Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
6a375880
Unverified
Commit
6a375880
authored
Feb 27, 2020
by
Sam Shleifer
Committed by
GitHub
Feb 27, 2020
Browse files
spelling: strictly (#3042)
parent
f4ff44a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
src/transformers/modeling_utils.py
src/transformers/modeling_utils.py
+6
-6
No files found.
src/transformers/modeling_utils.py
View file @
6a375880
...
...
@@ -626,7 +626,7 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin):
Number of beams for beam search. Must be between 1 and infinity. 1 means no beam search. Default to 1.
temperature: (`optional`) float
The value used to module the next token probabilities. Must be strict
e
ly positive. Default to 1.0.
The value used to module the next token probabilities. Must be strictly positive. Default to 1.0.
top_k: (`optional`) int
The number of highest probability vocabulary tokens to keep for top-k-filtering. Between 1 and infinity. Default to 50.
...
...
@@ -714,10 +714,10 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin):
if
isinstance
(
eos_token_ids
,
int
):
eos_token_ids
=
[
eos_token_ids
]
assert
isinstance
(
max_length
,
int
)
and
max_length
>
0
,
"`max_length` should be a strict
e
ly positive integer."
assert
isinstance
(
max_length
,
int
)
and
max_length
>
0
,
"`max_length` should be a strictly positive integer."
assert
isinstance
(
do_sample
,
bool
),
"`do_sample` should be a boolean."
assert
isinstance
(
num_beams
,
int
)
and
num_beams
>
0
,
"`num_beams` should be a strict
e
ly positive integer."
assert
temperature
>
0
,
"`temperature` should be strict
e
ly positive."
assert
isinstance
(
num_beams
,
int
)
and
num_beams
>
0
,
"`num_beams` should be a strictly positive integer."
assert
temperature
>
0
,
"`temperature` should be strictly positive."
assert
isinstance
(
top_k
,
int
)
and
top_k
>=
0
,
"`top_k` should be a positive integer."
assert
0
<=
top_p
<=
1
,
"`top_p` should be between 0 and 1."
assert
repetition_penalty
>=
1.0
,
"`repetition_penalty` should be >= 1."
...
...
@@ -730,10 +730,10 @@ class PreTrainedModel(nn.Module, ModuleUtilsMixin):
assert
(
eos_token_ids
is
None
)
or
(
isinstance
(
eos_token_ids
,
(
list
,
tuple
))
and
((
isinstance
(
e
,
int
)
and
e
>=
0
)
for
e
in
eos_token_ids
)
),
"`eos_token_ids` should be a positive integer or a list/tuple of positive integers."
assert
length_penalty
>
0
,
"`length_penalty` should be strict
e
ly positive."
assert
length_penalty
>
0
,
"`length_penalty` should be strictly positive."
assert
(
isinstance
(
num_return_sequences
,
int
)
and
num_return_sequences
>
0
),
"`num_return_sequences` should be a strict
e
ly positive integer."
),
"`num_return_sequences` should be a strictly positive integer."
if
input_ids
is
None
:
assert
isinstance
(
bos_token_id
,
int
)
and
bos_token_id
>=
0
,
(
...
...
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