Skip to content

Instantly share code, notes, and snippets.

View ed1d1a8d's full-sized avatar

Tony Wang ed1d1a8d

View GitHub Profile
import numpy as np
import openai
import scipy.special
import tiktoken
def get_top_chat_logprobs(
model: str,
messages: list[dict[str, str]],
@ed1d1a8d
ed1d1a8d / gen_beton.py
Last active July 14, 2022 21:51
ffcv-tqdm-thread-leak
import torch.utils.data
import torchvision
from ffcv.fields import IntField, RGBImageField
from ffcv.writer import DatasetWriter
ds = torch.utils.data.Subset(
dataset=torchvision.datasets.CIFAR10(
"/var/tmp", train=False, download=True
),
indices=range(64),
@ed1d1a8d
ed1d1a8d / .tmux.conf
Created May 31, 2021 03:04
tmux configuration
# remap prefix to Control + a
set -g prefix C-a
# bind 'C-a C-a' to type 'C-a'
bind C-a send-prefix
unbind C-b
set-window-option -g mode-keys vi
@ed1d1a8d
ed1d1a8d / .zshrc
Last active May 31, 2021 00:42
Zsh config
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# Begin history configuration
HISTFILE=~/.zsh_history
HISTSIZE=1000000000 # max events to load into memory
@ed1d1a8d
ed1d1a8d / .vimrc
Last active January 9, 2021 08:14
vimrc
set softtabstop=4 shiftwidth=4 expandtab
set autoindent
set number
set colorcolumn=81
autocmd BufWritePre * %s/\s\+$//e
set backspace=indent,eol,start
filetype indent plugin on
syntax enable
set background=dark