silveroxides commited on
Commit
fd40cc4
1 Parent(s): 46528f5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -4,10 +4,11 @@ import random
4
 
5
  import spaces
6
  from diffusers import DiffusionPipeline
7
- from transformers import T5EncoderModel
8
  import torch
9
 
10
  device = "cuda" if torch.cuda.is_available() else "cpu"
 
11
  text_encoder_3_repo = "silveroxides/t5xxl_flan_enc"
12
  model_repo_id = "stabilityai/stable-diffusion-3.5-large-turbo"
13
 
@@ -15,8 +16,9 @@ if torch.cuda.is_available():
15
  torch_dtype = torch.bfloat16
16
  else:
17
  torch_dtype = torch.float32
 
18
  text_encoder_3 = T5EncoderModel.from_pretrained(text_encoder_3_repo, torch_dtype=torch_dtype)
19
- pipe = DiffusionPipeline.from_pretrained(model_repo_id, text_encoder_3=text_encoder_3, torch_dtype=torch_dtype)
20
  pipe = pipe.to(device)
21
 
22
  MAX_SEED = np.iinfo(np.int32).max
 
4
 
5
  import spaces
6
  from diffusers import DiffusionPipeline
7
+ from transformers import T5EncoderModel, CLIPTextModel
8
  import torch
9
 
10
  device = "cuda" if torch.cuda.is_available() else "cpu"
11
+ text_encoder_repo = "silveroxides/diffusers-long-clip"
12
  text_encoder_3_repo = "silveroxides/t5xxl_flan_enc"
13
  model_repo_id = "stabilityai/stable-diffusion-3.5-large-turbo"
14
 
 
16
  torch_dtype = torch.bfloat16
17
  else:
18
  torch_dtype = torch.float32
19
+ text_encoder = CLIPTextModel.from_pretrained(text_encoder_repo, torch_dtype=torch_dtype)
20
  text_encoder_3 = T5EncoderModel.from_pretrained(text_encoder_3_repo, torch_dtype=torch_dtype)
21
+ pipe = DiffusionPipeline.from_pretrained(model_repo_id, text_encoder=text_encoder, text_encoder_3=text_encoder_3, torch_dtype=torch_dtype)
22
  pipe = pipe.to(device)
23
 
24
  MAX_SEED = np.iinfo(np.int32).max