-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ChatGLM模型微调问题咨询 #19
Comments
peft==0.3.0.dev0 pip install git+https://github.com/huggingface/peft |
fatal: unable to access 'https://github.com/huggingface/peft/': Could not resolve host: github.com × git clone --filter=blob:none --quiet https://github.com/huggingface/peft 'C:\Users\86187\AppData\Local\Temp\pip-req-build-n5rknw77' did not run successfully. note: This error originates from a subprocess, and is likely not a problem with pip. × git clone --filter=blob:none --quiet https://github.com/huggingface/peft 'C:\Users\86187\AppData\Local\Temp\pip-req-build-n5rknw77' did not run successfully. 能否直接给个 能用的命令 |
pip install git+https://github.com/huggingface/peft |
安装0.3.0.dev0后运行chatglm-6b-belle-zh-lora示例报了如下错误: |
chatglm-6b-belle-zh-lora 权重我没更新,可以自己训练,或者用shibing624/chatglm-6b-csc-zh-lora |
最新的代码跑train也有报错
完整的log如下
|
更新chatglm-6b的文件。 |
你的torch版本是2.0还是1.13.1? 我用的torch 2.0 之前的错误应该和 pytorch/pytorch#97077 这个有关,但是勉强绕过去之后又碰到了新的错误 |
更新代码 |
总算可以了,不过继续训练时仍然有报错,看上去是peft加载训练后的模型时报错,是现在的模式无法继续训练吗?
|
当前模型未测试lora继续训练的情况。 列个todo。 |
fixed. 633e376 |
我自己训练完了,对于 "少先队员因该为老人让坐" 的输出是正确的了,但是看着最后的loss和train_result我还是有点迷茫,似乎Loss很早就不收敛了,会不会中间某些步数的结果效果会更好?
中间及部分最后的输出:
|
具体模型效果哪个最好,依赖具体任务评估结果,train loss 最低也并不代表效果就最好。1)可以抽case看各checkpoint效果;2)可以算rouge,bleu看各checkpoint效果;3)csc任务可以看测试集的F1值。 |
csc任务的测试集似乎也不是全对?比如下面这个(我改了pycorrector/utils/eval.py试着运行一下的结果)
还有一些像是台湾用语和大陆用语的差异
|
是,SIGHAN数据集质量不够高。 |
我去手工修订一次,才1000条,按说还是可以搞的。 用缺省的设置跑了一次这句话,十次有6次正确。
|
建议去调整下 top_p, num_beams, repetition_renalty, temperature, do_sample=True; 数据生成有重复,调高repetition_renalty; csc这种任务不复杂,训练样本少,调低 temperature。 以上是经验参数,具体调参根据任务而定,不是固定的。 |
这个不是重复,是我重复调用chat了十次,发现结果不稳定。 您说的是训练时调整这些参数吗? |
|
运行 chatglm$ python predict_demo.py 报下面错误
|
我碰到了一个比较奇异的现象,就是training_chatglm_csc_demo.py 这个模式下继续训练似乎无效,而且还会产生忘记训练效果。
我试过训练了1个epoch而且效果正常的outputs-csc,然后即使继续训练0.01个epoch,马上也会崩掉。
我还用 training_chatglm_hfdataset_demo.py 训练了其它数据,继续训练了7次(每次1 epoch),似乎结果是正常的。 |
更新代码 |
更新代码后,只有 ‘training_chatglm_adgen_demo.py’ 和 ‘training_chatglm_demo.py’ 有"resume_from_checkpoint" 参数了? 但是无论是否加上这个参数,在一个已经能正确输出标准格式 "错误字: 因” 的模型下继续训练0.1甚至0.01 epoch,都会导致原来训练出的能力丢失。
|
|
第二条“基于已经训练好的lora继续训练的推荐做法,是把原来的lora权重merge到base model,再基于新base model训练;”意思是说得到merge以后,然后通过--model_name参数指定merge ,实现继续训练是这样吗 |
|
alpaca-zh等通用数据集? 这是chatglm之前预训练过的语料吗?怎么知道模型训练过哪些语料? |
|
以为要保留原来的对话等通用能力,是加入chatglm训练时用过的语料 -- 所以...,其实类似alpaca-zh等通用数据集,也是可以避免遗忘问题 |
你的问题解决了?我用--mode_name参数指定merge的目录,继续训练会出现OSError: /opt/models/THUDM_chatglm-6b-lora/ does not appear to have a file named configuration_chatglm.py. 这个错误的。 |
configuration_chatglm.py等原chatglm官方目录下的py文件手动拷贝过来 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.(由于长期不活动,机器人自动关闭此问题,如果需要欢迎提问) |
运行 /ChatGLM-6B/textgen/examples/chatglm$ python predict_demo.py 报错,glm6B模型用的是 原版, lora 微调模型 用的是 git clone https://huggingface.co/shibing624/chatglm-6b-csc-zh-lora
报错
(pt) ubuntu@youran-gpu21:~/ChatGLM-6B/textgen/examples/chatglm$ python predict_demo2.py
2023-04-14 11:47:33.176 | DEBUG | textgen.chatglm.chatglm_model:init:98 - Device: cuda
Explicitly passing a
revision
is encouraged when loading a configuration with custom code to ensure no malicious code has been contributed in a newer revision.Explicitly passing a
revision
is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.Loading checkpoint shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 8/8 [00:12<00:00, 1.58s/it]
Explicitly passing a
revision
is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision.2023-04-14 11:48:08.995 | INFO | textgen.chatglm.chatglm_model:load_lora:342 - Loaded lora model from /home/ubuntu/ChatGLM-6B/textgen/chatglm-6b-csc-zh-lora
Traceback (most recent call last):
File "/home/ubuntu/ChatGLM-6B/textgen/examples/chatglm/predict_demo2.py", line 12, in
r = model.predict(["对下面中文拼写纠错:\n少先队员因该为老人让坐。\n答:"])
File "/home/ubuntu/anaconda3/envs/pt/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/home/ubuntu/anaconda3/envs/pt/lib/python3.9/site-packages/textgen-0.1.9-py3.9.egg/textgen/chatglm/chatglm_model.py", line 385, in predict
self.model.eval()
File "/home/ubuntu/anaconda3/envs/pt/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1930, in eval
return self.train(False)
File "/home/ubuntu/anaconda3/envs/pt/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1911, in train
module.train(mode)
File "/home/ubuntu/anaconda3/envs/pt/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1911, in train
module.train(mode)
File "/home/ubuntu/anaconda3/envs/pt/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1911, in train
module.train(mode)
[Previous line repeated 4 more times]
File "/home/ubuntu/anaconda3/envs/pt/lib/python3.9/site-packages/peft-0.2.0-py3.9.egg/peft/tuners/lora.py", line 417, in train
delta_w = F.conv1d(
RuntimeError: Expected 4-dimensional input for 4-dimensional weight [8192, 8, 1, 1], but got 3-dimensional input of size [1, 16, 4096] instead
The text was updated successfully, but these errors were encountered: