baichuan-inc / Baichuan2

A series of large language models developed by Baichuan Intelligent Technology
https://huggingface.co/baichuan-inc
Apache License 2.0
4.08k stars 293 forks source link

微调token长度的问题 #384

Open jichaoqun opened 7 months ago

jichaoqun commented 7 months ago

在微调baichuan2-7B-Base模型的时候,发现,输入的token长度不能超过512,其官方给出的最大长度为4096。 微调遵循官方教程,使用lora的方式,在微调过程中使用官方数据集,在数据中添加超长数据时出现 Token indices sequence length is longer than the specified maximum sequence length for this model (1759 > 512). Running this sequence through the model will result in indexing errors

请问,是否需要修改相关配置文件或是相关代码?还是7B的模型本身不支持超长序列的输入?

GuntherCentralPerkRing commented 4 months ago

同样的问题 Traceback (most recent call last): File "/home/ma-user/work/mindformers/research/baichuan2/run_baichuan2_pipeline.py", line 145, in outputs = pipeline_task(inputs, File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindformers/pipeline/base_pipeline.py", line 121, in call outputs = self.run_multi(inputs, batch_size, preprocess_params, forward_params, postprocess_params) File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindformers/pipeline/text_generation_pipeline.py", line 208, in run_multi outputs.extend(self.run_single(item, preprocess_params, File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindformers/pipeline/base_pipeline.py", line 170, in run_single model_outputs = self.forward(model_inputs, forward_params) File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindformers/pipeline/text_generation_pipeline.py", line 224, in forward output_ids = self.network.generate(input_ids, forward_params) File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindformers/generation/text_generator.py", line 1120, in generate output_ids = self._greedy_search( File "/home/ma-user/anaconda3/envs/MindSpore/lib/python3.9/site-packages/mindformers/generation/text_generator.py", line 315, in _greedy_search raise ValueError( ValueError: the input_ids length 757 exceeds the max length config 512.check your inputs and set max_length larger than your inputs length.

zzw1123 commented 3 months ago

Have you solved this problem?