Skip to content

burcukilic/transformers_scratch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Decision Transformer Implementation

πŸ“¦ Installation

git clone https://github.com/burcukilic/transformers_scratch.git
cd transformers_scratch
python3.12 -m venv env
source env/bin/activate
pip install -e .

πŸ“ File Structure

The project is organized as follows:

.
└── src/dt/
    β”œβ”€β”€ blocks.py
    β”œβ”€β”€ decision_transformer.py
    β”œβ”€β”€ minari_train_bc.py
    β”œβ”€β”€ minari_train_dt.py
    β”œβ”€β”€ transformer_decoder.py
    β”œβ”€β”€ transformer_encoder.py
    └── test_transformer_blocks.py

Key files and their roles:

* `src/dt/blocks.py`: Has the Sinusoidal positional encoding, feed forward block, and Multi Head Attention implementations.
* `src/dt/transformer_encoder.py`: The transformer encoder implementation
* `src/dt/transformer_decoder.py`: The transformer decoder implementation
* `src/dt/decision_transformer.py`: Uses the transformer decoder implementation for Decision Transformer, multiple classes for different purposes
* `src/dt/minari_train_bc.py`: Downloads D4RL PointMaze dataset from minari and trains a simple behavior cloning with the dataset
* `src/dt/minari_train_dt.py`: Downloads D4RL PointMaze dataset from minari and trains a decision transformer with the dataset

About

Implementing Transformers from Scratch

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published