Support custom language factory setting in meta.json
@@ -160,7 +160,10 @@ def load_model_from_path(model_path, meta=False, **overrides):
pipeline from meta.json and then calls from_disk() with path."""
if not meta:
meta = get_model_meta(model_path)
- cls = get_lang_class(meta["lang"])
+ # 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", [])
disable = overrides.get("disable", [])
