datawhalechina / self-llm

《开源大模型食用指南》基于Linux环境快速部署开源大模型,更适合中国宝宝的部署教程
Apache License 2.0
8.33k stars 993 forks source link

Llama3 Lora报错:RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn #229

Open AndyLuo1029 opened 2 months ago

AndyLuo1029 commented 2 months ago

用transformer库之前就下载好的LLaMA3_1-8B-Instruct模型,没有使用modelscope下载,执行trainer.train后:

截屏2024-07-31 16 08 18 截屏2024-07-31 16 08 26 截屏2024-07-31 16 08 34

求解答谢谢T T

LiXinyuan1015 commented 2 days ago

model.enable_input_require_grads()