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
norm
vllm
Commits
3c2b47fc
Commit
3c2b47fc
authored
Feb 09, 2023
by
Woosuk Kwon
Browse files
Add decoding params
parent
5e644b91
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
0 deletions
+30
-0
cacheflow/decoding.py
cacheflow/decoding.py
+30
-0
No files found.
cacheflow/decoding.py
0 → 100644
View file @
3c2b47fc
from
typing
import
List
class
DecodingParams
:
def
__init__
(
self
,
n
:
int
=
1
,
temperature
:
float
=
1.0
,
top_p
:
float
=
1.0
,
use_beam_search
:
bool
=
False
,
stop_token_ids
:
List
[
int
]
=
[],
)
->
None
:
assert
n
>=
1
assert
temperature
>=
0.0
assert
0.0
<
top_p
<=
1.0
if
use_beam_search
:
assert
n
>
1
assert
temperature
>
0.0
assert
top_p
==
1.0
elif
temperature
==
0.0
:
# Zero temperature means greedy decoding.
assert
n
==
1
assert
top_p
==
1.0
self
.
n
=
n
self
.
temperature
=
temperature
self
.
top_p
=
top_p
self
.
use_beam_search
=
use_beam_search
self
.
stop_token_ids
=
stop_token_ids
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