John6666 commited on
Commit
d6db322
·
verified ·
1 Parent(s): 4e05fad

Upload 6 files

Browse files
Files changed (5) hide show
  1. README.md +2 -0
  2. constants.py +17 -5
  3. env.py +5 -95
  4. requirements.txt +1 -1
  5. utils.py +29 -15
README.md CHANGED
@@ -11,6 +11,8 @@ header: mini
11
  license: mit
12
  duplicated_from: r3gm/DiffuseCraft
13
  short_description: Stunning images using stable diffusion.
 
 
14
  hf_oauth: true
15
  ---
16
 
 
11
  license: mit
12
  duplicated_from: r3gm/DiffuseCraft
13
  short_description: Stunning images using stable diffusion.
14
+ preload_from_hub:
15
+ - madebyollin/sdxl-vae-fp16-fix config.json,diffusion_pytorch_model.safetensors
16
  hf_oauth: true
17
  ---
18
 
constants.py CHANGED
@@ -7,10 +7,10 @@ from stablepy import (
7
  )
8
 
9
  # - **Download Models**
10
- DOWNLOAD_MODEL = "https://civitai.com/api/download/models/574369, https://huggingface.co/TechnoByte/MilkyWonderland/resolve/main/milkyWonderland_v40.safetensors"
11
 
12
  # - **Download VAEs**
13
- DOWNLOAD_VAE = "https://huggingface.co/nubby/blessed-sdxl-vae-fp16-fix/resolve/main/sdxl_vae-fp16fix-c-1.1-b-0.5.safetensors?download=true, https://huggingface.co/nubby/blessed-sdxl-vae-fp16-fix/resolve/main/sdxl_vae-fp16fix-blessed.safetensors?download=true, https://huggingface.co/digiplay/VAE/resolve/main/vividReal_v20.safetensors?download=true, https://huggingface.co/fp16-guy/anything_kl-f8-anime2_vae-ft-mse-840000-ema-pruned_blessed_clearvae_fp16_cleaned/resolve/main/vae-ft-mse-840000-ema-pruned_fp16.safetensors?download=true"
14
 
15
  # - **Download LoRAs**
16
  DOWNLOAD_LORA = "https://huggingface.co/Leopain/color/resolve/main/Coloring_book_-_LineArt.safetensors, https://civitai.com/api/download/models/135867, https://huggingface.co/Linaqruf/anime-detailer-xl-lora/resolve/main/anime-detailer-xl.safetensors?download=true, https://huggingface.co/Linaqruf/style-enhancer-xl-lora/resolve/main/style-enhancer-xl.safetensors?download=true, https://huggingface.co/ByteDance/Hyper-SD/resolve/main/Hyper-SD15-8steps-CFG-lora.safetensors?download=true, https://huggingface.co/ByteDance/Hyper-SD/resolve/main/Hyper-SDXL-8steps-CFG-lora.safetensors?download=true"
