1inkusFace commited on
Commit
5428564
·
verified ·
1 Parent(s): 3ee37e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -66,9 +66,9 @@ pipe = StableDiffusion3Pipeline.from_pretrained(
66
  "ford442/stable-diffusion-3.5-large-bf16",
67
  # vae=AutoencoderKL.from_pretrained("ford442/stable-diffusion-3.5-large-fp32", use_safetensors=True, subfolder='vae',token=True),
68
  #scheduler = FlowMatchHeunDiscreteScheduler.from_pretrained('ford442/stable-diffusion-3.5-large-bf16', subfolder='scheduler',token=True),
69
- # text_encoder=CLIPTextModelWithProjection.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", subfolder='text_encoder', token=True),
70
- # text_encoder_2=CLIPTextModelWithProjection.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", subfolder='text_encoder_2',token=True),
71
- # text_encoder_3=T5EncoderModel.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", subfolder='text_encoder_3',token=True),
72
  #tokenizer=CLIPTokenizer.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", add_prefix_space=True, subfolder="tokenizer", token=True),
73
  #tokenizer_2=CLIPTokenizer.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", add_prefix_space=True, subfolder="tokenizer_2", token=True),
74
  tokenizer_3=T5TokenizerFast.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", use_fast=True, subfolder="tokenizer_3", token=True),
@@ -81,6 +81,10 @@ pipe = StableDiffusion3Pipeline.from_pretrained(
81
 
82
  pipe.to(device)
83
 
 
 
 
 
84
  upscaler_2 = UpscaleWithModel.from_pretrained("Kim2091/ClearRealityV1").to(torch.device("cuda:0"))
85
 
86
  MAX_SEED = np.iinfo(np.int32).max
@@ -111,6 +115,9 @@ def infer(
111
  image_encoder_path=None,
112
  progress=gr.Progress(track_tqdm=True),
113
  ):
 
 
 
114
  upscaler_2.to(torch.device('cpu'))
115
  torch.set_float32_matmul_precision("highest")
116
  seed = random.randint(0, MAX_SEED)
 
66
  "ford442/stable-diffusion-3.5-large-bf16",
67
  # vae=AutoencoderKL.from_pretrained("ford442/stable-diffusion-3.5-large-fp32", use_safetensors=True, subfolder='vae',token=True),
68
  #scheduler = FlowMatchHeunDiscreteScheduler.from_pretrained('ford442/stable-diffusion-3.5-large-bf16', subfolder='scheduler',token=True),
69
+ text_encoder=None, #CLIPTextModelWithProjection.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", subfolder='text_encoder', token=True),
70
+ text_encoder_2=None, #CLIPTextModelWithProjection.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", subfolder='text_encoder_2',token=True),
71
+ text_encoder_3=None, #T5EncoderModel.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", subfolder='text_encoder_3',token=True),
72
  #tokenizer=CLIPTokenizer.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", add_prefix_space=True, subfolder="tokenizer", token=True),
73
  #tokenizer_2=CLIPTokenizer.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", add_prefix_space=True, subfolder="tokenizer_2", token=True),
74
  tokenizer_3=T5TokenizerFast.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", use_fast=True, subfolder="tokenizer_3", token=True),
 
81
 
82
  pipe.to(device)
83
 
84
+ text_encoder=CLIPTextModelWithProjection.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", subfolder='text_encoder', token=True).to(device=device, dtype=torch.bfloat16)
85
+ text_encoder_2=CLIPTextModelWithProjection.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", subfolder='text_encoder_2',token=True).to(device=device, dtype=torch.bfloat16)
86
+ text_encoder_3=T5EncoderModel.from_pretrained("ford442/stable-diffusion-3.5-large-bf16", subfolder='text_encoder_3',token=True).to(device=device, dtype=torch.bfloat16)
87
+
88
  upscaler_2 = UpscaleWithModel.from_pretrained("Kim2091/ClearRealityV1").to(torch.device("cuda:0"))
89
 
90
  MAX_SEED = np.iinfo(np.int32).max
 
115
  image_encoder_path=None,
116
  progress=gr.Progress(track_tqdm=True),
117
  ):
118
+ pipe.text_encoder=text_encoder
119
+ pipe.text_encoder_2=text_encoder_2
120
+ pipe.text_encoder_3=text_encoder_3
121
  upscaler_2.to(torch.device('cpu'))
122
  torch.set_float32_matmul_precision("highest")
123
  seed = random.randint(0, MAX_SEED)