AlekseyCalvin commited on
Commit
f152e69
1 Parent(s): 01c68ec

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +0 -15
pipeline.py CHANGED
@@ -163,7 +163,6 @@ class FluxWithCFGPipeline(DiffusionPipeline, FluxLoraLoaderMixin, FromSingleFile
163
  prompt: Union[str, List[str]],
164
  num_images_per_prompt: int = 1,
165
  device: Optional[torch.device] = None,
166
- clip_skip: Optional[int] = None,
167
  ):
168
  device = device or self._execution_device
169
 
@@ -190,11 +189,6 @@ class FluxWithCFGPipeline(DiffusionPipeline, FluxLoraLoaderMixin, FromSingleFile
190
  )
191
  prompt_embeds = self.text_encoder(text_input_ids.to(device), output_hidden_states=False)
192
 
193
- if clip_skip is None:
194
- prompt_embeds = prompt_embeds.hidden_states[-2]
195
- else:
196
- prompt_embeds = prompt_embeds.hidden_states[-(clip_skip + 2)]
197
-
198
  # Use pooled output of CLIPTextModel
199
  prompt_embeds = prompt_embeds.pooler_output
200
  prompt_embeds = prompt_embeds.to(dtype=self.text_encoder.dtype, device=device)
@@ -220,7 +214,6 @@ class FluxWithCFGPipeline(DiffusionPipeline, FluxLoraLoaderMixin, FromSingleFile
220
  pooled_prompt_embeds: Optional[torch.FloatTensor] = None,
221
  negative_pooled_prompt_2_embed: Optional[torch.FloatTensor] = None,
222
  negative_pooled_prompt_embeds: Optional[torch.FloatTensor] = None,
223
- clip_skip: Optional[int] = None,
224
  max_sequence_length: int = 512,
225
  lora_scale: Optional[float] = None,
226
  ):
@@ -258,7 +251,6 @@ class FluxWithCFGPipeline(DiffusionPipeline, FluxLoraLoaderMixin, FromSingleFile
258
  prompt=prompt,
259
  device=device,
260
  num_images_per_prompt=num_images_per_prompt,
261
- clip_skip=clip_skip,
262
  )
