Skip to content

Commit

Permalink
Add comprehensive error messages (#7261)
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Peganov <[email protected]>
  • Loading branch information
PeganovAnton committed Sep 12, 2023
1 parent fefa3f1 commit 5ccb70f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions nemo/collections/nlp/modules/common/text_generation_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,14 @@ def get_computeprob_response(tokenizer, response, inputs):
token_len = int(inputs[1][batch_id].item())
new_token_id = inputs[0][batch_id][:token_len].tolist()
new_text = tokenizer.ids_to_text(new_token_id)
else:
raise TypeError(
f"Unsupported type of `inputs[0]`: {type(inputs[0])}. Supported types: `str`, `torch.Tensor`."
)
else:
raise TypeError(
f"Unsupported type of parameter `inputs`: {type(inputs)}. Supported types: `list` and `tuple`"
)
new_token_ids.append(new_token_id)
new_tokens.append(response['tokens'][batch_id][:token_len])
new_texts.append(new_text)
Expand Down

0 comments on commit 5ccb70f

Please sign in to comment.