Skip to content

Commit fd82d25

Browse files
committed
Addresses review comments
1 parent cd49e9b commit fd82d25

File tree

3 files changed

+35
-9
lines changed

3 files changed

+35
-9
lines changed

CHANGELOG.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@
99
* `RAW_TEXT` and `TEXT_FILE` attachment types to replace the `TEXT` type.
1010

1111
# Version 3.25.3 (2022-08-10)
12+
13+
### Added
14+
* `ModelRun.update_config()`
15+
* Updates model run training metadata
16+
* `ModelRun.reset_config()`
17+
* Resets model run training metadata
18+
* `ModelRun.get_config()`
19+
* Fetches model run training metadata
20+
21+
### Changed
22+
* `Model.create_model_run()`
23+
* Add training metadata config as a model run creation param
24+
1225
## Fixed
1326
* Label export will continue polling if the downloadUrl is None
1427

@@ -663,7 +676,3 @@ a `Label`. Default value is 0.0.
663676

664677
## Version 2.2 (2019-10-18)
665678
Changelog not maintained before version 2.2.
666-
667-
### Changed
668-
* `Model.create_model_run()`
669-
* Add training metadata config as a model run creation param

labelbox/schema/model_run.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,14 @@ def update_status(self,
263263
experimental=True)
264264

265265
@experimental
266-
def update_config(self, config: Dict[str, Any]):
266+
def update_config(self, config: Dict[str, Any]) -> Dict[str, Any]:
267+
"""
268+
Updates the model run's training metadata config
269+
Args:
270+
config (dict): A dictionary of keys and values
271+
Returns:
272+
model run id and updated training metadata
273+
"""
267274
data: Dict[str, Any] = {'config': config}
268275
res = self.client.execute(
269276
"""mutation updateModelRunConfigPyApi($modelRunId: ID!, $data: UpdateModelRunConfigInput!){
@@ -277,7 +284,12 @@ def update_config(self, config: Dict[str, Any]):
277284
return res["updateModelRunConfig"]
278285

279286
@experimental
280-
def reset_config(self):
287+
def reset_config(self) -> Dict[str, Any]:
288+
"""
289+
Resets model run's training metadata config
290+
Returns:
291+
Model run id and reset training metadata
292+
"""
281293
res = self.client.execute(
282294
"""mutation resetModelRunConfigPyApi($modelRunId: ID!){
283295
resetModelRunConfig(modelRun: {id : $modelRunId}){trainingMetadata}
@@ -287,7 +299,12 @@ def reset_config(self):
287299
return res["resetModelRunConfig"]
288300

289301
@experimental
290-
def fetch_config(self):
302+
def get_config(self) -> Dict[str, Any]:
303+
"""
304+
Gets model run's training metadata
305+
Returns:
306+
training metadata as a dictionary
307+
"""
291308
res = self.client.execute("""query ModelRunPyApi($modelRunId: ID!){
292309
modelRun(where: {id : $modelRunId}){trainingMetadata}
293310
}

tests/integration/annotation_import/test_model_run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ def test_model_run_reset_config(model_run_with_training_metadata):
6767
assert res["trainingMetadata"] is None
6868

6969

70-
def test_model_run_fetch_config(model_run_with_training_metadata):
70+
def test_model_run_get_config(model_run_with_training_metadata):
7171
new_config = {"batch_size": 2000}
7272
model_run_with_training_metadata.update_config(new_config)
73-
res = model_run_with_training_metadata.fetch_config()
73+
res = model_run_with_training_metadata.get_config()
7474
assert res["trainingMetadata"]["batchSize"] == new_config["batch_size"]
7575

7676

0 commit comments

Comments
 (0)