hook up meta in load_model_from_config (#10400)

This commit is contained in:
Sofie Van Landeghem 2022-03-04 11:07:45 +01:00 committed by GitHub
parent 91acc3ea75
commit d89dac4066
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -485,13 +485,16 @@ def load_model_from_path(
config_path = model_path / "config.cfg" config_path = model_path / "config.cfg"
overrides = dict_to_dot(config) overrides = dict_to_dot(config)
config = load_config(config_path, overrides=overrides) config = load_config(config_path, overrides=overrides)
nlp = load_model_from_config(config, vocab=vocab, disable=disable, exclude=exclude) nlp = load_model_from_config(
config, vocab=vocab, disable=disable, exclude=exclude, meta=meta
)
return nlp.from_disk(model_path, exclude=exclude, overrides=overrides) return nlp.from_disk(model_path, exclude=exclude, overrides=overrides)
def load_model_from_config( def load_model_from_config(
config: Union[Dict[str, Any], Config], config: Union[Dict[str, Any], Config],
*, *,
meta: Dict[str, Any] = SimpleFrozenDict(),
vocab: Union["Vocab", bool] = True, vocab: Union["Vocab", bool] = True,
disable: Iterable[str] = SimpleFrozenList(), disable: Iterable[str] = SimpleFrozenList(),
exclude: Iterable[str] = SimpleFrozenList(), exclude: Iterable[str] = SimpleFrozenList(),
@ -529,6 +532,7 @@ def load_model_from_config(
exclude=exclude, exclude=exclude,
auto_fill=auto_fill, auto_fill=auto_fill,
validate=validate, validate=validate,
meta=meta,
) )
return nlp return nlp