Skip to content

Instantly share code, notes, and snippets.

View mofas's full-sized avatar

Chung Yen Li mofas

View GitHub Profile
@mofas
mofas / min-char-rnn.py
Created March 7, 2019 04:12 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
const COLORS = {
blue: ['#1E88E5', '#90CAF9'],
brown: ['#6D4C41', '#D7CCC8'],
gray: ['#212121', '#BDBDBD'],
green: ['#388E3C', '#A5D6A7'],
red: ['#E53935', '#EF9A9A'],
orange: ['#F4511E', '#FFAB91'],
purple: ['#8E24AA', '#E1BEE7'],
yellow: ['#FFD600', '#FFF59D'],
}