Upload finetune_soc.py with huggingface_hub
Browse files- finetune_soc.py +8 -0
finetune_soc.py
CHANGED
|
@@ -32,6 +32,14 @@ OUTPUT_REPO = "Colby/apertus-8b-soc"
|
|
| 32 |
print("Loading tokenizer...")
|
| 33 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
print("Loading dataset...")
|
| 36 |
dataset = load_dataset(DATASET_ID, split="train")
|
| 37 |
print(f"Loaded {len(dataset)} conversations")
|
|
|
|
| 32 |
print("Loading tokenizer...")
|
| 33 |
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
|
| 34 |
|
| 35 |
+
# Apertus-8B tokenizer has no chat_template set; define ChatML explicitly.
|
| 36 |
+
# Custom roles (persona usernames) are preserved as-is in the im_start tag.
|
| 37 |
+
tokenizer.chat_template = (
|
| 38 |
+
"{% for message in messages %}"
|
| 39 |
+
"<|im_start|>{{ message['role'] }}\n{{ message['content'] }}<|im_end|>\n"
|
| 40 |
+
"{% endfor %}"
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
print("Loading dataset...")
|
| 44 |
dataset = load_dataset(DATASET_ID, split="train")
|
| 45 |
print(f"Loaded {len(dataset)} conversations")
|