Skip to content

Instantly share code, notes, and snippets.

@willccbb
willccbb / grpo_demo.py
Last active May 2, 2025 08:43
GRPO Llama-1B
# train_grpo.py
#
# See https://github.com/willccbb/verifiers for ongoing developments
#
import re
import torch
from datasets import load_dataset, Dataset
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import LoraConfig
from trl import GRPOConfig, GRPOTrainer
@rain-1
rain-1 / LLM.md
Last active April 8, 2025 13:49
LLM Introduction: Learn Language Models

Purpose

Bootstrap knowledge of LLMs ASAP. With a bias/focus to GPT.

Avoid being a link dump. Try to provide only valuable well tuned information.

Prelude

Neural network links before starting with transformers.

@chriseidhof
chriseidhof / Routing.swift
Last active May 13, 2018 06:06 — forked from gonzalonunez/Routing.swift
Routing Problem
import Foundation
struct Handler {
let handleJSON: (Data) throws -> Void
init<T: Decodable>(handler: @escaping (T) -> Void) {
handleJSON = { data in
let object = try JSONDecoder().decode(T.self, from: data)
handler(object)
}
@makeev
makeev / create_pkcs7_sign.py
Created March 28, 2016 13:25
Creating a PKCS #7 detached signature of the manifest file for safari push package in python
import M2Crypto
def main():
manifest_path = 'path/to/manifest.json'
signature_path = 'path/to/signature'
# to convert .cer to .pem
# openssl x509 -inform der -in certificate.cer -out certificate.pem
# to combine certificate and key
# cat PushChatCert.pem PushChatKey.pem > ck.pem
@andymatuschak
andymatuschak / CollectionViewDataSource.swift
Last active February 12, 2021 09:44
Type-safe value-oriented collection view data source
//
// CollectionViewDataSource.swift
// Khan Academy
//
// Created by Andy Matuschak on 10/14/14.
// Copyright (c) 2014 Khan Academy. All rights reserved.
//
import UIKit
@jk
jk / generate_passkit_manifest.sh
Created June 28, 2012 09:27
Generate PassKit manifest.json
echo "{"`find . -type f -exec shasum {} + | sed 's/\.\///g' | awk '{print "\t\"" $2 "\" : \"" $1 "\","}' | grep -v -E "(\.DS_Store|manifest\.json)"`"}" | sed 's/\,}/}/g' | python -mjson.tool > manifest.json