auto-diffusers 2.0.36__tar.gz → 2.0.36.dev0__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.4
2
2
  Name: auto_diffusers
3
- Version: 2.0.36
3
+ Version: 2.0.36.dev0
4
4
  Summary: diffusers with search engine
5
5
  Home-page: https://github.com/suzukimain/auto_diffusers
6
6
  Author: suzukimain
@@ -80,15 +80,6 @@ Enhance the functionality of diffusers.
80
80
 
81
81
  </details>
82
82
 
83
- ## Regarding the Civitai API bug
84
-
85
- Due to recent specification changes in the Civitai API, we are aware of the following issues:
86
- - Reduced search accuracy
87
- - Some search results not being returned
88
-
89
- 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.
90
-
91
- link: [civitai/civitai#1757](https://github.com/civitai/civitai/issues/1757)
92
83
  ## How to use<a name = "How_to_use"></a>
93
84
 
94
85
  ```python
@@ -42,15 +42,6 @@ Enhance the functionality of diffusers.
42
42
 
43
43
  </details>
44
44
 
45
- ## Regarding the Civitai API bug
46
-
47
- Due to recent specification changes in the Civitai API, we are aware of the following issues:
48
- - Reduced search accuracy
49
- - Some search results not being returned
50
-
51
- 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.
52
-
53
- link: [civitai/civitai#1757](https://github.com/civitai/civitai/issues/1757)
54
45
  ## How to use<a name = "How_to_use"></a>
55
46
 
56
47
  ```python
@@ -11,7 +11,7 @@ version_range_max = max(sys.version_info[1], 10) + 1
11
11
 
12
12
  setup(
13
13
  name="auto_diffusers",
14
- version="2.0.36",
14
+ version="2.0.36dev0",
15
15
  description="diffusers with search engine",
16
16
  long_description=open("README.md", "r", encoding="utf-8").read(),
17
17
  long_description_content_type="text/markdown",
@@ -1,4 +1,4 @@
1
- __version__ = "2.0.36"
1
+ __version__ = "2.0.36dev0"
2
2
 
3
3
  from .pipeline_easy import (
4
4
  search_huggingface,
@@ -1,5 +1,5 @@
1
1
  # coding=utf-8
2
- # Copyright 2026 suzukimain
2
+ # Copyright 2025 suzukimain
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -13,193 +13,58 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
- # Standard library imports
17
16
  import os
18
17
  import re
19
18
  import types
20
- from collections import OrderedDict
21
19
  from dataclasses import asdict, dataclass, field
22
20
  from typing import Dict, List, Optional, Union
21
+ from collections import OrderedDict
22
+
23
23
 
24
- # Third-party imports
25
24
  import requests
26
25
  import torch
27
26
 
28
- # Diffusers core imports
29
27
  from diffusers.loaders.single_file_utils import (
30
28
  VALID_URL_PREFIXES,
31
29
  _extract_repo_id_and_weights_name,
32
30
  infer_diffusers_model_type,
33
31
  load_single_file_checkpoint,
34
32
  )
33
+
34
+ from diffusers import (
35
+ StableDiffusionPipeline,
36
+ StableDiffusionImg2ImgPipeline,
37
+ StableDiffusionInpaintPipeline,
38
+ )
35
39
  from diffusers.pipelines.auto_pipeline import (
36
- AUTO_IMAGE2IMAGE_PIPELINES_MAPPING,
37
- AUTO_INPAINT_PIPELINES_MAPPING,
38
- AUTO_TEXT2IMAGE_PIPELINES_MAPPING,
39
40
  AutoPipelineForImage2Image,
40
41
  AutoPipelineForInpainting,
41
42
  AutoPipelineForText2Image,
43
+ AUTO_TEXT2IMAGE_PIPELINES_MAPPING,
44
+ AUTO_IMAGE2IMAGE_PIPELINES_MAPPING,
45
+ AUTO_INPAINT_PIPELINES_MAPPING,
42
46
  )
43
47
  from diffusers.pipelines.pipeline_utils import DiffusionPipeline
44
48
  from diffusers.utils import logging
45
49
 
46
- # Stable Diffusion v1/v2 pipelines
47
- from diffusers import (
48
- StableDiffusionImg2ImgPipeline,
49
- StableDiffusionInpaintPipeline,
50
- StableDiffusionPipeline,
51
- StableDiffusionUpscalePipeline,
52
- )
53
-
54
- # Stable Diffusion XL pipelines
55
50
  from diffusers import (
56
- StableDiffusionXLControlNetImg2ImgPipeline,
57
- StableDiffusionXLControlNetInpaintPipeline,
58
- StableDiffusionXLControlNetPipeline,
51
+ AnimateDiffPipeline,
52
+ AnimateDiffSDXLPipeline,
53
+ StableDiffusionControlNetPipeline,
54
+ StableDiffusionControlNetImg2ImgPipeline,
55
+ StableDiffusionControlNetInpaintPipeline,
59
56
  StableDiffusionXLImg2ImgPipeline,
60
- StableDiffusionXLInpaintPipeline,
61
57
  StableDiffusionXLPipeline,
62
- )
63
-
64
- # Stable Diffusion 3 pipelines
65
- from diffusers import (
66
- StableDiffusion3Img2ImgPipeline,
67
- StableDiffusion3InpaintPipeline,
58
+ StableDiffusionXLInpaintPipeline,
59
+ StableDiffusionUpscalePipeline,
68
60
  StableDiffusion3Pipeline,
61
+ StableDiffusion3Img2ImgPipeline,
62
+ FluxPipeline,
63
+ FluxImg2ImgPipeline,
64
+ StableDiffusionXLControlNetPipeline,
65
+ StableDiffusionXLControlNetImg2ImgPipeline,
69
66
  )
70
67
 
71
- # Flux pipelines (import separately to avoid Flax deprecation warnings)
72
- try:
73
- from diffusers.pipelines.flux import (
74
- FluxImg2ImgPipeline,
75
- FluxInpaintPipeline,
76
- FluxPipeline,
77
- FluxControlImg2ImgPipeline,
78
- FluxControlInpaintPipeline,
79
- FluxControlNetImg2ImgPipeline,
80
- FluxControlNetInpaintPipeline,
81
- FluxControlNetPipeline,
82
- FluxControlPipeline,
83
- FluxKontextPipeline,
84
- )
85
- except ImportError:
86
- FluxImg2ImgPipeline = None
87
- FluxInpaintPipeline = None
88
- FluxPipeline = None
89
- FluxControlImg2ImgPipeline = None
90
- FluxControlInpaintPipeline = None
91
- FluxControlNetImg2ImgPipeline = None
92
- FluxControlNetInpaintPipeline = None
93
- FluxControlNetPipeline = None
94
- FluxControlPipeline = None
95
- FluxKontextPipeline = None
96
-
97
- # ControlNet pipelines
98
- from diffusers import (
99
- StableDiffusionControlNetImg2ImgPipeline,
100
- StableDiffusionControlNetInpaintPipeline,
101
- StableDiffusionControlNetPipeline,
102
- )
103
-
104
- # AnimateDiff pipelines
105
- from diffusers import (
106
- AnimateDiffPipeline,
107
- AnimateDiffSDXLPipeline,
108
- )
109
-
110
- # Optional pipelines (newer versions only)
111
- try:
112
- from diffusers import (
113
- AuraFlowPipeline,
114
- ChromaPipeline,
115
- CogView3PlusPipeline,
116
- CogView4ControlPipeline,
117
- CogView4Pipeline,
118
- HunyuanDiTPipeline,
119
- KandinskyCombinedPipeline,
120
- KandinskyImg2ImgCombinedPipeline,
121
- KandinskyInpaintCombinedPipeline,
122
- KandinskyV22CombinedPipeline,
123
- KandinskyV22Img2ImgCombinedPipeline,
124
- KandinskyV22InpaintCombinedPipeline,
125
- Kandinsky3Img2ImgPipeline,
126
- Kandinsky3Pipeline,
127
- LatentConsistencyModelImg2ImgPipeline,
128
- LatentConsistencyModelPipeline,
129
- Lumina2Pipeline,
130
- LuminaPipeline,
131
- OvisImagePipeline,
132
- PixArtAlphaPipeline,
133
- PixArtSigmaPipeline,
134
- QwenImageControlNetPipeline,
135
- QwenImageEditInpaintPipeline,
136
- QwenImageEditPipeline,
137
- QwenImageEditPlusPipeline,
138
- QwenImageImg2ImgPipeline,
139
- QwenImageInpaintPipeline,
140
- QwenImageLayeredPipeline,
141
- QwenImagePipeline,
142
- SanaPipeline,
143
- StableDiffusion3ControlNetInpaintingPipeline,
144
- StableDiffusion3ControlNetPipeline,
145
- StableDiffusionXLControlNetUnionImg2ImgPipeline,
146
- StableDiffusionXLControlNetUnionInpaintPipeline,
147
- StableDiffusionXLControlNetUnionPipeline,
148
- WanImageToVideoPipeline,
149
- WanPipeline,
150
- WanVideoToVideoPipeline,
151
- ZImageControlNetInpaintPipeline,
152
- ZImageControlNetPipeline,
153
- ZImageImg2ImgPipeline,
154
- ZImageOmniPipeline,
155
- ZImagePipeline,
156
- )
157
- except ImportError:
158
- # Fallback to None for pipelines not available in older versions
159
- AuraFlowPipeline = None
160
- ChromaPipeline = None
161
- CogView3PlusPipeline = None
162
- CogView4ControlPipeline = None
163
- CogView4Pipeline = None
164
- HunyuanDiTPipeline = None
165
- KandinskyCombinedPipeline = None
166
- KandinskyImg2ImgCombinedPipeline = None
167
- KandinskyInpaintCombinedPipeline = None
168
- KandinskyV22CombinedPipeline = None
169
- KandinskyV22Img2ImgCombinedPipeline = None
170
- KandinskyV22InpaintCombinedPipeline = None
171
- Kandinsky3Img2ImgPipeline = None
172
- Kandinsky3Pipeline = None
173
- LatentConsistencyModelImg2ImgPipeline = None
174
- LatentConsistencyModelPipeline = None
175
- Lumina2Pipeline = None
176
- LuminaPipeline = None
177
- OvisImagePipeline = None
178
- PixArtAlphaPipeline = None
179
- PixArtSigmaPipeline = None
180
- QwenImageControlNetPipeline = None
181
- QwenImageEditInpaintPipeline = None
182
- QwenImageEditPipeline = None
183
- QwenImageEditPlusPipeline = None
184
- QwenImageImg2ImgPipeline = None
185
- QwenImageInpaintPipeline = None
186
- QwenImageLayeredPipeline = None
187
- QwenImagePipeline = None
188
- SanaPipeline = None
189
- StableDiffusion3ControlNetInpaintingPipeline = None
190
- StableDiffusion3ControlNetPipeline = None
191
- StableDiffusionXLControlNetUnionImg2ImgPipeline = None
192
- StableDiffusionXLControlNetUnionInpaintPipeline = None
193
- StableDiffusionXLControlNetUnionPipeline = None
194
- WanImageToVideoPipeline = None
195
- WanPipeline = None
196
- WanVideoToVideoPipeline = None
197
- ZImageControlNetInpaintPipeline = None
198
- ZImageControlNetPipeline = None
199
- ZImageImg2ImgPipeline = None
200
- ZImageOmniPipeline = None
201
- ZImagePipeline = None
202
-
203
68
  from huggingface_hub import hf_api, hf_hub_download, hf_hub_url
204
69
  from huggingface_hub.file_download import http_get
205
70
  from huggingface_hub.utils import validate_hf_hub_args
@@ -207,16 +72,6 @@ from huggingface_hub.utils import validate_hf_hub_args
207
72
 
208
73
  logger = logging.get_logger(__name__)
209
74
 
210
- # Suppress verbose warnings from dependencies
211
- logging.set_verbosity_error()
212
- # Reduce logging level for torchao
213
- try:
214
- import logging as std_logging
215
- std_logging.getLogger("torchao").setLevel(std_logging.WARNING)
216
- std_logging.getLogger("torchao.kernel.intmm").setLevel(std_logging.ERROR)
217
- except Exception:
218
- pass
219
-
220
75
 
221
76
  SINGLE_FILE_CHECKPOINT_TEXT2IMAGE_PIPELINE_MAPPING = OrderedDict(
222
77
  [
@@ -226,65 +81,29 @@ SINGLE_FILE_CHECKPOINT_TEXT2IMAGE_PIPELINE_MAPPING = OrderedDict(
226
81
  ("animatediff_v1", AnimateDiffPipeline),
227
82
  ("animatediff_v2", AnimateDiffPipeline),
228
83
  ("animatediff_v3", AnimateDiffPipeline),
229
- ("auraflow", AuraFlowPipeline),
230
84
  ("autoencoder-dc-f128c512", None),
231
85
  ("autoencoder-dc-f32c32", None),
232
86
  ("autoencoder-dc-f32c32-sana", None),
233
87
  ("autoencoder-dc-f64c128", None),
234
- ("chroma", ChromaPipeline),
235
- ("cogview3", CogView3PlusPipeline),
236
- ("cogview4", CogView4Pipeline),
237
- ("cogview4-control", CogView4ControlPipeline),
238
88
  ("controlnet", StableDiffusionControlNetPipeline),
239
89
  ("controlnet_xl", StableDiffusionXLControlNetPipeline),
240
90
  ("controlnet_xl_large", StableDiffusionXLControlNetPipeline),
241
91
  ("controlnet_xl_mid", StableDiffusionXLControlNetPipeline),
242
92
  ("controlnet_xl_small", StableDiffusionXLControlNetPipeline),
243
- ("controlnet_xl_union", StableDiffusionXLControlNetUnionPipeline),
244
- ("cosmos-1.0-t2w-7B", None),
245
- ("cosmos-1.0-t2w-14B", None),
246
- ("cosmos-1.0-v2w-7B", None),
247
- ("cosmos-1.0-v2w-14B", None),
248
- ("cosmos-2.0-t2i-2B", None),
249
- ("cosmos-2.0-t2i-14B", None),
250
- ("cosmos-2.0-v2w-2B", None),
251
- ("cosmos-2.0-v2w-14B", None),
252
- ("flux-2-dev", FluxPipeline),
253
- ("flux-control", FluxControlPipeline),
254
- ("flux-controlnet", FluxControlNetPipeline),
255
93
  ("flux-depth", FluxPipeline),
256
94
  ("flux-dev", FluxPipeline),
257
95
  ("flux-fill", FluxPipeline),
258
- ("flux-kontext", FluxKontextPipeline),
259
96
  ("flux-schnell", FluxPipeline),
260
- ("hidream", None),
261
- ("hunyuan", HunyuanDiTPipeline),
262
97
  ("hunyuan-video", None),
263
98
  ("inpainting", None),
264
99
  ("inpainting_v2", None),
265
- ("instruct-pix2pix", None),
266
- ("kandinsky", KandinskyCombinedPipeline),
267
- ("kandinsky22", KandinskyV22CombinedPipeline),
268
- ("kandinsky3", Kandinsky3Pipeline),
269
- ("lcm", LatentConsistencyModelPipeline),
270
- ("lumina", LuminaPipeline),
271
- ("lumina2", Lumina2Pipeline),
272
100
  ("ltx-video", None),
273
101
  ("ltx-video-0.9.1", None),
274
- ("ltx-video-0.9.5", None),
275
- ("ltx-video-0.9.7", None),
276
102
  ("mochi-1-preview", None),
277
- ("ovis", OvisImagePipeline),
278
- ("pixart-alpha", PixArtAlphaPipeline),
279
- ("pixart-sigma", PixArtSigmaPipeline),
280
103
  ("playground-v2-5", StableDiffusionXLPipeline),
281
- ("qwenimage", QwenImagePipeline),
282
- ("qwenimage-controlnet", QwenImageControlNetPipeline),
283
- ("sana", SanaPipeline),
284
104
  ("sd3", StableDiffusion3Pipeline),
285
105
  ("sd35_large", StableDiffusion3Pipeline),
286
106
  ("sd35_medium", StableDiffusion3Pipeline),
287
- ("sd3-controlnet", StableDiffusion3ControlNetPipeline),
288
107
  ("stable_cascade_stage_b", None),
289
108
  ("stable_cascade_stage_b_lite", None),
290
109
  ("stable_cascade_stage_c", None),
@@ -292,20 +111,9 @@ SINGLE_FILE_CHECKPOINT_TEXT2IMAGE_PIPELINE_MAPPING = OrderedDict(
292
111
  ("upscale", StableDiffusionUpscalePipeline),
293
112
  ("v1", StableDiffusionPipeline),
294
113
  ("v2", StableDiffusionPipeline),
295
- ("wan-i2v-14B", WanImageToVideoPipeline),
296
- ("wan-t2v-1.3B", WanPipeline),
297
- ("wan-t2v-14B", WanPipeline),
298
- ("wan-vace-1.3B", WanVideoToVideoPipeline),
299
- ("wan-vace-14B", WanVideoToVideoPipeline),
300
114
  ("xl_base", StableDiffusionXLPipeline),
115
+ ("xl_inpaint", None),
301
116
  ("xl_refiner", StableDiffusionXLPipeline),
302
- ("z-image", ZImagePipeline),
303
- ("z-image-controlnet", ZImageControlNetPipeline),
304
- ("z-image-omni", ZImageOmniPipeline),
305
- ("z-image-turbo", None),
306
- ("z-image-turbo-controlnet", None),
307
- ("z-image-turbo-controlnet-2.0", None),
308
- ("z-image-turbo-controlnet-2.1", None),
309
117
  ],
310
118
  )
311
119
 
@@ -331,45 +139,17 @@ SINGLE_FILE_CHECKPOINT_IMAGE2IMAGE_PIPELINE_MAPPING = OrderedDict(
331
139
  ("controlnet_xl_large", StableDiffusionXLControlNetImg2ImgPipeline),
332
140
  ("controlnet_xl_mid", StableDiffusionXLControlNetImg2ImgPipeline),
333
141
  ("controlnet_xl_small", StableDiffusionXLControlNetImg2ImgPipeline),
334
- ("controlnet_xl_union", StableDiffusionXLControlNetUnionImg2ImgPipeline),
335
- ("cosmos-1.0-t2w-7B", None),
336
- ("cosmos-1.0-t2w-14B", None),
337
- ("cosmos-1.0-v2w-7B", None),
338
- ("cosmos-1.0-v2w-14B", None),
339
- ("cosmos-2.0-t2i-2B", None),
340
- ("cosmos-2.0-t2i-14B", None),
341
- ("cosmos-2.0-v2w-2B", None),
342
- ("cosmos-2.0-v2w-14B", None),
343
- ("flux-2-dev", FluxImg2ImgPipeline),
344
- ("flux-control", FluxControlImg2ImgPipeline),
345
- ("flux-controlnet", FluxControlNetImg2ImgPipeline),
346
142
  ("flux-depth", FluxImg2ImgPipeline),
347
143
  ("flux-dev", FluxImg2ImgPipeline),
348
144
  ("flux-fill", FluxImg2ImgPipeline),
349
- ("flux-kontext", FluxKontextPipeline),
350
145
  ("flux-schnell", FluxImg2ImgPipeline),
351
- ("hidream", None),
352
146
  ("hunyuan-video", None),
353
147
  ("inpainting", None),
354
148
  ("inpainting_v2", None),
355
- ("instruct-pix2pix", None),
356
- ("kandinsky", KandinskyImg2ImgCombinedPipeline),
357
- ("kandinsky22", KandinskyV22Img2ImgCombinedPipeline),
358
- ("kandinsky3", Kandinsky3Img2ImgPipeline),
359
- ("lcm", LatentConsistencyModelImg2ImgPipeline),
360
- ("lumina", None),
361
- ("lumina2", None),
362
149
  ("ltx-video", None),
363
150
  ("ltx-video-0.9.1", None),
364
- ("ltx-video-0.9.5", None),
365
- ("ltx-video-0.9.7", None),
366
151
  ("mochi-1-preview", None),
367
152
  ("playground-v2-5", StableDiffusionXLImg2ImgPipeline),
368
- ("qwenimage", QwenImageImg2ImgPipeline),
369
- ("qwenimage-edit", QwenImageEditPipeline),
370
- ("qwenimage-edit-plus", QwenImageEditPlusPipeline),
371
- ("qwenimage-layered", QwenImageLayeredPipeline),
372
- ("sana", None),
373
153
  ("sd3", StableDiffusion3Img2ImgPipeline),
374
154
  ("sd35_large", StableDiffusion3Img2ImgPipeline),
375
155
  ("sd35_medium", StableDiffusion3Img2ImgPipeline),
@@ -380,18 +160,9 @@ SINGLE_FILE_CHECKPOINT_IMAGE2IMAGE_PIPELINE_MAPPING = OrderedDict(
380
160
  ("upscale", StableDiffusionUpscalePipeline),
381
161
  ("v1", StableDiffusionImg2ImgPipeline),
382
162
  ("v2", StableDiffusionImg2ImgPipeline),
383
- ("wan-i2v-14B", WanImageToVideoPipeline),
384
- ("wan-t2v-1.3B", None),
385
- ("wan-t2v-14B", None),
386
- ("wan-vace-1.3B", WanVideoToVideoPipeline),
387
- ("wan-vace-14B", WanVideoToVideoPipeline),
388
163
  ("xl_base", StableDiffusionXLImg2ImgPipeline),
164
+ ("xl_inpaint", None),
389
165
  ("xl_refiner", StableDiffusionXLImg2ImgPipeline),
390
- ("z-image", ZImageImg2ImgPipeline),
391
- ("z-image-turbo", None),
392
- ("z-image-turbo-controlnet", None),
393
- ("z-image-turbo-controlnet-2.0", None),
394
- ("z-image-turbo-controlnet-2.1", None),
395
166
  ]
396
167
  )
397
168
 
@@ -408,68 +179,34 @@ SINGLE_FILE_CHECKPOINT_INPAINT_PIPELINE_MAPPING = OrderedDict(
408
179
  ("autoencoder-dc-f32c32-sana", None),
409
180
  ("autoencoder-dc-f64c128", None),
410
181
  ("controlnet", StableDiffusionControlNetInpaintPipeline),
411
- ("controlnet_xl", StableDiffusionXLControlNetInpaintPipeline),
412
- ("controlnet_xl_large", StableDiffusionXLControlNetInpaintPipeline),
413
- ("controlnet_xl_mid", StableDiffusionXLControlNetInpaintPipeline),
414
- ("controlnet_xl_small", StableDiffusionXLControlNetInpaintPipeline),
415
- ("controlnet_xl_union", StableDiffusionXLControlNetUnionInpaintPipeline),
416
- ("cosmos-1.0-t2w-7B", None),
417
- ("cosmos-1.0-t2w-14B", None),
418
- ("cosmos-1.0-v2w-7B", None),
419
- ("cosmos-1.0-v2w-14B", None),
420
- ("cosmos-2.0-t2i-2B", None),
421
- ("cosmos-2.0-t2i-14B", None),
422
- ("cosmos-2.0-v2w-2B", None),
423
- ("cosmos-2.0-v2w-14B", None),
424
- ("flux-2-dev", FluxInpaintPipeline),
425
- ("flux-control", FluxControlInpaintPipeline),
426
- ("flux-controlnet", FluxControlNetInpaintPipeline),
427
- ("flux-depth", FluxInpaintPipeline),
428
- ("flux-dev", FluxInpaintPipeline),
429
- ("flux-fill", FluxInpaintPipeline),
430
- ("flux-schnell", FluxInpaintPipeline),
431
- ("hidream", None),
182
+ ("controlnet_xl", None),
183
+ ("controlnet_xl_large", None),
184
+ ("controlnet_xl_mid", None),
185
+ ("controlnet_xl_small", None),
186
+ ("flux-depth", None),
187
+ ("flux-dev", None),
188
+ ("flux-fill", None),
189
+ ("flux-schnell", None),
432
190
  ("hunyuan-video", None),
433
191
  ("inpainting", StableDiffusionInpaintPipeline),
434
192
  ("inpainting_v2", StableDiffusionInpaintPipeline),
435
- ("instruct-pix2pix", None),
436
- ("kandinsky", KandinskyInpaintCombinedPipeline),
437
- ("kandinsky22", KandinskyV22InpaintCombinedPipeline),
438
- ("lcm", None),
439
- ("lumina", None),
440
- ("lumina2", None),
441
193
  ("ltx-video", None),
442
194
  ("ltx-video-0.9.1", None),
443
- ("ltx-video-0.9.5", None),
444
- ("ltx-video-0.9.7", None),
445
195
  ("mochi-1-preview", None),
446
196
  ("playground-v2-5", None),
447
- ("qwenimage", QwenImageInpaintPipeline),
448
- ("qwenimage-edit", QwenImageEditInpaintPipeline),
449
- ("sana", None),
450
- ("sd3", StableDiffusion3InpaintPipeline),
451
- ("sd35_large", StableDiffusion3InpaintPipeline),
452
- ("sd35_medium", StableDiffusion3InpaintPipeline),
453
- ("sd3-controlnet", StableDiffusion3ControlNetInpaintingPipeline),
197
+ ("sd3", None),
198
+ ("sd35_large", None),
199
+ ("sd35_medium", None),
454
200
  ("stable_cascade_stage_b", None),
455
201
  ("stable_cascade_stage_b_lite", None),
456
202
  ("stable_cascade_stage_c", None),
457
203
  ("stable_cascade_stage_c_lite", None),
458
204
  ("upscale", StableDiffusionUpscalePipeline),
459
- ("v1", StableDiffusionInpaintPipeline),
460
- ("v2", StableDiffusionInpaintPipeline),
461
- ("wan-i2v-14B", None),
462
- ("wan-t2v-1.3B", None),
463
- ("wan-t2v-14B", None),
464
- ("wan-vace-1.3B", None),
465
- ("wan-vace-14B", None),
466
- ("xl_base", StableDiffusionXLInpaintPipeline),
205
+ ("v1", None),
206
+ ("v2", None),
207
+ ("xl_base", None),
467
208
  ("xl_inpaint", StableDiffusionXLInpaintPipeline),
468
- ("z-image-controlnet-inpaint", ZImageControlNetInpaintPipeline),
469
- ("z-image-turbo", None),
470
- ("z-image-turbo-controlnet", None),
471
- ("z-image-turbo-controlnet-2.0", None),
472
- ("z-image-turbo-controlnet-2.1", None),
209
+ ("xl_refiner", None),
473
210
  ]
474
211
  )
475
212
 
@@ -525,30 +262,17 @@ TOKENIZER_SHAPE_MAP = {
525
262
  }
526
263
 
527
264
 
528
- def get_allowed_extensions(allow_unsafe_formats: bool = True) -> List[str]:
529
- r"""
530
- Get the list of allowed file extensions based on safety preferences.
531
-
532
- Parameters:
533
- allow_unsafe_formats (`bool`, *optional*, defaults to `True`):
534
- If True (default), allows all formats (.safetensors, .ckpt, .bin) for backward compatibility.
535
- If False, only allows .safetensors format for maximum security.
536
-
537
- Returns:
538
- `List[str]`: List of allowed file extensions.
539
- """
540
- if allow_unsafe_formats:
541
- return [".safetensors", ".ckpt", ".bin"]
542
- else:
543
- return [".safetensors"]
544
-
545
-
546
- # Default extension list (for backward compatibility)
547
265
  EXTENSION = [".safetensors", ".ckpt", ".bin"]
548
266
 
549
267
  CACHE_HOME = os.path.expanduser("~/.cache")
550
268
 
551
269
 
270
+ # Set up pipeline mappings
271
+ AUTO_TEXT2IMAGE_PIPELINES_MAPPING["v1"] = StableDiffusionPipeline
272
+ AUTO_IMAGE2IMAGE_PIPELINES_MAPPING["v1"] = StableDiffusionImg2ImgPipeline
273
+ AUTO_INPAINT_PIPELINES_MAPPING["v1"] = StableDiffusionInpaintPipeline
274
+
275
+
552
276
  @dataclass
553
277
  class RepoStatus:
554
278
  r"""
@@ -908,14 +632,10 @@ def file_downloader(
908
632
  mode = "ab"
909
633
  file_size = os.path.getsize(save_path)
910
634
 
911
- # Try HEAD validation but don't fail if it returns errors (Cloudflare R2 blocks HEAD requests)
912
- # The actual download attempt will reveal if the URL is truly inaccessible
913
- try:
914
- validate_url_with_head(url, headers=headers)
915
- except requests.HTTPError as e:
916
- # Log but continue - HEAD requests may fail even when GET succeeds
917
- status_code = e.response.status_code if hasattr(e, 'response') else 'unknown'
918
- logger.info(f"HEAD request returned {status_code} for {url}, attempting download anyway...")
635
+ # Check if the URL is accessible before downloading. If the HEAD request returns any
636
+ # 4xx or 5xx status code, an HTTPError is raised so callers can try the next candidate.
637
+ # Only successful (2xx) responses will proceed to download.
638
+ validate_url_with_head(url, headers=headers)
919
639
 
920
640
  # Open the file in the appropriate mode (write or append)
921
641
  with open(save_path, mode) as model_file:
@@ -957,9 +677,6 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
957
677
  A boolean to filter models on the Hub that are gated or not.
958
678
  skip_error (`bool`, *optional*, defaults to `False`):
959
679
  Whether to skip errors and return None.
960
- allow_unsafe_formats (`bool`, *optional*, defaults to `False`):
961
- If True, allows potentially unsafe formats (.ckpt, .bin) in addition to .safetensors.
962
- If False (default), only allows .safetensors format for maximum security.
963
680
 
964
681
  Returns:
965
682
  `Union[str, SearchResult, None]`: The model path or SearchResult or None.
@@ -981,10 +698,6 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
981
698
  gated = kwargs.pop("gated", False)
982
699
  cache_dir = kwargs.pop("cache_dir", None)
983
700
  skip_error = kwargs.pop("skip_error", False)
984
- allow_unsafe_formats = kwargs.pop("allow_unsafe_formats", False)
985
-
986
- # Get allowed extensions based on safety preference
987
- allowed_extensions = get_allowed_extensions(allow_unsafe_formats)
988
701
 
989
702
  file_list = []
990
703
  hf_repo_info = {}
@@ -1030,7 +743,7 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
1030
743
  return None
1031
744
  else:
1032
745
  raise ValueError(
1033
- "The URL for Civitai is invalid with `from_huggingface`. Please use `from_civitai` instead."
746
+ "The URL for Civitai is invalid with `for_hf`. Please use `for_civitai` instead."
1034
747
  )
1035
748
  else:
1036
749
  # Get model data from HF API
@@ -1080,7 +793,7 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
1080
793
  break
1081
794
 
1082
795
  elif (
1083
- any(file_path.endswith(ext) for ext in allowed_extensions)
796
+ any(file_path.endswith(ext) for ext in EXTENSION)
1084
797
  and not any(config in file_path for config in CONFIG_FILE_LIST)
1085
798
  and not any(exc in file_path for exc in exclusion)
1086
799
  and os.path.basename(os.path.dirname(file_path)) not in DIFFUSERS_CONFIG_DIR
@@ -1248,9 +961,6 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
1248
961
  Whether to resume an incomplete download.
1249
962
  skip_error (`bool`, *optional*, defaults to `False`):
1250
963
  Whether to skip errors and return None.
1251
- allow_unsafe_formats (`bool`, *optional*, defaults to `False`):
1252
- If True, allows potentially unsafe formats (.ckpt, .bin) in addition to .safetensors.
1253
- If False (default), only allows .safetensors format for maximum security.
1254
964
 
1255
965
  Returns:
1256
966
  `Union[str, SearchResult, None]`: The model path or ` SearchResult` or None.
@@ -1267,10 +977,6 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
1267
977
  resume = kwargs.pop("resume", False)
1268
978
  cache_dir = kwargs.pop("cache_dir", None)
1269
979
  skip_error = kwargs.pop("skip_error", False)
1270
- allow_unsafe_formats = kwargs.pop("allow_unsafe_formats", False)
1271
-
1272
- # Get allowed extensions based on safety preference
1273
- allowed_extensions = get_allowed_extensions(allow_unsafe_formats)
1274
980
 
1275
981
  # Initialize additional variables with default values
1276
982
  model_path = ""
@@ -1420,9 +1126,6 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
1420
1126
  # Since the Civitai API is broken, I will temporarily sort by name.
1421
1127
  sorted_repos = sorted(data["items"], key=lambda x: x["name"], reverse=True)
1422
1128
 
1423
- # Collect all valid candidates instead of selecting one
1424
- all_candidates = []
1425
-
1426
1129
  for selected_repo in sorted_repos:
1427
1130
  repo_name = selected_repo["name"]
1428
1131
  repo_id = selected_repo["id"]
@@ -1445,7 +1148,9 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
1445
1148
  if (
1446
1149
  model_data["pickleScanResult"] == "Success"
1447
1150
  and model_data["virusScanResult"] == "Success"
1448
- and any(file_name.endswith(ext) for ext in allowed_extensions)
1151
+ and any(file_name.endswith(ext) for ext in EXTENSION)
1152
+ and os.path.basename(os.path.dirname(file_name))
1153
+ not in DIFFUSERS_CONFIG_DIR
1449
1154
  ):
1450
1155
  file_status = {
1451
1156
  "filename": file_name,
@@ -1470,69 +1175,65 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
1470
1175
  sorted_models[0],
1471
1176
  )
1472
1177
 
1473
- # Add to candidates list (skip URL validation which causes 403 errors)
1474
- # Actual download will be attempted and retried recursively
1475
- all_candidates.append({
1476
- 'model': candidate_model,
1477
- 'repo_name': repo_name,
1478
- 'repo_id': repo_id,
1479
- 'version_id': version_id,
1480
- 'trainedWords': trainedWords,
1481
- })
1482
- logger.info(f"Added candidate: {candidate_model['filename']} from {repo_name}")
1483
-
1484
-
1485
- # Exception handling when no candidates are found
1486
- if not all_candidates:
1178
+ # Validate download URL accessibility (check first file only)
1179
+ try:
1180
+ # Since models requiring authentication do not return results, there is no need to determine their status via status codes.
1181
+ _resp = requests.head(
1182
+ candidate_model["download_url"],
1183
+ headers=headers,
1184
+ timeout=2,
1185
+ allow_redirects=True
1186
+ )
1187
+ _resp.raise_for_status()
1188
+ selected_model = candidate_model
1189
+ logger.info(f"Validated download URL: {candidate_model['download_url']}")
1190
+ break # Exit the version loop if a valid model is found
1191
+ except requests.HTTPError as e:
1192
+ if "403" in str(e) or "401" in str(e):
1193
+ logger.info(f"Access denied ({e.response.status_code}) for {candidate_model['download_url']}, trying next version...")
1194
+ continue
1195
+ else:
1196
+ logger.info(f"HTTP error for {candidate_model['download_url']}: {e}, trying next version...")
1197
+ continue
1198
+ except requests.exceptions.RequestException as e:
1199
+ logger.info(f"Failed to validate URL {candidate_model['download_url']}: {e}, trying next version...")
1200
+ continue
1201
+
1202
+ # If we found a valid model in this repo, exit outer repo loop
1203
+ if selected_model:
1204
+ break
1205
+
1206
+
1207
+ # Exception handling when search candidates are not found
1208
+ if not selected_model:
1487
1209
  if skip_error:
1488
1210
  return None
1489
1211
  else:
1490
- # Provide helpful error message based on token availability
1491
- if token:
1492
- error_msg = (
1493
- "No model found. Please try changing the search word or filter criteria "
1494
- "(e.g., base_model, sort). You can also check if your CivitAI token has "
1495
- "access to the models you're searching for."
1496
- )
1497
- else:
1498
- error_msg = (
1499
- "No model found. Please try changing the search word or filter criteria. "
1500
- "If you're looking for private or exclusive models, provide a CivitAI token: "
1501
- "search_civitai(search_word, token='your_civitai_token')"
1502
- )
1503
- raise ValueError(error_msg)
1504
-
1505
- # Select first candidate for initial metadata
1506
- selected = all_candidates[0]
1507
- selected_model = selected['model']
1508
- repo_name = selected['repo_name']
1509
- repo_id = selected['repo_id']
1510
- version_id = selected['version_id']
1511
- trainedWords = selected['trainedWords']
1512
-
1212
+ raise ValueError(
1213
+ "No model found. Please try changing the word you are searching for."
1214
+ )
1215
+
1216
+ # Define model file status
1513
1217
  file_name = selected_model["filename"]
1514
1218
  download_url = selected_model["download_url"]
1515
1219
 
1516
1220
  # Handle file download and setting model information
1517
1221
  if download:
1518
- # Try downloading from all candidates recursively
1222
+ # Try downloading from the models list, retrying on 401/403 errors
1519
1223
  download_success = False
1224
+ # Create a sorted list of all available models to try
1225
+ sorted_models = sorted(
1226
+ models_list, key=lambda x: x["filename"], reverse=True
1227
+ )
1520
1228
 
1521
- logger.info(f"Attempting to download from {len(all_candidates)} candidate(s)...")
1522
-
1523
- for idx, candidate in enumerate(all_candidates):
1229
+ for model_candidate in sorted_models:
1524
1230
  try:
1525
- candidate_model = candidate['model']
1526
- file_name = candidate_model["filename"]
1527
- download_url = candidate_model["download_url"]
1528
- candidate_repo_id = candidate['repo_id']
1529
- candidate_version_id = candidate['version_id']
1231
+ file_name = model_candidate["filename"]
1232
+ download_url = model_candidate["download_url"]
1530
1233
 
1531
- logger.info(f"Attempt {idx + 1}/{len(all_candidates)}: {file_name} from {candidate['repo_name']}")
1532
-
1533
- # The path where the model is to be saved
1234
+ # The path where the model is to be saved.
1534
1235
  model_path = os.path.join(
1535
- str(civitai_cache_dir), str(candidate_repo_id), str(candidate_version_id), str(file_name)
1236
+ str(civitai_cache_dir), str(repo_id), str(version_id), str(file_name)
1536
1237
  )
1537
1238
 
1538
1239
  # Download Model File
@@ -1545,44 +1246,22 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
1545
1246
  headers=headers,
1546
1247
  **kwargs,
1547
1248
  )
1548
-
1549
- # Update selected metadata on success
1550
1249
  download_success = True
1551
- selected_model = candidate_model
1552
- repo_name = candidate['repo_name']
1553
- repo_id = candidate_repo_id
1554
- version_id = candidate_version_id
1555
- trainedWords = candidate['trainedWords']
1556
- file_name = candidate_model["filename"]
1557
- download_url = candidate_model["download_url"]
1558
-
1559
- logger.info(f"Successfully downloaded: {file_name} from {repo_name}")
1250
+ logger.info(f"Successfully downloaded model from: {download_url}")
1560
1251
  break
1561
-
1562
1252
  except requests.HTTPError as e:
1563
- status_code = e.response.status_code if hasattr(e, 'response') else 'unknown'
1564
- logger.info(f"HTTP error {status_code} for {download_url}, trying next candidate...")
1565
- continue
1566
- except Exception as e:
1567
- logger.info(f"Download failed for {download_url}: {e}, trying next candidate...")
1568
- continue
1253
+ if "401" in str(e) or "403" in str(e):
1254
+ logger.info(f"Access denied ({e.response.status_code if hasattr(e, 'response') else 'unknown'}) for {download_url}, trying next candidate...")
1255
+ continue
1256
+ else:
1257
+ logger.info(f"HTTP error for {download_url}: {e}, trying next candidate...")
1258
+ continue
1569
1259
 
1570
1260
  if not download_success:
1571
1261
  if skip_error:
1572
1262
  return None
1573
1263
  else:
1574
- # Show helpful error message based on token availability
1575
- if token:
1576
- error_msg = (
1577
- f"Failed to download any model file after trying {len(all_candidates)} candidate(s). "
1578
- "All downloads returned errors. Please check your CivitAI token permissions or try different search criteria."
1579
- )
1580
- else:
1581
- error_msg = (
1582
- f"Failed to download any model file after trying {len(all_candidates)} candidate(s). "
1583
- "If models require authentication, provide a CivitAI token: search_civitai(search_word, token='your_token')"
1584
- )
1585
- raise ValueError(error_msg)
1264
+ raise ValueError(f"Failed to download any model file from {repo_name}. All URLs returned access denied or other errors.")
1586
1265
 
1587
1266
  else:
1588
1267
  model_path = download_url
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: auto_diffusers
3
- Version: 2.0.36
3
+ Version: 2.0.36.dev0
4
4
  Summary: diffusers with search engine
5
5
  Home-page: https://github.com/suzukimain/auto_diffusers
6
6
  Author: suzukimain
@@ -80,15 +80,6 @@ Enhance the functionality of diffusers.
80
80
 
81
81
  </details>
82
82
 
83
- ## Regarding the Civitai API bug
84
-
85
- Due to recent specification changes in the Civitai API, we are aware of the following issues:
86
- - Reduced search accuracy
87
- - Some search results not being returned
88
-
89
- 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.
90
-
91
- link: [civitai/civitai#1757](https://github.com/civitai/civitai/issues/1757)
92
83
  ## How to use<a name = "How_to_use"></a>
93
84
 
94
85
  ```python