adamelliotfields commited on
Commit
fe2bc86
1 Parent(s): 67ca03a

Single file checkpoints

Browse files
Files changed (3) hide show
  1. README.md +10 -6
  2. lib/config.py +8 -1
  3. lib/loader.py +7 -1
README.md CHANGED
@@ -16,6 +16,7 @@ license: apache-2.0
16
  models:
17
  - ai-forever/Real-ESRGAN
18
  - cagliostrolab/animagine-xl-3.1
 
19
  - fluently/Fluently-XL-Final
20
  - madebyollin/sdxl-vae-fp16-fix
21
  - SG161222/RealVisXL_V5.0
@@ -27,22 +28,25 @@ preload_from_hub:
27
  RealESRGAN_x2.pth,RealESRGAN_x4.pth
28
  - >-
29
  cagliostrolab/animagine-xl-3.1
30
- text_encoder/model.safetensors,text_encoder_2/model.safetensors,unet/diffusion_pytorch_model.safetensors,model_index.json
 
 
 
31
  - >-
32
  fluently/Fluently-XL-Final
33
- text_encoder/model.safetensors,text_encoder_2/model.safetensors,unet/diffusion_pytorch_model.safetensors,model_index.json
34
  - >-
35
  madebyollin/sdxl-vae-fp16-fix
36
- diffusion_pytorch_model.safetensors,config.json
37
  - >-
38
  SG161222/RealVisXL_V5.0
39
- text_encoder/model.fp16.safetensors,text_encoder_2/model.fp16.safetensors,unet/diffusion_pytorch_model.fp16.safetensors,model_index.json
40
  - >-
41
  stabilityai/stable-diffusion-xl-base-1.0
42
- text_encoder/model.fp16.safetensors,text_encoder_2/model.fp16.safetensors,unet/diffusion_pytorch_model.fp16.safetensors,model_index.json
43
  - >-
44
  stabilityai/stable-diffusion-xl-refiner-1.0
45
- text_encoder_2/model.fp16.safetensors,unet/diffusion_pytorch_model.fp16.safetensors,model_index.json
46
  ---
47
 
48
  # diffusion-xl
 
16
  models:
17
  - ai-forever/Real-ESRGAN
18
  - cagliostrolab/animagine-xl-3.1
19
+ - cyberdelia/CyberRealsticXL
20
  - fluently/Fluently-XL-Final
21
  - madebyollin/sdxl-vae-fp16-fix
22
  - SG161222/RealVisXL_V5.0
 
28
  RealESRGAN_x2.pth,RealESRGAN_x4.pth
29
  - >-
30
  cagliostrolab/animagine-xl-3.1
31
+ animagine-xl-3.1.safetensors
32
+ - >-
33
+ cyberdelia/CyberRealsticXL
34
+ CyberRealisticXLPlay_V1.0.safetensors
35
  - >-
36
  fluently/Fluently-XL-Final
37
+ FluentlyXL-Final.safetensors
38
  - >-
39
  madebyollin/sdxl-vae-fp16-fix
40
+ config.json,diffusion_pytorch_model.safetensors
41
  - >-
42
  SG161222/RealVisXL_V5.0
43
+ RealVisXL_V5.0_fp16.safetensors
44
  - >-
45
  stabilityai/stable-diffusion-xl-base-1.0
46
+ scheduler/scheduler_config.json,text_encoder/config.json,text_encoder/model.fp16.safetensors,text_encoder_2/config.json,text_encoder_2/model.fp16.safetensors,tokenizer/merges.txt,tokenizer/special_tokens_map.json,tokenizer/tokenizer_config.json,tokenizer/vocab.json,tokenizer_2/merges.txt,tokenizer_2/special_tokens_map.json,tokenizer_2/tokenizer_config.json,tokenizer_2/vocab.json,unet/config.json,unet/diffusion_pytorch_model.fp16.safetensors,vae/config.json,vae/diffusion_pytorch_model.fp16.safetensors,model_index.json
47
  - >-
48
  stabilityai/stable-diffusion-xl-refiner-1.0
49
+ scheduler/scheduler_config.json,text_encoder_2/config.json,text_encoder_2/model.fp16.safetensors,tokenizer_2/merges.txt,tokenizer_2/special_tokens_map.json,tokenizer_2/tokenizer_config.json,tokenizer_2/vocab.json,unet/config.json,unet/diffusion_pytorch_model.fp16.safetensors,vae/config.json,vae/diffusion_pytorch_model.fp16.safetensors,model_index.json
50
  ---
51
 
52
  # diffusion-xl
lib/config.py CHANGED
@@ -25,12 +25,19 @@ Config = SimpleNamespace(
25
  },
26
  MODEL="fluently/Fluently-XL-Final",
27
  MODELS=[
28
- # TODO: CyberRealisticXL once single file support is added
29
  "cagliostrolab/animagine-xl-3.1",
 
30
  "fluently/Fluently-XL-Final",
31
  "SG161222/RealVisXL_V5.0",
32
  "stabilityai/stable-diffusion-xl-base-1.0",
33
  ],
 
 
 
 
 
 
 
34
  VAE_MODEL="madebyollin/sdxl-vae-fp16-fix",
35
  REFINER_MODEL="stabilityai/stable-diffusion-xl-refiner-1.0",
36
  SCHEDULER="Euler",
 
25
  },
26
  MODEL="fluently/Fluently-XL-Final",
27
  MODELS=[
 
28
  "cagliostrolab/animagine-xl-3.1",
29
+ "cyberdelia/CyberRealsticXL",
30
  "fluently/Fluently-XL-Final",
31
  "SG161222/RealVisXL_V5.0",
32
  "stabilityai/stable-diffusion-xl-base-1.0",
33
  ],
34
+ MODEL_CHECKPOINTS={
35
+ # keep keys lowercase
36
+ "cagliostrolab/animagine-xl-3.1": "animagine-xl-3.1.safetensors",
37
+ "cyberdelia/cyberrealsticxl": "CyberRealisticXLPlay_V1.0.safetensors", # typo in "realistic"
38
+ "fluently/fluently-xl-final": "FluentlyXL-Final.safetensors",
39
+ "sg161222/realvisxl_v5.0": "RealVisXL_V5.0_fp16.safetensors",
40
+ },
41
  VAE_MODEL="madebyollin/sdxl-vae-fp16-fix",
42
  REFINER_MODEL="stabilityai/stable-diffusion-xl-refiner-1.0",
43
  SCHEDULER="Euler",
lib/loader.py CHANGED
@@ -61,7 +61,13 @@ class Loader:
61
  try:
62
  print(f"Loading {model}...")
63
  self.model = model
64
- self.pipe = pipeline.from_pretrained(model, **kwargs).to("cuda")
 
 
 
 
 
 
65
  if self.refiner is not None:
66
  self.refiner.vae = self.pipe.vae
67
  self.refiner.scheduler = self.pipe.scheduler
 
61
  try:
62
  print(f"Loading {model}...")
63
  self.model = model
64
+ if model.lower() in Config.MODEL_CHECKPOINTS.keys():
65
+ self.pipe = pipeline.from_single_file(
66
+ f"https://huggingface.co/{model}/{Config.MODEL_CHECKPOINTS[model.lower()]}",
67
+ **kwargs,
68
+ ).to("cuda")
69
+ else:
70
+ self.pipe = pipeline.from_pretrained(model, **kwargs).to("cuda")
71
  if self.refiner is not None:
72
  self.refiner.vae = self.pipe.vae
73
  self.refiner.scheduler = self.pipe.scheduler