Unable to access gated repository for FLUX.1-dev model
7enChan opened this issue · 8 comments
Hi there,
I'm trying to use the FLUX.1-dev model from the black-forest-labs repository on the Hugging Face Hub, but I'm encountering an issue where I'm unable to access the gated repository. When running the code, I'm getting the following error:
huggingface_hub.utils._errors.GatedRepoError: 401 Client Error. (Request ID: Root=1-66c53d39-68d77c7933c60a4939ed6363;0a757519-549c-463e-9f18-356e8663f1f5) Cannot access gated repo for url https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/0ef5fff789c832c5c7f4e127f94c8b54bbcced44/tokenizer/merges.txt. Access to model black-forest-labs/FLUX.1-dev is restricted. You must be authenticated to access it.
I'm able to directly access the URL in my browser, but it seems that the code is unable to authenticate correctly when trying to download the files. I've double-checked my authentication credentials, but I'm still running into this issue.
Could you please help me troubleshoot this problem? I'd be happy to provide any additional information or logs that might be helpful.
I referenced this link and added the following code, replacing it with my own token as a temporary solution:
from huggingface_hub import login
login(token="your_access_token")
This allowed me to resolve the issue for now. I don't know much about coding, but I understand that using a personal access token directly in the code is not the correct long-term solution, as it is not very scalable or secure.
Hello,
The other way to pass the access token is through the huggingface cli. In your terminal, type
huggingface-cli login
This will ask for your HF Token, and you’ll be good to go after that.
If you do not have the cli installed, follow the instructions here.
I am not fully sure what the cleanest/best way is to handle this in code at the moment (e.g maybe nothing should be added and authentication should purely be done outside this repo as I guess is the case for using huggingface-cli
?). For now, I'll simply link to this issue in the readme to point people in the right direction if they get any related troubles.
User have to create API token from Hugging Face with Repositories permissions to 'black-forest-labs/FLUX.1-dev' search for repos.
Than do 'huggingface-cli login' in terminal with the token