Skip to content

Commit a403be8

Browse files
committed
address cursor feedback... crazy cursor is actually useful
1 parent 4149c6e commit a403be8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

olmoearth_pretrain/model_loader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ def load_model(model_id: ModelID, load_weights: bool = True) -> torch.nn.Module:
5454
config_fname = hf_hub_download(
5555
repo_id="allenai/olmoearth_pretrain", filename=f"{model_id.value}-config.json"
5656
) # nosec
57-
pth_fname = hf_hub_download(
58-
repo_id="allenai/olmoearth_pretrain", filename=f"{model_id.value}.pth"
59-
) # nosec
6057
with open(config_fname) as f:
6158
config_dict = json.load(f)
6259
model_config = Config.from_dict(config_dict["model"])
@@ -66,6 +63,9 @@ def load_model(model_id: ModelID, load_weights: bool = True) -> torch.nn.Module:
6663
if not load_weights:
6764
return model
6865

66+
pth_fname = hf_hub_download(
67+
repo_id="allenai/olmoearth_pretrain", filename=f"{model_id.value}.pth"
68+
) # nosec
6969
state_dict = torch.load(pth_fname)
7070
model.load_state_dict(state_dict)
7171
return model

0 commit comments

Comments
 (0)