Skip to content

Commit

Permalink
Needed for latest transformers
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunguha committed Feb 25, 2024
1 parent 3609be3 commit 8b683a9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion automodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,18 @@ def completion_tensors(
temperature: float,
top_p: float,
):
self.model.eval() # Not essential, but just in case.

inputs = self.tokenizer(
prompts, padding=True, return_tensors="pt", return_token_type_ids=False
prompts,
padding=True,
return_tensors="pt",
return_token_type_ids=False,
truncation=True,
max_length=max_length - 1,
).to("cuda")


with torch.no_grad():
output = self.model.generate(
**inputs,
Expand Down

0 comments on commit 8b683a9

Please sign in to comment.