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

run mainpro_FER.py report an error. I can't solve. Please help me, thanks! #12

Closed
dingmingdu opened this issue Oct 10, 2018 · 5 comments

Comments

@dingmingdu
Copy link

==> Preparing data..
==> Building model..

Epoch: 0
learning_rate: 0.01
Traceback (most recent call last):
File "C:/Users/Du/Desktop/a program/python/CCC/mainpro_FER.py", line 218, in
train(epoch)
File "C:/Users/Du/Desktop/a program/python/CCC/mainpro_FER.py", line 110, in train
for batch_idx, (inputs, targets) in enumerate(trainloader):
File "C:\A\envs\tensorflow-gpu\lib\site-packages\torch\utils\data\dataloader.py", line 501, in iter
return _DataLoaderIter(self)
File "C:\A\envs\tensorflow-gpu\lib\site-packages\torch\utils\data\dataloader.py", line 289, in init
w.start()
File "C:\A\envs\tensorflow-gpu\lib\multiprocessing\process.py", line 105, in start
self._popen = self._Popen(self)
File "C:\A\envs\tensorflow-gpu\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\A\envs\tensorflow-gpu\lib\multiprocessing\context.py", line 322, in Popen
return Popen(process_obj)
File "C:\A\envs\tensorflow-gpu\lib\multiprocessing\popen_spawn_win32.py", line 65, in init
reduction.dump(process_obj, to_child)
File "C:\A\envs\tensorflow-gpu\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)
TypeError: can't pickle h5py.h5f.FileID objects
C:\A\envs\tensorflow-gpu\lib\site-packages\h5py_init
.py:34: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
==> Preparing data..
==> Building model..

Epoch: 0
learning_rate: 0.01
Traceback (most recent call last):
File "", line 1, in
File "C:\A\envs\tensorflow-gpu\lib\multiprocessing\spawn.py", line 105, in spawn_main
exitcode = _main(fd)
File "C:\A\envs\tensorflow-gpu\lib\multiprocessing\spawn.py", line 114, in _main
prepare(preparation_data)
File "C:\A\envs\tensorflow-gpu\lib\multiprocessing\spawn.py", line 225, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "C:\A\envs\tensorflow-gpu\lib\multiprocessing\spawn.py", line 277, in _fixup_main_from_path
run_name="mp_main")
File "C:\A\envs\tensorflow-gpu\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "C:\A\envs\tensorflow-gpu\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\A\envs\tensorflow-gpu\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Du\Desktop\a program\python\CCC\mainpro_FER.py", line 218, in
train(epoch)
File "C:\Users\Du\Desktop\a program\python\CCC\mainpro_FER.py", line 110, in train
for batch_idx, (inputs, targets) in enumerate(trainloader):
File "C:\A\envs\tensorflow-gpu\lib\site-packages\torch\utils\data\dataloader.py", line 501, in iter
return _DataLoaderIter(self)
File "C:\A\envs\tensorflow-gpu\lib\site-packages\torch\utils\data\dataloader.py", line 289, in init
w.start()
File "C:\A\envs\tensorflow-gpu\lib\multiprocessing\process.py", line 105, in start
self._popen = self._Popen(self)
File "C:\A\envs\tensorflow-gpu\lib\multiprocessing\context.py", line 223, in _Popen
return _default_context.get_context().Process._Popen(process_obj)
File "C:\A\envs\tensorflow-gpu\lib\multiprocessing\context.py", line 322, in _Popen
return Popen(process_obj)
File "C:\A\envs\tensorflow-gpu\lib\multiprocessing\popen_spawn_win32.py", line 33, in init
prep_data = spawn.get_preparation_data(process_obj._name)
File "C:\A\envs\tensorflow-gpu\lib\multiprocessing\spawn.py", line 143, in get_preparation_data
_check_not_importing_main()
File "C:\A\envs\tensorflow-gpu\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.
@WuJie1010
Copy link
Owner

Are you running this code in window?
please use "if name == ‘main’:" for multiprocessing in window!

@JunfengZZZZhou
Copy link

I'm sorry I'm new to these things. So I want to ask where to add "if name == ‘main’:" ? which file and which line? Thank you!

@ice-llz
Copy link

ice-llz commented Dec 19, 2019

I'm sorry I'm new to these things. So I want to ask where to add "if name == ‘main’:" ? which file and which line? Thank you!
I am sorry, have you sovled this problem? I face the same problem.

@deepak-kumar-guntupu
Copy link

Are you running this code in window?
please use "if name == ‘main’:" for multiprocessing in window!

Where to add "if name == ‘main' ?

@ice-llz
Copy link

ice-llz commented Feb 20, 2020

Are you running this code in window?
please use "if name == ‘main’:" for multiprocessing in window!

Where to add "if name == ‘main' ?

I use local code to run this project. And finally I also cannot get my expect results. So I choose other projects

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

5 participants