class_docstr: spaCy backend for NER.
class_docstr_tok: ["spaCy","backend","for","NER","."]
code: def initialize(self):
      # We need to initialize the model on the GPU if needed.
      with self._select_device():
          self.pipeline = spacy.load(self._model_name_or_path)
  
      if not self.pipeline.has_pipe("ner"):
          raise ComponentError(
              f"spaCy pipeline '{self._model_name_or_path}' does not contain an NER component"
          )
  
      # Disable unnecessary pipes.
      pipes_to_keep = (
          "ner",
          "tok2vec",
          "transformer",
          "curated_transformer",
      )
      for name in self.pipeline.pipe_names:
          if name not in pipes_to_keep:
              self.pipeline.disable_pipe(name)
  
      self._pipeline_kwargs = {
          k: v
          for k, v in self._pipeline_kwargs.items()
          if k not in ("texts", "batch_size")
      }
  
imports: from abc import ABC, abstractmethod
  from contextlib import contextmanager
  from dataclasses import dataclass
  from enum import Enum, EnumMeta
  from typing import Any, Dict, List, Optional, Union
  from ...None import ComponentError, DeserializationError, Document, component, default_from_dict, default_to_dict
  from ...lazy_imports import LazyImport
label_desc: Use image node_id 2 for calling the _SpacyBackend obj's underlying member method code with example usage: obj.initialize() without return types