Skip to content

Encoder-Decoder transformer for translating natural language to code in PyTorch

Notifications You must be signed in to change notification settings

mfshi03/transformers

Repository files navigation

This will be a naive implementation of the Transformer Architecture in PyTorch. Transformers address problems in natural language processing through the use of self-attention. This allows the Transformer to understand patterns in linear sequences and reason about them by learning long-range patterns in text.

How to use

Experiment for code-generation in train_code.py

Code

To run the experiment for NMT for code-generation, run train_code.py

To test your model, run run_inference.py and change your model weights on this line: transformer.load_state_dict(torch.load(f"weights/transformer_code_50.pth"))

Examples:

Example

BLEU Score during Training: BLEU

Preliminary Plan

  • Read the following reference material on Github for implementation specifics by 9/17

  • Write a system design document for classes and necessary methods for implementation 9/20

  • Build a custom text vocab dataset for training and validation. 10/1

    • Use tiktoken library to tokenize sentences and phrases.
  • Complete core transformer classes and methods 10/10

  • Make a dataset loader module for running experiments to train our transformer on the custom dataset 10/20

  • Wrap-up experiment and document experimental results such as training performance 11/1

Papers

Adapting for Code-Generation

Online Resources

About

Encoder-Decoder transformer for translating natural language to code in PyTorch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages