-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Integration of from_pretrained
and from_single_file
#10208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Integration of from_pretrained
and from_single_file
#10208
Conversation
Updated dictionary used when loading the |
Can anyone please review this PR? |
…loading_method_integration
…e map for loading single file checkpoints.
…Integrate-load-method-into-from_pretrained
local_files_only=local_files_only, | ||
revision=revision, | ||
) | ||
pipeline_class = _get_pipeline_class(cls, class_name=cls.__name__, config=None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you don't pass the class_name when loading a single file checkpoint in DiffusionPipeline
, it will result in a TypeError.
# Load the pipeline from a single file | ||
elif load_method_name == "from_single_file": | ||
# The arguments for the __init__ method of `DiffusionPipeline` are keyword arguments, so they cannot be loaded from `from_single_file` | ||
if cls.__name__ == "DiffusionPipeline": | ||
# import it here to avoid circular import | ||
from .stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt | ||
|
||
checkpoint = load_single_file_checkpoint( | ||
pretrained_model_name_or_path, | ||
force_download=force_download, | ||
proxies=proxies, | ||
token=token, | ||
cache_dir=cache_dir, | ||
local_files_only=local_files_only, | ||
revision=revision, | ||
) | ||
|
||
return download_from_original_stable_diffusion_ckpt(checkpoint, **kwargs) | ||
else: | ||
return cls.from_single_file(pretrained_model_name_or_path, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm separating the process because executing DiffusionPipeline.from_single_file
results in the following error:
ValueError: Pipeline <class 'diffusers.pipelines.pipeline_utils.DiffusionPipeline'> expected {'kwargs', 'args'}, but only set() were passed.
…loading_method_integration
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread. Please note that issues that do not follow the contributing guidelines are likely to be ignored. |
…loading_method_integration
hi @suzukimain thanks for the PR, like @DN6 mentioned here #10208 (comment) but we are not 100% about if we are going to unify these two methods yet. We will not be able to merge PR at the moment. sorry if we wasted your time. In the future, would you be abe to open an issue and start a discussion first? |
I understand. I appreciate your kind response during your busy time. |
What does this PR do?
This PR integrates the
from_single_file
function intofrom_pretrained
Additionally, since
AutoPipeline
doesn't have a method to load single file checkpoints, I've adapted a part of the model_search functionality to enable this capability.Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
@yiyixuxu ,@asomoza