dolphin-utils
A collection of utilities for AI/ML model analysis and processing.
dolphin-summarize
This tool analyzes safetensors model files to generate a condensed summary of the model's architecture. It groups similar parameter names using range notation (e.g., model.layers.[0-39].mlp.down_proj.weight) and displays the shape and data type (precision) for each parameter group.
Key Features:
- Remote Processing: Analyze Hugging Face models without downloading the full model files (downloads only headers - KB instead of GB)
- Local Processing: Works with locally stored model directories
- Efficient: Uses HTTP range requests and streaming to minimize data transfer
- Reliable: Multiple fallback strategies ensure 100% compatibility
Dependencies
- Python 3.7+
huggingface_hub- For accessing Hugging Face repositoriesrequests- For HTTP requests and remote file accesssafetensors- For reading safetensors file headers
All dependencies are automatically installed when you install the package:
pip install dolphin-utils
Usage
After installing the package:
pip install dolphin-utils
You can use the tool in two ways:
Via CLI command:
dolphin-summarize [MODEL_PATH_OR_REPO_ID] [OPTIONS]
Via Python module:
python -m dolphin_summarize [MODEL_PATH_OR_REPO_ID] [OPTIONS]
Arguments:
MODEL_PATH_OR_REPO_ID:- Local path: Directory containing safetensors files (e.g.,
~/models/my_llama_model) - Hugging Face repo ID: Repository identifier (e.g.,
microsoft/DialoGPT-medium) - Defaults to current directory (
.) if not provided
- Local path: Directory containing safetensors files (e.g.,
Options:
--output OUTPUT,-o OUTPUT: Path to an output file where the summary will be written (optional).--verbose,-v: Show verbose output during processing (optional).
Examples
Remote Processing (Hugging Face Hub):
# Process a model directly from Hugging Face without downloading
python -m dolphin_summarize microsoft/DialoGPT-medium --verbose
# Large models work too - only headers are downloaded
python -m dolphin_summarize meta-llama/Llama-2-70b-hf --verbose
Local Processing:
# Process a local model directory
python -m dolphin_summarize ~/models/my_llama_model --verbose
# Process current directory
python -m dolphin_summarize . --verbose
Output Format
The script prints the summary to the console (and optionally to a file). Each line represents a parameter or a group of parameters with a similar structure:
parameter_name,[shape],dtype
Example Output Lines:
lm_head.weight,[131072,5120],BF16
model.embed_tokens.weight,[131072,5120],BF16
model.layers.[0-39].input_layernorm.weight,[5120],BF16
model.layers.[0-39].mlp.down_proj.weight,[5120,13824],BF16
model.layers.[0-39].mlp.gate_proj.weight,[13824,5120],BF16
model.layers.[0-39].mlp.up_proj.weight,[13824,5120],BF16
model.layers.[0-39].post_attention_layernorm.weight,[5120],BF16
model.layers.[0-39].self_attn.k_proj.weight,[512,5120],BF16
model.layers.[0-39].self_attn.o_proj.weight,[5120,8192],BF16
model.layers.[0-39].self_attn.q_proj.weight,[8192,5120],BF16
model.layers.[0-39].self_attn.v_proj.weight,[512,5120],BF16
model.norm.weight,[5120],BF16
Metadata
Release files for dolphin-utils 0.4.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dolphin_utils-0.4.5.tar.gz | 10.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dolphin_utils-0.4.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.9 kB
Release files / dolphin_utils-0.4.5.tar.gz
| Download URL | dolphin_utils-0.4.5.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3415b0dd9e1d7cf94b81b0984d7e0fe3a7910a55aa92e0875f05cc63d27008ed
|
|
BLAKE2b-256 checksum How to use checksums |
70f043d9475a318fb0bf90a223b443169f60092a506dc85d367099fc77c072ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / dolphin_utils-0.4.5-py3-none-any.whl
| Download URL | dolphin_utils-0.4.5-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5920361ea74dbc0ef2c4ce389399621d06c88be67d08497ae8cba627e091ff22
|
|
BLAKE2b-256 checksum How to use checksums |
42788f74fe3f76997caaca9bcf76f1e171e8a3137d9bd41184681f617d05b030
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|