Skip to main content

goldilocks-ml

Build Status Docs status License

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.

📖 Documentation

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
CGCNN metallicity classifier metal or insulator ba06w-n6a68
CGCNN representation 64 numbers describing a crystal m742g-g0k14

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.

The real scientific models need the optional dependency set:

uv sync --extra models

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 --extra models
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run mkdocs build --strict
uv build

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.

Release files for goldilocks-ml 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for goldilocks-ml 0.1.0
File Size Uploaded
goldilocks_ml-0.1.0.tar.gz 386.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for goldilocks-ml 0.1.0
File Interpreter ABI Platform
goldilocks_ml-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 482.2 kB

Release files / goldilocks_ml-0.1.0.tar.gz

Download URL goldilocks_ml-0.1.0.tar.gz
Size 386.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e7a06ef415fcdc295bd4a39940f5d52be93df14ad0d77752b78b098e6c2cfc05
BLAKE2b-256 checksum
How to use checksums
82f78e41cfd2c33e7ba4251a60c5a286b3b05cdd5c21fda95a07dd392965c433
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","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.1.0-py3-none-any.whl

Download URL goldilocks_ml-0.1.0-py3-none-any.whl
Size 96.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
377a93bf99558336958a36c4195be87c3252b6d5c789f6f1bafb7b2f3871b636
BLAKE2b-256 checksum
How to use checksums
287f5f3fecbb8fe681df7b0f0c3c119b465558edb0fb54ff6c03fb7097cd49d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.10 {"installer":{"name":"uv","version":"0.12.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page