Upload root_scripts/check_ready.py with huggingface_hub
Browse files- root_scripts/check_ready.py +43 -0
root_scripts/check_ready.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os, json
|
| 2 |
+
issues = []
|
| 3 |
+
ok = []
|
| 4 |
+
|
| 5 |
+
model_path = "/workspace/rl4phyx/models/Qwen2.5-VL-3B-Instruct"
|
| 6 |
+
if os.path.isdir(model_path):
|
| 7 |
+
files = os.listdir(model_path)
|
| 8 |
+
ok.append(f"Model: {len([f for f in files if f.endswith('.safetensors')])} safetensors")
|
| 9 |
+
else:
|
| 10 |
+
issues.append(f"Model NOT found: {model_path}")
|
| 11 |
+
|
| 12 |
+
data_path = "/workspace/rl4phyx/RL4Phyx/SFT/sft_train/sft_train_formatted.jsonl"
|
| 13 |
+
if os.path.isfile(data_path):
|
| 14 |
+
with open(data_path) as f:
|
| 15 |
+
lines = f.readlines()
|
| 16 |
+
ok.append(f"SFT data: {len(lines)} samples")
|
| 17 |
+
first = json.loads(lines[0])
|
| 18 |
+
for c in first.get("messages",[{}])[0].get("content",[]):
|
| 19 |
+
if c.get("type") == "image":
|
| 20 |
+
ip = c["image"].replace("file://","")
|
| 21 |
+
ok.append(f"Image exists: {os.path.isfile(ip)} ({ip})")
|
| 22 |
+
else:
|
| 23 |
+
issues.append(f"Data NOT found: {data_path}")
|
| 24 |
+
|
| 25 |
+
for f in ["train_sft.py","run_sft.sh","ds_zero2.json"]:
|
| 26 |
+
p = f"/workspace/rl4phyx/RL4Phyx/SFT/{f}"
|
| 27 |
+
if os.path.isfile(p):
|
| 28 |
+
ok.append(f"{f}: OK")
|
| 29 |
+
else:
|
| 30 |
+
issues.append(f"{f} NOT found")
|
| 31 |
+
|
| 32 |
+
out = "/workspace/rl4phyx/RL4Phyx/SFT/checkpoints/"
|
| 33 |
+
os.makedirs(out, exist_ok=True)
|
| 34 |
+
ok.append(f"Output dir: writable")
|
| 35 |
+
|
| 36 |
+
import torch
|
| 37 |
+
ok.append(f"GPUs: {torch.cuda.device_count()} x {torch.cuda.get_device_name(0)}")
|
| 38 |
+
|
| 39 |
+
print("=== OK ===")
|
| 40 |
+
for x in ok: print(x)
|
| 41 |
+
print(f"\n=== ISSUES ({len(issues)}) ===")
|
| 42 |
+
for x in issues: print(x)
|
| 43 |
+
if not issues: print("None! Ready to train.")
|