Instantly share code, notes, and snippets.

# Jaemin Choj-min

• Sort options
Last active Feb 24, 2020
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
View min-char-rnn.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)
Last active Feb 22, 2020
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
View Install NVIDIA Driver and CUDA.md

In this article, I will share some of my experience on installing NVIDIA driver and CUDA on Linux OS. Here I mainly use Ubuntu as example. Comments for CentOS/Fedora are also provided as much as I can.

Last active Feb 20, 2020
Sample the next token from a probability distribution using top-k and/or nucleus (top-p) sampling
View top-k-top-p.py
 def top_k_top_p_filtering(logits, top_k=0, top_p=0.0, filter_value=-float('Inf')): """ Filter a distribution of logits using top-k and/or nucleus (top-p) filtering Args: logits: logits distribution shape (vocabulary size) top_k >0: keep only top k tokens with highest probability (top-k filtering). top_p >0.0: keep the top tokens with cumulative probability >= top_p (nucleus filtering). Nucleus filtering is described in Holtzman et al. (http://arxiv.org/abs/1904.09751) """ assert logits.dim() == 1 # batch size 1 for now - could be updated for more but the code would be less clear top_k = min(top_k, logits.size(-1)) # Safety check
Created Apr 2, 2016
Caffe Installation Tutorial for beginners
View CaffeInstallation.md

## Freshly brewed !

With the availability of huge amount of data for research and powerfull machines to run your code on, Machine Learning and Neural Networks is gaining their foot again and impacting us more than ever in our everyday lives. With huge players like Google opensourcing part of their Machine Learning systems like the TensorFlow software library for numerical computation, there are many options for someone interested in starting off with Machine Learning/Neural Nets to choose from. Caffe, a deep learning framework developed by the Berkeley Vision and Learning Center (BVLC) and its contributors, comes to the play with a fresh cup of coffee.

# Installation Instructions (Ubuntu 14 Trusty)

The following section is divided in to two parts. Caffe's documentation suggest

Last active Feb 12, 2020
How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
View how-to-install-latest-gcc-on-ubuntu-lts.txt
 These commands are based on a askubuntu answer http://askubuntu.com/a/581497 To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below. USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING. ABSOLUTELY NO WARRANTY. If you are still reading let's carry on with the code. sudo apt-get update && \ sudo apt-get install build-essential software-properties-common -y && \ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
Last active Feb 9, 2020
Created Jan 22, 2011
A module to "unparse" a Python AST tree.
View codegen.py
 # -*- coding: utf-8 -*- """ codegen ~~~~~~~ Extension to ast that allow ast -> python code generation. :copyright: Copyright 2008 by Armin Ronacher. :license: BSD. """
Last active Jan 30, 2020
Installing TensorFlow on EC2
View install-tensorflow.sh
 # Note – this is not a bash script (some of the steps require reboot) # I named it .sh just so Github does correct syntax highlighting. # # This is also available as an AMI in us-east-1 (virginia): ami-cf5028a5 # # The CUDA part is mostly based on this excellent blog post: # http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/ # Install various packages sudo apt-get update
Last active Jan 27, 2020
tmux 2.0 and tmux 2.3 installation steps for Ubuntu. Or build from tmux source v2.5 for Ubuntu and CentOS.
View tmux__CentOS__build_from_source.sh
 # Steps to build and install tmux from source. # Takes < 25 seconds on EC2 env [even on a low-end config instance]. VERSION=2.7 sudo yum -y remove tmux sudo yum -y install wget tar libevent-devel ncurses-devel wget https://github.com/tmux/tmux/releases/download/\${VERSION}/tmux-\${VERSION}.tar.gz tar xzf tmux-\${VERSION}.tar.gz rm -f tmux-\${VERSION}.tar.gz cd tmux-\${VERSION}
Last active Jan 23, 2020
how to convert/port gensim word2vec to tensorflow projector board.
View gensim2projector_tf.py
 # required tensorflow 0.12 # required gensim 0.13.3+ for new api model.wv.index2word or just use model.index2word from gensim.models import Word2Vec import tensorflow as tf from tensorflow.contrib.tensorboard.plugins import projector # loading your gensim model = Word2Vec.load("YOUR-MODEL")
You can’t perform that action at this time.