Skip to main content

Hyperparameter sweeps on slurm

Project description

slurm_sweep: hyperparameter sweeps with W&B on SLURM clusters

Tests Coverage Pre-commit.ci PyPI Downloads

slurm_sweep is the missing (small) piece to efficiently run hyperparameter sweeps on SLURM clusters by combining the power of weights and biases (W&B) and simple_slurm. It allows you to efficiently parallelize sweeps with job arrays, while tracking experiments and results on W&B. All you need is:

  • W&B account.
  • config.yaml file that defines your sweep.
  • train.py script, that specifies the actual training and evaluation.

Getting started

Create an account on W&B and take a look at our examples in the examples folder. These contain both config.yaml and train.py scripts.

The config file

You need config file in yaml format. This file should have three sections:

  • general: you need to define at least the project_name and the entity for the sweep on wandB.
  • slurm: any valid slurm option. Depends on your cluster, see the simple_slurm docs.
  • wandb: standard W&B config for a hyperparameter sweep.

The training script

This needs to be a python script that defines the training and evaluation logic. It should call wandb.init() and retrieve parameters from wandb.config. It can log values using wandb.log. See the W&B docs.

Submission

Once you're ready, you can test your config file using slurm-sweep validate-config config.yaml. If this passes, create a submission script using slurm-sweep configure-sweep config.yaml, and submit with sbatch submit.sh.

Installation

You need to have Python 3.11 or newer installed on your system. If you don't have Python installed, we recommend installing uv.

There are two alternative options to install slurm_sweep:

  • Install the latest release from PyPI:

    pip install slurm_sweep
    
  • Install the latest development version:

    pip install git+https://github.com/quadbio/slurm_sweep.git@main
    

Release notes

See the changelog.

Contact

If you found a bug, please use the issue tracker.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slurm_sweep-0.2.1.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slurm_sweep-0.2.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file slurm_sweep-0.2.1.tar.gz.

File metadata

  • Download URL: slurm_sweep-0.2.1.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for slurm_sweep-0.2.1.tar.gz
Algorithm Hash digest
SHA256 2dc60539dd38a1d5d8e4ae9c70248be9c6a7d3ac718e1982a79745085828b0ab
MD5 210fe338e7157365bf30ef22bb4d5610
BLAKE2b-256 bb611d98818f28f3a06d1769fd6d8f59592814defad4ad5a57a81b54e671fe2f

See more details on using hashes here.

Provenance

The following attestation bundles were made for slurm_sweep-0.2.1.tar.gz:

Publisher: release.yaml on quadbio/slurm_sweep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file slurm_sweep-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: slurm_sweep-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for slurm_sweep-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 16c4427d9f665a67d8a962e813e0f1c7f503b45d192a301e3ae02ff06f62b2ef
MD5 ad175c75905d73a86a8cdd6bba448a33
BLAKE2b-256 eec10f355bc94f063a345340a28f4df00809f25f9ab96b31a31019cafa2fd47b

See more details on using hashes here.

Provenance

The following attestation bundles were made for slurm_sweep-0.2.1-py3-none-any.whl:

Publisher: release.yaml on quadbio/slurm_sweep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page