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
b6e06c84
"...ui/git@developer.sourcefind.cn:chenpangpang/ComfyUI.git" did not exist on "0d9009c96ea5a1922a1c187deef27c7f133ee946"
Unverified
Commit
b6e06c84
authored
Mar 17, 2022
by
Boris Dayma
Committed by
GitHub
Mar 17, 2022
Browse files
fix(flax): generate with logits processor/warper (#16231)
parent
1c1e377e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/generation_flax_utils.py
src/transformers/generation_flax_utils.py
+2
-2
No files found.
src/transformers/generation_flax_utils.py
View file @
b6e06c84
...
...
@@ -560,10 +560,10 @@ class FlaxGenerationMixin:
# apply min_length, ...
logits
=
logits_processor
(
state
.
sequences
,
logits
,
state
.
cur_len
)
# apply top_
k
, top_k, temperature
# apply top_
p
, top_k, temperature
logits
=
logits_warper
(
logits
,
logits
,
state
.
cur_len
)
next_token
=
jax
.
random
.
categorical
(
prng_key
,
model_outputs
.
logits
[:,
-
1
]
,
axis
=-
1
)
next_token
=
jax
.
random
.
categorical
(
prng_key
,
logits
,
axis
=-
1
)
next_is_sent_finished
=
state
.
is_sent_finished
|
(
next_token
==
eos_token_id
)
next_token
=
next_token
*
~
next_is_sent_finished
+
pad_token_id
*
next_is_sent_finished
...
...
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