Spaces:
Running
on
Zero
Running
on
Zero
gokaygokay
commited on
Commit
·
f245ce8
1
Parent(s):
9ed763c
spacesgpu
Browse files
app.py
CHANGED
@@ -273,16 +273,18 @@ with gr.Blocks() as demo:
|
|
273 |
|
274 |
# Initialize both pipelines
|
275 |
if __name__ == "__main__":
|
|
|
276 |
# Initialize Flux pipeline
|
277 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
278 |
huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
|
|
286 |
|
287 |
# Initialize Trellis pipeline
|
288 |
trellis_pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
|
|
|
273 |
|
274 |
# Initialize both pipelines
|
275 |
if __name__ == "__main__":
|
276 |
+
from diffusers import FluxTransformer2DModel, FluxPipeline, BitsAndBytesConfig
|
277 |
# Initialize Flux pipeline
|
278 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
279 |
huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
|
280 |
+
|
281 |
+
quantization_config = BitsAndBytesConfig(load_in_4bit=True)
|
282 |
+
hf_token = ""
|
283 |
+
dtype = torch.bfloat16
|
284 |
+
file_url = "https://huggingface.co/gokaygokay/flux-game/blob/main/gokaygokay_00001_.safetensors"
|
285 |
+
single_file_base_model = "camenduru/FLUX.1-dev-diffusers"
|
286 |
+
transformer = FluxTransformer2DModel.from_single_file(file_url, subfolder="transformer", torch_dtype=dtype, config=single_file_base_model, quantization_config=quantization_config)
|
287 |
+
pipe = FluxPipeline.from_pretrained(single_file_base_model, transformer=transformer, torch_dtype=dtype, token=huggingface_token, quantization_config=quantization_config)
|
288 |
|
289 |
# Initialize Trellis pipeline
|
290 |
trellis_pipeline = TrellisImageTo3DPipeline.from_pretrained("JeffreyXiang/TRELLIS-image-large")
|