Upload hf_train_runner.py with huggingface_hub
Browse files- hf_train_runner.py +24 -0
hf_train_runner.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import subprocess
|
| 3 |
+
|
| 4 |
+
# --- 1. Clone the environment repository ---
|
| 5 |
+
print("--- Cloning Environment Repository ---")
|
| 6 |
+
# We assume the training script is in a different repo and needs to get the environment
|
| 7 |
+
# For this hackathon, we can simplify and assume the env is in the same repo,
|
| 8 |
+
# but a separate runner is a better practice for modularity.
|
| 9 |
+
# Here we'll just install dependencies from the local files.
|
| 10 |
+
|
| 11 |
+
# --- 2. Install Dependencies ---
|
| 12 |
+
print("
|
| 13 |
+
--- Installing Dependencies ---")
|
| 14 |
+
subprocess.run(["pip", "install", "-r", "requirements.txt"])
|
| 15 |
+
subprocess.run(["pip", "install", "unsloth[colab-new] @ git+https://github.com/unslothai/unsloth.git", "trl", "peft", "bitsandbytes", "requests"])
|
| 16 |
+
|
| 17 |
+
# --- 3. Run the Training Script ---
|
| 18 |
+
print("
|
| 19 |
+
--- Starting Training ---")
|
| 20 |
+
# The train.py script is expected to be in the same directory
|
| 21 |
+
subprocess.run(["python", "train.py"])
|
| 22 |
+
|
| 23 |
+
print("
|
| 24 |
+
--- Training Finished ---")
|