Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import os, gc
|
|
2 |
import gradio as gr
|
3 |
import numpy as np
|
4 |
import random
|
5 |
-
from transformers import
|
6 |
import spaces
|
7 |
from diffusers import DiffusionPipeline, FlowMatchEulerDiscreteScheduler
|
8 |
import torch
|
@@ -16,14 +16,12 @@ if torch.cuda.is_available():
|
|
16 |
else:
|
17 |
torch_dtype = torch.bfloat16
|
18 |
|
19 |
-
tokenizer =
|
20 |
-
|
21 |
-
trust_remote_code=True,
|
22 |
use_fast=True
|
23 |
)
|
24 |
-
feature_extractor =
|
25 |
-
|
26 |
-
trust_remote_code=True
|
27 |
)
|
28 |
|
29 |
# 3) Dispatch & load in FP16 with offloading
|
|
|
2 |
import gradio as gr
|
3 |
import numpy as np
|
4 |
import random
|
5 |
+
from transformers import CLIPTokenizer, CLIPFeatureExtractor
|
6 |
import spaces
|
7 |
from diffusers import DiffusionPipeline, FlowMatchEulerDiscreteScheduler
|
8 |
import torch
|
|
|
16 |
else:
|
17 |
torch_dtype = torch.bfloat16
|
18 |
|
19 |
+
tokenizer = CLIPTokenizer.from_pretrained(
|
20 |
+
"openai/clip-vit-base-patch32", # or clip-vit-large if you prefer
|
|
|
21 |
use_fast=True
|
22 |
)
|
23 |
+
feature_extractor = CLIPFeatureExtractor.from_pretrained(
|
24 |
+
"openai/clip-vit-base-patch32"
|
|
|
25 |
)
|
26 |
|
27 |
# 3) Dispatch & load in FP16 with offloading
|