Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 1 addition & 8 deletions export_hf_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,6 @@
# did we do anything?
assert not torch.allclose(first_weight_old, first_weight)

lora_model_sd = lora_model.state_dict()
deloreanized_sd = {
k.replace("base_model.model.", ""): v
for k, v in lora_model_sd.items()
if "lora" not in k
}

LlamaForCausalLM.save_pretrained(
base_model, "./hf_ckpt", state_dict=deloreanized_sd, max_shard_size="400MB"
base_model, "./hf_ckpt", max_shard_size="400MB"
)
7 changes: 0 additions & 7 deletions finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,6 @@ def generate_and_tokenize_prompt(data_point):
)
model.config.use_cache = False

old_state_dict = model.state_dict
model.state_dict = (
lambda self, *_, **__: get_peft_model_state_dict(
self, old_state_dict()
)
).__get__(model, type(model))

if torch.__version__ >= "2" and sys.platform != "win32":
model = torch.compile(model)

Expand Down