Skip to main content

Tuning Client Python SDK and demo

Tuning Client is the Python SDK and demo for the hyperopt.dev AutoML service.

Use the Python SDK to request tuning suggestions while keeping model training, datasets, and model weights on your computer. The optional demo trains small PyTorch models and compares tuning strategies on classification, regression, and teaching datasets.

Code provenance: The SDK and demo code were generated with ChatGPT and reviewed. Review does not guarantee correctness; evaluate the code and benchmark results for your use case. The demos are examples, not production ML benchmarks.

Installation

Requires Python 3.11 or newer. Install the SDK alone or include the demo:

python -m pip install tuning-client
python -m pip install 'tuning-client[demo]'

Run the demo

Create an account using the service's signup page and verify your email. Replace https://YOUR_API below with the service URL provided to you:

python -m tuning_demo --api-url https://YOUR_API --email you@example.com --dataset digits
# The installed command is equivalent:
tuning-client-demo --api-url https://YOUR_API --email you@example.com --dataset iris
python -m tuning_demo --list-datasets

The demo prompts for your password. You can instead set COMPUTE_ACCESS_TOKEN, or COMPUTE_EMAIL and COMPUTE_PASSWORD. Set COMPUTE_API_URL to avoid passing --api-url each time. Connections use HTTPS and verified TLS.

Service effort defaults to medium. Use --effort easy for lower effort; the observation budget stays the same. --interactive offers another dataset after each run. Sessions created by the demo are released automatically on completion or failure. --session-id ID uses an existing unused session that you remain responsible for releasing; --keep-session retains a new session.

Results are saved in ./results/. Downloaded datasets are cached in ~/.cache/tuning-client/. Override these with --output-dir and --data-dir. Optional usage events include a run ID, session ID, workload category, and progress event; use --no-telemetry to disable them. Training data, file paths, and model weights are not included in those events.

SDK usage

import os
from tuning_client import TuningClient

with TuningClient(os.environ['COMPUTE_API_URL'],
                   access_token=os.environ['COMPUTE_ACCESS_TOKEN']) as api:
    session_id = api.create_session()
    try:
        stream = api.tuning_session(session_id)
        try:
            configurations = [{'learning_rate': rate} for rate in
                              [0.001, 0.002, 0.003, 0.004, 0.005,
                               0.006, 0.007, 0.008, 0.009, 0.010]]
            stream.initialize(configurations, max_steps=10, seed=42)
            suggestion = stream.suggest()
            # Train the suggested configuration locally, then report validation loss:
            # stream.report(suggestion['idx'], validation_loss)
            # Continue with suggest/report or report_and_suggest as needed.
        finally:
            stream.close()
    finally:
        api.terminate_session(session_id)

initialize and reset default to effort="medium". A report records one observation; max_steps limits observations per model, not optimizer updates. Use status() to inspect progress and rankings. reset(...) starts a fresh run after the previous run completes. api.list_sessions() lists your sessions; api.wait_for_termination(session_id) waits for a release to complete.

Datasets and training budgets

Each demo starts with ten sampled model configurations and allows up to 50 validation observations across them, with at most ten observations per model. After tuning, all models finish to the same update cap for comparison. Classification ranks use validation cross-entropy; regression ranks use MSE in original target units. Lower is better. Test data is used only for final reporting.

Dataset Updates per observation Maximum updates per model Source
iris 10 100 scikit-learn
wine 200 2,000 scikit-learn
breast-cancer 30 300 scikit-learn
digits 60 600 scikit-learn
glass 100 1,000 OpenML dataset 41
vehicle 60 600 OpenML dataset 54
diabetes 10 100 scikit-learn
friedman 200 2,000 Generated regression data
linear-regression 200 2,000 Generated regression data
toy-lm 30 300 Generated language teaching task
toy-vla 200 2,000 Generated vision/language teaching task

