Skip to content

ValueError when using FromOriginalModelMixin in subclasses #8440

Closed
@luocfprime

Description

@luocfprime

Describe the bug

ValueError when using FromOriginalModelMixin in subclasses due to the following strict class check:

class_name = cls.__name__
if class_name not in SINGLE_FILE_LOADABLE_CLASSES:
raise ValueError(
f"FromOriginalModelMixin is currently only compatible with {', '.join(SINGLE_FILE_LOADABLE_CLASSES.keys())}"
)

Could it be possible to extend from_single_file to derived classes of SINGLE_FILE_LOADABLE_CLASSES too?

Reproduction

Example:

class MyVAE(AutoencoderKL):
    pass

MyVAE.from_single_file("xxx.safetensors")

Logs

No response

System Info

diffusers 0.28.0

Who can help?

@sayakpaul @DN6 @yiyixuxu

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions