update_meta()

audmodel.update_meta(uid, meta, *, replace=False, cache_root=None, verbose=False)[source]

Update metadata of model on backend and in cache.

Unless replace is set to True iterates through current meta dictionary and updates fields where they match or adds missing fields, but keeps all existing fields.

Parameters
  • uid (str) – unique model ID or short ID for latest version

  • meta (dict[str, object]) – dictionary with meta information

  • replace (bool) – replace existing dictionary

  • cache_root (Optional[str]) – cache folder where models and headers are stored. If not set audmodel.default_cache_root() is used

  • verbose (bool) – show debug messages

Return type

dict[str, object]

Returns

new meta dictionary

Raises

Examples

>>> meta = {
...     "model": {
...         "cnn10": {"layers": 10},
...     },
... }
>>> d = update_meta("d4e9c65b-3.0.0", meta)
>>> print(yaml.dump(d))
data:
  emodb:
    version: 1.2.0
feature:
  melspec:
    win_dur: 32ms
    hop_dur: 10ms
    num_fft: 512
    mel_bins: 64
model:
  cnn10:
    learning-rate: 0.01
    optimizer: adam
    layers: 10

>>> d = update_meta("d4e9c65b-3.0.0", meta, replace=True)
>>> print(yaml.dump(d))
model:
  cnn10:
    layers: 10