Skip to content

Repository files navigation



GitHub release

GitHub releaseGitHub releaseVisitor Badge

CONTENTS

About The Project

Enhance the functionality of diffusers.

Image of the listing location on Hugging Face



Regarding the Civitai API bug

The previously reported Civitai API issue has largely been resolved.

Previous issue description

Due to recent specification changes in the Civitai API, we were aware of the following issues:

  • Reduced search accuracy
  • Some search results not being returned

A temporary workaround has been implemented for the above issues, but since certain search results are still not returned, there is a possibility that some models may not be found.

link: civitai/civitai#1757

How to use

pipinstall--quietauto_diffusers
importtorchfromauto_diffusersimportEasyPipelineForText2Image# Load an official Hugging Face modelpipe=EasyPipelineForText2Image.from_huggingface(
"stabilityai/stable-diffusion-xl-base-1.0",
dtype=torch.float16,
).to("cuda")
img=pipe("cat").images[0]
img.save("cat.png")
# Search for Civitaipipe=EasyPipelineForText2Image.from_civitai(
"search_word",
dtype=torch.float16,
).to("cuda")
image=pipe("cat").images[0]
image.save("cat.png")

Use dtype for new code. torch_dtype remains supported for compatibility, but do not pass both arguments at the same time.

Search Civitai and Huggingface

# Load Lora into the pipeline.pipe.auto_load_lora_weights("Detail Tweaker")
# Load TextualInversion into the pipeline.pipe.auto_load_textual_inversion("EasyNegative", token="EasyNegative")

Search Civitai

Tip

If an error occurs, insert the token and run again.

EasyPipeline.from_civitai parameters

NameTypeDefaultDescription
search_wordstring, PathrequiredThe search query string. Can be a keyword, Civitai URL, local directory or file path.
model_typestringCheckpointThe type of model to search for.
(for example Checkpoint, TextualInversion, Controlnet, LORA, Hypernetwork, AestheticGradient, Poses)
base_modelstringNoneTrained model tag (for example SD 1.5, SD 3.5, SDXL 1.0)
dtypestring, torch.dtypeNoneOverride the default torch.dtype and load the model with another dtype.
force_downloadboolFalseWhether or not to force the (re-)download of the model weights and configuration files, overriding the cached versions if they exist.
cache_dirstring, PathNonePath to the folder where cached files are stored.
resumeboolFalseWhether to resume an incomplete download.
tokenstringNoneAPI token for Civitai authentication.

search_civitai parameters

NameTypeDefaultDescription
search_wordstring, PathrequiredThe search query string. Can be a keyword, Civitai URL, local directory or file path.
model_typestringCheckpointThe type of model to search for.
(for example Checkpoint, TextualInversion, Controlnet, LORA, Hypernetwork, AestheticGradient, Poses)
base_modelstringNoneTrained model tag (for example SD 1.5, SD 3.5, SDXL 1.0)
downloadboolFalseWhether to download the model.
force_downloadboolFalseWhether to force the download if the model already exists.
cache_dirstring, PathNonePath to the folder where cached files are stored.
resumeboolFalseWhether to resume an incomplete download.
tokenstringNoneAPI token for Civitai authentication.
include_paramsboolFalseWhether to include parameters in the returned data.
skip_errorboolFalseWhether to skip errors and return None.

Search Huggingface

Tip

If an error occurs, insert the token and run again.

EasyPipeline.from_huggingface parameters

NameTypeDefaultDescription
search_wordstring, PathrequiredThe search query string. Can be a keyword, Hugging Face URL, local directory or file path, or a Hugging Face path (<creator>/<repo>).
checkpoint_formatstringsingle_fileThe format of the model checkpoint.
- single_file to search for single file checkpoint
- diffusers to search for multifolder diffusers format checkpoint
dtypestring, torch.dtypeNoneOverride the default torch.dtype and load the model with another dtype.
force_downloadboolFalseWhether or not to force the (re-)download of the model weights and configuration files, overriding the cached versions if they exist.
cache_dirstring, PathNonePath to a directory where a downloaded pretrained model configuration is cached if the standard cache is not used.
tokenstring, boolNoneThe token to use as HTTP bearer authorization for remote files.

search_huggingface parameters

NameTypeDefaultDescription
search_wordstring, PathrequiredThe search query string. Can be a keyword, Hugging Face URL, local directory or file path, or a Hugging Face path (<creator>/<repo>).
checkpoint_formatstringsingle_fileThe format of the model checkpoint.
- single_file to search for single file checkpoint
- diffusers to search for multifolder diffusers format checkpoint
pipeline_tagstringNoneTag to filter models by pipeline.
downloadboolFalseWhether to download the model.
force_downloadboolFalseWhether or not to force the (re-)download of the model weights and configuration files, overriding the cached versions if they exist.
cache_dirstring, PathNonePath to a directory where a downloaded pretrained model configuration is cached if the standard cache is not used.
tokenstring, boolNoneThe token to use as HTTP bearer authorization for remote files.
include_paramsboolFalseWhether to include parameters in the returned data.
skip_errorboolFalseWhether to skip errors and return None.

License

In accordance with Apache-2.0 license

Acknowledgement

I have used open source resources and free tools in the creation of this project.

I would like to take this opportunity to thank the open source community and those who provided free tools.

About

diffusers with search engine

Topics

Resources

Stars

12 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages