Skip to content

Instantly share code, notes, and snippets.

View bartvm's full-sized avatar

Bart van Merriënboer bartvm

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bartvm
bartvm / blocks_log_api.py
Last active August 29, 2015 14:22
REST API to SQLite Blocks log
import argparse
import sqlite3
from uuid import UUID
from flask import g, json, Flask
from blocks.config import config
from blocks.log.sqlite import ANCESTORS_QUERY
app = Flask(__name__)
th test/test_qr.lua
Running 36 tests
_____________*_*_*_*________________ ==> Done Completed 193792 asserts in 36 tests with 16 errors
--------------------------------------------------------------------------------
randomMediumQR_inPlace_torch.FloatTensor
QR = A
TensorEQ(==) violation val=1.5631318092346e-05, condition=1e-05
/Users/bartvm/torch/install/share/lua/5.1/torch/Tester.lua:61: in function 'assertTensorEq'
test/test_qr.lua:80: in function 'checkQR'
@bartvm
bartvm / dl-frameworks.rst
Last active December 7, 2020 18:18
A comparison of deep learning frameworks

A comparison of Theano with other deep learning frameworks, highlighting a series of low-level design choices in no particular order.

Overview

Symbolic: Theano, CGT; Automatic: Torch, MXNet

Symbolic and automatic differentiation are often confused or used interchangeably, although their implementations are significantly different.

import numpy as np
import timeit
from matplotlib import pyplot as plt
n = 1000
t1s, t2s = [], []
for p in np.linspace(0, 1, num=20):
y = np.random.binomial(1, p, n)
x = np.random.rand(n)
t1 = timeit.timeit('np.sum(x * y)', 'import numpy as np; from __main__ import x, y', number=100000)
import sqlite3
import xmltodict
from datetime import datetime
from flask import g, Flask, request
app = Flask(__name__)
DATABASE = 'data.db'
# Run the following command on the hosts:
# nvidia-smi -q -x -l 60 | curl -X POST -d @- http://eos12:5000/$HOSTNAME
DROP TABLE IF EXISTS data;
CREATE TABLE data (
hostname TEXT,
gpu_id TEXT,
gpu_name TEXT,
timestamp INTEGER,
utilization REAL
);
@bartvm
bartvm / gist:3e3d169a7d4154353981
Last active December 3, 2015 20:05
Pseudo-code multi-GPU

Each worker is roughly of the following form:

# socket is some form of communication
def train(id, device, batch_queue, socket):
  construct_graph_and_compile()
  if id == 1:
      # This is the first process, so memory map the parameters
      m_params = memory_map(params)
      # Send them to the main thread
SOURCE=en
TARGET=fr
SCRIPTS="$(pwd)/mosesdecoder/scripts"
# Create the data directory
mkdir -p IWSLT15 && cd IWSLT15
# Download and unpack the data
# wget "https://wit3.fbk.eu/archive/2015-01/texts/$SOURCE/$TARGET/$SOURCE-$TARGET.tgz"
tar xvfz "$SOURCE-$TARGET.tgz"
cd "$SOURCE-$TARGET"
for lang in $SOURCE $TARGET; do
@bartvm
bartvm / PIA.sh
Last active September 8, 2017 03:42
cd openvpn
connections=(*.ovpn)
i=1
for filename in "${connections[@]}"; do
extension="${filename##*.}"
base="${filename%.*}"
printf -v j "%02d" $((i+10))
mkdir "$j"
cp crl.rsa.2048.pem "$j/crl.rsa.2048.pem"
cp ca.rsa.2048.crt "$j/ca.rsa.2048.crt"