-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add files via upload #25
Conversation
revise main.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution! Please address these comments.
return dataset | ||
|
||
|
||
def eval_metrics(labels, preds): | ||
if all(pd.isna(labels)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use .all()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this case really need to be handled in a seperate if
statement? Could this be directly integrated into the original control flow?
pd.Series([None] * len(dataset["label"]), dtype="boolean"), | ||
dataset["label"], | ||
), | ||
if not dataset["label"].isna().all(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a flag hasLabels
to replace all not dataset["label"].isna().all()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be refactored as results = {...} if has_labels else {}
if k != "Annotation": | ||
tb.add_row([k, v["labelled_coverage"], v["accuracy"], v["recall"], v["precision"], v["f1"]]) | ||
print(tb) | ||
if not dataset["label"].isna().all(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the flag hasLabels
@@ -189,11 +202,10 @@ def main( | |||
} | |||
|
|||
del evaluator | |||
except Exception as e: | |||
logger.error(f"Failed to evaluate {evaluator_id}: {e}") | |||
finally: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this finally
will result in leakage
"coverage": coverage, | ||
"jailbreak_ratio": jailbreak_ratio, | ||
"labelled_coverage": 0.00, | ||
"accuracy": "N/A", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use pd.NA
revise main.py
What does this PR do?
fix no label problems
Please check all applicable items before submitting: