LPX55 commited on
Commit
1ed2bd5
·
verified ·
1 Parent(s): 1014999

Update raw.py

Browse files
Files changed (1) hide show
  1. raw.py +18 -13
raw.py CHANGED
@@ -17,15 +17,20 @@ import gradio as gr
17
  huggingface_token = os.getenv("HUGGINFACE_TOKEN")
18
  MAX_SEED = 1000000
19
 
20
- quant_config = TransformersBitsAndBytesConfig(load_in_8bit=True,)
21
- text_encoder_2_8bit = T5EncoderModel.from_pretrained(
 
 
 
 
 
 
 
22
  "LPX55/FLUX.1-merged_uncensored",
23
  subfolder="text_encoder_2",
24
- quantization_config=quant_config,
25
  torch_dtype=torch.bfloat16,
26
  token=huggingface_token
27
  )
28
-
29
  # good_vae = AutoencoderKL.from_pretrained("black-forest-labs/FLUX.1-dev", subfolder="vae", torch_dtype=torch.bfloat16, token=huggingface_token).to("cuda")
30
 
31
  # Load pipeline
@@ -36,7 +41,7 @@ text_encoder_2_8bit = T5EncoderModel.from_pretrained(
36
  pipe = FluxControlNetPipeline.from_pretrained(
37
  "LPX55/FLUX.1M-8step_upscaler-cnet",
38
  torch_dtype=torch.bfloat16,
39
- text_encoder_2=text_encoder_2_8bit,
40
  token=huggingface_token
41
  )
42
  # adapter_id = "alimama-creative/FLUX.1-Turbo-Alpha"
@@ -45,14 +50,14 @@ pipe = FluxControlNetPipeline.from_pretrained(
45
 
46
  pipe.to("cuda")
47
 
48
- try:
49
- pipe.vae.enable_slicing()
50
- except:
51
- print("debug-2")
52
- try:
53
- pipe.vae.enable_tiling()
54
- except:
55
- print("debug-3")
56
 
57
  # pipe.load_lora_weights(adapter_id, adapter_name="turbo")
58
  # pipe.load_lora_weights(adapter_id2, adapter_name="real")
 
17
  huggingface_token = os.getenv("HUGGINFACE_TOKEN")
18
  MAX_SEED = 1000000
19
 
20
+ # quant_config = TransformersBitsAndBytesConfig(load_in_8bit=True,)
21
+ # text_encoder_2_8bit = T5EncoderModel.from_pretrained(
22
+ # "LPX55/FLUX.1-merged_uncensored",
23
+ # subfolder="text_encoder_2",
24
+ # quantization_config=quant_config,
25
+ # torch_dtype=torch.bfloat16,
26
+ # token=huggingface_token
27
+ # )
28
+ text_encoder_2_unquant = T5EncoderModel.from_pretrained(
29
  "LPX55/FLUX.1-merged_uncensored",
30
  subfolder="text_encoder_2",
 
31
  torch_dtype=torch.bfloat16,
32
  token=huggingface_token
33
  )
 
34
  # good_vae = AutoencoderKL.from_pretrained("black-forest-labs/FLUX.1-dev", subfolder="vae", torch_dtype=torch.bfloat16, token=huggingface_token).to("cuda")
35
 
36
  # Load pipeline
 
41
  pipe = FluxControlNetPipeline.from_pretrained(
42
  "LPX55/FLUX.1M-8step_upscaler-cnet",
43
  torch_dtype=torch.bfloat16,
44
+ text_encoder_2=text_encoder_2_unquant,
45
  token=huggingface_token
46
  )
47
  # adapter_id = "alimama-creative/FLUX.1-Turbo-Alpha"
 
50
 
51
  pipe.to("cuda")
52
 
53
+ # try:
54
+ # pipe.vae.enable_slicing()
55
+ # except:
56
+ # print("debug-2")
57
+ # try:
58
+ # pipe.vae.enable_tiling()
59
+ # except:
60
+ # print("debug-3")
61
 
62
  # pipe.load_lora_weights(adapter_id, adapter_name="turbo")
63
  # pipe.load_lora_weights(adapter_id2, adapter_name="real")