Update train.py
Browse files
train.py
CHANGED
@@ -1,4 +1,11 @@
|
|
1 |
-
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def main(): # 1) Load Unsloth 4-bit model + tokenizer model_name = "HuggingFaceTB/SmolLM2-1.7B" max_seq_length = 2048 dtype = torch.float16 load_in_4bit = True
|
4 |
|
@@ -104,7 +111,7 @@ tokenizer.save_pretrained(final_dir)
|
|
104 |
print(f"Saved final adapter to {final_dir}")
|
105 |
|
106 |
# 10) Zip the final model
|
107 |
-
zip_path = "
|
108 |
print(f"Zipping model directory {final_dir} to {zip_path}...")
|
109 |
with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as z:
|
110 |
for root, _, files in os.walk(final_dir):
|
|
|
1 |
+
import os
|
2 |
+
import zipfile
|
3 |
+
import pandas as pd
|
4 |
+
import torch from datasets
|
5 |
+
import Dataset from transformers
|
6 |
+
import TrainingArguments from unsloth
|
7 |
+
import FastLanguageModel from trl
|
8 |
+
import SFTTrainer
|
9 |
|
10 |
def main(): # 1) Load Unsloth 4-bit model + tokenizer model_name = "HuggingFaceTB/SmolLM2-1.7B" max_seq_length = 2048 dtype = torch.float16 load_in_4bit = True
|
11 |
|
|
|
111 |
print(f"Saved final adapter to {final_dir}")
|
112 |
|
113 |
# 10) Zip the final model
|
114 |
+
zip_path = "model.zip"
|
115 |
print(f"Zipping model directory {final_dir} to {zip_path}...")
|
116 |
with zipfile.ZipFile(zip_path, "w", zipfile.ZIP_DEFLATED) as z:
|
117 |
for root, _, files in os.walk(final_dir):
|