urchade / GLiNER

Generalist and Lightweight Model for Named Entity Recognition (Extract any entity types from texts) @ NAACL 2024
https://arxiv.org/abs/2311.08526
Apache License 2.0
1.22k stars 98 forks source link

cannot import name 'SAFETENSORS_SINGLE_FILE' from 'huggingface_hub.constants' #150

Open Chandrak1907 opened 1 month ago

Chandrak1907 commented 1 month ago

after installing gliner, below line gives an error

from gliner import GLiNER


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
/tmp/ipykernel_1653/103435563.py in <cell line: 1>()
----> 1 from gliner import GLiNER

~/conda/pytorch21_p39_gpu_v1/lib/python3.9/site-packages/gliner/__init__.py in <module>
      1 __version__ = "0.2.7"
      2 
----> 3 from .model import GLiNER
      4 from .config import GLiNERConfig
      5 

~/conda/pytorch21_p39_gpu_v1/lib/python3.9/site-packages/gliner/model.py in <module>
     21 from .config import GLiNERConfig
     22 
---> 23 from huggingface_hub import PyTorchModelHubMixin, snapshot_download
     24 
     25 class GLiNER(nn.Module, PyTorchModelHubMixin):

~/conda/pytorch21_p39_gpu_v1/lib/python3.9/site-packages/huggingface_hub/__init__.py in __getattr__(name)
    355         "TextToAudioParameters",
    356         "TextToImageInput",
--> 357         "TextToImageOutput",
    358         "TextToImageParameters",
    359         "TextToImageTargetSize",

~/conda/pytorch21_p39_gpu_v1/lib/python3.9/importlib/__init__.py in import_module(name, package)
    125                 break
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 
    129 

~/conda/pytorch21_p39_gpu_v1/lib/python3.9/site-packages/huggingface_hub/hub_mixin.py in <module>
     18 )
     19 
---> 20 from .constants import CONFIG_NAME, PYTORCH_WEIGHTS_NAME, SAFETENSORS_SINGLE_FILE
     21 from .file_download import hf_hub_download
     22 from .hf_api import HfApi

ImportError: cannot import name 'SAFETENSORS_SINGLE_FILE' from 'huggingface_hub.constants' (/home/datascience/conda/pytorch21_p39_gpu_v1/lib/python3.9/site-packages/huggingface_hub/constants.py)
urchade commented 1 month ago

Hi, it looks like the problem come form your huggingface_hub version. try updating it