Code for Keras plays catch blog post
python qlearn.py- Generate figures
| from transformers import AutoTokenizer, T5ForConditionalGeneration | |
| # Model Init | |
| n_gpu = 8 | |
| tokenizer = AutoTokenizer.from_pretrained("google/flan-ul2") | |
| model = T5ForConditionalGeneration.from_pretrained("google/flan-ul2") | |
| heads_per_gpu = len(model.encoder.block) // n_gpu | |
| device_map = { | |
| gpu: list( | |
| range( |
| """ Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """ | |
| import numpy as np | |
| import cPickle as pickle | |
| import gym | |
| # hyperparameters | |
| H = 200 # number of hidden layer neurons | |
| batch_size = 10 # every how many episodes to do a param update? | |
| learning_rate = 1e-4 | |
| gamma = 0.99 # discount factor for reward |
Code for Keras plays catch blog post
python qlearn.py| """ | |
| 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) |
| """ | |
| A deep neural network with or w/o dropout in one file. | |
| License: Do What The Fuck You Want to Public License http://www.wtfpl.net/ | |
| """ | |
| import numpy, theano, sys, math | |
| from theano import tensor as T | |
| from theano import shared | |
| from theano.tensor.shared_randomstreams import RandomStreams |
| #!/bin/bash | |
| # Pylearn2 setup script for Amazon Linux AMI with NVIDIA GRID GPU Driver. | |
| # http://goo.gl/3KeXXW | |
| # not tested | |
| sudo yum update -y | |
| sudo yum install -y emacs tmux python-pip | |
| sudo yum install -y python-devel git blas-devel lapack-devel |
| # (C) Kyle Kastner, June 2014 | |
| # License: BSD 3 clause | |
| import scipy.stats as st | |
| import numpy as np | |
| class gmmhmm: | |
| #This class converted with modifications from https://code.google.com/p/hmm-speech-recognition/source/browse/Word.m | |
| def __init__(self, n_states): | |
| self.n_states = n_states |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns
Compress 1K bytes with Zippy ............. 3,000 ns = 3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns = 20 µs
SSD random read ........................ 150,000 ns = 150 µs
Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs