Skip to content
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

Fix pipelines user_agent, ignore CI requests #1058

Merged
merged 4 commits into from
Oct 31, 2022
Merged

Conversation

anton-l
Copy link
Member

@anton-l anton-l commented Oct 29, 2022

  • Makes sure that the pipeline class takes priority over _class_name (so that we count StableDiffusionImg2Img too)
  • Adds UA logging to the Flax pipeline
  • Adds a flag for CI requests to filter them out
  • Formats the UA string similarly to transformers to fix a weird additional none/None inserted into the request

"""
Formats a user-agent string with basic info about a request.
"""
ua = f"diffusers/{__version__}; python/{sys.version.split()[0]}; session_id/{SESSION_ID}"
Copy link
Member Author

Choose a reason for hiding this comment

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

This is how it's done in transformers, now here too :)

@@ -301,6 +302,13 @@ def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union[str, os.P
allow_patterns = [os.path.join(k, "*") for k in folder_names]
allow_patterns += [FLAX_WEIGHTS_NAME, SCHEDULER_CONFIG_NAME, CONFIG_NAME, cls.config_name]

if cls != FlaxDiffusionPipeline:
Copy link
Member Author

Choose a reason for hiding this comment

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

Flax pipelines now count too

Copy link
Contributor

Choose a reason for hiding this comment

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

Cool!

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Oct 29, 2022

The documentation is not available anymore as the PR was closed or merged.

Copy link
Contributor

@patrickvonplaten patrickvonplaten left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@anton-l anton-l merged commit 1606eb9 into main Oct 31, 2022
@anton-l anton-l deleted the fix-pipeline-class-agent branch October 31, 2022 12:41
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
* Fix pipelines user_agent, ignore CI requests

* fix circular import

* N/A versions

* N/A versions
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.

3 participants