mattbitzesty commited on
Commit
dcde171
·
unverified ·
1 Parent(s): c93892a

hf_train_job: install huggingface_hub before downloading source/dataset

Browse files
Files changed (1) hide show
  1. scripts/hf_train_job.py +16 -2
scripts/hf_train_job.py CHANGED
@@ -2,6 +2,7 @@ from __future__ import annotations
2
 
3
  import os
4
  import shutil
 
5
  import sys
6
  import time
7
  import traceback
@@ -54,6 +55,21 @@ def _upload_log() -> None:
54
 
55
  _log("[HF-JOB] hf_train_job.py started")
56
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  # Download fresh source and dataset into writable workspace.
58
  try:
59
  from huggingface_hub import snapshot_download
@@ -106,8 +122,6 @@ _log(f"[HF-JOB] PINO_REGISTRY_PATH={os.environ['PINO_REGISTRY_PATH']}")
106
  # Install the freshly downloaded source.
107
  _log("[HF-JOB] Installing pino from fresh source")
108
  try:
109
- import subprocess
110
-
111
  subprocess.check_call(
112
  [sys.executable, "-m", "pip", "install", "-e", str(SOURCE_DIR)],
113
  stdout=sys.stdout,
 
2
 
3
  import os
4
  import shutil
5
+ import subprocess
6
  import sys
7
  import time
8
  import traceback
 
55
 
56
  _log("[HF-JOB] hf_train_job.py started")
57
 
58
+ # Install huggingface_hub first so we can download fresh source and dataset.
59
+ _log("[HF-JOB] Installing huggingface_hub")
60
+ try:
61
+ subprocess.check_call(
62
+ [sys.executable, "-m", "pip", "install", "--quiet", "huggingface-hub"],
63
+ stdout=sys.stdout,
64
+ stderr=sys.stderr,
65
+ )
66
+ _log("[HF-JOB] huggingface_hub installed")
67
+ except Exception as exc:
68
+ _log(f"[HF-JOB] huggingface_hub install failed: {exc}")
69
+ traceback.print_exc()
70
+ _upload_log()
71
+ sys.exit(1)
72
+
73
  # Download fresh source and dataset into writable workspace.
74
  try:
75
  from huggingface_hub import snapshot_download
 
122
  # Install the freshly downloaded source.
123
  _log("[HF-JOB] Installing pino from fresh source")
124
  try:
 
 
125
  subprocess.check_call(
126
  [sys.executable, "-m", "pip", "install", "-e", str(SOURCE_DIR)],
127
  stdout=sys.stdout,