Upload vlm-streaming-sft-unsloth.py with huggingface_hub
Browse files
vlm-streaming-sft-unsloth.py
CHANGED
|
@@ -198,7 +198,7 @@ def main():
|
|
| 198 |
logger.info(f"Trackio dashboard: https://huggingface.co/spaces/{args.trackio_space}")
|
| 199 |
|
| 200 |
# Import heavy dependencies (note: import from unsloth.trainer for VLM)
|
| 201 |
-
from unsloth import FastVisionModel
|
| 202 |
from unsloth.trainer import UnslothVisionDataCollator
|
| 203 |
from datasets import load_dataset
|
| 204 |
from trl import SFTTrainer, SFTConfig
|
|
@@ -237,6 +237,9 @@ def main():
|
|
| 237 |
loftq_config=None,
|
| 238 |
target_modules="all-linear",
|
| 239 |
)
|
|
|
|
|
|
|
|
|
|
| 240 |
print(f"Model loaded in {time.time() - start:.1f}s")
|
| 241 |
|
| 242 |
# 2. Load streaming dataset
|
|
|
|
| 198 |
logger.info(f"Trackio dashboard: https://huggingface.co/spaces/{args.trackio_space}")
|
| 199 |
|
| 200 |
# Import heavy dependencies (note: import from unsloth.trainer for VLM)
|
| 201 |
+
from unsloth import FastVisionModel, get_chat_template
|
| 202 |
from unsloth.trainer import UnslothVisionDataCollator
|
| 203 |
from datasets import load_dataset
|
| 204 |
from trl import SFTTrainer, SFTConfig
|
|
|
|
| 237 |
loftq_config=None,
|
| 238 |
target_modules="all-linear",
|
| 239 |
)
|
| 240 |
+
|
| 241 |
+
# Apply chat template (required for base models)
|
| 242 |
+
processor = get_chat_template(processor, "gemma-3")
|
| 243 |
print(f"Model loaded in {time.time() - start:.1f}s")
|
| 244 |
|
| 245 |
# 2. Load streaming dataset
|