Update app.py
Browse files
app.py
CHANGED
@@ -73,7 +73,9 @@ import torch.nn.functional as F
|
|
73 |
from PIL import Image
|
74 |
from torchvision import transforms
|
75 |
from torchvision.transforms import v2
|
76 |
-
from diffusers import
|
|
|
|
|
77 |
from diffusers import FluxPipeline
|
78 |
from pytorch_lightning import seed_everything
|
79 |
import os
|
@@ -95,10 +97,14 @@ isomer_color_weights = torch.from_numpy(np.array([1, 0.5, 1, 0.5])).float().to(d
|
|
95 |
|
96 |
# model initialization and loading
|
97 |
# flux
|
98 |
-
|
|
|
|
|
|
|
99 |
flux_lora_ckpt_path = hf_hub_download(repo_id="LTT/xxx-ckpt", filename="rgb_normal_large.safetensors", repo_type="model")
|
100 |
flux_pipe.load_lora_weights(flux_lora_ckpt_path)
|
101 |
flux_pipe.to(device=device_0, dtype=torch.bfloat16)
|
|
|
102 |
|
103 |
|
104 |
# lrm
|
@@ -210,7 +216,8 @@ def generate_multi_view_images(prompt, seed):
|
|
210 |
width=resolution * 4,
|
211 |
height=resolution * 2,
|
212 |
output_type='np',
|
213 |
-
generator=generator
|
|
|
214 |
).images
|
215 |
return images
|
216 |
|
|
|
73 |
from PIL import Image
|
74 |
from torchvision import transforms
|
75 |
from torchvision.transforms import v2
|
76 |
+
from diffusers import DiffusionPipeline, FlowMatchEulerDiscreteScheduler, AutoencoderTiny, AutoencoderKL
|
77 |
+
from transformers import CLIPTextModel, CLIPTokenizer,T5EncoderModel, T5TokenizerFast
|
78 |
+
from live_preview_helpers import calculate_shift, retrieve_timesteps, flux_pipe_call_that_returns_an_iterable_of_images
|
79 |
from diffusers import FluxPipeline
|
80 |
from pytorch_lightning import seed_everything
|
81 |
import os
|
|
|
97 |
|
98 |
# model initialization and loading
|
99 |
# flux
|
100 |
+
taef1 = AutoencoderTiny.from_pretrained("madebyollin/taef1", torch_dtype=torch.bfloat16).to(device_0)
|
101 |
+
good_vae = AutoencoderKL.from_pretrained("black-forest-labs/FLUX.1-dev", subfolder="vae", torch_dtype=torch.bfloat16, token=access_token).to(device_0)
|
102 |
+
# flux_pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16, token=access_token).to(device=device_0, dtype=torch.bfloat16)
|
103 |
+
flux_pipe = DiffusionPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16, vae=taef1).to(device)
|
104 |
flux_lora_ckpt_path = hf_hub_download(repo_id="LTT/xxx-ckpt", filename="rgb_normal_large.safetensors", repo_type="model")
|
105 |
flux_pipe.load_lora_weights(flux_lora_ckpt_path)
|
106 |
flux_pipe.to(device=device_0, dtype=torch.bfloat16)
|
107 |
+
flux_pipe.flux_pipe_call_that_returns_an_iterable_of_images = flux_pipe_call_that_returns_an_iterable_of_images.__get__(flux_pipe)
|
108 |
|
109 |
|
110 |
# lrm
|
|
|
216 |
width=resolution * 4,
|
217 |
height=resolution * 2,
|
218 |
output_type='np',
|
219 |
+
generator=generator,
|
220 |
+
good_vae=good_vae,
|
221 |
).images
|
222 |
return images
|
223 |
|