(
        self, path: Union[str, Path], *, exclude: Iterable[str] = tuple()
    )
return self
Load the pipe from disk.

        path (str / Path): Path to a directory.
        exclude (Iterable[str]): String names of serialization fields to exclude.
        RETURNS (Transformer): The loaded object.

        DOCS: https://spacy.io/api/transformer#from_disk
Load the pipe from disk.
Load the pipe from disk .
def from_disk(
        self, path: Union[str, Path], *, exclude: Iterable[str] = tuple()
    ) -> "Transformer":
        """Load the pipe from disk.

        path (str / Path): Path to a directory.
        exclude (Iterable[str]): String names of serialization fields to exclude.
        RETURNS (Transformer): The loaded object.

        DOCS: https://spacy.io/api/transformer#from_disk
        """

        def load_model(p):
            try:
                with open(p, "rb") as mfile:
                    self.model.from_bytes(mfile.read())
            except AttributeError:
                raise ValueError(Errors.E149) from None
            except (IsADirectoryError, PermissionError):
                warn_msg = (
                    "Automatically converting a transformer component "
                    "from spacy-transformers v1.0 to v1.1+. If you see errors "
                    "or degraded performance, download a newer compatible "
                    "model or retrain your custom model with the current "
                    "spacy-transformers version. For more details and "
                    "available updates, run: python -m spacy validate"
                )
                warnings.warn(warn_msg)
                p = Path(p).absolute()
                hf_model = huggingface_from_pretrained(
                    p,
                    self.model._init_tokenizer_config,
                    self.model._init_transformer_config,
                )
                self.model.attrs["set_transformer"](self.model, hf_model)

        deserialize = {
            "vocab": self.vocab.from_disk,
            "cfg": lambda p: self.cfg.update(deserialize_config(p)),
            "model": load_model,
        }
        util.from_disk(path, deserialize, exclude)
        return self
def from_disk ( self , path : Union [ str , Path ] , * , exclude : Iterable [ str ] = tuple ( ) ) -> "Transformer" : def load_model ( p ) : try : with open ( p , "rb" ) as mfile : self . model . from_bytes ( mfile . read ( ) ) except AttributeError : raise ValueError ( Errors . E149 ) from None except ( IsADirectoryError , PermissionError ) : warn_msg = ( "Automatically converting a transformer component " "from spacy-transformers v1.0 to v1.1+. If you see errors " "or degraded performance, download a newer compatible " "model or retrain your custom model with the current " "spacy-transformers version. For more details and " "available updates, run: python -m spacy validate" ) warnings . warn ( warn_msg ) p = Path ( p ) . absolute ( ) hf_model = huggingface_from_pretrained ( p , self . model . _init_tokenizer_config , self . model . _init_transformer_config , ) self . model . attrs [ "set_transformer" ] ( self . model , hf_model ) deserialize = { "vocab" : self . vocab . from_disk , "cfg" : lambda p : self . cfg . update ( deserialize_config ( p ) ) , "model" : load_model , } util . from_disk ( path , deserialize , exclude ) return self