Skip to content

Instantly share code, notes, and snippets.

View epeters3's full-sized avatar

Evan Peterson epeters3

View GitHub Profile
@epeters3
epeters3 / install_cuda.sh
Last active May 29, 2020 17:19
Install latest CUDA toolkit and drivers on Ubuntu
# Register the Ubuntu Nvidia PPA
add-apt-repository ppa:graphics-driver/ppa
apt update
ubuntu-drivers autoinstall
# Restart the machine
reboot
# Then, once rebooted...
# Install the latest toolkit
@epeters3
epeters3 / recognize_intent.py
Last active March 6, 2020 23:06
This is a naive system for intent recognition, for use in dialogue systems. Other intents can be added. This system is naive because it makes the assumption that the sentence embeddings of all natural language instantiations of an intent will be within two standard deviations of the intent's examples centroid. This is a heuristic.
from statistics import mean
from math import sqrt
from functools import reduce
from sentence_transformers import SentenceTransformer
import numpy as np
from scipy.spatial.distance import cosine
model = SentenceTransformer("distilbert-base-nli-stsb-mean-tokens")
@epeters3
epeters3 / embeddings_playground.py
Last active February 3, 2020 19:11
Fast Querying of Word Embeddings Using `sklearn.neighbors.BallTree`
import io
import typing as t
import pickle
import os
import numpy as np
from tqdm import tqdm
from sklearn.neighbors import BallTree
# The embedded word vectors that work with this gist can be downloaded at
@epeters3
epeters3 / .bash_profile
Created August 28, 2018 15:14
My .bash_profile that I like to use
### VISUAL TERMINAL SETTINGS
############################
# Configure prompt
EMOJIS=("๐ŸŒฎ" "๐Ÿ" "๐ŸŽ‰" "๐Ÿš€")
DEFAULT_EMOJI=${EMOJIS[$RANDOM % ${#EMOJIS[@]} ]}
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'