docstr: Uses a pre-trained grammar check model to score each step.
  
  Passes `steps` directly to the model, so should be called with a number of steps
  that will fit in memory.
docstr_tok: ["Uses","a","pre-trained","grammar","check","model","to","score","each","step",".","Passes","`","steps","`","directly","to","the","model",",","so","should","be","called","with","a","number","of","steps","that","will","fit","in","memory","."]
code: def check_grammar_batch(self, steps: List[str]) -> List[float]:
      """
      Uses a pre-trained grammar check model to score each step.
  
      Passes `steps` directly to the model, so should be called with a number of steps
      that will fit in memory.
      """
      encodings = self.grmr_tokenizer(
          steps,
          return_tensors="pt",
          padding=True,
          truncation=True,
      ).to(self.device)
      with torch.no_grad():
          logits = self.grmr_model(**encodings).logits
          probs = torch.softmax(logits, dim=-1)
      # 0=correct, 1=incorrect
      return probs[:, 0].tolist()
  
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 23 for calling the Evaluator obj's underlying member method code with example usage: obj.check_grammar_batch(steps) and returns: probs