goldilocks-ml
Train and publish the models that choose DFT settings for you.
Setting up a DFT calculation means guessing things that are hard to guess: how dense the k-point mesh needs to be, whether the material is a metal and needs smearing. Goldilocks answers those from models trained on past calculations. This package is where those models are trained, evaluated and published.
Want the answers rather than the models? Goldilocks Core takes a structure and writes your input files.
Installation
pip install goldilocks-ml
That installs everything, including PyTorch, pymatgen, mace and the rest of the scientific stack the real models need -- there's no separate extra to remember.
Use a published model
from goldilocks_ml.inference import load_model
model = load_model("path/to/a/psdi/record")
prediction = model.predict(structure)
prediction.value # e.g. 0.2134
prediction.quantity # 'k_distance'
| Model | What it gives you | PSDI record |
|---|---|---|
| QRF95 | how dense a k-point mesh needs to be | q3bye-wep37 |
| k-index forest | which mesh on the ladder a crystal needs | 4050a-aas85 |
| CGCNN metallicity classifier | metal or insulator | ba06w-n6a68 |
| CGCNN representation | 64 numbers describing a crystal | m742g-g0k14 |
| is_magnetic | whether a structure's DFT ground state is spin-polarised | sgk1t-48m42 |
The CGCNN representation record is a feature extractor for QRF95's own feature
pipeline, not something you call load_model(...).predict(...) on directly --
load_model refuses it with a clear error naming what it's for instead. See
its own docs
page.
Use the is_magnetic classifier
is_magnetic reads the embedding of a frozen mMACE backbone that ships in the
same record. Pass the backbone file when you load it:
model = load_model(
"path/to/sgk1t-48m42",
artifacts={
"mace_backbone": "path/to/sgk1t-48m42/mmace-matpes-pbe-pretrained.model"
},
)
Train one
A training job is one TOML file, not a notebook. This runs offline in a clean checkout:
uv sync
uv run goldilocks-ml train run protocols/synthetic/regression.toml \
--dataset tests/fixtures/kdist --output local_runs/first
You get one folder holding the predictions, the split, the scores against a baseline, the environment, and a SHA-256 for every file involved.
See Train a model.
Publish one
uv run goldilocks-ml publish validate deposits/k_points/k_distance/qrf \
--artifact-directory local_data/models/k_points/k_distance/qrf
Everything is checked locally first, and nothing is ever submitted for review without you doing it yourself. See Publish a model.
Development
uv sync --group dev --group docs
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run mkdocs build --strict
uv build
--group docs is what actually installs mkdocs/mkdocs-material -- CI runs
lint/tests and the docs build as two separate jobs with their own uv sync
(.github/workflows/ci.yml and docs.yml), so leaving it out here previously
worked in CI but failed the moment someone ran this exact sequence locally.
The lint and format checks cover the whole tree, including Python inside
fenced blocks in the documentation. Narrowing them to src tests passes
locally and fails in CI.
The GitHub Pages workflow builds documentation on every pull request and
deploys it after changes reach main. A repository administrator must select
GitHub Actions as the Pages source once before the first deployment.
Licence
This package is released under the BSD 3-Clause Licence, matching Goldilocks Core.
Published models are a separate matter. Trained weights and the datasets behind them are released through PSDI under CC BY 4.0, which is stated in each deposit's record rather than here — a licence for code and a licence for data answer different questions.
Two modules under src/goldilocks_ml/models/ are adapted from
stfc/goldilocks_kpoints, which is CC BY 4.0, and carry attribution in their
headers. CC BY 4.0 permits adapted material under other terms provided
attribution is kept, so they are redistributed under the licence above.
Metadata
Release files for goldilocks-ml 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| goldilocks_ml-0.3.1.tar.gz | 1.8 MB | Without provenance | Details for goldilocks_ml-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| goldilocks_ml-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for goldilocks_ml-0.3.1-py3-none-any.whl |
Total release size: 1.9 MB
Release files / goldilocks_ml-0.3.1.tar.gz
| Download URL | goldilocks_ml-0.3.1.tar.gz |
|---|---|
| Size | 1.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f2c6fb7cfcb919bc7c8323a59e39813877cc7e1228bc947dd64680775cb1e1de
|
|
BLAKE2b-256 checksum How to use checksums |
f20bc5487ddfe8b823671ef28c6292a5766e87dc4af8b3be728c0d5ee3da41bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / goldilocks_ml-0.3.1-py3-none-any.whl
| Download URL | goldilocks_ml-0.3.1-py3-none-any.whl |
|---|---|
| Size | 136.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
70b4d9bc73a5829d1c915b8e3a003e0a2eccee87579f79deea1f3d34253d4a80
|
|
BLAKE2b-256 checksum How to use checksums |
92fc17649f0fde9510c2fd048863b9899fc3ede63f71773fcf5f487e8f1eb9bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for goldilocks-ml 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.