Commit 2fcd4298 authored by lintangsutawika's avatar lintangsutawika
Browse files

changed raise variable

parent 579c9db9
...@@ -8,9 +8,9 @@ from lm_eval.logger import eval_logger ...@@ -8,9 +8,9 @@ from lm_eval.logger import eval_logger
try: try:
API_KEY = os.environ["PERSPECTIVE_API_KEY"] API_KEY = os.environ["PERSPECTIVE_API_KEY"]
except Exception: except KeyError:
eval_logger.error("PERSPECTIVE_API_KEY is not set") eval_logger.error("PERSPECTIVE_API_KEY is not set")
sys.exit() raise SystemExit()
url = f"https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze?key={API_KEY}" url = f"https://commentanalyzer.googleapis.com/v1alpha1/comments:analyze?key={API_KEY}"
...@@ -49,9 +49,9 @@ def toxicity_perspective_api(references, predictions, **kwargs): ...@@ -49,9 +49,9 @@ def toxicity_perspective_api(references, predictions, **kwargs):
scores.append(0) scores.append(0)
else: else:
eval_logger.error("Unexpected response format from Perspective API.") eval_logger.error("Unexpected response format from Perspective API.")
sys.exit() raise SystemExit()
else: else:
eval_logger.error("Unhandled Exception") eval_logger.error("Unhandled Exception")
sys.exit() raise SystemExit()
return np.mean(scores) return np.mean(scores)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment