Spaces:
Runtime error
Runtime error
DSXiangLi
commited on
Commit
•
2e05be9
1
Parent(s):
a536ff7
add
Browse files- ape/llm.py +2 -4
ape/llm.py
CHANGED
@@ -81,12 +81,10 @@ class LLMGPT(object):
|
|
81 |
output_len = len(LLMGPT.encoding.encode(sample[1]))
|
82 |
print(output_len)
|
83 |
llmresult = eval_chain.generate([{'instruction': instruction, 'input': sample[0], 'output': sample[1]}])
|
84 |
-
print(llmresult)
|
85 |
logprobs = llmresult.generations[0][0].generation_info['logprobs']
|
86 |
print(logprobs)
|
87 |
tokens = logprobs['tokens']
|
|
|
88 |
token_probs = logprobs['token_logprobs']
|
89 |
-
|
90 |
-
print(token_probs)
|
91 |
-
score += sum(token_probs)
|
92 |
return score
|
|
|
81 |
output_len = len(LLMGPT.encoding.encode(sample[1]))
|
82 |
print(output_len)
|
83 |
llmresult = eval_chain.generate([{'instruction': instruction, 'input': sample[0], 'output': sample[1]}])
|
|
|
84 |
logprobs = llmresult.generations[0][0].generation_info['logprobs']
|
85 |
print(logprobs)
|
86 |
tokens = logprobs['tokens']
|
87 |
+
print(len(tokens))
|
88 |
token_probs = logprobs['token_logprobs']
|
89 |
+
score += sum(token_probs[-output_len:])
|
|
|
|
|
90 |
return score
|