Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 1.3 KB

File metadata and controls

41 lines (31 loc) · 1.3 KB

Frequency example with Hydra

This example implements a task that counts the frequency of objects in a list. The runtime can be measured with timeit and the memory usage with memray. The implementation is similar to other examples. The main difference is the use of hydra-zen so no YAML configuration or command line arguments are needed.

Installation

  • install conda
mamba env update -f src/frequencies_hydra/env.yaml
conda activate frequencies_hydra
pip install -e src/frequencies_hydra
  • Select this conda environment in VS Code to use it for development

Usage

You can run a multirun by executing the launch.py script:

python src/frequencies_hydra/src/frequencies_hydra/launch.py

The output will be stored in the multirun folder. Also a plot is created in the resources folder: plot

Like in other Hydra examples, you can also access a CLI by running the main.py script:

ml swap cluster/donphan
# launch interactive session
srun --pty bash
conda activate frequencies_hydra
# execute Hydra like normal
python src/frequencies_hydra/src/frequencies_hydra/main.py --help

You can also run jobs:

ACTIVATE=src/frequencies_hydra SCRIPT='python src/frequencies_hydra/src/frequencies_hydra/main.py --help' srun --pty runner.pbs