2023-07-05 19:37:33 +00:00
|
|
|
![ollama](https://github.com/jmorganca/ollama/assets/251292/961f99bb-251a-4eec-897d-1ba99997ad0f)
|
|
|
|
|
2023-06-27 16:08:52 +00:00
|
|
|
# Ollama
|
2023-06-22 16:45:31 +00:00
|
|
|
|
2023-07-05 19:37:33 +00:00
|
|
|
Run large language models with `llama.cpp`.
|
|
|
|
|
|
|
|
> Note: certain models that can be run with this project are intended for research and/or non-commercial use only.
|
|
|
|
|
|
|
|
### Features
|
2023-06-27 21:13:07 +00:00
|
|
|
|
2023-07-05 19:37:33 +00:00
|
|
|
- Download and run popular large language models
|
|
|
|
- Switch between multiple models on the fly
|
|
|
|
- Hardware acceleration where available (Metal, CUDA)
|
2023-07-05 20:32:49 +00:00
|
|
|
- Fast inference server written in Go, powered by [llama.cpp](https://github.com/ggerganov/llama.cpp)
|
2023-07-05 19:37:33 +00:00
|
|
|
- REST API to use with your application (python, typescript SDKs coming soon)
|
2023-06-28 13:57:36 +00:00
|
|
|
|
|
|
|
## Install
|
2023-06-22 16:45:31 +00:00
|
|
|
|
2023-07-05 19:37:33 +00:00
|
|
|
- Download for macOS
|
|
|
|
- Download for Windows (coming soon)
|
2023-07-06 20:30:46 +00:00
|
|
|
- Docker: `docker run -p 11434:11434 ollama/ollama`
|
2023-07-05 19:37:33 +00:00
|
|
|
|
|
|
|
You can also build the [binary from source](#building).
|
|
|
|
|
|
|
|
## Quickstart
|
|
|
|
|
|
|
|
Run the model that started it all.
|
2023-06-30 16:39:25 +00:00
|
|
|
|
2023-06-22 16:45:31 +00:00
|
|
|
```
|
2023-07-05 19:37:33 +00:00
|
|
|
ollama run llama
|
2023-06-22 16:45:31 +00:00
|
|
|
```
|
|
|
|
|
2023-07-05 19:37:33 +00:00
|
|
|
## Example models
|
|
|
|
|
|
|
|
### 💬 Chat
|
|
|
|
|
|
|
|
Have a conversation.
|
2023-06-30 16:39:25 +00:00
|
|
|
|
2023-06-30 16:31:00 +00:00
|
|
|
```
|
2023-07-05 19:37:33 +00:00
|
|
|
ollama run vicuna "Why is the sky blue?"
|
2023-06-30 16:31:00 +00:00
|
|
|
```
|
|
|
|
|
2023-07-05 19:37:33 +00:00
|
|
|
### 🗺️ Instructions
|
2023-06-25 17:08:03 +00:00
|
|
|
|
2023-07-05 19:37:33 +00:00
|
|
|
Ask questions. Get answers.
|
2023-06-29 22:25:02 +00:00
|
|
|
|
|
|
|
```
|
2023-07-05 19:37:33 +00:00
|
|
|
ollama run orca "Write an email to my boss."
|
2023-06-25 17:08:03 +00:00
|
|
|
```
|
|
|
|
|
2023-07-05 19:37:33 +00:00
|
|
|
### 👩💻 Code completion
|
|
|
|
|
|
|
|
Sometimes you just need a little help writing code.
|
2023-06-27 16:08:52 +00:00
|
|
|
|
2023-06-29 22:25:02 +00:00
|
|
|
```
|
2023-07-05 19:37:33 +00:00
|
|
|
ollama run replit "Give me react code to render a button"
|
2023-06-29 22:25:02 +00:00
|
|
|
```
|
2023-06-28 13:57:36 +00:00
|
|
|
|
2023-07-05 19:37:33 +00:00
|
|
|
### 📖 Storytelling
|
|
|
|
|
|
|
|
Venture into the unknown.
|
2023-06-29 22:25:02 +00:00
|
|
|
|
|
|
|
```
|
2023-07-06 20:21:01 +00:00
|
|
|
ollama run nous-hermes "Once upon a time"
|
|
|
|
```
|
|
|
|
|
|
|
|
## Advanced usage
|
|
|
|
|
|
|
|
### Run a local model
|
|
|
|
|
|
|
|
```
|
|
|
|
ollama run ~/Downloads/vicuna-7b-v1.3.ggmlv3.q4_1.bin
|
2023-06-28 13:57:36 +00:00
|
|
|
```
|
|
|
|
|
2023-07-03 20:32:48 +00:00
|
|
|
## Building
|
|
|
|
|
|
|
|
```
|
2023-07-06 15:34:24 +00:00
|
|
|
make
|
2023-07-03 20:32:48 +00:00
|
|
|
```
|
|
|
|
|
2023-07-05 19:37:33 +00:00
|
|
|
To run it start the server:
|
2023-06-27 17:46:46 +00:00
|
|
|
|
2023-07-05 19:37:33 +00:00
|
|
|
```
|
|
|
|
./ollama server &
|
|
|
|
```
|
|
|
|
|
|
|
|
Finally, run a model!
|
|
|
|
|
|
|
|
```
|
|
|
|
./ollama run ~/Downloads/vicuna-7b-v1.3.ggmlv3.q4_1.bin
|
|
|
|
```
|
|
|
|
|
|
|
|
## API Reference
|
|
|
|
|
2023-07-06 20:46:05 +00:00
|
|
|
### `POST /api/pull`
|
|
|
|
|
|
|
|
Download a model
|
|
|
|
|
|
|
|
```
|
|
|
|
curl -X POST http://localhost:11343/api/pull -d '{"model": "orca"}'
|
|
|
|
```
|
|
|
|
|
|
|
|
### `POST /api/generate`
|
2023-07-05 19:37:33 +00:00
|
|
|
|
|
|
|
Complete a prompt
|
|
|
|
|
|
|
|
```
|
2023-07-06 20:46:05 +00:00
|
|
|
curl -X POST http://localhost:11434/api/generate -d '{"model": "orca", "prompt": "hello!", "stream": true}'
|
2023-07-05 19:37:33 +00:00
|
|
|
```
|