Skip to content

Commit

Permalink
fix json serialize (#4235)
Browse files Browse the repository at this point in the history
Signed-off-by: Yi Dong <[email protected]>
  • Loading branch information
yidong72 authored May 23, 2022
1 parent 4c58053 commit f7343ee
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nemo/collections/nlp/modules/common/text_generation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ def put(self):
repetition_penalty,
min_tokens_to_generate,
)
for k in output:
if isinstance(output[k], torch.Tensor):
output[k] = output[k].tolist()
if not all_probs:
del output['full_logprob']
return jsonify(output)
Expand Down

0 comments on commit f7343ee

Please sign in to comment.