Commit 6c1b2355 authored by Lysandre's avatar Lysandre
Browse files

Sample instead of greedy decoding by default in generate

parent 239dd23f
...@@ -586,7 +586,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin): ...@@ -586,7 +586,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin):
self, self,
input_ids=None, input_ids=None,
max_length=None, max_length=None,
do_sample=None, do_sample=True,
num_beams=None, num_beams=None,
temperature=None, temperature=None,
top_k=None, top_k=None,
...@@ -617,7 +617,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin): ...@@ -617,7 +617,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin):
The max length of the sequence to be generated. Between 1 and infinity. Default to 20. The max length of the sequence to be generated. Between 1 and infinity. Default to 20.
do_sample: (`optional`) bool do_sample: (`optional`) bool
If set to `False` greedy decoding is used. Otherwise sampling is used. Default to greedy sampling. If set to `False` greedy decoding is used. Otherwise sampling is used. Defaults to `True`.
num_beams: (`optional`) int num_beams: (`optional`) int
Number of beams for beam search. Must be between 1 and infinity. 1 means no beam search. Default to 1. Number of beams for beam search. Must be between 1 and infinity. 1 means no beam search. Default to 1.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment