Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
1fec32ad
Unverified
Commit
1fec32ad
authored
Aug 18, 2021
by
Jannis Vamvas
Committed by
GitHub
Aug 18, 2021
Browse files
Fix generation docstrings regarding input_ids=None (#12823)
parent
ecfa7eb2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
20 deletions
+15
-20
src/transformers/generation_flax_utils.py
src/transformers/generation_flax_utils.py
+1
-1
src/transformers/generation_tf_utils.py
src/transformers/generation_tf_utils.py
+2
-2
src/transformers/generation_utils.py
src/transformers/generation_utils.py
+12
-17
No files found.
src/transformers/generation_flax_utils.py
View file @
1fec32ad
...
@@ -190,7 +190,7 @@ class FlaxGenerationMixin:
...
@@ -190,7 +190,7 @@ class FlaxGenerationMixin:
Parameters:
Parameters:
input_ids (:obj:`jnp.ndarray` of shape :obj:`(batch_size, sequence_length)`
, `optional`
):
input_ids (:obj:`jnp.ndarray` of shape :obj:`(batch_size, sequence_length)`):
The sequence used as a prompt for the generation.
The sequence used as a prompt for the generation.
max_length (:obj:`int`, `optional`, defaults to 20):
max_length (:obj:`int`, `optional`, defaults to 20):
The maximum length of the sequence to be generated.
The maximum length of the sequence to be generated.
...
...
src/transformers/generation_tf_utils.py
View file @
1fec32ad
...
@@ -400,8 +400,8 @@ class TFGenerationMixin:
...
@@ -400,8 +400,8 @@ class TFGenerationMixin:
Parameters:
Parameters:
input_ids (:obj:`tf.Tensor` of :obj:`dtype=tf.int32` and shape :obj:`(batch_size, sequence_length)`, `optional`):
input_ids (:obj:`tf.Tensor` of :obj:`dtype=tf.int32` and shape :obj:`(batch_size, sequence_length)`, `optional`):
The sequence used as a prompt for the generation. If :obj:`None` the method initializes it
as an empty
The sequence used as a prompt for the generation. If :obj:`None` the method initializes it
with
:obj:`
tf.Tensor` of shape :obj:`(1,)`
.
:obj:`
bos_token_id` and a batch size of 1
.
max_length (:obj:`int`, `optional`, defaults to 20):
max_length (:obj:`int`, `optional`, defaults to 20):
The maximum length of the sequence to be generated.
The maximum length of the sequence to be generated.
min_length (:obj:`int`, `optional`, defaults to 10):
min_length (:obj:`int`, `optional`, defaults to 10):
...
...
src/transformers/generation_utils.py
View file @
1fec32ad
...
@@ -692,8 +692,8 @@ class GenerationMixin:
...
@@ -692,8 +692,8 @@ class GenerationMixin:
Parameters:
Parameters:
input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`):
input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`):
The sequence used as a prompt for the generation. If :obj:`None` the method initializes it
as an empty
The sequence used as a prompt for the generation. If :obj:`None` the method initializes it
with
:obj:`
torch.LongTensor` of shape :obj:`(1,)`
.
:obj:`
bos_token_id` and a batch size of 1
.
max_length (:obj:`int`, `optional`, defaults to :obj:`model.config.max_length`):
max_length (:obj:`int`, `optional`, defaults to :obj:`model.config.max_length`):
The maximum length of the sequence to be generated.
The maximum length of the sequence to be generated.
max_new_tokens (:obj:`int`, `optional`, defaults to None):
max_new_tokens (:obj:`int`, `optional`, defaults to None):
...
@@ -1165,9 +1165,8 @@ class GenerationMixin:
...
@@ -1165,9 +1165,8 @@ class GenerationMixin:
Parameters:
Parameters:
input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`):
input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`):
The sequence used as a prompt for the generation. If :obj:`None` the method initializes it as an empty
The sequence used as a prompt for the generation.
:obj:`torch.LongTensor` of shape :obj:`(1,)`.
logits_processor (:obj:`LogitsProcessorList`, `optional`):
logits_processor (:obj:`LogitsProcessorList`, `optional`):
An instance of :class:`~transformers.LogitsProcessorList`. List of instances of class derived from
An instance of :class:`~transformers.LogitsProcessorList`. List of instances of class derived from
:class:`~transformers.LogitsProcessor` used to modify the prediction scores of the language modeling
:class:`~transformers.LogitsProcessor` used to modify the prediction scores of the language modeling
...
@@ -1391,9 +1390,8 @@ class GenerationMixin:
...
@@ -1391,9 +1390,8 @@ class GenerationMixin:
Parameters:
Parameters:
input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`):
input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`):
The sequence used as a prompt for the generation. If :obj:`None` the method initializes it as an empty
The sequence used as a prompt for the generation.
:obj:`torch.LongTensor` of shape :obj:`(1,)`.
logits_processor (:obj:`LogitsProcessorList`, `optional`):
logits_processor (:obj:`LogitsProcessorList`, `optional`):
An instance of :class:`~transformers.LogitsProcessorList`. List of instances of class derived from
An instance of :class:`~transformers.LogitsProcessorList`. List of instances of class derived from
:class:`~transformers.LogitsProcessor` used to modify the prediction scores of the language modeling
:class:`~transformers.LogitsProcessor` used to modify the prediction scores of the language modeling
...
@@ -1632,9 +1630,8 @@ class GenerationMixin:
...
@@ -1632,9 +1630,8 @@ class GenerationMixin:
Parameters:
Parameters:
input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`):
input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`):
The sequence used as a prompt for the generation. If :obj:`None` the method initializes it as an empty
The sequence used as a prompt for the generation.
:obj:`torch.LongTensor` of shape :obj:`(1,)`.
beam_scorer (:obj:`BeamScorer`):
beam_scorer (:obj:`BeamScorer`):
An derived instance of :class:`~transformers.BeamScorer` that defines how beam hypotheses are
An derived instance of :class:`~transformers.BeamScorer` that defines how beam hypotheses are
constructed, stored and sorted during generation. For more information, the documentation of
constructed, stored and sorted during generation. For more information, the documentation of
...
@@ -1925,9 +1922,8 @@ class GenerationMixin:
...
@@ -1925,9 +1922,8 @@ class GenerationMixin:
Parameters:
Parameters:
input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`):
input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`):
The sequence used as a prompt for the generation. If :obj:`None` the method initializes it as an empty
The sequence used as a prompt for the generation.
:obj:`torch.LongTensor` of shape :obj:`(1,)`.
beam_scorer (:obj:`BeamScorer`):
beam_scorer (:obj:`BeamScorer`):
A derived instance of :class:`~transformers.BeamScorer` that defines how beam hypotheses are
A derived instance of :class:`~transformers.BeamScorer` that defines how beam hypotheses are
constructed, stored and sorted during generation. For more information, the documentation of
constructed, stored and sorted during generation. For more information, the documentation of
...
@@ -2228,9 +2224,8 @@ class GenerationMixin:
...
@@ -2228,9 +2224,8 @@ class GenerationMixin:
Parameters:
Parameters:
input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`, `optional`):
input_ids (:obj:`torch.LongTensor` of shape :obj:`(batch_size, sequence_length)`):
The sequence used as a prompt for the generation. If :obj:`None` the method initializes it as an empty
The sequence used as a prompt for the generation.
:obj:`torch.LongTensor` of shape :obj:`(1,)`.
beam_scorer (:obj:`BeamScorer`):
beam_scorer (:obj:`BeamScorer`):
An derived instance of :class:`~transformers.BeamScorer` that defines how beam hypotheses are
An derived instance of :class:`~transformers.BeamScorer` that defines how beam hypotheses are
constructed, stored and sorted during generation. For more information, the documentation of
constructed, stored and sorted during generation. For more information, the documentation of
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment