lucidrains / stylegan2-pytorch

Simplest working implementation of Stylegan2, state of the art generative adversarial network, in Pytorch. Enabling everyone to experience disentanglement
https://thispersondoesnotexist.com
MIT License
3.7k stars 585 forks source link

AttributeError: module '__main__' has no attribute '__spec__' #126

Open Zenahr opened 4 years ago

Zenahr commented 4 years ago
  1. Installed all dependencies.
  2. Ran following command within a folder in which 2 .jpg image files reside: stylegan2_pytorch --data .

Any pointers?

stacktrace:

$ stylegan2_pytorch --data .
default<.>:   0%|          | 0/150000 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "C:/Python38/Scripts/stylegan2_pytorch", line 4, in <module>
    __import__('pkg_resources').run_script('stylegan2-pytorch==0.21.0', 'stylegan2_pytorch')
  File "C:\Python38\lib\site-packages\pkg_resources\__init__.py", line 666, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "C:\Python38\lib\site-packages\pkg_resources\__init__.py", line 1469, in run_script
    exec(script_code, namespace, namespace)
  File "C:\Python38\lib\site-packages\stylegan2_pytorch-0.21.0-py3.8.egg\EGG-INFO\scripts\stylegan2_pytorch", line 96, in <module>
  File "C:\Python38\lib\site-packages\fire\core.py", line 138, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
  File "C:\Python38\lib\site-packages\fire\core.py", line 463, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
  File "C:\Python38\lib\site-packages\fire\core.py", line 672, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
  File "C:\Python38\lib\site-packages\stylegan2_pytorch-0.21.0-py3.8.egg\EGG-INFO\scripts\stylegan2_pytorch", line 91, in train_from_folder
  File "C:\Python38\lib\site-packages\retry\api.py", line 101, in retry_call
    return __retry_internal(partial(f, *args, **kwargs), exceptions, tries, delay, max_delay, backoff, jitter, logger)
  File "C:\Python38\lib\site-packages\retry\api.py", line 33, in __retry_internal
    return f()
  File "C:\Python38\lib\site-packages\stylegan2_pytorch-0.21.0-py3.8.egg\stylegan2_pytorch\stylegan2_pytorch.py", line 788, in train
  File "C:\Python38\lib\site-packages\stylegan2_pytorch-0.21.0-py3.8.egg\stylegan2_pytorch\stylegan2_pytorch.py", line 113, in cycle
  File "C:\Python38\lib\site-packages\torch\utils\data\dataloader.py", line 291, in __iter__
    return _MultiProcessingDataLoaderIter(self)
  File "C:\Python38\lib\site-packages\torch\utils\data\dataloader.py", line 737, in __init__
    w.start()
  File "C:\Python38\lib\multiprocessing\process.py", line 121, in start
    self._popen = self._Popen(self)
  File "C:\Python38\lib\multiprocessing\context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "C:\Python38\lib\multiprocessing\context.py", line 326, in _Popen
    return Popen(process_obj)
  File "C:\Python38\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\Python38\lib\multiprocessing\spawn.py", line 183, in get_preparation_data
    main_mod_name = getattr(main_module.__spec__, "name", None)
AttributeError: module '__main__' has no attribute '__spec__'
lucidrains commented 3 years ago

@Zenahr Hi! Would you like to give v1.0 a try? It may have been how I had packaged the script

Zenahr commented 3 years ago

yeah I'll give it a try right now.