modelscope训练完一直出现这个错误2024-08-15 11:43:24,103 - modelscope - INFO - Train finished. Uploading models, waiting...
Traceback (most recent call last):
File "", line 1, in
File "D:\ProgramData.conda\envs\mt5py\Lib\multiprocessing\spawn.py", line 120, in spawn_main
exitcode = _main(fd, parent_sentinel)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ProgramData.conda\envs\mt5py\Lib\multiprocessing\spawn.py", line 129, in _main
prepare(preparation_data)
File "D:\ProgramData.conda\envs\mt5py\Lib\multiprocessing\spawn.py", line 240, in prepare
_fixup_main_from_path(data['init_main_from_path'])
File "D:\ProgramData.conda\envs\mt5py\Lib\multiprocessing\spawn.py", line 291, in _fixup_main_from_path
main_content = runpy.run_path(main_path,
^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 291, in run_path
File "", line 98, in _run_module_code
File "", line 88, in _run_code
File "d:\geoner\GeoNER-jstrain\src\model\train.py", line 86, in
finetune(
File "d:\geoner\GeoNER-jstrain\src\model\train.py", line 31, in finetune
trainer.train()
File "D:\ProgramData.conda\envs\mt5py\Lib\site-packages\modelscope\trainers\trainer.py", line 711, in train
self.train_loop(self.train_dataloader)
File "D:\ProgramData.conda\envs\mt5py\Lib\site-packages\modelscope\trainers\trainer.py", line 1250, in train_loop
self.invoke_hook(TrainerStages.after_run)
File "D:\ProgramData.conda\envs\mt5py\Lib\site-packages\modelscope\trainers\trainer.py", line 1395, in invoke_hook
getattr(hook, fn_name)(self)
File "D:\ProgramData.conda\envs\mt5py\Lib\site-packages\modelscope\trainers\hooks\checkpoint\checkpoint_hook.py", line 188, in after_run
push_to_hub_in_queue(
File "D:\ProgramData.conda\envs\mt5py\Lib\site-packages\modelscope\hub\push_to_hub.py", line 171, in push_to_hub_in_queue
_manager = Manager()
^^^^^^^^^
File "D:\ProgramData.conda\envs\mt5py\Lib\multiprocessing\context.py", line 57, in Manager
m.start()
File "D:\ProgramData.conda\envs\mt5py\Lib\multiprocessing\managers.py", line 563, in start
self._process.start()
File "D:\ProgramData.conda\envs\mt5py\Lib\multiprocessing\process.py", line 121, in start
self._popen = self._Popen(self)
^^^^^^^^^^^^^^^^^
File "D:\ProgramData.conda\envs\mt5py\Lib\multiprocessing\context.py", line 336, in _Popen
return Popen(process_obj)
^^^^^^^^^^^^^^^^^^
File "D:\ProgramData.conda\envs\mt5py\Lib\multiprocessing\popen_spawn_win32.py", line 45, in init
prep_data = spawn.get_preparation_data(process_obj._name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ProgramData.conda\envs\mt5py\Lib\multiprocessing\spawn.py", line 158, in get_preparation_data
_check_not_importing_main()
File "D:\ProgramData.conda\envs\mt5py\Lib\multiprocessing\spawn.py", line 138, 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.
您看下output文件夹下有pytorch_model.bin这个文件没。有的话,用这个文件推理就行。早期的一些模型windows上训练会报错。此回答整理自钉钉群“魔搭ModelScope开发者联盟群 ①”
ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!欢迎加入技术交流群:微信公众号:魔搭ModelScope社区,钉钉群号:44837352