mirror of
https://github.com/abetlen/llama-cpp-python.git
synced 2023-09-07 17:34:22 +03:00
Re-organize examples folder
This commit is contained in:
19
examples/high_level_api/high_level_api_inference.py
Normal file
19
examples/high_level_api/high_level_api_inference.py
Normal file
@@ -0,0 +1,19 @@
|
||||
import json
|
||||
import argparse
|
||||
|
||||
from llama_cpp import Llama
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-m", "--model", type=str, default="./models/...")
|
||||
args = parser.parse_args()
|
||||
|
||||
llm = Llama(model_path=args.model)
|
||||
|
||||
output = llm(
|
||||
"Question: What are the names of the planets in the solar system? Answer: ",
|
||||
max_tokens=48,
|
||||
stop=["Q:", "\n"],
|
||||
echo=True,
|
||||
)
|
||||
|
||||
print(json.dumps(output, indent=2))
|
||||
Reference in New Issue
Block a user