首页 > 其他分享 >An attempt has been made to start a new process before the current process has finished its bootstra

An attempt has been made to start a new process before the current process has finished its bootstra

时间:2023-05-30 09:00:12浏览次数:50  
标签:made attempt lib Anaconda3 process Eprogramfiles py File line

 

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "E:\Eprogramfiles\Anaconda3\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "E:\Eprogramfiles\Anaconda3\lib\multiprocessing\spawn.py", line 125, in _main
    prepare(preparation_data)
  File "E:\Eprogramfiles\Anaconda3\lib\multiprocessing\spawn.py", line 236, in prepare
    _fixup_main_from_path(data['init_main_from_path'])
  File "E:\Eprogramfiles\Anaconda3\lib\multiprocessing\spawn.py", line 287, in _fixup_main_from_path
    main_content = runpy.run_path(main_path,
  File "E:\Eprogramfiles\Anaconda3\lib\runpy.py", line 265, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "E:\Eprogramfiles\Anaconda3\lib\runpy.py", line 97, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "E:\Eprogramfiles\Anaconda3\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "E:\other\lightvit\bert_test_demo01.py", line 100, in <module>
    for i, batch in enumerate(train):
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 359, in __iter__
    return self._get_iterator()
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 305, in _get_iterator
    return _MultiProcessingDataLoaderIter(self)
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\torch\utils\data\dataloader.py", line 918, in __init__
    w.start()
  File "E:\Eprogramfiles\Anaconda3\lib\multiprocessing\process.py", line 121, in start
    self._popen = self._Popen(self)
  File "E:\Eprogramfiles\Anaconda3\lib\multiprocessing\context.py", line 224, in _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "E:\Eprogramfiles\Anaconda3\lib\multiprocessing\context.py", line 327, in _Popen
    return Popen(process_obj)
  File "E:\Eprogramfiles\Anaconda3\lib\multiprocessing\popen_spawn_win32.py", line 45, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "E:\Eprogramfiles\Anaconda3\lib\multiprocessing\spawn.py", line 154, in get_preparation_data
    _check_not_importing_main()
  File "E:\Eprogramfiles\Anaconda3\lib\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.

 

报错的原因
linux系统中可以使用多个子进程加载数据,windows系统里是不可以的,  num_workers的设置,设置为0或者采用默认为0的设置。

 

===========================================================

E:\Eprogramfiles\Anaconda3\python.exe E:/other/lightvit/bert_test_demo01.py
'HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /bert-base-chinese/resolve/main/tokenizer_config.json (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000024FA9894370>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')))' thrown while requesting HEAD https://huggingface.co/bert-base-chinese/resolve/main/tokenizer_config.json
Traceback (most recent call last):
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\urllib3\connection.py", line 159, in _new_conn
    conn = connection.create_connection(
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\urllib3\util\connection.py", line 84, in create_connection
    raise err
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\urllib3\util\connection.py", line 74, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 667, in urlopen
    self._prepare_proxy(conn)
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 932, in _prepare_proxy
    conn.connect()
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\urllib3\connection.py", line 309, in connect
    conn = self._new_conn()
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\urllib3\connection.py", line 171, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x0000024FA9894370>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\urllib3\connectionpool.py", line 726, in urlopen
    retries = retries.increment(
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\urllib3\util\retry.py", line 446, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /bert-base-chinese/resolve/main/tokenizer_config.json (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000024FA9894370>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:/other/lightvit/bert_test_demo01.py", line 72, in <module>
    train = Data.DataLoader(dataset=MyDataset(sentences, labels), batch_size=batch_size, shuffle=True, num_workers=1)
  File "E:/other/lightvit/bert_test_demo01.py", line 44, in __init__
    self.tokenizer = AutoTokenizer.from_pretrained(model)
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\transformers\models\auto\tokenization_auto.py", line 643, in from_pretrained
    tokenizer_config = get_tokenizer_config(pretrained_model_name_or_path, **kwargs)
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\transformers\models\auto\tokenization_auto.py", line 487, in get_tokenizer_config
    resolved_config_file = cached_file(
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\transformers\utils\hub.py", line 417, in cached_file
    resolved_file = hf_hub_download(
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\huggingface_hub\utils\_validators.py", line 120, in _inner_fn
    return fn(*args, **kwargs)
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\huggingface_hub\file_download.py", line 1195, in hf_hub_download
    metadata = get_hf_file_metadata(
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\huggingface_hub\utils\_validators.py", line 120, in _inner_fn
    return fn(*args, **kwargs)
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\huggingface_hub\file_download.py", line 1532, in get_hf_file_metadata
    r = _request_wrapper(
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\huggingface_hub\file_download.py", line 407, in _request_wrapper
    response = _request_wrapper(
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\huggingface_hub\file_download.py", line 442, in _request_wrapper
    return http_backoff(
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\huggingface_hub\utils\_http.py", line 228, in http_backoff
    raise err
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\huggingface_hub\utils\_http.py", line 212, in http_backoff
    response = session.request(method=method, url=url, **kwargs)
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\requests\sessions.py", line 530, in request
    resp = self.send(prep, **send_kwargs)
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\requests\sessions.py", line 643, in send
    r = adapter.send(request, **kwargs)
  File "E:\Eprogramfiles\Anaconda3\lib\site-packages\requests\adapters.py", line 510, in send
    raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /bert-base-chinese/resolve/main/tokenizer_config.json (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x0000024FA9894370>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it')))

Process finished with exit code 1

 

解决方法:FQ
=============================================

 

 

=============================================

 

 

 

=============================================

 

标签:made,attempt,lib,Anaconda3,process,Eprogramfiles,py,File,line
From: https://www.cnblogs.com/emanlee/p/17442075.html

相关文章

  • Unity的AssetPostprocessor之Model:深入解析与实用案例 1
    UnityAssetPostprocessor模型相关函数详解在Unity中,AssetPostprocessor是一个非常有用的工具,它可以在导入资源时自动执行一些操作。在本文中,我们将重点介绍AssetPostprocessor中与模型相关的函数,并提供多个使用例子。OnPostprocessModelOnPostprocessModel是AssetPostprocessor......
  • Unity的IUnityLinkerProcessor:深入解析与实用案例
    UnityIUnityLinkerProcessorUnityIUnityLinkerProcessor是Unity引擎中的一个接口,它允许开发者在Unity项目构建时对代码进行链接处理。这个接口可以用来优化项目构建大小,减少不必要的代码和资源,提高项目的性能和加载速度。接口定义IUnityLinkerProcessor接口定义如下:namespace......
  • Unity的IPreprocessShaders:深入解析与实用案例
    UnityIPreprocessShadersUnityIPreprocessShaders是Unity引擎中的一个非常有用的功能,它可以让开发者在编译Shader时自定义哪些操作需要被执行。这个可以帮助开发者更好地控制Shader的编译过程,确保在编译Shader时执行必要的操作。在本文中,我们介绍UnityIPreprocessShaders的使用......
  • Unity的IPreprocessComputeShaders:深入解析与实用案例
    UnityIPreprocessComputeShadersUnityIPreprocessComputeShaders是Unity引擎中的一个非常有用的功能,它可以让开发者编译ComputeShader时自定义哪些操作需要被执行。这个可以帮助开发者更好地控制ComputeShader的编译过程,确保在编译ComputeShader时执行必要的操作。在本文中,我......
  • Unity的IPostprocessBuild:深入解析与实用案例
    UnityIPostprocessBuild技术文章UnityIPostprocessBuild是Unity引擎中的一个非常有用的功能,它可以让开发者在构建项目后自动执行一些操作。这个功能可以帮助开发者提高工作效率,减少手动操作的时间和错误率。在本文中,我们将介绍UnityIPostprocessBuild的使用方法,并提供三个使用......
  • Unity的BuildPlayerProcessor:深入解析与实用案例
    UnityBuildPlayerProcessorUnityBuildPlayerProcessor是Unity引擎中的一个非常有用的功能,它可以让开发者在构建项目时自动执行一些操作。这个功能可以帮助开发者提高工作效率,减少手动操作的时间和错误率。在本文中,我们将介绍UnityBuildPlayerProcessor的使用方法,并提供三个使用......
  • Unity的IPreprocessBuildWithReport:深入解析与实用案例
    UnityIPreprocessBuildWithReportUnityIPreprocessBuildWithReport是Unity引擎中的一个非常有用的功能,它可以让开发者在构建项目时自动执行一些操作,并且可以获取构建报告。这个功能可以帮助开发者提高工作效率,减少手动操作的时间和错误率。在本文中,我们将介绍UnityIPreprocessB......
  • Unity的IPostprocessBuildWithReport:深入解析与实用案例
    UnityIPostprocessBuildWithReportUnityIPostprocessBuildWithReport是Unity引擎中的一个非常有用的功能,它可以让开发者在构建项目后自动执行一些操作,并且可以获取构建报告。这个功能可以帮助开发提高工作效率,减少手动操作的时间和错误率。在本文中,我们将介绍UnityIPostprocess......
  • Unity的IPreprocessBuild:深入解析与实用案例
    UnityIPreprocessBuildUnityIPreprocessBuild是Unity引擎中的一个非常有用的功能,它可以让开发者在构建项目时自动执行一些操作。这个功能可以帮助开发者提高工作效率,减少手动操作的时间和错误率。在本文中我们将介绍UnityIPreprocessBuild的使用方法,并提供三个使用例子,帮助读者......
  • Unity的IPreprocessBuild:深入解析与实用案例
    UnityIPreprocessBuildUnityIPreprocessBuild是Unity引擎中的一个非常有用的功能,它可以让开发者在构建项目时自动执行一些操作。这个功能可以帮助开发者提高工作效率,减少手动操作的时间和错误率。在本文中我们将介绍UnityIPreprocessBuild的使用方法,并提供三个使用例子,帮助读......