Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Mistral #133

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
4 changes: 4 additions & 0 deletions tuned_lens/model_surgery.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ def get_final_norm(model: Model) -> Norm:
final_layer_norm = base_model.ln_f
elif isinstance(base_model, models.llama.modeling_llama.LlamaModel):
final_layer_norm = base_model.norm
elif isinstance(base_model, models.mistral.modeling_mistral.MistralModel):
final_layer_norm = base_model.norm
else:
raise NotImplementedError(f"Unknown model type {type(base_model)}")

Expand Down Expand Up @@ -159,6 +161,8 @@ def get_transformer_layers(model: Model) -> tuple[str, th.nn.ModuleList]:
path_to_layers += ["h"]
elif isinstance(base_model, models.llama.modeling_llama.LlamaModel):
path_to_layers += ["layers"]
elif isinstance(base_model, models.mistral.modeling_mistral.MistralModel):
path_to_layers += ["layers"]
else:
raise NotImplementedError(f"Unknown model type {type(base_model)}")

Expand Down
Loading