Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/tensor-fusion/gpt-haskell

A pure Haskell implementation of a decoder-only transformer (GPT)
https://github.com/tensor-fusion/gpt-haskell

deep-learning gpt gpt-2 haskell large-language-models transformer

Last synced: 3 months ago
JSON representation

A pure Haskell implementation of a decoder-only transformer (GPT)

Awesome Lists containing this project

README

        

# Haskell GPT

Super minimal implementation of [GPT-2](https://d4mucfpksywv.cloudfront.net/better-language-models/language_models_are_unsupervised_multitask_learners.pdf) in Haskell.

Highly inspired by:
- [openai/gpt-2](https://github.com/openai/gpt-2).
- [karpathy/minGPT](https://github.com/karpathy/mingpt).
- [picoGPT](https://github.com/jaymody/picoGPT).

Structure is similar to [picoGPT](https://github.com/jaymody/picoGPT). Code contains:
- Translation of OpenAI's BPE Tokenizer
- Decoder-only transformer
- GPT-2 generation

You can run tests with

```
cabal build
cabal test
```

(You'll first need to download GPT-2 weights, tokenizer, and hyperparams into `/models`)

## TODO
- [ ] Merge changes containing top-k sampling and tensorflow inference for actual text generation
- [ ] Nix deps management