auto-diffusers 2.0.14__tar.gz → 2.0.17__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: auto_diffusers
3
- Version: 2.0.14
3
+ Version: 2.0.17
4
4
  Summary: Customized diffusers with model search and other functions.
5
5
  Home-page: https://github.com/suzukimain/auto_diffusers
6
6
  Author: suzukimain
@@ -61,46 +61,26 @@ pip install --quiet auto_diffusers
61
61
  from auto_diffusers import EasyPipelineForText2Image
62
62
 
63
63
  # Search for Huggingface
64
- pipe = EasyPipelineForText2Image.from_huggingface("any").to("cuda")
64
+ pipe = EasyPipelineForText2Image.from_huggingface("search_word").to("cuda")
65
65
  img = pipe("cat").images[0]
66
66
  img.save("cat.png")
67
67
 
68
68
 
69
69
  # Search for Civitai
70
- pipe = EasyPipelineForText2Image.from_civitai("any").to("cuda")
70
+ pipe = EasyPipelineForText2Image.from_civitai("search_word").to("cuda")
71
71
  image = pipe("cat").images[0]
72
72
  image.save("cat.png")
73
73
 
74
74
  ```
75
75
 
76
- ## Search Civitai and Huggingfacee<a name = "Search_Civitai_and_Huggingfacee"></a>
76
+ ## Search Civitai and Huggingfacee<a name = "Search_Civitai_and_Huggingface"></a>
77
77
 
78
78
  ```python
79
- from pipeline_easy import (
80
- search_huggingface,
81
- search_civitai,
82
- )
83
-
84
- # Search Lora
85
- Lora = search_civitai(
86
- "Keyword_to_search_Lora",
87
- model_type="LORA",
88
- base_model = "SD 1.5",
89
- download=True,
90
- )
91
79
  # Load Lora into the pipeline.
92
- pipeline.load_lora_weights(Lora)
80
+ pipe.auto_load_lora_weights("Detail Tweaker")
93
81
 
94
-
95
- # Search TextualInversion
96
- TextualInversion = search_civitai(
97
- "EasyNegative",
98
- model_type="TextualInversion",
99
- base_model = "SD 1.5",
100
- download=True
101
- )
102
82
  # Load TextualInversion into the pipeline.
103
- pipeline.load_textual_inversion(TextualInversion, token="EasyNegative")
83
+ pipe.auto_load_textual_inversion("EasyNegative", token="EasyNegative")
104
84
  ```
105
85
 
106
86
  ### Search Civitai<a name = "Search_Civitai"></a>
@@ -35,46 +35,26 @@ pip install --quiet auto_diffusers
35
35
  from auto_diffusers import EasyPipelineForText2Image
36
36
 
37
37
  # Search for Huggingface
38
- pipe = EasyPipelineForText2Image.from_huggingface("any").to("cuda")
38
+ pipe = EasyPipelineForText2Image.from_huggingface("search_word").to("cuda")
39
39
  img = pipe("cat").images[0]
40
40
  img.save("cat.png")
41
41
 
42
42
 
43
43
  # Search for Civitai
44
- pipe = EasyPipelineForText2Image.from_civitai("any").to("cuda")
44
+ pipe = EasyPipelineForText2Image.from_civitai("search_word").to("cuda")
45
45
  image = pipe("cat").images[0]
46
46
  image.save("cat.png")
47
47
 
48
48
  ```
49
49
 
50
- ## Search Civitai and Huggingfacee<a name = "Search_Civitai_and_Huggingfacee"></a>
50
+ ## Search Civitai and Huggingfacee<a name = "Search_Civitai_and_Huggingface"></a>
51
51
 
52
52
  ```python
53
- from pipeline_easy import (
54
- search_huggingface,
55
- search_civitai,
56
- )
57
-
58
- # Search Lora
59
- Lora = search_civitai(
60
- "Keyword_to_search_Lora",
61
- model_type="LORA",
62
- base_model = "SD 1.5",
63
- download=True,
64
- )
65
53
  # Load Lora into the pipeline.
66
- pipeline.load_lora_weights(Lora)
54
+ pipe.auto_load_lora_weights("Detail Tweaker")
67
55
 
68
-
69
- # Search TextualInversion
70
- TextualInversion = search_civitai(
71
- "EasyNegative",
72
- model_type="TextualInversion",
73
- base_model = "SD 1.5",
74
- download=True
75
- )
76
56
  # Load TextualInversion into the pipeline.
77
- pipeline.load_textual_inversion(TextualInversion, token="EasyNegative")
57
+ pipe.auto_load_textual_inversion("EasyNegative", token="EasyNegative")
78
58
  ```
79
59
 
80
60
  ### Search Civitai<a name = "Search_Civitai"></a>
@@ -0,0 +1 @@
1
+ 2.0.17
@@ -15,11 +15,13 @@
15
15
 
16
16
  import os
17
17
  import re
18
+ import types
18
19
  from collections import OrderedDict
19
20
  from dataclasses import asdict, dataclass
20
- from typing import Union
21
+ from typing import Dict, List, Optional, Union
21
22
 
22
23
  import requests
24
+ import torch
23
25
  from huggingface_hub import hf_api, hf_hub_download
24
26
  from huggingface_hub.file_download import http_get
25
27
  from huggingface_hub.utils import validate_hf_hub_args
@@ -30,6 +32,7 @@ from diffusers.loaders.single_file_utils import (
30
32
  infer_diffusers_model_type,
31
33
  load_single_file_checkpoint,
32
34
  )