@@ -24,7 +24,9 @@ LOAD_DIFFUSERS_FORMAT_MODEL = [
24
  'John6666/lyh-anime-flux-v2a1-fp8-flux',
25
  'John6666/carnival-unchained-v10-fp8-flux',
26
  'Freepik/flux.1-lite-8B-alpha',
27
- 'ostris/OpenFLUX.1',
 
 
28
  'John6666/noobai-xl-nai-xl-epsilonpred10version-sdxl',
29
  'John6666/noobai-xl-nai-xl-epsilonpred075version-sdxl',
30
  'John6666/noobai-xl-nai-xl-epsilonpred05version-sdxl',
@@ -38,6 +40,7 @@ LOAD_DIFFUSERS_FORMAT_MODEL = [
38
  'John6666/illustriousxl-mmmix-v50-sdxl',
39
  'John6666/illustrious-pencil-xl-v200-sdxl',
40
  'John6666/obsession-illustriousxl-v21-sdxl',
 
41
  'eienmojiki/Anything-XL',
42
  'eienmojiki/Starry-XL-v5.2',
43
  'John6666/meinaxl-v2-sdxl',
@@ -86,6 +89,8 @@ LOAD_DIFFUSERS_FORMAT_MODEL = [
86
  'yodayo-ai/kivotos-xl-2.0',
87
  'yodayo-ai/holodayo-xl-2.1',
88
  'yodayo-ai/clandestine-xl-1.0',
 
 
89
  'digiplay/majicMIX_sombre_v2',
90
  'digiplay/majicMIX_realistic_v6',
91
  'digiplay/majicMIX_realistic_v7',
@@ -120,8 +125,8 @@ DIFFUSERS_FORMAT_LORAS = [
120
 
121
  DOWNLOAD_EMBEDS = [
122
  'https://huggingface.co/datasets/Nerfgun3/bad_prompt/blob/main/bad_prompt_version2.pt',
123
- 'https://huggingface.co/embed/negative/resolve/main/EasyNegativeV2.safetensors',
124
- 'https://huggingface.co/embed/negative/resolve/main/bad-hands-5.pt',
125
  ]
126
 
127
  CIVITAI_API_KEY = os.environ.get("CIVITAI_API_KEY")
@@ -291,6 +296,13 @@ MODEL_TYPE_CLASS = {
291
  "diffusers:FluxPipeline": "FLUX",
292
  }
293
 
 
 
 
 
 
 
 
294
  POST_PROCESSING_SAMPLER = ["Use same sampler"] + [
295
  name_s for name_s in scheduler_names if "Auto-Loader" not in name_s
296
  ]
 
7
  )
8
 
9
  # - **Download Models**
10
+ DOWNLOAD_MODEL = "https://huggingface.co/TechnoByte/MilkyWonderland/resolve/main/milkyWonderland_v40.safetensors"
11
 
12
  # - **Download VAEs**
13
+ DOWNLOAD_VAE = "https://huggingface.co/fp16-guy/anything_kl-f8-anime2_vae-ft-mse-840000-ema-pruned_blessed_clearvae_fp16_cleaned/resolve/main/vae-ft-mse-840000-ema-pruned_fp16.safetensors?download=true"
14
 
15
  # - **Download LoRAs**
16
  DOWNLOAD_LORA = "https://huggingface.co/Leopain/color/resolve/main/Coloring_book_-_LineArt.safetensors, https://civitai.com/api/download/models/135867, https://huggingface.co/Linaqruf/anime-detailer-xl-lora/resolve/main/anime-detailer-xl.safetensors?download=true, https://huggingface.co/Linaqruf/style-enhancer-xl-lora/resolve/main/style-enhancer-xl.safetensors?download=true, https://huggingface.co/ByteDance/Hyper-SD/resolve/main/Hyper-SD15-8steps-CFG-lora.safetensors?download=true, https://huggingface.co/ByteDance/Hyper-SD/resolve/main/Hyper-SDXL-8steps-CFG-lora.safetensors?download=true"
 
24
  'John6666/lyh-anime-flux-v2a1-fp8-flux',
25
  'John6666/carnival-unchained-v10-fp8-flux',
26
  'Freepik/flux.1-lite-8B-alpha',
27
+ 'shauray/FluxDev-HyperSD-merged',
28
+ 'mikeyandfriends/PixelWave_FLUX.1-dev_03',
29
+ 'terminusresearch/FluxBooru-v0.3',
30
  'John6666/noobai-xl-nai-xl-epsilonpred10version-sdxl',
31
  'John6666/noobai-xl-nai-xl-epsilonpred075version-sdxl',
32
  'John6666/noobai-xl-nai-xl-epsilonpred05version-sdxl',
 
40
  'John6666/illustriousxl-mmmix-v50-sdxl',
41
  'John6666/illustrious-pencil-xl-v200-sdxl',
42
  'John6666/obsession-illustriousxl-v21-sdxl',
43
+ 'John6666/obsession-illustriousxl-v30-sdxl',
44
  'eienmojiki/Anything-XL',
45
  'eienmojiki/Starry-XL-v5.2',
46
  'John6666/meinaxl-v2-sdxl',
 
89
  'yodayo-ai/kivotos-xl-2.0',
90
  'yodayo-ai/holodayo-xl-2.1',
91
  'yodayo-ai/clandestine-xl-1.0',
92
+ 'ostris/OpenFLUX.1',
93
+ 'shuttleai/shuttle-3-diffusion',
94
  'digiplay/majicMIX_sombre_v2',
95
  'digiplay/majicMIX_realistic_v6',
96
  'digiplay/majicMIX_realistic_v7',
 
125
 
126
  DOWNLOAD_EMBEDS = [
127
  'https://huggingface.co/datasets/Nerfgun3/bad_prompt/blob/main/bad_prompt_version2.pt',
128
+ # 'https://huggingface.co/embed/negative/resolve/main/EasyNegativeV2.safetensors',
129
+ # 'https://huggingface.co/embed/negative/resolve/main/bad-hands-5.pt',
130
  ]
131
 
132
  CIVITAI_API_KEY = os.environ.get("CIVITAI_API_KEY")
 
296
  "diffusers:FluxPipeline": "FLUX",
297
  }
298
 
299
+ DIFFUSECRAFT_CHECKPOINT_NAME = {
300
+ "sd1.5": "SD 1.5",
301
+ "sdxl": "SDXL",
302
+ "flux-dev": "FLUX",
303
+ "flux-schnell": "FLUX",
304
+ }
305
+
306
  POST_PROCESSING_SAMPLER = ["Use same sampler"] + [
307
  name_s for name_s in scheduler_names if "Auto-Loader" not in name_s
308
  ]
env.py CHANGED
@@ -1,103 +1,12 @@
1
  import os
2
-
3
  CIVITAI_API_KEY = os.environ.get("CIVITAI_API_KEY")
4
  HF_TOKEN = os.environ.get("HF_TOKEN")
5
  HF_READ_TOKEN = os.environ.get('HF_READ_TOKEN') # only use for private repo
6
 
7
  # - **List Models**
8
  LOAD_DIFFUSERS_FORMAT_MODEL = [
9
- 'stabilityai/stable-diffusion-xl-base-1.0',
10
- 'black-forest-labs/FLUX.1-dev',
11
- 'John6666/blue-pencil-flux1-v021-fp8-flux',
12
- 'John6666/wai-ani-flux-v10forfp8-fp8-flux',
13
- 'John6666/xe-anime-flux-v04-fp8-flux',
14
- 'John6666/lyh-anime-flux-v2a1-fp8-flux',
15
- 'John6666/carnival-unchained-v10-fp8-flux',
16
- 'Freepik/flux.1-lite-8B-alpha',
17
- 'ostris/OpenFLUX.1',
18
- 'John6666/noobai-xl-nai-xl-epsilonpred10version-sdxl',
19
- 'John6666/noobai-xl-nai-xl-epsilonpred075version-sdxl',
20
- 'John6666/noobai-xl-nai-xl-epsilonpred05version-sdxl',
21
- 'John6666/noobai-cyberfix-v10-sdxl',
22
- 'John6666/noobaiiter-xl-vpred-v075-sdxl',
23
- 'John6666/complicated-noobai-merge-vprediction-sdxl',
24
- 'John6666/noobai-fusion2-vpred-itercomp-v1-sdxl',
25
- 'John6666/noobai-xl-nai-xl-vpredtestversion-sdxl',
26
- 'John6666/chadmix-noobai075-illustrious01-v10-sdxl',
27
- 'OnomaAIResearch/Illustrious-xl-early-release-v0',
28
- 'John6666/obsession-illustriousxl-v21-sdxl',
29
- 'eienmojiki/Anything-XL',
30
- 'eienmojiki/Starry-XL-v5.2',
31
- 'John6666/meinaxl-v2-sdxl',
32
- 'John6666/epicrealism-xl-v10kiss2-sdxl',
33
- 'John6666/epicrealism-xl-v8kiss-sdxl',
34
- 'misri/zavychromaxl_v80',
35
- 'SG161222/RealVisXL_V4.0',
36
- 'SG161222/RealVisXL_V5.0',
37
- 'misri/newrealityxlAllInOne_Newreality40',
38
- 'gsdf/CounterfeitXL',
39
- 'John6666/silvermoon-mix-01xl-v11-sdxl',
40
- 'WhiteAiZ/autismmixSDXL_autismmixConfetti_diffusers',
41
- 'kitty7779/ponyDiffusionV6XL',
42
- 'GraydientPlatformAPI/aniverse-pony',
43
- 'John6666/ras-real-anime-screencap-v1-sdxl',
44
- 'John6666/duchaiten-pony-xl-no-score-v60-sdxl',
45
- 'John6666/mistoon-anime-ponyalpha-sdxl',
46
- 'John6666/3x3x3mixxl-v2-sdxl',
47
- 'John6666/3x3x3mixxl-3dv01-sdxl',
48
- 'John6666/ebara-mfcg-pony-mix-v12-sdxl',
49
- 'John6666/t-ponynai3-v51-sdxl',
50
- 'John6666/t-ponynai3-v65-sdxl',
51
- 'John6666/prefect-pony-xl-v3-sdxl',
52
- 'John6666/mala-anime-mix-nsfw-pony-xl-v5-sdxl',
53
- 'John6666/wai-real-mix-v11-sdxl',
54
- 'John6666/wai-c-v6-sdxl',
55
- 'John6666/iniverse-mix-xl-sfwnsfw-pony-guofeng-v43-sdxl',
56
- 'John6666/sifw-annihilation-xl-v2-sdxl',
57
- 'John6666/photo-realistic-pony-v5-sdxl',
58
- 'John6666/pony-realism-v21main-sdxl',
59
- 'John6666/pony-realism-v22main-sdxl',
60
- 'John6666/cyberrealistic-pony-v63-sdxl',
61
- 'John6666/cyberrealistic-pony-v64-sdxl',
62
- 'John6666/cyberrealistic-pony-v65-sdxl',
63
- 'GraydientPlatformAPI/realcartoon-pony-diffusion',
64
- 'John6666/nova-anime-xl-pony-v5-sdxl',
65
- 'John6666/autismmix-sdxl-autismmix-pony-sdxl',
66
- 'John6666/aimz-dream-real-pony-mix-v3-sdxl',
67
- 'John6666/duchaiten-pony-real-v11fix-sdxl',
68
- 'John6666/duchaiten-pony-real-v20-sdxl',
69
- 'John6666/duchaiten-pony-xl-no-score-v70-sdxl',
70
- 'Eugeoter/artiwaifu-diffusion-2.0',
71
- 'comin/IterComp',
72
- 'KBlueLeaf/Kohaku-XL-Zeta',
73
- 'cagliostrolab/animagine-xl-3.1',
74
- 'yodayo-ai/kivotos-xl-2.0',
75
- 'yodayo-ai/holodayo-xl-2.1',
76
- 'yodayo-ai/clandestine-xl-1.0',
77
- 'digiplay/majicMIX_sombre_v2',
78
- 'digiplay/majicMIX_realistic_v6',
79
- 'digiplay/majicMIX_realistic_v7',
80
- 'digiplay/DreamShaper_8',
81
- 'digiplay/BeautifulArt_v1',
82
- 'digiplay/DarkSushi2.5D_v1',
83
- 'digiplay/darkphoenix3D_v1.1',
84
- 'digiplay/BeenYouLiteL11_diffusers',
85
- 'Yntec/RevAnimatedV2Rebirth',
86
- 'youknownothing/cyberrealistic_v50',
87
- 'youknownothing/deliberate-v6',
88
- 'GraydientPlatformAPI/deliberate-cyber3',
89
- 'GraydientPlatformAPI/picx-real',
90
- 'GraydientPlatformAPI/perfectworld6',
91
- 'emilianJR/epiCRealism',
92
- 'votepurchase/counterfeitV30_v30',
93
- 'votepurchase/ChilloutMix',
94
- 'Meina/MeinaMix_V11',
95
- 'Meina/MeinaUnreal_V5',
96
- 'Meina/MeinaPastel_V7',
97
- 'GraydientPlatformAPI/realcartoon3d-17',
98
- 'GraydientPlatformAPI/realcartoon-pixar11',
99
- 'GraydientPlatformAPI/realcartoon-real17',
100
- 'nitrosocke/Ghibli-Diffusion',
101
  'KBlueLeaf/Kohaku-XL-Epsilon-rev2',
102
  'KBlueLeaf/Kohaku-XL-Epsilon-rev3',
103
  'KBlueLeaf/Kohaku-XL-Zeta',
@@ -105,7 +14,7 @@ LOAD_DIFFUSERS_FORMAT_MODEL = [
105
  'kayfahaarukku/irAsu-1.0',
106
  'Eugeoter/artiwaifu-diffusion-2.0',
107
  'comin/IterComp',
108
- "OnomaAIResearch/Illustrious-xl-early-release-v0",
109
  'Raelina/Rae-Diffusion-XL-V2',
110
  'Raelina/Raemu-XL-V4',
111
  'Raelina/Raehoshi-illust-XL',
@@ -118,17 +27,18 @@ LOAD_DIFFUSERS_FORMAT_MODEL = [
118
  "multimodalart/FLUX.1-dev2pro-full",
119
  "Raelina/Raemu-Flux",
120
  ]
 
121
 
122
  DIFFUSERS_FORMAT_LORAS = [
123
  "nerijs/animation2k-flux",
124
  "XLabs-AI/flux-RealismLora",
 
125
  ]
126
 
127
  # List all Models for specified user
128
  HF_MODEL_USER_LIKES = ["votepurchase"] # sorted by number of likes
129
  HF_MODEL_USER_EX = ["John6666"] # sorted by a special rule
130
 
131
-
132
  # - **Download Models**
133
  DOWNLOAD_MODEL_LIST = [
134
  ]
 
1
  import os
2
+ from constants import LOAD_DIFFUSERS_FORMAT_MODEL as LOAD_DIFFUSERS_FORMAT_MODEL_DC
3
  CIVITAI_API_KEY = os.environ.get("CIVITAI_API_KEY")
4
  HF_TOKEN = os.environ.get("HF_TOKEN")
5
  HF_READ_TOKEN = os.environ.get('HF_READ_TOKEN') # only use for private repo
6
 
7
  # - **List Models**
8
  LOAD_DIFFUSERS_FORMAT_MODEL = [
9
+ 'Laxhar/noobai-XL-1.0',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  'KBlueLeaf/Kohaku-XL-Epsilon-rev2',
11
  'KBlueLeaf/Kohaku-XL-Epsilon-rev3',
12
  'KBlueLeaf/Kohaku-XL-Zeta',
 
14
  'kayfahaarukku/irAsu-1.0',
15
  'Eugeoter/artiwaifu-diffusion-2.0',
16
  'comin/IterComp',
17
+ 'OnomaAIResearch/Illustrious-xl-early-release-v0',
18
  'Raelina/Rae-Diffusion-XL-V2',
19
  'Raelina/Raemu-XL-V4',
20
  'Raelina/Raehoshi-illust-XL',
 
27
  "multimodalart/FLUX.1-dev2pro-full",
28
  "Raelina/Raemu-Flux",
29
  ]
30
+ LOAD_DIFFUSERS_FORMAT_MODEL = LOAD_DIFFUSERS_FORMAT_MODEL_DC + LOAD_DIFFUSERS_FORMAT_MODEL
31
 
32
  DIFFUSERS_FORMAT_LORAS = [
33
  "nerijs/animation2k-flux",
34
  "XLabs-AI/flux-RealismLora",
35
+ "Shakker-Labs/FLUX.1-dev-LoRA-Logo-Design",
36
  ]
37
 
38
  # List all Models for specified user
39
  HF_MODEL_USER_LIKES = ["votepurchase"] # sorted by number of likes
40
  HF_MODEL_USER_EX = ["John6666"] # sorted by a special rule
41
 
 
42
  # - **Download Models**
43
  DOWNLOAD_MODEL_LIST = [
44
  ]
requirements.txt CHANGED
@@ -1,4 +1,4 @@
1
- git+https://github.com/R3gm/stablepy.git@ed51089 # -b refactor_sampler_fix
2
  torch==2.2.0
3
  gdown
4
  opencv-python
 
1
+ git+https://github.com/R3gm/stablepy.git@f686946 # -b refactor_sampler_fix
2
  torch==2.2.0
3
  gdown
4
  opencv-python
utils.py CHANGED
@@ -7,11 +7,14 @@ from constants import (
7
  HF_TOKEN,
8
  MODEL_TYPE_CLASS,
9
  DIRECTORY_LORAS,
 
10
  )
11
  from huggingface_hub import HfApi
 
12
  from diffusers import DiffusionPipeline
13
  from huggingface_hub import model_info as model_info_data
14
  from diffusers.pipelines.pipeline_loading_utils import variant_compatible_siblings
 
15
  from pathlib import PosixPath
16
  from unidecode import unidecode
17
  import urllib.parse
@@ -283,10 +286,15 @@ def get_model_type(repo_id: str):
283
  api = HfApi(token=os.environ.get("HF_TOKEN")) # if use private or gated model
284
  default = "SD 1.5"
285
  try:
286
- model = api.model_info(repo_id=repo_id, timeout=5.0)
287
- tags = model.tags
288
- for tag in tags:
289
- if tag in MODEL_TYPE_CLASS.keys(): return MODEL_TYPE_CLASS.get(tag, default)
 
 
 
 
 
290
  except Exception:
291
  return default
292
  return default
@@ -371,17 +379,23 @@ def download_diffuser_repo(repo_name: str, model_type: str, revision: str = "mai
371
  if len(variant_filenames):
372
  variant = "fp16"
373
 
374
- cached_folder = DiffusionPipeline.download(
375
- pretrained_model_name=repo_name,
376
- force_download=False,
377
- token=token,
378
- revision=revision,
379
- # mirror="https://hf-mirror.com",
380
- variant=variant,
381
- use_safetensors=True,
382
- trust_remote_code=False,
383
- timeout=5.0,
384
- )
 
 
 
 
 
 
385
 
386
  if isinstance(cached_folder, PosixPath):
387
  cached_folder = cached_folder.as_posix()
 
7
  HF_TOKEN,
8
  MODEL_TYPE_CLASS,
9
  DIRECTORY_LORAS,
10
+ DIFFUSECRAFT_CHECKPOINT_NAME,
11
  )
12
  from huggingface_hub import HfApi
13
+ from huggingface_hub import snapshot_download
14
  from diffusers import DiffusionPipeline
15
  from huggingface_hub import model_info as model_info_data
16
  from diffusers.pipelines.pipeline_loading_utils import variant_compatible_siblings
17
+ from stablepy.diffusers_vanilla.utils import checkpoint_model_type
18
  from pathlib import PosixPath
19
  from unidecode import unidecode
20
  import urllib.parse
 
286
  api = HfApi(token=os.environ.get("HF_TOKEN")) # if use private or gated model
287
  default = "SD 1.5"
288
  try:
289
+ if os.path.exists(repo_id):
290
+ tag = checkpoint_model_type(repo_id)
291
+ return DIFFUSECRAFT_CHECKPOINT_NAME[tag]
292
+ else:
293
+ model = api.model_info(repo_id=repo_id, timeout=5.0)
294
+ tags = model.tags
295
+ for tag in tags:
296
+ if tag in MODEL_TYPE_CLASS.keys(): return MODEL_TYPE_CLASS.get(tag, default)
297
+
298
  except Exception:
299
  return default
300
  return default
 
379
  if len(variant_filenames):
380
  variant = "fp16"
381
 
382
+ if model_type == "FLUX":
383
+ cached_folder = snapshot_download(
384
+ repo_id=repo_name,
385
+ allow_patterns="transformer/*"
386
+ )
387
+ else:
388
+ cached_folder = DiffusionPipeline.download(
389
+ pretrained_model_name=repo_name,
390
+ force_download=False,
391
+ token=token,
392
+ revision=revision,
393
+ # mirror="https://hf-mirror.com",
394
+ variant=variant,
395
+ use_safetensors=True,
396
+ trust_remote_code=False,
397
+ timeout=5.0,
398
+ )
399
 
400
  if isinstance(cached_folder, PosixPath):
401
  cached_folder = cached_folder.as_posix()