Chinese-Vicuna icon indicating copy to clipboard operation
Chinese-Vicuna copied to clipboard

finetune_chat 运行错误

Open lucasjinreal opened this issue 1 year ago • 9 comments

│   154 │   │   lens = len(data_point['input'])                                                    │
│   155 │   │   for i in range(lens-1):                                                            │
│   156 │   │   │   user_prompt += self.prompt_history.format_map({'input':data_point['input'][i   │
│ ❱ 157 │   │   user_prompt += self.prompt_post.format_map({'input':data_point['input'][-1].stri   │
│   158 │   │                                                                                      │
│   159 │   │   len_user_prompt_tokens = len(self.tokenizer(                                       │
│   160 │   │   │   user_prompt,                                                                   │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
IndexError: string index out of range
python finetune_chat.py --data_path guanaco_belle_merge_v1.0/merge.json --model_path llama-7b-hf --micro_batch 1

lucasjinreal avatar May 29 '23 06:05 lucasjinreal

你那个数据文件有数据吗。你可以看看这个“data_point”是不是空的

Facico avatar May 29 '23 11:05 Facico

❱ 113 assert train_tokenizer.eos_token_id == 2, "Tokenizer eos is wrong!!!"                      │
│   114 # unk. we want this to be different from the eos token                                     │
│   115 train_tokenizer.pad_token_id = 0                                                           │
│   116 # cannot use eos in generation!   

下载数据后出现新的错误

lucasjinreal avatar May 29 '23 12:05 lucasjinreal

貌似新的transformers已经不兼容depera那个tokenizer model了。

我看finetune.py 没有这个assertion, finetune_chat里面有:

assert train_tokenizer.eos_token_id == 2, "Tokenizer eos is wrong!!!"

是不是意味着finentune训的已经崩了? 因为deppera那个tokenizer返回的eos已经是空了

lucasjinreal avatar May 29 '23 12:05 lucasjinreal

@Facico chat 根本无法训练:

│ 245 │ │ user_prompt += self.prompt_post.format_map( │ │ ❱ 246 │ │ │ {"input": data_point["input"][-1].strip()} │ │ 247 │ │ ) │ │ 248 │ │ │ │ 249 │ │ len_user_prompt_tokens = ( │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ IndexError: string index out of range

你的merge.json input是一个string,而且是 "" ,怎么index的?

lucasjinreal avatar May 29 '23 12:05 lucasjinreal

@lucasjinreal decapoda那个model要用我们requirements.txt里面固定的transformers版本就没问题。只要推理的时候能输出eos就没问题。deppera那个tokenizer虽然是空的,但是tokenizer.model里面是有的,当时的代码默认用的是那个。 现在是如果用最新的transformers可以用yahma的模型,老版本的可以用decapoda的模型。

merge.json每个input应该是json格式的,可以参考这里,https://github.com/Facico/Chinese-Vicuna/blob/master/sample/chat/data_sample.jsonl

Facico avatar May 29 '23 13:05 Facico

对了,如果用finetune_chat的话,用这个数据:https://huggingface.co/datasets/Chinese-Vicuna/instruct_chat_50k.jsonl

原本的instruct数据确实是没有input

Facico avatar May 29 '23 13:05 Facico

@Facico 請教一下finetune_chat、finetune、finetune_deepspeed這三個檔案的差別是什麼?

cyc00518 avatar May 30 '23 01:05 cyc00518

@Facico 非常感谢,已经解决了。

另外想请教一下这个版本训练的chat finetune多轮对话能力如何,相较于BiLLa和PandaLM或者是Chinese-Llama?

lucasjinreal avatar May 30 '23 02:05 lucasjinreal

@cyc00518 finetune_chat是调对话型的数据的,多轮对话的能力会强一点,finetune就是普通的指令微调,finetune_deepspeed是用于fp16的(现在改名为finetune_fp16)

Facico avatar Jun 29 '23 13:06 Facico