Skip to content

Instantly share code, notes, and snippets.

View vukrosic's full-sized avatar

Vuk Rosić vukrosic

View GitHub Profile
@vukrosic
vukrosic / rmsnorm.ipynb
Last active October 21, 2025 21:26
RMSNorm Tutorial.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vukrosic
vukrosic / excercise.ipynb
Last active October 4, 2025 10:52
Implementing the NVFP4 Recipe From Scratch.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vukrosic
vukrosic / qwen3_from_scratch.ipynb
Last active October 19, 2025 17:05
qwen3_from_scratch.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vukrosic
vukrosic / inference_mnist_diffusion_image_gen.py
Last active August 7, 2025 12:33
Training and inference of image generation diffusion model for MNIST hand written digits
# -*- coding: utf-8 -*-
import torch
import torchvision
import datasets
import diffusers
import accelerate
from tqdm.auto import tqdm
import matplotlib.pyplot as plt
import os
@vukrosic
vukrosic / t2vdiffusion.py
Last active August 5, 2025 18:43
Small text to video diffusion skeleton (generates 1 small video and overfits on it), build it from here
"""
Memory-Efficient Wan Text-to-Video Model - Single File Implementation
Generates synthetic data, trains on it, and demonstrates inference
Optimized for Google Colab with minimal GPU memory usage
"""
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
@vukrosic
vukrosic / llm.py
Created August 5, 2025 10:42
Small transformer LLM
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
from torch.cuda.amp import autocast, GradScaler
import math
import random
import numpy as np
from datasets import load_dataset
from tqdm import tqdm
@vukrosic
vukrosic / simple_neural_network.py
Created August 4, 2025 17:19
Simple neural network that fits a line and plots graphs for easier understanding
import numpy as np
import matplotlib.pyplot as plt
class SimpleNeuralNetwork:
def __init__(self, input_size, hidden_size, output_size, learning_rate=0.1):
# Initialize weights and biases for 2-layer network
self.W1 = np.random.randn(input_size, hidden_size) * np.sqrt(2.0 / input_size)
self.b1 = np.zeros((1, hidden_size)) # Hidden layer bias
self.W2 = np.random.randn(hidden_size, output_size) * np.sqrt(2.0 / hidden_size)
self.b2 = np.zeros((1, output_size)) # Output layer bias
@vukrosic
vukrosic / master-math-of-a-neuron-road-to-top-0-1-ai-researcher.ipynb
Last active November 9, 2025 07:11
master-math-of-a-neuron-road-to-top-0-1-ai-researcher.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vukrosic
vukrosic / StrawberryProductCard.tsx
Created July 5, 2024 12:40
Ecommerce product card - react (NextJS) code for this video - https://youtu.be/UObUvSu91PM
"use client";
import React, { useState } from 'react';
import { Card, CardContent } from "@/components/ui/card";
import { Button } from "@/components/ui/button";
import { ChevronLeft, ChevronRight, Minus, Plane, Plus } from 'lucide-react';
const product = {
id: '1',
name: 'Strawberries',