Skip to content

Repository files navigation

GoPT

This is my learning project to understand transformer models. In particular, it implements GPT-2 model inference. It is the same model type used for ChatGPT, only smaller and therefore less powerful.

The model is implemented in pure Go, without any external dependencies and not optimized for speed.

Build

go build

Download and convert small model

Download the model files

  • model.safetensors
  • vocab.json

from huggingface at https://huggingface.co/openai-community/gpt2/tree/main

wget -O model.safetensors "https://huggingface.co/openai-community/gpt2/resolve/main/model.safetensors?download=true"
wget -O vocab.json "https://huggingface.co/openai-community/gpt2/raw/main/vocab.json?download=true"
./GoPT

Credits

This code is based on the following projects:

About

GPT-2 Model Inference

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages