fix component library resolution when a transformers model folder shadows a pipeline dir - #14652
Conversation
…dows a pipeline dir
|
Hmm interesting and this is not covered by our tests because @kashif I am wondering if it's possible to still extend the |
|
Hi @akshan-main, thanks for the PR! It does not appear to link an issue it fixes. If this PR addresses an existing issue, please add a closing keyword (e.g. Please note that PRs without a linked issue are likely to be automatically closed 10 days after this notice. Once the PR links an issue (or gets the |
|
Good idea, and it's doable. Want me to open a PR for this? |
Yes please! |
|
Opened #14661. |
What does this PR do?
_fetch_class_library_tupletreats a component as a pipeline-module class whenever its parent folder name matches a diffusers pipeline folder, without checking the module actually lives in diffusers. A transformers class whose model folder shares a name with a diffusers pipeline folder gets the pipeline folder recorded as its library inmodel_index.json, andfrom_pretrainedthen fails trying to import it fromdiffusers.pipelines.<name>.This breaks
DiffusionGemmaPipelinesave/load on main today (transformers.models.diffusion_gemmacollides withdiffusers.pipelines.diffusion_gemma):The fix requires the module path to start with the diffusers package for the pipeline-module branch. Classes genuinely defined inside a pipeline folder (e.g.
IFWatermarker) still resolve to their pipeline dir, and unit tests cover all three resolution cases.Before submitting
Who can review?
@sayakpaul @DN6