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."""
      texts = [
          self.tokenizer.decode(ids[self.input_length :])
          for ids in input_ids
      ]
      dones = [
          any(stop_word in text for stop_word in self.stop_words)
          for text in texts
      ]
      return all(dones)
  
imports: import time
  import json
  from tqdm import tqdm
  from argparse import ArgumentParser
  from typing import Dict, List
  from threading import Thread
  import torch
  import uvicorn
  from fastapi import FastAPI
  from fastapi.responses import JSONResponse
  from fastapi.middleware.cors import CORSMiddleware
  from pydantic import BaseModel
  from transformers import AutoTokenizer
  from bigdl.llm.transformers import AutoModelForCausalLM, AutoModel
  from transformers.generation import GenerationConfig, TextIteratorStreamer
  from transformers import StoppingCriteriaList, StoppingCriteria
  from sse_starlette.sse import EventSourceResponse
label_desc: Use image node_id 2 for calling the StopWordsCriteria obj's underlying member method code with example usage: obj.__call__(input_ids, scores) and returns: all