code: def process(self, document):
      if hasattr(self, "_variant"):
          return self._variant.process(document)
  
      if any(
          word.upos is None and word.xpos is None
          for sentence in document.sentences
          for word in sentence.words
      ):
          raise ValueError("POS not run before depparse!")
      try:
          batch = DataLoader(
              document,
              self.config["batch_size"],
              self.config,
              self.pretrain,
              vocab=self.vocab,
              evaluation=True,
              sort_during_eval=self.config.get(
                  "sort_during_eval", True
              ),
              min_length_to_batch_separately=self.config.get(
                  "min_length_to_batch_separately",
                  DEFAULT_SEPARATE_BATCH,
              ),
          )
          with torch.no_grad():
              preds = []
              for i, b in enumerate(batch):
                  preds += self.trainer.predict(b)
          if batch.data_orig_idx is not None:
              preds = unsort(preds, batch.data_orig_idx)
          batch.doc.set(
              (doc.HEAD, doc.DEPREL), [y for x in preds for y in x]
          )
          # build dependencies based on predictions
          for sentence in batch.doc.sentences:
              sentence.build_dependencies()
          return batch.doc
      except RuntimeError as e:
          if str(e).startswith("CUDA out of memory. Tried to allocate"):
              new_message = (
                  str(e)
                  + " ... You may be able to compensate for this by separating long sentences into their own batch with a parameter such as depparse_min_length_to_batch_separately=150 or by limiting the overall batch size with depparse_batch_size=400."
              )
              raise RuntimeError(new_message) from e
          else:
              raise
  
file_path: stanza/stanza/pipeline/depparse_processor.py
imports: import torch
  from stanza.models.common import doc
  from stanza.models.common.utils import unsort
  from stanza.models.common.vocab import VOCAB_PREFIX
  from stanza.models.depparse.data import DataLoader
  from stanza.models.depparse.trainer import Trainer
  from stanza.pipeline._constants import *
  from stanza.pipeline.processor import UDProcessor, register_processor
  from stanza.pipeline.external.corenlp_converter_depparse import ConverterDepparse
label_desc: Use image node_id 5 for calling the DepparseProcessor obj's underlying member method code with example usage: obj.process(document) and returns: self, batch