# Buggy code
def load_model_from_path(model_path, meta=False, **overrides):
    """Load a model from a data directory path. Creates Language class with
    pipeline from meta.json and then calls from_disk() with path."""
    if not meta:
        meta = get_model_meta(model_path)
    # Support language factories registered via entry points (e.g. custom
    # language subclass) while keeping top-level language identifier "lang"
    lang = meta.get("lang_factory", meta["lang"])
    cls = get_lang_class(lang)
    nlp = cls(meta=meta, **overrides)
    pipeline = meta.get("pipeline", [])
    factories = meta.get("factories", {})
    disable = overrides.get("disable", [])
    if pipeline is True:
        pipeline = nlp.Defaults.pipe_names
    elif pipeline in (False, None):
        pipeline = []
    for name in pipeline:
        if name not in disable:
            config = meta.get("pipeline_args", {}).get(name, {})
            config.update(overrides)
            factory = factories.get(name, name)
            component = nlp.create_pipe(factory, config=config)
            nlp.add_pipe(component, name=name)
    return nlp.from_disk(model_path, exclude=disable)


# Traceback (TypeError)
py -m spacy train en C:\Work\ML\Spacy\dataset\model C:\Work\ML\Spacy\dataset\train C:\Work\ML\Spacy\dataset\valid -v en_core_web_md
Training pipeline: ['tagger', 'parser', 'ner']
Starting with blank model 'en'
Loading vector from model 'en_core_web_md'
Traceback (most recent call last):
File "C:\Program Files\Python\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Program Files\Python\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Program Files\Python\lib\site-packages\spacy\__main__.py", line 33, in <module>
plac.call(commands[command], sys.argv[1:])
File "C:\Program Files\Python\lib\site-packages\plac_core.py", line 367, in call
cmd, result = parser.consume(arglist)
File "C:\Program Files\Python\lib\site-packages\plac_core.py", line 232, in consume
return cmd, self.func(*(args + varargs + extraopts), **kwargs)
File "C:\Program Files\Python\lib\site-packages\spacy\cli\train.py", line 266, in train
_load_vectors(nlp, vectors)
File "C:\Program Files\Python\lib\site-packages\spacy\cli\train.py", line 645, in _load_vectors
util.load_model(vectors, vocab=nlp.vocab)
File "C:\Program Files\Python\lib\site-packages\spacy\util.py", line 170, in load_model
return load_model_from_package(name, **overrides)
File "C:\Program Files\Python\lib\site-packages\spacy\util.py", line 191, in load_model_from_package
return cls.load(**overrides)
File "C:\Program Files\Python\lib\site-packages\en_core_web_md\__init__.py", line 12, in load
return load_model_from_init_py(__file__, **overrides)
File "C:\Program Files\Python\lib\site-packages\spacy\util.py", line 235, in load_model_from_init_py
return load_model_from_path(data_path, meta, **overrides)
File "C:\Program Files\Python\lib\site-packages\spacy\util.py", line 216, in load_model_from_path
component = nlp.create_pipe(factory, config=config)
File "C:\Program Files\Python\lib\site-packages\spacy\language.py", line 309, in create_pipe
return factory(self, **config)
File "C:\Program Files\Python\lib\site-packages\spacy\language.py", line 1080, in factory
return obj.from_nlp(nlp, **cfg)
File "pipes.pyx", line 62, in spacy.pipeline.pipes.Pipe.from_nlp
File "pipes.pyx", line 378, in spacy.pipeline.pipes.Tagger.__init__
TypeError: __init__() got multiple values for keyword argument 'vocab'

# Fixed code
def load_model_from_path(model_path, meta=False, **overrides):
    """Load a model from a data directory path. Creates Language class with
    pipeline from meta.json and then calls from_disk() with path."""
    if not meta:
        meta = get_model_meta(model_path)
    # Support language factories registered via entry points (e.g. custom
    # language subclass) while keeping top-level language identifier "lang"
    lang = meta.get("lang_factory", meta["lang"])
    cls = get_lang_class(lang)
    nlp = cls(meta=meta, **overrides)
    pipeline = meta.get("pipeline", [])
    factories = meta.get("factories", {})
    disable = overrides.get("disable", [])
    if pipeline is True:
        pipeline = nlp.Defaults.pipe_names
    elif pipeline in (False, None):
        pipeline = []
    # skip "vocab" from overrides in component initialization since vocab is
    # already configured from overrides when nlp is initialized above
    if "vocab" in overrides:
        del overrides["vocab"]
    for name in pipeline:
        if name not in disable:
            config = meta.get("pipeline_args", {}).get(name, {})
            config.update(overrides)
            factory = factories.get(name, name)
            component = nlp.create_pipe(factory, config=config)
            nlp.add_pipe(component, name=name)
    return nlp.from_disk(model_path, exclude=disable)