35
+ from diffusers.pipelines.animatediff import AnimateDiffPipeline, AnimateDiffSDXLPipeline
33
36
  from diffusers.pipelines.auto_pipeline import (
34
37
  AutoPipelineForImage2Image,
35
38
  AutoPipelineForInpainting,
@@ -39,13 +42,18 @@ from diffusers.pipelines.controlnet import (
39
42
  StableDiffusionControlNetImg2ImgPipeline,
40
43
  StableDiffusionControlNetInpaintPipeline,
41
44
  StableDiffusionControlNetPipeline,
45
+ StableDiffusionXLControlNetImg2ImgPipeline,
46
+ StableDiffusionXLControlNetPipeline,
42
47
  )
48
+ from diffusers.pipelines.flux import FluxImg2ImgPipeline, FluxPipeline
43
49
  from diffusers.pipelines.pipeline_utils import DiffusionPipeline
44
50
  from diffusers.pipelines.stable_diffusion import (
45
51
  StableDiffusionImg2ImgPipeline,
46
52
  StableDiffusionInpaintPipeline,
47
53
  StableDiffusionPipeline,
54
+ StableDiffusionUpscalePipeline,
48
55
  )
56
+ from diffusers.pipelines.stable_diffusion_3 import StableDiffusion3Img2ImgPipeline, StableDiffusion3Pipeline
49
57
  from diffusers.pipelines.stable_diffusion_xl import (
50
58
  StableDiffusionXLImg2ImgPipeline,
51
59
  StableDiffusionXLInpaintPipeline,
@@ -59,46 +67,133 @@ logger = logging.get_logger(__name__)
59
67
 
60
68
  SINGLE_FILE_CHECKPOINT_TEXT2IMAGE_PIPELINE_MAPPING = OrderedDict(
61
69
  [
62
- ("xl_base", StableDiffusionXLPipeline),
63
- ("xl_refiner", StableDiffusionXLPipeline),
64
- ("xl_inpaint", None),
65
- ("playground-v2-5", StableDiffusionXLPipeline),
66
- ("upscale", None),
70
+ ("animatediff_rgb", AnimateDiffPipeline),
71
+ ("animatediff_scribble", AnimateDiffPipeline),
72
+ ("animatediff_sdxl_beta", AnimateDiffSDXLPipeline),
73
+ ("animatediff_v1", AnimateDiffPipeline),
74
+ ("animatediff_v2", AnimateDiffPipeline),
75
+ ("animatediff_v3", AnimateDiffPipeline),
76
+ ("autoencoder-dc-f128c512", None),
77
+ ("autoencoder-dc-f32c32", None),
78
+ ("autoencoder-dc-f32c32-sana", None),
79
+ ("autoencoder-dc-f64c128", None),
80
+ ("controlnet", StableDiffusionControlNetPipeline),
81
+ ("controlnet_xl", StableDiffusionXLControlNetPipeline),
82
+ ("controlnet_xl_large", StableDiffusionXLControlNetPipeline),
83
+ ("controlnet_xl_mid", StableDiffusionXLControlNetPipeline),
84
+ ("controlnet_xl_small", StableDiffusionXLControlNetPipeline),
85
+ ("flux-depth", FluxPipeline),
86
+ ("flux-dev", FluxPipeline),
87
+ ("flux-fill", FluxPipeline),
88
+ ("flux-schnell", FluxPipeline),
89
+ ("hunyuan-video", None),
67
90
  ("inpainting", None),
68
91
  ("inpainting_v2", None),
69
- ("controlnet", StableDiffusionControlNetPipeline),
70
- ("v2", StableDiffusionPipeline),
92
+ ("ltx-video", None),
93
+ ("ltx-video-0.9.1", None),
94
+ ("mochi-1-preview", None),
95
+ ("playground-v2-5", StableDiffusionXLPipeline),
96
+ ("sd3", StableDiffusion3Pipeline),
97
+ ("sd35_large", StableDiffusion3Pipeline),
98
+ ("sd35_medium", StableDiffusion3Pipeline),
99
+ ("stable_cascade_stage_b", None),
100
+ ("stable_cascade_stage_b_lite", None),
101
+ ("stable_cascade_stage_c", None),
102
+ ("stable_cascade_stage_c_lite", None),
103
+ ("upscale", StableDiffusionUpscalePipeline),
71
104
  ("v1", StableDiffusionPipeline),
105
+ ("v2", StableDiffusionPipeline),
106
+ ("xl_base", StableDiffusionXLPipeline),
107
+ ("xl_inpaint", None),
108
+ ("xl_refiner", StableDiffusionXLPipeline),
72
109
  ]
73
110
  )
74
111
 
75
112
  SINGLE_FILE_CHECKPOINT_IMAGE2IMAGE_PIPELINE_MAPPING = OrderedDict(
76
113
  [
77
- ("xl_base", StableDiffusionXLImg2ImgPipeline),
78
- ("xl_refiner", StableDiffusionXLImg2ImgPipeline),
79
- ("xl_inpaint", None),
80
- ("playground-v2-5", StableDiffusionXLImg2ImgPipeline),
81
- ("upscale", None),
114
+ ("animatediff_rgb", AnimateDiffPipeline),
115
+ ("animatediff_scribble", AnimateDiffPipeline),
116
+ ("animatediff_sdxl_beta", AnimateDiffSDXLPipeline),
117
+ ("animatediff_v1", AnimateDiffPipeline),
118
+ ("animatediff_v2", AnimateDiffPipeline),
119
+ ("animatediff_v3", AnimateDiffPipeline),
120
+ ("autoencoder-dc-f128c512", None),
121
+ ("autoencoder-dc-f32c32", None),
122
+ ("autoencoder-dc-f32c32-sana", None),
123
+ ("autoencoder-dc-f64c128", None),
124
+ ("controlnet", StableDiffusionControlNetImg2ImgPipeline),
125
+ ("controlnet_xl", StableDiffusionXLControlNetImg2ImgPipeline),
126
+ ("controlnet_xl_large", StableDiffusionXLControlNetImg2ImgPipeline),
127
+ ("controlnet_xl_mid", StableDiffusionXLControlNetImg2ImgPipeline),
128
+ ("controlnet_xl_small", StableDiffusionXLControlNetImg2ImgPipeline),
129
+ ("flux-depth", FluxImg2ImgPipeline),
130
+ ("flux-dev", FluxImg2ImgPipeline),
131
+ ("flux-fill", FluxImg2ImgPipeline),
132
+ ("flux-schnell", FluxImg2ImgPipeline),
133
+ ("hunyuan-video", None),
82
134
  ("inpainting", None),
83
135
  ("inpainting_v2", None),
84
- ("controlnet", StableDiffusionControlNetImg2ImgPipeline),
85
- ("v2", StableDiffusionImg2ImgPipeline),
136
+ ("ltx-video", None),
137
+ ("ltx-video-0.9.1", None),
138
+ ("mochi-1-preview", None),
139
+ ("playground-v2-5", StableDiffusionXLImg2ImgPipeline),
140
+ ("sd3", StableDiffusion3Img2ImgPipeline),
141
+ ("sd35_large", StableDiffusion3Img2ImgPipeline),
142
+ ("sd35_medium", StableDiffusion3Img2ImgPipeline),
143
+ ("stable_cascade_stage_b", None),
144
+ ("stable_cascade_stage_b_lite", None),
145
+ ("stable_cascade_stage_c", None),
146
+ ("stable_cascade_stage_c_lite", None),
147
+ ("upscale", StableDiffusionUpscalePipeline),
86
148
  ("v1", StableDiffusionImg2ImgPipeline),
149
+ ("v2", StableDiffusionImg2ImgPipeline),
150
+ ("xl_base", StableDiffusionXLImg2ImgPipeline),
151
+ ("xl_inpaint", None),
152
+ ("xl_refiner", StableDiffusionXLImg2ImgPipeline),
87
153
  ]
88
154
  )
89
155
 
90
156
  SINGLE_FILE_CHECKPOINT_INPAINT_PIPELINE_MAPPING = OrderedDict(
91
157
  [
92
- ("xl_base", None),
93
- ("xl_refiner", None),
94
- ("xl_inpaint", StableDiffusionXLInpaintPipeline),
95
- ("playground-v2-5", None),
96
- ("upscale", None),
158
+ ("animatediff_rgb", None),
159
+ ("animatediff_scribble", None),
160
+ ("animatediff_sdxl_beta", None),
161
+ ("animatediff_v1", None),
162
+ ("animatediff_v2", None),
163
+ ("animatediff_v3", None),
164
+ ("autoencoder-dc-f128c512", None),
165
+ ("autoencoder-dc-f32c32", None),
166
+ ("autoencoder-dc-f32c32-sana", None),
167
+ ("autoencoder-dc-f64c128", None),
168
+ ("controlnet", StableDiffusionControlNetInpaintPipeline),
169
+ ("controlnet_xl", None),
170
+ ("controlnet_xl_large", None),
171
+ ("controlnet_xl_mid", None),
172
+ ("controlnet_xl_small", None),
173
+ ("flux-depth", None),
174
+ ("flux-dev", None),
175
+ ("flux-fill", None),
176
+ ("flux-schnell", None),
177
+ ("hunyuan-video", None),
97
178
  ("inpainting", StableDiffusionInpaintPipeline),
98
179
  ("inpainting_v2", StableDiffusionInpaintPipeline),
99
- ("controlnet", StableDiffusionControlNetInpaintPipeline),
100
- ("v2", None),
180
+ ("ltx-video", None),
181
+ ("ltx-video-0.9.1", None),
182
+ ("mochi-1-preview", None),
183
+ ("playground-v2-5", None),
184
+ ("sd3", None),
185
+ ("sd35_large", None),
186
+ ("sd35_medium", None),
187
+ ("stable_cascade_stage_b", None),
188
+ ("stable_cascade_stage_b_lite", None),
189
+ ("stable_cascade_stage_c", None),
190
+ ("stable_cascade_stage_c_lite", None),
191
+ ("upscale", StableDiffusionUpscalePipeline),
101
192
  ("v1", None),
193
+ ("v2", None),
194
+ ("xl_base", None),
195
+ ("xl_inpaint", StableDiffusionXLInpaintPipeline),
196
+ ("xl_refiner", None),
102
197
  ]
103
198
  )
104
199
 
@@ -116,14 +211,33 @@ CONFIG_FILE_LIST = [
116
211
  "diffusion_pytorch_model.non_ema.safetensors",
117
212
  ]
118
213
 
119
- DIFFUSERS_CONFIG_DIR = ["safety_checker", "unet", "vae", "text_encoder", "text_encoder_2"]
120
-
121
- INPAINT_PIPELINE_KEYS = [
122
- "xl_inpaint",
123
- "inpainting",
124
- "inpainting_v2",
214
+ DIFFUSERS_CONFIG_DIR = [
215
+ "safety_checker",
216
+ "unet",
217
+ "vae",
218
+ "text_encoder",
219
+ "text_encoder_2",
125
220
  ]
126
221
 
222
+ TOKENIZER_SHAPE_MAP = {
223
+ 768: [
224
+ "SD 1.4",
225
+ "SD 1.5",
226
+ "SD 1.5 LCM",
227
+ "SDXL 0.9",
228
+ "SDXL 1.0",
229
+ "SDXL 1.0 LCM",
230
+ "SDXL Distilled",
231
+ "SDXL Turbo",
232
+ "SDXL Lightning",
233
+ "PixArt a",
234
+ "Playground v2",
235
+ "Pony",
236
+ ],
237
+ 1024: ["SD 2.0", "SD 2.0 768", "SD 2.1", "SD 2.1 768", "SD 2.1 Unclip"],
238
+ }
239
+
240
+
127
241
  EXTENSION = [".safetensors", ".ckpt", ".bin"]
128
242
 
129
243
  CACHE_HOME = os.path.expanduser("~/.cache")
@@ -162,12 +276,28 @@ class ModelStatus:
162
276
  The name of the model file.
163
277
  local (`bool`):
164
278
  Whether the model exists locally
279
+ site_url (`str`):
280
+ The URL of the site where the model is hosted.
165
281
  """
166
282
 
167
283
  search_word: str = ""
168
284
  download_url: str = ""
169
285
  file_name: str = ""
170
286
  local: bool = False
287
+ site_url: str = ""
288
+
289
+
290
+ @dataclass
291
+ class ExtraStatus:
292
+ r"""
293
+ Data class for storing extra status information.
294
+
295
+ Attributes:
296
+ trained_words (`str`):
297
+ The words used to trigger the model
298
+ """
299
+
300
+ trained_words: Union[List[str], None] = None
171
301
 
172
302
 
173
303
  @dataclass
@@ -193,6 +323,7 @@ class SearchResult:
193
323
  checkpoint_format: Union[str, None] = None
194
324
  repo_status: RepoStatus = RepoStatus()
195
325
  model_status: ModelStatus = ModelStatus()
326
+ extra_status: ExtraStatus = ExtraStatus()
196
327
 
197
328
 
198
329
  @validate_hf_hub_args
@@ -385,6 +516,7 @@ def file_downloader(
385
516
  proxies = kwargs.pop("proxies", None)
386
517
  force_download = kwargs.pop("force_download", False)
387
518
  displayed_filename = kwargs.pop("displayed_filename", None)
519
+
388
520
  # Default mode for file writing and initial file size
389
521
  mode = "wb"
390
522
  file_size = 0
@@ -396,7 +528,7 @@ def file_downloader(
396
528
  if os.path.exists(save_path):
397
529
  if not force_download:
398
530
  # If the file exists and force_download is False, skip the download
399
- logger.warning(f"File already exists: {save_path}, skipping download.")
531
+ logger.info(f"File already exists: {save_path}, skipping download.")
400
532
  return None
401
533
  elif resume:
402
534
  # If resuming, set mode to append binary and get current file size
@@ -523,7 +655,10 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
523
655
  if hf_security_info["scansDone"]:
524
656
  for info in repo_info["siblings"]:
525
657
  file_path = info["rfilename"]
526
- if "model_index.json" == file_path and checkpoint_format in ["diffusers", "all"]:
658
+ if "model_index.json" == file_path and checkpoint_format in [
659
+ "diffusers",
660
+ "all",
661
+ ]:
527
662
  diffusers_model_exists = True
528
663
  break
529
664
 
@@ -586,10 +721,12 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
586
721
  repo_status=RepoStatus(repo_id=repo_id, repo_hash=hf_repo_info.sha, version=revision),
587
722
  model_status=ModelStatus(
588
723
  search_word=search_word,
724
+ site_url=download_url,
589
725
  download_url=download_url,
590
726
  file_name=file_name,
591
727
  local=download,
592
728
  ),
729
+ extra_status=ExtraStatus(trained_words=None),
593
730
  )
594
731
 
595
732
  else:
@@ -605,6 +742,8 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
605
742
  The search query string.
606
743
  model_type (`str`, *optional*, defaults to `Checkpoint`):
607
744
  The type of model to search for.
745
+ sort (`str`, *optional*):
746
+ The order in which you wish to sort the results(for example, `Highest Rated`, `Most Downloaded`, `Newest`).
608
747
  base_model (`str`, *optional*):
609
748
  The base model to filter by.
610
749
  download (`bool`, *optional*, defaults to `False`):
@@ -628,6 +767,7 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
628
767
 
629
768
  # Extract additional parameters from kwargs
630
769
  model_type = kwargs.pop("model_type", "Checkpoint")
770
+ sort = kwargs.pop("sort", None)
631
771
  download = kwargs.pop("download", False)
632
772
  base_model = kwargs.pop("base_model", None)
633
773
  force_download = kwargs.pop("force_download", False)
@@ -642,6 +782,7 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
642
782
  repo_name = ""
643
783
  repo_id = ""
644
784
  version_id = ""
785
+ trainedWords = ""
645
786
  models_list = []
646
787
  selected_repo = {}
647
788
  selected_model = {}
@@ -652,12 +793,16 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
652
793
  params = {
653
794
  "query": search_word,
654
795
  "types": model_type,
655
- "sort": "Most Downloaded",
656
796
  "limit": 20,
657
797
  }
658
798
  if base_model is not None:
799
+ if not isinstance(base_model, list):
800
+ base_model = [base_model]
659
801
  params["baseModel"] = base_model
660
802
 
803
+ if sort is not None:
804
+ params["sort"] = sort
805
+
661
806
  headers = {}
662
807
  if token:
663
808
  headers["Authorization"] = f"Bearer {token}"
@@ -686,25 +831,30 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
686
831
 
687
832
  # Sort versions within the selected repo by download count
688
833
  sorted_versions = sorted(
689
- selected_repo["modelVersions"], key=lambda x: x["stats"]["downloadCount"], reverse=True
834
+ selected_repo["modelVersions"],
835
+ key=lambda x: x["stats"]["downloadCount"],
836
+ reverse=True,
690
837
  )
691
838
  for selected_version in sorted_versions:
692
839
  version_id = selected_version["id"]
840
+ trainedWords = selected_version["trainedWords"]
693
841
  models_list = []
694
- for model_data in selected_version["files"]:
695
- # Check if the file passes security scans and has a valid extension
696
- file_name = model_data["name"]
697
- if (
698
- model_data["pickleScanResult"] == "Success"
699
- and model_data["virusScanResult"] == "Success"
700
- and any(file_name.endswith(ext) for ext in EXTENSION)
701
- and os.path.basename(os.path.dirname(file_name)) not in DIFFUSERS_CONFIG_DIR
702
- ):
703
- file_status = {
704
- "filename": file_name,
705
- "download_url": model_data["downloadUrl"],
706
- }
707
- models_list.append(file_status)
842
+ # When searching for textual inversion, results other than the values entered for the base model may come up, so check again.
843
+ if base_model is None or selected_version["baseModel"] in base_model:
844
+ for model_data in selected_version["files"]:
845
+ # Check if the file passes security scans and has a valid extension
846
+ file_name = model_data["name"]
847
+ if (
848
+ model_data["pickleScanResult"] == "Success"
849
+ and model_data["virusScanResult"] == "Success"
850
+ and any(file_name.endswith(ext) for ext in EXTENSION)
851
+ and os.path.basename(os.path.dirname(file_name)) not in DIFFUSERS_CONFIG_DIR
852
+ ):
853
+ file_status = {
854
+ "filename": file_name,
855
+ "download_url": model_data["downloadUrl"],
856
+ }
857
+ models_list.append(file_status)
708
858
 
709
859
  if models_list:
710
860
  # Sort the models list by filename and find the safest model
@@ -764,19 +914,229 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
764
914
  repo_status=RepoStatus(repo_id=repo_name, repo_hash=repo_id, version=version_id),
765
915
  model_status=ModelStatus(
766
916
  search_word=search_word,
917
+ site_url=f"https://civitai.com/models/{repo_id}?modelVersionId={version_id}",
767
918
  download_url=download_url,
768
919
  file_name=file_name,
769
920
  local=output_info["type"]["local"],
770
921
  ),
922
+ extra_status=ExtraStatus(trained_words=trainedWords or None),
771
923
  )
772
924
 
773
925
 
774
- class EasyPipelineForText2Image(AutoPipelineForText2Image):
926
+ def add_methods(pipeline):
775
927
  r"""
928
+ Add methods from `AutoConfig` to the pipeline.
776
929
 
777
- [`AutoPipelineForText2Image`] is a generic pipeline class that instantiates a text-to-image pipeline class. The
930
+ Parameters:
931
+ pipeline (`Pipeline`):
932
+ The pipeline to which the methods will be added.
933
+ """
934
+ for attr_name in dir(AutoConfig):
935
+ attr_value = getattr(AutoConfig, attr_name)
936
+ if callable(attr_value) and not attr_name.startswith("__"):
937
+ setattr(pipeline, attr_name, types.MethodType(attr_value, pipeline))
938
+ return pipeline
939
+
940
+
941
+ class AutoConfig:
942
+ def auto_load_textual_inversion(
943
+ self,
944
+ pretrained_model_name_or_path: Union[str, List[str]],
945
+ token: Optional[Union[str, List[str]]] = None,
946
+ base_model: Optional[Union[str, List[str]]] = None,
947
+ tokenizer=None,
948
+ text_encoder=None,
949
+ **kwargs,
950
+ ):
951
+ r"""
952
+ Load Textual Inversion embeddings into the text encoder of [`StableDiffusionPipeline`] (both 🤗 Diffusers and
953
+ Automatic1111 formats are supported).
954
+
955
+ Parameters:
956
+ pretrained_model_name_or_path (`str` or `os.PathLike` or `List[str or os.PathLike]` or `Dict` or `List[Dict]`):
957
+ Can be either one of the following or a list of them:
958
+
959
+ - Search keywords for pretrained model (for example `EasyNegative`).
960
+ - A string, the *model id* (for example `sd-concepts-library/low-poly-hd-logos-icons`) of a
961
+ pretrained model hosted on the Hub.
962
+ - A path to a *directory* (for example `./my_text_inversion_directory/`) containing the textual
963
+ inversion weights.
964
+ - A path to a *file* (for example `./my_text_inversions.pt`) containing textual inversion weights.
965
+ - A [torch state
966
+ dict](https://pytorch.org/tutorials/beginner/saving_loading_models.html#what-is-a-state-dict).
967
+
968
+ token (`str` or `List[str]`, *optional*):
969
+ Override the token to use for the textual inversion weights. If `pretrained_model_name_or_path` is a
970
+ list, then `token` must also be a list of equal length.
971
+ text_encoder ([`~transformers.CLIPTextModel`], *optional*):
972
+ Frozen text-encoder ([clip-vit-large-patch14](https://huggingface.co/openai/clip-vit-large-patch14)).
973
+ If not specified, function will take self.tokenizer.
974
+ tokenizer ([`~transformers.CLIPTokenizer`], *optional*):
975
+ A `CLIPTokenizer` to tokenize text. If not specified, function will take self.tokenizer.
976
+ weight_name (`str`, *optional*):
977
+ Name of a custom weight file. This should be used when:
978
+
979
+ - The saved textual inversion file is in 🤗 Diffusers format, but was saved under a specific weight
980
+ name such as `text_inv.bin`.
981
+ - The saved textual inversion file is in the Automatic1111 format.
982
+ cache_dir (`Union[str, os.PathLike]`, *optional*):
983
+ Path to a directory where a downloaded pretrained model configuration is cached if the standard cache
984
+ is not used.
985
+ force_download (`bool`, *optional*, defaults to `False`):
986
+ Whether or not to force the (re-)download of the model weights and configuration files, overriding the
987
+ cached versions if they exist.
988
+
989
+ proxies (`Dict[str, str]`, *optional*):
990
+ A dictionary of proxy servers to use by protocol or endpoint, for example, `{'http': 'foo.bar:3128',
991
+ 'http://hostname': 'foo.bar:4012'}`. The proxies are used on each request.
992
+ local_files_only (`bool`, *optional*, defaults to `False`):
993
+ Whether to only load local model weights and configuration files or not. If set to `True`, the model
994
+ won't be downloaded from the Hub.
995
+ token (`str` or *bool*, *optional*):
996
+ The token to use as HTTP bearer authorization for remote files. If `True`, the token generated from
997
+ `diffusers-cli login` (stored in `~/.huggingface`) is used.
998
+ revision (`str`, *optional*, defaults to `"main"`):
999
+ The specific model version to use. It can be a branch name, a tag name, a commit id, or any identifier
1000
+ allowed by Git.
1001
+ subfolder (`str`, *optional*, defaults to `""`):
1002
+ The subfolder location of a model file within a larger model repository on the Hub or locally.
1003
+ mirror (`str`, *optional*):
1004
+ Mirror source to resolve accessibility issues if you're downloading a model in China. We do not
1005
+ guarantee the timeliness or safety of the source, and you should refer to the mirror site for more
1006
+ information.
1007
+
1008
+ Examples:
1009
+
1010
+ ```py
1011
+ >>> from auto_diffusers import EasyPipelineForText2Image
1012
+
1013
+ >>> pipeline = EasyPipelineForText2Image.from_huggingface("stable-diffusion-v1-5")
1014
+
1015
+ >>> pipeline.auto_load_textual_inversion("EasyNegative", token="EasyNegative")
1016
+
1017
+ >>> image = pipeline(prompt).images[0]
1018
+ ```
1019
+
1020
+ """
1021
+ # 1. Set tokenizer and text encoder
1022
+ tokenizer = tokenizer or getattr(self, "tokenizer", None)
1023
+ text_encoder = text_encoder or getattr(self, "text_encoder", None)
1024
+
1025
+ # Check if tokenizer and text encoder are provided
1026
+ if tokenizer is None or text_encoder is None:
1027
+ raise ValueError("Tokenizer and text encoder must be provided.")
1028
+
1029
+ # 2. Normalize inputs
1030
+ pretrained_model_name_or_paths = (
1031
+ [pretrained_model_name_or_path]
1032
+ if not isinstance(pretrained_model_name_or_path, list)
1033
+ else pretrained_model_name_or_path
1034
+ )
1035
+
1036
+ # 2.1 Normalize tokens
1037
+ tokens = [token] if not isinstance(token, list) else token
1038
+ if tokens[0] is None:
1039
+ tokens = tokens * len(pretrained_model_name_or_paths)
1040
+
1041
+ for check_token in tokens:
1042
+ # Check if token is already in tokenizer vocabulary
1043
+ if check_token in tokenizer.get_vocab():
1044
+ raise ValueError(
1045
+ f"Token {token} already in tokenizer vocabulary. Please choose a different token name or remove {token} and embedding from the tokenizer and text encoder."
1046
+ )
1047
+
1048
+ expected_shape = text_encoder.get_input_embeddings().weight.shape[-1] # Expected shape of tokenizer
1049
+
1050
+ for search_word in pretrained_model_name_or_paths:
1051
+ if isinstance(search_word, str):
1052
+ # Update kwargs to ensure the model is downloaded and parameters are included
1053
+ _status = {
1054
+ "download": True,
1055
+ "include_params": True,
1056
+ "skip_error": False,
1057
+ "model_type": "TextualInversion",
1058
+ }
1059
+ # Get tags for the base model of textual inversion compatible with tokenizer.
1060
+ # If the tokenizer is 768-dimensional, set tags for SD 1.x and SDXL.
1061
+ # If the tokenizer is 1024-dimensional, set tags for SD 2.x.
1062
+ if expected_shape in TOKENIZER_SHAPE_MAP:
1063
+ # Retrieve the appropriate tags from the TOKENIZER_SHAPE_MAP based on the expected shape
1064
+ tags = TOKENIZER_SHAPE_MAP[expected_shape]
1065
+ if base_model is not None:
1066
+ if isinstance(base_model, list):
1067
+ tags.extend(base_model)
1068
+ else:
1069
+ tags.append(base_model)
1070
+ _status["base_model"] = tags
1071
+
1072
+ kwargs.update(_status)
1073
+ # Search for the model on Civitai and get the model status
1074
+ textual_inversion_path = search_civitai(search_word, **kwargs)
1075
+ logger.warning(
1076
+ f"textual_inversion_path: {search_word} -> {textual_inversion_path.model_status.site_url}"
1077
+ )
1078
+
1079
+ pretrained_model_name_or_paths[pretrained_model_name_or_paths.index(search_word)] = (
1080
+ textual_inversion_path.model_path
1081
+ )
1082
+
1083
+ self.load_textual_inversion(
1084
+ pretrained_model_name_or_paths, token=tokens, tokenizer=tokenizer, text_encoder=text_encoder, **kwargs
1085
+ )
1086
+
1087
+ def auto_load_lora_weights(
1088
+ self, pretrained_model_name_or_path_or_dict: Union[str, Dict[str, torch.Tensor]], adapter_name=None, **kwargs
1089
+ ):
1090
+ r"""
1091
+ Load LoRA weights specified in `pretrained_model_name_or_path_or_dict` into `self.unet` and
1092
+ `self.text_encoder`.
1093
+
1094
+ All kwargs are forwarded to `self.lora_state_dict`.
1095
+
1096
+ See [`~loaders.StableDiffusionLoraLoaderMixin.lora_state_dict`] for more details on how the state dict is
1097
+ loaded.
1098
+
1099
+ See [`~loaders.StableDiffusionLoraLoaderMixin.load_lora_into_unet`] for more details on how the state dict is
1100
+ loaded into `self.unet`.
1101
+
1102
+ See [`~loaders.StableDiffusionLoraLoaderMixin.load_lora_into_text_encoder`] for more details on how the state
1103
+ dict is loaded into `self.text_encoder`.
1104
+
1105
+ Parameters:
1106
+ pretrained_model_name_or_path_or_dict (`str` or `os.PathLike` or `dict`):
1107
+ See [`~loaders.StableDiffusionLoraLoaderMixin.lora_state_dict`].
1108
+ adapter_name (`str`, *optional*):
1109
+ Adapter name to be used for referencing the loaded adapter model. If not specified, it will use
1110
+ `default_{i}` where i is the total number of adapters being loaded.
1111
+ low_cpu_mem_usage (`bool`, *optional*):
1112
+ Speed up model loading by only loading the pretrained LoRA weights and not initializing the random
1113
+ weights.
1114
+ kwargs (`dict`, *optional*):
1115
+ See [`~loaders.StableDiffusionLoraLoaderMixin.lora_state_dict`].
1116
+ """
1117
+ if isinstance(pretrained_model_name_or_path_or_dict, str):
1118
+ # Update kwargs to ensure the model is downloaded and parameters are included
1119
+ _status = {
1120
+ "download": True,
1121
+ "include_params": True,
1122
+ "skip_error": False,
1123
+ "model_type": "LORA",
1124
+ }
1125
+ kwargs.update(_status)
1126
+ # Search for the model on Civitai and get the model status
1127
+ lora_path = search_civitai(pretrained_model_name_or_path_or_dict, **kwargs)
1128
+ logger.warning(f"lora_path: {lora_path.model_status.site_url}")
1129
+ logger.warning(f"trained_words: {lora_path.extra_status.trained_words}")
1130
+ pretrained_model_name_or_path_or_dict = lora_path.model_path
1131
+
1132
+ self.load_lora_weights(pretrained_model_name_or_path_or_dict, adapter_name=adapter_name, **kwargs)
1133
+
1134
+
1135
+ class EasyPipelineForText2Image(AutoPipelineForText2Image, AutoConfig):
1136
+ r"""
1137
+ [`EasyPipelineForText2Image`] is a generic pipeline class that instantiates a text-to-image pipeline class. The
778
1138
  specific underlying pipeline class is automatically selected from either the
779
- [`~AutoPipelineForText2Image.from_pretrained`] or [`~AutoPipelineForText2Image.from_pipe`] methods.
1139
+ [`~EasyPipelineForText2Image.from_pretrained`], [`~EasyPipelineForText2Image.from_pipe`], [`~EasyPipelineForText2Image.from_huggingface`] or [`~EasyPipelineForText2Image.from_civitai`] methods.
780
1140
 
781
1141
  This class cannot be instantiated using `__init__()` (throws an error).
782
1142
 
@@ -891,9 +1251,9 @@ class EasyPipelineForText2Image(AutoPipelineForText2Image):
891
1251
  Examples:
892
1252
 
893
1253
  ```py
894
- >>> from diffusers import AutoPipelineForText2Image
1254
+ >>> from auto_diffusers import EasyPipelineForText2Image
895
1255
 
896
- >>> pipeline = AutoPipelineForText2Image.from_huggingface("stable-diffusion-v1-5")
1256
+ >>> pipeline = EasyPipelineForText2Image.from_huggingface("stable-diffusion-v1-5")
897
1257
  >>> image = pipeline(prompt).images[0]
898
1258
  ```
899
1259
  """
@@ -907,20 +1267,21 @@ class EasyPipelineForText2Image(AutoPipelineForText2Image):
907
1267
  kwargs.update(_status)
908
1268
 
909
1269
  # Search for the model on Hugging Face and get the model status
910
- hf_model_status = search_huggingface(pretrained_model_link_or_path, **kwargs)
911
- logger.warning(f"checkpoint_path: {hf_model_status.model_status.download_url}")
912
- checkpoint_path = hf_model_status.model_path
1270
+ hf_checkpoint_status = search_huggingface(pretrained_model_link_or_path, **kwargs)
1271
+ logger.warning(f"checkpoint_path: {hf_checkpoint_status.model_status.download_url}")
1272
+ checkpoint_path = hf_checkpoint_status.model_path
913
1273
 
914
1274
  # Check the format of the model checkpoint
915
- if hf_model_status.checkpoint_format == "single_file":
1275
+ if hf_checkpoint_status.loading_method == "from_single_file":
916
1276
  # Load the pipeline from a single file checkpoint
917
- return load_pipeline_from_single_file(
1277
+ pipeline = load_pipeline_from_single_file(
918
1278
  pretrained_model_or_path=checkpoint_path,
919
1279
  pipeline_mapping=SINGLE_FILE_CHECKPOINT_TEXT2IMAGE_PIPELINE_MAPPING,
920
1280
  **kwargs,
921
1281
  )
922
1282
  else:
923
- return cls.from_pretrained(checkpoint_path, **kwargs)
1283
+ pipeline = cls.from_pretrained(checkpoint_path, **kwargs)
1284
+ return add_methods(pipeline)
924
1285
 
925
1286
  @classmethod
926
1287
  def from_civitai(cls, pretrained_model_link_or_path, **kwargs):
@@ -999,9 +1360,9 @@ class EasyPipelineForText2Image(AutoPipelineForText2Image):
999
1360
  Examples:
1000
1361
 
1001
1362
  ```py
1002
- >>> from diffusers import AutoPipelineForText2Image
1363
+ >>> from auto_diffusers import EasyPipelineForText2Image
1003
1364
 
1004
- >>> pipeline = AutoPipelineForText2Image.from_huggingface("stable-diffusion-v1-5")
1365
+ >>> pipeline = EasyPipelineForText2Image.from_huggingface("stable-diffusion-v1-5")
1005
1366
  >>> image = pipeline(prompt).images[0]
1006
1367
  ```
1007
1368
  """
@@ -1015,24 +1376,25 @@ class EasyPipelineForText2Image(AutoPipelineForText2Image):
1015
1376
  kwargs.update(_status)
1016
1377
 
1017
1378
  # Search for the model on Civitai and get the model status
1018
- model_status = search_civitai(pretrained_model_link_or_path, **kwargs)
1019
- logger.warning(f"checkpoint_path: {model_status.model_status.download_url}")
1020
- checkpoint_path = model_status.model_path
1379
+ checkpoint_status = search_civitai(pretrained_model_link_or_path, **kwargs)
1380
+ logger.warning(f"checkpoint_path: {checkpoint_status.model_status.site_url}")
1381
+ checkpoint_path = checkpoint_status.model_path
1021
1382
 
1022
1383
  # Load the pipeline from a single file checkpoint
1023
- return load_pipeline_from_single_file(
1384
+ pipeline = load_pipeline_from_single_file(
1024
1385
  pretrained_model_or_path=checkpoint_path,
1025
1386
  pipeline_mapping=SINGLE_FILE_CHECKPOINT_TEXT2IMAGE_PIPELINE_MAPPING,
1026
1387
  **kwargs,
1027
1388
  )
1389
+ return add_methods(pipeline)
1028
1390
 
1029
1391
 
1030
1392
  class EasyPipelineForImage2Image(AutoPipelineForImage2Image):
1031
1393
  r"""
1032
1394
 
1033
- [`AutoPipelineForImage2Image`] is a generic pipeline class that instantiates an image-to-image pipeline class. The
1395
+ [`EasyPipelineForImage2Image`] is a generic pipeline class that instantiates an image-to-image pipeline class. The
1034
1396
  specific underlying pipeline class is automatically selected from either the
1035
- [`~AutoPipelineForImage2Image.from_pretrained`] or [`~AutoPipelineForImage2Image.from_pipe`] methods.
1397
+ [`~EasyPipelineForImage2Image.from_pretrained`], [`~EasyPipelineForImage2Image.from_pipe`], [`~EasyPipelineForImage2Image.from_huggingface`] or [`~EasyPipelineForImage2Image.from_civitai`] methods.
1036
1398
 
1037
1399
  This class cannot be instantiated using `__init__()` (throws an error).
1038
1400
 
@@ -1147,10 +1509,10 @@ class EasyPipelineForImage2Image(AutoPipelineForImage2Image):
1147
1509
  Examples:
1148
1510
 
1149
1511
  ```py
1150
- >>> from diffusers import AutoPipelineForText2Image
1512
+ >>> from auto_diffusers import EasyPipelineForImage2Image
1151
1513
 
1152
- >>> pipeline = AutoPipelineForText2Image.from_huggingface("stable-diffusion-v1-5")
1153
- >>> image = pipeline(prompt).images[0]
1514
+ >>> pipeline = EasyPipelineForImage2Image.from_huggingface("stable-diffusion-v1-5")
1515
+ >>> image = pipeline(prompt, image).images[0]
1154
1516
  ```
1155
1517
  """
1156
1518
  # Update kwargs to ensure the model is downloaded and parameters are included
@@ -1163,20 +1525,22 @@ class EasyPipelineForImage2Image(AutoPipelineForImage2Image):
1163
1525
  kwargs.update(_parmas)
1164
1526
 
1165
1527
  # Search for the model on Hugging Face and get the model status
1166
- model_status = search_huggingface(pretrained_model_link_or_path, **kwargs)
1167
- logger.warning(f"checkpoint_path: {model_status.model_status.download_url}")
1168
- checkpoint_path = model_status.model_path
1528
+ hf_checkpoint_status = search_huggingface(pretrained_model_link_or_path, **kwargs)
1529
+ logger.warning(f"checkpoint_path: {hf_checkpoint_status.model_status.download_url}")
1530
+ checkpoint_path = hf_checkpoint_status.model_path
1169
1531
 
1170
1532
  # Check the format of the model checkpoint
1171
- if model_status.checkpoint_format == "single_file":
1533
+ if hf_checkpoint_status.loading_method == "from_single_file":
1172
1534
  # Load the pipeline from a single file checkpoint
1173
- return load_pipeline_from_single_file(
1535
+ pipeline = load_pipeline_from_single_file(
1174
1536
  pretrained_model_or_path=checkpoint_path,
1175
1537
  pipeline_mapping=SINGLE_FILE_CHECKPOINT_IMAGE2IMAGE_PIPELINE_MAPPING,
1176
1538
  **kwargs,
1177
1539
  )
1178
1540
  else:
1179
- return cls.from_pretrained(checkpoint_path, **kwargs)
1541
+ pipeline = cls.from_pretrained(checkpoint_path, **kwargs)
1542
+
1543
+ return add_methods(pipeline)
1180
1544
 
1181
1545
  @classmethod
1182
1546
  def from_civitai(cls, pretrained_model_link_or_path, **kwargs):
@@ -1255,10 +1619,10 @@ class EasyPipelineForImage2Image(AutoPipelineForImage2Image):
1255
1619
  Examples:
1256
1620
 
1257
1621
  ```py
1258
- >>> from diffusers import AutoPipelineForText2Image
1622
+ >>> from auto_diffusers import EasyPipelineForImage2Image
1259
1623
 
1260
- >>> pipeline = AutoPipelineForText2Image.from_huggingface("stable-diffusion-v1-5")
1261
- >>> image = pipeline(prompt).images[0]
1624
+ >>> pipeline = EasyPipelineForImage2Image.from_huggingface("stable-diffusion-v1-5")
1625
+ >>> image = pipeline(prompt, image).images[0]
1262
1626
  ```
1263
1627
  """
1264
1628
  # Update kwargs to ensure the model is downloaded and parameters are included
@@ -1271,24 +1635,25 @@ class EasyPipelineForImage2Image(AutoPipelineForImage2Image):
1271
1635
  kwargs.update(_status)
1272
1636
 
1273
1637
  # Search for the model on Civitai and get the model status
1274
- model_status = search_civitai(pretrained_model_link_or_path, **kwargs)
1275
- logger.warning(f"checkpoint_path: {model_status.model_status.download_url}")
1276
- checkpoint_path = model_status.model_path
1638
+ checkpoint_status = search_civitai(pretrained_model_link_or_path, **kwargs)
1639
+ logger.warning(f"checkpoint_path: {checkpoint_status.model_status.site_url}")
1640
+ checkpoint_path = checkpoint_status.model_path
1277
1641
 
1278
1642
  # Load the pipeline from a single file checkpoint
1279
- return load_pipeline_from_single_file(
1643
+ pipeline = load_pipeline_from_single_file(
1280
1644
  pretrained_model_or_path=checkpoint_path,
1281
1645
  pipeline_mapping=SINGLE_FILE_CHECKPOINT_IMAGE2IMAGE_PIPELINE_MAPPING,
1282
1646
  **kwargs,
1283
1647
  )
1648
+ return add_methods(pipeline)
1284
1649
 
1285
1650
 
1286
1651
  class EasyPipelineForInpainting(AutoPipelineForInpainting):
1287
1652
  r"""
1288
1653
 
1289
- [`AutoPipelineForInpainting`] is a generic pipeline class that instantiates an inpainting pipeline class. The
1654
+ [`EasyPipelineForInpainting`] is a generic pipeline class that instantiates an inpainting pipeline class. The
1290
1655
  specific underlying pipeline class is automatically selected from either the
1291
- [`~AutoPipelineForInpainting.from_pretrained`] or [`~AutoPipelineForInpainting.from_pipe`] methods.
1656
+ [`~EasyPipelineForInpainting.from_pretrained`], [`~EasyPipelineForInpainting.from_pipe`], [`~EasyPipelineForInpainting.from_huggingface`] or [`~EasyPipelineForInpainting.from_civitai`] methods.
1292
1657
 
1293
1658
  This class cannot be instantiated using `__init__()` (throws an error).
1294
1659
 
@@ -1403,10 +1768,10 @@ class EasyPipelineForInpainting(AutoPipelineForInpainting):
1403
1768
  Examples:
1404
1769
 
1405
1770
  ```py
1406
- >>> from diffusers import AutoPipelineForText2Image
1771
+ >>> from auto_diffusers import EasyPipelineForInpainting
1407
1772
 
1408
- >>> pipeline = AutoPipelineForText2Image.from_huggingface("stable-diffusion-v1-5")
1409
- >>> image = pipeline(prompt).images[0]
1773
+ >>> pipeline = EasyPipelineForInpainting.from_huggingface("stable-diffusion-2-inpainting")
1774
+ >>> image = pipeline(prompt, image=init_image, mask_image=mask_image).images[0]
1410
1775
  ```
1411
1776
  """
1412
1777
  # Update kwargs to ensure the model is downloaded and parameters are included
@@ -1419,20 +1784,21 @@ class EasyPipelineForInpainting(AutoPipelineForInpainting):
1419
1784
  kwargs.update(_status)
1420
1785
 
1421
1786
  # Search for the model on Hugging Face and get the model status
1422
- model_status = search_huggingface(pretrained_model_link_or_path, **kwargs)
1423
- logger.warning(f"checkpoint_path: {model_status.model_status.download_url}")
1424
- checkpoint_path = model_status.model_path
1787
+ hf_checkpoint_status = search_huggingface(pretrained_model_link_or_path, **kwargs)
1788
+ logger.warning(f"checkpoint_path: {hf_checkpoint_status.model_status.download_url}")
1789
+ checkpoint_path = hf_checkpoint_status.model_path
1425
1790
 
1426
1791
  # Check the format of the model checkpoint
1427
- if model_status.checkpoint_format == "single_file":
1792
+ if hf_checkpoint_status.loading_method == "from_single_file":
1428
1793
  # Load the pipeline from a single file checkpoint
1429
- return load_pipeline_from_single_file(
1794
+ pipeline = load_pipeline_from_single_file(
1430
1795
  pretrained_model_or_path=checkpoint_path,
1431
1796
  pipeline_mapping=SINGLE_FILE_CHECKPOINT_INPAINT_PIPELINE_MAPPING,
1432
1797
  **kwargs,
1433
1798
  )
1434
1799
  else:
1435
- return cls.from_pretrained(checkpoint_path, **kwargs)
1800
+ pipeline = cls.from_pretrained(checkpoint_path, **kwargs)
1801
+ return add_methods(pipeline)
1436
1802
 
1437
1803
  @classmethod
1438
1804
  def from_civitai(cls, pretrained_model_link_or_path, **kwargs):
@@ -1511,10 +1877,10 @@ class EasyPipelineForInpainting(AutoPipelineForInpainting):
1511
1877
  Examples:
1512
1878
 
1513
1879
  ```py
1514
- >>> from diffusers import AutoPipelineForText2Image
1880
+ >>> from auto_diffusers import EasyPipelineForInpainting
1515
1881
 
1516
- >>> pipeline = AutoPipelineForText2Image.from_huggingface("stable-diffusion-v1-5")
1517
- >>> image = pipeline(prompt).images[0]
1882
+ >>> pipeline = EasyPipelineForInpainting.from_huggingface("stable-diffusion-2-inpainting")
1883
+ >>> image = pipeline(prompt, image=init_image, mask_image=mask_image).images[0]
1518
1884
  ```
1519
1885
  """
1520
1886
  # Update kwargs to ensure the model is downloaded and parameters are included
@@ -1527,13 +1893,14 @@ class EasyPipelineForInpainting(AutoPipelineForInpainting):
1527
1893
  kwargs.update(_status)
1528
1894
 
1529
1895
  # Search for the model on Civitai and get the model status
1530
- model_status = search_civitai(pretrained_model_link_or_path, **kwargs)
1531
- logger.warning(f"checkpoint_path: {model_status.model_status.download_url}")
1532
- checkpoint_path = model_status.model_path
1896
+ checkpoint_status = search_civitai(pretrained_model_link_or_path, **kwargs)
1897
+ logger.warning(f"checkpoint_path: {checkpoint_status.model_status.site_url}")
1898
+ checkpoint_path = checkpoint_status.model_path
1533
1899
 
1534
1900
  # Load the pipeline from a single file checkpoint
1535
- return load_pipeline_from_single_file(
1901
+ pipeline = load_pipeline_from_single_file(
1536
1902
  pretrained_model_or_path=checkpoint_path,
1537
1903
  pipeline_mapping=SINGLE_FILE_CHECKPOINT_INPAINT_PIPELINE_MAPPING,
1538
1904
  **kwargs,
1539
1905
  )
1906
+ return add_methods(pipeline)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: auto_diffusers
3
- Version: 2.0.14
3
+ Version: 2.0.17
4
4
  Summary: Customized diffusers with model search and other functions.
5
5
  Home-page: https://github.com/suzukimain/auto_diffusers
6
6
  Author: suzukimain
@@ -61,46 +61,26 @@ pip install --quiet auto_diffusers
61
61
  from auto_diffusers import EasyPipelineForText2Image
62
62
 
63
63
  # Search for Huggingface
64
- pipe = EasyPipelineForText2Image.from_huggingface("any").to("cuda")
64
+ pipe = EasyPipelineForText2Image.from_huggingface("search_word").to("cuda")
65
65
  img = pipe("cat").images[0]
66
66
  img.save("cat.png")
67
67
 
68
68
 
69
69
  # Search for Civitai
70
- pipe = EasyPipelineForText2Image.from_civitai("any").to("cuda")
70
+ pipe = EasyPipelineForText2Image.from_civitai("search_word").to("cuda")
71
71
  image = pipe("cat").images[0]
72
72
  image.save("cat.png")
73
73
 
74
74
  ```
75
75
 
76
- ## Search Civitai and Huggingfacee<a name = "Search_Civitai_and_Huggingfacee"></a>
76
+ ## Search Civitai and Huggingfacee<a name = "Search_Civitai_and_Huggingface"></a>
77
77
 
78
78
  ```python
79
- from pipeline_easy import (
80
- search_huggingface,
81
- search_civitai,
82
- )
83
-
84
- # Search Lora
85
- Lora = search_civitai(
86
- "Keyword_to_search_Lora",
87
- model_type="LORA",
88
- base_model = "SD 1.5",
89
- download=True,
90
- )
91
79
  # Load Lora into the pipeline.
92
- pipeline.load_lora_weights(Lora)
80
+ pipe.auto_load_lora_weights("Detail Tweaker")
93
81
 
94
-
95
- # Search TextualInversion
96
- TextualInversion = search_civitai(
97
- "EasyNegative",
98
- model_type="TextualInversion",
99
- base_model = "SD 1.5",
100
- download=True
101
- )
102
82
  # Load TextualInversion into the pipeline.
103
- pipeline.load_textual_inversion(TextualInversion, token="EasyNegative")
83
+ pipe.auto_load_textual_inversion("EasyNegative", token="EasyNegative")
104
84
  ```
105
85
 
106
86
  ### Search Civitai<a name = "Search_Civitai"></a>
@@ -1 +0,0 @@
1
- 2.0.14
File without changes