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
d65c4a4f
"vscode:/vscode.git/clone" did not exist on "03b980990a2dba03611f2d89cdac07ea57254d48"
Unverified
Commit
d65c4a4f
authored
Sep 12, 2023
by
larekrow
Committed by
GitHub
Sep 12, 2023
Browse files
Update logits_process.py docstrings (#25971)
parent
3319eb54
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
src/transformers/generation/logits_process.py
src/transformers/generation/logits_process.py
+2
-2
No files found.
src/transformers/generation/logits_process.py
View file @
d65c4a4f
...
@@ -272,7 +272,7 @@ class RepetitionPenaltyLogitsProcessor(LogitsProcessor):
...
@@ -272,7 +272,7 @@ class RepetitionPenaltyLogitsProcessor(LogitsProcessor):
[`LogitsProcessor`] that prevents the repetition of previous tokens through an exponential penalty. This technique
[`LogitsProcessor`] that prevents the repetition of previous tokens through an exponential penalty. This technique
shares some similarities with coverage mechanisms and other aimed at reducing repetition. During the text
shares some similarities with coverage mechanisms and other aimed at reducing repetition. During the text
generation process, the probability distribution for the next token is determined using a formula that incorporates
generation process, the probability distribution for the next token is determined using a formula that incorporates
token scores based on their occurrence in the generated sequence. Tokens with higher scores are
less
likely to be
token scores based on their occurrence in the generated sequence. Tokens with higher scores are
more
likely to be
selected. The formula can be seen in the original [paper](https://arxiv.org/pdf/1909.05858.pdf). According to the
selected. The formula can be seen in the original [paper](https://arxiv.org/pdf/1909.05858.pdf). According to the
paper a penalty of around 1.2 yields a good balance between truthful generation and lack of repetition.
paper a penalty of around 1.2 yields a good balance between truthful generation and lack of repetition.
...
@@ -328,7 +328,7 @@ class EncoderRepetitionPenaltyLogitsProcessor(LogitsProcessor):
...
@@ -328,7 +328,7 @@ class EncoderRepetitionPenaltyLogitsProcessor(LogitsProcessor):
hallucination_penalty (`float`):
hallucination_penalty (`float`):
The parameter for hallucination penalty. 1.0 means no penalty.
The parameter for hallucination penalty. 1.0 means no penalty.
encoder_input_ids (`torch.LongTensor`):
encoder_input_ids (`torch.LongTensor`):
The encoder_input_ids that should
not
be repeated within the decoder ids.
The encoder_input_ids that should be repeated within the decoder ids.
"""
"""
def
__init__
(
self
,
penalty
:
float
,
encoder_input_ids
:
torch
.
LongTensor
):
def
__init__
(
self
,
penalty
:
float
,
encoder_input_ids
:
torch
.
LongTensor
):
...
...
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