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
otat-0.1.1.tar.gz
(22.3 kB
view details)
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
otat-0.1.1-py3-none-any.whl
(33.7 kB
view details)
File details
Details for the file otat-0.1.1.tar.gz.
File metadata
- Download URL: otat-0.1.1.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e09016ae0c68f460b4cde53979642a7114de0ef9418c8d0a523d8b1bfdebc7c9
|
|
| MD5 |
a4e78593ae3641a29bf8ea25b7cf2047
|
|
| BLAKE2b-256 |
c1881a073276605f37f0dcf5ea8fb85824dcd95aff2f1b3b215e00fdeb91bcca
|
File details
Details for the file otat-0.1.1-py3-none-any.whl.
File metadata
- Download URL: otat-0.1.1-py3-none-any.whl
- Upload date:
- Size: 33.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2df3c895a2567a49cce2483afbe6a1f5b3c6bb15bf9b7520caef4e5ff9c05f97
|
|
| MD5 |
3d21c30f3e10791e215678ccd5610a22
|
|
| BLAKE2b-256 |
b4450b426a9ea7a8b17cb864c66aeefe01994c5152089c7d0fed4bf689fe2a34
|