Skip to content

Instantly share code, notes, and snippets.

View vgel's full-sized avatar

Theia Vogel vgel

View GitHub Profile
@vgel
vgel / _language_vector.py
Last active July 18, 2024 08:10
generating a language response vector w/ repeng
import json
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from repeng import ControlVector, ControlModel, DatasetEntry
model_name = "mistralai/Mistral-7B-Instruct-v0.1"
tokenizer = AutoTokenizer.from_pretrained(model_name)
@vgel
vgel / features.json
Created July 2, 2024 18:20
Anthropic SAE features extracted from the feature browser, normalized, and tested for errors against the API
[
{
"model": "34m",
"index": 6426,
"desc": "Grove startup; Gateway cloning technology",
"usable": true
},
{
"model": "34m",
"index": 19443,
@vgel
vgel / readme.txt
Created May 14, 2024 22:33
AlephNull (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@vgel
vgel / readme.txt
Created April 6, 2024 02:47
AlephNull (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
@vgel
vgel / readme.txt
Created April 4, 2024 08:16
maxwell's demon (PuzzleScript Script)
Play this game by pasting the script in http://www.puzzlescript.net/editor.html
import os
import tqdm
import openai
openai.api_key = os.environ["OPENAI_API_KEY"]
def get_response(usermsg):
response = openai.ChatCompletion.create(
@vgel
vgel / chunkpaper.py
Created November 8, 2023 20:34
ar5iv
# pip install beautifulsoup4 requests markdownify mistletoe
# command line usage: python chunkpaper.py 'https://ar5iv.org/abs/1910.06709'
# will dump the HTML, Markdown, and finally the chunk JSON
# note that (as of Nov 8 '23) ar5iv only has arxiv papers converted up to the end of October,
# but if you need something more recent you could probably do the LaTeX→HTML conversion yourself
# library usage: call `chunk` with some ar5iv HTML. will probably choke on anything else
import dataclasses
@vgel
vgel / _README.md
Last active October 28, 2023 06:47
Bantu Lexical Reconstructions 3 (Extracted from Filemaker Pro)
@vgel
vgel / app.py
Last active December 20, 2022 23:28
Simple RSS proxy to add title elements to a Mastodon feed
# put in rss_proxy/ as app.py and run with `python -m flask run`
# requirements: flask beautifulsoup4 requests lxml
# usage: `curl localhost:5000?feed=https://instance.example.com/users/username.rss`
from bs4 import BeautifulSoup
from flask import Flask, request
import requests
from lxml.builder import E
import lxml.etree
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/4.5.3/pixi.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/planck-js/0.1.34/planck-with-testbed.js"></script>
</head>
<body>