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

[community] Load Models from Sources like Civitai into Existing Pipelines #9986

Merged
merged 38 commits into from
Dec 6, 2024

Conversation

suzukimain
Copy link
Contributor

@suzukimain suzukimain commented Nov 21, 2024

What does this PR do?

This PR adds an example that allows you to search for models from Civitai and Hugging Face by simply entering a keyword and loading models that meet the criteria into existing pipelines.

Example

!wget https://raw.githubusercontent.com/suzukimain/auto_diffusers/refs/heads/master/src/auto_diffusers/pipeline_easy.py
from pipeline_easy import (
    EasyPipelineForText2Image,
    EasyPipelineForImage2Image,
    EasyPipelineForInpainting,
)

# Search for Civitai
pipeline = EasyPipelineForText2Image.from_civitai(
    "search_word",
    base_model="SD 1.5",
).to("cuda")


# Search for Hugging Face
pipeline = EasyPipelineForText2Image.from_huggingface(
    "search_word",
    checkpoint_format="diffusers",
).to("cuda")

Before submitting

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@bghira
Copy link
Contributor

bghira commented Nov 22, 2024

can it use AIR IDs to import them? thanks for this example!

edit: the fact that model API responses has the model type in it we could even do AutoPipeline.from_civitai(air=model_air) kind of thing.

Copy link
Member

@stevhliu stevhliu left a comment

Choose a reason for hiding this comment

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

Nice, really cool and convenient functionality!

examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@suzukimain
Copy link
Contributor Author

I was mostly done reflecting the changes.
However, I was not sure how to do these parts.
cc: @stevhliu

| model_type | string | `Checkpoint` | The type of model to search for. <br>(for example `Checkpoint`, `TextualInversion`, `Controlnet`, `LORA`, `Hypernetwork`, `AestheticGradient`, `Poses`) |

| checkpoint_format | string | `single_file` | The format of the model checkpoint.<br>`single_file` to search for `single file checkpoint` <br>`diffusers` to search for `multifolder diffusers format checkpoint` |

Copy link
Member

@stevhliu stevhliu left a comment

Choose a reason for hiding this comment

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

Thanks! Just a few more formatting things :)

examples/model_search/README.md Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
examples/model_search/README.md Outdated Show resolved Hide resolved
@suzukimain
Copy link
Contributor Author

Fixed. Please confirm. cc:@stevhliu

Copy link
Member

@stevhliu stevhliu left a comment

Choose a reason for hiding this comment

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

Cool, thanks so much for your project 🤗

Can you run make style to fix the failing CI test?

@suzukimain
Copy link
Contributor Author

hi, @stevhliu Corrected

@suzukimain
Copy link
Contributor Author

Corrected pipeline style.

@stevhliu stevhliu merged commit 6394d90 into huggingface:main Dec 6, 2024
8 checks passed
sayakpaul pushed a commit that referenced this pull request Dec 23, 2024
…elines (#9986)

* Added example of model search.

* Combine processing into one file

* Add parameters for base model

* Bug Fixes

* bug fix

* Create README.md

* Update search_for_civitai_and_HF.py

* Create requirements.txt

* bug fix

* Update README.md

* bug fix

* Correction of typos

* Update examples/model_search/README.md

Co-authored-by: Steven Liu <[email protected]>

* Update examples/model_search/README.md

Co-authored-by: Steven Liu <[email protected]>

* Update examples/model_search/README.md

Co-authored-by: Steven Liu <[email protected]>

* Update examples/model_search/README.md

Co-authored-by: Steven Liu <[email protected]>

* Update examples/model_search/README.md

Co-authored-by: Steven Liu <[email protected]>

* Update examples/model_search/README.md

Co-authored-by: Steven Liu <[email protected]>

* apply the changes

* Replace search_for_civitai_and_HF.py with pipeline_easy.py

* Update examples/model_search/README.md

Co-authored-by: Steven Liu <[email protected]>

* Update examples/model_search/README.md

Co-authored-by: Steven Liu <[email protected]>

* Update examples/model_search/README.md

Co-authored-by: Steven Liu <[email protected]>

* Update README.md

* Organize the table of parameters

* Update README.md

* Update README.md

* Update README.md

* make style

* Fixing the style of pipeline

* Fix pipeline style

* fix

---------

Co-authored-by: Steven Liu <[email protected]>
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.

4 participants