Skip to content

Instantly share code, notes, and snippets.

View vsevolodl's full-sized avatar
🤗

Vsevolod Leonov vsevolodl

🤗
View GitHub Profile
@vsevolodl
vsevolodl / grpo_demo.py
Created February 4, 2025 20:48 — 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
@vsevolodl
vsevolodl / llm_benchmark_throughput.py
Created July 1, 2024 20:08
LLM throughput benchmarking
# Sample usage:
# Download py file and sample formatted_prompts.json files
#
# Run in command line: python llm_benchmark_throughput.py --prompts_file formatted_prompts.json --model meta-llama/Meta-Llama-3-8B-Instruct
# --api_base http://vllm:8000/v1 --api_key vllm_key_here --profile vllm050_fp16_tp2 --stream --iterations 3 --max_tokens 128 --qps "16, 32, 64"
#
#
# formatted_prompts.json sample record:
# {"prompt": "Your task is blah blah blah."}
#