n-waves / multifit

The code to reproduce results from paper "MultiFiT: Efficient Multi-lingual Language Model Fine-tuning" https://arxiv.org/abs/1909.04761
MIT License
282 stars 56 forks source link

Saliency maps #70

Open javithe7 opened 4 years ago

javithe7 commented 4 years ago

Hi everyone, I am working on the creation of saliency maps for multifit classification models, with the ultimate goal of highlighting over the text those parts that are decisive in making a prediction.

In order to make the prominence maps, on the one hand I need to obtain the activations of a designated layer of the model using a hook, and on the other hand I need the tokenized text and in the form of a tensor. In this way I can relate the activations to the input text that caused those activations.

My question is to know how to get the input tensor and the tokenized text that the multifit model receives when doing a prediction, because those operations are done internally by multifit.

Thanks