Skip to content

Instantly share code, notes, and snippets.

View jakeju92's full-sized avatar

Jake Ju jakeju92

View GitHub Profile
@jakeju92
jakeju92 / grpo_demo.py
Created February 9, 2025 12:01 — forked from willccbb/grpo_demo.py
GRPO Llama-1B
# train_grpo.py
import re
import torch
from datasets import load_dataset, Dataset
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import LoraConfig
from trl import GRPOConfig, GRPOTrainer
# Load and prep dataset
@jakeju92
jakeju92 / gist:64878465417a043218f00ff814c55a0a
Created December 27, 2023 15:11 — forked from mberman84/gist:45545e48040ef6aafb6a1cb3442edb83
LLaMA 2 13b chat fp16 Install Instructions
conda create -n textgen python=3.10.9
conda activate textgen
install pytorch: pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu117
git clone https://github.com/oobabooga/text-generation-webui
cd text-generation-webui
pip install -r requirements.txt
python server.py
# download model
# refresh model list
# load model
@jakeju92
jakeju92 / tar-progress.md
Last active December 14, 2023 04:16 — forked from Kautenja/tar-progress.md
one-liners for using tar with gzip and pv for a progress bar

Prerequisites

You need to install the pv library first for visualize progress bar.

In Debian system, just run this command: sudo apt-get install pv

Compress

tar cf - <files> -P | pv -s $(du -sb <files> | awk '{print $1}') | gzip > <some .tar.gz file>
@jakeju92
jakeju92 / GitHub Pages Jekyll Dockerfile
Created August 12, 2023 14:47 — forked from BillRaymond/GitHub Pages Jekyll Dockerfile
GitHub Pages and Jekyll Dockerfile
# "#################################################"
# Dockerfile to build a GitHub Pages Jekyll site
# - Ubuntu 22.04
# - Ruby 3.1.2
# - Jekyll 3.9.3
# - GitHub Pages 288
#
# This code is from the following Gist:
# https://gist.github.com/BillRaymond/db761d6b53dc4a237b095819d33c7332#file-post-run-txt
#
@jakeju92
jakeju92 / pytorch_bilinear_interpolation.md
Created December 9, 2021 07:17 — forked from peteflorence/pytorch_bilinear_interpolation.md
Bilinear interpolation in PyTorch, and benchmarking vs. numpy

Here's a simple implementation of bilinear interpolation on tensors using PyTorch.

I wrote this up since I ended up learning a lot about options for interpolation in both the numpy and PyTorch ecosystems. More generally than just interpolation, too, it's also a nice case study in how PyTorch magically can put very numpy-like code on the GPU (and by the way, do autodiff for you too).

For interpolation in PyTorch, this open issue calls for more interpolation features. There is now a nn.functional.grid_sample() feature but at least at first this didn't look like what I needed (but we'll come back to this later).

In particular I wanted to take an image, W x H x C, and sample it many times at different random locations. Note also that this is different than upsampling which exhaustively samples and also doesn't give us fle