Spaces:
Running
on
Zero
Running
on
Zero
gokaygokay
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -281,13 +281,13 @@ if __name__ == "__main__":
|
|
281 |
huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
|
282 |
|
283 |
dtype = torch.bfloat16
|
284 |
-
file_url = "https://huggingface.co/gokaygokay/flux-game/blob/main/gokaygokay_00001_.
|
285 |
file_url = file_url.replace("/resolve/main/", "/blob/main/").replace("?download=true", "")
|
286 |
single_file_base_model = "camenduru/FLUX.1-dev-diffusers"
|
287 |
quantization_config_tf = BitsAndBytesConfigTF(load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_use_double_quant=True, bnb_4bit_compute_dtype=torch.bfloat16)
|
288 |
text_encoder_2 = T5EncoderModel.from_pretrained(single_file_base_model, subfolder="text_encoder_2", torch_dtype=dtype, config=single_file_base_model, quantization_config=quantization_config_tf, token=huggingface_token)
|
289 |
if ".gguf" in file_url:
|
290 |
-
transformer =
|
291 |
else:
|
292 |
quantization_config = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_use_double_quant=True, bnb_4bit_compute_dtype=torch.bfloat16, token=huggingface_token)
|
293 |
transformer = FluxTransformer2DModel.from_single_file(file_url, subfolder="transformer", torch_dtype=dtype, config=single_file_base_model, quantization_config=quantization_config, token=huggingface_token)
|
|
|
281 |
huggingface_token = os.getenv("HUGGINGFACE_TOKEN")
|
282 |
|
283 |
dtype = torch.bfloat16
|
284 |
+
file_url = "https://huggingface.co/gokaygokay/flux-game/blob/main/gokaygokay_00001_.q5_1.gguf"
|
285 |
file_url = file_url.replace("/resolve/main/", "/blob/main/").replace("?download=true", "")
|
286 |
single_file_base_model = "camenduru/FLUX.1-dev-diffusers"
|
287 |
quantization_config_tf = BitsAndBytesConfigTF(load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_use_double_quant=True, bnb_4bit_compute_dtype=torch.bfloat16)
|
288 |
text_encoder_2 = T5EncoderModel.from_pretrained(single_file_base_model, subfolder="text_encoder_2", torch_dtype=dtype, config=single_file_base_model, quantization_config=quantization_config_tf, token=huggingface_token)
|
289 |
if ".gguf" in file_url:
|
290 |
+
transformer = FluxTransformer2DModel.from_single_file(file_url, subfolder="transformer", quantization_config=GGUFQuantizationConfig(compute_dtype=dtype), torch_dtype=dtype, config=single_file_base_model)
|
291 |
else:
|
292 |
quantization_config = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_quant_type="nf4", bnb_4bit_use_double_quant=True, bnb_4bit_compute_dtype=torch.bfloat16, token=huggingface_token)
|
293 |
transformer = FluxTransformer2DModel.from_single_file(file_url, subfolder="transformer", torch_dtype=dtype, config=single_file_base_model, quantization_config=quantization_config, token=huggingface_token)
|