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

fix: Handle missing and unexpected keys during LLMEncoder state dict load #3841

Merged
merged 3 commits into from
Dec 20, 2023

Conversation

jeffkinnison
Copy link
Contributor

When using an adapter, the LLMEncoder uses custom state_dict() ans load_state_dict() logic to only save/load adapter parameters, however loading would fail when using strict mode due to

  • The base model's parameters being excluded from state_dict (missing_keys)
  • The adapter parameters being recorded under different names under the hood by peft (unexpected_keys)

None of these keys are missing or unexpected under the custom logic, though, so the lists of missing and unexpected keys must be updated to reflect our expected state. This PR adds a post-load hook that updates the missing_keys and unexpected_keys lists to reflect our custom logic, and it re-enables a unit test that checks loading adapter state.

Copy link

github-actions bot commented Dec 19, 2023

Unit Test Results

  6 files  ±0    6 suites  ±0   13m 56s ⏱️ +5s
12 tests ±0    9 ✔️ ±0    3 💤 ±0  0 ±0 
60 runs  ±0  42 ✔️ ±0  18 💤 ±0  0 ±0 

Results for commit f800b6b. ± Comparison against base commit aa17e08.

♻️ This comment has been updated with latest results.

@jeffkinnison jeffkinnison merged commit 8f9b546 into master Dec 20, 2023
18 checks passed
@jeffkinnison jeffkinnison deleted the llm-encoder-load-fix branch December 20, 2023 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants