Skip to content

Instantly share code, notes, and snippets.

/train/n02112137/n02112137_3351.JPEG 96
/train/n02112137/n02112137_14715.JPEG 96
/train/n02112137/n02112137_8996.JPEG 96
/train/n02112137/n02112137_8952.JPEG 96
/train/n02112137/n02112137_482.JPEG 96
/train/n02112137/n02112137_2023.JPEG 96
/train/n02112137/n02112137_10146.JPEG 96
/train/n02112137/n02112137_13505.JPEG 96
/train/n02112137/n02112137_6212.JPEG 96
/train/n02112137/n02112137_9200.JPEG 96
@rahulvigneswaran
rahulvigneswaran / code-for-moving-average-of-a-tensor.ipynb
Created April 4, 2023 11:33
Code for moving average of a tensor.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rahulvigneswaran
rahulvigneswaran / python2vscode-debugger-args-converter.ipynb
Created March 20, 2023 07:42
python2vscode debugger args converter.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rahulvigneswaran
rahulvigneswaran / label_names_cifar100.py
Created March 20, 2023 05:02
Fine label names for cifar100 dataset
def fine_labels():
fine_labels = [
'apple', # id 0
'aquarium_fish',
'baby',
'bear',
'beaver',
'bed',
'bee',
'beetle',
@rahulvigneswaran
rahulvigneswaran / gpt3_generate.py
Created March 20, 2023 04:59
Routine to generate sentence based on a word. Uses GPT-3. Requires OpenAI's API.
# ========================================================================================================================
import openai
openai.api_key =
# ========================================================================================================================
# >>> len(a[31:60]), len(a[60:])
# (29, 40)
import os
from tqdm import tqdm, trange
import torchvision
model_conv = torchvision.models.resnet18(pretrained=True)
for name, param in model_conv.named_parameters():
if not("fc" in name):
param.requires_grad = False
print(name, param.requires_grad)
@rahulvigneswaran
rahulvigneswaran / color_palatte.py
Created March 16, 2022 11:20
Nice color palattes for plotting
# From Polyfjord - https://youtu.be/Q9IRHmfGDrU?t=17
names = ["gold",
"chilli_pepper",
"crystal_blue",
"aquamarine",
"army_green",
"neon_yellow",
"caramel",
"pumpkin_orange",
@rahulvigneswaran
rahulvigneswaran / cifar100_fine_coarse_labels.py
Last active March 7, 2022 13:30 — forked from adam-dziedzic/cifar100_fine_coarse_labels.py
Mappings between fine (classes) and coarse labels (superclasses) for CIFAR100. Returns coarse2fine, fine2coarse mappings
import pprint as pp
fine_labels = [
'apple', # id 0
'aquarium_fish',
'baby',
'bear',
'beaver',
'bed',
'bee',
@rahulvigneswaran
rahulvigneswaran / welcome_to_DGX-IITH.md
Last active February 7, 2022 12:52
This gist is for newbies of server 93 (DGX) at IIT Hyderabad.

Table of Contents

CPU

  • Dont use CPUs to train. This will slow experiments of others drastically. Almost always try to run your exps on GPUs excluding certain edge cases.

GPU

  • Before you start a run on a GPU that someone else is already using, please do try and run first on an empty GPU, to check the GPU memory your experiment will occupy. If it exceeds the available memory (Use gpustat --watch to find the usage), PLEASE DONT RUN ON IT. This will crash the other person's runs.
#!/bin/bash
#
# script to download and extract ImageNet dataset
# ILSVRC2012_img_train.tar (about 138 GB)
# ILSVRC2012_img_val.tar (about 6.3 GB)
#
# make sure ILSVRC2012_img_train.tar & ILSVRC2012_img_val.tar in your current directory
#
# https://github.com/facebook/fb.resnet.torch/blob/master/INSTALL.md
#