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_example.sh does not run #1

Open
samleenz opened this issue Feb 28, 2022 · 0 comments
Open

run_example.sh does not run #1

samleenz opened this issue Feb 28, 2022 · 0 comments

Comments

@samleenz
Copy link

Hi -- I was hoping to test out this method but I'm having some trouble getting it working unfortunately.

After creating a fresh conda (as below) I've tried running the example script but unfortunately it's throwing an error -- which I've pasted the output of below. (I changed the path /storage/zhang/mfMap.py in the source code as needed to the equivalent on my machine)

I'm not super familiar with python code so do you have any tips on how I can get this to run?

Thanks,
Sam


conda create --name mfmap -c pytorch -c conda-forge \
  pytorch \
  numpy \
  pandas \
  scikit-learn \
  tensorflow

conda activate mfmap
(mfmap) ###@### mfMap.py % bash run_example.sh
Number of parameters: 4705052

SUPERVISED

(1, 1)
0.001
best train acc:0
best train er:inf
best validation acc:0
Number of parameters: 4705052

SUPERVISED

(1, 1)
0.001
best train acc:0
best train er:inf
best validation acc:0
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/multiprocessing/spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/multiprocessing/spawn.py", line 125, in _main
    prepare(preparation_data)
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/multiprocessing/spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/multiprocessing/spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/runpy.py", line 268, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/###/git/mfMap.py/mfMAP_cpu.py", line 653, in <module>
    run_train()
  File "/Users/###/git/mfMap.py/mfMAP_cpu.py", line 502, in run_train
    train_accuracy,train_total_loss_ave,train_classifier_er_ave=train(e_index=epoch_index, e_num=FLAGS.p1_epoch_num+FLAGS.p2_epoch_num,k_cnv_recon=c1,k_expr_recon=c1, k_kl=c1,k_hbc=c2)
  File "/Users/###/git/mfMap.py/mfMAP_cpu.py", line 332, in train
    for batch_index, sample in enumerate(train_loader):
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 359, in __iter__
    return self._get_iterator()
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 305, in _get_iterator
    return _MultiProcessingDataLoaderIter(self)
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/site-packages/torch/utils/data/dataloader.py", line 918, in __init__
    w.start()
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/multiprocessing/context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/multiprocessing/context.py", line 284, in _Popen
    return Popen(process_obj)
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/multiprocessing/popen_spawn_posix.py", line 42, in _launch
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/multiprocessing/spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "/Users/###/miniconda3/envs/mfmap/lib/python3.9/multiprocessing/spawn.py", line 134, in _check_not_importing_main
    raise RuntimeError('''
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.
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

1 participant