code: def benchmark(
      nlp: Language,
      docs: List[Doc],
      n_batches: int,
      batch_size: int,
      shuffle: bool,
  ) -> numpy.ndarray:
      if shuffle:
          bench_docs = [
              nlp.make_doc(random.choice(docs).text)
              for _ in range(n_batches * batch_size)
          ]
      else:
          bench_docs = [
              nlp.make_doc(docs[i % len(docs)].text)
              for i in range(n_batches * batch_size)
          ]
  
      return annotate(nlp, bench_docs, batch_size)
  
imports: import random
  import time
  from itertools import islice
  from pathlib import Path
  from typing import Iterable, List, Optional
  import numpy
  import typer
  from tqdm import tqdm
  from wasabi import msg
  from ..None import util
  from ..language import Language
  from ..tokens import Doc
  from ..training import Corpus
  from ._util import Arg, Opt, benchmark_cli, setup_gpu
label_desc: Use image node_id 3 for calling a global function with example usage: benchmark(nlp, docs, n_batches, batch_size, shuffle) and returns: annotate