auto_sklearn autosklearn AttributeError: 'NoneType' object has no attribute 'info'

发布时间 2023-10-08 17:55:26作者: emanlee

 

 
Traceback (most recent call last):
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/site-packages/autosklearn/automl.py", line 634, in fit
    self._logger = self._get_logger(dataset_name)
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/site-packages/autosklearn/automl.py", line 390, in _get_logger
    self.logging_server.start()
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/multiprocessing/process.py", line 112, in start
    self._popen = self._Popen(self)
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/multiprocessing/context.py", line 291, in _Popen
    return Popen(process_obj)
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/multiprocessing/popen_forkserver.py", line 35, in __init__
    super().__init__(process_obj)
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/multiprocessing/popen_fork.py", line 20, in __init__
    self._launch(process_obj)
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/multiprocessing/popen_forkserver.py", line 42, in _launch
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/multiprocessing/spawn.py", line 143, in get_preparation_data
    _check_not_importing_main()
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/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.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/site-packages/autosklearn/automl.py", line 961, in fit
    self._logger.exception(e)
AttributeError: 'NoneType' object has no attribute 'exception'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/multiprocessing/forkserver.py", line 281, in main
    old_handlers)
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/multiprocessing/forkserver.py", line 317, in _serve_one
    code = spawn._main(child_r)
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/multiprocessing/spawn.py", line 114, in _main
    prepare(preparation_data)
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/multiprocessing/spawn.py", line 225, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/multiprocessing/spawn.py", line 277, in _fixup_main_from_path
    run_name="__mp_main__")
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/runpy.py", line 263, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/data/pigenhancer/transformer_test/auto_sklearn_demo01_iris_classification.py", line 34, in <module>
    model.fit(X_train, y_train)# 预测并计算准确率得分
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/site-packages/autosklearn/estimators.py", line 1454, in fit
    dataset_name=dataset_name,
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/site-packages/autosklearn/estimators.py", line 540, in fit
    self.automl_.fit(load_models=self.load_models, **kwargs)
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/site-packages/autosklearn/automl.py", line 2313, in fit
    is_classification=True,
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/site-packages/autosklearn/automl.py", line 964, in fit
    self._fit_cleanup()
  File "/home/software/anaconda3/envs/bert_env/lib/python3.7/site-packages/autosklearn/automl.py", line 1064, in _fit_cleanup
    self._logger.info("Closing the dask infrastructure")
AttributeError: 'NoneType' object has no attribute 'info'

 

 print("Precision", sklearn.metrics.precision_score(y_test, predictions))

ValueError: Target is multiclass but average='binary'. Please choose another average setting, one of [None, 'micro', 'macro', 'weighted'].