styleGAN2 MemoryError: Unable to allocate 0 bytes for an array with shape (1073741824, 0)

错误信息

Traceback (most recent call last):
  File "C:/Users/78753/Desktop/stylegan2encoder/project_images.py", line 129, in <module>
    main()
  File "C:/Users/78753/Desktop/stylegan2encoder/project_images.py", line 118, in main
    project_image(proj, src_file, args.dst_dir, args.tmp_dir, video=args.video)
  File "C:/Users/78753/Desktop/stylegan2encoder/project_images.py", line 30, in project_image
    max_label_size=0, repeat=False, shuffle_mb=0
  File "C:\Users\78753\Desktop\stylegan2encoder\training\dataset.py", line 192, in load_dataset
    dataset = dnnlib.util.get_obj_by_name(class_name)(**kwargs)
  File "C:\Users\78753\Desktop\stylegan2encoder\training\dataset.py", line 86, in __init__
    self._np_labels = np.zeros([1<<30, 0], dtype=np.float32)
MemoryError: Unable to allocate 0 bytes for an array with shape (1073741824, 0) and data type float32

Process finished with exit code 1

发现./training/dataset.py这里居然要

self._np_labels = np.zeros([1<<30, 0], dtype=np.float32)

1<<30 == 1073741824 == 1G
我内存挺紧张的,禁不起这么几下.
1<<30 改成 1<<20 (styleGAN1 就是这样的)

self._np_labels = np.zeros([1<<20, 0], dtype=np.float32)

就能跑动了,好像也没什么副作用?

你可能感兴趣的:(debug)