Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -27,9 +27,6 @@ def get_lora_sd_pipeline(
|
|
27 |
|
28 |
pipe = StableDiffusionPipeline.from_pretrained(base_model_name_or_path, torch_dtype=dtype)
|
29 |
pipe.unet = PeftModel.from_pretrained(pipe.unet, unet_sub_dir, adapter_name=adapter_name)
|
30 |
-
print(os.path.exists(unet_sub_dir))
|
31 |
-
print(unet_sub_dir)
|
32 |
-
print(dtype)
|
33 |
|
34 |
if os.path.exists(text_encoder_sub_dir):
|
35 |
pipe.text_encoder = PeftModel.from_pretrained(
|
@@ -42,6 +39,8 @@ def get_lora_sd_pipeline(
|
|
42 |
return pipe
|
43 |
|
44 |
def split_prompt(prompt, tokenizer, max_length=77):
|
|
|
|
|
45 |
tokens = tokenizer(prompt, truncation=False)["input_ids"]
|
46 |
chunks = [tokens[i:i + max_length] for i in range(0, len(tokens), max_length)]
|
47 |
return chunks
|
@@ -136,10 +135,6 @@ def infer(
|
|
136 |
pipe = pipe.to(device)
|
137 |
image = pipe(**params).images[0]
|
138 |
else:
|
139 |
-
print('----')
|
140 |
-
print(lora_scale)
|
141 |
-
print(prompt)
|
142 |
-
print(negative_prompt)
|
143 |
prompt_embeds, negative_prompt_embeds = prompts_embeddings(
|
144 |
prompt,
|
145 |
negative_prompt,
|
|
|
27 |
|
28 |
pipe = StableDiffusionPipeline.from_pretrained(base_model_name_or_path, torch_dtype=dtype)
|
29 |
pipe.unet = PeftModel.from_pretrained(pipe.unet, unet_sub_dir, adapter_name=adapter_name)
|
|
|
|
|
|
|
30 |
|
31 |
if os.path.exists(text_encoder_sub_dir):
|
32 |
pipe.text_encoder = PeftModel.from_pretrained(
|
|
|
39 |
return pipe
|
40 |
|
41 |
def split_prompt(prompt, tokenizer, max_length=77):
|
42 |
+
print(prompt)
|
43 |
+
print(type(prompt))
|
44 |
tokens = tokenizer(prompt, truncation=False)["input_ids"]
|
45 |
chunks = [tokens[i:i + max_length] for i in range(0, len(tokens), max_length)]
|
46 |
return chunks
|
|
|
135 |
pipe = pipe.to(device)
|
136 |
image = pipe(**params).images[0]
|
137 |
else:
|
|
|
|
|
|
|
|
|
138 |
prompt_embeds, negative_prompt_embeds = prompts_embeddings(
|
139 |
prompt,
|
140 |
negative_prompt,
|