Views
No views yet
AutoModel-loadable checkpoint. See modeling_hybrid.py for the
exact code and load instructions.1from transformers import AutoModelForCausalLM
2import torch
3from modeling_hybrid import hybridize
4
5base = AutoModelForCausalLM.from_pretrained(
6 "meta-llama/Llama-3.2-1B", torch_dtype=torch.float32
7)
8LAYERS_TO_KEEP_ATTENTION = set([0, 4, 8, 12])
9model = hybridize(base, LAYERS_TO_KEEP_ATTENTION)
10state_dict = torch.load("pytorch_model.bin", map_location="cpu")
11model.load_state_dict(state_dict)
12model.eval()