chore(hf): download warm registry.db cache from HF dataset repo before training
Browse files- scripts/hf_train_job.py +19 -0
scripts/hf_train_job.py
CHANGED
|
@@ -21,6 +21,7 @@ def hf_train_5epoch() -> None:
|
|
| 21 |
"""Run a controlled 5-epoch training pass and push artifacts to the Hub."""
|
| 22 |
token = os.environ.get("HF_TOKEN")
|
| 23 |
data_path = REPO_ROOT / "data" / "empirical_dataset_v1.jsonl"
|
|
|
|
| 24 |
|
| 25 |
if not data_path.exists() and token:
|
| 26 |
# Download the dataset from the canonical dataset repository.
|
|
@@ -41,6 +42,24 @@ def hf_train_5epoch() -> None:
|
|
| 41 |
# Allow the dataset to be mounted elsewhere in the container.
|
| 42 |
data_path = Path("/data/empirical_dataset_v1.jsonl")
|
| 43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
sys.argv = [
|
| 45 |
"pino.train",
|
| 46 |
"--data", str(data_path),
|
|
|
|
| 21 |
"""Run a controlled 5-epoch training pass and push artifacts to the Hub."""
|
| 22 |
token = os.environ.get("HF_TOKEN")
|
| 23 |
data_path = REPO_ROOT / "data" / "empirical_dataset_v1.jsonl"
|
| 24 |
+
registry_path = REPO_ROOT / "src" / "pino" / "registry.db"
|
| 25 |
|
| 26 |
if not data_path.exists() and token:
|
| 27 |
# Download the dataset from the canonical dataset repository.
|
|
|
|
| 42 |
# Allow the dataset to be mounted elsewhere in the container.
|
| 43 |
data_path = Path("/data/empirical_dataset_v1.jsonl")
|
| 44 |
|
| 45 |
+
if not registry_path.exists() and token:
|
| 46 |
+
from huggingface_hub import hf_hub_download
|
| 47 |
+
|
| 48 |
+
print("📥 Downloading warm registry cache from Hugging Face Hub...")
|
| 49 |
+
registry_path.parent.mkdir(parents=True, exist_ok=True)
|
| 50 |
+
downloaded = hf_hub_download(
|
| 51 |
+
repo_id="mattbitzesty/pino-synthetic-dataset",
|
| 52 |
+
filename="registry.db",
|
| 53 |
+
repo_type="dataset",
|
| 54 |
+
token=token,
|
| 55 |
+
local_dir=str(registry_path.parent),
|
| 56 |
+
)
|
| 57 |
+
registry_path = Path(downloaded)
|
| 58 |
+
print(f" Registry cache downloaded to {registry_path}")
|
| 59 |
+
elif not registry_path.exists():
|
| 60 |
+
# Use the local registry file if it was cloned with the repo.
|
| 61 |
+
registry_path = Path("/workspace/pino/src/pino/registry.db")
|
| 62 |
+
|
| 63 |
sys.argv = [
|
| 64 |
"pino.train",
|
| 65 |
"--data", str(data_path),
|