# graykode/nlp-tutorial architecture

> Architecture diagram of the GitHub repository graykode/nlp-tutorial, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/graykode/nlp-tutorial
- Repository: https://github.com/graykode/nlp-tutorial

## Overview

nlp-tutorial is a PyTorch learning repository: learners study compact, runnable NLP model examples and observe task-specific predictions, classifications, translations, embeddings, or attention visualizations. Its principal workflow is to explore a curriculum example, run its model/training code, and inspect the demonstrated result. The graph groups the documented examples by model family; scripts are largely self-contained rather than components in a shared runtime pipeline. The FastText implementation is represented by its notebook because no Python source file appears in the tree. Archived TensorFlow versions are excluded. Relationships reflect README curriculum links, not unsampled implementation calls.

Main entry points: [`1-1.NNLM/NNLM.py`](https://github.com/graykode/nlp-tutorial/blob/master/1-1.NNLM/NNLM.py) (NNLM), [`1-2.Word2Vec/Word2Vec-Skipgram(Softmax).py`](https://github.com/graykode/nlp-tutorial/blob/master/1-2.Word2Vec/Word2Vec-Skipgram(Softmax).py) (Word2Vec), [`1-3.FastText/FastText.ipynb`](https://github.com/graykode/nlp-tutorial/blob/master/1-3.FastText/FastText.ipynb) (FastText), [`3-1.TextRNN/TextRNN.py`](https://github.com/graykode/nlp-tutorial/blob/master/3-1.TextRNN/TextRNN.py) (TextRNN)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_embeddings["Embedding Models"]
  node_nnlm["NNLM<br/>[NNLM.py]"]
  node_word2vec["Word2Vec"]
  node_fasttext["FastText<br/>[FastText.ipynb]"]
end

subgraph group_sequence["Sequence Models"]
  node_textrnn["TextRNN<br/>[TextRNN.py]"]
  node_textlstm["TextLSTM<br/>[TextLSTM.py]"]
  node_bilstm["Bi-LSTM<br/>[Bi-LSTM.py]"]
  node_seq2seq["Seq2Seq<br/>[Seq2Seq.py]"]
end

subgraph group_attention["Attention Models"]
  node_seqattention["Seq2Seq Attention"]
  node_bilstmattention["Bi-LSTM Attention"]
end

subgraph group_transformers["Transformer Models"]
  node_transformer["Transformer<br/>[Transformer.py]"]
  node_greedytransformer["Greedy Transformer"]
  node_bert["BERT<br/>[BERT.py]"]
end

subgraph group_classification["Classification"]
  node_textcnn["TextCNN<br/>[TextCNN.py]"]
end

node_learner(("NLP learner"))

node_learner -->|"studies example"| node_nnlm
node_learner -->|"studies example"| node_word2vec
node_learner -->|"studies example"| node_fasttext
node_learner -->|"studies example"| node_textrnn
node_learner -->|"studies example"| node_textlstm
node_learner -->|"studies example"| node_bilstm
node_learner -->|"studies example"| node_seq2seq
node_learner -->|"studies example"| node_seqattention
node_learner -->|"studies example"| node_bilstmattention
node_learner -->|"studies example"| node_transformer
node_learner -->|"studies example"| node_greedytransformer
node_learner -->|"studies example"| node_bert
node_learner -->|"studies example"| node_textcnn

click node_nnlm "https://github.com/graykode/nlp-tutorial/blob/master/1-1.NNLM/NNLM.py"
click node_word2vec "https://github.com/graykode/nlp-tutorial/blob/master/1-2.Word2Vec/Word2Vec-Skipgram(Softmax).py"
click node_fasttext "https://github.com/graykode/nlp-tutorial/blob/master/1-3.FastText/FastText.ipynb"
click node_textrnn "https://github.com/graykode/nlp-tutorial/blob/master/3-1.TextRNN/TextRNN.py"
click node_textlstm "https://github.com/graykode/nlp-tutorial/blob/master/3-2.TextLSTM/TextLSTM.py"
click node_bilstm "https://github.com/graykode/nlp-tutorial/blob/master/3-3.Bi-LSTM/Bi-LSTM.py"
click node_seq2seq "https://github.com/graykode/nlp-tutorial/blob/master/4-1.Seq2Seq/Seq2Seq.py"
click node_seqattention "https://github.com/graykode/nlp-tutorial/blob/master/4-2.Seq2Seq(Attention)/Seq2Seq(Attention).py"
click node_bilstmattention "https://github.com/graykode/nlp-tutorial/blob/master/4-3.Bi-LSTM(Attention)/Bi-LSTM(Attention).py"
click node_transformer "https://github.com/graykode/nlp-tutorial/blob/master/5-1.Transformer/Transformer.py"
click node_greedytransformer "https://github.com/graykode/nlp-tutorial/blob/master/5-1.Transformer/Transformer(Greedy_decoder).py"
click node_bert "https://github.com/graykode/nlp-tutorial/blob/master/5-2.BERT/BERT.py"
click node_textcnn "https://github.com/graykode/nlp-tutorial/blob/master/2-1.TextCNN/TextCNN.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_nnlm,node_word2vec,node_fasttext toneBlue
class node_textrnn,node_textlstm,node_bilstm,node_seq2seq toneAmber
class node_seqattention,node_bilstmattention toneMint
class node_transformer,node_greedytransformer,node_bert toneRose
class node_textcnn,node_learner toneIndigo
```

## Components

### Embedding Models

- [NNLM](https://github.com/graykode/nlp-tutorial/blob/master/1-1.NNLM/NNLM.py): `1-1.NNLM/NNLM.py`
- [Word2Vec](https://github.com/graykode/nlp-tutorial/blob/master/1-2.Word2Vec/Word2Vec-Skipgram(Softmax).py): `1-2.Word2Vec/Word2Vec-Skipgram(Softmax).py`
- [FastText](https://github.com/graykode/nlp-tutorial/blob/master/1-3.FastText/FastText.ipynb): `1-3.FastText/FastText.ipynb`

### Sequence Models

- [TextRNN](https://github.com/graykode/nlp-tutorial/blob/master/3-1.TextRNN/TextRNN.py): `3-1.TextRNN/TextRNN.py`
- [TextLSTM](https://github.com/graykode/nlp-tutorial/blob/master/3-2.TextLSTM/TextLSTM.py): `3-2.TextLSTM/TextLSTM.py`
- [Bi-LSTM](https://github.com/graykode/nlp-tutorial/blob/master/3-3.Bi-LSTM/Bi-LSTM.py): `3-3.Bi-LSTM/Bi-LSTM.py`
- [Seq2Seq](https://github.com/graykode/nlp-tutorial/blob/master/4-1.Seq2Seq/Seq2Seq.py): `4-1.Seq2Seq/Seq2Seq.py`

### Attention Models

- [Seq2Seq Attention](https://github.com/graykode/nlp-tutorial/blob/master/4-2.Seq2Seq(Attention)/Seq2Seq(Attention).py): `4-2.Seq2Seq(Attention)/Seq2Seq(Attention).py`
- [Bi-LSTM Attention](https://github.com/graykode/nlp-tutorial/blob/master/4-3.Bi-LSTM(Attention)/Bi-LSTM(Attention).py): `4-3.Bi-LSTM(Attention)/Bi-LSTM(Attention).py`

### Transformer Models

- [Transformer](https://github.com/graykode/nlp-tutorial/blob/master/5-1.Transformer/Transformer.py): `5-1.Transformer/Transformer.py`
- [Greedy Transformer](https://github.com/graykode/nlp-tutorial/blob/master/5-1.Transformer/Transformer(Greedy_decoder).py): `5-1.Transformer/Transformer(Greedy_decoder).py`
- [BERT](https://github.com/graykode/nlp-tutorial/blob/master/5-2.BERT/BERT.py): `5-2.BERT/BERT.py`

### Classification

- [TextCNN](https://github.com/graykode/nlp-tutorial/blob/master/2-1.TextCNN/TextCNN.py): `2-1.TextCNN/TextCNN.py`

### Other components

- **NLP learner**

## Connections

- NLP learner → NNLM: studies example (evidence: `README.md`)
- NLP learner → Word2Vec: studies example (evidence: `README.md`)
- NLP learner → FastText: studies example (evidence: `README.md`)
- NLP learner → TextRNN: studies example (evidence: `README.md`)
- NLP learner → TextLSTM: studies example (evidence: `README.md`)
- NLP learner → Bi-LSTM: studies example (evidence: `README.md`)
- NLP learner → Seq2Seq: studies example (evidence: `README.md`)
- NLP learner → Seq2Seq Attention: studies example (evidence: `README.md`)
- NLP learner → Bi-LSTM Attention: studies example (evidence: `README.md`)
- NLP learner → Transformer: studies example (evidence: `README.md`)
- NLP learner → Greedy Transformer: studies example (evidence: `README.md`)
- NLP learner → BERT: studies example (evidence: `README.md`)
- NLP learner → TextCNN: studies example (evidence: `README.md`)
