LoginSignup
0
0

More than 1 year has passed since last update.

MLflowのProductionのモデルのバージョンの確認方法

Posted at

記載内容

MLflowで管理しているモデルについて、実行時のログに、バージョン番号も記録したい。
Productionのステージにあるモデルのバージョン番号の確認方法を調査する。

MLflowのProductionのモデルのバージョンの確認方法

REST APIで実行したら、レスポンスヘッダーにモデルバージョン番号が入ってないかな、
モデルをロードした場合は、そのモデルがバージョン番号持ってないかな、
と期待したのですが、ありませんでした。

MLflowに対して、モデル名でModelVersionを検索して、ステージがProductionのモデルのバージョン番号を確認する必要があるようです。

REST APIで確認する方法

Search ModelVersionsが使えます。

mlflow document > Search ModelVersions

リクエストデータのfilterに、"name='my-model-name'"といったように、モデル名を絞り込み条件に入れてリクエストすると、[ModelVersion]の配列が返ってきます。current_stageがProductionのModelVersionのバージョン番号を確認します。

残念ながら、ステージでの絞り込みは現状対応していないようです。

String filter condition, like “name=’my-model-name’”. Must be a single boolean condition, with string values wrapped in single quotes.

Python APIで確認する方法

mlflow.tracking.MlflowClient.search_model_versionsが使えます。

mlflow document > mlflow.tracking.MlflowClient.search_model_versions

REST APIと同じ要領です。メソッドの引数に、"name='my-model-name'"と入れて実行します。

filter_string – A filter string expression. Currently, it supports a single filter condition either a name of model like name = 'model_name' or run_id = '...'.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0