darrenphodgson76 commited on
Commit
6d6b976
·
verified ·
1 Parent(s): 4d2faa4

Update train.py

Browse files
Files changed (1) hide show
  1. train.py +9 -2
train.py CHANGED
@@ -1,4 +1,11 @@
1
- import os import zipfile import pandas as pd import torch from datasets import Dataset from transformers import TrainingArguments from unsloth import FastLanguageModel from trl import SFTTrainer
 
 
 
 
 
 
 
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 = "model_final.zip"
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):