-
Notifications
You must be signed in to change notification settings - Fork 420
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
微调之后加载权重发现输出停不下来 #140
Comments
你要确定下你自己训练的时候tokenizer是不是也是pad=0 bos=1 eos=2, 以及训练数据预处理后是不是eos结尾,一般来说这种情况是训练的时候eos没加,模型没学到如何结尾 |
@LZY-the-boys 最后结果都是pad=0 bos=1 eos=2, |
在生成阶段可以设置一下repetition_penalty,如:
|
Repetition Penalty 在web界面上可以调整吧 默认设置是2 。 |
我用的是alpaca-lora的代码,alpaca-lora默认是没设置repetition_penalty的 |
@LZY-the-boys 把这3个样本超过踢出去。也还是解决不了这个问题。绝了。 |
@LZY-the-boys 我解决了我的问题。我参看了 alpace-lora的代码和这个issuse tloen/alpaca-lora#279 一共发现两个问题 2.https://github.com/Facico/Chinese-Vicuna/blob/master/finetune.py 全文中你没有使用tokenize。我看了一下这个代码在 alpace-lora使用,其实是在对最后的输出位置补充EOS。 |
@wilson9x1 是的,我们当时使用的decapoda-research/llama-7b-hf可能比较早,后面的yahma的模型是修正过tokenizer的问题的。因为它们版本比较乱,我们在不同的机器上部署的时候也遇到了类似的问题,4.28.1的应该是可以和yahma对应的。 关于第二个问题,在数据比较短的时候(比如belle和guanaco的数据)其实不加eos是问题不大的。小于截断长度加eos,不小于不加确实合理一点。不过其实当截断长度开成2048都加eos问题也不大 |
感谢耐心解答 |
llama 7b 的模型本身(未经过finetune)generate时候能够输出eos吗? |
@Facico 想请教下,如果是文本摘要这种输入一般很长的任务,超过截断长度要不要设置加eos呢,我现在看各个版本的llama finetune都是超过就不加eos, 而且训练的时候有很多样本是没有标签的, 训练来的模型有时候会说不出完整的句子。这种情况下厨了增大max_seq-len, 请问还有什么比较好的方法吗? 还是说这种长文本就设置一律加上eos呢 |
系统:
centos transformers 4.28.0.dev0
Python 3.10.11
decapoda-research--llama-7b-hf 4.27.0.dev0
我重新自己验证一下我的问题发现:
一) 直接使用,你们提供的权重,使用时正常的:python generate.py --model_path 'decapoda-research/llama-7b-hf' --lora_path 'Chinese-Vicuna/Chinese-Vicuna-lora-7b-belle-and-guanaco' --use_local '0' --use_typewriter '1'
![image](https://user-images.githubusercontent.com/9835472/236723748-2b68574e-ec3b-4780-9f1a-453b501331e3.png)
二)使用自己微调的模型 。如何加载权重时候,发现一直输出问题:python finetune.py --data_path './sample/merge_sample.json' --output_path './loar-v/' --model_path 'decapoda-research/llama-7b-hf' --eval_steps 200 --save_steps 200 --test_size 1
python generate.py --model_path 'decapoda-research/llama-7b-hf' --lora_path './loar-v/' --use_local '0' --use_typewriter '1'
![image](https://user-images.githubusercontent.com/9835472/236723790-925e32bc-bb33-4744-979c-45b790d7706b.png)
三)参考 #59
改tokenizer_config.json配置没还是存在问题。
模型直接不工作了。。
补充我的几个token值情况:
![截屏2023-05-08 11 03 45](https://user-images.githubusercontent.com/9835472/236724783-18d70f18-d0d5-484e-808c-015921163ac5.png)
The text was updated successfully, but these errors were encountered: