automl / Auto-PyTorch

Automatic architecture search and hyperparameter optimization for PyTorch
Apache License 2.0
2.37k stars 287 forks source link

error in running examples/basics/regression.py #65

Closed 2533245542 closed 3 years ago

2533245542 commented 4 years ago

I was able to run the classification.py but when running regression.py, the below error message showed up.

19:46:25 WORKER: start listening for jobs
19:46:25 [AutoNet] Start bohb
19:46:25 DISPATCHER: started the 'discover_worker' thread
19:46:25 DISPATCHER: started the 'job_runner' thread
19:46:25 DISPATCHER: Pyro daemon running on 10.19.209.113:51310
19:46:25 DISPATCHER: discovered new worker, hpbandster.run_0.worker.MacBook-Pro-3.local.1825.-14446031296
19:46:25 HBMASTER: starting run at 1598582785.601034
19:46:25 HBMASTER: adjusted queue size to (0, 1)
19:46:25 WORKER: start processing job (0, 0, 0)
/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/site-packages/sklearn/utils/deprecation.py:143: FutureWarning: The sklearn.ensemble.forest module is  deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.ensemble. Anything that cannot be imported from sklearn.ensemble is now part of the private API.
  warnings.warn(message, FutureWarning)
/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/site-packages/sklearn/utils/deprecation.py:143: FutureWarning: The sklearn.metrics.classification module is  deprecated in version 0.22 and will be removed in version 0.24. The corresponding classes / functions should instead be imported from sklearn.metrics. Anything that cannot be imported from sklearn.metrics is now part of the private API.
  warnings.warn(message, FutureWarning)
19:46:27 WORKER: start listening for jobs
19:46:27 [AutoNet] Start bohb
19:46:27 DISPATCHER: started the 'discover_worker' thread
19:46:27 DISPATCHER: started the 'job_runner' thread
19:46:27 DISPATCHER: Pyro daemon running on 10.19.209.113:51319
19:46:27 DISPATCHER: discovered new worker, hpbandster.run_0.worker.MacBook-Pro-3.local.1830.-14677414336
19:46:27 HBMASTER: adjusted queue size to (0, 1)
19:46:27 DISPATCHER: A new worker triggered discover_worker
19:46:27 HBMASTER: starting run at 1598582787.894285
19:46:27 WORKER: start processing job (0, 0, 0)
19:46:27 WORKER: registered result for job (0, 0, 0) with dispatcher
19:46:27 job (0, 0, 0) failed with exception
Traceback (most recent call last):
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/site-packages/hpbandster/core/worker.py", line 206, in start_computation
    result = {'result': self.compute(*args, config_id=id, **kwargs),
  File "/Users/wzhou87/Desktop/covidProject/auto-pytorch/Auto-PyTorch/autoPyTorch/core/worker.py", line 77, in compute
    result = limit_train(config, config_id, budget, start_time)
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/site-packages/pynisher/limit_function_call.py", line 195, in __call__
    subproc.start()
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/multiprocessing/context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/multiprocessing/context.py", line 284, in _Popen
    return Popen(process_obj)
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 42, in _launch
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/multiprocessing/spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/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.
19:46:27 WORKER: start processing job (0, 0, 1)
19:46:27 WORKER: registered result for job (0, 0, 1) with dispatcher
19:46:27 job (0, 0, 1) failed with exception
Traceback (most recent call last):
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/site-packages/hpbandster/core/worker.py", line 206, in start_computation
    result = {'result': self.compute(*args, config_id=id, **kwargs),
  File "/Users/wzhou87/Desktop/covidProject/auto-pytorch/Auto-PyTorch/autoPyTorch/core/worker.py", line 77, in compute
    result = limit_train(config, config_id, budget, start_time)
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/site-packages/pynisher/limit_function_call.py", line 195, in __call__
    subproc.start()
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/multiprocessing/process.py", line 121, in start
    self._popen = self._Popen(self)
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/multiprocessing/context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/multiprocessing/context.py", line 284, in _Popen
    return Popen(process_obj)
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 32, in __init__
    super().__init__(process_obj)
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/multiprocessing/popen_fork.py", line 19, in __init__
    self._launch(process_obj)
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/multiprocessing/popen_spawn_posix.py", line 42, in _launch
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/multiprocessing/spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "/Users/wzhou87/anaconda3/envs/AutoPyTorch/lib/python3.8/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.
19:46:27 WORKER: start processing job (0, 0, 2)
19:46:27 WORKER: registered result for job (0, 0, 2) with dispatcher
19:46:27 job (0, 0, 2) failed with exception
...the same freeze_support() error repeats...
2533245542 commented 4 years ago

well, setting

autonet = AutoNetRegression(budget_type='epochs', min_budget=1, max_budget=9, num_iterations=1, log_level='info')

to

autonet = AutoNetRegression("tiny_cs", budget_type='epochs', min_budget=1, max_budget=9, num_iterations=1, log_level='debug', use_pynisher=False)

and it is runnable now (use the same argument as in classification.py).