unitaryai / detoxify

Trained models & code to predict toxic comments on all 3 Jigsaw Toxic Comment Challenges. Built using ⚡ Pytorch Lightning and 🤗 Transformers. For access to our API, please email us at contact@unitary.ai.
https://www.unitary.ai/
Apache License 2.0
893 stars 115 forks source link

Unbiased model not returning identity labels #61

Open SallyBean opened 1 year ago

SallyBean commented 1 year ago

Thanks for the great repo!

I'm running the 'Quick prediction' code using the unbiased model, but there are no identity labels being returned - even with severe toxicity. I only get the toxicity labels.

Am I missing something?

Thanks again!

m13uz commented 1 year ago

@SallyBean could you please provide a minimal reproducible example of the issue, e.g. a code snippet?

SallyBean commented 1 year ago

@m13uz Sure, sorry about that! Thanks for your help in advance. :)

!pip install detoxify from detoxify import Detoxify

input_text=["I hate women", "Men are idiots"]

results = Detoxify('unbiased').predict(input_text)

model = Detoxify('unbiased', device='cuda')

import pandas as pd

pd.DataFrame(results, index=input_text).round(5))

output (without the expected identity labels): image

jamt9000 commented 1 year ago

This is by design - the detoxify wrapper only returns the toxicity-related classes, since identity outputs are more intended for de-biasing during training. If you want them you could load the model checkpoint directly.

Mario-RC commented 1 year ago

This is by design - the detoxify wrapper only returns the toxicity-related classes, since identity outputs are more intended for de-biasing during training. If you want them you could load the model checkpoint directly.

Hello, how can I download and load the model checkpoint that returns identity labels? They would be very useful for my projects, thank you!

lethal-mole commented 1 year ago

Hello, is there any update over here? I couldn't find the checkpoints either Thank you!!

laurahanu commented 1 year ago

Hello, that would be the unbiased model checkpoint, one way to get it to return the identity labels is to: