alfredplpl commited on
Commit
6102167
1 Parent(s): 662c196

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -22
app.py CHANGED
@@ -15,8 +15,6 @@ import spaces
15
 
16
  model_id = "aipicasso/emix-0-4-turbo"
17
  auth_token=os.environ["ACCESS_TOKEN"]
18
- #adapter_id = "latent-consistency/lcm-lora-sdxl"
19
- #adapter_id_2 = "manual.safetensors"
20
 
21
  scheduler = EulerAncestralDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler",token=auth_token)
22
 
@@ -25,23 +23,9 @@ pipe = AutoPipelineForText2Image.from_pretrained(
25
  torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
26
  scheduler=scheduler,
27
  token=auth_token)
28
- pipe=pipe.to("cuda")
29
-
30
- #pipe = AutoPipelineForText2Image.from_pretrained(
31
- # model_id,
32
- # torch_dtype=torch.float16,
33
- # use_auth_token=auth_token
34
- #)
35
- #pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
36
-
37
-
38
- #pipe.load_lora_weights(adapter_id)
39
- #pipe.load_lora_weights(adapter_id_2)
40
- #pipe.fuse_lora()
41
 
 
42
  pipe.enable_freeu(s1=0.9, s2=0.2, b1=1.3, b2=1.4)
43
- #pipe.enable_freeu(s1=0.6, s2=0.4, b1=1.1, b2=1.2)
44
- #pipe.unet = torch.compile(pipe.unet, mode="reduce-overhead", fullgraph=True)
45
 
46
  state_dict = load_file("unaestheticXLv31.safetensors")
47
  pipe.load_textual_inversion(state_dict["clip_g"], token="unaestheticXLv31", text_encoder=pipe.text_encoder_2, tokenizer=pipe.tokenizer_2)
@@ -113,13 +97,15 @@ def auto_prompt_correction(prompt_ui,neg_prompt_ui,disable_auto_prompt_correctio
113
 
114
  #
115
  def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator):
116
- conditioning, pooled = compel([prompt, neg_prompt])
 
 
117
 
118
  result = pipe(
119
- prompt_embeds=conditioning[0:1],
120
- pooled_prompt_embeds=pooled[0:1],
121
- negative_prompt_embeds=conditioning[1:2],
122
- negative_pooled_prompt_embeds=pooled[1:2],
123
  num_inference_steps = int(steps),
124
  guidance_scale = guidance,
125
  width = width,
 
15
 
16
  model_id = "aipicasso/emix-0-4-turbo"
17
  auth_token=os.environ["ACCESS_TOKEN"]
 
 
18
 
19
  scheduler = EulerAncestralDiscreteScheduler.from_pretrained(model_id, subfolder="scheduler",token=auth_token)
20
 
 
23
  torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
24
  scheduler=scheduler,
25
  token=auth_token)
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
+ pipe.to("cuda")
28
  pipe.enable_freeu(s1=0.9, s2=0.2, b1=1.3, b2=1.4)
 
 
29
 
30
  state_dict = load_file("unaestheticXLv31.safetensors")
31
  pipe.load_textual_inversion(state_dict["clip_g"], token="unaestheticXLv31", text_encoder=pipe.text_encoder_2, tokenizer=pipe.tokenizer_2)
 
97
 
98
  #
99
  def txt_to_img(prompt, neg_prompt, guidance, steps, width, height, generator):
100
+ conditioning, pooled = compel(prompt)
101
+ neg_conditioning, neg_pooled = compel(neg_prompt)
102
+
103
 
104
  result = pipe(
105
+ prompt_embeds=conditioning,
106
+ pooled_prompt_embeds=pooled,
107
+ negative_prompt_embeds=neg_conditioning,
108
+ negative_pooled_prompt_embeds=neg_pooled,
109
  num_inference_steps = int(steps),
110
  guidance_scale = guidance,
111
  width = width,