Glass and vehicle download on first use. Ordinary datasets use a 70/15/15 train/validation/test split; wine uses 55/30/15. Identical language contexts are grouped into one split. Preprocessing is fitted on training data only.

--block-steps N sets updates per observation and a maximum of 10*N updates. The defaults are bounded workload profiles, not guarantees of convergence. Version 2 uses loss-based classification ranks; these are not comparable with version 1 accuracy-error ranks. --seed sets all seeds; --config-seed, --split-seed, and --training-seed allow independent overrides.

Repeated benchmarks

python -m tuning_demo.stats --api-url https://YOUR_API --email you@example.com \
  --datasets iris wine --runs 2

Without dataset/run options, this runs all eleven datasets ten times, starting at seed 42. Each trial starts with fresh models and tuning state. Sessions are reused per dataset; --session-scope run reuses one session across datasets. Service benchmarks run sequentially.

Local reference schedulers need no service account:

python -m tuning_demo --scheduler asha --dataset digits
python -m tuning_demo.stats --scheduler flaml --datasets iris wine --runs 2 --workers 2

Available schedulers are service (default), asha, median, pbt, pb2, and flaml. --workers applies only to local reference schedulers; it cannot parallelize service benchmarks. Reference statistics default to available CPU cores, capped by trial count; use --workers 1 to limit resource use. See benchmark details for algorithm settings.

Results include configurations, seeds, observation histories, timings, losses, and rankings at the tuning cutoff and after final training. Statistics report the mean final rank of the model selected at the cutoff and the best final rank among models already capped at that cutoff. Ties receive ranks such as 1, 1, 3; unavailable measurements and failed trials do not count as zero. A failed service trial skips the remaining trials for that dataset. The command exits nonzero on trial or cleanup failure and preserves partial results.

Timing includes client training and service round trips; it is not a pure measurement of service compute. The service ranking uses latest reported losses, not predicted fully trained losses. PBT/PB2 compare evolved checkpoint lineages, not the original fixed configurations.

Custom datasets

python -m pip install 'tuning-client[demo,custom]'
python -m tuning_demo --api-url https://YOUR_API --custom-data ./data.csv \
  --target label --task classification --drop-columns id
python -m tuning_demo --api-url https://YOUR_API --custom-data ./data.parquet \
  --target price --task regression

Use one row per independent example, unique column names, a non-missing scalar target, and numeric or categorical input columns. Drop identifiers and columns that leak the target. Custom datasets default to 100 updates per observation. Files stay local. Use an appropriate split outside this demo for time series, grouped observations, or other data that requires special leakage controls.

License and third-party notices

Original SDK and demo code is licensed under the MIT License.

The benchmark implementations include adaptations of Ray Tune (Apache-2.0) and FLAML (MIT). Their license texts and attribution are included in the package; see third-party notices.

Metadata

Release files for tuning-client 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 tuning-client 0.1.0
File Size Uploaded Provenance
tuning_client-0.1.0.tar.gz 49.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for tuning-client 0.1.0
File Interpreter ABI Platform
tuning_client-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 116.1 kB

Release files / tuning_client-0.1.0.tar.gz

Download URL tuning_client-0.1.0.tar.gz
Size 49.8 kB
Tags Source
SHA-256 checksum
How to use checksums
a18a169cf90690d4e5812bef400b0a442ecafc2cfdeefdd246b29242b9237d23
BLAKE2b-256 checksum
How to use checksums
9a5ba7773214dd13504930ddfb483f019932b3be9c3a6a2ec194c82778319886
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Release files / tuning_client-0.1.0-py3-none-any.whl

Download URL tuning_client-0.1.0-py3-none-any.whl
Size 66.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6dbe16d478ece53d616d1194050a4ec80ce6c306c834e60c621b2f41453e8539
BLAKE2b-256 checksum
How to use checksums
0aec22761577375ca08d033e648622968864765749b1f1097190948bcf39d79a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.15

Security for tuning-client 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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