This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Examples: | |
with figure_grid(5, 3) as grid: | |
grid.next() | |
# plot something | |
grid.next() | |
# plot something | |
# ...etc | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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 | |
""" |