コード例 #1
0
def test_load_config_default():
    test_path = "config-defaults.yaml"
    yaml_dict = {"epochs": {"value": 32}, "size_batch": {"value": 32}}
    with open(test_path, "w") as f:
        yaml.dump(yaml_dict, f, default_flow_style=False)
    config = wandb_sdk.Config()
    assert dict(config) == dict(epochs=32, size_batch=32)
コード例 #2
0
def test_load_config_default():
    test_path = "config-defaults.yaml"
    yaml_dict = {"epochs": {"value": 32}, "size_batch": {"value": 32}}
    with open(test_path, "w") as f:
        yaml.dump(yaml_dict, f, default_flow_style=False)
    s = wandb_sdk.Config()
    expected = sorted([("epochs", 32), ("size_batch", 32)], key=lambda x: x[0])
    actual = sorted(s.items(), key=lambda x: x[0])
    assert actual == expected
コード例 #3
0
ファイル: wandb_config_test.py プロジェクト: ayulockin/client
def test_load_empty_config_default(runner, capsys):
    test_path = "config-defaults.yaml"
    with runner.isolated_filesystem():
        with open(test_path, "w") as f:
            pass
        _ = wandb_sdk.Config()
        err_log = capsys.readouterr().err
        warn_msg = "wandb: WARNING Found an empty default config file (config-defaults.yaml). Proceeding with no defaults."
        print(err_log)
        assert warn_msg in err_log
コード例 #4
0
def config(callback):
    s = wandb_sdk.Config()
    s._set_callback(callback)
    return s
コード例 #5
0
def test_locked_update():
    s = wandb_sdk.Config()
    s.update_locked(dict(this=2, that=4), "sweep")
    s.update(dict(this=8))
    assert s.this == 2
    assert s.that == 4
コード例 #6
0
def test_attrib_get():
    s = wandb_sdk.Config()
    s._set_callback(callback_func)
    s.this = 2
    assert s.this == 2