Coder Social home page Coder Social logo

gpt_implementation's Introduction

GPT_implementation

Here is pytorch implementation of a decoder-only model for poem generation. It was trained on truongpdd/vietnamese_poetry - a dataset of Vietnamese poem. This repo may be useful to understand the architecture of decoder block in transfomer and how a decoder-only model work.

Result

This still a very simple network and train in just about 20000 iterations with Kaggle GPU P100 and it tooks about 30 mins to train. Therefore, the results are not good but you can still see the improvement in performance after some iterations.

After 100 iterations


Figure_1


Figure_2


Figure_3

After 20000 iterations


Figure_4


Figure_5


Figure_6

with the same input, we can see the difference between the output of model after 100 and after 200 iterations.

How to use

Run the following command to install modules needed

pip install -r requirements.txt

The code was organized:

  • In the notebook directory, you can use gpt-pytorch-implementation.ipynb and adjust some things accordingly your conditions to train on notebook or Kaggle.
  • set up paramter for dataset and model: config.py
  • download data from hugging face, get batched data: data.py
  • modules needed to build model: modules.py
  • script to train model: train.py
  • test model with different input: test.py

gpt_implementation's People

Contributors

binhng2803 avatar

Watchers

 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.