Skip to content

Instantly share code, notes, and snippets.

# This is inspired by the fantastic guide https://github.com/saiprashanths/dl-setup
# I have just updated the python-related commands so that everything works in Python 3.
# Tested on Xubuntu 16.04.
# First of all let's update the repos:
sudo apt-get update
# Only if you have a CUDA-compatible Nvidia card, install CUDA.
# Check on the Nvidia website what is the latest driver version which supports your card.
# At the time of this writing it was 367.
@aa1607
aa1607 / layers_tied.py
Created September 15, 2017 22:23 — forked from dswah/layers_tied.py
Tied Convolutional Weights with Keras for CNN Auto-encoders
from keras import backend as K
from keras import activations, initializations, regularizers, constraints
from keras.engine import Layer, InputSpec
from keras.utils.np_utils import conv_output_length
from keras.layers import Convolution1D, Convolution2D
import tensorflow as tf
class Convolution1D_tied(Layer):
'''Convolution operator for filtering neighborhoods of one-dimensional inputs.
When using this layer as the first layer in a model,
@aa1607
aa1607 / install-gpu-gce.sh
Created July 27, 2017 03:40 — forked from rahimnathwani/install-gpu-gce.sh
Set up a Google Cloud GPU instance for doing the exercises in course.fast.ai
#!/bin/bash
if ! dpkg-query -W cuda; then
curl -O http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
dpkg -i ./cuda-repo-ubuntu1604_8.0.61-1_amd64.deb
fi
apt-get update
apt-get -y upgrade
apt-get -y install tmux build-essential gcc g++ make binutils software-properties-common cuda unzip
modprobe nvidia
nvidia-smi
@aa1607
aa1607 / figure_grid.py
Created July 21, 2017 17:37 — forked from asross/figure_grid.py
A helper to plot grids of graphs in matplotlib.pyplot
"""
Examples:
with figure_grid(5, 3) as grid:
grid.next()
# plot something
grid.next()
# plot something
# ...etc
@aa1607
aa1607 / keras_attention_wrapper.py
Created July 20, 2017 13:30 — forked from wassname/keras_attention_wrapper.py
A keras attention layer that wraps RNN layers.
"""
A keras attention layer that wraps RNN layers.
Based on tensorflows [attention_decoder](https://github.com/tensorflow/tensorflow/blob/c8a45a8e236776bed1d14fd71f3b6755bd63cc58/tensorflow/python/ops/seq2seq.py#L506)
and [Grammar as a Foreign Language](https://arxiv.org/abs/1412.7449).
date: 20161101
author: wassname
url: https://gist.github.com/wassname/5292f95000e409e239b9dc973295327a
"""