MLflow adalah platform open source untuk manajemen siklus hidup pembelajaran mesin yang melacak informasi pelatihan model serta mengelola dan men-deploy model pembelajaran mesin. Topik ini menjelaskan cara mengonfigurasi registri model MLflow untuk manajemen model.
Pengenalan registri model MLflow
Untuk informasi lebih lanjut tentang registri model MLflow, lihat MLflow Model Registry — MLflow documentation.
Prasyarat
-
Anda telah membuat kluster ACK Pro dengan versi Kubernetes 1.20 atau yang lebih baru. Untuk informasi selengkapnya, lihat Create an ACK Pro cluster.
-
Anda telah membuat instans RDS PostgreSQL. Untuk informasi selengkapnya, lihat Create an RDS PostgreSQL instance.
Saat membuat instans RDS PostgreSQL, disarankan memilih VPC tempat kluster ACK Anda dideploy dan menambahkan Blok CIDR VPC tersebut ke daftar putih agar Anda dapat mengakses database menggunakan Titik akhir internal. Jika instans RDS dan kluster ACK berada di VPC yang berbeda, aktifkan akses jaringan publik untuk instans RDS dan tambahkan Blok CIDR VPC kluster ACK ke daftar putih. Untuk informasi selengkapnya, lihat Configure a whitelist.
-
Buat akun standar bernama
mlflowdi instans RDS PostgreSQL. Untuk informasi selengkapnya, lihat Create an account. -
Buat database bernama
mlflow_storedi instans RDS PostgreSQL untuk menyimpan metadata model. Atur Authorized Account ke akunmlflow. Untuk informasi selengkapnya, lihat Create a database. -
(Opsional) Buat database bernama
mlflow_basic_authdi instans RDS PostgreSQL untuk menyimpan informasi otentikasi pengguna MLflow. Atur Authorized Account ke akunmlflow. Untuk informasi selengkapnya, lihat Create a database. -
Konfigurasikan klien Arena untuk manajemen model. Versi Arena harus 0.9.14 atau yang lebih baru. Untuk informasi selengkapnya, lihat Configure the Arena client.
Langkah 1: Deploy MLflow di kluster ACK
Masuk ke ACK console. Di panel navigasi kiri, klik Clusters.
Di halaman Clusters, klik nama kluster Anda. Di panel navigasi kiri, klik .
-
Klik Deploy. Di halaman Deploy, atur Application Name menjadi
mlflowdan Namespace menjadikube-ai. Di bagian Chart, cari dan pilihmlflow. Klik Next. Di kotak dialog yang muncul, konfirmasi apakah akan menggunakan mlflow sebagai namespace default untuk Chart tersebut.-
Untuk mengelola model menggunakan Konsol pengembangan AI Suite, deploy MLflow di namespace
kube-aidan pertahankan nama rilis sebagai nilai defaultmlflow. -
Untuk mengelola model menggunakan Arena, Anda dapat mendeploy MLflow di namespace apa pun, tetapi pertahankan nama rilis sebagai nilai default
mlflow.
-
-
Di halaman Create, konfigurasikan parameter Chart.
-
Konfigurasikan parameter
defaultArtifactRootdanbackendStore. Contoh berikut menunjukkan konfigurasi sampel.trackingServer: # -- Specifies which mode mlflow tracking server run with, available options are `serve-artifacts`, `no-serve-artifacts` and `artifacts-only` mode: no-serve-artifacts # -- Specifies a default artifact location for logging, data will be logged to `mlflow-artifacts/:` if artifact serving is enabled, otherwise `./mlruns` defaultArtifactRoot: "./mlruns" # For more information about how to configure backend store, please visit https://mlflow.org/docs/latest/tracking/backend-stores.html backendStore: # -- Backend store uri e.g. `<dialect>+<driver>://<username>:<password>@<host>:<port>/<database>` backendStoreUri: postgresql+psycopg2://mlflow:<password>@pgm-xxxxxxxxxxxxxx.pg.rds.aliyuncs.com/mlflow_storeGanti
backendStore.backendStoreUridengan titik akhir databasemlflow_storeyang telah Anda buat pada prasyarat. Misalnya, gunakanpostgresql+psycopg2://mlflow:<password>@pgm-xxxxxxxxxxxxxx.pg.rds.aliyuncs.com/mlflow_store.PentingJika instans RDS dan kluster ACK berada di VPC yang sama, gunakan Titik akhir internal instans RDS. Jika tidak, gunakan Titik akhir publik dan pastikan kluster ACK dapat mengaksesnya.
Masuk ke RDS PostgreSQL console. Klik Instance ID > Database Connection > Internal/External Endpoint untuk mendapatkan titik akhir database, seperti
pgm-xxxxxxxxxxxxxx.pg.rds.aliyuncs.com.Untuk informasi selengkapnya, lihat Connect to a database.
-
(Opsional) Untuk mengaktifkan BasicAuth, konfigurasikan parameter berikut.
trackingServer: # -- Specifies which mode mlflow tracking server run with, available options are `serve-artifacts`, `no-serve-artifacts` and `artifacts-only` mode: no-serve-artifacts # -- Specifies a default artifact location for logging, data will be logged to `mlflow-artifacts/:` if artifact serving is enabled, otherwise `./mlruns` defaultArtifactRoot: "./mlruns" # Basic authentication configuration, # for more information, please visit https://mlflow.org/docs/latest/auth/index.html#configuration basicAuth: # -- Specifies whether to enable basic authentication enabled: true # -- Default permission on all resources, available options are `READ`, `EDIT`, `MANAGE` and `NO_PERMISSIONS` defaultPermission: NO_PERMISSIONS # -- Database location to store permissions and user data e.g. `<dialect>+<driver>://<username>:<password>@<host>:<port>/<database>` databaseUri: postgresql+psycopg2://<username>:<password>@pgm-xxxxxxxxxxxxxx.pg.rds.aliyuncs.com/mlflow_basic_auth # -- Default admin username if the admin is not already created adminUsername: admin # -- Default admin password if the admin is not already created adminPassword: password # -- Function to authenticate requests authorizationFunction: mlflow.server.auth:authenticate_request_basic_auth # For more information about how to configure backend store, please visit https://mlflow.org/docs/latest/tracking/backend-stores.html backendStore: # -- Backend store uri e.g. `<dialect>+<driver>://<username>:<password>@<host>:<port>/<database>` backendStoreUri: postgresql+psycopg2://mlflow:<password>@pgm-xxxxxxxxxxxxxx.pg.rds.aliyuncs.com/mlflow_store-
Ganti
trackingServer.basicAuth.databaseUridengan titik akhir databasemlflow_basic_authyang telah Anda buat pada prasyarat. Misalnya, gunakanpostgresql+psycopg2://<username>:<password>@pgm-xxxxxxxxxxxxxx.pg.rds.aliyuncs.com/mlflow_basic_auth. -
Ubah parameter
trackingServer.basicAuth.adminUsernamedantrackingServer.basicAuth.adminPassworduntuk mengonfigurasi username dan password awal administrator MLflow. Akun administrator baru hanya dibuat jika belum ada sebelumnya.
-
Untuk daftar lengkap parameter MLflow, lihat MLflow.
-
Langkah 2: Akses UI Web MLflow yang dideploy di Kubernetes
-
Jalankan perintah berikut untuk meneruskan layanan UI Web MLflow ke port 5000 di mesin lokal Anda.
kubectl port-forward -n kube-ai services/mlflow 5000Output yang diharapkan:
Forwarding from 127.0.0.1:5000 -> 5000 Forwarding from [::1]:5000 -> 5000 Handling connection for 5000 Handling connection for 5000 ... -
Buka browser Anda dan kunjungi http://127.0.0.1:5000 untuk melihat UI Web MLflow.
Setelah berhasil diakses, halaman eksperimen Default dari UI Web MLflow akan muncul. Pesan "No runs logged" menunjukkan bahwa belum ada run yang dicatat. Hal ini mengonfirmasi bahwa layanan MLflow telah berhasil dideploy dan berjalan normal di Kubernetes.
Langkah selanjutnya: Manajemen model
Suite AI cloud-native mendukung pengelolaan model di registri model MLflow. Untuk informasi selengkapnya tentang cara mengelola model menggunakan Konsol pengembangan suite AI cloud-native dan antarmuka baris perintah Arena, lihat Manage MLflow registry models using Arena.