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
a5be9541
"docs/vscode:/vscode.git/clone" did not exist on "8ac29fe0905c3f7f04963ef22c4f61e59ee1004a"
Unverified
Commit
a5be9541
authored
Oct 14, 2021
by
David del Río Medina
Committed by
GitHub
Oct 14, 2021
Browse files
Replace assertion with ValueError exception (#14006)
parent
cc360649
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
src/transformers/generation_flax_logits_process.py
src/transformers/generation_flax_logits_process.py
+5
-3
No files found.
src/transformers/generation_flax_logits_process.py
View file @
a5be9541
...
...
@@ -84,9 +84,11 @@ class FlaxLogitsProcessorList(list):
for
processor
in
self
:
function_args
=
inspect
.
signature
(
processor
.
__call__
).
parameters
if
len
(
function_args
)
>
3
:
assert
all
(
arg
in
kwargs
for
arg
in
list
(
function_args
.
keys
())[
2
:]
),
f
"Make sure that all the required parameters:
{
list
(
function_args
.
keys
())
}
for
{
processor
.
__class__
}
are passed to the logits processor."
if
not
all
(
arg
in
kwargs
for
arg
in
list
(
function_args
.
keys
())[
2
:]):
raise
ValueError
(
f
"Make sure that all the required parameters:
{
list
(
function_args
.
keys
())
}
for "
f
"
{
processor
.
__class__
}
are passed to the logits processor."
)
scores
=
processor
(
input_ids
,
scores
,
cur_len
,
**
kwargs
)
else
:
scores
=
processor
(
input_ids
,
scores
,
cur_len
)
...
...
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