If this work has been helpful to you, you can support it for free by clicking ⭐ to star this repository!
Click-n-Ollama Run is a handy bookmarklet that converts Hugging Face model URLs into Ollama run commands with a single click. It simplifies the process of running Hugging Face models locally using Ollama, saving you time and reducing the chance of errors in command construction. Inspired by https://huggingface.co/docs/hub/en/ollama
Also check out Click 'n' Clone bookmarklet - rapidly clone a git repo! https://github.com/hololeo/click-n-clone
- Create a new bookmark in your browser.
- Name the bookmark "Click-n-OllamaRun" (or any name you prefer).
- In the URL or location field of the bookmark, paste the following code:
javascript: (function() {
var url = window.location.href,
match = url.match(/(?:https?:\/\/)?(?:www\.)?(?:huggingface\.co|hf\.co)\/([^\/]+)\/([^\/]+)/);
if (match) {
var username = match[1],
repository = match[2],
newUrl = `ollama run hf.co/${username}/${repository}`,
message = 'Here\'s your Ollama run command:\nDefaults to Q4_K_M\nAppend:{quantization} for different quantization\nCopy and paste in terminal to pull and run model\nsee https://huggingface.co/docs/hub/en/ollama\n\nYou can modify the command below:',
userInput = prompt(message, newUrl);
userInput !== null && navigator.clipboard.writeText(userInput).then(function() {
alert('Command copied to clipboard!')
}, function() {
alert('Copying to clipboard failed. Please copy the command manually.')
})
} else alert('This bookmarklet only works on Hugging Face model pages.')
})();
// use with bookmarklet maker like https://caiorss.github.io/bookmarklet-maker/
- Save the bookmark.
- Navigate to a Hugging Face model page (e.g., https://huggingface.co/username/model-name).
- Click the "Click-n-OllamaRun" bookmark in your browser.
- A prompt will appear with the Ollama run command. You can modify it if needed.
- Click OK to copy the command to your clipboard.
- Paste the command into your terminal to run the model with Ollama.
- Visit: https://huggingface.co/bartowski/MathCoder2-CodeLlama-7B-GGUF
- Click the "Click-n-OllamaRun" bookmark.
- You'll see a prompt with:
ollama run hf.co/bartowski/MathCoder2-CodeLlama-7B-GGUF
- Click OK to copy the command.
- Paste the command into your terminal to run the model with Ollama.
- Visit: https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF
- Click the "Click-n-OllamaRun" bookmark.
- In the prompt, modify the command to specify a different quantization:
ollama run hf.co/TheBloke/Llama-2-7B-Chat-GGUF:Q5_K_M
- Click OK to copy the modified command.
- Paste in terminal. It will pull and run the model in Ollama
This bookmarklet works with both huggingface.co
and hf.co
URLs. Ensure you're on a valid Hugging Face model page when using it. For more information: https://huggingface.co/docs/hub/en/ollama