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
gaoqiong
lm-evaluation-harness
Commits
7f8d6676
"official/legacy/image_classification/classifier_trainer.py" did not exist on "b035a2273710eec9631aca27fcad78f68e30b838"
Commit
7f8d6676
authored
Oct 01, 2021
by
Leo Gao
Browse files
UPdate cost estimate
parent
7a058d69
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
scripts/cost_estimate.py
scripts/cost_estimate.py
+16
-6
No files found.
scripts/cost_estimate.py
View file @
7f8d6676
...
...
@@ -33,26 +33,36 @@ class DryrunLM(LM):
self
.
tokencost
+=
len
(
self
.
tokenizer
.
tokenize
(
ctx
))
+
256
return
res
def
loglikelihood_rolling
(
self
,
requests
):
res
=
[]
for
s
,
in
requests
:
# assume worst case: extra full context
self
.
tokencost
+=
len
(
self
.
tokenizer
.
tokenize
(
s
))
+
2048
return
res
def
main
():
lm
=
DryrunLM
()
task_list
=
"arc_challenge,arc_easy,boolq,cola,copa,headqa,hellaswag,lambada,logiqa,mathqa,mc_taco,mrpc,multirc,openbookqa,piqa,prost,pubmedqa,qnli,qqp,race,record,rte,sciq,sst,triviaqa,webqs,wic,wikitext,winogrande,wnli,wsc"
values
=
[]
for
taskname
in
list
(
tasks
.
TASK_REGISTRY
.
keys
()
):
for
taskname
in
task_list
.
split
(
","
):
lm
.
tokencost
=
0
evaluator
.
evaluate
(
lm
,
{
taskname
:
tasks
.
get_task
(
taskname
)()},
False
,
0
,
None
)
evaluator
.
evaluate
(
lm
,
{
taskname
:
tasks
.
get_task
(
taskname
)()},
False
,
0
,
None
,
bootstrap_iters
=
10
)
print
(
taskname
,
lm
.
tokencost
)
values
.
append
([
taskname
,
lm
.
tokencost
,
lm
.
tokencost
/
1000
*
0.06
])
values
.
append
([
taskname
,
lm
.
tokencost
,
lm
.
tokencost
/
1000
*
0.0008
,
lm
.
tokencost
/
1000
*
0.0012
,
lm
.
tokencost
/
1000
*
0.006
,
lm
.
tokencost
/
1000
*
0.06
])
from
pytablewriter
import
MarkdownTableWriter
writer
=
MarkdownTableWriter
()
writer
.
headers
=
[
"Task"
,
"Tokens"
,
"Davinci
Cost
"
]
writer
.
headers
=
[
"Task"
,
"Tokens"
,
"Ada"
,
"Babbage"
,
"Curie"
,
"Davinci"
]
values
.
sort
(
key
=
lambda
x
:
-
x
[
1
])
totcost
=
sum
([
x
[
1
]
for
x
in
values
])
values
.
append
([
"**Total**"
,
totcost
,
totcost
/
1000
*
0.06
])
values
.
append
([
"**Total**"
,
totcost
,
totcost
/
1000
*
0.0008
,
totcost
/
1000
*
0.0012
,
totcost
/
1000
*
0.006
,
totcost
/
1000
*
0.06
])
writer
.
value_matrix
=
values
...
...
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