def from_config(
        cls,
        config: Union[Dict[str, Any], Config] = {},
        *,
        vocab: Union[Vocab, bool] = True,
        disable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES,
        enable: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES,
        exclude: Union[str, Iterable[str]] = _DEFAULT_EMPTY_PIPES,
        meta: Dict[str, Any] = SimpleFrozenDict(),
        auto_fill: bool = True,
        validate: bool = True,
    ) -> "Language":
        """Create the nlp object from a loaded config. Will set up the tokenizer
        and language data, add pipeline components etc. If no config is provided,
        the default config of the given language is used.

        config (Dict[str, Any] / Config): The loaded config.
        vocab (Vocab): A Vocab object. If True, a vocab is created.
        disable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to disable.
            Disabled pipes will be loaded but they won't be run unless you
            explicitly enable them by calling nlp.enable_pipe.
        enable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to enable. All other
            pipes will be disabled (and can be enabled using `nlp.enable_pipe`).
        exclude (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to exclude.
            Excluded components won't be loaded.
        meta (Dict[str, Any]): Meta overrides for nlp.meta.
        auto_fill (bool): Automatically fill in missing values in config based
            on defaults and function argument annotations.
        validate (bool): Validate the component config and arguments against
            the types expected by the factory.
        RETURNS (Language): The initialized Language class.

        DOCS: https://spacy.io/api/language#from_config
        """
        if auto_fill:
            config = Config(
                cls.default_config, section_order=CONFIG_SECTION_ORDER
            ).merge(config)
        if "nlp" not in config:
            raise ValueError(Errors.E985.format(config=config))
        # fill in [nlp.vectors] if not present (as a narrower alternative to
        # auto-filling [nlp] from the default config)
        if "vectors" not in config["nlp"]:
            config["nlp"]["vectors"] = {"@vectors": "spacy.Vectors.v1"}
        config_lang = config["nlp"].get("lang")
        if config_lang is not None and config_lang != cls.lang:
            raise ValueError(
                Errors.E958.format(
                    bad_lang_code=config["nlp"]["lang"],
                    lang_code=cls.lang,
                    lang=util.get_object_name(cls),
                )
            )
        config["nlp"]["lang"] = cls.lang
        # This isn't very elegant, but we remove the [components] block here to prevent
        # it from getting resolved (causes problems because we expect to pass in
        # the nlp and name args for each component). If we're auto-filling, we're
        # using the nlp.config with all defaults.
        config = util.copy_config(config)
        orig_pipeline = config.pop("components", {})
        orig_pretraining = config.pop("pretraining", None)
        config["components"] = {}
        if auto_fill:
            filled = registry.fill(config, validate=validate, schema=ConfigSchema)
        else:
            filled = config
        filled["components"] = orig_pipeline
        config["components"] = orig_pipeline
        if orig_pretraining is not None:
            filled["pretraining"] = orig_pretraining
            config["pretraining"] = orig_pretraining
        resolved_nlp = registry.resolve(
            filled["nlp"], validate=validate, schema=ConfigSchemaNlp
        )
        create_tokenizer = resolved_nlp["tokenizer"]
        create_vectors = resolved_nlp["vectors"]
        before_creation = resolved_nlp["before_creation"]
        after_creation = resolved_nlp["after_creation"]
        after_pipeline_creation = resolved_nlp["after_pipeline_creation"]
        lang_cls = cls
        if before_creation is not None:
            lang_cls = before_creation(cls)
            if (
                not isinstance(lang_cls, type)
                or not issubclass(lang_cls, cls)
                or lang_cls is not cls
            ):
                raise ValueError(Errors.E943.format(value=type(lang_cls)))

        # Warn about require_gpu usage in jupyter notebook
        warn_if_jupyter_cupy()

        # Note that we don't load vectors here, instead they get loaded explicitly
        # inside stuff like the spacy train function. If we loaded them here,
        # then we would load them twice at runtime: once when we make from config,
        # and then again when we load from disk.
        nlp = lang_cls(
            vocab=vocab,
            create_tokenizer=create_tokenizer,
            create_vectors=create_vectors,
            meta=meta,
        )
        if after_creation is not None:
            nlp = after_creation(nlp)
            if not isinstance(nlp, cls):
                raise ValueError(Errors.E942.format(name="creation", value=type(nlp)))
        # To create the components we need to use the final interpolated config
        # so all values are available (if component configs use variables).
        # Later we replace the component config with the raw config again.
        interpolated = filled.interpolate() if not filled.is_interpolated else filled
        pipeline = interpolated.get("components", {})
        # If components are loaded from a source (existing models), we cache
        # them here so they're only loaded once
        source_nlps = {}
        source_nlp_vectors_hashes = {}
        vocab_b = None
        for pipe_name in config["nlp"]["pipeline"]:
            if pipe_name not in pipeline:
                opts = ", ".join(pipeline.keys())
                raise ValueError(Errors.E956.format(name=pipe_name, opts=opts))
            pipe_cfg = util.copy_config(pipeline[pipe_name])
            raw_config = Config(filled["components"][pipe_name])
            if pipe_name not in exclude:
                if "factory" not in pipe_cfg and "source" not in pipe_cfg:
                    err = Errors.E984.format(name=pipe_name, config=pipe_cfg)
                    raise ValueError(err)
                if "factory" in pipe_cfg:
                    factory = pipe_cfg.pop("factory")
                    # The pipe name (key in the config) here is the unique name
                    # of the component, not necessarily the factory
                    nlp.add_pipe(
                        factory,
                        name=pipe_name,
                        config=pipe_cfg,
                        validate=validate,
                        raw_config=raw_config,
                    )
                else:
                    assert "source" in pipe_cfg
                    # We need the sourced components to reference the same
                    # vocab without modifying the current vocab state **AND**
                    # we still want to load the source model vectors to perform
                    # the vectors check. Since the source vectors clobber the
                    # current ones, we save the original vocab state and
                    # restore after this loop. Existing strings are preserved
                    # during deserialization, so they do not need any
                    # additional handling.
                    if vocab_b is None:
                        vocab_b = nlp.vocab.to_bytes(exclude=["lookups", "strings"])
                    model = pipe_cfg["source"]
                    if model not in source_nlps:
                        # Load with the same vocab, adding any strings
                        source_nlps[model] = util.load_model(
                            model, vocab=nlp.vocab, exclude=["lookups"]
                        )
                    source_name = pipe_cfg.get("component", pipe_name)
                    listeners_replaced = False
                    if "replace_listeners" in pipe_cfg:
                        # Make sure that the listened-to component has the
                        # state of the source pipeline listener map so that the
                        # replace_listeners method below works as intended.
                        source_nlps[model]._link_components()
                        for name, proc in source_nlps[model].pipeline:
                            if source_name in getattr(proc, "listening_components", []):
                                source_nlps[model].replace_listeners(
                                    name, source_name, pipe_cfg["replace_listeners"]
                                )
                                listeners_replaced = True
                    with warnings.catch_warnings():
                        warnings.filterwarnings("ignore", message="\\[W113\\]")
                        nlp.add_pipe(
                            source_name, source=source_nlps[model], name=pipe_name
                        )
                        # At this point after nlp.add_pipe, the listener map
                        # corresponds to the new pipeline.
                    if model not in source_nlp_vectors_hashes:
                        source_nlp_vectors_hashes[model] = hash(
                            source_nlps[model].vocab.vectors.to_bytes(
                                exclude=["strings"]
                            )
                        )
                    if "_sourced_vectors_hashes" not in nlp.meta:
                        nlp.meta["_sourced_vectors_hashes"] = {}
                    nlp.meta["_sourced_vectors_hashes"][
                        pipe_name
                    ] = source_nlp_vectors_hashes[model]
                    # Delete from cache if listeners were replaced
                    if listeners_replaced:
                        del source_nlps[model]
        # Restore the original vocab after sourcing if necessary
        if vocab_b is not None:
            nlp.vocab.from_bytes(vocab_b)

        # Resolve disabled/enabled settings.
        if isinstance(disable, str):
            disable = [disable]
        if isinstance(enable, str):
            enable = [enable]
        if isinstance(exclude, str):
            exclude = [exclude]

        # `enable` should not be merged with `enabled` (the opposite is true for `disable`/`disabled`). If the config
        # specifies values for `enabled` not included in `enable`, emit warning.
        if id(enable) != id(_DEFAULT_EMPTY_PIPES):
            enabled = config["nlp"].get("enabled", [])
            if len(enabled) and not set(enabled).issubset(enable):
                warnings.warn(
                    Warnings.W123.format(
                        enable=enable,
                        enabled=enabled,
                    )
                )

        # Ensure sets of disabled/enabled pipe names are not contradictory.
        disabled_pipes = cls._resolve_component_status(
            list({*disable, *config["nlp"].get("disabled", [])}),
            enable,
            config["nlp"]["pipeline"],
        )
        nlp._disabled = set(p for p in disabled_pipes if p not in exclude)

        nlp.batch_size = config["nlp"]["batch_size"]
        nlp.config = filled if auto_fill else config
        if after_pipeline_creation is not None:
            nlp = after_pipeline_creation(nlp)
            if not isinstance(nlp, cls):
                raise ValueError(
                    Errors.E942.format(name="pipeline_creation", value=type(nlp))
                )
        return nlp
Create the nlp object from a loaded config. Will set up the tokenizer
        and language data, add pipeline components etc. If no config is provided,
        the default config of the given language is used.

        config (Dict[str, Any] / Config): The loaded config.
        vocab (Vocab): A Vocab object. If True, a vocab is created.
        disable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to disable.
            Disabled pipes will be loaded but they won't be run unless you
            explicitly enable them by calling nlp.enable_pipe.
        enable (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to enable. All other
            pipes will be disabled (and can be enabled using `nlp.enable_pipe`).
        exclude (Union[str, Iterable[str]]): Name(s) of pipeline component(s) to exclude.
            Excluded components won't be loaded.
        meta (Dict[str, Any]): Meta overrides for nlp.meta.
        auto_fill (bool): Automatically fill in missing values in config based
            on defaults and function argument annotations.
        validate (bool): Validate the component config and arguments against
            the types expected by the factory.
        RETURNS (Language): The initialized Language class.

        DOCS: https://spacy.io/api/language#from_config
        
spacy/language.py