Skip to content

Commit

Permalink
Fix default behavior toxic_label in HuggingFaceToxicityModel. (#1146)
Browse files Browse the repository at this point in the history
  • Loading branch information
Liraim authored Jun 6, 2024
1 parent 89f06c6 commit e68824a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/evidently/features/hf_feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ def _toxicity(model_name: Optional[str], toxic_label: Optional[str], data: pd.Se

column_data = data.values.tolist()
model = evaluate.load("toxicity", model_name, module_type="measurement")
scores = model.compute(predictions=column_data, toxic_label=toxic_label)
if toxic_label is None:
scores = model.compute(predictions=column_data)
else:
scores = model.compute(predictions=column_data, toxic_label=toxic_label)
return pd.Series(scores["toxicity"], index=data.index)


Expand Down

0 comments on commit e68824a

Please sign in to comment.