diff --git a/python/functions/datascience/glirel_load_model.py b/python/functions/datascience/glirel_load_model.py index 8f83ae74..c43d439f 100644 --- a/python/functions/datascience/glirel_load_model.py +++ b/python/functions/datascience/glirel_load_model.py @@ -56,6 +56,18 @@ def glirel_load_model( "`uv pip install glirel` o `uv pip install -e '.[nlp]'`." ) from exc + # huggingface_hub 1.x ya no pasa `proxies`/`resume_download` a + # `_from_pretrained`, pero glirel todavia los declara required-keyword. + # Wrappeamos el classmethod para inyectar valores neutros si faltan. + if not getattr(GLiREL, "_fn_registry_kwargs_patched", False): + _orig = GLiREL._from_pretrained.__func__ + def _patched(cls, **kw): + kw.setdefault("proxies", None) + kw.setdefault("resume_download", False) + return _orig(cls, **kw) + GLiREL._from_pretrained = classmethod(_patched) + GLiREL._fn_registry_kwargs_patched = True + model = GLiREL.from_pretrained(model_name) if hasattr(model, "to"): model.to(resolved_device)