Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions transformer_lens/loading_from_pretrained.py
Original file line number Diff line number Diff line change
Expand Up @@ -1903,15 +1903,15 @@ def get_pretrained_state_dict(
hf_model = AutoModelForCausalLM.from_pretrained(
official_model_name,
revision=f"checkpoint-{cfg.checkpoint_value}",
torch_dtype=dtype,
dtype=dtype,
token=huggingface_token if len(huggingface_token) > 0 else None,
**kwargs,
)
elif official_model_name.startswith("EleutherAI/pythia"):
hf_model = AutoModelForCausalLM.from_pretrained(
official_model_name,
revision=f"step{cfg.checkpoint_value}",
torch_dtype=dtype,
dtype=dtype,
token=huggingface_token,
**kwargs,
)
Expand All @@ -1924,21 +1924,21 @@ def get_pretrained_state_dict(
elif "bert" in official_model_name:
hf_model = BertForPreTraining.from_pretrained(
official_model_name,
torch_dtype=dtype,
dtype=dtype,
token=huggingface_token if len(huggingface_token) > 0 else None,
**kwargs,
)
elif "t5" in official_model_name:
hf_model = T5ForConditionalGeneration.from_pretrained(
official_model_name,
torch_dtype=dtype,
dtype=dtype,
token=huggingface_token if len(huggingface_token) > 0 else None,
**kwargs,
)
else:
hf_model = AutoModelForCausalLM.from_pretrained(
official_model_name,
torch_dtype=dtype,
dtype=dtype,
token=huggingface_token if len(huggingface_token) > 0 else None,
**kwargs,
)
Expand Down
Loading