publish()

audmodel.publish(root, name, params, version, *, author=None, date=None, meta=None, repository=Repository('models-local', 'https://artifactory.audeering.com/artifactory', 'artifactory'), subgroup=None, verbose=False)[source]

Zip model and publish as a new artifact.

Before publishing a model, pick meaningful values for name, subgroup, params. The following table explains what the arguments should encode and shows examples.

Encodes

Examples

name

  • package used to train/create the model

  • onnx

  • sklearn

  • torch

subgroup

  • project

  • task the model was trained for

  • model architecture

  • ser.dimensions.wav2vec2

  • age.cnn

params

  • model

  • data

  • feature set

  • sampling rate

  • { ‘model’: ‘facebook/wav2vec2-large’, ‘data’: ‘msppodcast’, ‘sampling_rate’: 16000 }

  • { ‘model’: ‘cnn10’, ‘data’: [‘agender’, ‘emodb’], ‘feature’: ‘log-melspec’, ‘sampling_rate’: 8000 }

The meta argument encodes additional information. In contrast to name, subgroup, params it can be changed later. It should be used to extend information of the params entries using the same keys. In addition, it can store example output, and benchmark results. For example, a meta entry corresponding to the first params example from the table might contain:

{
    'model': {'facebook/wav2vec2-large': {'layers': 24}},
    'data': {'msppodcast': {'version': '2.6.0'}},
}
Parameters
  • root (str) – folder with model files

  • name (str) – model name

  • params (dict[str, object]) – dictionary with parameters

  • version (str) – version string

  • author (Optional[str]) – author name(s), defaults to user name

  • date (Optional[date]) – date, defaults to current timestamp

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

  • repository (Repository) – repository where the model will be published

  • subgroup (Optional[str]) – subgroup under which the model is stored on backend. . are replaced by / on the backend

  • verbose (bool) – show debug messages

Return type

str

Returns

unique model ID

Raises

Examples

>>> # Assuming your model files are stored under `model_root`
>>> # and your repository is given by `repository`
>>> # (which you usually don't specify, but use its default value)
>>> import datetime
>>> name = "torch"
>>> subgroup = "audmodel.dummy.cnn"
>>> version = "4.0.0"
>>> author = "Calvin and Hobbes"
>>> data = datetime.date(1985, 11, 18)
>>> params = {
...     "model": "cnn10",
...     "data": "emodb",
...     "feature": "melspec",
...     "sampling_rate": 16000,
... }
>>> meta = {
...     "model": {
...         "cnn10": {
...             "learning-rate": 1e-4,
...             "optimizer": "sgd",
...         },
...     },
...     "data": {
...         "emodb": {
...             "version": "1.2.0",
...         },
...     },
...     "feature": {
...         "melspec": {
...             "win_dur": "32ms",
...             "hop_dur": "10ms",
...             "num_fft": 512,
...             "mel_bins": 64,
...         },
...     },
... }
>>> publish(
...     model_root,
...     name,
...     params,
...     version,
...     author=author,
...     date=date,
...     meta=meta,
...     subgroup=subgroup,
...     repository=repository,
... )
'd4e9c65b-4.0.0'