Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I keep getting an Assertion Error with StyleGAN

Recently I have been playing around with StyleGAN and I have generated a dataset but I get the following when I try to run train.py.

2020-01-08 13:33:21.943217: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:34: The name tf.Dimension is deprecated. Please use tf.compat.v1.Dimension instead.

WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:74: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.

WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:128: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

Creating the run dir: results\00003-sgan-datasets-1gpu
Copying files to the run dir
dnnlib: Running training.training_loop.training_loop() on localhost...
WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:97: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.

WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:109: The name tf.set_random_seed is deprecated. Please use tf.compat.v1.set_random_seed instead.

WARNING:tensorflow:From C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\tflib\tfutil.py:132: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

2020-01-08 13:33:23.904828: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-01-08 13:33:23.913674: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-01-08 13:33:23.945149: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties:
name: GeForce GTX 1660 Ti major: 7 minor: 5 memoryClockRate(GHz): 1.59
pciBusID: 0000:01:00.0
2020-01-08 13:33:23.951080: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
2020-01-08 13:33:23.957540: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_100.dll
2020-01-08 13:33:23.964398: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_100.dll
2020-01-08 13:33:23.968829: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_100.dll
2020-01-08 13:33:23.975979: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_100.dll
2020-01-08 13:33:23.983341: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_100.dll
2020-01-08 13:33:23.997908: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2020-01-08 13:33:24.002421: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2020-01-08 13:33:24.657141: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-01-08 13:33:24.661322: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165]      0
2020-01-08 13:33:24.663568: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0:   N
2020-01-08 13:33:24.667420: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4627 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1660 Ti, pci bus id: 0000:01:00.0, compute capability: 7.5)
Streaming data using training.dataset.TFRecordDataset...
Traceback (most recent call last):
  File "train.py", line 190, in <module>
    main()
  File "train.py", line 185, in main
    dnnlib.submit_run(**kwargs)
  File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\submission\submit.py", line 290, in submit_run
    run_wrapper(submit_config)
  File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\submission\submit.py", line 242, in run_wrapper
    util.call_func_by_name(func_name=submit_config.run_func_name, submit_config=submit_config, **submit_config.run_func_kwargs)
  File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\dnnlib\util.py", line 257, in call_func_by_name
    return func_obj(*args, **kwargs)
  File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\training\training_loop.py", line 146, in training_loop
    training_set = dataset.load_dataset(data_dir=config.data_dir, verbose=True, **dataset_args)
  File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\training\dataset.py", line 234, in load_dataset
    dataset = dnnlib.util.get_obj_by_name(class_name)(**adjusted_kwargs)
  File "C:\Users\MyName\Desktop\StyleGan\stylegan-master\training\dataset.py", line 70, in __init__
    assert os.path.isdir(self.tfrecord_dir)
AssertionError

I am still very unfamiliar with StyleGAN and any advice would be helpful. I have already modified the Train.py file to accommodate my single GPU and the dataset directory.

like image 317
Peter S Avatar asked Jan 08 '20 21:01

Peter S


2 Answers

If anyone else has this issue, make sure that your dataset is in a directory called datasets.

like image 167
jzisawesome Avatar answered Nov 09 '22 04:11

jzisawesome


As answered by @Chrispresso in the comments of this question, the directory that I was referencing in the following line was invalid and had to set it to a valid directory.

# Dataset.
    desc += '-dataset';     dataset = EasyDict(tfrecord_dir='dataset', resolution=128); train.mirror_augment = False

(this is in line #36 in the train.py that is included in StyleGAN)

like image 2
Peter S Avatar answered Nov 09 '22 02:11

Peter S