Skip to content

Commit

Permalink
removed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hsz0403 committed Aug 29, 2024
1 parent 41f6c1d commit f15af66
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions python/external_models/hf_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,13 @@ def generate(self, input: str, target_prefix: str = "") -> List[Tuple[str, float
eos_token_id=eos_token_id,
**self.generation_args
)
# outputs = outputs[0].tolist()[len(tokenized_input.input_ids[0]) :]
response = self.tokenizer.batch_decode(
outputs['sequences'], skip_special_tokens=True)
# response = response.split("<|im_end|>")[0]
result = []
# if we ues beam search here should be zip(response,outputs.sequence_scores)
index = 0
for out, score in zip(response, outputs.scores):
out = post_process_output(self.name, out)
result.append((out, score[index].exp().sum().log().cpu().item()))
# if beam seach:
# result.append((out,score.exp().item()))
index += 1
result = choices_dedup(result)
return result
Expand Down

0 comments on commit f15af66

Please sign in to comment.