File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -254,8 +254,9 @@ namespace ctranslate2 {
254254 sampling_topp: Keep the most probable tokens whose cumulative probability exceeds
255255 this value.
256256 sampling_temperature: Sampling temperature to generate more random samples.
257- callback: Optional function that is called for each generated token.
258- This requires a beam size of 1.
257+ callback: Optional function that is called for each generated token when
258+ :obj:`beam_size` is 1. If the callback function returns ``True``, the
259+ decoding will stop for this batch.
259260
260261 Returns:
261262 A list of generation results.
Original file line number Diff line number Diff line change @@ -490,8 +490,9 @@ namespace ctranslate2 {
490490 this value.
491491 sampling_temperature: Sampling temperature to generate more random samples.
492492 replace_unknowns: Replace unknown target tokens by the source token with the highest attention.
493- callback: Optional function that is called for each generated token.
494- This requires a beam size of 1.
493+ callback: Optional function that is called for each generated token when
494+ :obj:`beam_size` is 1. If the callback function returns ``True``, the
495+ decoding will stop for this batch.
495496
496497 Returns:
497498 A list of translation results.
You can’t perform that action at this time.
0 commit comments