Skip to content

Instantly share code, notes, and snippets.

View candywal's full-sized avatar

Anshul Khandelwal candywal

View GitHub Profile
@candywal
candywal / readme.md
Created November 17, 2024 21:18
Transformer

I implemented a transformer from scratch, with different sampling methods, beam search and caching. Made it while working through https://www.arena.education/.

@candywal
candywal / gan.py
Last active November 17, 2024 17:26
GAN
# %% This file should
import torch as t
from torch import nn
import torch.utils.data as data
from torchvision import datasets, transforms
from dataclasses import dataclass
from typing import Literal
from tqdm import tqdm
import matplotlib.pyplot as plt
from IPython import display
@candywal
candywal / asgn8.rkt
Created January 23, 2024 22:20
This project is an interpreter and parser written in racket.
#lang typed/racket
(require typed/rackunit)
; Data definitions
(define-type ExprC (U NumC IdC AppC IfC LamTC StringC))
(struct NumC ([n : Real])#:transparent)
(struct IdC ([s : Symbol])#:transparent)
(struct AppC ([fun : ExprC] [arg : (Listof ExprC)]) #:transparent)
(struct IfC ([test : ExprC] [then : ExprC] [else : ExprC]) #:transparent)
(struct LamTC ([args : (Listof Symbol)] [arg-types : (Listof ty)] [body : ExprC]) #:transparent)