Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing the edge-connect model in Windows 10 #168

Open
Sicily-F opened this issue Jan 25, 2021 · 2 comments
Open

Executing the edge-connect model in Windows 10 #168

Sicily-F opened this issue Jan 25, 2021 · 2 comments

Comments

@Sicily-F
Copy link

Sicily-F commented Jan 25, 2021

Hi there,

Has anyone run the train.py file in Windows 10?

I keep getting the following traceback:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "train.py", line 2, in <module>
    main(mode=1)
  File "C:\Users\Sicily\edge-connect\main.py", line 56, in main
  File "D:\Anaconda\lib\multiprocessing\spawn.py", line 105, in spawn_main
    model.train()
exitcode = _main(fd)  File "C:\Users\Sicily\edge-connect\src\edge_connect.py", line 98, in train

      File "D:\Anaconda\lib\multiprocessing\spawn.py", line 114, in _main
for items in train_loader:
prepare(preparation_data)  File "D:\Anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 352, in __iter__

  File "D:\Anaconda\lib\multiprocessing\spawn.py", line 225, in prepare
        return self._get_iterator()_fixup_main_from_path(data['init_main_from_path'])

  File "D:\Anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 294, in _get_iterator
  File "D:\Anaconda\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
        return _MultiProcessingDataLoaderIter(self)run_name="__mp_main__")

  File "D:\Anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 801, in __init__
  File "D:\Anaconda\lib\runpy.py", line 263, in run_path
    w.start()
pkg_name=pkg_name, script_name=fname)  File "D:\Anaconda\lib\multiprocessing\process.py", line 112, in start

  File "D:\Anaconda\lib\runpy.py", line 96, in _run_module_code
        self._popen = self._Popen(self)mod_name, mod_spec, pkg_name, script_name)
  File "D:\Anaconda\lib\multiprocessing\context.py", line 223, in _Popen

      File "D:\Anaconda\lib\runpy.py", line 85, in _run_code
return _default_context.get_context().Process._Popen(process_obj)
  File "D:\Anaconda\lib\multiprocessing\context.py", line 322, in _Popen
exec(code, run_globals)
return Popen(process_obj)  File "C:\Users\Sicily\edge-connect\train.py", line 2, in <module>

      File "D:\Anaconda\lib\multiprocessing\popen_spawn_win32.py", line 65, in __init__
main(mode=1)
reduction.dump(process_obj, to_child)  File "C:\Users\Sicily\edge-connect\main.py", line 56, in main

      File "D:\Anaconda\lib\multiprocessing\reduction.py", line 60, in dump
model.train()
  File "C:\Users\Sicily\edge-connect\src\edge_connect.py", line 98, in train
    ForkingPickler(file, protocol).dump(obj)
for items in train_loader:BrokenPipeError
:   File "D:\Anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 352, in __iter__
[Errno 32] Broken pipe
return self._get_iterator()
  File "D:\Anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 294, in _get_iterator
    return _MultiProcessingDataLoaderIter(self)
  File "D:\Anaconda\lib\site-packages\torch\utils\data\dataloader.py", line 801, in __init__
    w.start()
  File "D:\Anaconda\lib\multiprocessing\process.py", line 112, in start
    self._popen = self._Popen(self)
  File "D:\Anaconda\lib\multiprocessing\context.py", line 223, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "D:\Anaconda\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "D:\Anaconda\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "D:\Anaconda\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
    _check_not_importing_main()
  File "D:\Anaconda\lib\multiprocessing\spawn.py", line 136, in _check_not_importing_main
    is not going to be frozen to produce an executable.''')
RuntimeError:
        An attempt has been made to start a new process before the
        current process has finished its bootstrapping phase.

        This probably means that you are not using fork to start your
        child processes and you have forgotten to use the proper idiom
        in the main module:

            if __name__ == '__main__':
                freeze_support()
                ...

        The "freeze_support()" line can be omitted if the program
        is not going to be frozen to produce an executable

I tried placing this code at the beginning

if __name__ == "__main__":
    
    main()

And then indenting everything else below it in the main.py file. However, this also doesn't work, does anyone have any other workarounds they could suggest?

I would be forever grateful!

@vladsterz
Copy link

I hope you have figured it out by now, but for future visitors
change train.py from

from main import main
main(mode=1)

to

from main import main
if __name__ == "__main__":
    main(mode=1)

@01SHENyankun
Copy link

你好,不知这个问题拟解决了吗,我试着按上面那个评论改,结果又出来了其他错误

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants