Update toxicity.py
Browse files130 unmodified lines131132133134135136137130 unmodified linesmodel_name = self.config_nameself.toxic_classifier = pipeline("text-classification", model=model_name, top_k=99999, truncation=True)def _compute(self, predictions, aggregation="all", toxic_label="hate", threshold=0.5):scores = toxicity(predictions, self.toxic_classifier, toxic_label)if aggregation == "ratio":return {"toxicity_ratio": sum(i >= threshold for i in scores) / len(scores)}130 unmodified lines131132133134135136137130 unmodified linesmodel_name = self.config_nameself.toxic_classifier = pipeline("text-classification", model=model_name, top_k=99999, truncation=True)def _compute(self, predictions, aggregation="all", toxic_label="offensive", threshold=0.5):scores = toxicity(predictions, self.toxic_classifier, toxic_label)if aggregation == "ratio":return {"toxicity_ratio": sum(i >= threshold for i in scores) / len(scores)}
toxicity.py+1-1