Skip to content

Fix PEFT example and base-model config resolution for adapter models#1301

Open
oraziooztas wants to merge 1 commit into
huggingface:mainfrom
oraziooztas:fix/682-peft-adapter-config
Open

Fix PEFT example and base-model config resolution for adapter models#1301
oraziooztas wants to merge 1 commit into
huggingface:mainfrom
oraziooztas:fix/682-peft-adapter-config

Conversation

@oraziooztas

Copy link
Copy Markdown

Fixes #682.

What does this PR do?

The PEFT adapter path was broken in three places:

  • examples/model_configs/peft_model.yaml used obsolete fields and did not select the adapter backend;
  • AdapterModelConfig resolved the Transformers config and the default tokenizer from the adapter repository instead of the base model;
  • AdapterModel._create_auto_model() read the removed pretrained field instead of the adapter model_name.

This PR migrates the example to the current schema, resolves config/tokenizer from base_model, loads adapter weights from model_name, and keeps AdapterModelConfig importable without the optional peft runtime (the runtime test skips cleanly when peft is absent).

Test plan

  • Adapter and adjacent Transformers tests with peft==0.3.0: 17 passed, 16 subtests passed
  • Adapter config test without peft in an isolated environment: 1 passed, runtime-only test skipped
  • ruff check and ruff format --check pass
  • git diff --check clean

🤖 Generated with Claude Code

https://claude.ai/code/session_0158ZooCCJEy6xtme9c8iksT

- 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
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.

[FT] Improve Documentation and Examples

1 participant