Skip to content

Fix active adapter detection for text encoders - #14961

Merged
sayakpaul merged 3 commits into
huggingface:mainfrom
Subodh-17:fix/get-active-adapters-text-encoder
Oct 8, 2026
Merged

sayakpaul merged 3 commits into
huggingface:mainfrom
Subodh-17:fix/get-active-adapters-text-encoder

Conversation

@Subodh-17

Copy link
Copy Markdown
Contributor

Summary

Fixes an issue where get_active_adapters() returns an empty list when a LoRA adapter is attached only to a text encoder.

get_active_adapters() previously only inspected ModelMixin components, while text encoders inherit from PreTrainedModel. This change includes both component types, matching the behavior already used by other LoRA adapter methods.

Testing

  • Added test_get_active_adapters_text_encoder_only
  • Focused regression test passes
  • Relevant LoRA loader tests pass
  • git diff --check passes

Fixes #14955

@sayakpaul

Copy link
Copy Markdown
Member

Let's wait for #14965 to get merged first.

@HuggingFaceDocBuilderDev

Copy link
Copy Markdown

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.

Signed-off-by: Subodh Bansode <subodh171011@gmail.com>
@Subodh-17
Subodh-17 force-pushed the fix/get-active-adapters-text-encoder branch from e89f06d to 74e2c61 Compare October 6, 2026 16:51

@BenjaminBossan BenjaminBossan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for fixing this, I confirmed that the test fails without the fix.

Comment thread tests/lora/utils.py Outdated
"Fused lora should change the output",
)

def test_get_active_adapters_text_encoder_only(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Signed-off-by: Subodh Bansode <subodh171011@gmail.com>
@Subodh-17
Subodh-17 force-pushed the fix/get-active-adapters-text-encoder branch from cfed9d0 to f656aa9 Compare October 8, 2026 04:49
@sayakpaul

Copy link
Copy Markdown
Member

/diffusers-bot pytest tests/pipelines -k "test_get_active_adapters_text_encoder_only"

@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

✅ pytest tests/pipelines -k "test_get_active_adapters_text_encoder_only" passed on GPU — view logs.

@sayakpaul
sayakpaul merged commit e0415c4 into huggingface:main Oct 8, 2026
33 of 36 checks passed
@sayakpaul sayakpaul added this to the Release 0.42.0 milestone Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

get_active_adapters() returns empty for active text-encoder-only LoRA adapters

4 participants