mirror of
https://github.com/karpathy/nanochat.git
synced 2026-01-30 04:22:02 +00:00
fix lstrip bug, make it removeprefix, TIL.
This commit is contained in:
@@ -72,7 +72,7 @@ def build_model(checkpoint_dir, step, device, phase):
|
|||||||
for k, v in model_data.items()
|
for k, v in model_data.items()
|
||||||
}
|
}
|
||||||
# Hack: fix torch compile issue, which prepends all keys with _orig_mod.
|
# Hack: fix torch compile issue, which prepends all keys with _orig_mod.
|
||||||
model_data = {k.lstrip("_orig_mod."): v for k, v in model_data.items()}
|
model_data = {k.removeprefix("_orig_mod."): v for k, v in model_data.items()}
|
||||||
model_config_kwargs = meta_data["model_config"]
|
model_config_kwargs = meta_data["model_config"]
|
||||||
log0(f"Building model with config: {model_config_kwargs}")
|
log0(f"Building model with config: {model_config_kwargs}")
|
||||||
model_config = GPTConfig(**model_config_kwargs)
|
model_config = GPTConfig(**model_config_kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user