Skip to content

Commit

Permalink
no_grad
Browse files Browse the repository at this point in the history
  • Loading branch information
thohag committed Mar 15, 2023
1 parent 4dbebed commit c671211
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions script.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ def _call(self, prompt, stop=None):
top_p=0.95,
repetition_penalty=1.15,
)

generation_output = model.generate(
input_ids=input_ids,
generation_config=generation_config,
return_dict_in_generate=True,
output_scores=True,
max_new_tokens=128,
)
with torch.no_grad():
generation_output = model.generate(
input_ids=input_ids,
generation_config=generation_config,
return_dict_in_generate=True,
output_scores=True,
max_new_tokens=128,
)
response = ""
for s in generation_output.sequences:
response += tokenizer.decode(s)
Expand Down

0 comments on commit c671211

Please sign in to comment.