No project description provided
Project description
EasyRoutine
This is just a simple collection of routines that I use frequently. I have found that I often need to do the same things over and over again, so I have created this repository to store them. I hope you find them useful.
Installation
Interpretability
The interpretability module contains wrapper of huggingface LLM/VLM that help to perform interpretability tasks on the model. Currently, it supports:
- Extract activations of any component of the model
- Perform ablation study on the model during inference
- Perform activation patching on the model during inference
Simple Tutorial
# First we need to import the HookedModel and the config classes
from easyroutine.interpretability import HookedModel, ExtractionConfig
hooked_model = HookedModel.from_pretrained(
model_name="mistral-community/pixtral-12b", # the model name
device_map = "auto"
)
# Now let's define a simple dataset
dataset = [
"This is a test",
"This is another test"
]
tokenizer = hooked_model.get_tokenizer()
dataset = tokenizer(dataset, padding=True, truncation=True, return_tensors="pt")
cache = hooked_model.extract_cache(
dataset,
target_token_positions = ["last"],
extraction_config = ExtractionConfig(
extract_resid_out = True
)
)
Development
For publish the package push a commit with the flag:
[patch]: x.x.7 -> x.x.8[minor]: x.7.x -> x.8.0[major]: 2.x.x -> 3.0.0
Example commit: fix multiple bus [patch]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file easyroutine-1.0.2.tar.gz.
File metadata
- Download URL: easyroutine-1.0.2.tar.gz
- Upload date:
- Size: 46.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bc6aebf934a99c1c67699c402d029a4c9e8fe5bac995b939e3638cbeb85ddef6
|
|
| MD5 |
a8e358c762f61a313856ae2757455e42
|
|
| BLAKE2b-256 |
52569f17d6e4cf4cb5c0982aa35df2c4d2e3488632e5eaf217f3245e1dc4e891
|
File details
Details for the file easyroutine-1.0.2-py3-none-any.whl.
File metadata
- Download URL: easyroutine-1.0.2-py3-none-any.whl
- Upload date:
- Size: 57.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3de07926d8655e1a88c340845a087accb2099665458a90157605e6c3c0d086da
|
|
| MD5 |
27edb3e4e2eac86273f24c0e1a4178ca
|
|
| BLAKE2b-256 |
e861769d156a8fd8a70482d4fa293239893857e339b1d4419416c29193a677f9
|