8b / configs /paths.py
JulianHJR's picture
Add files using upload-large-folder tool
48bf805 verified
Raw
History Blame Contribute Delete
3.26 kB
"""Project paths — v8b (Qwen3-8B dense migration).
v8b base lives at ~/jrhu/v8b. Every path below can be overridden by an
environment variable (the SLURM scripts set them explicitly), so the
hardcoded defaults only matter when running outside the container.
If your home is NOT /data/home/user-test, set V8B_BASE in the env, or
edit the one line below.
"""
import os
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Single source of truth for the base dir. Override with env V8B_BASE.
V8B_BASE = os.environ.get("V8B_BASE", "/data/home/user-test/jrhu/v8b")
MODEL_PATH = os.environ.get(
"MODEL_PATH",
os.path.join(V8B_BASE, "data", "models", "Qwen3-8B"),
)
MODEL_REPO = os.environ.get("MODEL_REPO", "Qwen/Qwen3-8B")
RAW_COTS_PATH = os.environ.get(
"RAW_COTS_PATH",
os.path.join(V8B_BASE, "data", "cots", "raw_cots.jsonl"),
)
MATH_SOURCE_PATH = os.environ.get(
"MATH_SOURCE_PATH",
os.path.join(V8B_BASE, "data", "math200.jsonl"),
)
AIME25_PATH = os.environ.get(
"AIME25_PATH",
os.path.join(V8B_BASE, "data", "aime25.jsonl"),
)
AIME25_ANSWERS_PATH = os.environ.get(
"AIME25_ANSWERS_PATH",
os.path.join(V8B_BASE, "data", "aime25_answers.jsonl"),
)
MATH500_FULL_PATH = os.environ.get(
"MATH500_FULL_PATH",
os.path.join(V8B_BASE, "data", "math500_full.jsonl"),
)
GPQA_D_PATH = os.environ.get(
"GPQA_D_PATH",
os.path.join(V8B_BASE, "data", "gpqa_d.jsonl"),
)
DATA_ROOT = os.path.join(PROJECT_ROOT, "data")
LOG_DIR = os.path.join(DATA_ROOT, "logs")
def dim_paths(dim: str):
d = os.path.join(DATA_ROOT, dim)
ck = os.path.join(d, "checkpoints")
ac = os.path.join(d, "activations")
re = os.path.join(d, "results")
class P:
DIM_ROOT = d
CHECKPOINT_DIR = ck
ACT_DIR = ac
RESULTS_DIR = re
ACTIVATIONS = os.path.join(ac, f"activations_{dim}.pt")
DIRECTIONS = os.path.join(ck, f"directions_{dim}.pt")
CALIBRATION = os.path.join(ck, f"calibration_{dim}.json")
SELECTED_LAYERS = os.path.join(ck, f"selected_layers_{dim}.json")
CALIB_BASELINE = os.path.join(ck, "calib_baselines.json")
CALIB_PER_LAYER = os.path.join(ck, "calib_per_layer")
return P
def ensure_dirs(dim: str = None):
for d in [DATA_ROOT, LOG_DIR,
os.path.join(DATA_ROOT, "cots"),
os.path.join(DATA_ROOT, "models")]:
os.makedirs(d, exist_ok=True)
if dim:
p = dim_paths(dim)
for d in [p.DIM_ROOT, p.CHECKPOINT_DIR, p.ACT_DIR,
p.RESULTS_DIR, p.CALIB_PER_LAYER]:
os.makedirs(d, exist_ok=True)
if __name__ == "__main__":
ensure_dirs("monitoring")
print("PROJECT_ROOT :", PROJECT_ROOT)
print("V8B_BASE :", V8B_BASE)
print("MODEL_PATH :", MODEL_PATH, "| exists?", os.path.isdir(MODEL_PATH))
print("MODEL_REPO :", MODEL_REPO)
print("RAW_COTS_PATH :", RAW_COTS_PATH)
print("MATH_SOURCE_PATH :", MATH_SOURCE_PATH, "| exists?", os.path.isfile(MATH_SOURCE_PATH))
print("AIME25_PATH :", AIME25_PATH, "| exists?", os.path.isfile(AIME25_PATH))
print("AIME25_ANSWERS_PATH:", AIME25_ANSWERS_PATH, "| exists?", os.path.isfile(AIME25_ANSWERS_PATH))