class_docstr: spaCy pipeline component that provides access to a transformer model from
  the Huggingface transformers library. Usually you will connect subsequent
  components to the shared transformer using the TransformerListener layer.
  This works similarly to spaCy's Tok2Vec component and Tok2VecListener
  sublayer.
  
  The activations from the transformer are saved in the doc._.trf_data extension
  attribute. You can also provide a callback to set additional annotations.
  
  vocab (Vocab): The Vocab object for the pipeline.
  model (Model[List[Doc], FullTransformerBatch]): A thinc Model object wrapping
      the transformer. Usually you will want to use the TransformerModel
      layer for this.
  set_extra_annotations (Callable[[List[Doc], FullTransformerBatch], None]): A
      callback to set additional information onto the batch of `Doc` objects.
      The doc._.trf_data attribute is set prior to calling the callback.
      By default, no additional annotations are set.
docstr: Assign the extracted features to the Doc objects. By default, the
  TransformerData object is written to the doc._.trf_data attribute. Your
  set_extra_annotations callback is then called, if provided.
  
  docs (Iterable[Doc]): The documents to modify.
  predictions: (FullTransformerBatch): A batch of activations.
  
  DOCS: https://spacy.io/api/pipe#set_annotations
docstr_tok: ["Assign","the","extracted","features","to","the","Doc","objects",".","By","default",",","the","TransformerData","object","is","written","to","the","doc._.trf_data","attribute",".","Your","set_extra_annotations","callback","is","then","called",",","if","provided",".","docs","(","Iterable","[","Doc","]",")",":","The","documents","to","modify",".","predictions",":","(","FullTransformerBatch",")",":","A","batch","of","activations",".","DOCS",":","https",":","\/\/spacy.io\/api\/pipe","#","set_annotations"]
code: def set_annotations(
      self, docs: Iterable[Doc], predictions: FullTransformerBatch
  ) -> None:
      """Assign the extracted features to the Doc objects. By default, the
      TransformerData object is written to the doc._.trf_data attribute. Your
      set_extra_annotations callback is then called, if provided.
  
      docs (Iterable[Doc]): The documents to modify.
      predictions: (FullTransformerBatch): A batch of activations.
  
      DOCS: https://spacy.io/api/pipe#set_annotations
      """
      doc_data = list(predictions.doc_data)
      for doc, data in zip(docs, doc_data):
          doc._.trf_data = data
      self.set_extra_annotations(list(docs), predictions)
  
imports: from typing import List, Callable, Iterable, Iterator, Optional, Dict, Union
  import warnings
  from spacy.language import Language
  from spacy.pipeline.trainable_pipe import TrainablePipe
  from spacy.pipeline.pipe import deserialize_config
  from spacy.tokens import Doc
  from spacy.vocab import Vocab
  from spacy.training import Example, validate_examples
  from spacy import util, Errors
  from spacy.util import minibatch
  from thinc.api import Model, Config, set_dropout_rate, Optimizer
  import srsly
  from pathlib import Path
  from .layers.transformer_model import huggingface_from_pretrained
  from .util import batch_by_length
  from .annotation_setters import null_annotation_setter
  from .data_classes import FullTransformerBatch, TransformerData
  from .layers import TransformerListener
label_desc: Use image node_id 10 for calling the Transformer obj's underlying member method code with example usage: obj.set_annotations(docs, predictions) without return types