Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
bad81d8
1
Parent(s):
3b62d0f
chroma
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import torch
|
|
3 |
import gradio as gr
|
4 |
import os
|
5 |
from diffusers import FluxPipeline
|
6 |
-
from transformers import T5EncoderModel
|
7 |
|
8 |
# Initialize model outside the function
|
9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
@@ -12,14 +12,12 @@ file_url = "https://huggingface.co/lodestones/Chroma/blob/main/chroma-unlocked-v
|
|
12 |
huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
|
13 |
single_file_base_model = "camenduru/FLUX.1-dev-diffusers"
|
14 |
|
15 |
-
|
16 |
-
quantization_config_tf = BitsAndBytesConfigTF(load_in_8bit=True, bnb_8bit_compute_dtype=torch.bfloat16)
|
17 |
text_encoder_2 = T5EncoderModel.from_pretrained(
|
18 |
single_file_base_model,
|
19 |
subfolder="text_encoder_2",
|
20 |
torch_dtype=dtype,
|
21 |
config=single_file_base_model,
|
22 |
-
quantization_config=quantization_config_tf,
|
23 |
token=huggingface_token
|
24 |
)
|
25 |
|
|
|
3 |
import gradio as gr
|
4 |
import os
|
5 |
from diffusers import FluxPipeline
|
6 |
+
from transformers import T5EncoderModel
|
7 |
|
8 |
# Initialize model outside the function
|
9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
12 |
huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
|
13 |
single_file_base_model = "camenduru/FLUX.1-dev-diffusers"
|
14 |
|
15 |
+
|
|
|
16 |
text_encoder_2 = T5EncoderModel.from_pretrained(
|
17 |
single_file_base_model,
|
18 |
subfolder="text_encoder_2",
|
19 |
torch_dtype=dtype,
|
20 |
config=single_file_base_model,
|
|
|
21 |
token=huggingface_token
|
22 |
)
|
23 |
|