Skip to content

Instantly share code, notes, and snippets.

View appliedml42's full-sized avatar
🤖
Learning

Abhishek Patnia appliedml42

🤖
Learning
View GitHub Profile
@appliedml42
appliedml42 / mha.py
Last active January 7, 2022 15:39
MultiHeadAttention Implementation using einops and Pytorch
'''
I am reading this amazing series(https://uvadlc-notebooks.readthedocs.io/en/latest). I always struggle with revisiting
my old code that has a lot of tensor manipulation. Experimented with reimplementing their MultiHeadAttention layer using
einops syntax that feels more human readable.
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
import einops
import math
@appliedml42
appliedml42 / quickdraw_example.py
Last active November 20, 2022 17:33
Using QuickDraw Dataset
from am42_fsd.data.quickdraw import QuickDraw
from torch.utils.data import DataLoader
from tqdm.auto import tqdm
quickdraw = QuickDraw("path to numpy_bitmap folder")
dataloader = DataLoader(quickdraw, shuffle=True, batch_size=64, num_workers=4)
for images, cat_id in tqdm(dataloader):
pass