You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-25Lines changed: 13 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,18 @@
1
+
## Python bindings for llama.cpp
2
+
1
3
## Building the Python bindings
2
4
3
5
### macOS
4
6
5
-
`brew install pybind11`
6
-
7
-
## Install python package
8
-
9
-
### From PyPI
10
-
11
7
```
12
-
pip install llamacpp
8
+
brew install pybind11 # Installs dependency
9
+
git submodule init && git submodule update
10
+
poetry install
13
11
```
14
-
15
-
### From source
12
+
### From PyPI
16
13
17
14
```
18
-
poetry install
15
+
pip install llamacpp
19
16
```
20
17
21
18
## Get the model weights
@@ -32,25 +29,16 @@ Convert the weights to GGML format using `llamacpp-convert`. Then use `llamacpp-
32
29
```
33
30
llamacpp-convert ./models/7B/ 1
34
31
llamacpp-quantize ./models/7B/
32
+
llamacpp-cli
35
33
```
36
34
37
-
## Run this demo script
35
+
## Command line interface
38
36
39
-
```
40
-
import llamacpp
41
-
import os
37
+
The package installs the command line entry point `llamacpp-cli` that points to `llamacpp/cli.py` and should provide about the same functionality as the `main` program in the original C++ repository. There is also an experimental `llamacpp-chat` that is supposed to bring up a chat interface but this is not working correctly yet.
42
38
43
-
model_path = "./models/7B/ggml-model-q4_0.bin"
44
-
params = llamacpp.gpt_params(model_path,
45
-
"Hi, I'm a llama.",
46
-
4096,
47
-
40,
48
-
0.1,
49
-
0.7,
50
-
2.0)
51
-
model = llamacpp.PyLLAMA(model_path, params)
52
-
model.predict("Hello, I'm a llama.", 10)
53
-
```
39
+
## Demo script
40
+
41
+
See `llamacpp/cli.py` for a detailed example. The simplest demo would be something like the following:
0 commit comments