code: def cond_fn(
      self, prompts: List[str], grad_scale: float
  ) -> Callable[..., torch.Tensor]:
      with torch.no_grad():
          z_t = self.text_embeddings(prompts)
  
      def cond_fn(x, t, grad_scale=grad_scale, **kwargs):
          with torch.enable_grad():
              x_var = x.detach().requires_grad_(True)
              z_i = self.image_embeddings(x_var, t)
              loss = torch.exp(self.logit_scale) * (z_t * z_i).sum()
              grad = torch.autograd.grad(loss, x_var)[0].detach()
          return grad * grad_scale
  
      return cond_fn
  
file_path: glide-text2im/glide_text2im/clip/model_creation.py
imports: import os
  from functools import lru_cache
  from typing import Any, Callable, Dict, List, Optional, Tuple
  import attr
  import numpy
  import torch
  import torch.nn
  import yaml
  from glide_text2im.tokenizer.simple_tokenizer import SimpleTokenizer
  from .encoders import ImageEncoder, TextEncoder
label_desc: Use image node_id 4 for calling the CLIPModel obj's underlying member method code with example usage: obj.cond_fn(prompts, grad_scale) and returns: cond_fn, unknown