Update merge.py
Browse files
merge.py
CHANGED
@@ -17,8 +17,8 @@ model = PeftModel.from_pretrained(model, "/path/to/llama3-8b-adapter", device_ma
|
|
17 |
model = model.merge_and_unload()
|
18 |
|
19 |
tokenizer = AutoTokenizer.from_pretrained("/path/to/meta-llama3-8b", trust_remote_code=True)
|
20 |
-
tokenizer.pad_token_id =
|
21 |
-
|
22 |
pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer, max_length=4096, do_sample=False)
|
23 |
print("Padding side:",tokenizer.padding_side)
|
24 |
val_dataset = load_dataset("csv", data_files={'val':'/path/to/actseq-val-new.csv'})["val"]
|
@@ -28,7 +28,7 @@ test_dataset = load_dataset("csv", data_files={'test':'/path/to/actseq-test-new.
|
|
28 |
def formatting_prompts_func(example):
|
29 |
output_texts = []
|
30 |
for i in range(len(example['dial_with_actions'])):
|
31 |
-
text = f"Predict the action sequence (AS) for the Minecraft excerpt:\n {example['dial_with_actions'][i]}\n ### AS:"
|
32 |
output_texts.append(text)
|
33 |
return output_texts
|
34 |
|
|
|
17 |
model = model.merge_and_unload()
|
18 |
|
19 |
tokenizer = AutoTokenizer.from_pretrained("/path/to/meta-llama3-8b", trust_remote_code=True)
|
20 |
+
tokenizer.pad_token_id = tokenizer.eos_token_id + 1
|
21 |
+
model.config.pad_token_id = tokenizer.pad_token_id
|
22 |
pipe = pipeline(task="text-generation", model=model, tokenizer=tokenizer, max_length=4096, do_sample=False)
|
23 |
print("Padding side:",tokenizer.padding_side)
|
24 |
val_dataset = load_dataset("csv", data_files={'val':'/path/to/actseq-val-new.csv'})["val"]
|
|
|
28 |
def formatting_prompts_func(example):
|
29 |
output_texts = []
|
30 |
for i in range(len(example['dial_with_actions'])):
|
31 |
+
text = f"<|begin_of_text|>Predict the action sequence (AS) for the Minecraft excerpt:\n {example['dial_with_actions'][i]}\n ### AS:"
|
32 |
output_texts.append(text)
|
33 |
return output_texts
|
34 |
|