whatisgithub

What is char-rnn?

karpathy/char-rnn — explained in plain English

Analysis updated 2026-06-24 · repo last pushed 2023-10-24

12,065LuaAudience · researcherComplexity · 3/5DormantSetup · hard

In one sentence

char-rnn trains a character-level neural network on any text file, feed it Shakespeare and it writes new Shakespeare-like text, feed it code and it generates code-like output, character by character.

Mindmap

mindmap
  root((char-rnn))
    What it does
      Character-level RNN
      Text style learning
      New text generation
    Model Variants
      LSTM
      GRU
    Use Cases
      Creative writing
      Code generation
      Style mimicry
    Tech
      Lua Torch
      GPU training
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Train a model on a corpus of Shakespeare plays and generate entirely new dialogue that mimics the original style.

USE CASE 2

Prototype a character-level text generation model on your own dataset to understand how RNNs learn sequential patterns.

USE CASE 3

Generate plausible-looking code snippets by training on a folder of source files from any programming language.

What is it built with?

LuaTorch

How does it compare?

karpathy/char-rnnxmake-io/xmakejunyanz/cyclegan
Stars12,06511,97412,852
LanguageLuaLuaLua
Last pushed2023-10-24
MaintenanceDormant
Setup difficultyhardeasyhard
Complexity3/53/54/5
Audienceresearcherdeveloperresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1day+

Requires the Torch ML framework with Lua, GPU training needs CUDA. The project is older and environment setup can be non-trivial on modern systems.

No license information is provided in the explanation.

Copy-paste prompts

Prompt 1
I want to use char-rnn to generate new blog posts in my writing style. Walk me through preparing my text file, choosing training hyperparameters, and sampling from the finished model.
Prompt 2
Help me train char-rnn on a collection of Python source files to generate Python-like code, what model size should I use and how long should I train for a 1MB dataset?
Prompt 3
Explain the difference between the LSTM and GRU options in char-rnn and which one works better for longer-range stylistic patterns.
Prompt 4
My char-rnn training loss is not decreasing after 10 000 iterations. What hyperparameters should I adjust and how do I tell if the model is overfitting?

Frequently asked questions

What is char-rnn?

char-rnn trains a character-level neural network on any text file, feed it Shakespeare and it writes new Shakespeare-like text, feed it code and it generates code-like output, character by character.

What language is char-rnn written in?

Mainly Lua. The stack also includes Lua, Torch.

Is char-rnn actively maintained?

Dormant — no commits in 2+ years (last push 2023-10-24).

What license does char-rnn use?

No license information is provided in the explanation.

How hard is char-rnn to set up?

Setup difficulty is rated hard, with roughly 1day+ to a first successful run.

Who is char-rnn for?

Mainly researcher.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.