Skip to content

Instantly share code, notes, and snippets.

View erichocean's full-sized avatar

Erich Ocean erichocean

  • Xy Group Ltd
  • North Carolina
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@esshka
esshka / dual_math.clj
Created April 8, 2025 02:18
clojure dual nums impl
(ns dual-math
(:refer-clojure :exclude [+ - * / abs max min sin cos tan asin acos atan exp log pow sqrt])
(:require [clojure.core :as core]))
;; == Part 1: Dual Number Definition and Helpers ==
(defrecord DualNumber [value deriv])
;; Helper to check if something is a dual number
(defn dual? [x] (instance? DualNumber x))
#!/usr/bin/env python3
from flask import Flask, render_template_string
app = Flask(__name__)
@app.route('/')
def dashboard():
return render_template_string(r'''
<!DOCTYPE html>
<html lang="en">
@willccbb
willccbb / grpo_demo.py
Last active May 23, 2025 09:48
GRPO Llama-1B
# train_grpo.py
#
# See https://github.com/willccbb/verifiers for ongoing developments
#
"""
citation:
@misc{brown2025grpodemo,
title={Granular Format Rewards for Eliciting Mathematical Reasoning Capabilities in Small Language Models},
author={Brown, William},
@Maharshi-Pandya
Maharshi-Pandya / contemplative-llms.txt
Last active May 23, 2025 13:17
"Contemplative reasoning" response style for LLMs like Claude and GPT-4o
You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis.
## Core Principles
1. EXPLORATION OVER CONCLUSION
- Never rush to conclusions
- Keep exploring until a solution emerges naturally from the evidence
- If uncertain, continue reasoning indefinitely
- Question every assumption and inference
@DennyLindberg
DennyLindberg / sdl3_win32_wmpointer.cpp
Created November 16, 2024 10:08
Grabbing WM_POINTER events with SDL3 on Windows
// This code does not work as-is. It is a work-in-progress in my application. You need to modify it for your application.
void handle_stylus_event(UINT uMsg, WPARAM wParam)
{
// Wacom + [DriverSetting: Use Windows Ink] required for these events to happen at all.
// WinTab mandatory when Windows Ink is disabled in any way.
if (uMsg == WM_POINTERDEVICECHANGE)
{
PRINT_INPUT("DEVICE CHANGE\n");
def generate_speculative(
model: nn.Module,
draft_model: nn.Module,
tokenizer: Union[PreTrainedTokenizer, TokenizerWrapper],
prompt: str,
max_tokens: int = 100,
verbose: bool = False,
formatter: Optional[Callable] = None,
**kwargs,
@sullyo
sullyo / collect_code.sh
Created September 22, 2024 18:49
Clones a github repo and puts all the code into a single text file perfect for LLMs
#!/bin/bash
# Check if a GitHub URL is provided as an argument
if [ -z "$1" ]; then
echo "Usage: $0 <github_url>"
exit 1
fi
# Store the GitHub URL
GIT_URL="$1"
@catid
catid / gist:533dd0c7d4f3ee8d34a6a905155b72ae
Last active April 22, 2024 04:53
How to quantize 70B model so it will fit on 2x4090 GPUs
How to quantize 70B model so it will fit on 2x4090 GPUs:
I tried EXL2, AutoAWQ, and SqueezeLLM and they all failed for different reasons (issues opened).
HQQ worked:
I rented a 4x GPU 1TB RAM ($19/hr) instance on runpod with 1024GB container and 1024GB workspace disk space.
I think you only need 2x GPU with 80GB VRAM and 512GB+ system RAM so probably overpaid.
Note you need to fill in the form to get access to the 70B Meta weights.
@rmcelreath
rmcelreath / prior_likelihood_conflict.r
Created September 11, 2023 11:29
Demonstration of how normal and student-t distributions interact in Bayesian updating
# prior - likelihood conflict
library(rethinking)
yobs <- 0
mtt <- ulam(
alist(
y ~ dstudent(2,mu,1),
mu ~ dstudent(2,10,1)