Skip to content

Instantly share code, notes, and snippets.

View bhavika's full-sized avatar

Bhavika Tekwani bhavika

View GitHub Profile
import numpy as np
from transformers import AutoTokenizer, AutoModel
from pathlib import Path
from optimum.exporters import TasksManager
from optimum.exporters.onnx import export
import onnx
from optimum.exporters.onnx import validate_model_outputs
from optimum.onnxruntime import ORTModelForFeatureExtraction
import torch
@bhavika
bhavika / zsh_profile
Created January 16, 2024 18:21
ZSH Profile
git_current_branch () {
local ref
ref=$(command git symbolic-ref --quiet HEAD 2> /dev/null)
local ret=$?
if [[ $ret != 0 ]]
then
[[ $ret == 128 ]] && return
ref=$(command git rev-parse --short HEAD 2> /dev/null) || return
fi
echo ${ref#refs/heads/}
@bhavika
bhavika / latency.txt
Created December 15, 2020 00:22 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@bhavika
bhavika / sudoku.py
Created November 10, 2018 07:13
Sudoku Solver
# Sudoku Solver - Peter A. Norvig
digits = '123456789'
rows = 'ABCDEFGHI'
cols = digits
def cross(A, B):
return [a+b for a in A for b in B]
squares = cross(rows, cols)
@bhavika
bhavika / finetune.py
Created November 25, 2017 21:45 — forked from panovr/finetune.py
Fine-tuning pre-trained models with PyTorch
import argparse
import os
import shutil
import time
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
@bhavika
bhavika / docker_help.txt
Last active August 2, 2017 04:59
Docker commands I use frequently
Delete all containers:
docker rm $(docker ps -a -q)
Delete all images:
docker rmi $(docker images -q)

Keybase proof

I hereby claim:

  • I am bhavika on github.
  • I am bhavika (https://keybase.io/bhavika) on keybase.
  • I have a public key whose fingerprint is 9560 2C5B 4FBF F6B7 20FE CA07 8DE0 2A9A 10C5 B55F

To claim this, I am signing this object:

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name: