Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LongBench
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
thukeg
LongBench
Commits
2533f68b
Unverified
Commit
2533f68b
authored
1 year ago
by
JackKuo666
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Update support chatglm3
parent
7738f1dc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pred.py
+3
-3
3 additions, 3 deletions
pred.py
with
3 additions
and
3 deletions
pred.py
+
3
−
3
View file @
2533f68b
...
...
@@ -11,7 +11,7 @@ from llama_flash_attn_monkey_patch import replace_llama_attn_with_flash_attn
def
parse_args
(
args
=
None
):
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'
--model
'
,
type
=
str
,
default
=
None
,
choices
=
[
"
llama2-7b-chat-4k
"
,
"
longchat-v1.5-7b-32k
"
,
"
xgen-7b-8k
"
,
"
internlm-7b-8k
"
,
"
chatglm2-6b
"
,
"
chatglm2-6b-32k
"
,
"
vicuna-v1.5-7b-16k
"
])
parser
.
add_argument
(
'
--model
'
,
type
=
str
,
default
=
None
,
choices
=
[
"
llama2-7b-chat-4k
"
,
"
longchat-v1.5-7b-32k
"
,
"
xgen-7b-8k
"
,
"
internlm-7b-8k
"
,
"
chatglm2-6b
"
,
"
chatglm2-6b-32k
"
,
"
chatglm3-6b-32k
"
,
"
vicuna-v1.5-7b-16k
"
])
parser
.
add_argument
(
'
--e
'
,
action
=
'
store_true
'
,
help
=
"
Evaluate on LongBench-E
"
)
return
parser
.
parse_args
(
args
)
...
...
@@ -60,7 +60,7 @@ def get_pred(model, tokenizer, data, max_length, max_gen, prompt_format, dataset
if
dataset
not
in
[
"
trec
"
,
"
triviaqa
"
,
"
samsum
"
,
"
lsht
"
,
"
lcc
"
,
"
repobench-p
"
]:
# chat models are better off without build prompts on these tasks
prompt
=
build_chat
(
tokenizer
,
prompt
,
model_name
)
if
"
chatglm3
"
in
model_name
:
input
=
prompt
input
=
prompt
.
to
(
device
)
else
:
input
=
tokenizer
(
prompt
,
truncation
=
False
,
return_tensors
=
"
pt
"
).
to
(
device
)
context_length
=
input
.
input_ids
.
shape
[
-
1
]
...
...
@@ -163,4 +163,4 @@ if __name__ == '__main__':
with
open
(
out_path
,
"
w
"
,
encoding
=
"
utf-8
"
)
as
f
:
for
pred
in
preds
:
json
.
dump
(
pred
,
f
,
ensure_ascii
=
False
)
f
.
write
(
'
\n
'
)
\ No newline at end of file
f
.
write
(
'
\n
'
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment