Skip to content

Configuration can be used with MP

Latest
Compare
Choose a tag to compare
@vfdev-5 vfdev-5 released this 24 Mar 14:54
· 5 commits to master since this release

Configuration can be now used with multiprocessing:

import multiprocessing as mp


def worker_config_checker(config):
    import numpy as np

    assert "a" in config
    assert config.a == 123

    assert "b" in config
    np.testing.assert_allclose(config.b, np.array([1, 2, 3]))

    assert "out" in config
    assert config.out == 12

if __name__ == "__main__":
    config = ConfigObject(config_filepath)
    ctx = mp.get_context("spawn")
    p = ctx.Process(target=worker_config_checker, args=(config,))
    p.start()
    p.join()

Deep Learning DDP example with Ignite :