Skip to content

Instantly share code, notes, and snippets.

View jgraving's full-sized avatar

Jake Graving jgraving

  • Max Planck Institute of Animal Behavior
  • Konstanz, Germany
View GitHub Profile
@jgraving
jgraving / cuda_11.7_installation_on_Ubuntu_20.04
Created April 10, 2024 13:18 — forked from verazuo/cuda_11.7_installation_on_Ubuntu_20.04
Instructions for CUDA v11.7 and cuDNN 8.5 installation on Ubuntu 20.04 for PyTorch 1.12.1
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check
@jgraving
jgraving / install-cuda-10-bionic.sh
Created December 11, 2019 09:50 — forked from bogdan-kulynych/install-cuda-10-bionic.sh
Install CUDA 10 on Ubuntu 18.04
# WARNING: These steps seem to not work anymore!
#!/bin/bash
# Purge existign CUDA first
sudo apt --purge remove "cublas*" "cuda*"
sudo apt --purge remove "nvidia*"
# Install CUDA Toolkit 10
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
@jgraving
jgraving / Earth Mover's Distance.ipynb
Created April 10, 2019 22:56 — forked from kylemcdonald/Earth Mover's Distance.ipynb
Faster 1d Earth Mover's Distance with numpy and numba.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jgraving
jgraving / dtw_mse.py
Created April 10, 2019 22:56 — forked from kylemcdonald/dtw_mse.py
DTW MSE numba function for use with UMAP.
# based on https://github.com/kylerbrown/ezdtw
# with modifications to be fully njit-able
import numpy as np
from numba import njit
@njit
def sqeuclidean(a, b):
return np.sum((a - b)**2)
@jgraving
jgraving / cuda_installation_on_ubuntu_18.04
Created September 25, 2018 09:39 — forked from Mahedi-61/cuda_11.8_installation_on_Ubuntu_22.04
cuda 9.0 complete installation procedure for ubuntu 18.04 LTS
#!/bin/bash
## This gist contains step by step instructions to install cuda v9.0 and cudnn 7.2 in ubuntu 18.04
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
@jgraving
jgraving / Readme.md
Created May 24, 2018 12:53 — forked from dpatschke/Readme.md
Numba Ball Tree (ParallelAccelerator)

Numba Ball Tree (ParallelAccelerator)

This is a modified gist of Jake Vanderplas wonderful Numba Ball Tree code from the following gist. This gist basically adds the 'nopython' parameter in the jit decorators from the original gist and parallelizes the nearest neighbor query for each of the points.

Timings

With some of the new advances in numba and the modifications

@jgraving
jgraving / algorithms_openpose.md
Created May 2, 2018 12:55 — forked from alesolano/algorithms_openpose.md
OpenPose TensorFlow Alogrithms
@jgraving
jgraving / autoencoder_extra.py
Created December 7, 2017 13:36 — forked from njellinas/autoencoder_extra.py
Two Keras Layer-Class definitions for implementing Weight-Tying and for loading pretrained weights in Deep Autoencoders
import keras.backend as K
from keras.layers import Layer
from keras.legacy import interfaces
from keras.engine import InputSpec
from keras import activations, initializers, regularizers, constraints
class DenseTransposeTied(Layer):
@interfaces.legacy_dense_support
@jgraving
jgraving / ffmpeg_load_audio.py
Created September 28, 2017 23:07 — forked from kylemcdonald/ffmpeg_load_audio.py
Load audio from ffmpeg into Python using numpy.
import numpy as np
import subprocess as sp
import os
DEVNULL = open(os.devnull, 'w')
# load_audio can not detect the input type
def ffmpeg_load_audio(filename, sr=44100, mono=False, normalize=True, in_type=np.int16, out_type=np.float32):
channels = 1 if mono else 2
format_strings = {
np.float64: 'f64le',
@jgraving
jgraving / medfilt.py
Created July 31, 2017 14:33 — forked from bhawkins/medfilt.py
1D median filter using numpy
#!/usr/bin/env python
import numpy as np
def medfilt (x, k):
"""Apply a length-k median filter to a 1D array x.
Boundaries are extended by repeating endpoints.
"""
assert k % 2 == 1, "Median filter length must be odd."