Giter Site home page Giter Site logo

causalgan's Issues

Problem Running the Demo on the CPU

Hello Murat,

I tried to run the code using 0 GPUs, and it gave me errors on both BEGAN and DCGAN. I am not able to test on the default 1 GPU because I don't have any. Do you know what might be causing this?

The command I entered was the following:

python main.py --causal_model big_causal_graph --is_pretrain True --model_type dcgan --is_train True --num_gpu 0

And I got the following output:

C:\Users\kayan\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\dtypes.py:455: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\kayan\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\dtypes.py:456: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\kayan\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\dtypes.py:457: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\kayan\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\dtypes.py:458: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\kayan\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\dtypes.py:459: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\kayan\anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\framework\dtypes.py:462: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
tf: resetting default graph!
Loaded ./config.py
Loaded ./causal_controller/config.py
Loaded ./causal_dcgan/config.py
Loaded ./causal_began/config.py
saving config because load path not given
[] MODEL dir: logs\celebA_0728_103822
[
] PARAM path: logs\celebA_0728_103822\params.json
[] PARAM path: logs\celebA_0728_103822\cc_params.json
[
] PARAM path: logs\celebA_0728_103822\dcgan_params.json
[*] PARAM path: logs\celebA_0728_103822\began_params.json
setting up CausalController
causal graph size: 9
setting up data
setup pretrain
setting up pretrain: CausalController
causalcontroller has 58 summaries
WARNING:CausalGAN.rec_loss_coff= 0.0
Filling queue with 202 Celeb images before starting to train. I don't know how long this will take
2021-07-28 10:38:32.942722: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations.
2021-07-28 10:38:32.942937: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations.
2021-07-28 10:38:32.943087: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
2021-07-28 10:38:32.943198: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2021-07-28 10:38:32.943308: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2021-07-28 10:38:32.943489: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2021-07-28 10:38:32.944325: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2021-07-28 10:38:32.945032: W c:\tf_jenkins\home\workspace\release-win\device\cpu\os\windows\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
Traceback (most recent call last):
File "main.py", line 87, in
trainer=get_trainer()
File "main.py", line 74, in get_trainer
trainer=Trainer(config,cc_config,model_config)
File "C:\Users\kayan\OneDrive\Desktop\CausalGAN\trainer.py", line 95, in init
self.model.build_train_op()
File "C:\Users\kayan\OneDrive\Desktop\CausalGAN\causal_dcgan\CausalGAN.py", line 287, in build_train_op
.minimize(self.g_loss, var_list=self.g_vars)
AttributeError: 'CausalGAN' object has no attribute 'g_loss'

For the BEGAN, I ran:

python main.py --causal_model big_causal_graph --is_pretrain True --model_type began --is_train True --num_gpu 0

and got the following error:

C:\Users\kayan\anaconda3\envs\tf2\lib\site-packages\tensorflow\python\framework\dtypes.py:458: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint8 = np.dtype([("qint8", np.int8, 1)])
C:\Users\kayan\anaconda3\envs\tf2\lib\site-packages\tensorflow\python\framework\dtypes.py:459: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint8 = np.dtype([("quint8", np.uint8, 1)])
C:\Users\kayan\anaconda3\envs\tf2\lib\site-packages\tensorflow\python\framework\dtypes.py:460: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint16 = np.dtype([("qint16", np.int16, 1)])
C:\Users\kayan\anaconda3\envs\tf2\lib\site-packages\tensorflow\python\framework\dtypes.py:461: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_quint16 = np.dtype([("quint16", np.uint16, 1)])
C:\Users\kayan\anaconda3\envs\tf2\lib\site-packages\tensorflow\python\framework\dtypes.py:462: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
_np_qint32 = np.dtype([("qint32", np.int32, 1)])
C:\Users\kayan\anaconda3\envs\tf2\lib\site-packages\tensorflow\python\framework\dtypes.py:465: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
np_resource = np.dtype([("resource", np.ubyte, 1)])
tf: resetting default graph!
Loaded ./config.py
Loaded ./causal_controller/config.py
Loaded ./causal_dcgan/config.py
Loaded ./causal_began/config.py
saving config because load path not given
[] MODEL dir: logs\celebA_0728_100704
[
] PARAM path: logs\celebA_0728_100704\params.json
[] PARAM path: logs\celebA_0728_100704\cc_params.json
[
] PARAM path: logs\celebA_0728_100704\dcgan_params.json
[*] PARAM path: logs\celebA_0728_100704\began_params.json
setting up CausalController
causal graph size: 9
setting up data
setup pretrain
setting up pretrain: CausalController
causalcontroller has 58 summaries
Filling queue with 202 Celeb images before starting to train. I don't know how long this will take
2021-07-28 10:07:14.554201: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE instructions, but these are available on your machine and could speed up CPU computations.
2021-07-28 10:07:14.554405: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE2 instructions, but these are available on your machine and could speed up CPU computations.
2021-07-28 10:07:14.554999: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations.
2021-07-28 10:07:14.555208: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2021-07-28 10:07:14.555410: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2021-07-28 10:07:14.555604: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2021-07-28 10:07:14.555802: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2021-07-28 10:07:14.556000: W c:\tf_jenkins\home\workspace\release-win\m\windows\py\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
Traceback (most recent call last):
File "main.py", line 87, in
trainer=get_trainer()
File "main.py", line 74, in get_trainer
trainer=Trainer(config,cc_config,model_config)
File "C:\Users\kayan\OneDrive\Desktop\CausalGAN\trainer.py", line 95, in init
self.model.build_train_op()
File "C:\Users\kayan\OneDrive\Desktop\CausalGAN\causal_began\CausalBEGAN.py", line 278, in build_train_op
g_optim = self.g_optimizer.apply_gradients(g_grads, global_step=self.step)
File "C:\Users\kayan\anaconda3\envs\tf2\lib\site-packages\tensorflow\python\training\optimizer.py", line 423, in apply_gradients
raise ValueError("No variables provided.")
ValueError: No variables provided.

