Initial pi0.7 minimal validation

This commit is contained in:
seeker
2026-07-12 00:52:00 +08:00
commit b4c8db846b
27 changed files with 3724 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
from __future__ import annotations
import json,random
from pathlib import Path
import numpy as np,torch,yaml
def load_config(path):
with Path(path).open() as f:return yaml.safe_load(f)
def seed_everything(seed:int):random.seed(seed);np.random.seed(seed);torch.manual_seed(seed)
def choose_device(name="auto"):
if name!="auto":return torch.device(name)
if torch.cuda.is_available():return torch.device("cuda")
if torch.backends.mps.is_available():return torch.device("mps")
return torch.device("cpu")
def write_json(path,value):
p=Path(path);p.parent.mkdir(parents=True,exist_ok=True);p.write_text(json.dumps(value,indent=2,ensure_ascii=False))