|
| 1 | +# Use AI Models Locally |
| 2 | + |
| 3 | +You can run AI models from the Hub locally on your machine. This means that you can benefit from these advantages: |
| 4 | + |
| 5 | +- **Privacy**: You won't be sending your data to a remote server. |
| 6 | +- **Speed**: Your hardware is the limiting factor, not the server or connection speed. |
| 7 | +- **Control**: You can configure models to your liking. |
| 8 | +- **Cost**: You can run models locally without paying for an API provider. |
| 9 | + |
| 10 | +## How to Use Local Apps |
| 11 | + |
| 12 | +Local apps are applications that can run Hugging Face models directly on your machine. To get started: |
| 13 | + |
| 14 | +1. **Enable local apps** in your [Local Apps settings](https://huggingface.co/settings/local-apps). |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | +1. **Choose a supported model** from the Hub by searching for it. You can filter by `app` in the `Other` section of the navigation bar: |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | +3. **Select the local app** from the "Use this model" dropdown on the model page. |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +4. **Copy and run** the provided command in your terminal. |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | +## Supported Local Apps |
| 31 | + |
| 32 | +The best way to check if a local app is supported is to go to the Local Apps settings and see if the app is listed. Here is a quick overview of some of the most popular local apps: |
| 33 | + |
| 34 | +<Tip> |
| 35 | + |
| 36 | +👨💻 To use these local apps, copy the snippets from the model card as above. |
| 37 | + |
| 38 | +👷 If you're building a local app, you can learn about integrating with the Hub in [this guide](https://huggingface.co/docs/hub/en/models-adding-libraries). |
| 39 | + |
| 40 | +</Tip> |
| 41 | + |
| 42 | +### Llama.cpp |
| 43 | + |
| 44 | +Llama.cpp is a high-performance C/C++ library for running LLMs locally with optimized inference across lots of different hardware, including CPUs, CUDA and Metal. |
| 45 | + |
| 46 | +**Advantages:** |
| 47 | +- Extremely fast performance for CPU-based models on multiple CPU families |
| 48 | +- Low resource usage |
| 49 | +- Multiple interface options (CLI, server, Python library) |
| 50 | +- Hardware-optimized for CPUs and GPUs |
| 51 | + |
| 52 | +To use Llama.cpp, navigate to the model card and click "Use this model" and copy the command. |
| 53 | + |
| 54 | +```sh |
| 55 | +# Load and run the model: |
| 56 | +./llama-server -hf unsloth/gpt-oss-20b-GGUF:Q4_K_M |
| 57 | +``` |
| 58 | + |
| 59 | + |
| 60 | +### Ollama |
| 61 | + |
| 62 | +Ollama is an application that lets you run large language models locally on your computer with a simple command-line interface. |
| 63 | + |
| 64 | +**Advantages:** |
| 65 | +- Easy installation and setup |
| 66 | +- Direct integration with Hugging Face Hub |
| 67 | + |
| 68 | +To use Ollama, navigate to the model card and click "Use this model" and copy the command. |
| 69 | + |
| 70 | +```sh |
| 71 | +ollama run hf.co/unsloth/gpt-oss-20b-GGUF:Q4_K_M |
| 72 | +``` |
| 73 | + |
| 74 | +### Jan |
| 75 | + |
| 76 | +Jan is an open-source ChatGPT alternative that runs entirely offline with a user-friendly interface. |
| 77 | + |
| 78 | +**Advantages:** |
| 79 | +- User-friendly GUI |
| 80 | +- Chat with documents and files |
| 81 | +- OpenAI-compatible API server, so you can run models and use them from other apps |
| 82 | + |
| 83 | +To use Jan, navigate to the model card and click "Use this model". Jan will open and you can start chatting through the interface. |
| 84 | + |
| 85 | +### LM Studio |
| 86 | + |
| 87 | +LM Studio is a desktop application that provides an easy way to download, run, and experiment with local LLMs. |
| 88 | + |
| 89 | +**Advantages:** |
| 90 | +- Intuitive graphical interface |
| 91 | +- Built-in model browser |
| 92 | +- Developer tools and APIs |
| 93 | +- Free for personal and commercial use |
| 94 | + |
| 95 | +Navigate to the model card and click "Use this model". LM Studio will open and you can start chatting through the interface. |
0 commit comments