shibing624 / pycorrector

pycorrector is a toolkit for text error correction. 文本纠错,实现了Kenlm,T5,MacBERT,ChatGLM3,Qwen2.5等模型应用在纠错场景,开箱即用。
https://www.mulanai.com/product/corrector/
Apache License 2.0
5.61k stars 1.1k forks source link

NotImplementedError: Cannot copy out of meta tensor; no data! #525

Closed diudiudiu0 closed 1 month ago

diudiudiu0 commented 1 month ago

Describe the Question

Please provide a clear and concise description of what the question is. 大佬,您好! 请问我在使用training_qwen_demo.py文件对qwen2.5-7b进行微调时候,报错NotImplementedError: Cannot copy out of meta tensor; no data!,请问如何解决,报错信息如下 Traceback (most recent call last): File "/root/dataDisk/pycorrector/examples/gpt/training_qwen_demo.py", line 75, in main() File "/root/dataDisk/pycorrector/examples/gpt/training_qwen_demo.py", line 56, in main model.train_model(args.train_file, eval_data=args.test_file) File "/root/.local/lib/python3.10/site-packages/pycorrector/gpt/gpt_model.py", line 445, in train_model trainer = SavePeftModelTrainer( File "/root/.local/lib/python3.10/site-packages/transformers/trainer.py", line 554, in init self._move_model_to_device(model, args.device) File "/root/.local/lib/python3.10/site-packages/transformers/trainer.py", line 802, in _move_model_to_device model = model.to(device) File "/opt/conda/envs/py10/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1160, in to return self._apply(convert) File "/opt/conda/envs/py10/lib/python3.10/site-packages/torch/nn/modules/module.py", line 810, in _apply module._apply(fn) File "/opt/conda/envs/py10/lib/python3.10/site-packages/torch/nn/modules/module.py", line 810, in _apply module._apply(fn) File "/opt/conda/envs/py10/lib/python3.10/site-packages/torch/nn/modules/module.py", line 810, in _apply module._apply(fn) [Previous line repeated 5 more times] File "/opt/conda/envs/py10/lib/python3.10/site-packages/torch/nn/modules/module.py", line 833, in _apply param_applied = fn(param) File "/opt/conda/envs/py10/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1158, in convert return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking) NotImplementedError: Cannot copy out of meta tensor; no data!

shibing624 commented 1 month ago

机器显存不够。