class_docstr: Performs Textual Inversion fine-tuning on a Determined cluster.
class_docstr_tok: ["Performs","Textual","Inversion","fine-tuning","on","a","Determined","cluster","."]
code: def _get_encoder_hidden_states(self, text: List[str]) -> torch.Tensor:
      tokenized_text = self.tokenizer(
          text,
          padding="max_length",
          truncation=True,
          max_length=self.tokenizer.model_max_length,
          return_tensors="pt",
      ).input_ids
      encoder_hidden_states = self.text_encoder(
          tokenized_text
      ).last_hidden_state
      return encoder_hidden_states
  
imports: import json
  import os
  import pathlib
  from collections import defaultdict
  from typing import List, Literal, Optional, Sequence, Union
  import accelerate
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from detsd import data, defaults, layers, utils
  from diffusers import AutoencoderKL, DDPMScheduler, StableDiffusionPipeline, UNet2DConditionModel
  from diffusers.pipelines.stable_diffusion import StableDiffusionSafetyChecker
  from torch.utils.data import DataLoader
  from torch.utils.tensorboard import SummaryWriter
  from transformers import CLIPFeatureExtractor, CLIPTextModel, CLIPTokenizer
  import determined
  from determined.pytorch import TorchData
label_desc: Use image node_id 4 for calling the DetSDTextualInversionTrainer obj's underlying member method code with example usage: obj._get_encoder_hidden_states(text) and returns: encoder_hidden_states