ford442 commited on
Commit
f1a5177
·
verified ·
1 Parent(s): 9b79fdd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -59,7 +59,6 @@ ENABLE_CPU_OFFLOAD = 0
59
  BATCH_SIZE = int(os.getenv("BATCH_SIZE", "1"))
60
 
61
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
62
- torch.set_default_device('cuda')
63
 
64
  style_list = [
65
  {
@@ -102,6 +101,7 @@ def apply_style(style_name: str, positive: str, negative: str = "") -> Tuple[str
102
  return p.replace("{prompt}", positive), n + negative
103
 
104
  def load_and_prepare_model():
 
105
  #vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", safety_checker=None)
106
  vaeX = AutoencoderKL.from_pretrained("stabilityai/sdxl-vae", safety_checker=None,use_safetensors=False)
107
  #vae = AutoencoderKL.from_single_file('https://huggingface.co/ford442/sdxl-vae-bf16/mySLR/myslrVAE_v10.safetensors')
@@ -173,6 +173,11 @@ def load_and_prepare_model():
173
  #pipe.unet=pipeX.unet
174
  #pipe.scheduler=EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear", beta_start=0.00085, beta_end=0.012, steps_offset=1)
175
  #pipe.scheduler=EulerAncestralDiscreteScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler',beta_schedule="scaled_linear")
 
 
 
 
 
176
 
177
  pipe.to(device)
178
  pipe.to(torch.bfloat16)
@@ -189,12 +194,6 @@ def load_and_prepare_model():
189
  #print(f'UNET: {pipe.unet}')
190
  pipe.watermark=None
191
  pipe.safety_checker=None
192
-
193
- # pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/Fantasy_World_XL.safetensors", adapter_name="fantasy")
194
- pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/skin_texture_style_v4.safetensors", adapter_name="skin")
195
- #pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/epicNewPhoto.safetensors", adapter_name="photo")
196
- #pipe.set_adapters(["skin", "photo", "fantasy"], adapter_weights=[0.75, 0.25, 0.5])
197
- pipe.set_adapters(["skin"], adapter_weights=[0.5])
198
 
199
  #sched = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, beta_schedule="linear", algorithm_type="dpmsolver++")
200
  return pipe
 
59
  BATCH_SIZE = int(os.getenv("BATCH_SIZE", "1"))
60
 
61
  device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
 
62
 
63
  style_list = [
64
  {
 
101
  return p.replace("{prompt}", positive), n + negative
102
 
103
  def load_and_prepare_model():
104
+ torch.set_default_device('cuda')
105
  #vae = AutoencoderKL.from_pretrained("ford442/sdxl-vae-bf16", safety_checker=None)
106
  vaeX = AutoencoderKL.from_pretrained("stabilityai/sdxl-vae", safety_checker=None,use_safetensors=False)
107
  #vae = AutoencoderKL.from_single_file('https://huggingface.co/ford442/sdxl-vae-bf16/mySLR/myslrVAE_v10.safetensors')
 
173
  #pipe.unet=pipeX.unet
174
  #pipe.scheduler=EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config, beta_schedule="scaled_linear", beta_start=0.00085, beta_end=0.012, steps_offset=1)
175
  #pipe.scheduler=EulerAncestralDiscreteScheduler.from_pretrained('ford442/RealVisXL_V5.0_BF16', subfolder='scheduler',beta_schedule="scaled_linear")
176
+ # pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/Fantasy_World_XL.safetensors", adapter_name="fantasy")
177
+ pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/skin_texture_style_v4.safetensors", adapter_name="skin")
178
+ #pipe.load_lora_weights("ford442/sdxl-vae-bf16", weight_name="LoRA/epicNewPhoto.safetensors", adapter_name="photo")
179
+ #pipe.set_adapters(["skin", "photo", "fantasy"], adapter_weights=[0.75, 0.25, 0.5])
180
+ pipe.set_adapters(["skin"], adapter_weights=[0.5])
181
 
182
  pipe.to(device)
183
  pipe.to(torch.bfloat16)
 
194
  #print(f'UNET: {pipe.unet}')
195
  pipe.watermark=None
196
  pipe.safety_checker=None
 
 
 
 
 
 
197
 
198
  #sched = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, beta_schedule="linear", algorithm_type="dpmsolver++")
199
  return pipe