263
  prompt_embeds = self._get_t5_prompt_embeds(
264
  prompt=prompt_2,
@@ -293,7 +285,6 @@ class FluxWithCFGPipeline(DiffusionPipeline, FluxLoraLoaderMixin, FromSingleFile
293
  negative_prompt,
294
  device=device,
295
  num_images_per_prompt=num_images_per_prompt,
296
- clip_skip=None,
297
  )
298
  negative_clip_prompt_embeds = torch.cat([negative_prompt_embed, negative_prompt_2_embed], dim=-1)
299
 
@@ -539,7 +530,6 @@ class FluxWithCFGPipeline(DiffusionPipeline, FluxLoraLoaderMixin, FromSingleFile
539
  output_type: Optional[str] = "pil",
540
  return_dict: bool = True,
541
  joint_attention_kwargs: Optional[Dict[str, Any]] = None,
542
- clip_skip: Optional[int] = None,
543
  max_sequence_length: int = 300,
544
  **kwargs,
545
  ):
@@ -562,7 +552,6 @@ class FluxWithCFGPipeline(DiffusionPipeline, FluxLoraLoaderMixin, FromSingleFile
562
  )
563
 
564
  self._guidance_scale = guidance_scale
565
- self._clip_skip = clip_skip
566
  self._joint_attention_kwargs = joint_attention_kwargs
567
  self._interrupt = False
568
 
@@ -597,7 +586,6 @@ class FluxWithCFGPipeline(DiffusionPipeline, FluxLoraLoaderMixin, FromSingleFile
597
  pooled_prompt_embeds=pooled_prompt_embeds,
598
  negative_pooled_prompt_embeds=negative_pooled_prompt_embeds,
599
  device=device,
600
- clip_skip=self.clip_skip,
601
  num_images_per_prompt=num_images_per_prompt,
602
  max_sequence_length=max_sequence_length,
603
  lora_scale=lora_scale,
@@ -723,7 +711,6 @@ class FluxWithCFGPipeline(DiffusionPipeline, FluxLoraLoaderMixin, FromSingleFile
723
  output_type: Optional[str] = "pil",
724
  return_dict: bool = True,
725
  joint_attention_kwargs: Optional[Dict[str, Any]] = None,
726
- clip_skip: Optional[int] = None,
727
  max_sequence_length: int = 300,
728
  **kwargs,
729
  ):
@@ -746,7 +733,6 @@ class FluxWithCFGPipeline(DiffusionPipeline, FluxLoraLoaderMixin, FromSingleFile
746
  )
747
 
748
  self._guidance_scale = guidance_scale
749
- self._clip_skip = clip_skip
750
  self._joint_attention_kwargs = joint_attention_kwargs
751
  self._interrupt = False
752
 
@@ -781,7 +767,6 @@ class FluxWithCFGPipeline(DiffusionPipeline, FluxLoraLoaderMixin, FromSingleFile
781
  pooled_prompt_embeds=pooled_prompt_embeds,
782
  negative_pooled_prompt_embeds=negative_pooled_prompt_embeds,
783
  device=device,
784
- clip_skip=self.clip_skip,
785
  num_images_per_prompt=num_images_per_prompt,
786
  max_sequence_length=max_sequence_length,
787
  lora_scale=lora_scale,
 
163
  prompt: Union[str, List[str]],
164
  num_images_per_prompt: int = 1,
165
  device: Optional[torch.device] = None,
 
166
  ):
167
  device = device or self._execution_device
168
 
 
189
  )
190
  prompt_embeds = self.text_encoder(text_input_ids.to(device), output_hidden_states=False)
191
 
 
 
 
 
 
192
  # Use pooled output of CLIPTextModel
193
  prompt_embeds = prompt_embeds.pooler_output
194
  prompt_embeds = prompt_embeds.to(dtype=self.text_encoder.dtype, device=device)
 
214
  pooled_prompt_embeds: Optional[torch.FloatTensor] = None,
215
  negative_pooled_prompt_2_embed: Optional[torch.FloatTensor] = None,
216
  negative_pooled_prompt_embeds: Optional[torch.FloatTensor] = None,
 
217
  max_sequence_length: int = 512,
218
  lora_scale: Optional[float] = None,
219
  ):
 
251
  prompt=prompt,
252
  device=device,
253
  num_images_per_prompt=num_images_per_prompt,
 
254
  )
255
  prompt_embeds = self._get_t5_prompt_embeds(
256
  prompt=prompt_2,
 
285
  negative_prompt,
286
  device=device,
287
  num_images_per_prompt=num_images_per_prompt,
 
288
  )
289
  negative_clip_prompt_embeds = torch.cat([negative_prompt_embed, negative_prompt_2_embed], dim=-1)
290
 
 
530
  output_type: Optional[str] = "pil",
531
  return_dict: bool = True,
532
  joint_attention_kwargs: Optional[Dict[str, Any]] = None,
 
533
  max_sequence_length: int = 300,
534
  **kwargs,
535
  ):
 
552
  )
553
 
554
  self._guidance_scale = guidance_scale
 
555
  self._joint_attention_kwargs = joint_attention_kwargs
556
  self._interrupt = False
557
 
 
586
  pooled_prompt_embeds=pooled_prompt_embeds,
587
  negative_pooled_prompt_embeds=negative_pooled_prompt_embeds,
588
  device=device,
 
589
  num_images_per_prompt=num_images_per_prompt,
590
  max_sequence_length=max_sequence_length,
591
  lora_scale=lora_scale,
 
711
  output_type: Optional[str] = "pil",
712
  return_dict: bool = True,
713
  joint_attention_kwargs: Optional[Dict[str, Any]] = None,
 
714
  max_sequence_length: int = 300,
715
  **kwargs,
716
  ):
 
733
  )
734
 
735
  self._guidance_scale = guidance_scale
 
736
  self._joint_attention_kwargs = joint_attention_kwargs
737
  self._interrupt = False
738
 
 
767
  pooled_prompt_embeds=pooled_prompt_embeds,
768
  negative_pooled_prompt_embeds=negative_pooled_prompt_embeds,
769
  device=device,
 
770
  num_images_per_prompt=num_images_per_prompt,
771
  max_sequence_length=max_sequence_length,
772
  lora_scale=lora_scale,