auto-diffusers 2.0.13__py3-none-any.whl → 2.0.14__py3-none-any.whl
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/pipeline_easy.py +77 -101
- auto_diffusers-2.0.14.dist-info/METADATA +180 -0
- auto_diffusers-2.0.14.dist-info/RECORD +8 -0
- auto_diffusers-2.0.13.dist-info/METADATA +0 -211
- auto_diffusers-2.0.13.dist-info/RECORD +0 -8
- {auto_diffusers-2.0.13.dist-info → auto_diffusers-2.0.14.dist-info}/LICENSE +0 -0
- {auto_diffusers-2.0.13.dist-info → auto_diffusers-2.0.14.dist-info}/WHEEL +0 -0
- {auto_diffusers-2.0.13.dist-info → auto_diffusers-2.0.14.dist-info}/top_level.txt +0 -0
auto_diffusers/pipeline_easy.py
CHANGED
|
@@ -15,39 +15,32 @@
|
|
|
15
15
|
|
|
16
16
|
import os
|
|
17
17
|
import re
|
|
18
|
-
import requests
|
|
19
|
-
from tqdm.auto import tqdm
|
|
20
|
-
from typing import Union
|
|
21
18
|
from collections import OrderedDict
|
|
22
|
-
from dataclasses import
|
|
23
|
-
|
|
24
|
-
asdict
|
|
25
|
-
)
|
|
19
|
+
from dataclasses import asdict, dataclass
|
|
20
|
+
from typing import Union
|
|
26
21
|
|
|
22
|
+
import requests
|
|
23
|
+
from huggingface_hub import hf_api, hf_hub_download
|
|
27
24
|
from huggingface_hub.file_download import http_get
|
|
28
25
|
from huggingface_hub.utils import validate_hf_hub_args
|
|
29
|
-
from huggingface_hub import (
|
|
30
|
-
hf_api,
|
|
31
|
-
hf_hub_download,
|
|
32
|
-
)
|
|
33
26
|
|
|
34
|
-
from diffusers.utils import logging
|
|
35
27
|
from diffusers.loaders.single_file_utils import (
|
|
28
|
+
VALID_URL_PREFIXES,
|
|
29
|
+
_extract_repo_id_and_weights_name,
|
|
36
30
|
infer_diffusers_model_type,
|
|
37
31
|
load_single_file_checkpoint,
|
|
38
|
-
_extract_repo_id_and_weights_name,
|
|
39
|
-
VALID_URL_PREFIXES,
|
|
40
32
|
)
|
|
41
33
|
from diffusers.pipelines.auto_pipeline import (
|
|
42
|
-
AutoPipelineForText2Image,
|
|
43
34
|
AutoPipelineForImage2Image,
|
|
44
35
|
AutoPipelineForInpainting,
|
|
36
|
+
AutoPipelineForText2Image,
|
|
45
37
|
)
|
|
46
38
|
from diffusers.pipelines.controlnet import (
|
|
47
39
|
StableDiffusionControlNetImg2ImgPipeline,
|
|
48
40
|
StableDiffusionControlNetInpaintPipeline,
|
|
49
41
|
StableDiffusionControlNetPipeline,
|
|
50
42
|
)
|
|
43
|
+
from diffusers.pipelines.pipeline_utils import DiffusionPipeline
|
|
51
44
|
from diffusers.pipelines.stable_diffusion import (
|
|
52
45
|
StableDiffusionImg2ImgPipeline,
|
|
53
46
|
StableDiffusionInpaintPipeline,
|
|
@@ -58,7 +51,8 @@ from diffusers.pipelines.stable_diffusion_xl import (
|
|
|
58
51
|
StableDiffusionXLInpaintPipeline,
|
|
59
52
|
StableDiffusionXLPipeline,
|
|
60
53
|
)
|
|
61
|
-
from diffusers.
|
|
54
|
+
from diffusers.utils import logging
|
|
55
|
+
|
|
62
56
|
|
|
63
57
|
logger = logging.get_logger(__name__)
|
|
64
58
|
|
|
@@ -130,10 +124,11 @@ INPAINT_PIPELINE_KEYS = [
|
|
|
130
124
|
"inpainting_v2",
|
|
131
125
|
]
|
|
132
126
|
|
|
133
|
-
EXTENSION =
|
|
127
|
+
EXTENSION = [".safetensors", ".ckpt", ".bin"]
|
|
134
128
|
|
|
135
129
|
CACHE_HOME = os.path.expanduser("~/.cache")
|
|
136
130
|
|
|
131
|
+
|
|
137
132
|
@dataclass
|
|
138
133
|
class RepoStatus:
|
|
139
134
|
r"""
|
|
@@ -147,10 +142,12 @@ class RepoStatus:
|
|
|
147
142
|
version (`str`):
|
|
148
143
|
The version ID of the repository.
|
|
149
144
|
"""
|
|
145
|
+
|
|
150
146
|
repo_id: str = ""
|
|
151
147
|
repo_hash: str = ""
|
|
152
148
|
version: str = ""
|
|
153
149
|
|
|
150
|
+
|
|
154
151
|
@dataclass
|
|
155
152
|
class ModelStatus:
|
|
156
153
|
r"""
|
|
@@ -166,11 +163,13 @@ class ModelStatus:
|
|
|
166
163
|
local (`bool`):
|
|
167
164
|
Whether the model exists locally
|
|
168
165
|
"""
|
|
166
|
+
|
|
169
167
|
search_word: str = ""
|
|
170
168
|
download_url: str = ""
|
|
171
169
|
file_name: str = ""
|
|
172
170
|
local: bool = False
|
|
173
171
|
|
|
172
|
+
|
|
174
173
|
@dataclass
|
|
175
174
|
class SearchResult:
|
|
176
175
|
r"""
|
|
@@ -188,8 +187,9 @@ class SearchResult:
|
|
|
188
187
|
model_status (`ModelStatus`):
|
|
189
188
|
The status of the model.
|
|
190
189
|
"""
|
|
190
|
+
|
|
191
191
|
model_path: str = ""
|
|
192
|
-
loading_method: Union[str, None] = None
|
|
192
|
+
loading_method: Union[str, None] = None
|
|
193
193
|
checkpoint_format: Union[str, None] = None
|
|
194
194
|
repo_status: RepoStatus = RepoStatus()
|
|
195
195
|
model_status: ModelStatus = ModelStatus()
|
|
@@ -282,7 +282,7 @@ def get_keyword_types(keyword):
|
|
|
282
282
|
`dict`: A dictionary containing the model format, loading method,
|
|
283
283
|
and various types and extra types flags.
|
|
284
284
|
"""
|
|
285
|
-
|
|
285
|
+
|
|
286
286
|
# Initialize the status dictionary with default values
|
|
287
287
|
status = {
|
|
288
288
|
"checkpoint_format": None,
|
|
@@ -299,16 +299,16 @@ def get_keyword_types(keyword):
|
|
|
299
299
|
"missing_model_index": None,
|
|
300
300
|
},
|
|
301
301
|
}
|
|
302
|
-
|
|
302
|
+
|
|
303
303
|
# Check if the keyword is an HTTP or HTTPS URL
|
|
304
304
|
status["extra_type"]["url"] = bool(re.search(r"^(https?)://", keyword))
|
|
305
|
-
|
|
305
|
+
|
|
306
306
|
# Check if the keyword is a file
|
|
307
307
|
if os.path.isfile(keyword):
|
|
308
308
|
status["type"]["local"] = True
|
|
309
309
|
status["checkpoint_format"] = "single_file"
|
|
310
310
|
status["loading_method"] = "from_single_file"
|
|
311
|
-
|
|
311
|
+
|
|
312
312
|
# Check if the keyword is a directory
|
|
313
313
|
elif os.path.isdir(keyword):
|
|
314
314
|
status["type"]["local"] = True
|
|
@@ -316,13 +316,13 @@ def get_keyword_types(keyword):
|
|
|
316
316
|
status["loading_method"] = "from_pretrained"
|
|
317
317
|
if not os.path.exists(os.path.join(keyword, "model_index.json")):
|
|
318
318
|
status["extra_type"]["missing_model_index"] = True
|
|
319
|
-
|
|
319
|
+
|
|
320
320
|
# Check if the keyword is a Civitai URL
|
|
321
321
|
elif keyword.startswith("https://civitai.com/"):
|
|
322
322
|
status["type"]["civitai_url"] = True
|
|
323
323
|
status["checkpoint_format"] = "single_file"
|
|
324
324
|
status["loading_method"] = None
|
|
325
|
-
|
|
325
|
+
|
|
326
326
|
# Check if the keyword starts with any valid URL prefixes
|
|
327
327
|
elif any(keyword.startswith(prefix) for prefix in VALID_URL_PREFIXES):
|
|
328
328
|
repo_id, weights_name = _extract_repo_id_and_weights_name(keyword)
|
|
@@ -334,27 +334,27 @@ def get_keyword_types(keyword):
|
|
|
334
334
|
status["type"]["hf_repo"] = True
|
|
335
335
|
status["checkpoint_format"] = "diffusers"
|
|
336
336
|
status["loading_method"] = "from_pretrained"
|
|
337
|
-
|
|
337
|
+
|
|
338
338
|
# Check if the keyword matches a Hugging Face repository format
|
|
339
339
|
elif re.match(r"^[^/]+/[^/]+$", keyword):
|
|
340
340
|
status["type"]["hf_repo"] = True
|
|
341
341
|
status["checkpoint_format"] = "diffusers"
|
|
342
342
|
status["loading_method"] = "from_pretrained"
|
|
343
|
-
|
|
343
|
+
|
|
344
344
|
# If none of the above apply
|
|
345
345
|
else:
|
|
346
346
|
status["type"]["other"] = True
|
|
347
347
|
status["checkpoint_format"] = None
|
|
348
348
|
status["loading_method"] = None
|
|
349
|
-
|
|
349
|
+
|
|
350
350
|
return status
|
|
351
351
|
|
|
352
352
|
|
|
353
353
|
def file_downloader(
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
354
|
+
url,
|
|
355
|
+
save_path,
|
|
356
|
+
**kwargs,
|
|
357
|
+
) -> None:
|
|
358
358
|
"""
|
|
359
359
|
Downloads a file from a given URL and saves it to the specified path.
|
|
360
360
|
|
|
@@ -374,7 +374,7 @@ def file_downloader(
|
|
|
374
374
|
displayed_filename (`str`, *optional*):
|
|
375
375
|
The filename of the file that is being downloaded. Value is used only to display a nice progress bar. If
|
|
376
376
|
not set, the filename is guessed from the URL or the `Content-Disposition` header.
|
|
377
|
-
|
|
377
|
+
|
|
378
378
|
returns:
|
|
379
379
|
None
|
|
380
380
|
"""
|
|
@@ -499,7 +499,7 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
|
|
|
499
499
|
pipeline_tag=pipeline_tag,
|
|
500
500
|
full=True,
|
|
501
501
|
gated=gated,
|
|
502
|
-
token=token
|
|
502
|
+
token=token,
|
|
503
503
|
)
|
|
504
504
|
model_dicts = [asdict(value) for value in list(hf_models)]
|
|
505
505
|
|
|
@@ -514,25 +514,19 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
|
|
|
514
514
|
for repo_info in model_dicts:
|
|
515
515
|
repo_id = repo_info["id"]
|
|
516
516
|
file_list = []
|
|
517
|
-
hf_repo_info = hf_api.model_info(
|
|
518
|
-
repo_id=repo_id,
|
|
519
|
-
securityStatus=True
|
|
520
|
-
)
|
|
517
|
+
hf_repo_info = hf_api.model_info(repo_id=repo_id, securityStatus=True)
|
|
521
518
|
# Lists files with security issues.
|
|
522
519
|
hf_security_info = hf_repo_info.security_repo_status
|
|
523
|
-
exclusion = [issue[
|
|
520
|
+
exclusion = [issue["path"] for issue in hf_security_info["filesWithIssues"]]
|
|
524
521
|
|
|
525
522
|
# Checks for multi-folder diffusers model or valid files (models with security issues are excluded).
|
|
526
523
|
if hf_security_info["scansDone"]:
|
|
527
524
|
for info in repo_info["siblings"]:
|
|
528
525
|
file_path = info["rfilename"]
|
|
529
|
-
if
|
|
530
|
-
"model_index.json" == file_path
|
|
531
|
-
and checkpoint_format in ["diffusers", "all"]
|
|
532
|
-
):
|
|
526
|
+
if "model_index.json" == file_path and checkpoint_format in ["diffusers", "all"]:
|
|
533
527
|
diffusers_model_exists = True
|
|
534
528
|
break
|
|
535
|
-
|
|
529
|
+
|
|
536
530
|
elif (
|
|
537
531
|
any(file_path.endswith(ext) for ext in EXTENSION)
|
|
538
532
|
and not any(config in file_path for config in CONFIG_FILE_LIST)
|
|
@@ -540,7 +534,7 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
|
|
|
540
534
|
and os.path.basename(os.path.dirname(file_path)) not in DIFFUSERS_CONFIG_DIR
|
|
541
535
|
):
|
|
542
536
|
file_list.append(file_path)
|
|
543
|
-
|
|
537
|
+
|
|
544
538
|
# Exit from the loop if a multi-folder diffusers model or valid file is found
|
|
545
539
|
if diffusers_model_exists or file_list:
|
|
546
540
|
break
|
|
@@ -560,18 +554,13 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
|
|
|
560
554
|
)
|
|
561
555
|
else:
|
|
562
556
|
model_path = repo_id
|
|
563
|
-
|
|
557
|
+
|
|
564
558
|
elif file_list:
|
|
565
559
|
# Sort and find the safest model
|
|
566
560
|
file_name = next(
|
|
567
|
-
(
|
|
568
|
-
|
|
569
|
-
for model in sorted(file_list, reverse=True)
|
|
570
|
-
if re.search(r"(?i)[-_](safe|sfw)", model)
|
|
571
|
-
),
|
|
572
|
-
file_list[0]
|
|
561
|
+
(model for model in sorted(file_list, reverse=True) if re.search(r"(?i)[-_](safe|sfw)", model)),
|
|
562
|
+
file_list[0],
|
|
573
563
|
)
|
|
574
|
-
|
|
575
564
|
|
|
576
565
|
if download:
|
|
577
566
|
model_path = hf_hub_download(
|
|
@@ -581,12 +570,12 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
|
|
|
581
570
|
token=token,
|
|
582
571
|
force_download=force_download,
|
|
583
572
|
)
|
|
584
|
-
|
|
573
|
+
|
|
585
574
|
if file_name:
|
|
586
575
|
download_url = f"https://huggingface.co/{repo_id}/blob/main/{file_name}"
|
|
587
576
|
else:
|
|
588
577
|
download_url = f"https://huggingface.co/{repo_id}"
|
|
589
|
-
|
|
578
|
+
|
|
590
579
|
output_info = get_keyword_types(model_path)
|
|
591
580
|
|
|
592
581
|
if include_params:
|
|
@@ -594,22 +583,18 @@ def search_huggingface(search_word: str, **kwargs) -> Union[str, SearchResult, N
|
|
|
594
583
|
model_path=model_path or download_url,
|
|
595
584
|
loading_method=output_info["loading_method"],
|
|
596
585
|
checkpoint_format=output_info["checkpoint_format"],
|
|
597
|
-
repo_status=RepoStatus(
|
|
598
|
-
repo_id=repo_id,
|
|
599
|
-
repo_hash=hf_repo_info.sha,
|
|
600
|
-
version=revision
|
|
601
|
-
),
|
|
586
|
+
repo_status=RepoStatus(repo_id=repo_id, repo_hash=hf_repo_info.sha, version=revision),
|
|
602
587
|
model_status=ModelStatus(
|
|
603
588
|
search_word=search_word,
|
|
604
589
|
download_url=download_url,
|
|
605
590
|
file_name=file_name,
|
|
606
591
|
local=download,
|
|
607
|
-
)
|
|
592
|
+
),
|
|
608
593
|
)
|
|
609
|
-
|
|
594
|
+
|
|
610
595
|
else:
|
|
611
596
|
return model_path
|
|
612
|
-
|
|
597
|
+
|
|
613
598
|
|
|
614
599
|
def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]:
|
|
615
600
|
r"""
|
|
@@ -679,9 +664,7 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
|
|
|
679
664
|
|
|
680
665
|
try:
|
|
681
666
|
# Make the request to the CivitAI API
|
|
682
|
-
response = requests.get(
|
|
683
|
-
"https://civitai.com/api/v1/models", params=params, headers=headers
|
|
684
|
-
)
|
|
667
|
+
response = requests.get("https://civitai.com/api/v1/models", params=params, headers=headers)
|
|
685
668
|
response.raise_for_status()
|
|
686
669
|
except requests.exceptions.HTTPError as err:
|
|
687
670
|
raise requests.HTTPError(f"Could not get elements from the URL: {err}")
|
|
@@ -693,7 +676,7 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
|
|
|
693
676
|
return None
|
|
694
677
|
else:
|
|
695
678
|
raise ValueError("Invalid JSON response")
|
|
696
|
-
|
|
679
|
+
|
|
697
680
|
# Sort repositories by download count in descending order
|
|
698
681
|
sorted_repos = sorted(data["items"], key=lambda x: x["stats"]["downloadCount"], reverse=True)
|
|
699
682
|
|
|
@@ -702,7 +685,9 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
|
|
|
702
685
|
repo_id = selected_repo["id"]
|
|
703
686
|
|
|
704
687
|
# Sort versions within the selected repo by download count
|
|
705
|
-
sorted_versions = sorted(
|
|
688
|
+
sorted_versions = sorted(
|
|
689
|
+
selected_repo["modelVersions"], key=lambda x: x["stats"]["downloadCount"], reverse=True
|
|
690
|
+
)
|
|
706
691
|
for selected_version in sorted_versions:
|
|
707
692
|
version_id = selected_version["id"]
|
|
708
693
|
models_list = []
|
|
@@ -730,21 +715,21 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
|
|
|
730
715
|
for model_data in sorted_models
|
|
731
716
|
if bool(re.search(r"(?i)[-_](safe|sfw)", model_data["filename"]))
|
|
732
717
|
),
|
|
733
|
-
sorted_models[0]
|
|
718
|
+
sorted_models[0],
|
|
734
719
|
)
|
|
735
720
|
|
|
736
721
|
break
|
|
737
722
|
else:
|
|
738
723
|
continue
|
|
739
724
|
break
|
|
740
|
-
|
|
725
|
+
|
|
741
726
|
# Exception handling when search candidates are not found
|
|
742
727
|
if not selected_model:
|
|
743
728
|
if skip_error:
|
|
744
729
|
return None
|
|
745
730
|
else:
|
|
746
731
|
raise ValueError("No model found. Please try changing the word you are searching for.")
|
|
747
|
-
|
|
732
|
+
|
|
748
733
|
# Define model file status
|
|
749
734
|
file_name = selected_model["filename"]
|
|
750
735
|
download_url = selected_model["download_url"]
|
|
@@ -752,9 +737,7 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
|
|
|
752
737
|
# Handle file download and setting model information
|
|
753
738
|
if download:
|
|
754
739
|
# The path where the model is to be saved.
|
|
755
|
-
model_path = os.path.join(
|
|
756
|
-
str(civitai_cache_dir), str(repo_id), str(version_id), str(file_name)
|
|
757
|
-
)
|
|
740
|
+
model_path = os.path.join(str(civitai_cache_dir), str(repo_id), str(version_id), str(file_name))
|
|
758
741
|
# Download Model File
|
|
759
742
|
file_downloader(
|
|
760
743
|
url=download_url,
|
|
@@ -778,17 +761,13 @@ def search_civitai(search_word: str, **kwargs) -> Union[str, SearchResult, None]
|
|
|
778
761
|
model_path=model_path,
|
|
779
762
|
loading_method=output_info["loading_method"],
|
|
780
763
|
checkpoint_format=output_info["checkpoint_format"],
|
|
781
|
-
repo_status=RepoStatus(
|
|
782
|
-
repo_id=repo_name,
|
|
783
|
-
repo_hash=repo_id,
|
|
784
|
-
version=version_id
|
|
785
|
-
),
|
|
764
|
+
repo_status=RepoStatus(repo_id=repo_name, repo_hash=repo_id, version=version_id),
|
|
786
765
|
model_status=ModelStatus(
|
|
787
766
|
search_word=search_word,
|
|
788
767
|
download_url=download_url,
|
|
789
768
|
file_name=file_name,
|
|
790
|
-
local=output_info["type"]["local"]
|
|
791
|
-
)
|
|
769
|
+
local=output_info["type"]["local"],
|
|
770
|
+
),
|
|
792
771
|
)
|
|
793
772
|
|
|
794
773
|
|
|
@@ -814,7 +793,6 @@ class EasyPipelineForText2Image(AutoPipelineForText2Image):
|
|
|
814
793
|
# EnvironmentError is returned
|
|
815
794
|
super().__init__()
|
|
816
795
|
|
|
817
|
-
|
|
818
796
|
@classmethod
|
|
819
797
|
@validate_hf_hub_args
|
|
820
798
|
def from_huggingface(cls, pretrained_model_link_or_path, **kwargs):
|
|
@@ -929,21 +907,21 @@ class EasyPipelineForText2Image(AutoPipelineForText2Image):
|
|
|
929
907
|
kwargs.update(_status)
|
|
930
908
|
|
|
931
909
|
# Search for the model on Hugging Face and get the model status
|
|
932
|
-
hf_model_status = search_huggingface(pretrained_model_link_or_path, **kwargs)
|
|
910
|
+
hf_model_status = search_huggingface(pretrained_model_link_or_path, **kwargs)
|
|
933
911
|
logger.warning(f"checkpoint_path: {hf_model_status.model_status.download_url}")
|
|
934
912
|
checkpoint_path = hf_model_status.model_path
|
|
935
|
-
|
|
913
|
+
|
|
936
914
|
# Check the format of the model checkpoint
|
|
937
915
|
if hf_model_status.checkpoint_format == "single_file":
|
|
938
916
|
# Load the pipeline from a single file checkpoint
|
|
939
917
|
return load_pipeline_from_single_file(
|
|
940
918
|
pretrained_model_or_path=checkpoint_path,
|
|
941
919
|
pipeline_mapping=SINGLE_FILE_CHECKPOINT_TEXT2IMAGE_PIPELINE_MAPPING,
|
|
942
|
-
**kwargs
|
|
920
|
+
**kwargs,
|
|
943
921
|
)
|
|
944
922
|
else:
|
|
945
923
|
return cls.from_pretrained(checkpoint_path, **kwargs)
|
|
946
|
-
|
|
924
|
+
|
|
947
925
|
@classmethod
|
|
948
926
|
def from_civitai(cls, pretrained_model_link_or_path, **kwargs):
|
|
949
927
|
r"""
|
|
@@ -1045,9 +1023,8 @@ class EasyPipelineForText2Image(AutoPipelineForText2Image):
|
|
|
1045
1023
|
return load_pipeline_from_single_file(
|
|
1046
1024
|
pretrained_model_or_path=checkpoint_path,
|
|
1047
1025
|
pipeline_mapping=SINGLE_FILE_CHECKPOINT_TEXT2IMAGE_PIPELINE_MAPPING,
|
|
1048
|
-
**kwargs
|
|
1026
|
+
**kwargs,
|
|
1049
1027
|
)
|
|
1050
|
-
|
|
1051
1028
|
|
|
1052
1029
|
|
|
1053
1030
|
class EasyPipelineForImage2Image(AutoPipelineForImage2Image):
|
|
@@ -1071,7 +1048,7 @@ class EasyPipelineForImage2Image(AutoPipelineForImage2Image):
|
|
|
1071
1048
|
def __init__(self, *args, **kwargs):
|
|
1072
1049
|
# EnvironmentError is returned
|
|
1073
1050
|
super().__init__()
|
|
1074
|
-
|
|
1051
|
+
|
|
1075
1052
|
@classmethod
|
|
1076
1053
|
@validate_hf_hub_args
|
|
1077
1054
|
def from_huggingface(cls, pretrained_model_link_or_path, **kwargs):
|
|
@@ -1186,21 +1163,21 @@ class EasyPipelineForImage2Image(AutoPipelineForImage2Image):
|
|
|
1186
1163
|
kwargs.update(_parmas)
|
|
1187
1164
|
|
|
1188
1165
|
# Search for the model on Hugging Face and get the model status
|
|
1189
|
-
model_status = search_huggingface(pretrained_model_link_or_path, **kwargs)
|
|
1166
|
+
model_status = search_huggingface(pretrained_model_link_or_path, **kwargs)
|
|
1190
1167
|
logger.warning(f"checkpoint_path: {model_status.model_status.download_url}")
|
|
1191
1168
|
checkpoint_path = model_status.model_path
|
|
1192
|
-
|
|
1169
|
+
|
|
1193
1170
|
# Check the format of the model checkpoint
|
|
1194
1171
|
if model_status.checkpoint_format == "single_file":
|
|
1195
1172
|
# Load the pipeline from a single file checkpoint
|
|
1196
1173
|
return load_pipeline_from_single_file(
|
|
1197
1174
|
pretrained_model_or_path=checkpoint_path,
|
|
1198
1175
|
pipeline_mapping=SINGLE_FILE_CHECKPOINT_IMAGE2IMAGE_PIPELINE_MAPPING,
|
|
1199
|
-
**kwargs
|
|
1176
|
+
**kwargs,
|
|
1200
1177
|
)
|
|
1201
1178
|
else:
|
|
1202
1179
|
return cls.from_pretrained(checkpoint_path, **kwargs)
|
|
1203
|
-
|
|
1180
|
+
|
|
1204
1181
|
@classmethod
|
|
1205
1182
|
def from_civitai(cls, pretrained_model_link_or_path, **kwargs):
|
|
1206
1183
|
r"""
|
|
@@ -1302,10 +1279,9 @@ class EasyPipelineForImage2Image(AutoPipelineForImage2Image):
|
|
|
1302
1279
|
return load_pipeline_from_single_file(
|
|
1303
1280
|
pretrained_model_or_path=checkpoint_path,
|
|
1304
1281
|
pipeline_mapping=SINGLE_FILE_CHECKPOINT_IMAGE2IMAGE_PIPELINE_MAPPING,
|
|
1305
|
-
**kwargs
|
|
1282
|
+
**kwargs,
|
|
1306
1283
|
)
|
|
1307
1284
|
|
|
1308
|
-
|
|
1309
1285
|
|
|
1310
1286
|
class EasyPipelineForInpainting(AutoPipelineForInpainting):
|
|
1311
1287
|
r"""
|
|
@@ -1328,7 +1304,7 @@ class EasyPipelineForInpainting(AutoPipelineForInpainting):
|
|
|
1328
1304
|
def __init__(self, *args, **kwargs):
|
|
1329
1305
|
# EnvironmentError is returned
|
|
1330
1306
|
super().__init__()
|
|
1331
|
-
|
|
1307
|
+
|
|
1332
1308
|
@classmethod
|
|
1333
1309
|
@validate_hf_hub_args
|
|
1334
1310
|
def from_huggingface(cls, pretrained_model_link_or_path, **kwargs):
|
|
@@ -1443,21 +1419,21 @@ class EasyPipelineForInpainting(AutoPipelineForInpainting):
|
|
|
1443
1419
|
kwargs.update(_status)
|
|
1444
1420
|
|
|
1445
1421
|
# Search for the model on Hugging Face and get the model status
|
|
1446
|
-
model_status = search_huggingface(pretrained_model_link_or_path, **kwargs)
|
|
1422
|
+
model_status = search_huggingface(pretrained_model_link_or_path, **kwargs)
|
|
1447
1423
|
logger.warning(f"checkpoint_path: {model_status.model_status.download_url}")
|
|
1448
1424
|
checkpoint_path = model_status.model_path
|
|
1449
|
-
|
|
1425
|
+
|
|
1450
1426
|
# Check the format of the model checkpoint
|
|
1451
1427
|
if model_status.checkpoint_format == "single_file":
|
|
1452
1428
|
# Load the pipeline from a single file checkpoint
|
|
1453
1429
|
return load_pipeline_from_single_file(
|
|
1454
1430
|
pretrained_model_or_path=checkpoint_path,
|
|
1455
1431
|
pipeline_mapping=SINGLE_FILE_CHECKPOINT_INPAINT_PIPELINE_MAPPING,
|
|
1456
|
-
**kwargs
|
|
1432
|
+
**kwargs,
|
|
1457
1433
|
)
|
|
1458
1434
|
else:
|
|
1459
1435
|
return cls.from_pretrained(checkpoint_path, **kwargs)
|
|
1460
|
-
|
|
1436
|
+
|
|
1461
1437
|
@classmethod
|
|
1462
1438
|
def from_civitai(cls, pretrained_model_link_or_path, **kwargs):
|
|
1463
1439
|
r"""
|
|
@@ -1559,5 +1535,5 @@ class EasyPipelineForInpainting(AutoPipelineForInpainting):
|
|
|
1559
1535
|
return load_pipeline_from_single_file(
|
|
1560
1536
|
pretrained_model_or_path=checkpoint_path,
|
|
1561
1537
|
pipeline_mapping=SINGLE_FILE_CHECKPOINT_INPAINT_PIPELINE_MAPPING,
|
|
1562
|
-
**kwargs
|
|
1563
|
-
)
|
|
1538
|
+
**kwargs,
|
|
1539
|
+
)
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: auto_diffusers
|
|
3
|
+
Version: 2.0.14
|
|
4
|
+
Summary: Customized diffusers with model search and other functions.
|
|
5
|
+
Home-page: https://github.com/suzukimain/auto_diffusers
|
|
6
|
+
Author: suzukimain
|
|
7
|
+
Author-email: subarucosmosmain@gmail.com
|
|
8
|
+
License: Apache 2.0 License
|
|
9
|
+
Keywords: huggingface civitai diffusers model search deep learning diffusion pytorch stable diffusion
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Education
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: torch
|
|
24
|
+
Requires-Dist: diffusers
|
|
25
|
+
Requires-Dist: huggingface-hub>=0.26.2
|
|
26
|
+
|
|
27
|
+
# auto_diffusers
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
<p>
|
|
31
|
+
<a href="https://github.com/suzukimain/auto_diffusers/blob/main/LICENSE"><img alt="GitHub release" src="https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=social"></a>
|
|
32
|
+
</p>
|
|
33
|
+
<p>
|
|
34
|
+
<a href="https://pepy.tech/project/auto_diffusers"><img alt="GitHub release" src="https://static.pepy.tech/badge/auto_diffusers"></a>
|
|
35
|
+
<a href="https://github.com/suzukimain/auto_diffusers/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/suzukimain/auto_diffusers.svg"></a>
|
|
36
|
+
<img src="https://visitor-badge.laobi.icu/badge?page_id=suzukimain.auto_diffusers" alt="Visitor Badge">
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
>CONTENTS
|
|
41
|
+
+ [About The Project](#About_The_Project)
|
|
42
|
+
+ [How to use](#How_to_use)
|
|
43
|
+
+ [Search Hubs](#Search_Civitai_and_Huggingfacee)
|
|
44
|
+
- [Search Civitai](#Search_Civitai)
|
|
45
|
+
- [Search Huggingface](#Search_Huggingface)
|
|
46
|
+
+ [License](#License)
|
|
47
|
+
+ [Acknowledgement](#Acknowledgement)
|
|
48
|
+
|
|
49
|
+
## About The Project<a name = "About_The_Project"></a>
|
|
50
|
+
Enhance the functionality of diffusers.
|
|
51
|
+
* Search models from huggingface and Civitai.
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
## How to use<a name = "How_to_use"></a>
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
pip install --quiet auto_diffusers
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from auto_diffusers import EasyPipelineForText2Image
|
|
62
|
+
|
|
63
|
+
# Search for Huggingface
|
|
64
|
+
pipe = EasyPipelineForText2Image.from_huggingface("any").to("cuda")
|
|
65
|
+
img = pipe("cat").images[0]
|
|
66
|
+
img.save("cat.png")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# Search for Civitai
|
|
70
|
+
pipe = EasyPipelineForText2Image.from_civitai("any").to("cuda")
|
|
71
|
+
image = pipe("cat").images[0]
|
|
72
|
+
image.save("cat.png")
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Search Civitai and Huggingfacee<a name = "Search_Civitai_and_Huggingfacee"></a>
|
|
77
|
+
|
|
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
|
+
# Load Lora into the pipeline.
|
|
92
|
+
pipeline.load_lora_weights(Lora)
|
|
93
|
+
|
|
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
|
+
# Load TextualInversion into the pipeline.
|
|
103
|
+
pipeline.load_textual_inversion(TextualInversion, token="EasyNegative")
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Search Civitai<a name = "Search_Civitai"></a>
|
|
107
|
+
|
|
108
|
+
> [!TIP]
|
|
109
|
+
> **If an error occurs, insert the `token` and run again.**
|
|
110
|
+
|
|
111
|
+
#### `EasyPipeline.from_civitai` parameters
|
|
112
|
+
|
|
113
|
+
| Name | Type | Default | Description |
|
|
114
|
+
|:---------------:|:----------------------:|:-------------:|:-----------------------------------------------------------------------------------:|
|
|
115
|
+
| search_word | string, Path | ー | The search query string. Can be a keyword, Civitai URL, local directory or file path. |
|
|
116
|
+
| model_type | string | `Checkpoint` | The type of model to search for. <br>(for example `Checkpoint`, `TextualInversion`, `Controlnet`, `LORA`, `Hypernetwork`, `AestheticGradient`, `Poses`) |
|
|
117
|
+
| base_model | string | None | Trained model tag (for example `SD 1.5`, `SD 3.5`, `SDXL 1.0`) |
|
|
118
|
+
| torch_dtype | string, torch.dtype | None | Override the default `torch.dtype` and load the model with another dtype. |
|
|
119
|
+
| force_download | bool | False | Whether or not to force the (re-)download of the model weights and configuration files, overriding the cached versions if they exist. |
|
|
120
|
+
| cache_dir | string, Path | None | Path to the folder where cached files are stored. |
|
|
121
|
+
| resume | bool | False | Whether to resume an incomplete download. |
|
|
122
|
+
| token | string | None | API token for Civitai authentication. |
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
#### `search_civitai` parameters
|
|
126
|
+
|
|
127
|
+
| Name | Type | Default | Description |
|
|
128
|
+
|:---------------:|:--------------:|:-------------:|:-----------------------------------------------------------------------------------:|
|
|
129
|
+
| search_word | string, Path | ー | The search query string. Can be a keyword, Civitai URL, local directory or file path. |
|
|
130
|
+
| model_type | string | `Checkpoint` | The type of model to search for. <br>(for example `Checkpoint`, `TextualInversion`, `Controlnet`, `LORA`, `Hypernetwork`, `AestheticGradient`, `Poses`) |
|
|
131
|
+
| base_model | string | None | Trained model tag (for example `SD 1.5`, `SD 3.5`, `SDXL 1.0`) |
|
|
132
|
+
| download | bool | False | Whether to download the model. |
|
|
133
|
+
| force_download | bool | False | Whether to force the download if the model already exists. |
|
|
134
|
+
| cache_dir | string, Path | None | Path to the folder where cached files are stored. |
|
|
135
|
+
| resume | bool | False | Whether to resume an incomplete download. |
|
|
136
|
+
| token | string | None | API token for Civitai authentication. |
|
|
137
|
+
| include_params | bool | False | Whether to include parameters in the returned data. |
|
|
138
|
+
| skip_error | bool | False | Whether to skip errors and return None. |
|
|
139
|
+
|
|
140
|
+
### Search Huggingface<a name = "Search_Huggingface"></a>
|
|
141
|
+
|
|
142
|
+
> [!TIP]
|
|
143
|
+
> **If an error occurs, insert the `token` and run again.**
|
|
144
|
+
|
|
145
|
+
#### `EasyPipeline.from_huggingface` parameters
|
|
146
|
+
|
|
147
|
+
| Name | Type | Default | Description |
|
|
148
|
+
|:---------------------:|:-------------------:|:--------------:|:----------------------------------------------------------------:|
|
|
149
|
+
| search_word | string, Path | ー | The search query string. Can be a keyword, Hugging Face URL, local directory or file path, or a Hugging Face path (`<creator>/<repo>`). |
|
|
150
|
+
| checkpoint_format | string | `single_file` | The format of the model checkpoint.<br>● `single_file` to search for `single file checkpoint` <br>●`diffusers` to search for `multifolder diffusers format checkpoint` |
|
|
151
|
+
| torch_dtype | string, torch.dtype | None | Override the default `torch.dtype` and load the model with another dtype. |
|
|
152
|
+
| force_download | bool | False | Whether or not to force the (re-)download of the model weights and configuration files, overriding the cached versions if they exist. |
|
|
153
|
+
| cache_dir | string, Path | None | Path to a directory where a downloaded pretrained model configuration is cached if the standard cache is not used. |
|
|
154
|
+
| token | string, bool | None | The token to use as HTTP bearer authorization for remote files. |
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
#### `search_huggingface` parameters
|
|
158
|
+
|
|
159
|
+
| Name | Type | Default | Description |
|
|
160
|
+
|:---------------------:|:-------------------:|:--------------:|:----------------------------------------------------------------:|
|
|
161
|
+
| search_word | string, Path | ー | The search query string. Can be a keyword, Hugging Face URL, local directory or file path, or a Hugging Face path (`<creator>/<repo>`). |
|
|
162
|
+
| checkpoint_format | string | `single_file` | The format of the model checkpoint. <br>● `single_file` to search for `single file checkpoint` <br>●`diffusers` to search for `multifolder diffusers format checkpoint` |
|
|
163
|
+
| pipeline_tag | string | None | Tag to filter models by pipeline. |
|
|
164
|
+
| download | bool | False | Whether to download the model. |
|
|
165
|
+
| force_download | bool | False | Whether or not to force the (re-)download of the model weights and configuration files, overriding the cached versions if they exist. |
|
|
166
|
+
| cache_dir | string, Path | None | Path to a directory where a downloaded pretrained model configuration is cached if the standard cache is not used. |
|
|
167
|
+
| token | string, bool | None | The token to use as HTTP bearer authorization for remote files. |
|
|
168
|
+
| include_params | bool | False | Whether to include parameters in the returned data. |
|
|
169
|
+
| skip_error | bool | False | Whether to skip errors and return None. |
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
## License<a name = "License"></a>
|
|
173
|
+
In accordance with [Apache-2.0 license](https://github.com/suzukimain/auto_diffusers/blob/master/LICENSE)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
## Acknowledgement<a name = "Acknowledgement"></a>
|
|
177
|
+
|
|
178
|
+
I have used open source resources and free tools in the creation of this project.
|
|
179
|
+
|
|
180
|
+
I would like to take this opportunity to thank the open source community and those who provided free tools.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
auto_diffusers/__init__.py,sha256=2VKCeWUc38yM2JVLhR9oqSQMC6513XEWPuBzk2pdRrM,204
|
|
2
|
+
auto_diffusers/pipeline_easy.py,sha256=YzPPPy-uoQLa10O6DDK52361e5nAkLLunJ_zg0CDnq0,74664
|
|
3
|
+
auto_diffusers/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
+
auto_diffusers-2.0.14.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
|
+
auto_diffusers-2.0.14.dist-info/METADATA,sha256=4CltVO87O9PU_bQzfJkCKNYUmQhd_guPxhjP6VH1njA,10267
|
|
6
|
+
auto_diffusers-2.0.14.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
7
|
+
auto_diffusers-2.0.14.dist-info/top_level.txt,sha256=iYkbnc9T-VKVnoCP6AufdXcDUfUaLZ_yMG-USuYf4UQ,15
|
|
8
|
+
auto_diffusers-2.0.14.dist-info/RECORD,,
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: auto_diffusers
|
|
3
|
-
Version: 2.0.13
|
|
4
|
-
Summary: Customized diffusers with model search and other functions.
|
|
5
|
-
Home-page: https://github.com/suzukimain/auto_diffusers
|
|
6
|
-
Author: suzukimain
|
|
7
|
-
Author-email: subarucosmosmain@gmail.com
|
|
8
|
-
License: Apache 2.0 License
|
|
9
|
-
Keywords: huggingface civitai diffusers model search deep learning diffusion pytorch stable diffusion
|
|
10
|
-
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
-
Classifier: Intended Audience :: Developers
|
|
12
|
-
Classifier: Intended Audience :: Education
|
|
13
|
-
Classifier: Intended Audience :: Science/Research
|
|
14
|
-
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
-
Classifier: Programming Language :: Python :: 3
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
-
Description-Content-Type: text/markdown
|
|
22
|
-
License-File: LICENSE
|
|
23
|
-
Requires-Dist: torch
|
|
24
|
-
Requires-Dist: diffusers
|
|
25
|
-
Requires-Dist: huggingface-hub>=0.26.2
|
|
26
|
-
|
|
27
|
-
# auto_diffusers
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<p>
|
|
31
|
-
<a href="https://github.com/suzukimain/auto_diffusers/blob/main/LICENSE"><img alt="GitHub release" src="https://img.shields.io/badge/license-Apache%202.0-blue.svg?style=social"></a>
|
|
32
|
-
</p>
|
|
33
|
-
<p>
|
|
34
|
-
<a href="https://pepy.tech/project/auto_diffusers"><img alt="GitHub release" src="https://static.pepy.tech/badge/auto_diffusers"></a>
|
|
35
|
-
<a href="https://github.com/suzukimain/auto_diffusers/releases"><img alt="GitHub release" src="https://img.shields.io/github/release/suzukimain/auto_diffusers.svg"></a>
|
|
36
|
-
<img src="https://visitor-badge.laobi.icu/badge?page_id=suzukimain.auto_diffusers" alt="Visitor Badge">
|
|
37
|
-
</p>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
>CONTENTS
|
|
41
|
-
+ [About The Project](#About_The_Project)
|
|
42
|
-
+ [How to use](#How_to_use)
|
|
43
|
-
+ [Description](#Description)
|
|
44
|
-
+ [License](#License)
|
|
45
|
-
+ [Acknowledgement](#Acknowledgement)
|
|
46
|
-
|
|
47
|
-
## About The Project<a name = "About_The_Project"></a>
|
|
48
|
-
Enhance the functionality of diffusers.
|
|
49
|
-
* Search models from huggingface and Civitai.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
## How to use<a name = "How_to_use"></a>
|
|
53
|
-
|
|
54
|
-
```python
|
|
55
|
-
pip install --quiet auto_diffusers
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
```python
|
|
59
|
-
from auto_diffusers import EasyPipelineForText2Image
|
|
60
|
-
|
|
61
|
-
# Search for Huggingface
|
|
62
|
-
pipe = EasyPipelineForText2Image.from_huggingface("any").to("cuda")
|
|
63
|
-
img = pipe("cat").images[0]
|
|
64
|
-
img.save("cat.png")
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
# Search for Civitai
|
|
68
|
-
pipe = EasyPipelineForText2Image.from_civitai("any").to("cuda")
|
|
69
|
-
image = pipe("cat").images[0]
|
|
70
|
-
image.save("cat.png")
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
---
|
|
75
|
-
|
|
76
|
-
```python
|
|
77
|
-
from auto_diffusers import (
|
|
78
|
-
search_huggingface,
|
|
79
|
-
search_civitai,
|
|
80
|
-
)
|
|
81
|
-
|
|
82
|
-
# Search Lora
|
|
83
|
-
Lora = search_civitai(
|
|
84
|
-
"Keyword_to_search_Lora",
|
|
85
|
-
model_type="LORA",
|
|
86
|
-
base_model = "SD 1.5",
|
|
87
|
-
download=True,
|
|
88
|
-
)
|
|
89
|
-
# Load Lora into the pipeline.
|
|
90
|
-
pipeline.load_lora_weights(Lora)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
# Search TextualInversion
|
|
94
|
-
TextualInversion = search_civitai(
|
|
95
|
-
"EasyNegative",
|
|
96
|
-
model_type="TextualInversion",
|
|
97
|
-
base_model = "SD 1.5",
|
|
98
|
-
download=True
|
|
99
|
-
)
|
|
100
|
-
# Load TextualInversion into the pipeline.
|
|
101
|
-
pipeline.load_textual_inversion(TextualInversion, token="EasyNegative")
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
## Description<a name = "Description"></a>
|
|
106
|
-
> Arguments of `EasyPipeline.from_huggingface`
|
|
107
|
-
|
|
108
|
-
| Name | Type | Default | Input Available | Description |
|
|
109
|
-
|:---------------------:|:------------------------------:|:--------------:|:-----------------:|:--------------------------------------------------------------------------------------------------------------------:|
|
|
110
|
-
| pretrained_model_or_path | str or os.PathLike | ー | ー | Keywords to search models |
|
|
111
|
-
| checkpoint_format | string | "single_file" | `single_file`,<br>`diffusers`,<br>`all` | The format of the model checkpoint. |
|
|
112
|
-
| pipeline_tag | string | None | ー | Tag to filter models by pipeline. |
|
|
113
|
-
| torch_dtype | str or torch.dtype | None | ー | Override the default `torch.dtype` and load the model with another dtype. If "auto" is passed, the dtype is automatically derived from the model's weights. |
|
|
114
|
-
| force_download | bool | False | ー | Whether or not to force the (re-)download of the model weights and configuration files, overriding the cached versions if they exist. |
|
|
115
|
-
| cache_dir | str, os.PathLike | None | ー | Path to a directory where a downloaded pretrained model configuration is cached if the standard cache is not used. |
|
|
116
|
-
| token | str or bool | None | ー | The token to use as HTTP bearer authorization for remote files. |
|
|
117
|
-
|
|
118
|
-
<a id="model_format"></a>
|
|
119
|
-
<details open>
|
|
120
|
-
<summary>model_format</summary>
|
|
121
|
-
|
|
122
|
-
| Argument | Description |
|
|
123
|
-
| :--------------------------: | :--------------------------------------------------------------------: |
|
|
124
|
-
| single_file | Only `single file checkpoint` are searched. |
|
|
125
|
-
| diffusers | Search only for `multifolder diffusers format checkpoint |
|
|
126
|
-
|
|
127
|
-
</details>
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
<a id="Other_Arguments"></a>
|
|
131
|
-
<details close>
|
|
132
|
-
<summary>Other_Arguments</summary>
|
|
133
|
-
|
|
134
|
-
| Name | Type | Default | Input Available | Description |
|
|
135
|
-
|:---------------------:|:------------------------------:|:--------------:|:-----------------:|:--------------------------------------------------------------------------------------------------------------------:|
|
|
136
|
-
| proxies | Dict[str] | None | ー | A dictionary of proxy servers to use by protocol or endpoint. |
|
|
137
|
-
| output_loading_info | bool | False | ー | Whether or not to also return a dictionary containing missing keys, unexpected keys and error messages. |
|
|
138
|
-
| local_files_only | bool | False | ー | Whether to only load local model weights and configuration files or not. |
|
|
139
|
-
| revision | str | "main" | ー | The specific model version to use. |
|
|
140
|
-
| custom_revision | str | "main" | ー | The specific model version to use when loading a custom pipeline from the Hub or GitHub. |
|
|
141
|
-
| mirror | str | None | ー | Mirror source to resolve accessibility issues if you’re downloading a model in China. |
|
|
142
|
-
| device_map | str or Dict[str, Union[int, str, torch.device]] | None | ー | A map that specifies where each submodule should go. |
|
|
143
|
-
| max_memory | Dict | None | ー | A dictionary device identifier for the maximum memory. |
|
|
144
|
-
| offload_folder | str or os.PathLike | None | ー | The path to offload weights if device_map contains the value `"disk"`. |
|
|
145
|
-
| offload_state_dict | bool | True | ー | If `True`, temporarily offloads the CPU state dict to the hard drive to avoid running out of CPU RAM. |
|
|
146
|
-
| low_cpu_mem_usage | bool | Depends on torch version | ー | Speed up model loading only loading the pretrained weights and not initializing the weights. |
|
|
147
|
-
| use_safetensors | bool | None | ー | If set to `None`, the safetensors weights are downloaded if they're available and if the safetensors library is installed. |
|
|
148
|
-
| gated | bool | False | ー | A boolean to filter models on the Hub that are gated or not. |
|
|
149
|
-
| kwargs | dict | None | ー | Can be used to overwrite load and saveable variables. |
|
|
150
|
-
| variant | str | None | ー | Load weights from a specified variant filename such as `"fp16"` or `"ema"`. |
|
|
151
|
-
|
|
152
|
-
</details>
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
---
|
|
157
|
-
|
|
158
|
-
> [!TIP]
|
|
159
|
-
> **If an error occurs, insert the `token` and run again.**
|
|
160
|
-
|
|
161
|
-
> Arguments of `EasyPipeline.from_civitai`
|
|
162
|
-
|
|
163
|
-
| Name | Type | Default | Input Available | Description |
|
|
164
|
-
|:---------------:|:------:|:-------------:|:-----------------:|:-----------------------------------------------------------------------------------:|
|
|
165
|
-
| search_word | string | ー | ー | Keywords to search models |
|
|
166
|
-
| model_type | string | `Checkpoint` | [Details](#model_type) | The type of model to search for. |
|
|
167
|
-
| base_model | string | None | ー | Trained model tag (example: `SD 1.5`, `SD 3.5`, `SDXL 1.0`) |
|
|
168
|
-
| download | bool | False | ー | Whether to download the model. |
|
|
169
|
-
| force_download | bool | False | ー | Whether to force the download if the model already exists. |
|
|
170
|
-
| cache_dir | string, Path | None | ー | Path to the folder where cached files are stored. |
|
|
171
|
-
| resume | bool | False | ー | Whether to resume an incomplete download. |
|
|
172
|
-
| token | string | None | ー | API token for Civitai authentication. |
|
|
173
|
-
| skip_error | bool | False | ー | Whether to skip errors and return None. |
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
<a id="search-word"></a>
|
|
179
|
-
<details open>
|
|
180
|
-
<summary>search_word</summary>
|
|
181
|
-
|
|
182
|
-
| Type | Description |
|
|
183
|
-
| :--------------------------: | :--------------------------------------------------------------------: |
|
|
184
|
-
| keyword | Keywords to search model<br> |
|
|
185
|
-
| url | Can be any URL other than huggingface or Civitai. |
|
|
186
|
-
| Local directory or file path | Search for files with the extensions: `.safetensors`, `.ckpt`, `.bin` |
|
|
187
|
-
| huggingface path | The following format: `< creator > / < repo >` |
|
|
188
|
-
|
|
189
|
-
</details>
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
<a id="model_type"></a>
|
|
193
|
-
<details open>
|
|
194
|
-
<summary>model_type</summary>
|
|
195
|
-
|
|
196
|
-
| Input Available |
|
|
197
|
-
| :--------------------------------------: |
|
|
198
|
-
| `Checkpoint`,<br>`TextualInversion`,<br>`Hypernetwork`,<br>`AestheticGradient`,<br>`LORA`,<br>`Controlnet`,<br>`Poses` |
|
|
199
|
-
|
|
200
|
-
</details>
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
## License<a name = "License"></a>
|
|
204
|
-
In accordance with [Apache-2.0 license](https://github.com/suzukimain/auto_diffusers/blob/master/LICENSE)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
## Acknowledgement<a name = "Acknowledgement"></a>
|
|
208
|
-
|
|
209
|
-
I have used open source resources and free tools in the creation of this project.
|
|
210
|
-
|
|
211
|
-
I would like to take this opportunity to thank the open source community and those who provided free tools.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
auto_diffusers/__init__.py,sha256=2VKCeWUc38yM2JVLhR9oqSQMC6513XEWPuBzk2pdRrM,204
|
|
2
|
-
auto_diffusers/pipeline_easy.py,sha256=9lDZYxp74BVuHryhitJcPG3zHAUpNYxVyyzMsnZoJ0Q,75262
|
|
3
|
-
auto_diffusers/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
auto_diffusers-2.0.13.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
|
-
auto_diffusers-2.0.13.dist-info/METADATA,sha256=xRrieSi7ocd5uwUfknwfBCeM9eod4GUU6xsPLcmOuzw,12695
|
|
6
|
-
auto_diffusers-2.0.13.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
7
|
-
auto_diffusers-2.0.13.dist-info/top_level.txt,sha256=iYkbnc9T-VKVnoCP6AufdXcDUfUaLZ_yMG-USuYf4UQ,15
|
|
8
|
-
auto_diffusers-2.0.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|