ITADN

Loading the model from huggingface is broken.

#308Opentuv-benedikt-mayer 创建于 2025-11-26
When executing the basic: ```python from gliner import GLiNER model = GLiNER.from_pretrained("urchade/gliner_medium-v2.1") ``` only with the latest version v0.2.23, not with v0.2.22, it throws this error: ``` Traceback (most recent call last): File "/home/my-username/workspace/IDAS/backend/analytics/services/gliner_endpoint/download_gliner_model.py", line 9, in <module> model = GLiNER.from_pretrained("urchade/gliner_medium-v2.1") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/my-username/.cache/uv/environments-v2/download-gliner-model-c0b76d7f0d4a21f1/lib/python3.11/site-packages/gliner/model.py", line 2800, in from_pretrained return gliner_class.from_pretrained( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/my-username/.cache/uv/environments-v2/download-gliner-model-c0b76d7f0d4a21f1/lib/python3.11/site-packages/gliner/model.py", line 629, in from_pretrained state_dict = cls._load_state_dict(model_file, map_location) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/my-username/.cache/uv/environments-v2/download-gliner-model-c0b76d7f0d4a21f1/lib/python3.11/site-packages/gliner/model.py", line 359, in _load_state_dict for key in f: TypeError: 'builtins.safe_open' object is not iterable ``` This seems to be related to: https://github.com/huggingface/transformers/issues/40318 Are there ways to use GLiNER via torch as mentioned in that issue?
1 条评论