8000 Update basic example · coderonion/llama-cpp-python@3d6eb32 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d6eb32

Browse files
committed
Update basic example
1 parent dba6df2 commit 3d6eb32

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

examples/basic.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
import json
2+
import argparse
3+
24
from llama_cpp import Llama
35

4-
llm = Llama(model_path="models/...")
6+
parser = argparse.ArgumentParser()
7+
parser.add_argument("-m", "--model", type=str, default="../models/...")
8+
args = parser.parse_args()
9+
10+
llm = Llama(model_path=args.model)
511

6-
output = llm("Q: Name the planets in the solar system? A: ", max_tokens=32, stop=["Q:", "\n"], echo=True)
12+
output = llm("Question: What are the names of the planets in the solar system? Answer: ", max_tokens=48, stop=["Q:", "\n"], echo=False)
713

814
print(json.dumps(output, indent=2))

0 commit comments

Comments
 (0)
0