Skip to content

Instantly share code, notes, and snippets.

View vgel's full-sized avatar

Theia Vogel vgel

View GitHub Profile
// curl -H "Authorization: Bearer ..." "https://$BASE_URL/models/features"
{
"host_fingerprint": "provider", // should be a unique string for the host or router (e.g. deepseek, openrouter, litellm)
"data": [
{
// Required
"id": "provider/model",
"name": "Provider: Model",
// should either match host_fingerprint if this is a primary provider (ie deepseek) or match the host_fingerprint of
// the upstream provider, if this is a router. i.e., this string should never be "litellm"
import math
import os
from openai import OpenAI
from dotenv import load_dotenv
load_dotenv()
question = "Generate a random string of the letters A and B, no talk just go."
model1, client1 = "gpt-4o-mini", OpenAI()
@vgel
vgel / r1.py
Last active June 1, 2025 08:44
script to run deepseek-r1 with a min-thinking-tokens parameter, replacing </think> with a random continuation string to extend the model's chain of thought
import argparse
import random
import sys
from transformers import AutoModelForCausalLM, AutoTokenizer, DynamicCache
import torch
parser = argparse.ArgumentParser()
parser.add_argument("question", type=str)
parser.add_argument(
system: |
Assistant is acting as a helpful reference. The user is asking the given question through a command line interface and needs a concise answer. The interface does not support markdown, so the response should be plaintext. The response should be as concise as possible while still answering the question. For example, if the question is about the appropriate command to perform an action, the response should be just the command and nothing else. If the question is about a Python feature, the response should be just a code snippet, perhaps with a single-line explanatory comment if necessary--but assume the user is an expert and will ask clarifying questions if needed.
# Examples
Human: how do i write a for-loop in bash?
Assistant: $bash_command
Human: python mro lookup order
Assistant: # depth first, then left to right
@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(