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
OpenDAS
opencompass
Commits
b6e21ece
Unverified
Commit
b6e21ece
authored
Feb 19, 2024
by
Yang Yong
Committed by
GitHub
Feb 19, 2024
Browse files
Support LightllmApi input_format (#888)
parent
08133e06
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
0 deletions
+7
-0
configs/eval_lightllm.py
configs/eval_lightllm.py
+1
-0
opencompass/models/lightllm_api.py
opencompass/models/lightllm_api.py
+6
-0
No files found.
configs/eval_lightllm.py
View file @
b6e21ece
...
...
@@ -14,6 +14,7 @@ models = [
abbr
=
'LightllmAPI'
,
type
=
LightllmAPI
,
url
=
'http://localhost:8080/generate'
,
input_format
=
'<input_text_to_replace>'
,
max_seq_len
=
2048
,
batch_size
=
32
,
generation_kwargs
=
dict
(
...
...
opencompass/models/lightllm_api.py
View file @
b6e21ece
...
...
@@ -20,6 +20,7 @@ class LightllmAPI(BaseAPIModel):
self
,
path
:
str
=
'LightllmAPI'
,
url
:
str
=
'http://localhost:8080/generate'
,
input_format
:
str
=
'<input_text_to_replace>'
,
max_seq_len
:
int
=
2048
,
meta_template
:
Optional
[
Dict
]
=
None
,
retry
:
int
=
2
,
...
...
@@ -33,6 +34,7 @@ class LightllmAPI(BaseAPIModel):
generation_kwargs
=
generation_kwargs
)
self
.
logger
=
get_logger
()
self
.
url
=
url
self
.
input_format
=
input_format
self
.
generation_kwargs
=
generation_kwargs
self
.
max_out_len
=
self
.
generation_kwargs
.
get
(
'max_new_tokens'
,
1024
)
...
...
@@ -62,6 +64,8 @@ class LightllmAPI(BaseAPIModel):
self
.
wait
()
header
=
{
'content-type'
:
'application/json'
}
try
:
input
=
self
.
input_format
.
replace
(
'<input_text_to_replace>'
,
input
)
data
=
dict
(
inputs
=
input
,
parameters
=
self
.
generation_kwargs
)
raw_response
=
requests
.
post
(
self
.
url
,
headers
=
header
,
...
...
@@ -114,6 +118,8 @@ class LightllmAPI(BaseAPIModel):
self
.
wait
()
header
=
{
'content-type'
:
'application/json'
}
try
:
input
=
self
.
input_format
.
replace
(
'<input_text_to_replace>'
,
input
)
data
=
dict
(
inputs
=
input
,
parameters
=
self
.
generation_kwargs
)
raw_response
=
requests
.
post
(
self
.
url
,
headers
=
header
,
...
...
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