fix: Loading LoRA parameters which saved from multi-card training #523
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
我使用8张卡训练的lora,训练启动如下:
在加载lora参数进行推理时碰到了以下问题:
经过分析是由于多卡训练导致的模型字典多了"module"字段,通过对model/model_lora.py中"load_lora"进行修复,能够正常运行lora推理:
在load_lora中进行修改而不是在save_lora中修改是考虑到已经训练好的模型不用重新保存一遍,就能兼容之前训练好的模型。
另外:我还在gitignore加上了"trainer/__pycache__",不然会有很多中间文件被识别到。