Update pipeline.py
Browse files- pipeline.py +2 -12
pipeline.py
CHANGED
|
@@ -50,21 +50,12 @@ class SuperDiffSDXLPipeline(DiffusionPipeline, ConfigMixin):
|
|
| 50 |
"""
|
| 51 |
super().__init__()
|
| 52 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
| 53 |
-
print("decice", device)
|
| 54 |
|
| 55 |
vae.to(device)
|
| 56 |
unet.to(device)
|
| 57 |
text_encoder.to(device)
|
| 58 |
text_encoder_2.to(device)
|
| 59 |
-
|
| 60 |
-
#vae = AutoencoderKL.from_pretrained(model_path, subfolder="vae").to(device)
|
| 61 |
-
#tokenizer = CLIPTokenizer.from_pretrained(model_path, subfolder="tokenizer")
|
| 62 |
-
#tokenizer_2 = CLIPTokenizer.from_pretrained(model_path, subfolder="tokenizer_2")
|
| 63 |
-
#text_encoder = CLIPTextModel.from_pretrained(model_path, subfolder="text_encoder").to(device, dtype=dtype)
|
| 64 |
-
#text_encoder_2 = CLIPTextModelWithProjection.from_pretrained(model_path, subfolder="text_encoder_2").to(device, dtype=dtype)
|
| 65 |
-
#unet = UNet2DConditionModel.from_pretrained(model_path, subfolder="unet").to(device, dtype=dtype)
|
| 66 |
-
#vae.eval()
|
| 67 |
-
#unet.eval()
|
| 68 |
|
| 69 |
self.register_modules(unet=unet,
|
| 70 |
vae=vae,
|
|
@@ -73,9 +64,8 @@ class SuperDiffSDXLPipeline(DiffusionPipeline, ConfigMixin):
|
|
| 73 |
tokenizer=tokenizer,
|
| 74 |
tokenizer_2=tokenizer_2,
|
| 75 |
)
|
| 76 |
-
|
| 77 |
def prepare_prompt_input(self, prompt_o, prompt_b, batch_size, height, width):
|
| 78 |
-
print("self.device", self.device)
|
| 79 |
text_input = self.tokenizer(prompt_o* batch_size, padding="max_length", max_length=self.tokenizer.model_max_length, truncation=True, return_tensors="pt")
|
| 80 |
text_input_2 = self.tokenizer_2(prompt_o* batch_size, padding="max_length", max_length=self.tokenizer_2.model_max_length, truncation=True, return_tensors="pt")
|
| 81 |
with torch.no_grad():
|
|
|
|
| 50 |
"""
|
| 51 |
super().__init__()
|
| 52 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
|
|
| 53 |
|
| 54 |
vae.to(device)
|
| 55 |
unet.to(device)
|
| 56 |
text_encoder.to(device)
|
| 57 |
text_encoder_2.to(device)
|
| 58 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
self.register_modules(unet=unet,
|
| 61 |
vae=vae,
|
|
|
|
| 64 |
tokenizer=tokenizer,
|
| 65 |
tokenizer_2=tokenizer_2,
|
| 66 |
)
|
| 67 |
+
|
| 68 |
def prepare_prompt_input(self, prompt_o, prompt_b, batch_size, height, width):
|
|
|
|
| 69 |
text_input = self.tokenizer(prompt_o* batch_size, padding="max_length", max_length=self.tokenizer.model_max_length, truncation=True, return_tensors="pt")
|
| 70 |
text_input_2 = self.tokenizer_2(prompt_o* batch_size, padding="max_length", max_length=self.tokenizer_2.model_max_length, truncation=True, return_tensors="pt")
|
| 71 |
with torch.no_grad():
|