ollama/README.md

83 lines
1.0 KiB
Markdown
Raw Normal View History

2023-06-28 00:08:52 +08:00
# Ollama
2023-06-23 00:45:31 +08:00
2023-06-28 00:08:52 +08:00
- Run models, fast
- Download, manage and import models
2023-06-26 01:08:03 +08:00
2023-06-28 00:08:52 +08:00
## Install
2023-06-23 00:45:31 +08:00
```
2023-06-28 00:08:52 +08:00
pip install ollama
2023-06-23 00:45:31 +08:00
```
2023-06-28 00:08:52 +08:00
## Example quickstart
2023-06-26 01:08:03 +08:00
2023-06-28 00:08:52 +08:00
```python
import ollama
model_name = "huggingface.co/thebloke/llama-7b-ggml"
model = ollama.pull(model_name)
ollama.load(model)
ollama.generate(model_name, "hi")
2023-06-26 01:08:03 +08:00
```
2023-06-28 00:08:52 +08:00
## Reference
2023-06-26 01:08:03 +08:00
2023-06-28 00:08:52 +08:00
### `ollama.load`
Load a model from a path or a docker image
```python
ollama.load("model name")
2023-06-26 01:08:03 +08:00
```
2023-06-28 00:08:52 +08:00
### `ollama.generate("message")`
2023-06-26 01:08:03 +08:00
2023-06-28 00:08:52 +08:00
Generate a completion
2023-06-26 01:08:03 +08:00
2023-06-28 00:08:52 +08:00
```python
ollama.generate(model, "hi")
2023-06-26 01:08:03 +08:00
```
2023-06-28 00:08:52 +08:00
### `ollama.models`
2023-06-26 01:08:03 +08:00
2023-06-28 00:08:52 +08:00
List models
```
models = ollama.models()
2023-06-26 01:08:03 +08:00
```
2023-06-28 00:08:52 +08:00
### `ollama.serve`
2023-06-26 01:10:15 +08:00
2023-06-28 00:08:52 +08:00
Serve the ollama http server
2023-06-26 01:08:03 +08:00
2023-06-28 00:08:52 +08:00
## Cooing Soon
2023-06-26 01:08:03 +08:00
2023-06-28 00:08:52 +08:00
### `ollama.pull`
Examples:
```python
ollama.pull("huggingface.co/thebloke/llama-7b-ggml")
2023-06-26 01:08:03 +08:00
```
2023-06-28 00:08:52 +08:00
### `ollama.import`
Import an existing model into the model store
```python
ollama.import("./path/to/model")
```
2023-06-26 01:08:03 +08:00
2023-06-28 00:08:52 +08:00
### `ollama.search`
2023-06-26 02:29:26 +08:00
2023-06-28 00:08:52 +08:00
Search for compatible models that Ollama can run
2023-06-26 02:29:26 +08:00
2023-06-28 00:08:52 +08:00
```python
ollama.search("llama-7b")
```
2023-06-26 01:08:03 +08:00
2023-06-28 00:08:52 +08:00
## Future CLI
2023-06-26 02:29:26 +08:00
2023-06-28 00:08:52 +08:00
```
ollama run huggingface.co/thebloke/llama-7b-ggml
```