这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@BenjaminBossan
Copy link
Member

@BenjaminBossan BenjaminBossan commented Aug 13, 2025

Resolves #2695

For some PEFT methods, there was a bit of a mess when it comes to how the init_weights argument was set in test_custom_models.py. The default kwargs for the tests should be that the PEFT method is initialized as an identity transform, and for specific tests we want to disable that. Note that most PEFT methods are initialized by default to be identity transforms, which is why the argument does not need to be set explicitly, but it's not true for all PEFT methods.

With this PR, SHiRA, C3A, and FourierFT are now initialized to be consistent with this. This made it possible to remove some extra handling of those methods which was intermingled with certain tests.

Moreover, in the appropriate places, I did the following:

  • use the set_init_weights_false helper function
  • cleaned up a bit the docs for the init_weights arguments of these PEFT methods
  • added clarifying comments
  • for test_unload_adapter, simplified a config type check and rewrote it to load the base model only once

Resolves huggingface#2695

For some PEFT methods, there was a bit of a mess when it comes to how
the init_weights argument was set in test_custom_models.py. The default
kwargs for the tests should be that the PEFT method is initialized as an
identity transform, and for specific tests we want to disable that. Note
that most PEFT methods are initialized by default to be identity
transforms, which is why the argument does not need to be set
explicitly, but it's not true for all PEFT methods.

With this PR, SHiRA, C3A, and FourierFT are now initialized to be
consistent with this. This made it possible to remove some extra
handling of those methods which was intermingled with certain tests.

Moreover, test_custom_models.py now uses the set_init_weights_false
helper function where appropriate.

While working on this, I also cleaned up a bit the docs for the
init_weights arguments of these PEFT methods where appropriate.
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

- simplify check by checking for prompt learning config
- don't unnecessarily load the base model twice
Copy link
Collaborator

@githubnemo githubnemo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise. I also appreciate the added comments in the tests.

Co-authored-by: githubnemo <githubnemo@users.noreply.github.com>
@BenjaminBossan BenjaminBossan merged commit b5ace6a into huggingface:main Aug 19, 2025
10 of 14 checks passed
@BenjaminBossan BenjaminBossan deleted the chore-clean-up-custom-test-config-kwargs branch August 19, 2025 09:55
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.

TST: Some SHiRA tests are failing when run with parallelism

3 participants