skillfed

ml-collections

ML Collections is a library of Python collections designed for ML usecases.

ml-collections v1.1.0 2.2M downloads/30d#3,218 on PyPI1,039
Permissive license Active released

What it is and what it does

ML Collections provides ConfigDict and FrozenConfigDict—specialized dictionary classes designed for ML workflows. ConfigDict lets you access nested configuration values using dot notation (cfg.learning_rate) instead of bracket syntax, with built-in type checking to catch spelling mistakes and type mismatches. FrozenConfigDict is an immutable, hashable variant useful for passing configs as function arguments or storing them in sets. Both support lazy evaluation through FieldReferences, allowing one field to depend on another and recompute automatically when the source changes.

The library depends on absl-py and PyYAML to handle logging and YAML serialization. It's widely used in ML research and production to centralize experiment hyperparameters, model settings, and training configurations in a single, strongly-typed object that's easier to reason about than plain dictionaries.

Use it for:

  • Store and manage experiment hyperparameters with type safety to prevent configuration errors.
  • Create immutable, hashable configuration snapshots for reproducible ML experiments using FrozenConfigDict.
  • Define dependent configuration fields using lazy evaluation so changing a base value automatically updates derived values.
  • Serialize and deserialize experiment configs to YAML for easy version control and sharing across teams.
  • Prevent typos in nested config access by using dot notation with locking to catch misspelled field names early.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides dict-like configuration data structures with dot-notation access, type safety, and lazy evaluation for ML experiment and model configuration.

Yes. ML Collections fills a genuine gap in Python ML tooling by providing type-safe, dot-accessible configuration objects with lazy evaluation. Low install friction, active maintenance, permissive license, and no known vulnerabilities make it a straightforward choice for any ML project that needs structured configuration management beyond plain dicts.

Install

ml-collections on PyPI

pip

pip install ml-collections

uv

uv add ml-collections

poetry

poetry add ml-collections

Installing ml-collections

Before you install

Low friction install with only two lightweight runtime dependencies (absl-py and PyYAML). Active maintenance with recent releases; last commit 2026-07-07 and latest release 2025-04-17 indicate ongoing support.

License in practice

Permissive license (Apache Software License per OSI approval) means you can use, modify, and distribute this package with minimal legal restrictions.

Quickstart

pip install ml-collections

from ml_collections import config_dict

cfg = config_dict.ConfigDict()
cfg.learning_rate = 12.6
cfg.nested = config_dict.ConfigDict()
cfg.nested.string_field = 'tom'
print(cfg.learning_rate)

Requires Python 3.10 or later.

Verify before relying

  • Performance characteristics when working with deeply nested or very large ConfigDict structures.
  • Compatibility with popular ML frameworks (PyTorch, TensorFlow, JAX) beyond basic configuration storage.

Package facts

License not declared (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 2 — absl-py, PyYAML
Maintenance actively maintained — 484 days since the last release
Last repo commit
First released
Downloads 2,197,822/month — #3,218 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ml_collections-1.1.0-py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonTopic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules

Tags

configuration management pythondict with dot notation accesstyped config dictionariesml experiment configurationlazy evaluation configimmutable frozen confignested configuration objects
ml-configexperiment-managementtype-safe-dicts

More Libraries packages