Skip to content

Commit

Permalink
Update simple_inference.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jzhang38 authored Oct 3, 2023
1 parent 0eb52f8 commit 58665a9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions sft/simple_inference.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@


from transformers import AutoTokenizer
import transformers
import torch
model = "/data/TinyLlama/out/TinyLlama-1.1B-900B-code-preview"
model = "PY007/TinyLlama-1.1B-Chat-v0.1"
tokenizer = AutoTokenizer.from_pretrained(model)
pipeline = transformers.pipeline(
"text-generation",
Expand All @@ -12,11 +10,12 @@
device_map="auto",
)

prompt = "Quick Sort Implementation in golang"
prompt = "Give me detailed info about Jeo Biden."
formatted_prompt = (
f"### Human: {prompt} ### Assistant:"
)


sequences = pipeline(
formatted_prompt,
do_sample=True,
Expand All @@ -27,4 +26,4 @@
max_new_tokens=1024,
)
for seq in sequences:
print(f"Result: {seq['generated_text']}")
print(f"Result: {seq['generated_text']}")

0 comments on commit 58665a9

Please sign in to comment.