Importing external models from HuggingFace

You can get the HuggingFace model version identifier from HuggingFace.

To discover the model, see Hugging Face Models.

Import the selected model to CML Registry

curl -XPOST -H "Content-Type: application/json" -H "Authorization: Bearer ${CDP_TOKEN}" ${DOMAIN}/api/v2/models -d '{
    "name": "tiny",
    "createModelVersionRequestPayload": {
        "metadata": {
            "model_repo_type": "HF"
        },
        "downloadModelRepoRequest": {
            "source": "HF",
            "repo_id": "prajjwal1/bert-tiny"
        }
    }
}'

Get all models

curl -s -H "Authorization: Bearer ${CDP_TOKEN}" ${DOMAIN}/api/v2/models | jq
{
  "models": [
    {
      "created_at": "2024-04-18T15:54:15.543Z",
      "creator": {
        "user_name": "csso_cheyuanl"
      },
      "id": "5bwt-qqe2-e1vg-chqj",
      "name": "foo",
      "tags": null,
      "updated_at": "2024-04-18T15:54:15.543Z",
      "visibility": "private"
    },

Get a model

curl -s -H "Authorization: Bearer ${CDP_TOKEN}" ${DOMAIN}/api/v2/models/fx0k-baf7-yszl-jrt2 | jq
{
  "created_at": "2024-04-18T15:54:24.940Z",
  "creator": {
    "user_name": "csso_cheyuanl"
  },
  "id": "fx0k-baf7-yszl-jrt2",
  "model_versions": [
    {
      "artifact_uri": "abfs://data@engmldevenvazuresan.dfs.core.windows.net/modelregistry/fx0k-baf7-yszl-jrt2/y8d8-qluc-00md-h2pw/model.tar.gz",
      "created_at": "2024-04-18T15:54:24.942Z",
      "model_id": "fx0k-baf7-yszl-jrt2",
      "status": "READY",
      "tags": null,
      "updated_at": "2024-04-18T15:54:24.942Z",
      "user": {
        "user_name": "csso_cheyuanl"
      },
      "version": 1
    }
  ],
  "name": "foo2",
  "tags": null,
  "updated_at": "2024-04-18T15:54:24.940Z",
  "visibility": "private"
}

Get a model version

curl -s -H "Authorization: Bearer ${CDP_TOKEN}" ${DOMAIN}/api/v2/models/fx0k-baf7-yszl-jrt2/versions/1 | jq
{
  "artifact_uri": "abfs://data@engmldevenvazuresan.dfs.core.windows.net/modelregistry/fx0k-baf7-yszl-jrt2/y8d8-qluc-00md-h2pw/model.tar.gz",
  "created_at": "2024-04-18T15:54:24.942Z",
  "model_id": "fx0k-baf7-yszl-jrt2",
  "status": "READY",
  "tags": null,
  "updated_at": "2024-04-18T15:54:24.942Z",
  "user": {
    "user_name": "csso_cheyuanl"
  },
  "version": 1
}

Delete a Model

curl -XDELETE -s -H "Authorization: Bearer ${CDP_TOKEN}" ${DOMAIN}/api/v2/models/vuu6-gcfx-ydio-rit0

Delete a Model Version

curl -XDELETE -s -H "Authorization: Bearer ${CDP_TOKEN}" ${DOMAIN}/api/v2/models/vuu6-gcfx-ydio-rit0/versions/1