asp2131 commited on
Commit
4ff1b6c
·
verified ·
1 Parent(s): b1080e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -68,9 +68,17 @@ repo_id = "black-forest-labs/FLUX.1-dev" # Verify if it's 1 or 2 on the official
68
  hf_token = os.environ.get("HF_TOKEN")
69
 
70
  # Load the transformer with the token
 
 
 
 
 
 
71
  dit = Flux2Transformer2DModel.from_pretrained(
72
  "black-forest-labs/FLUX.2-dev",
73
  subfolder="transformer",
 
 
74
  token=os.environ.get("HF_TOKEN"),
75
  )
76
 
 
68
  hf_token = os.environ.get("HF_TOKEN")
69
 
70
  # Load the transformer with the token
71
+ nf4_config = DiffBitsAndBytesConfig(
72
+ load_in_4bit=True,
73
+ bnb_4bit_quant_type="nf4",
74
+ bnb_4bit_compute_dtype=torch.bfloat16,
75
+ )
76
+
77
  dit = Flux2Transformer2DModel.from_pretrained(
78
  "black-forest-labs/FLUX.2-dev",
79
  subfolder="transformer",
80
+ quantization_config=nf4_config,
81
+ torch_dtype=torch.bfloat16,
82
  token=os.environ.get("HF_TOKEN"),
83
  )
84