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
fd734be1
Unverified
Commit
fd734be1
authored
Mar 21, 2024
by
théo gigant
Committed by
GitHub
Mar 21, 2024
Browse files
fix issue with logit processor during beam search in Flax (#29636)
fix issue with logit processor in beam search in Flax
parent
691c3d73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
1 deletion
+1
-1
src/transformers/generation/flax_utils.py
src/transformers/generation/flax_utils.py
+1
-1
No files found.
src/transformers/generation/flax_utils.py
View file @
fd734be1
...
@@ -911,7 +911,7 @@ class FlaxGenerationMixin:
...
@@ -911,7 +911,7 @@ class FlaxGenerationMixin:
# add new logprobs to existing running logprobs scores.
# add new logprobs to existing running logprobs scores.
log_probs
=
jax
.
nn
.
log_softmax
(
logits
)
log_probs
=
jax
.
nn
.
log_softmax
(
logits
)
log_probs
=
logits_processor
(
log_probs
=
logits_processor
(
flatten_beam_dim
(
running_sequences
),
flatten_beam_dim
(
log_probs
),
state
.
cur_len
flatten_beam_dim
(
state
.
running_sequences
),
flatten_beam_dim
(
log_probs
),
state
.
cur_len
)
)
log_probs
=
unflatten_beam_dim
(
log_probs
,
batch_size
,
num_beams
)
log_probs
=
unflatten_beam_dim
(
log_probs
,
batch_size
,
num_beams
)
log_probs
=
log_probs
+
jnp
.
expand_dims
(
state
.
running_scores
,
axis
=
2
)
log_probs
=
log_probs
+
jnp
.
expand_dims
(
state
.
running_scores
,
axis
=
2
)
...
...
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