`SecurityStatus` does not exist in `model_info`
suzukimain opened this issue · 1 comments
suzukimain commented
Describe the bug
SecurityStatus
does not exist in model_info.
Instead, securityRepoStatus
exists.
It is related to huggingface/Google-Cloud-Containers#116
Reproduction
from huggingface_hub import HfApi
hf_api = HfApi()
hf_info = hf_api.model_info(
repo_id="google/gemma-2b-it", securityStatus=True
)
try:
print(hf_info.securityStatus)
except AttributeError:
raise AttributeError(hf_info.__dict__.keys())
Logs
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-4-1beb226f1dff> in <cell line: 7>()
7 try:
----> 8 print(hf_info.securityStatus)
9 except AttributeError:
AttributeError: 'ModelInfo' object has no attribute 'securityStatus'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
<ipython-input-4-1beb226f1dff> in <cell line: 7>()
8 print(hf_info.securityStatus)
9 except AttributeError:
---> 10 raise AttributeError(hf_info.__dict__.keys())
AttributeError: dict_keys(['id', 'author', 'sha', 'last_modified', 'created_at', 'private', 'gated', 'disabled', 'downloads', 'downloads_all_time', 'likes', 'library_name', 'tags', 'pipeline_tag', 'mask_token', 'card_data', 'widget_data', 'model_index', 'config', 'transformers_info', 'siblings', 'spaces', 'safetensors', 'lastModified', 'cardData', 'transformersInfo', '_id', 'modelId', 'gguf', 'securityRepoStatus'])
System info
- huggingface_hub version: 0.24.7
- Platform: Linux-6.1.85+-x86_64-with-glibc2.35
- Python version: 3.10.12
- Running in iPython ?: Yes
- iPython shell: Shell
- Running in notebook ?: Yes
- Running in Google Colab ?: Yes
- Token path ?: /root/.cache/huggingface/token
- Has saved token ?: False
- Configured git credential helpers:
- FastAI: 2.7.18
- Tensorflow: 2.17.0
- Torch: 2.5.0+cu121
- Jinja2: 3.1.4
- Graphviz: 0.20.3
- keras: 3.4.1
- Pydot: 3.0.2
- Pillow: 10.4.0
- hf_transfer: N/A
- gradio: N/A
- tensorboard: N/A
- numpy: 1.26.4
- pydantic: 2.9.2
- aiohttp: 3.10.10
- ENDPOINT: https://huggingface.co
- HF_HUB_CACHE: /root/.cache/huggingface/hub
- HF_ASSETS_CACHE: /root/.cache/huggingface/assets
- HF_TOKEN_PATH: /root/.cache/huggingface/token
- HF_HUB_OFFLINE: False
- HF_HUB_DISABLE_TELEMETRY: False
- HF_HUB_DISABLE_PROGRESS_BARS: None
- HF_HUB_DISABLE_SYMLINKS_WARNING: False
- HF_HUB_DISABLE_EXPERIMENTAL_WARNING: False
- HF_HUB_DISABLE_IMPLICIT_TOKEN: False
- HF_HUB_ENABLE_HF_TRANSFER: False
- HF_HUB_ETAG_TIMEOUT: 10
- HF_HUB_DOWNLOAD_TIMEOUT: 10
{'huggingface_hub version': '0.24.7',
'Platform': 'Linux-6.1.85+-x86_64-with-glibc2.35',
'Python version': '3.10.12',
'Running in iPython ?': 'Yes',
'iPython shell': 'Shell',
'Running in notebook ?': 'Yes',
'Running in Google Colab ?': 'Yes',
'Token path ?': '/root/.cache/huggingface/token',
'Has saved token ?': False,
'Configured git credential helpers': '',
'FastAI': '2.7.18',
'Tensorflow': '2.17.0',
'Torch': '2.5.0+cu121',
'Jinja2': '3.1.4',
'Graphviz': '0.20.3',
'keras': '3.4.1',
'Pydot': '3.0.2',
'Pillow': '10.4.0',
'hf_transfer': 'N/A',
'gradio': 'N/A',
'tensorboard': 'N/A',
'numpy': '1.26.4',
'pydantic': '2.9.2',
'aiohttp': '3.10.10',
'ENDPOINT': 'https://huggingface.co',
'HF_HUB_CACHE': '/root/.cache/huggingface/hub',
'HF_ASSETS_CACHE': '/root/.cache/huggingface/assets',
'HF_TOKEN_PATH': '/root/.cache/huggingface/token',
'HF_HUB_OFFLINE': False,
'HF_HUB_DISABLE_TELEMETRY': False,
'HF_HUB_DISABLE_PROGRESS_BARS': None,
'HF_HUB_DISABLE_SYMLINKS_WARNING': False,
'HF_HUB_DISABLE_EXPERIMENTAL_WARNING': False,
'HF_HUB_DISABLE_IMPLICIT_TOKEN': False,
'HF_HUB_ENABLE_HF_TRANSFER': False,
'HF_HUB_ETAG_TIMEOUT': 10,
'HF_HUB_DOWNLOAD_TIMEOUT': 10}
hanouticelina commented
Hello @suzukimain, thanks a lot for reporting and sorry you've encountered this issue! The securityStatus
field was recently renamed to securityRepoStatus
on the server side. we've just release a patch (v0.26.2) to fix this where we added a proper field to access a model's security scan status in ModelInfo
:
- first you will need to upgrade to
huggingface_hub==0.26.2
:
pip install huggingface_hub==0.26.2
- then, you will be able to access model's scan status using
ModelInfo.security_repo_status
field :
from huggingface_hub import HfApi
hf_api = HfApi()
hf_info = hf_api.model_info(repo_id="google/gemma-2b-it", securityStatus=True)
try:
print(hf_info.security_repo_status)
except AttributeError:
raise AttributeError(hf_info.__dict__.keys())
I will close this issue but don't hesitate to comment if you have any other related question! 🤗