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
2ff1f5a2
Commit
2ff1f5a2
authored
Nov 05, 2021
by
Leo Gao
Browse files
Add imports and fix comment
parent
8ef7a515
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
lm_eval/base.py
lm_eval/base.py
+3
-4
No files found.
lm_eval/base.py
View file @
2ff1f5a2
...
...
@@ -5,6 +5,8 @@ import numpy as np
import
re
from
tqdm
import
tqdm
import
torch
import
torch.nn
as
nn
import
torch.nn.functional
as
F
from
lm_eval.metrics
import
mean
,
perplexity
,
weighted_perplexity
,
weighted_mean
from
lm_eval
import
utils
...
...
@@ -130,7 +132,7 @@ class BaseLM(LM):
"""
pass
# subclass must implement properties vocab_size, eot_token_id, max_gen_toks.
# subclass must implement properties vocab_size, eot_token_id, max_gen_toks
, batch_size, device, max_length
.
# TODO: enforce this somehow
def
loglikelihood
(
self
,
requests
):
...
...
@@ -174,9 +176,6 @@ class BaseLM(LM):
return
loglikelihoods
# subclass must implement properties batch_size, vocab_size, eot_token_id, max_gen_toks, device.
# TODO: enforce this somehow
def
_loglikelihood_tokens
(
self
,
requests
,
disable_tqdm
=
False
):
# TODO: implement some kind of efficient-request-middleware that lumps together requests with the same context
res
=
[]
...
...
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