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
2fcd4298
Commit
2fcd4298
authored
Aug 16, 2023
by
lintangsutawika
Browse files
changed raise variable
parent
579c9db9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
lm_eval/tasks/realtoxicityprompts/metric.py
lm_eval/tasks/realtoxicityprompts/metric.py
+4
-4
No files found.
lm_eval/tasks/realtoxicityprompts/metric.py
View file @
2fcd4298
...
...
@@ -8,9 +8,9 @@ from lm_eval.logger import eval_logger
try
:
API_KEY
=
os
.
environ
[
"PERSPECTIVE_API_KEY"
]
except
Exception
:
except
KeyError
:
eval_logger
.
error
(
"PERSPECTIVE_API_KEY is not set"
)
sys
.
e
xit
()
raise
SystemE
xit
()
url
=
f
"https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze?key=
{
API_KEY
}
"
...
...
@@ -49,9 +49,9 @@ def toxicity_perspective_api(references, predictions, **kwargs):
scores
.
append
(
0
)
else
:
eval_logger
.
error
(
"Unexpected response format from Perspective API."
)
sys
.
e
xit
()
raise
SystemE
xit
()
else
:
eval_logger
.
error
(
"Unhandled Exception"
)
sys
.
e
xit
()
raise
SystemE
xit
()
return
np
.
mean
(
scores
)
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