[ONNX] Don't download ONNX model by default by patrickvonplaten · Pull Request #4338 · huggingface/diffusers · GitHub
Skip to content

[ONNX] Don't download ONNX model by default - #4338

Merged
patrickvonplaten merged 8 commits into
mainfrom
fix_onnx_download
Jul 28, 2023
Merged

patrickvonplaten merged 8 commits into
mainfrom
fix_onnx_download

Conversation

@patrickvonplaten

@patrickvonplaten patrickvonplaten commented Jul 28, 2023 •

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR makes sure that ONNX weights are only ever by default downloaded by ONNX pipelines, but not any PyTorch pipelines.

The user is also given the option to have more fine-grained control via a use_onnx download argument.

@HuggingFaceDocBuilderDev

HuggingFaceDocBuilderDev commented Jul 28, 2023 •

Copy link
Copy Markdown

):
ignore_patterns = ["*.bin", "*.msgpack"]

if not use_onnx:

@echarlaix echarlaix Jul 28, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be set by default for all the OnnxStableDiffusionXxxPipeline ?

@patrickvonplaten patrickvonplaten changed the title Fix onnx download [ONNX] Don't download ONNX model by default Jul 28, 2023

@echarlaix echarlaix left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, thanks for the fix!

@patrickvonplaten
patrickvonplaten merged commit 306a7bd into main Jul 28, 2023
@patrickvonplaten
patrickvonplaten deleted the fix_onnx_download branch July 28, 2023 13:11
sayakpaul pushed a commit that referenced this pull request Jul 28, 2023
* [Download] Don't download ONNX weights by default

* [Download] Don't download ONNX weights by default

* [Download] Don't download ONNX weights by default

* fix more

* finish

* finish

* finish
@JacquiML

Copy link
Copy Markdown
Contributor

Hey @sayakpaul , in from_pretrained func, when calling cls.download, should we as use_onnx as an input parameter?
current:

 if not os.path.isdir(pretrained_model_name_or_path):
            cached_folder = cls.download(
                pretrained_model_name_or_path,
                cache_dir=cache_dir,
                resume_download=resume_download,
                force_download=force_download,
                proxies=proxies,
                local_files_only=local_files_only,
                use_auth_token=use_auth_token,
                revision=revision,
                from_flax=from_flax,
                use_safetensors=use_safetensors,
                custom_pipeline=custom_pipeline,
                custom_revision=custom_revision,
                variant=variant,
                load_connected_pipeline=load_connected_pipeline,
                **kwargs,
            )

proposed (added use_onnx=use_onnx,):

 if not os.path.isdir(pretrained_model_name_or_path):
            cached_folder = cls.download(
                pretrained_model_name_or_path,
                cache_dir=cache_dir,
                resume_download=resume_download,
                force_download=force_download,
                proxies=proxies,
                local_files_only=local_files_only,
                use_auth_token=use_auth_token,
                revision=revision,
                from_flax=from_flax,
                use_safetensors=use_safetensors,
                use_onnx=use_onnx,
                custom_pipeline=custom_pipeline,
                custom_revision=custom_revision,
                variant=variant,
                load_connected_pipeline=load_connected_pipeline,
                **kwargs,
            )

@sayakpaul

Copy link
Copy Markdown
Member

@patrickvonplaten ^.

orpatashnik pushed a commit to orpatashnik/diffusers that referenced this pull request Aug 1, 2023
* [Download] Don't download ONNX weights by default

* [Download] Don't download ONNX weights by default

* [Download] Don't download ONNX weights by default

* fix more

* finish

* finish

* finish
orpatashnik pushed a commit to orpatashnik/diffusers that referenced this pull request Aug 1, 2023
* [Download] Don't download ONNX weights by default

* [Download] Don't download ONNX weights by default

* [Download] Don't download ONNX weights by default

* fix more

* finish

* finish

* finish
orpatashnik pushed a commit to orpatashnik/diffusers that referenced this pull request Aug 1, 2023
* [Download] Don't download ONNX weights by default

* [Download] Don't download ONNX weights by default

* [Download] Don't download ONNX weights by default

* fix more

* finish

* finish

* finish
@patrickvonplaten

Copy link
Copy Markdown
Contributor Author

Hey @JacquiML,

Good point! Would you like to open a PR for this?

@JacquiML

JacquiML commented Aug 3, 2023

Copy link
Copy Markdown
Contributor

yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
* [Download] Don't download ONNX weights by default

* [Download] Don't download ONNX weights by default

* [Download] Don't download ONNX weights by default

* fix more

* finish

* finish

* finish
AmericanPresidentJimmyCarter pushed a commit to AmericanPresidentJimmyCarter/diffusers that referenced this pull request Apr 26, 2024
* [Download] Don't download ONNX weights by default

* [Download] Don't download ONNX weights by default

* [Download] Don't download ONNX weights by default

* fix more

* finish

* finish

* finish
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.

5 participants