class_docstr: Custom `StoppingCriteria` which checks if all generated functions in the batch are completed.
class_docstr_tok: ["Custom","`","StoppingCriteria","`","which","checks","if","all","generated","functions","in","the","batch","are","completed","."]
docstr: Returns true if all generated sequences contain any of the end-of-function strings.
docstr_tok: ["Returns","true","if","all","generated","sequences","contain","any","of","the","end-of-function","strings","."]
code: def __call__(self, input_ids, scores, **kwargs):
      """Returns true if all generated sequences contain any of the end-of-function strings."""
      decoded_generations = self.tokenizer.batch_decode(
          input_ids[:, self.start_length :]
      )
      done = []
      for decoded_generation in decoded_generations:
          done.append(
              any(
                  [
                      stop_string in decoded_generation
                      for stop_string in self.eof_strings
                  ]
              )
          )
      return all(done)
  
imports: import json
  import multiprocessing
  import os
  import re
  from collections import defaultdict
  import torch
  from datasets import load_dataset, load_metric
  from torch.utils.data import IterableDataset
  from torch.utils.data.dataloader import DataLoader
  from tqdm import tqdm
  import transformers
  from accelerate import Accelerator
  from accelerate.utils import set_seed
  from arguments import HumanEvalArguments
  from transformers import AutoModelForCausalLM, AutoTokenizer, HfArgumentParser, StoppingCriteria, StoppingCriteriaList
label_desc: Use image node_id 2 for calling the EndOfFunctionCriteria obj's underlying member method code with example usage: obj.__call__(input_ids, scores) and returns: all