Git Product home page Git Product logo

Comments (2)

lalitpagaria avatar lalitpagaria commented on May 21, 2024

I can contribute if you guide me.
As far as I understood explainer base class need to pass customer dict to PretrainedConfig during init.

from transformers-interpret.

cdpierse avatar cdpierse commented on May 21, 2024

@lalitpagaria that would be really helpful thanks. So because this only applies to sequence classification tasks I think the best place to implement this would be in the __init__ of the SequenceClassificationExplainer.

On the API level I see it looking something like

cls_explainer = SequenceClassificationExplainer(model, tokenizer, custom_id2label = {0: "my_label1", 1: "my_label2"})

Where custom_id2label is a optional parameter that can passed and will set the new values. I don't think you even need to overwrite id2label on the HF model's config itself because the classification explainer sets these as attributes itself so changing it for the explainer should do, I try as much as possible not to interfere with HF model itself.

Some other things that would be nice to do before actually setting the new values would be to check that the length of custom_id2label.keys() matches the existing length. In a case where a user accidentally sets too few or too many labels I would see it raising some sort of value error.

Another thing that this has got me thinking is that once the new id2label is set it would be to set label2id with the inverse values.

Thanks for volunteering to help on this, let me know if you need any further guidance.

from transformers-interpret.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.