Skip to content

Bookmarklet to pull and run hugging face GGUF models in Ollama

License

Notifications You must be signed in to change notification settings

hololeo/click-n-ollamarun

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 

Repository files navigation

Click 'n' Ollama Run

If this work has been helpful to you, you can support it for free by clicking ⭐ to star this repository!

Description

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

Installation

  1. Create a new bookmark in your browser.
  2. Name the bookmark "Click-n-OllamaRun" (or any name you prefer).
  3. 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/
  1. Save the bookmark.

Usage

  1. Navigate to a Hugging Face model page (e.g., https://huggingface.co/username/model-name).
  2. Click the "Click-n-OllamaRun" bookmark in your browser.
  3. A prompt will appear with the Ollama run command. You can modify it if needed.
  4. Click OK to copy the command to your clipboard.
  5. Paste the command into your terminal to run the model with Ollama.

Examples

Example 1: Basic Usage

  1. Visit: https://huggingface.co/bartowski/MathCoder2-CodeLlama-7B-GGUF
  2. Click the "Click-n-OllamaRun" bookmark.
  3. You'll see a prompt with:
    ollama run hf.co/bartowski/MathCoder2-CodeLlama-7B-GGUF
    
  4. Click OK to copy the command.
  5. Paste the command into your terminal to run the model with Ollama.

Example 2: Modifying Quantization

  1. Visit: https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGUF
  2. Click the "Click-n-OllamaRun" bookmark.
  3. In the prompt, modify the command to specify a different quantization:
    ollama run hf.co/TheBloke/Llama-2-7B-Chat-GGUF:Q5_K_M
    
  4. Click OK to copy the modified command.
  5. Paste in terminal. It will pull and run the model in Ollama

Note

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

NotebookLLm podcast on this readme

click_n_ollamarun.mp4

About

Bookmarklet to pull and run hugging face GGUF models in Ollama

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published