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
de2f7221
Unverified
Commit
de2f7221
authored
May 13, 2024
by
Joao Gante
Committed by
GitHub
May 13, 2024
Browse files
Generate: remove near-duplicate sample/greedy copy (#30773)
parent
ce87dca1
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
418 deletions
+92
-418
src/transformers/generation/utils.py
src/transformers/generation/utils.py
+87
-413
src/transformers/models/musicgen/modeling_musicgen.py
src/transformers/models/musicgen/modeling_musicgen.py
+2
-2
src/transformers/models/musicgen_melody/modeling_musicgen_melody.py
...ormers/models/musicgen_melody/modeling_musicgen_melody.py
+2
-2
src/transformers/models/rag/modeling_rag.py
src/transformers/models/rag/modeling_rag.py
+1
-1
No files found.
src/transformers/generation/utils.py
View file @
de2f7221
This diff is collapsed.
Click to expand it.
src/transformers/models/musicgen/modeling_musicgen.py
View file @
de2f7221
...
...
@@ -1739,7 +1739,7 @@ class MusicgenForCausalLM(MusicgenPreTrainedModel):
)
# 11. run greedy search
outputs
=
self
.
_
greedy_search
(
outputs
=
self
.
_
sample
(
input_ids
,
logits_processor
=
logits_processor
,
stopping_criteria
=
stopping_criteria
,
...
...
@@ -2832,7 +2832,7 @@ class MusicgenForConditionalGeneration(PreTrainedModel):
)
# 11. run greedy search
outputs
=
self
.
_
greedy_search
(
outputs
=
self
.
_
sample
(
input_ids
,
logits_processor
=
logits_processor
,
stopping_criteria
=
stopping_criteria
,
...
...
src/transformers/models/musicgen_melody/modeling_musicgen_melody.py
View file @
de2f7221
...
...
@@ -1676,7 +1676,7 @@ class MusicgenMelodyForCausalLM(MusicgenMelodyPreTrainedModel):
)
# 11. run greedy search
outputs
=
self
.
_
greedy_search
(
outputs
=
self
.
_
sample
(
input_ids
,
logits_processor
=
logits_processor
,
stopping_criteria
=
stopping_criteria
,
...
...
@@ -2691,7 +2691,7 @@ class MusicgenMelodyForConditionalGeneration(PreTrainedModel):
)
# 11. run greedy search
outputs
=
self
.
_
greedy_search
(
outputs
=
self
.
_
sample
(
input_ids
,
logits_processor
=
logits_processor
,
stopping_criteria
=
stopping_criteria
,
...
...
src/transformers/models/rag/modeling_rag.py
View file @
de2f7221
...
...
@@ -1550,7 +1550,7 @@ class RagTokenForGeneration(RagPreTrainedModel):
f
"num_return_sequences has to be 1, but is
{
generation_config
.
num_return_sequences
}
when doing"
" greedy search."
)
return
self
.
_
greedy_search
(
return
self
.
_
sample
(
input_ids
,
logits_processor
=
pre_processor
,
stopping_criteria
=
prepared_stopping_criteria
,
...
...
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