2023-03-23 05:33:06 -04:00
|
|
|
import json
|
2023-03-23 14:57:31 -04:00
|
|
|
import argparse
|
|
|
|
|
2023-03-23 05:33:06 -04:00
|
|
|
from llama_cpp import Llama
|
|
|
|
|
2023-03-23 14:57:31 -04:00
|
|
|
parser = argparse.ArgumentParser()
|
2023-04-09 22:45:55 -04:00
|
|
|
parser.add_argument("-m", "--model", type=str, default="../models/7B/ggml-models.bin")
|
2023-03-23 14:57:31 -04:00
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
llm = Llama(model_path=args.model)
|
2023-03-23 05:33:06 -04:00
|
|
|
|
2023-03-24 14:35:41 -04:00
|
|
|
output = llm(
|
|
|
|
"Question: What are the names of the planets in the solar system? Answer: ",
|
2023-04-03 20:33:07 -04:00
|
|
|
max_tokens=48,
|
2023-03-24 14:35:41 -04:00
|
|
|
stop=["Q:", "\n"],
|
|
|
|
echo=True,
|
|
|
|
)
|
2023-03-23 05:33:06 -04:00
|
|
|
|
2023-03-24 14:35:41 -04:00
|
|
|
print(json.dumps(output, indent=2))
|