Model Run Config

Import Labelbox library

import labelbox as lb

Set up Labelbox client

# To get your API key go to: Workspace settings -> API -> Create API Key
API_KEY = ""
client = lb.Client(api_key=API_KEY, enable_experimental=True)

Create the model run with the config

example_config = {
    "learning_rate": 0.001, 
    "checkpoint_path": "/path/to/checkpoint/file",
    "early_stopping": False,
    "batch_size": 32, 
    "optimizer": { 
      "adam": {
        "beta1": 0.899999976158,
        "beta2": 0.999000012875,
        "epsilon": 9.99999993923e-9
      }
    }, 
    "ngpu": 1, 
    }

model = client.get_model("<MODEL_ID>")
# create a model with the config 
model_run = model.create_model_run(name="run 1", config=example_config)

# alternatively, create a model run first and update the model config field.
model_run = model.create_model_run(name="run 2")
model_run.update_config(example_config)

Get model run config

model_run_parameters = model_run.get_config()

Update the model run config

The update will replace the previous model run config with the new JSON input.

model_run = client.get_model_run("<MODEL_RUN_ID>")
model_run.update_config({"batch_size": 16})

Delete the model run config

model_run.reset_config()