Skip to content
Snippets Groups Projects
Commit e4424fdb authored by bys0318's avatar bys0318
Browse files

pred update

parent 3f0b2d22
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ def build_chat(tokenizer, prompt): ...@@ -11,7 +11,7 @@ def build_chat(tokenizer, prompt):
def get_pred(model, tokenizer, data, max_length, max_gen, prompt_format, dataset, device): def get_pred(model, tokenizer, data, max_length, max_gen, prompt_format, dataset, device):
preds = [] preds = []
for json_obj in tqdm(data[:10]): for json_obj in tqdm(data):
prompt = prompt_format.format(**json_obj) prompt = prompt_format.format(**json_obj)
# truncate to fit max_length (we suggest truncate in the middle, since the left and right side may contain crucial instructions) # truncate to fit max_length (we suggest truncate in the middle, since the left and right side may contain crucial instructions)
tokenized_prompt = tokenizer(prompt, truncation=False, return_tensors="pt").input_ids[0] tokenized_prompt = tokenizer(prompt, truncation=False, return_tensors="pt").input_ids[0]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment