Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -17,14 +17,17 @@ import spaces
|
|
17 |
|
18 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
19 |
|
|
|
|
|
20 |
model_path = "MeissonFlow/Meissonic"
|
21 |
-
model = Transformer2DModel.from_pretrained(model_path, subfolder="transformer")
|
22 |
-
vq_model = VQModel.from_pretrained(model_path, subfolder="vqvae")
|
23 |
-
# text_encoder = CLIPTextModelWithProjection.from_pretrained(model_path,
|
24 |
-
text_encoder = CLIPTextModelWithProjection.from_pretrained(
|
25 |
"laion/CLIP-ViT-H-14-laion2B-s32B-b79K"
|
26 |
-
|
27 |
-
|
|
|
28 |
scheduler = Scheduler.from_pretrained(model_path, subfolder="scheduler")
|
29 |
pipe = Pipeline(vq_model, tokenizer=tokenizer, text_encoder=text_encoder, transformer=model, scheduler=scheduler)
|
30 |
pipe.to(device)
|
|
|
17 |
|
18 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
19 |
|
20 |
+
|
21 |
+
dtype = torch.bfloat16
|
22 |
model_path = "MeissonFlow/Meissonic"
|
23 |
+
model = Transformer2DModel.from_pretrained(model_path, subfolder="transformer", torch_dtype=dtype)
|
24 |
+
vq_model = VQModel.from_pretrained(model_path, subfolder="vqvae", torch_dtype=dtype)
|
25 |
+
# text_encoder = CLIPTextModelWithProjection.from_pretrained(model_path,subfolder="text_encoder", torch_dtype=dtype)
|
26 |
+
text_encoder = CLIPTextModelWithProjection.from_pretrained( #using original text enc for stable sampling
|
27 |
"laion/CLIP-ViT-H-14-laion2B-s32B-b79K"
|
28 |
+
torch_dtype=dtype
|
29 |
+
)
|
30 |
+
tokenizer = CLIPTokenizer.from_pretrained(model_path, subfolder="tokenizer", torch_dtype=dtype)
|
31 |
scheduler = Scheduler.from_pretrained(model_path, subfolder="scheduler")
|
32 |
pipe = Pipeline(vq_model, tokenizer=tokenizer, text_encoder=text_encoder, transformer=model, scheduler=scheduler)
|
33 |
pipe.to(device)
|