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
"vscode:/vscode.git/clone" did not exist on "501307b58bdc2db1b6a25271a3f60975130f1c6c"
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 = [
...
@@ -14,6 +14,7 @@ models = [
abbr
=
'LightllmAPI'
,
abbr
=
'LightllmAPI'
,
type
=
LightllmAPI
,
type
=
LightllmAPI
,
url
=
'http://localhost:8080/generate'
,
url
=
'http://localhost:8080/generate'
,
input_format
=
'<input_text_to_replace>'
,
max_seq_len
=
2048
,
max_seq_len
=
2048
,
batch_size
=
32
,
batch_size
=
32
,
generation_kwargs
=
dict
(
generation_kwargs
=
dict
(
...
...
opencompass/models/lightllm_api.py
View file @
b6e21ece
...
@@ -20,6 +20,7 @@ class LightllmAPI(BaseAPIModel):
...
@@ -20,6 +20,7 @@ class LightllmAPI(BaseAPIModel):
self
,
self
,
path
:
str
=
'LightllmAPI'
,
path
:
str
=
'LightllmAPI'
,
url
:
str
=
'http://localhost:8080/generate'
,
url
:
str
=
'http://localhost:8080/generate'
,
input_format
:
str
=
'<input_text_to_replace>'
,
max_seq_len
:
int
=
2048
,
max_seq_len
:
int
=
2048
,
meta_template
:
Optional
[
Dict
]
=
None
,
meta_template
:
Optional
[
Dict
]
=
None
,
retry
:
int
=
2
,
retry
:
int
=
2
,
...
@@ -33,6 +34,7 @@ class LightllmAPI(BaseAPIModel):
...
@@ -33,6 +34,7 @@ class LightllmAPI(BaseAPIModel):
generation_kwargs
=
generation_kwargs
)
generation_kwargs
=
generation_kwargs
)
self
.
logger
=
get_logger
()
self
.
logger
=
get_logger
()
self
.
url
=
url
self
.
url
=
url
self
.
input_format
=
input_format
self
.
generation_kwargs
=
generation_kwargs
self
.
generation_kwargs
=
generation_kwargs
self
.
max_out_len
=
self
.
generation_kwargs
.
get
(
'max_new_tokens'
,
1024
)
self
.
max_out_len
=
self
.
generation_kwargs
.
get
(
'max_new_tokens'
,
1024
)
...
@@ -62,6 +64,8 @@ class LightllmAPI(BaseAPIModel):
...
@@ -62,6 +64,8 @@ class LightllmAPI(BaseAPIModel):
self
.
wait
()
self
.
wait
()
header
=
{
'content-type'
:
'application/json'
}
header
=
{
'content-type'
:
'application/json'
}
try
:
try
:
input
=
self
.
input_format
.
replace
(
'<input_text_to_replace>'
,
input
)
data
=
dict
(
inputs
=
input
,
parameters
=
self
.
generation_kwargs
)
data
=
dict
(
inputs
=
input
,
parameters
=
self
.
generation_kwargs
)
raw_response
=
requests
.
post
(
self
.
url
,
raw_response
=
requests
.
post
(
self
.
url
,
headers
=
header
,
headers
=
header
,
...
@@ -114,6 +118,8 @@ class LightllmAPI(BaseAPIModel):
...
@@ -114,6 +118,8 @@ class LightllmAPI(BaseAPIModel):
self
.
wait
()
self
.
wait
()
header
=
{
'content-type'
:
'application/json'
}
header
=
{
'content-type'
:
'application/json'
}
try
:
try
:
input
=
self
.
input_format
.
replace
(
'<input_text_to_replace>'
,
input
)
data
=
dict
(
inputs
=
input
,
parameters
=
self
.
generation_kwargs
)
data
=
dict
(
inputs
=
input
,
parameters
=
self
.
generation_kwargs
)
raw_response
=
requests
.
post
(
self
.
url
,
raw_response
=
requests
.
post
(
self
.
url
,
headers
=
header
,
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