code: def __init__(
      self,
      hypos: List[Chain],
      context: List[Chain],
      references: Optional[List[Chain]] = None,
      score_types: List[str] = REASONING_SCORES,
      model_type: str = SENT_TRANS,
      transformer_model: str = "all-mpnet-base-v2",
      nli_model: str = NLI_MODEL_NAME,
      ppl_model: str = "gpt2-large",
      grammar_model: str = GRAMMAR_CHECK_MODEL_NAME,
      discourse_batch: int = 64,
      coherence_batch: int = 8,
      ppl_batch: int = 16,
      grammar_batch: int = 8,
      random_seed: int = 42,
  ) -> None:
      # set seeds for reproducibility
      torch.manual_seed(random_seed)
      np.random.seed(random_seed)
  
      self.device = (
          torch.device("cuda")
          if torch.cuda.is_available()
          else torch.device("cpu")
      )
      self.references = references
      self.hypos = hypos
      self.context = context
  
      self.score_types = score_types
  
      if contains_embedding_scores(score_types):
          (
              self.sentence_model,
              self.word_model_name,
          ) = self._create_model(model_type, transformer_model)
          # Load model from HuggingFace Hub
          if self.word_model_name:
              self.tokenizer = AutoTokenizer.from_pretrained(
                  self.word_model_name
              )
              self.model = AutoModel.from_pretrained(
                  self.word_model_name
              )
              self.model.eval().to(self.device)
      if contains_nli_scores(score_types):
          # Load model for NLI-type predictions
          self.nli_tokenizer = AutoTokenizer.from_pretrained(nli_model)
          self.nli_model = (
              AutoModelForSequenceClassification.from_pretrained(
                  nli_model
              )
          )
          self.nli_model.eval().to(self.device)
          self.discourse_batch = discourse_batch
          self.coherence_batch = coherence_batch
      if contains_ppl_scores(score_types):
          # Load language model for PPL-based metrics
          self.ppl_model, self.ppl_tokenizer = self._build_ppl_model(
              model_id=ppl_model
          )
          self.cross_entropy_loss = nn.CrossEntropyLoss(
              reduction="none",
              ignore_index=self.ppl_tokenizer.pad_token_id,
          )
          self.ppl_batch = ppl_batch
      if contains_grammar_scores(score_types):
          # Load grammaticality model
          (
              self.grmr_model,
              self.grmr_tokenizer,
          ) = self._build_grammaticality_classifier(
              model_id=grammar_model,
          )
          self.grammar_batch = grammar_batch
  
      self._verify_input()
  
imports: from collections import defaultdict
  import itertools
  import math
  import numpy
  from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
  import torch
  from torch import nn
  from tqdm import tqdm
  from projects.roscoe.utils import cosine_similarity_scaled, embedding_alignment, al_mean
label_desc: Use image node_id 1 to create a new Evaluator object  with example: obj = Evaluator(hypos, context, references, score_types, model_type, transformer_model, nli_model, ppl_model, grammar_model, discourse_batch, coherence_batch, ppl_batch, grammar_batch, random_seed)