ak9250 / stylegan-art

train stylegan through transfer learning
Other
371 stars 78 forks source link

Assertion Error in the training/dataset.py file #3

Closed Horopter closed 5 years ago

Horopter commented 5 years ago

In the colab file https://colab.research.google.com/drive/1PSxULp-yjAYaxebswSSaQMtYLQhHEv5C

I get this error. Please let me know what to do.

Creating the run dir root: results
Creating the run dir: results/00000-sgan-custom-1gpu
Copying files to the run dir
dnnlib: Running training.training_loop.training_loop() on localhost...
Streaming data using training.dataset.TFRecordDataset...
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-21-9d49b7c69853> in <module>()
    187 
    188 if __name__ == "__main__":
--> 189     main()
    190 
    191 #----------------------------------------------------------------------------

<ipython-input-21-9d49b7c69853> in main()
    182     kwargs.submit_config.run_dir_ignore += config.run_dir_ignore
    183     kwargs.submit_config.run_desc = desc
--> 184     dnnlib.submit_run(**kwargs)
    185 
    186 #----------------------------------------------------------------------------

/content/stylegan/dnnlib/submission/submit.py in submit_run(submit_config, run_func_name, **run_func_kwargs)
    288             return
    289 
--> 290     run_wrapper(submit_config)

/content/stylegan/dnnlib/submission/submit.py in run_wrapper(submit_config)
    240         print("dnnlib: Running {0}() on {1}...".format(submit_config.run_func_name, submit_config.host_name))
    241         start_time = time.time()
--> 242         util.call_func_by_name(func_name=submit_config.run_func_name, submit_config=submit_config, **submit_config.run_func_kwargs)
    243         print("dnnlib: Finished {0}() in {1}.".format(submit_config.run_func_name, util.format_time(time.time() - start_time)))
    244     except:

/content/stylegan/dnnlib/util.py in call_func_by_name(func_name, *args, **kwargs)
    255     func_obj = get_obj_by_name(func_name)
    256     assert callable(func_obj)
--> 257     return func_obj(*args, **kwargs)
    258 
    259 

/content/stylegan/training/training_loop.py in training_loop(submit_config, G_args, D_args, G_opt_args, D_opt_args, G_loss_args, D_loss_args, dataset_args, sched_args, grid_args, metric_arg_list, tf_config, G_smoothing_kimg, D_repeats, minibatch_repeats, reset_opt_for_new_lod, total_kimg, mirror_augment, drange_net, image_snapshot_ticks, network_snapshot_ticks, save_tf_graph, save_weight_histograms, resume_run_id, resume_snapshot, resume_kimg, resume_time)
    144 
    145     # Load training set.
--> 146     training_set = dataset.load_dataset(data_dir=config.data_dir, verbose=True, **dataset_args)
    147 
    148     # Construct networks.

/content/stylegan/training/dataset.py in load_dataset(class_name, data_dir, verbose, **kwargs)
    232     if verbose:
    233         print('Streaming data using %s...' % class_name)
--> 234     dataset = dnnlib.util.get_obj_by_name(class_name)(**adjusted_kwargs)
    235     if verbose:
    236         print('Dataset shape =', np.int32(dataset.shape).tolist())

/content/stylegan/training/dataset.py in __init__(self, tfrecord_dir, resolution, label_file, max_label_size, repeat, shuffle_mb, prefetch_mb, buffer_mb, num_threads)
     68 
     69         # List tfrecords files and inspect their shapes.
---> 70         assert os.path.isdir(self.tfrecord_dir)
     71         tfr_files = sorted(glob.glob(os.path.join(self.tfrecord_dir, '*.tfrecords')))
     72         assert len(tfr_files) >= 1

AssertionError:
ak9250 commented 5 years ago

one thing i noticed is that you are using tpu, I tested it on gpu and you have the network-snapshot saved under /content/network-snapshot instead of /content/stylegan/network-snapshot, also only run process() or p.sample()

ak9250 commented 5 years ago

i just tested it here and it works now, I think you had your dir mixed up so I deleted some of those commands https://colab.research.google.com/drive/1YhimHNrOOEXknO4okgiAf5orpofAstzx