Brando's Ultimate Utils for Science, Machine Learning, and AI
Project description
ultimate-utils (uutils)
A comprehensive Python utility library for machine learning research, spanning PyTorch training infrastructure, statistical analysis, meta-learning, LLM evaluation, and experiment management.
Built and maintained by Brando Miranda (Stanford, MIT, UIUC).
pip install ultimate-utils
import uutils
uutils.hello()
What's Inside
| Module | Description |
|---|---|
uutils |
Core utilities — file I/O, argument parsing, serialization (dill/pickle/JSON), git helpers, seed management, progress bars |
uutils.torch_uu |
PyTorch training loops, distributed training, checkpointing, optimizers, learning rate schedulers |
uutils.torch_uu.models |
Model utilities and HuggingFace integrations |
uutils.torch_uu.dataloaders |
Dataloaders for meta-learning (miniImageNet, CIFAR-FS), standard vision, and multi-dataset sampling |
uutils.torch_uu.metrics |
CCA/PWCCA/DCCA similarity, model complexity, task diversity (Task2Vec), accuracy with confidence intervals |
uutils.torch_uu.meta_learners |
Meta-learning algorithms (MAML, Prototypical Networks, etc.) |
uutils.stats_uu |
Hypothesis testing, p-values, effect sizes (Cohen's d), power analysis, confidence intervals, ANOVA, regression |
uutils.plot |
Plotting with error bands, heatmaps, bar charts, LaTeX table export |
uutils.hf_uu |
HuggingFace training utilities — full fine-tuning, QLoRA/Unsloth, causal and seq2seq LM training |
uutils.evals |
LLM evaluation — math benchmarks (MATH, Putnam, OlympiadBench), API inference (Claude, OpenAI, vLLM), answer extraction |
uutils.dspy_uu |
DSPy-based synthetic data generation for in-context learning and fine-tuning |
uutils.jax_uu |
JAX multi-head attention, layer norm, flash attention implementations |
uutils.numpy_uu |
Statistical moments, confidence intervals, matrix utilities |
uutils.logging_uu |
Weights & Biases integration — setup, logging, sweeps, model watching |
uutils.emailing |
SMTP email notifications with attachments |
Installation
Note: PyTorch must be installed separately (with CUDA if you need GPU support).
Development install (recommended)
conda create -n uutils python=3.11 -y
conda activate uutils
pip install -e ~/ultimate-utils
pip install from PyPI
pip install ultimate-utils
Verify installation
python -c "import uutils; uutils.hello()"
python -c "import uutils; uutils.torch_uu.gpu_test_torch_any_device()"
Quick Examples
Seed everything for reproducibility
from uutils import seed_everything
seed_everything(42)
Save and load with dill
from uutils import save_with_dill, load_with_dill
save_with_dill(my_object, '~/data/my_object.pkl')
obj = load_with_dill('~/data/my_object.pkl')
Plot with error bands
from uutils.plot import plot_with_error_bands
plot_with_error_bands(x, y, yerr, xlabel='Steps', ylabel='Loss', title='Training Loss')
Statistical testing with effect size
from uutils.stats_uu.effect_size import stat_test_with_effect_size_as_emphasis
stat_test_with_effect_size_as_emphasis(group1_data, group2_data)
W&B logging
from uutils.logging_uu.wandb_logging.common import setup_wandb, log_2_wandb
setup_wandb(args)
log_2_wandb(metrics_dict, step=step)
Publishing to PyPI
# Bump version in setup.py, then:
cd ~/ultimate-utils && bash scripts/publish_to_pypi.sh
Citation
If you use ultimate-utils in your research, please cite:
@software{miranda2024uutils,
author = {Brando Miranda},
title = {ultimate-utils: A Comprehensive Utility Library for Machine Learning Research},
year = {2024},
publisher = {PyPI},
url = {https://github.com/brando90/ultimate-utils},
note = {Available at \url{https://pypi.org/project/ultimate-utils/}}
}
You can also find the author's publications on Google Scholar.
Related Publications
This library has supported research in the following publications (among others):
- Beyond Scale: the Diversity Coefficient as a Data Quality Metric Demonstrates LLMs are Not Yet More Human than Human
- Does MAML Only Work via Feature Re-use? A Data Set Centric Perspective
License
Apache-2.0
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 ultimate_utils-0.10.6.tar.gz.
File metadata
- Download URL: ultimate_utils-0.10.6.tar.gz
- Upload date:
- Size: 676.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6dab1bd115f69a7b7d5f6867e0b3dcc6701c34a85e222cb37c3ded8ad88c52b4
|
|
| MD5 |
5532fe49e89000e57af65d74e2f65342
|
|
| BLAKE2b-256 |
ecb8004c5fe4b76a4a05d9c846c6e8403be058b3b41557f94b3bc745a0da7277
|
File details
Details for the file ultimate_utils-0.10.6-py3-none-any.whl.
File metadata
- Download URL: ultimate_utils-0.10.6-py3-none-any.whl
- Upload date:
- Size: 616.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c323e7a7da485e894c535aaaa974e76c3088f844eb3d31b21190c1507d477d28
|
|
| MD5 |
e94be641bd5b512d265677dd78801404
|
|
| BLAKE2b-256 |
c0505dcdf48fc6b717b8a0826c8da8f1bf37a22bfc2bff2b6bd0838ad2ddbc80
|