class_docstr: A UNetModel that conditions on text with an encoding transformer.
  
  Expects an extra kwarg `tokens` of text.
  
  :param text_ctx: number of text tokens to expect.
  :param xf_width: width of the transformer.
  :param xf_layers: depth of the transformer.
  :param xf_heads: heads in the transformer.
  :param xf_final_ln: use a LayerNorm after the output layer.
  :param tokenizer: the text tokenizer for sampling/vocab size.
code: def get_text_emb(self, tokens, mask):
      assert tokens is not None
  
      if self.cache_text_emb and self.cache is not None:
          assert (
              tokens == self.cache["tokens"]
          ).all(), f"Tokens {tokens.cpu().numpy().tolist()} do not match cache {self.cache['tokens'].cpu().numpy().tolist()}"
          return self.cache
  
      xf_in = self.token_embedding(tokens.long())
      xf_in = xf_in + self.positional_embedding[None]
      if self.xf_padding:
          assert mask is not None
          xf_in = th.where(
              mask[..., None], xf_in, self.padding_embedding[None]
          )
      xf_out = self.transformer(xf_in.to(self.dtype))
      if self.final_ln is not None:
          xf_out = self.final_ln(xf_out)
      xf_proj = self.transformer_proj(xf_out[:, -1])
      xf_out = xf_out.permute(0, 2, 1)  # NLC -> NCL
  
      outputs = dict(xf_proj=xf_proj, xf_out=xf_out)
  
      if self.cache_text_emb:
          self.cache = dict(
              tokens=tokens,
              xf_proj=xf_proj.detach(),
              xf_out=xf_out.detach() if xf_out is not None else None,
          )
  
      return outputs
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from .nn import timestep_embedding
  from .unet import UNetModel
  from .xf import LayerNorm, Transformer, convert_module_to_f16
label_desc: Use image node_id 3 for calling the Text2ImUNet obj's underlying member method code with example usage: obj.get_text_emb(tokens, mask) and returns: outputs, self