Code Monkey home page Code Monkey logo

nlp_project_ood's Introduction

Detecting Textual Out-Of-Distribution Examples with Pretrained Transformers

This project is part of the final year NLP course at ENSAE. We have written a paper on this subject and here is the abstract.

Deep learning models allow today to train large datasets in order to have very good performance in all problems that call for Natural Language Processing (NLP). Nevertheless, these models are very vulnerable to the change in distribution between the training dataset and the application data. This is why it has become essential to develop methods to detect data that are not of the same distribution. In this paper, we give a quick background of the out-of-distribution problem. Then, we present different detectors, starting with their mathematical basis, and we change the DistilBERT model in order to have different aggregations. Finally, we propose to apply the detectors to several datasets and aggregation in order to compare them.

Requirements

To create the environment to work on, on a terminal, use:

$ conda env create -f environment.yml

or to install packages, use:

$ pip install -r requirements.txt

Usage example

You can create a folder on you drive to keep intermediate data to easily use it.

The models_scripts folder contains the modification files of the transformers package to access the outputs of the intermediate layers of the DistilBERT model, in order to use the created classes, you will have to use them to replace the initial corresponding files of your transformers package.

You can find several examples of use in the Notebook folder. For instance for IMDB as in-distribution, you will have to run the get_data_train_model_imdb.ipynbto download the data and trained the model. And then, you can use the get_metric_ood_imdb.ipynbnotebook to compute the OOD detections.

nlp_project_ood's People

Contributors

agatheminaro avatar julien2048 avatar

Watchers

 avatar

Forkers

agatheminaro

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.