Skip to content

Instantly share code, notes, and snippets.

View voletiv's full-sized avatar

Vikram Voleti voletiv

View GitHub Profile
import os
import psutil
import torch
def get_CPU_mem():
return psutil.Process(os.getpid()).memory_info().rss /1024**3
def get_GPU_mem():
@voletiv
voletiv / imagenet
Last active October 12, 2021 15:55
Imagenet Dataset and Dataloader
import h5py
import io
import json
import numpy as np
import os
import torch
from PIL import Image
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.distributed import DistributedSampler
@voletiv
voletiv / private_fork.md
Created June 8, 2021 23:22 — forked from 0xjac/private_fork.md
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare [email protected]:usi-systems/easytrace.git

@voletiv
voletiv / imagenet_classes.txt
Created July 7, 2020 19:34 — forked from aaronpolhamus/map_clsloc.txt
Image net classes + labels
n02119789 1 kit_fox
n02100735 2 English_setter
n02110185 3 Siberian_husky
n02096294 4 Australian_terrier
n02102040 5 English_springer
n02066245 6 grey_whale
n02509815 7 lesser_panda
n02124075 8 Egyptian_cat
n02417914 9 ibex
n02123394 10 Persian_cat
git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all
@voletiv
voletiv / parse_yaml.sh
Created November 14, 2016 16:42 — forked from pkuczynski/LICENSE
Read YAML file from Bash script
#!/bin/sh
parse_yaml() {
local prefix=$2
local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @|tr @ '\034')
sed -ne "s|^\($s\)\($w\)$s:$s\"\(.*\)\"$s\$|\1$fs\2$fs\3|p" \
-e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 |
awk -F$fs '{
indent = length($1)/2;
vname[indent] = $2;
for (i in vname) {if (i > indent) {delete vname[i]}}