class_docstr: Uses the OpenCLIP vision transformer encoder for images
class_docstr_tok: ["Uses","the","OpenCLIP","vision","transformer","encoder","for","images"]
code: def __init__(
      self,
      arch="ViT-H-14",
      version="laion2b_s32b_b79k",
      device="cuda",
      max_length=77,
      freeze=True,
      layer="pooled",
      antialias=True,
      ucg_rate=0.0,
  ):
      super().__init__()
      model, _, _ = open_clip.create_model_and_transforms(
          arch,
          device=torch.device("cpu"),
          pretrained=version,
      )
      del model.transformer
      self.model = model
  
      self.device = device
      self.max_length = max_length
      if freeze:
          self.freeze()
      self.layer = layer
      if self.layer == "penultimate":
          raise NotImplementedError()
          self.layer_idx = 1
  
      self.antialias = antialias
  
      self.register_buffer(
          "mean",
          torch.Tensor([0.48145466, 0.4578275, 0.40821073]),
          persistent=False,
      )
      self.register_buffer(
          "std",
          torch.Tensor([0.26862954, 0.26130258, 0.27577711]),
          persistent=False,
      )
      self.ucg_rate = ucg_rate
  
imports: import torch
  import torch.nn
  import kornia
  from torch.utils.checkpoint import checkpoint
  from transformers import T5Tokenizer, T5EncoderModel, CLIPTokenizer, CLIPTextModel
  import open_clip
  from ldm.util import default, count_params, autocast
  from ldm.modules.diffusionmodules.upscaling import ImageConcatWithNoiseAugmentation
  from ldm.modules.diffusionmodules.openaimodel import Timestep
label_desc: Use image node_id 1 to create a new FrozenOpenCLIPImageEmbedder object from inherited base classes: AbstractEncoder with example: obj = FrozenOpenCLIPImageEmbedder(arch, version, device, max_length, freeze, layer, antialias, ucg_rate)