MMSA-FET icon indicating copy to clipboard operation
MMSA-FET copied to clipboard

多进程的一个问题

Open 05Pikachu24 opened this issue 5 months ago • 0 comments

Traceback (most recent call last): File "C:\Users\20243\Desktop*\MMSA-FET-master\src\MSA_FET\dataset.py", line 420, in run_dataset 2024-09-24 22:00:48 - FET-Dataset - PID:17720 [ERROR] An Error Occured: Traceback (most recent call last): File "C:\Users\20243\Desktop*\MMSA-FET-master\src\MSA_FET\dataset.py", line 420, in run_dataset pool = mp_ctx.Pool( # 创建一个包含num_workers个进程的池 File "D:\Anaconda\envs\extractMul\lib\multiprocessing\context.py", line 119, in Pool return Pool(processes, initializer, initargs, maxtasksperchild, File "D:\Anaconda\envs\extractMul\lib\multiprocessing\pool.py", line 212, in init self._repopulate_pool() File "D:\Anaconda\envs\extractMul\lib\multiprocessing\pool.py", line 303, in _repopulate_pool return self._repopulate_pool_static(self._ctx, self.Process, File "D:\Anaconda\envs\extractMul\lib\multiprocessing\pool.py", line 326, in _repopulate_pool_static w.start() File "D:\Anaconda\envs\extractMul\lib\multiprocessing\process.py", line 121, in start self._popen = self._Popen(self) File "D:\Anaconda\envs\extractMul\lib\multiprocessing\context.py", line 327, in _Popen return Popen(process_obj) File "D:\Anaconda\envs\extractMul\lib\multiprocessing\popen_spawn_win32.py", line 45, in init prep_data = spawn.get_preparation_data(process_obj._name) File "D:\Anaconda\envs\extractMul\lib\multiprocessing\spawn.py", line 154, in get_preparation_data _check_not_importing_main() File "D:\Anaconda\envs\extractMul\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.
pool = mp_ctx.Pool(   # 创建一个包含num_workers个进程的池

05Pikachu24 avatar Sep 24 '24 14:09 05Pikachu24