Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/endlessreform/nanogpt-candle

Exercise: implementing Karpathy's nanoGPT in Candle
https://github.com/endlessreform/nanogpt-candle

Last synced: about 6 hours ago
JSON representation

Exercise: implementing Karpathy's nanoGPT in Candle

Awesome Lists containing this project

README

        

## NanoGPT, in Candle, spelled out

This repo is an implementation of [nanoGPT](https://github.com/karpathy/nanoGPT) in [Candle](https://github.com/huggingface/candle), a Rust-based PyTorch alternative.

If you use this in production, well, that's on you buddy.

## Installation

Install Rust if you haven't already done so. Then in root:

```bash
cargo build
# If on Nvidia platform
cargo build --features cuda
# If on Apple Silicon
cargo build --features metal
```

Add TinyShakespeare dataset:

```bash
mkdir corpus
curl 'https://raw.githubusercontent.com/karpathy/char-rnn/master/data/tinyshakespeare/input.txt' -o corpus/shakespeare.txt
```

## Usage

Train TinyShakespeare tokenizer:

```bash
cargo run --bin train_tokenizer -- -i corpus/shakespeare.txt -o models
```