Skip to content

Instantly share code, notes, and snippets.

View Butanium's full-sized avatar

Clément Dumas Butanium

View GitHub Profile
"""
Single File implementation of cross-model single layer crosscoder training inspired by
https://github.com/jkminder/dictionary_learning and https://github.com/saprmarks/dictionary_learning
Supports training multiple crosscoders on the same inputs and collect activations in a buffer.
"""
import torch.nn as nn
import torch as th
@Butanium
Butanium / deploy_pypi_package.py
Last active October 6, 2025 18:42
Deploys a python package in one line of code
import subprocess
import sys
import os
import glob
from argparse import ArgumentParser
def create_git_tag(version):
tag_name = f"v{version}"
result = subprocess.run(["git", "tag", tag_name])
@Butanium
Butanium / crosscoder.ipynb
Last active February 17, 2025 11:50
crosscoder.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Butanium
Butanium / femtoGPT.py
Last active February 1, 2024 12:58
femtoGPT
"""
A minimal pytorch implementation of a multi-head attention transformer inspired by nanoGPT
"""
from dataclasses import dataclass
import torch.nn as nn
import torch.nn.functional as F
import torch as th
import numpy as np
class SelfAttention(nn.Module):
@Butanium
Butanium / fall-challenge-2020_Irma.py
Created February 1, 2021 20:31
codinGame fall challenge 2020
import sys
import math
import numpy as np
REST = "REST"
WAIT = "WAIT"
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.