examples/research_projects/vqgan-clip/VQGAN_CLIP.py/VQGAN_CLIP/process_prompts
class VQGAN_CLIP:    def process_prompts(self, prompts):
        if not prompts:
            return []
        processed_prompts = []
        weights = []
        if isinstance(prompts, str):
            prompts = [prompt.strip() for prompt in prompts.split("|")]
        for prompt in prompts:
            if isinstance(prompt, (tuple, list)):
                processed_prompt = prompt[0]
                weight = float(prompt[1])
            elif ":" in prompt:
                processed_prompt, weight = prompt.split(":")
                weight = float(weight)
            else:
                processed_prompt = prompt
                weight = 1.0
            processed_prompts.append(processed_prompt)
            weights.append(weight)
        return {
            "prompts": processed_prompts,
            "weights": torch.tensor(weights, device=self.device),
        }