Upload train.py with huggingface_hub
Browse files
train.py
CHANGED
|
@@ -2,13 +2,23 @@
|
|
| 2 |
# requires-python = ">=3.10"
|
| 3 |
# dependencies = [
|
| 4 |
# "sentence-transformers>=3.0.0",
|
| 5 |
-
# "torch
|
| 6 |
# "transformers>=4.40.0",
|
| 7 |
# "numpy",
|
| 8 |
# "einops",
|
| 9 |
# "datasets",
|
| 10 |
# "accelerate>=1.1.0",
|
| 11 |
# ]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
# ///
|
| 13 |
"""
|
| 14 |
Self-contained automotive embedding fine-tuning + evaluation.
|
|
@@ -548,7 +558,11 @@ def evaluate_model(model: SentenceTransformer, corpus_names: list[str]) -> dict:
|
|
| 548 |
# ============================================================================
|
| 549 |
|
| 550 |
def train():
|
|
|
|
| 551 |
print(f"=== Automotive Embedding Fine-Tuning ===")
|
|
|
|
|
|
|
|
|
|
| 552 |
print(f"Base model: {BASE_MODEL}")
|
| 553 |
print(f"Epochs: {EPOCHS}, Batch size: {BATCH_SIZE}, LR: {LEARNING_RATE}")
|
| 554 |
print(f"Matryoshka dims: {MATRYOSHKA_DIMS}")
|
|
|
|
| 2 |
# requires-python = ">=3.10"
|
| 3 |
# dependencies = [
|
| 4 |
# "sentence-transformers>=3.0.0",
|
| 5 |
+
# "torch",
|
| 6 |
# "transformers>=4.40.0",
|
| 7 |
# "numpy",
|
| 8 |
# "einops",
|
| 9 |
# "datasets",
|
| 10 |
# "accelerate>=1.1.0",
|
| 11 |
# ]
|
| 12 |
+
#
|
| 13 |
+
# [tool.uv.sources]
|
| 14 |
+
# torch = [
|
| 15 |
+
# { index = "pytorch-cu124", marker = "sys_platform == 'linux'" },
|
| 16 |
+
# ]
|
| 17 |
+
#
|
| 18 |
+
# [[tool.uv.index]]
|
| 19 |
+
# name = "pytorch-cu124"
|
| 20 |
+
# url = "https://download.pytorch.org/whl/cu124"
|
| 21 |
+
# explicit = true
|
| 22 |
# ///
|
| 23 |
"""
|
| 24 |
Self-contained automotive embedding fine-tuning + evaluation.
|
|
|
|
| 558 |
# ============================================================================
|
| 559 |
|
| 560 |
def train():
|
| 561 |
+
import torch
|
| 562 |
print(f"=== Automotive Embedding Fine-Tuning ===")
|
| 563 |
+
print(f"CUDA available: {torch.cuda.is_available()}")
|
| 564 |
+
if torch.cuda.is_available():
|
| 565 |
+
print(f"GPU: {torch.cuda.get_device_name(0)}")
|
| 566 |
print(f"Base model: {BASE_MODEL}")
|
| 567 |
print(f"Epochs: {EPOCHS}, Batch size: {BATCH_SIZE}, LR: {LEARNING_RATE}")
|
| 568 |
print(f"Matryoshka dims: {MATRYOSHKA_DIMS}")
|