Skip to content

Instantly share code, notes, and snippets.

View panamantis's full-sized avatar

Jon panamantis

View GitHub Profile
@willccbb
willccbb / grpo_demo.py
Last active April 19, 2025 20:50
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
# !pip install torch transformers scikit-learn umap-learn matplotlib datasets joblib pandas zstandard
'''
Code outline:
1. Loading the pre-trained GPT-2 model and tokenizer.
2. Loading or downloading the dataset and saving it to disk with compression.
3. Collecting and normalizing activations from the middle layer of the model.
4. Training multiple SAEs with different feature sizes and saving them to disk.
5. Finding the feature that responds to the phrase "Golden Gate Bridge" in each SAE.
// Created by Anderson Mancini 2023
// React Three Fiber AutoFocus Component to be used
// as an extension for default Depth Of Field from react-three/postprocessing
// HOW TO USE?
// import AutoFocusDOF from './AutoFocusDOF'
//
// And add this component inside the EffectsComposer...
//...
// <EffectComposer>
import requests
headers = {"user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36",
}
company_link = 'https://www.linkedin.com/voyager/api/entities/companies/2652230'
with requests.session() as s:
s.cookies['li_at'] = "your li_at cookie"
s.cookies["JSESSIONID"] = "your JSESSIONID"
@zapalote
zapalote / extract-gbooks-terms.py
Last active April 2, 2024 11:31
Example of multi-threading and memory mapped file processing.
# extraction pattern: ngram TAB year TAB match_count TAB volume_count NEWLINE
# out: unique_ngram TAB sum(match_count) NEWLINE
import re
import os, sys, mmap
from pathlib import Path
from tqdm import tqdm
from concurrent.futures import ThreadPoolExecutor
abv = re.compile(r'^(([A-Z]\.){1,})(_|[^\w])') # A.B.C.
import requests
from bs4 import BeautifulSoup
import pandas as pd
import time
baseurl = 'http://publicreporting.ltchomes.net/en-ca/'
url = baseurl + 'Search_Selection.aspx'
response = requests.get(url)
soup = BeautifulSoup(response.text, "html.parser")
@vznncv
vznncv / paramiko_sftp_large_file_downloading_demo.py
Created January 18, 2020 09:26
Workaround to download a large file with paramiko from a sftp server
"""
The script contains example of the paramiko usage for large file downloading.
It implements :func:`download` with limited number of concurrent requests to server, whereas
paramiko implementation of the :meth:`paramiko.SFTPClient.getfo` send read requests without
limitations, that can cause problems if large file is being downloaded.
"""
import logging
import os
@flavioespinoza
flavioespinoza / depth_chart.html
Last active April 21, 2023 14:00
D3 Market Depth Chart built from Order Book
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>d3 depth chart</title>
<script type="text/javascript" src="https://d3js.org/d3.v4.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
<style>
@nbremer
nbremer / .block
Last active June 9, 2020 05:08
Gooey effect - Data visualization showcase
height: 680