Giter VIP home page Giter VIP logo

sufianj / ailc-lectures2021-lab Goto Github PK

View Code? Open in Web Editor NEW

This project forked from crux82/ailc-lectures2021-lab

0.0 0.0 0.0 189 KB

This is a Pytorch (+ Huggingface transformers) implementation of a "simple" text classifier defined using BERT-based models. In this lab we will see how it is simple to use BERT for a sentence classification task, obtaining state-of-the-art results in few lines of python code.

License: Apache License 2.0

Jupyter Notebook 100.00%

ailc-lectures2021-lab's Introduction

Lectures on Computational Linguistics 2021

Tranining a sentence classifier using BERT-based models (in Pytorch and compatible with HuggingFace)

Author: Danilo Croce

This is a Pytorch (+ Huggingface transformers) implementation of a "simple" text classifier defined using BERT-based models. In this lab we will see how it is simple to use BERT for a sentence classification task, obtaining state-of-the-art results in few lines of python code.

In a nutshell, we will "implement" this architecture:

BERT architecture for sentence classification

Given an input sentence, we will use a BERT-based architecture to encode it and a linear classifier is used to associate the produced vector to one of the c classes considered in the classification task.

Most importantly, we will show how to use the same code but using different transformer based architectures, such as:

  • RoBERTa or Electra in English;
  • multilingual BERT or XLMRoBERTA;
  • specific encoders trained on Italian corpora.

Moreover, we will evaluate our code in two sentence classification tasks:

  • Question Classification in English
  • Subjectivity identification in Italian

by (hopefully) changing only one or two lines of code.

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.