gokaygokay commited on
Commit
f245ce8
·
1 Parent(s): 9ed763c
Files changed (1) hide show
  1. app.py +9 -7
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
- flux_pipeline = DiffusionPipeline.from_pretrained(
280
- "black-forest-labs/FLUX.1-dev",
281
- torch_dtype=torch.bfloat16,
282
- token = huggingface_token
283
- )
284
- flux_pipeline.load_lora_weights("gokaygokay/Flux-Game-Assets-LoRA-v2")
285
- flux_pipeline = flux_pipeline.to(device)
 
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")