Fix PEFT example and base-model config resolution for adapter models#1301
Open
oraziooztas wants to merge 1 commit into
Open
Fix PEFT example and base-model config resolution for adapter models#1301oraziooztas wants to merge 1 commit into
oraziooztas wants to merge 1 commit into
Conversation
- migrate examples/model_configs/peft_model.yaml to the current adapter schema - resolve AutoConfig and the default tokenizer from base_model - load PEFT adapter weights from model_name - keep AdapterModelConfig importable without the optional peft runtime - add regression coverage for config/tokenizer resolution and weight loading Fixes huggingface#682 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0158ZooCCJEy6xtme9c8iksT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #682.
What does this PR do?
The PEFT adapter path was broken in three places:
examples/model_configs/peft_model.yamlused obsolete fields and did not select the adapter backend;AdapterModelConfigresolved the Transformers config and the default tokenizer from the adapter repository instead of the base model;AdapterModel._create_auto_model()read the removedpretrainedfield instead of the adaptermodel_name.This PR migrates the example to the current schema, resolves config/tokenizer from
base_model, loads adapter weights frommodel_name, and keepsAdapterModelConfigimportable without the optionalpeftruntime (the runtime test skips cleanly whenpeftis absent).Test plan
peft==0.3.0: 17 passed, 16 subtests passedpeftin an isolated environment: 1 passed, runtime-only test skippedruff checkandruff format --checkpassgit diff --checkclean🤖 Generated with Claude Code
https://claude.ai/code/session_0158ZooCCJEy6xtme9c8iksT