An open API service indexing awesome lists of open source software.

https://github.com/lin826/nanogpt-demo

Training and finetuning local GPTs.
https://github.com/lin826/nanogpt-demo

gpt nanogpt numpy pytorch tqdm transformers

Last synced: 3 months ago
JSON representation

Training and finetuning local GPTs.

Awesome Lists containing this project

README

          

# nanoGPT Reimplement

Reimplement nanoGPT, a local trainable and finetunable agent, into object-oriented style with typing checks.

Instead of using the example `karpathy/chr_rnn/tinyshakespeare/input.txt`, this repo support multiple .txt files from the folder `input/` to be trained with.

## Transformer - model architecture

> Deviation: Unlike the `Add & Norm` after each layer of the original paper, this repo implements pre-norm formulation.

![Figure from the attention research paper](data/images/attention_research_figure.png)

## Getting Started

Create virtual environment and install pyhton libraries.

> Hint: On [the official webpage](https://www.anaconda.com/download), scroll down to find Miniconda Installers section!

### Conda for System Dependencies

```sh
% conda env create -f environment.yml
```

### UV for no-sys-dependent packages

```sh
% uv venv
% uv add -r requirements.txt
```

### [Optional] Compile as a module

```sh
% pip install -e .
```

## Train and Validate

```sh
% pyhon src/main.py
```

### After optional local compile

```sh
% nanogpt
```

## Sample

## Finetune

## Testing

```sh
pytest .
```