memoryai commited on
Commit
3f6f388
·
verified ·
1 Parent(s): 9bed334

v6: fix shard threshold, separate Flux model download, better error logs

Browse files
Files changed (1) hide show
  1. job_ml.sh +18 -5
job_ml.sh CHANGED
@@ -156,7 +156,7 @@ mkdir -p "$SHARD_DIR"
156
  SHARD_COUNT=$(find "$SHARD_DIR" -name "*.tar" 2>/dev/null | wc -l | tr -d '[:space:]')
157
  SHARD_COUNT=${SHARD_COUNT:-0}
158
 
159
- if [ "$SHARD_COUNT" -ge 5 ]; then
160
  log " Shards ready ($SHARD_COUNT)"
161
  else
162
  # Try pull from HF first
@@ -178,7 +178,7 @@ PYEOF
178
  SHARD_COUNT=$(find "$SHARD_DIR" -name "*.tar" 2>/dev/null | wc -l | tr -d '[:space:]')
179
  SHARD_COUNT=${SHARD_COUNT:-0}
180
 
181
- if [ "$SHARD_COUNT" -lt 5 ]; then
182
  # Download from COYO
183
  log " Downloading from COYO (1 partition, top 20K images)..."
184
  COYO_RAW="$DATA0/datasets/raw/coyo"
@@ -267,17 +267,30 @@ EMB_COUNT=${EMB_COUNT:-0}
267
  if [ "$EMB_COUNT" -gt 0 ]; then
268
  log " Already computed ($EMB_COUNT)"
269
  else
270
- log " Computing..."
 
 
 
 
 
 
 
 
 
 
 
271
  python3 -u "$PROJECT_DIR/scripts/training/precompute_embeddings.py" \
272
  --data-dir "$SHARD_DIR" \
273
  --output-dir "$EMB_DIR" \
274
  --batch-size 4 \
275
  --cache-dir "$DATA0/models" \
276
- --device cuda:0
 
277
  EMB_COUNT=$(find "$EMB_DIR" -name "shard-*.pt" 2>/dev/null | wc -l | tr -d '[:space:]')
278
  EMB_COUNT=${EMB_COUNT:-0}
279
  if [ "$EMB_COUNT" -eq 0 ]; then
280
- log " FATAL: No embeddings"
 
281
  exit 1
282
  fi
283
  fi
 
156
  SHARD_COUNT=$(find "$SHARD_DIR" -name "*.tar" 2>/dev/null | wc -l | tr -d '[:space:]')
157
  SHARD_COUNT=${SHARD_COUNT:-0}
158
 
159
+ if [ "$SHARD_COUNT" -ge 2 ]; then
160
  log " Shards ready ($SHARD_COUNT)"
161
  else
162
  # Try pull from HF first
 
178
  SHARD_COUNT=$(find "$SHARD_DIR" -name "*.tar" 2>/dev/null | wc -l | tr -d '[:space:]')
179
  SHARD_COUNT=${SHARD_COUNT:-0}
180
 
181
+ if [ "$SHARD_COUNT" -lt 2 ]; then
182
  # Download from COYO
183
  log " Downloading from COYO (1 partition, top 20K images)..."
184
  COYO_RAW="$DATA0/datasets/raw/coyo"
 
267
  if [ "$EMB_COUNT" -gt 0 ]; then
268
  log " Already computed ($EMB_COUNT)"
269
  else
270
+ # Download Flux model first (separate step so we see if it fails)
271
+ log " Downloading Flux model..."
272
+ python3 -u << PYEOF
273
+ from huggingface_hub import snapshot_download
274
+ snapshot_download(
275
+ repo_id="black-forest-labs/FLUX.1-schnell",
276
+ cache_dir="$DATA0/models",
277
+ )
278
+ print(" Flux model cached")
279
+ PYEOF
280
+
281
+ log " Computing embeddings..."
282
  python3 -u "$PROJECT_DIR/scripts/training/precompute_embeddings.py" \
283
  --data-dir "$SHARD_DIR" \
284
  --output-dir "$EMB_DIR" \
285
  --batch-size 4 \
286
  --cache-dir "$DATA0/models" \
287
+ --device cuda:0 2>&1 | tee "$DATA1/logs/precompute.log" | tail -30
288
+
289
  EMB_COUNT=$(find "$EMB_DIR" -name "shard-*.pt" 2>/dev/null | wc -l | tr -d '[:space:]')
290
  EMB_COUNT=${EMB_COUNT:-0}
291
  if [ "$EMB_COUNT" -eq 0 ]; then
292
+ log " FATAL: No embeddings. Last 20 lines of log:"
293
+ tail -20 "$DATA1/logs/precompute.log" 2>/dev/null || true
294
  exit 1
295
  fi
296
  fi