Undefined names can raise NameErrors at runtime

Undefined names can raise NameError at runtime.

flake8 testing of https://github.com/mkocaoglu/CausalGAN on Python 2.7.13

$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics

./causal_dcgan/utils.py:147:16: F821 undefined name 'x'
        return x.astype(np.uint8)
               ^
./causal_dcgan/utils.py:149:18: F821 undefined name 'x'
        return ((x+1)/2*255).astype(np.uint8)
                 ^
./figure_scripts/sample.py:157:51: F821 undefined name 'list_labels'
    for name, lab, dfl in zip(model.cc.node_names,list_labels,list_d_fake_labels):
                                                  ^
./figure_scripts/sample.py:157:63: F821 undefined name 'list_d_fake_labels'
    for name, lab, dfl in zip(model.cc.node_names,list_labels,list_d_fake_labels):
                                                              ^
./figure_scripts/sample.py:442:47: F821 undefined name 'nsamples'
            outputs[k]=np.vstack(outputs[k])[:nsamples]
                                              ^
./figure_scripts/sample.py:507:41: F821 undefined name 'nsamples'
                if len(completed_rows)>=nsamples:
                                        ^
./figure_scripts/sample.py:585:40: F821 undefined name 'nsamples'
                outputs[k]=outputs[k][:nsamples]
                                       ^
./figure_scripts/sample.py:592:32: F821 undefined name 'nsamples'
            values=outputs[k][:nsamples]
                               ^

can't execute the download.py

The download link of download.py can not work, could you provide a new download link of your dataset, which is trained by your code.

train a causal implicit model using multiple GPUs

Hi @mkocaoglu Murat, I try to first train a causal implicit model by using your source code. It ran well if using default one gpu. However, when I set more GPUs, e.g.
python main.py --causal_model big_causal_graph --is_pretrain True --num_gpu 8
I met the error as below. Please help me! Thanks a lot!

setting up pretrain: CausalController
Traceback (most recent call last):
File "main.py", line 89, in
trainer=get_trainer()
File "main.py", line 76, in get_trainer
trainer=Trainer(config,cc_config,model_config)
File "/home/qw/projects/CausalGAN/trainer.py", line 60, in init
self.cc.build_pretrain(label_queue)
File "/home/qw/projects/CausalGAN/causal_controller/CausalController.py", line 179, in build_pretrain
grad_cost,self.dcc_slopes=Grad_Penalty(real_inputs,fake_inputs,self.DCC,self.config)
File "/home/qw/projects/CausalGAN/causal_controller/models.py", line 45, in Grad_Penalty
interpolates = alpha*real_data + ((1-alpha)*fake_data)#Could do more if not fixed batch_size
File "/home/qw/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/ops/math_ops.py", line 866, in binary_op_wrapper
return func(x, y, name=name)
File "/home/qw/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/ops/math_ops.py", line 1131, in _mul_dispatch
return gen_math_ops.mul(x, y, name=name)
File "/home/qw/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/ops/gen_math_ops.py", line 5042, in mul
"Mul", x=x, y=y, name=name)
File "/home/qw/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/qw/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/util/deprecation.py", line 488, in new_func
return func(*args, **kwargs)
File "/home/qw/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3274, in create_op
op_def=op_def)
File "/home/qw/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1792, in init
control_input_ops)
File "/home/qw/anaconda3/envs/py27/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1631, in _create_c_op
raise ValueError(str(e))
ValueError: Dimensions must be equal, but are 16 and 128 for 'mul_1' (op: 'Mul') with input shapes: [16,1], [128,9].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.