Vision-Language Model Interpretability Analysis - One Token at a Time
Project description
Interpretability Core
Vision-Language Model Interpretability Analysis toolkit for analyzing attention patterns in models like LLaVA and Qwen-VL.
Installation
From PyPI (when published)
pip install otat
From GitHub
pip install git@github.com:varungupta31/otat_api.git
Local Development
git clone https://github.com/varungupta31/otat_api.git
cd otat_api
pip install -e .
Quick Start
from interpretability.api.wrapper import InterpretabilityAnalyzer
# Initialize analyzer
analyzer = InterpretabilityAnalyzer(
model_type="llava_onevision",
model_id="llava-hf/llava-onevision-qwen2-0.5b-ov-hf"
)
# Run analysis
result = analyzer.analyze(
image_path="path/to/image.jpg",
task_text="What is in this image?",
instruction="Answer briefly.",
blocking_mode="none",
num_tokens=20
)
print(result['output_tokens'])
print(result['series']) # Attention patterns
Features
- ๐ Attention pattern analysis for VLMs
- ๐ฏ Support for LLaVA, Qwen-VL, and Qwen2-LLM
- ๐ซ Attention blocking experiments
- ๐ Token-level attention aggregation
License
MIT
---
## **3. Verify Your Project Structure**
Make sure it looks like this:
otat_api/ (or interpretability-core/) โโโ pyproject.toml # โ Just created โโโ README.md # โ Just created โโโ LICENSE # Optional but recommended โโโ .gitignore # Recommended โโโ src/ โ โโโ interpretability/ โ โโโ init.py # โ ๏ธ Make sure this exists! โ โโโ api/ โ โ โโโ init.py โ โ โโโ wrapper.py โ โโโ models/ โ โ โโโ init.py โ โ โโโ base_handler.py โ โ โโโ llava_onevision.py โ โ โโโ qwen2_llm.py โ โ โโโ qwen_25_vl.py โ โโโ tasks/ โ โ โโโ init.py โ โ โโโ base_task.py โ โ โโโ web_api_task.py โ โ โโโ ... โ โโโ analysis/ โ โ โโโ init.py โ โ โโโ extractor_aggregated.py โ โ โโโ ... โ โโโ utils/ โ โ โโโ init.py โ โ โโโ ... โ โโโ prompts/ โ โโโ ... โโโ scripts/ โโโ run_analysis.py
Project details
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 otat-0.1.0.tar.gz.
File metadata
- Download URL: otat-0.1.0.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0800a940373b0671edec0c4d8e83ef53a1fd2c4b56e2d2065df0d4142061cc48
|
|
| MD5 |
aa3a8c399b359dd6e7057b764e11c2a7
|
|
| BLAKE2b-256 |
5ae781664372ccb41acae50d18468a909e5ecb9f12158ff631f1ff3002059f26
|
File details
Details for the file otat-0.1.0-py3-none-any.whl.
File metadata
- Download URL: otat-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da7063942a896cf1c69abc5e5046a93e39d3475eeb34cbe453c7b02abc89e2f4
|
|
| MD5 |
8c46680d4e5e7dace9da8bc474bf7b00
|
|
| BLAKE2b-256 |
ad3f8e9665daeb793535c93922501fb45e2eba053f99b1a36b963dd78028f5d5
|