Skip to content

Commit

Permalink
prompt now works for a single question
Browse files Browse the repository at this point in the history
  • Loading branch information
Joao Leite committed May 23, 2023
1 parent e4de903 commit 1a7ae2f
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions process.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,25 +135,25 @@ def load_model(
if torch.__version__ >= "2" and sys.platform != "win32":
self.model = torch.compile(self.model)

def process_batch(
def prompt(
self,
prompts: List[str],
prompt: str,
temperature=0.1,
top_k=50,
top_p=0.75,
num_beams=4,
max_new_tokens=512,
):
for prompt in prompts:
answer = ""
for item in self.evaluate(
prompt,
temperature=temperature,
top_k=top_k,
top_p=top_p,
max_new_tokens=max_new_tokens,
num_beams=num_beams,
):
answer += item
answer = ""
for item in self.evaluate(
prompt,
input=None,
temperature=temperature,
top_k=top_k,
top_p=top_p,
max_new_tokens=max_new_tokens,
num_beams=num_beams,
):
answer += item

yield answer
return answer

0 comments on commit 1a7ae2f

Please sign in to comment.