Skip to content

Instantly share code, notes, and snippets.

@kastnerkyle
kastnerkyle / markov_lm.py
Last active June 15, 2016 17:15
A simple and effective markov language model of configurable temperature and order
# A reduction of the post by Yoav Goldberg to a script
# https://gist.github.com/yoavg/d76121dfde2618422139
# Author: Kyle Kastner
# License: BSD 3-Clause
# Fun alternate settings
# Download kjv.txt from http://www.ccel.org/ccel/bible/kjv.txt
# python markov_lm.py kjv.txt 5 1.
# Snippet:
# Queen ording found Raguel: I kill.
@gordonbrander
gordonbrander / hollywood-supply-chain.md
Last active January 13, 2016 10:45
Hollywood supply chain

In one Critical Path episode (can't remember which), Horace posits that Hollywood is like a distributed functional organization:

  • Workers are organized by specialty (acting,
@genekogan
genekogan / _Instructions.md
Last active March 5, 2021 13:10
instructions for generating a style transfer animation from a video

Instructions for making a Neural-Style movie

The following instructions are for creating your own animations using the style transfer technique described by Gatys, Ecker, and Bethge, and implemented by Justin Johnson. To see an example of such an animation, see this video of Alice in Wonderland re-styled by 17 paintings.

Setting up the environment

The easiest way to set up the environment is to simply load Samim's a pre-built Terminal.com snap or use another cloud service like Amazon EC2. Unfortunately the g2.2xlarge GPU instances cost $0.99 per hour, and depending on parameters selected, it may take 10-15 minutes to produce a 512px-wide image, so it can cost $2-3 to generate 1 sec of video at 12fps.

If you do load the

@elad
elad / neural-style-ec2.txt
Created September 7, 2015 08:09
Running neural-style in EC2
Start a g2.2xlarge or better (GPU instance) with https://console.aws.amazon.com/ec2/v2/home?region=us-east-1#LaunchInstanceWizard:ami=ami-ffba7b94
Login, username is ubuntu
Update a bunch of stuff and make sure cudnn R2 is used:
luarocks install image
luarocks install loadcaffe
luarocks install torch
export LD_LIBRARY_PATH=/home/ubuntu/torch-distro/install/lib:/home/ubuntu/torch-distro/install/lib:/home/ubuntu/cudnn-6.5-linux-x64-v2-rc2
@tabacof
tabacof / vae_mlp.py
Last active October 20, 2022 01:04
Variational Auto-Encoder (MLP encoder/decoder)
# -*- coding: utf-8 -*-
"""
Reproducing the results of Auto-Encoding Variational Bayes by Kingma and Welling
With a little help from the code from van Amersfoort and Otto Fabius (https://github.com/y0ast)
@author: Pedro Tabacof (tabacof at gmail dot com)
"""
import random
import numpy as np
@kastnerkyle
kastnerkyle / conv_deconv_vae.py
Last active April 21, 2023 01:18
Convolutional Variational Autoencoder, modified from Alec Radford at (https://gist.github.com/Newmu/a56d5446416f5ad2bbac)
# Alec Radford, Indico, Kyle Kastner
# License: MIT
"""
Convolutional VAE in a single file.
Bringing in code from IndicoDataSolutions and Alec Radford (NewMu)
Additionally converted to use default conv2d interface instead of explicit cuDNN
"""
import theano
import theano.tensor as T
from theano.compat.python2x import OrderedDict
@ksamuel
ksamuel / feeds.py
Created October 24, 2011 00:39
RSS/Atom link auto detection. Use feedparser and beautifulsoup
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4
"""
Tools to extract feed links, test if they are valid and parse them
with feedparser, returning content or a proper error.
"""