hai - Valohai toolbelt library

raw JSON →
0.4.1 verified Fri May 01 auth: no python

hai is a Python utility library developed by Valohai, providing helpers for parallel runs, logging, configuration, and other common infrastructure tasks in ML pipelines. Current version is 0.4.1, with occasional releases.

pip install hai
error ModuleNotFoundError: No module named 'hai'
cause Library not installed or installed in wrong environment.
fix
Run 'pip install hai'
error AttributeError: module 'hai' has no attribute 'ParallelRun'
cause Trying to import from old module path.
fix
Use 'from hai import ParallelRun' instead of 'from hai.parallel import ParallelRun'
breaking Python 3.6 support dropped in v0.3.0
fix Upgrade to Python >=3.7
gotcha ParallelRun context manager requires proper usage; forgetting to use it as context manager can lead to resource leaks.
fix Always use 'with ParallelRun() as pr:' pattern.

Run a simple parallel task using ParallelRun context manager.

from hai import ParallelRun

with ParallelRun() as pr:
    pr.run(lambda: print('Hello from parallel'))