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

Fixes LoRA save issue #533

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
12 changes: 6 additions & 6 deletions finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,12 +260,12 @@ 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))
#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