[docs] Correct the statement in the docstirng of compute_transition_scores in generation/utils.py (#28786)

This commit is contained in:
Shichao Song 2024-02-01 01:07:30 +08:00 committed by GitHub
parent 4735866141
commit 7b2bd1fbbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -968,7 +968,7 @@ class GenerationMixin:
>>> input_length = 1 if model.config.is_encoder_decoder else inputs.input_ids.shape[1]
>>> generated_tokens = outputs.sequences[:, input_length:]
>>> for tok, score in zip(generated_tokens[0], transition_scores[0]):
... # | token | token string | logits | probability
... # | token | token string | log probability | probability
... print(f"| {tok:5d} | {tokenizer.decode(tok):8s} | {score.numpy():.3f} | {np.exp(score.numpy()):.2%}")
| 262 | the | -1.414 | 24.33%
| 1110 | day | -2.609 | 7.36%