LoRA: pre-commit fix

This commit is contained in:
madroid 2024-09-20 12:10:25 +08:00
parent 30b39c7115
commit b94b7e0fe7

View File

@ -55,10 +55,7 @@ class ToolsDataset(Dataset):
messages = self._data[idx]["messages"] messages = self._data[idx]["messages"]
tools = self._data[idx]["tools"] tools = self._data[idx]["tools"]
text = self._tokenizer.apply_chat_template( text = self._tokenizer.apply_chat_template(
messages, messages, tools=tools, tokenize=False, add_generation_prompt=True
tools=tools,
tokenize=False,
add_generation_prompt=True
) )
return text return text
@ -144,9 +141,7 @@ def create_hf_dataset(args, tokenizer: PreTrainedTokenizer):
**hf_args.get("config", {}), **hf_args.get("config", {}),
) )
if prompt_feature and completion_feature: if prompt_feature and completion_feature:
return CompletionsDataset( return CompletionsDataset(ds, tokenizer, prompt_feature, completion_feature)
ds, tokenizer, prompt_feature, completion_feature
)
elif text_feature: elif text_feature:
return Dataset(train_ds, text_key=text_feature) return Dataset(train_ds, text_key=text_feature)
else: else: