Skip to content

Instantly share code, notes, and snippets.

View lelayf's full-sized avatar

François Le Lay lelayf

View GitHub Profile
@lelayf
lelayf / HOWTO.md
Last active September 30, 2020 12:21
CUDA on Windows Subsystem for Linux (WSL2)

I followed instructions documented at https://ubuntu.com/blog/getting-started-with-cuda-on-ubuntu-on-wsl-2.

A few things that wwere not documented:

  • After the Insiders Dev channel install, my WSL kernel version was still unchanged. Restarting the computer fixed it.
  • sudo service docker start did not work for me. It looks like Systemd is not/can't be the init system in WSL2. What worked is simply sudo dockerd. Then I had an issue with cgroups, fixed with:
sudo mkdir /sys/fs/cgroup/systemd
sudo mount -t cgroup -o none,name=systemd cgroup /sys/fs/cgroup/systemd
@lelayf
lelayf / build_tflite_demo.sh
Last active June 18, 2018 15:58
Build TensorFlow Lite demo for Android
#!/bin/sh
cd ~
# install bazel if you don't have it already
brew install bazel
# install Android NDK v14b in your home dir (more recent versions are NOT supported by Bazel)
# check https://developer.android.com/ndk/downloads/older_releases
curl -O https://dl.google.com/android/repository/android-ndk-r14b-darwin-x86_64.zip
# coding: utf-8
# In[35]:
import numpy as np
import pandas as pd
import tensorflow as tf
import random
import math
import random
random.seed(a=1337)
k_fold = KFold(n_splits=10)
LABEL_COLUMN = "Ask.Low.Pc_H4_8AM"
resultz=[]
layerz=[]
stepz=[]
for i in range(100):
Verifying that +lelayf is my blockchain ID. https://onename.com/lelayf
@lelayf
lelayf / lehedge_solver.prototxt
Last active August 29, 2015 14:06
LeHedge v1
# The train/test net protocol buffer definition
net: "lehedge_train_test.prototxt"
# test_iter specifies how many forward passes the test should carry out.
# In the case of MNIST, we have test batch size 100 and 100 test iterations,
# covering the full 10,000 testing images.
test_iter: 282
# Carry out testing every 500 training iterations.
test_interval: 564
# The base learning rate, momentum and the weight decay of the network.
base_lr: 0.0001
@lelayf
lelayf / mnist-predict-100-twos.py
Created August 30, 2014 20:16
Predict MNIST figures with Caffe trained model - Step 1 : prepare input data
import os, struct
import numpy as np
from array import array as pyarray
from numpy import append, array, int8, uint8, zeros
def read(digits, dataset = "training", path = "."):
"""
Loads MNIST files into 3D numpy arrays
Adapted from: http://abel.ee.ucla.edu/cvxopt/_downloads/mnist.py
@lelayf
lelayf / classify_mnist.sh
Last active August 29, 2015 14:05
Predict MNIST figures with Caffe trained model - Step 2 Launch
# save in $CAFFE_ROOT/examples/mnist
../../python/classify.py --model_def ./lenet.prototxt --pretrained_model ./lenet_iter_10000 --mean_file='' --images_dim 28,28 --gpu --channel_swap '0' ~/lehedge/mnist-predict-100-twos.npy foo
@lelayf
lelayf / gist:11380244
Created April 28, 2014 18:33
java cross-compilation
# Compliler is jdk 1.7 but jre is 1.6
# I got error
javac -source 1.6 -target 1.6 -bootclasspath /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/rt.jar AvroDataFileReader.java
@lelayf
lelayf / gist:2867633
Created June 4, 2012 10:18
TemplateTap + thrift + Hfs-seqfile / hfs-lzo-thrift
;; thrifters
(defn thrift-order-item-line_price_net
[id val]
(DataUnit/order_item_property
(OrderItemProperty.
(OrderItemID/id id)
(OrderItemPropertyValue/line_price_net val)
(. (new Date) getTime))))