Spaces:
Sleeping
Sleeping
Update requirements.txt to specify unsloth version 2025.4.5 and refactor imports in train.py for improved organization and clarity.
Browse files- requirements.txt +1 -1
- train.py +6 -3
requirements.txt
CHANGED
|
@@ -30,7 +30,7 @@ smolagents[litellm,telemetry]>=1.14.0
|
|
| 30 |
tensorboardX>=2.6.2.2
|
| 31 |
trl>=0.17.0
|
| 32 |
typing-extensions>=4.5.0
|
| 33 |
-
unsloth>=2025.4.
|
| 34 |
wandb>=0.19.10
|
| 35 |
wikipedia>=1.4.0
|
| 36 |
wikipedia-api>=0.8.1
|
|
|
|
| 30 |
tensorboardX>=2.6.2.2
|
| 31 |
trl>=0.17.0
|
| 32 |
typing-extensions>=4.5.0
|
| 33 |
+
unsloth>=2025.4.5
|
| 34 |
wandb>=0.19.10
|
| 35 |
wikipedia>=1.4.0
|
| 36 |
wikipedia-api>=0.8.1
|
train.py
CHANGED
|
@@ -19,6 +19,12 @@ from datetime import datetime
|
|
| 19 |
from pathlib import Path
|
| 20 |
from typing import Union
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
from datasets import (
|
| 23 |
Dataset,
|
| 24 |
DatasetDict,
|
|
@@ -28,8 +34,6 @@ from datasets import (
|
|
| 28 |
)
|
| 29 |
from transformers import AutoTokenizer, Trainer, TrainingArguments
|
| 30 |
from trl import SFTTrainer
|
| 31 |
-
from unsloth import FastLanguageModel, is_bfloat16_supported
|
| 32 |
-
from unsloth.chat_templates import get_chat_template
|
| 33 |
|
| 34 |
# Configuration
|
| 35 |
max_seq_length = 2048 # Auto supports RoPE Scaling internally
|
|
@@ -193,7 +197,6 @@ def create_trainer(
|
|
| 193 |
tokenizer=tokenizer,
|
| 194 |
train_dataset=dataset["train"],
|
| 195 |
eval_dataset=dataset["validation"],
|
| 196 |
-
max_seq_length=max_seq_length,
|
| 197 |
dataset_num_proc=2,
|
| 198 |
packing=False,
|
| 199 |
args=TrainingArguments(
|
|
|
|
| 19 |
from pathlib import Path
|
| 20 |
from typing import Union
|
| 21 |
|
| 22 |
+
# isort: off
|
| 23 |
+
from unsloth import FastLanguageModel, is_bfloat16_supported # noqa: E402
|
| 24 |
+
from unsloth.chat_templates import get_chat_template # noqa: E402
|
| 25 |
+
|
| 26 |
+
# isort: on
|
| 27 |
+
|
| 28 |
from datasets import (
|
| 29 |
Dataset,
|
| 30 |
DatasetDict,
|
|
|
|
| 34 |
)
|
| 35 |
from transformers import AutoTokenizer, Trainer, TrainingArguments
|
| 36 |
from trl import SFTTrainer
|
|
|
|
|
|
|
| 37 |
|
| 38 |
# Configuration
|
| 39 |
max_seq_length = 2048 # Auto supports RoPE Scaling internally
|
|
|
|
| 197 |
tokenizer=tokenizer,
|
| 198 |
train_dataset=dataset["train"],
|
| 199 |
eval_dataset=dataset["validation"],
|
|
|
|
| 200 |
dataset_num_proc=2,
|
| 201 |
packing=False,
|
| 202 |
args=TrainingArguments(
|