def encode_text_with_editing(
        self,
        prompt: Union[str, List[str]],
        prompt_2: Union[str, List[str]],
        pooled_prompt_embeds: Optional[torch.FloatTensor] = None,
        editing_prompt: Optional[List[str]] = None,
        editing_prompt_2: Optional[List[str]] = None,
        editing_prompt_embeds: Optional[torch.FloatTensor] = None,
        pooled_editing_prompt_embeds: Optional[torch.FloatTensor] = None,
        device: Optional[torch.device] = None,
        num_images_per_prompt: int = 1,
        max_sequence_length: int = 512,
        lora_scale: Optional[float] = None,
    ):
        """
        Encode text prompts with editing prompts and negative prompts for semantic guidance.

        Args:
            prompt (`str` or `List[str]`):
                The prompt or prompts to guide image generation.
            prompt_2 (`str` or `List[str]`):
                The prompt or prompts to guide image generation for second tokenizer.
            pooled_prompt_embeds (`torch.FloatTensor`, *optional*):
                Pre-generated pooled text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt weighting.
                If not provided, pooled text embeddings will be generated from `prompt` input argument.
            editing_prompt (`str` or `List[str]`, *optional*):
                The editing prompts for semantic guidance.
            editing_prompt_2 (`str` or `List[str]`, *optional*):
                The editing prompts for semantic guidance for second tokenizer.
            editing_prompt_embeds (`torch.FloatTensor`, *optional*):
                Pre-computed embeddings for editing prompts.
            pooled_editing_prompt_embeds (`torch.FloatTensor`, *optional*):
                Pre-computed pooled embeddings for editing prompts.
            device (`torch.device`, *optional*):
                The device to use for computation.
            num_images_per_prompt (`int`, defaults to 1):
                Number of images to generate per prompt.
            max_sequence_length (`int`, defaults to 512):
                Maximum sequence length for text encoding.
            lora_scale (`float`, *optional*):
                Scale factor for LoRA layers if used.

        Returns:
            tuple[torch.FloatTensor, torch.FloatTensor, torch.FloatTensor, int]:
                A tuple containing the prompt embeddings, pooled prompt embeddings,
                text IDs, and number of enabled editing prompts.
        """
        device = device or self._execution_device

        if prompt is not None and isinstance(prompt, str):
            batch_size = 1
        elif prompt is not None and isinstance(prompt, list):
            batch_size = len(prompt)
        else:
            raise ValueError("Prompt must be provided as string or list of strings")

        # Get base prompt embeddings
        prompt_embeds, pooled_prompt_embeds, text_ids = self.encode_prompt(
            prompt=prompt,
            prompt_2=prompt_2,
            pooled_prompt_embeds=pooled_prompt_embeds,
            device=device,
            num_images_per_prompt=num_images_per_prompt,
            max_sequence_length=max_sequence_length,
            lora_scale=lora_scale,
        )

        # Handle editing prompts
        if editing_prompt_embeds is not None:
            enabled_editing_prompts = int(editing_prompt_embeds.shape[0])
            edit_text_ids = []
        elif editing_prompt is not None:
            editing_prompt_embeds = []
            pooled_editing_prompt_embeds = []
            edit_text_ids = []

            editing_prompt_2 = editing_prompt if editing_prompt_2 is None else editing_prompt_2
            for edit_1, edit_2 in zip(editing_prompt, editing_prompt_2):
                e_prompt_embeds, pooled_embeds, e_ids = self.encode_prompt(
                    prompt=edit_1,
                    prompt_2=edit_2,
                    device=device,
                    num_images_per_prompt=num_images_per_prompt,
                    max_sequence_length=max_sequence_length,
                    lora_scale=lora_scale,
                )
                editing_prompt_embeds.append(e_prompt_embeds)
                pooled_editing_prompt_embeds.append(pooled_embeds)
                edit_text_ids.append(e_ids)

            enabled_editing_prompts = len(editing_prompt)

        else:
            edit_text_ids = []
            enabled_editing_prompts = 0

        if enabled_editing_prompts:
            for idx in range(enabled_editing_prompts):
                editing_prompt_embeds[idx] = torch.cat([editing_prompt_embeds[idx]] * batch_size, dim=0)
                pooled_editing_prompt_embeds[idx] = torch.cat([pooled_editing_prompt_embeds[idx]] * batch_size, dim=0)

        return (
            prompt_embeds,
            pooled_prompt_embeds,
            editing_prompt_embeds,
            pooled_editing_prompt_embeds,
            text_ids,
            edit_text_ids,
            enabled_editing_prompts,
        )

        Encode text prompts with editing prompts and negative prompts for semantic guidance.

        Args:
            prompt (`str` or `List[str]`):
                The prompt or prompts to guide image generation.
            prompt_2 (`str` or `List[str]`):
                The prompt or prompts to guide image generation for second tokenizer.
            pooled_prompt_embeds (`torch.FloatTensor`, *optional*):
                Pre-generated pooled text embeddings. Can be used to easily tweak text inputs, *e.g.* prompt weighting.
                If not provided, pooled text embeddings will be generated from `prompt` input argument.
            editing_prompt (`str` or `List[str]`, *optional*):
                The editing prompts for semantic guidance.
            editing_prompt_2 (`str` or `List[str]`, *optional*):
                The editing prompts for semantic guidance for second tokenizer.
            editing_prompt_embeds (`torch.FloatTensor`, *optional*):
                Pre-computed embeddings for editing prompts.
            pooled_editing_prompt_embeds (`torch.FloatTensor`, *optional*):
                Pre-computed pooled embeddings for editing prompts.
            device (`torch.device`, *optional*):
                The device to use for computation.
            num_images_per_prompt (`int`, defaults to 1):
                Number of images to generate per prompt.
            max_sequence_length (`int`, defaults to 512):
                Maximum sequence length for text encoding.
            lora_scale (`float`, *optional*):
                Scale factor for LoRA layers if used.

        Returns:
            tuple[torch.FloatTensor, torch.FloatTensor, torch.FloatTensor, int]:
                A tuple containing the prompt embeddings, pooled prompt embeddings,
                text IDs, and number of enabled editing prompts.
        
examples/community/pipeline_flux_semantic_guidance.py