sourabhdattawad
commited on
Commit
•
4242c49
1
Parent(s):
27d1090
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
## Usage
|
2 |
+
|
3 |
+
Package installation
|
4 |
+
|
5 |
+
```
|
6 |
+
pip install llama-cpp-python "huggingface_hub[cli]"
|
7 |
+
```
|
8 |
+
|
9 |
+
Download the model:
|
10 |
+
|
11 |
+
```
|
12 |
+
huggingface-cli download sourabhdattawad/meta-llama-3-8b-instruct-gguf meta-llama-3-8b-instruct.Q8_0.gguf --local-dir . --local-dir-use-symlinks False
|
13 |
+
```
|
14 |
+
|
15 |
+
```Python
|
16 |
+
from llama_cpp import Llama
|
17 |
+
llm = Llama(
|
18 |
+
model_path="meta-llama-3-8b-instruct.Q8_0.gguf",
|
19 |
+
# n_gpu_layers=-1, # Uncomment to use GPU acceleration
|
20 |
+
# seed=1337, # Uncomment to set a specific seed
|
21 |
+
# n_ctx=2048, # Uncomment to increase the context window
|
22 |
+
)
|
23 |
+
output = llm(
|
24 |
+
"Q: Name the planets in the solar system? A: ", # Prompt
|
25 |
+
max_tokens=32, # Generate up to 32 tokens, set to None to generate up to the end of the context window
|
26 |
+
stop=["Q:", "\n"], # Stop generating just before the model would generate a new question
|
27 |
+
echo=True # Echo the prompt back in the output
|
28 |
+
)
|
29 |
+
```
|