Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login to huggingface with a token asks for username and password #643

Open
pbabinca opened this issue Jan 28, 2025 · 3 comments
Open

Login to huggingface with a token asks for username and password #643

pbabinca opened this issue Jan 28, 2025 · 3 comments

Comments

@pbabinca
Copy link
Contributor

I would like to use a model from huggingface. Since the model is hidden behind authentication, I follow examples section of Documentation for ramalama login and run:

$ ramalama login --token="${TOKEN}" huggingface

but instead of logging me in, I'm being asked for Username: .


I have found a trivial typo on this line:

if registry in ["ollama", "hf" "huggingface"]:

which python interprets as:

>>> repr(["ollama", "hf" "huggingface"])
"['ollama', 'hfhuggingface']"

so I assume it should be:

if registry in ["ollama", "hf", "huggingface"]:

This is not enough though, because the registry from the command line (huggingface) is not one of the expected prefixes in factory function New(). I'm not sure how to fix this properly, but temporary workaround with:

if model.startswith("huggingface") or model.startswith("huggingface://") or model.startswith("hf://") or model.startswith("hf.co/"):

led me to an error:

Error: huggingface-cli not available, skipping login.

I haven't seen a requirement of this CLI to be installed on the system anywhere in the documentation. I guess best place would be in the examples section of ramalama-login, either using the command (pip install -U "huggingface_hub[cli]") or linking to https://huggingface.co/docs/huggingface_hub/en/guides/cli where I found it.


After all of this I was able to login.

@pbabinca pbabinca changed the title Login to huggingface with token asks for username and password Login to huggingface with a token asks for username and password Jan 28, 2025
@ericcurtin
Copy link
Collaborator

I think the best fix is to implement ramalama login in python3 from scratch it shouldn't be too bad, I've seen at least 3 implementations of it.

@ericcurtin
Copy link
Collaborator

But yes a documentation addition to install huggingface would be enough to close this issue for now. It's deliberately not a strong dependancy because it can be hard to install it on some platforms.

Would you like to open a PR @pbabinca with a documentation update?

If you are really interested in solving this, a PR with the python code is the longer term fix.

@pbabinca
Copy link
Contributor Author

Would you like to open a PR @pbabinca with a documentation update?

Opened #645 which should solve the last issue.


The other two issues, though, are not resolved yet. I'm not sure if test of the prefix huggingface on the top/instead of the "scheme" of URL is the correct way. I'm not sure which parts of code use that factory function.

pbabinca added a commit to pbabinca/containers.ramalama that referenced this issue Jan 29, 2025
Relates-to: containers#643

Signed-off-by: Pavol Babincak <[email protected]>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: Daniel J Walsh <[email protected]>
pbabinca added a commit to pbabinca/containers.ramalama that referenced this issue Jan 29, 2025
Relates-to: containers#643

Signed-off-by: Pavol Babincak <[email protected]>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: Daniel J Walsh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants