auto-diffusers 2.0.36.dev0__tar.gz → 2.0.36.dev1__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.
- {auto_diffusers-2.0.36.dev0/src/auto_diffusers.egg-info → auto_diffusers-2.0.36.dev1}/PKG-INFO +10 -1
- {auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/README.md +9 -0
- {auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/setup.py +1 -1
- {auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/src/auto_diffusers/__init__.py +1 -1
- {auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/src/auto_diffusers/pipeline_easy.py +431 -110
- {auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1/src/auto_diffusers.egg-info}/PKG-INFO +10 -1
- {auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/LICENSE +0 -0
- {auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/MANIFEST.in +0 -0
- {auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/setup.cfg +0 -0
- {auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/src/auto_diffusers/py.typed +0 -0
- {auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/src/auto_diffusers.egg-info/SOURCES.txt +0 -0
- {auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/src/auto_diffusers.egg-info/dependency_links.txt +0 -0
- {auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/src/auto_diffusers.egg-info/requires.txt +0 -0
- {auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/src/auto_diffusers.egg-info/top_level.txt +0 -0
{auto_diffusers-2.0.36.dev0/src/auto_diffusers.egg-info → auto_diffusers-2.0.36.dev1}/PKG-INFO
RENAMED
|
@@ -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.dev1
|
|
4
4
|
Summary: diffusers with search engine
|
|
5
5
|
Home-page: https://github.com/suzukimain/auto_diffusers
|
|
6
6
|
Author: suzukimain
|
|
@@ -80,6 +80,15 @@ 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)
|
|
83
92
|
## How to use<a name = "How_to_use"></a>
|
|
84
93
|
|
|
85
94
|
```python
|
|
@@ -42,6 +42,15 @@ 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)
|
|
45
54
|
## How to use<a name = "How_to_use"></a>
|
|
46
55
|
|
|
47
56
|
```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.
|
|
14
|
+
version="2.0.36dev1",
|
|
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",
|
{auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/src/auto_diffusers/pipeline_easy.py
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# coding=utf-8
|
|
2
|
-
# Copyright
|
|
2
|
+
# Copyright 2026 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,58 +13,193 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
+
# Standard library imports
|
|
16
17
|
import os
|
|
17
18
|
import re
|
|
18
19
|
import types
|
|
20
|
+
from collections import OrderedDict
|
|
19
21
|
from dataclasses import asdict, dataclass, field
|
|
20
22
|
from typing import Dict, List, Optional, Union
|
|
21
|
-
from collections import OrderedDict
|
|
22
|
-
|
|
23
23
|
|
|
24
|
+
# Third-party imports
|
|
24
25
|
import requests
|
|
25
26
|
import torch
|
|
26
27
|
|
|
28
|
+
# Diffusers core imports
|
|
27
29
|
from diffusers.loaders.single_file_utils import (
|
|
28
30
|
VALID_URL_PREFIXES,
|
|
29
31
|
_extract_repo_id_and_weights_name,
|
|
30
32
|
infer_diffusers_model_type,
|
|
31
33
|
load_single_file_checkpoint,
|
|
32
34
|
)
|
|
33
|
-
|
|
34
|
-
from diffusers import (
|
|
35
|
-
StableDiffusionPipeline,
|
|
36
|
-
StableDiffusionImg2ImgPipeline,
|
|
37
|
-
StableDiffusionInpaintPipeline,
|
|
38
|
-
)
|
|
39
35
|
from diffusers.pipelines.auto_pipeline import (
|
|
36
|
+
AUTO_IMAGE2IMAGE_PIPELINES_MAPPING,
|
|
37
|
+
AUTO_INPAINT_PIPELINES_MAPPING,
|
|
38
|
+
AUTO_TEXT2IMAGE_PIPELINES_MAPPING,
|
|
40
39
|
AutoPipelineForImage2Image,
|
|
41
40
|
AutoPipelineForInpainting,
|
|
42
41
|
AutoPipelineForText2Image,
|
|
43
|
-
AUTO_TEXT2IMAGE_PIPELINES_MAPPING,
|
|
44
|
-
AUTO_IMAGE2IMAGE_PIPELINES_MAPPING,
|
|
45
|
-
AUTO_INPAINT_PIPELINES_MAPPING,
|
|
46
42
|
)
|
|
47
43
|
from diffusers.pipelines.pipeline_utils import DiffusionPipeline
|
|
48
44
|
from diffusers.utils import logging
|
|
49
45
|
|
|
46
|
+
# Stable Diffusion v1/v2 pipelines
|
|
50
47
|
from diffusers import (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
StableDiffusionImg2ImgPipeline,
|
|
49
|
+
StableDiffusionInpaintPipeline,
|
|
50
|
+
StableDiffusionPipeline,
|
|
51
|
+
StableDiffusionUpscalePipeline,
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
# Stable Diffusion XL pipelines
|
|
55
|
+
from diffusers import (
|
|
56
|
+
StableDiffusionXLControlNetImg2ImgPipeline,
|
|
57
|
+
StableDiffusionXLControlNetInpaintPipeline,
|
|
58
|
+
StableDiffusionXLControlNetPipeline,
|
|
56
59
|
StableDiffusionXLImg2ImgPipeline,
|
|
57
|
-
StableDiffusionXLPipeline,
|
|
58
60
|
StableDiffusionXLInpaintPipeline,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
StableDiffusionXLPipeline,
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
# Stable Diffusion 3 pipelines
|
|
65
|
+
from diffusers import (
|
|
61
66
|
StableDiffusion3Img2ImgPipeline,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
67
|
+
StableDiffusion3InpaintPipeline,
|
|
68
|
+
StableDiffusion3Pipeline,
|
|
69
|
+
)
|
|
70
|
+
|
|
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,
|
|
66
102
|
)
|
|
67
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
|
+
|
|
68
203
|
from huggingface_hub import hf_api, hf_hub_download, hf_hub_url
|
|
69
204
|
from huggingface_hub.file_download import http_get
|
|
70
205
|
from huggingface_hub.utils import validate_hf_hub_args
|
|
@@ -72,6 +207,16 @@ from huggingface_hub.utils import validate_hf_hub_args
|
|
|
72
207
|
|
|
73
208
|
logger = logging.get_logger(__name__)
|
|
74
209
|
|
|
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
|
+
|
|
75
220
|
|
|
76
221
|
SINGLE_FILE_CHECKPOINT_TEXT2IMAGE_PIPELINE_MAPPING = OrderedDict(
|
|
77
222
|
[
|
|
@@ -81,29 +226,65 @@ SINGLE_FILE_CHECKPOINT_TEXT2IMAGE_PIPELINE_MAPPING = OrderedDict(
|
|
|
81
226
|
("animatediff_v1", AnimateDiffPipeline),
|
|
82
227
|
("animatediff_v2", AnimateDiffPipeline),
|
|
83
228
|
("animatediff_v3", AnimateDiffPipeline),
|
|
229
|
+
("auraflow", AuraFlowPipeline),
|
|
84
230
|
("autoencoder-dc-f128c512", None),
|
|
85
231
|
("autoencoder-dc-f32c32", None),
|
|
86
232
|
("autoencoder-dc-f32c32-sana", None),
|
|
87
233
|
("autoencoder-dc-f64c128", None),
|
|
234
|
+
("chroma", ChromaPipeline),
|
|
235
|
+
("cogview3", CogView3PlusPipeline),
|
|
236
|
+
("cogview4", CogView4Pipeline),
|
|
237
|
+
("cogview4-control", CogView4ControlPipeline),
|
|
88
238
|
("controlnet", StableDiffusionControlNetPipeline),
|
|
89
239
|
("controlnet_xl", StableDiffusionXLControlNetPipeline),
|
|
90
240
|
("controlnet_xl_large", StableDiffusionXLControlNetPipeline),
|
|
91
241
|
("controlnet_xl_mid", StableDiffusionXLControlNetPipeline),
|
|
92
242
|
("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),
|
|
93
255
|
("flux-depth", FluxPipeline),
|
|
94
256
|
("flux-dev", FluxPipeline),
|
|
95
257
|
("flux-fill", FluxPipeline),
|
|
258
|
+
("flux-kontext", FluxKontextPipeline),
|
|
96
259
|
("flux-schnell", FluxPipeline),
|
|
260
|
+
("hidream", None),
|
|
261
|
+
("hunyuan", HunyuanDiTPipeline),
|
|
97
262
|
("hunyuan-video", None),
|
|
98
263
|
("inpainting", None),
|
|
99
264
|
("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),
|
|
100
272
|
("ltx-video", None),
|
|
101
273
|
("ltx-video-0.9.1", None),
|
|
274
|
+
("ltx-video-0.9.5", None),
|
|
275
|
+
("ltx-video-0.9.7", None),
|
|
102
276
|
("mochi-1-preview", None),
|
|
277
|
+
("ovis", OvisImagePipeline),
|
|
278
|
+
("pixart-alpha", PixArtAlphaPipeline),
|
|
279
|
+
("pixart-sigma", PixArtSigmaPipeline),
|
|
103
280
|
("playground-v2-5", StableDiffusionXLPipeline),
|
|
281
|
+
("qwenimage", QwenImagePipeline),
|
|
282
|
+
("qwenimage-controlnet", QwenImageControlNetPipeline),
|
|
283
|
+
("sana", SanaPipeline),
|
|
104
284
|
("sd3", StableDiffusion3Pipeline),
|
|
105
285
|
("sd35_large", StableDiffusion3Pipeline),
|
|
106
286
|
("sd35_medium", StableDiffusion3Pipeline),
|
|
287
|
+
("sd3-controlnet", StableDiffusion3ControlNetPipeline),
|
|
107
288
|
("stable_cascade_stage_b", None),
|
|
108
289
|
("stable_cascade_stage_b_lite", None),
|
|
109
290
|
("stable_cascade_stage_c", None),
|
|
@@ -111,9 +292,20 @@ SINGLE_FILE_CHECKPOINT_TEXT2IMAGE_PIPELINE_MAPPING = OrderedDict(
|
|
|
111
292
|
("upscale", StableDiffusionUpscalePipeline),
|
|
112
293
|
("v1", StableDiffusionPipeline),
|
|
113
294
|
("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),
|
|
114
300
|
("xl_base", StableDiffusionXLPipeline),
|
|
115
|
-
("xl_inpaint", None),
|
|
116
301
|
("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),
|
|
117
309
|
],
|
|
118
310
|
)
|
|
119
311
|
|
|
@@ -139,17 +331,45 @@ SINGLE_FILE_CHECKPOINT_IMAGE2IMAGE_PIPELINE_MAPPING = OrderedDict(
|
|
|
139
331
|
("controlnet_xl_large", StableDiffusionXLControlNetImg2ImgPipeline),
|
|
140
332
|
("controlnet_xl_mid", StableDiffusionXLControlNetImg2ImgPipeline),
|
|
141
333
|
("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),
|
|
142
346
|
("flux-depth", FluxImg2ImgPipeline),
|
|
143
347
|
("flux-dev", FluxImg2ImgPipeline),
|
|
144
348
|
("flux-fill", FluxImg2ImgPipeline),
|
|
349
|
+
("flux-kontext", FluxKontextPipeline),
|
|
145
350
|
("flux-schnell", FluxImg2ImgPipeline),
|
|
351
|
+
("hidream", None),
|
|
146
352
|
("hunyuan-video", None),
|
|
147
353
|
("inpainting", None),
|
|
148
354
|
("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),
|
|
149
362
|
("ltx-video", None),
|
|
150
363
|
("ltx-video-0.9.1", None),
|
|
364
|
+
("ltx-video-0.9.5", None),
|
|
365
|
+
("ltx-video-0.9.7", None),
|
|
151
366
|
("mochi-1-preview", None),
|
|
152
367
|
("playground-v2-5", StableDiffusionXLImg2ImgPipeline),
|
|
368
|
+
("qwenimage", QwenImageImg2ImgPipeline),
|
|
369
|
+
("qwenimage-edit", QwenImageEditPipeline),
|
|
370
|
+
("qwenimage-edit-plus", QwenImageEditPlusPipeline),
|
|
371
|
+
("qwenimage-layered", QwenImageLayeredPipeline),
|
|
372
|
+
("sana", None),
|
|
153
373
|
("sd3", StableDiffusion3Img2ImgPipeline),
|
|
154
374
|
("sd35_large", StableDiffusion3Img2ImgPipeline),
|
|
155
375
|
("sd35_medium", StableDiffusion3Img2ImgPipeline),
|
|
@@ -160,9 +380,18 @@ SINGLE_FILE_CHECKPOINT_IMAGE2IMAGE_PIPELINE_MAPPING = OrderedDict(
|
|
|
160
380
|
("upscale", StableDiffusionUpscalePipeline),
|
|
161
381
|
("v1", StableDiffusionImg2ImgPipeline),
|
|
162
382
|
("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),
|
|
163
388
|
("xl_base", StableDiffusionXLImg2ImgPipeline),
|
|
164
|
-
("xl_inpaint", None),
|
|
165
389
|
("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),
|
|
166
395
|
]
|
|
167
396
|
)
|
|
168
397
|
|
|
@@ -179,34 +408,68 @@ SINGLE_FILE_CHECKPOINT_INPAINT_PIPELINE_MAPPING = OrderedDict(
|
|
|
179
408
|
("autoencoder-dc-f32c32-sana", None),
|
|
180
409
|
("autoencoder-dc-f64c128", None),
|
|
181
410
|
("controlnet", StableDiffusionControlNetInpaintPipeline),
|
|
182
|
-
("controlnet_xl",
|
|
183
|
-
("controlnet_xl_large",
|
|
184
|
-
("controlnet_xl_mid",
|
|
185
|
-
("controlnet_xl_small",
|
|
186
|
-
("
|
|
187
|
-
("
|
|
188
|
-
("
|
|
189
|
-
("
|
|
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),
|
|
190
432
|
("hunyuan-video", None),
|
|
191
433
|
("inpainting", StableDiffusionInpaintPipeline),
|
|
192
434
|
("inpainting_v2", StableDiffusionInpaintPipeline),
|
|
435
|
+
("instruct-pix2pix", None),
|
|
436
|
+
("kandinsky", KandinskyInpaintCombinedPipeline),
|
|
437
|
+
("kandinsky22", KandinskyV22InpaintCombinedPipeline),
|
|
438
|
+
("lcm", None),
|
|
439
|
+
("lumina", None),
|
|
440
|
+
("lumina2", None),
|
|
193
441
|
("ltx-video", None),
|
|
194
442
|
("ltx-video-0.9.1", None),
|
|
443
|
+
("ltx-video-0.9.5", None),
|
|
444
|
+
("ltx-video-0.9.7", None),
|
|
195
445
|
("mochi-1-preview", None),
|
|
196
446
|
("playground-v2-5", None),
|
|
197
|
-
("
|
|
198
|
-
("
|
|
199
|
-
("
|
|
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),
|
|
200
454
|
("stable_cascade_stage_b", None),
|
|
201
455
|
("stable_cascade_stage_b_lite", None),
|
|
202
456
|
("stable_cascade_stage_c", None),
|
|
203
457
|
("stable_cascade_stage_c_lite", None),
|
|
204
458
|
("upscale", StableDiffusionUpscalePipeline),
|
|
205
|
-
("v1",
|
|
206
|
-
("v2",
|
|
207
|
-
("
|
|
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),
|
|
208
467
|
("xl_inpaint", StableDiffusionXLInpaintPipeline),
|
|
209
|
-
("
|
|
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),
|
|
210
473
|
]
|
|
211
474
|
)
|
|
212
475
|
|
|
@@ -262,15 +525,28 @@ TOKENIZER_SHAPE_MAP = {
|
|
|
262
525
|
}
|
|
263
526
|
|
|
264
527
|
|
|
265
|
-
|
|
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"]
|
|
266
544
|
|
|
267
|
-
CACHE_HOME = os.path.expanduser("~/.cache")
|
|
268
545
|
|
|
546
|
+
# Default extension list (for backward compatibility)
|
|
547
|
+
EXTENSION = [".safetensors", ".ckpt", ".bin"]
|
|
269
548
|
|
|
270
|
-
|
|
271
|
-
AUTO_TEXT2IMAGE_PIPELINES_MAPPING["v1"] = StableDiffusionPipeline
|
|
272
|
-
AUTO_IMAGE2IMAGE_PIPELINES_MAPPING["v1"] = StableDiffusionImg2ImgPipeline
|
|
273
|
-
AUTO_INPAINT_PIPELINES_MAPPING["v1"] = StableDiffusionInpaintPipeline
|
|
549
|
+
CACHE_HOME = os.path.expanduser("~/.cache")
|
|
274
550
|
|
|
275
551
|
|
|
276
552
|
@dataclass
|
|
@@ -632,10 +908,14 @@ def file_downloader(
|
|
|
632
908
|
mode = "ab"
|
|
633
909
|
file_size = os.path.getsize(save_path)
|
|
634
910
|
|
|
635
|
-
#
|
|
636
|
-
#
|
|
637
|
-
|
|
638
|
-
|
|
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...")
|
|
639
919
|
|
|
640
920
|
# Open the file in the appropriate mode (write or append)
|
|
641
921
|
with open(save_path, mode) as model_file:
|
|
@@ -677,6 +957,9 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
|
|
|
677
957
|
A boolean to filter models on the Hub that are gated or not.
|
|
678
958
|
skip_error (`bool`, *optional*, defaults to `False`):
|
|
679
959
|
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.
|
|
680
963
|
|
|
681
964
|
Returns:
|
|
682
965
|
`Union[str, SearchResult, None]`: The model path or SearchResult or None.
|
|
@@ -698,6 +981,10 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
|
|
|
698
981
|
gated = kwargs.pop("gated", False)
|
|
699
982
|
cache_dir = kwargs.pop("cache_dir", None)
|
|
700
983
|
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)
|
|
701
988
|
|
|
702
989
|
file_list = []
|
|
703
990
|
hf_repo_info = {}
|
|
@@ -743,7 +1030,7 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
|
|
|
743
1030
|
return None
|
|
744
1031
|
else:
|
|
745
1032
|
raise ValueError(
|
|
746
|
-
"The URL for Civitai is invalid with `
|
|
1033
|
+
"The URL for Civitai is invalid with `from_huggingface`. Please use `from_civitai` instead."
|
|
747
1034
|
)
|
|
748
1035
|
else:
|
|
749
1036
|
# Get model data from HF API
|
|
@@ -793,7 +1080,7 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
|
|
|
793
1080
|
break
|
|
794
1081
|
|
|
795
1082
|
elif (
|
|
796
|
-
any(file_path.endswith(ext) for ext in
|
|
1083
|
+
any(file_path.endswith(ext) for ext in allowed_extensions)
|
|
797
1084
|
and not any(config in file_path for config in CONFIG_FILE_LIST)
|
|
798
1085
|
and not any(exc in file_path for exc in exclusion)
|
|
799
1086
|
and os.path.basename(os.path.dirname(file_path)) not in DIFFUSERS_CONFIG_DIR
|
|
@@ -961,6 +1248,9 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
|
|
|
961
1248
|
Whether to resume an incomplete download.
|
|
962
1249
|
skip_error (`bool`, *optional*, defaults to `False`):
|
|
963
1250
|
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.
|
|
964
1254
|
|
|
965
1255
|
Returns:
|
|
966
1256
|
`Union[str, SearchResult, None]`: The model path or ` SearchResult` or None.
|
|
@@ -977,6 +1267,10 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
|
|
|
977
1267
|
resume = kwargs.pop("resume", False)
|
|
978
1268
|
cache_dir = kwargs.pop("cache_dir", None)
|
|
979
1269
|
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)
|
|
980
1274
|
|
|
981
1275
|
# Initialize additional variables with default values
|
|
982
1276
|
model_path = ""
|
|
@@ -1126,6 +1420,9 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
|
|
|
1126
1420
|
# Since the Civitai API is broken, I will temporarily sort by name.
|
|
1127
1421
|
sorted_repos = sorted(data["items"], key=lambda x: x["name"], reverse=True)
|
|
1128
1422
|
|
|
1423
|
+
# Collect all valid candidates instead of selecting one
|
|
1424
|
+
all_candidates = []
|
|
1425
|
+
|
|
1129
1426
|
for selected_repo in sorted_repos:
|
|
1130
1427
|
repo_name = selected_repo["name"]
|
|
1131
1428
|
repo_id = selected_repo["id"]
|
|
@@ -1148,9 +1445,7 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
|
|
|
1148
1445
|
if (
|
|
1149
1446
|
model_data["pickleScanResult"] == "Success"
|
|
1150
1447
|
and model_data["virusScanResult"] == "Success"
|
|
1151
|
-
and any(file_name.endswith(ext) for ext in
|
|
1152
|
-
and os.path.basename(os.path.dirname(file_name))
|
|
1153
|
-
not in DIFFUSERS_CONFIG_DIR
|
|
1448
|
+
and any(file_name.endswith(ext) for ext in allowed_extensions)
|
|
1154
1449
|
):
|
|
1155
1450
|
file_status = {
|
|
1156
1451
|
"filename": file_name,
|
|
@@ -1175,65 +1470,69 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
|
|
|
1175
1470
|
sorted_models[0],
|
|
1176
1471
|
)
|
|
1177
1472
|
|
|
1178
|
-
#
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
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:
|
|
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:
|
|
1209
1487
|
if skip_error:
|
|
1210
1488
|
return None
|
|
1211
1489
|
else:
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
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
|
+
|
|
1217
1513
|
file_name = selected_model["filename"]
|
|
1218
1514
|
download_url = selected_model["download_url"]
|
|
1219
1515
|
|
|
1220
1516
|
# Handle file download and setting model information
|
|
1221
1517
|
if download:
|
|
1222
|
-
# Try downloading from
|
|
1518
|
+
# Try downloading from all candidates recursively
|
|
1223
1519
|
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
|
-
)
|
|
1228
1520
|
|
|
1229
|
-
|
|
1521
|
+
logger.info(f"Attempting to download from {len(all_candidates)} candidate(s)...")
|
|
1522
|
+
|
|
1523
|
+
for idx, candidate in enumerate(all_candidates):
|
|
1230
1524
|
try:
|
|
1231
|
-
|
|
1232
|
-
|
|
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']
|
|
1233
1530
|
|
|
1234
|
-
|
|
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
|
|
1235
1534
|
model_path = os.path.join(
|
|
1236
|
-
str(civitai_cache_dir), str(
|
|
1535
|
+
str(civitai_cache_dir), str(candidate_repo_id), str(candidate_version_id), str(file_name)
|
|
1237
1536
|
)
|
|
1238
1537
|
|
|
1239
1538
|
# Download Model File
|
|
@@ -1246,22 +1545,44 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
|
|
|
1246
1545
|
headers=headers,
|
|
1247
1546
|
**kwargs,
|
|
1248
1547
|
)
|
|
1548
|
+
|
|
1549
|
+
# Update selected metadata on success
|
|
1249
1550
|
download_success = True
|
|
1250
|
-
|
|
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}")
|
|
1251
1560
|
break
|
|
1561
|
+
|
|
1252
1562
|
except requests.HTTPError as e:
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
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
|
|
1259
1569
|
|
|
1260
1570
|
if not download_success:
|
|
1261
1571
|
if skip_error:
|
|
1262
1572
|
return None
|
|
1263
1573
|
else:
|
|
1264
|
-
|
|
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)
|
|
1265
1586
|
|
|
1266
1587
|
else:
|
|
1267
1588
|
model_path = download_url
|
{auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1/src/auto_diffusers.egg-info}/PKG-INFO
RENAMED
|
@@ -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.dev1
|
|
4
4
|
Summary: diffusers with search engine
|
|
5
5
|
Home-page: https://github.com/suzukimain/auto_diffusers
|
|
6
6
|
Author: suzukimain
|
|
@@ -80,6 +80,15 @@ 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)
|
|
83
92
|
## How to use<a name = "How_to_use"></a>
|
|
84
93
|
|
|
85
94
|
```python
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/src/auto_diffusers.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/src/auto_diffusers.egg-info/requires.txt
RENAMED
|
File without changes
|
{auto_diffusers-2.0.36.dev0 → auto_diffusers-2.0.36.dev1}/src/auto_diffusers.egg-info/top_level.txt
RENAMED
|
File without changes
|