Coder Social home page Coder Social logo

napoler / seq2seq-attention-pytorch-lightning Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ksopyla/seq2seq-attention-pytorch-lightning

0.0 0.0 0.0 1.77 MB

Pytorch-Lightning Seq2seq model with the use of recurrent neural network

License: MIT License

Python 100.00%

seq2seq-attention-pytorch-lightning's Introduction

Seq2Seq RNN model with attention as pytorch-lightning module

Code is modified version of @bentrevett great tutorial https://github.com/bentrevett/pytorch-seq2seq

Especially implements as Pytorch-lightning modules Encoder, Decoder and Seq2Seq trainer.

Implementation with Pytorch-Lightning allows:

  • training in distributed environments (many GPUS)
  • logging to Tensoboard
  • customize DataModule to your specific use case (your data)
  • remove dependency of TorchText

How to run the code

Main file is seq2seq_trainer.py just run it in your IDE.

  • Visual Studio Code users - there is launch.json in .vscode folder with settings and args

If you want to run in from terminal

python seq2seq_trainer.py --dataset_path /data/10k_sent_typos_wikipedia.jsonl \
 --gpus=2 --max_epoch=5 --batch_size=16 --num_workers=4 \
 --emb_dim=128 --hidden_dim=512 \
 --log_gpu_memory=True --weights_summary=full \
 --N_samples=1000000 --N_valid_size=10000 --distributed_backend=ddp --precision=16 --accumulate_grad_batches=4 --val_check_interval=640 --gradient_clip_val=2.0 --track_grad_norm=2

Ryn tensorboard

tensorboard dev --logdir model_corrector/pl_tensorboard_logs/version??

Data modules

There are two data modules:

you should uncomment which one you want to use seq2seq_trainer.py.

Tokenizers (token encoders)

Project use two tokenizers (token encoders) CharTokenizerEncoder BiGramTokenizerEncoder in each data module you can change it (find in code and uncomment or plug in yours).

seq2seq-attention-pytorch-lightning's People

Contributors

ksopyla 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.