[generate] do_sample default back to False (#3298)

* change do_samples back

* None better default as boolean

* adapt do_sample to True in test example

* make style
This commit is contained in:
Patrick von Platen
2020-03-17 15:52:37 +01:00
committed by GitHub
parent 2187c49f5c
commit e8f44af5bf
6 changed files with 30 additions and 22 deletions

View File

@@ -460,8 +460,8 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin):
input_ids=None,
max_length=None,
min_length=None,
do_sample=True,
early_stopping=False,
do_sample=None,
early_stopping=None,
num_beams=None,
temperature=None,
top_k=None,
@@ -494,7 +494,7 @@ class TFPreTrainedModel(tf.keras.Model, TFModelUtilsMixin):
The max length of the sequence to be generated. Between 1 and infinity. Default to 20.
do_sample: (`optional`) bool
If set to `False` greedy decoding is used. Otherwise sampling is used. Defaults to `True`.
If set to `False` greedy decoding is used. Otherwise sampling is used. Defaults to `False`.
num_beams: (`optional`) int
Number of beams for beam search. Must be between 1 and infinity. 1 means no beam search. Default to 1.

View File

@@ -656,8 +656,8 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin):
input_ids=None,
max_length=None,
min_length=None,
do_sample=True,
early_stopping=False,
do_sample=None,
early_stopping=None,
num_beams=None,
temperature=None,
top_k=None,
@@ -691,7 +691,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin):
The max length of the sequence to be generated. Between 1 and infinity. Default to 20.
do_sample: (`optional`) bool
If set to `False` greedy decoding is used. Otherwise sampling is used. Defaults to `True`.
If set to `False` greedy decoding is used. Otherwise sampling is used. Defaults to `False`.
num_beams: (`optional`) int
Number of beams for beam search. Must be between 1 and infinity. 1 means no beam search. Default to 1.