Code Monkey home page Code Monkey logo

interpret-flair's People

Contributors

krzysztoffiok avatar robinvanschaik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

interpret-flair's Issues

Add support for other type of Flair models

Flair offers multiple types of text classification models.

From transformers-based models via huggingface (currently implemented) to word embeddings.

Restructuring to allow for other types models would be nice.

RuntimeError: Input, output and indices must be on the current device

Hi Robin,

I found an error when I test with the pre-trained sentiment model from Flair. Simply loading with

classifier = TextClassifier.load('sentiment')
flair_model_wrapper = ModelWrapper(classifier)

And the rest is the same as yours. I got this error when I call the function interpret_sentence.

I test and print out the device. It turns out that the variable input_ids in function interpret_sentence is on cpu. My clumsy solution is to add

input_ids = input_ids.to(device)

after line

input_ids = flair_model_wrapper.tokenizer.encode(...)

There might be other internal solutions.

BTW, this work helps a lot!

Make target label work with multi class.

As target_label only accept single values, making it work on multi class problems is not so simple. I have written a simple looping function to iterate over the correct target labels, but as on Flair 0.8post1, I find that predictions of the interpret_sentence class deviate from the orginal multi class model (i.e. wrong class prediction).

On personal note: I think you have done a really good job in building this solution. It has worked wonders for multi label problems already.

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.