GithubHelp home page GithubHelp logo

maxime7770 / transformers-insights Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 4.12 MB

Exploring how Transformers actually transform the data under the hood

Home Page: https://medium.com/towards-data-science/transformers-how-do-they-transform-your-data-72d69e383e0d

License: MIT License

Python 100.00%
artificial-intelligence deep-learning llms transformers

transformers-insights's Introduction

Transformers-Insights

This project contains an implementation of the Transformer Encoder architecture, inspired by the "Attention Is All You Need" paper and BERT. It also aims to understand how the Encoder architecture transforms the input data under the hood by visualizing how embeddings are adapted during training. To illustrate this, the model is trained on a binary classification task using the IMDB dataset (positive and negative movie reviews).

Make sure to check the Medium article associated with this project.

Installation

Create a new Python environment

python3.9 -m venv venv

Install the requirements

pip install -r requirements.txt

Structure

.
├── assets                  # Contain generated plots
├── src                    
    ├── main.py             # Used to train/test the model and generate plots
    ├── utils.py               
    └── model               
        ├── layers.py       # Layers used in the Transformer architecture
        └── model.py        # Combine the layers to create the Transformer model and the classification head 

How to train the model?

Use the following, from the root directory of the project

python3 -m src.main

It should also save a GIF animated plot showing the evolution of the [CLS] embedding during training.

transformers-insights's People

Contributors

maxime7770 avatar

Stargazers

Nelson Tam avatar  avatar

Watchers

Kostas Georgiou avatar  avatar

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.