xuan-luo's picture
download
raw
2.06 kB
"""Validated launcher helpers for isolated shared-projection experiments."""
from pathlib import Path
from utils.megatron_launcher import validate_config
def architecture_arguments(config, experiment_root: Path, roll_dim: int, entry_spec: str):
validate_config(config, None)
model, training = config["model"], config["training"]
fields = ("num_layers", "hidden_size", "num_attention_heads", "num_query_groups",
"kv_channels", "ffn_hidden_size", "rolling_state_dim", "local_window")
expected = (12, 512, 8, 4, 64, 2166, roll_dim, 128)
actual = tuple(model.get(key) for key in fields)
if actual != expected:
raise ValueError(f"shared-projection experiment requires {expected}, got {actual}")
if model.get("rolling_rope_mode") != "full_head" or model.get("rope_theta") != 1_000_000:
raise ValueError("requires standard full-head 64-D RoPE with theta=1e6")
if (model.get("attention_variant") is not None or model.get("qk_layernorm")
or not model.get("untie_embeddings_and_output_weights")):
raise ValueError("use dedicated spec, no QK norm, and untied embeddings")
parallel = (training["tensor_model_parallel_size"],
training["pipeline_model_parallel_size"],
training["context_parallel_size"], training["sequence_parallel"])
if parallel != (1, 1, 1, False) or training.get("recompute_granularity") is not None:
raise ValueError("requires TP=PP=CP=1, no SP or activation recomputation")
root = experiment_root.resolve()
output = (root.parents[1] / config["paths"]["output_dir"]).resolve()
if not output.is_relative_to(root):
raise ValueError("refusing to write checkpoints outside the isolated experiment")
source = config["paths"].get("init_checkpoint")
if source and not (root.parents[1] / source).resolve().is_relative_to(root):
raise ValueError("only this experiment's preceding stage may be loaded")
return ["--no-create-attention-mask-in-dataloader", "--spec", entry_spec, "spec"]

Xet Storage Details

Size:
2.06 kB
·
Xet hash:
bc7ec86e0834e8df2d6718fcf86fb7eeaca098a414d2f007a4b5f7d6d57f31c7

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.