Spaces:
Sleeping
Sleeping
Update app.py
Browse files126 unmodified lines1271281291301311321331341351361371381 unmodified line140141142143144145146147148149150126 unmodified linesmodel = CodeSymb1B(vocab=VOCAB) # β architecture built to match REAL vocab sizeckpt_found = Falsefor ckpt_name in ["checkpoints/sft_latest.pt","checkpoints/latest.pt","checkpoints/sft_chat_latest.pt"]:try:ckpt_path = hf_hub_download(REPO_ID, ckpt_name, token=HF_TOKEN or None)state = torch.load(ckpt_path, map_location="cpu", mmap=True)model_state = state.get("model", state)model.load_state_dict(model_state, strict=False)step = state.get("step", 0)1 unmodified lineckpt_found = Truebreakexcept Exception as e:print(f" Not found: {ckpt_name}")# β HARD FAIL β never serve a random-weight model silentlyif not ckpt_found:raise RuntimeError("β NO CHECKPOINT FOUND on HF! Fix repo before deploying!")model.eval()n_params = sum(p.numel() for p in model.parameters())126 unmodified lines1271281291301311321331341351361371381391401411421431 unmodified line145146147148149150151152153154155156126 unmodified linesmodel = CodeSymb1B(vocab=VOCAB) # β architecture built to match REAL vocab sizeckpt_found = Falselast_err = Nonefor ckpt_name in ["checkpoints/sft_latest.pt","checkpoints/latest.pt","checkpoints/sft_chat_latest.pt"]:try:ckpt_path = hf_hub_download(REPO_ID, ckpt_name, token=HF_TOKEN or None)print(f"β¬οΈ Downloaded {ckpt_name} β loading weights...")try:state = torch.load(ckpt_path, map_location="cpu") # β NO mmapexcept Exception:state = torch.load(ckpt_path, map_location="cpu", weights_only=False)model_state = state.get("model", state)model.load_state_dict(model_state, strict=False)step = state.get("step", 0)1 unmodified lineckpt_found = Truebreakexcept Exception as e:last_err = eprint(f" β οΈ {ckpt_name} failed: {type(e).__name__}: {e}") # β show REAL errorif not ckpt_found:raise RuntimeError(f"β NO CHECKPOINT LOADED! Last error: {last_err}")model.eval()n_params = sum(p.numel() for p in model.parameters())
app.py+10-4