Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
c134a464
Unverified
Commit
c134a464
authored
Aug 13, 2024
by
Chang Su
Committed by
GitHub
Aug 14, 2024
Browse files
Fix empty output when temp is too low (#2937)
Co-authored-by:
Cyrus Leung
<
tlleungac@connect.ust.hk
>
parent
199adbb7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
vllm/model_executor/layers/sampler.py
vllm/model_executor/layers/sampler.py
+2
-1
vllm/sampling_params.py
vllm/sampling_params.py
+7
-0
No files found.
vllm/model_executor/layers/sampler.py
View file @
c134a464
...
...
@@ -118,8 +118,9 @@ class Sampler(nn.Module):
sampling_tensors
.
frequency_penalties
,
sampling_tensors
.
repetition_penalties
)
#
A
pply temperature scaling.
#
Use float32 to a
pply temperature scaling.
# Use in-place division to avoid creating a new tensor.
logits
=
logits
.
to
(
torch
.
float
)
logits
.
div_
(
sampling_tensors
.
temperatures
.
unsqueeze
(
dim
=
1
))
if
do_top_p_top_k
:
...
...
vllm/sampling_params.py
View file @
c134a464
...
...
@@ -13,6 +13,7 @@ from vllm.logger import init_logger
logger
=
init_logger
(
__name__
)
_SAMPLING_EPS
=
1e-5
_MAX_TEMP
=
1e-2
class
SamplingType
(
IntEnum
):
...
...
@@ -145,6 +146,12 @@ class SamplingParams:
self
.
presence_penalty
=
presence_penalty
self
.
frequency_penalty
=
frequency_penalty
self
.
repetition_penalty
=
repetition_penalty
if
0
<
temperature
<
_MAX_TEMP
:
logger
.
warning
(
"temperature %s is less than %s, which may cause numerical "
"errors nan or inf in tensors. We have maxed it out to %s."
,
temperature
,
_MAX_TEMP
,
_MAX_TEMP
)
temperature
=
max
(
temperature
,
_MAX_TEMP
)
self
.
temperature
=
temperature
self
.
top_p
=
top_p
self
.
top_k
=
top_k
...
...
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