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
7c011370
Unverified
Commit
7c011370
authored
Dec 05, 2021
by
Leo Gao
Committed by
GitHub
Dec 05, 2021
Browse files
Get rid of get_token_logprobs
parent
ae63eeb7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
21 deletions
+0
-21
lm_eval/models/gpt3.py
lm_eval/models/gpt3.py
+0
-21
No files found.
lm_eval/models/gpt3.py
View file @
7c011370
...
...
@@ -107,27 +107,6 @@ class GPT3LM(BaseLM):
def
tok_decode
(
self
,
tokens
):
return
self
.
tokenizer
.
decode
(
tokens
)
def
get_token_logprobs
(
self
,
input_tokens
,
pred_tokens
):
pred_start
=
len
(
input_tokens
)
-
len
(
pred_tokens
)
+
1
# We're going to stitch together the input_tokens and pred_tokens
# In the longest case, this gets us to length = max_seq_len+1 (which the API works with)
assert
input_tokens
[
pred_start
:]
==
pred_tokens
[:
-
1
]
token_ids
=
input_tokens
+
[
pred_tokens
[
-
1
]]
response
=
oa_completion
(
engine
=
self
.
engine
,
prompt
=
token_ids
,
max_tokens
=
0
,
temperature
=
0.0
,
logprobs
=
0
,
echo
=
True
,
)
logprobs
=
np
.
array
(
response
[
"choices"
][
0
][
"logprobs"
][
"token_logprobs"
][
pred_start
:])
positions
=
np
.
arange
(
pred_start
-
1
,
pred_start
-
1
+
len
(
token_ids
[
pred_start
:]))
return
{
"logprobs"
:
logprobs
,
"positions"
:
positions
,
}
def
_loglikelihood_tokens
(
self
,
requests
,
disable_tqdm
=
False
):
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