Instructions to use Salesforce/blip-image-captioning-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Salesforce/blip-image-captioning-base with Transformers:
# Use a pipeline as a high-level helper # Warning: Pipeline type "image-to-text" is no longer supported in transformers v5. # You must load the model directly (see below) or downgrade to v4.x with: # 'pip install "transformers<5.0.0' from transformers import pipeline pipe = pipeline("image-to-text", model="Salesforce/blip-image-captioning-base")# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("Salesforce/blip-image-captioning-base") model = AutoModelForImageTextToText.from_pretrained("Salesforce/blip-image-captioning-base") - Notebooks
- Google Colab
- Kaggle
I can not download this model.
Pycharm reminded me :
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/Salesfoce/blip-image-captioning-base/resolve/main/config.json
Repository Not Found for url: https://huggingface.co/Salesfoce/blip-image-captioning-base/resolve/main/config.json.
Please make sure you specified the correct repo_id and repo_type.
If you are trying to access a private or gated repo, make sure you are authenticated.
Invalid username or password.
I am experiencing the same error, even while using token and setting use_auth_token=True. The error after the above is:
OSError: Salesfoce/blip-image-captioning-base is not a local folder and is not a valid model identifier listed on 'https://huggingface.co/models'
If this is a private repository, make sure to pass a token having permission to this repo with use_auth_token or log in with huggingface-cli login and pass use_auth_token=True.
Interestingly, it works using snapshot_download:
from huggingface_hub import snapshot_download
snapshot_download(repo_id='Salesforce/blip-image-captioning-base')
Source: https://huggingface.co/docs/huggingface_hub/v0.13.2/guides/download
after rm -rf ~/.cache/huggingface/*, solve this error