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

Replace huggingface-cli download command with simple https client to pull models #375

Merged
merged 3 commits into from
Oct 26, 2024

Conversation

swarajpande5
Copy link
Contributor

Resolves #335

This PR replaces huggingface-cli with the same download_file() function as used in ollama.py. This makes the pull output similar for huggingface:// and ollama:// transports.
However, the depdency on huggingface-cli is not fully removed. If huggingface-cli is installed then it can be used for other commands (such as login, logout, push) but not for pulling the models. If huggingface-cli is not present, then a simple message will be printed on the console for those other commands.

Example run:

(venv) spande-mac:ramalama (hf-https-pulls*) $ ./bin/ramalama pull huggingface://TheBloke/Tinyllama-2-1b-miniguanaco-GGUF/tinyllama-2-1b-miniguanaco.Q2_K.gguf
Pulling sha256:17b5d82a52b71b74ce303fbe17fbba66462d80fb8b42b80629012b58c1a0b6a7: 100% ▕####################▏ 460M/460M 3.30MB/s 00:00 

(venv) spande-mac:ramalama (hf-https-pulls*) $ tree $HOME/.local/share/ramalama    
/Users/spande/.local/share/ramalama
├── models
│   ├── huggingface
│   │   └── TheBloke
│   │       └── Tinyllama-2-1b-miniguanaco-GGUF
│   │           └── tinyllama-2-1b-miniguanaco.Q2_K.gguf -> ../../../../repos/huggingface/TheBloke/Tinyllama-2-1b-miniguanaco-GGUF/tinyllama-2-1b-miniguanaco.Q2_K.gguf/sha256:17b5d82a52b71b74ce303fbe17fbba66462d80fb8b42b80629012b58c1a0b6a7
│   ├── oci
│   └── ollama
└── repos
    ├── huggingface
    │   └── TheBloke
    │       └── Tinyllama-2-1b-miniguanaco-GGUF
    │           └── tinyllama-2-1b-miniguanaco.Q2_K.gguf
    │               └── sha256:17b5d82a52b71b74ce303fbe17fbba66462d80fb8b42b80629012b58c1a0b6a7
    ├── oci
    └── ollama

14 directories, 2 files

@swarajpande5 swarajpande5 force-pushed the hf-https-pulls branch 2 times, most recently from 8898c30 to b38683a Compare October 26, 2024 06:57
@swarajpande5 swarajpande5 marked this pull request as draft October 26, 2024 07:34
@swarajpande5 swarajpande5 marked this pull request as ready for review October 26, 2024 07:48
@ericcurtin ericcurtin merged commit 566d7d0 into containers:main Oct 26, 2024
12 checks passed
@swarajpande5 swarajpande5 deleted the hf-https-pulls branch October 26, 2024 12:07
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

Successfully merging this pull request may close these issues.

Replace huggingface-cli with simple client that pulls models over https
2 participants