0Pricing
MLOps Academy · 课时

将最佳模型推向生产环境

选出最佳模型,并将其部署到提供服务的阶段

将最佳模型推向生产环境 是 CoddyKit 上的免费 MLOps Academy 课时。 这是第 2 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 MLOps Academy 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 MLOps Academy 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

Pick a Winner

You now have several registered versions. Promotion is choosing which one your service should actually use, then marking it as Production. 🏆

List the Versions

Use the MlflowClient to fetch every version of a model so you can compare them before choosing.

from mlflow import MlflowClient

client = MlflowClient()
versions = client.search_model_versions("name='churn-classifier'")

Compare by Metric

Each version links back to its run, so you can read that run's accuracy and pick the highest scorer programmatically.

for v in versions:
    run = client.get_run(v.run_id)
    print(v.version, run.data.metrics["accuracy"])

Aliases Over Stages

Newer MLflow uses named aliases like champion instead of fixed stages. An alias is a movable pointer to one chosen version.

Set the Champion Alias

Point the champion alias at your best version. Your serving code can then always ask for champion and get the current pick.

client.set_registered_model_alias(
    name="churn-classifier",
    alias="champion",
    version="3",
)

Stages Still Work

On older setups you transition a version to the Production stage instead. The idea is the same: mark which one is live.

client.transition_model_version_stage(
    name="churn-classifier",
    version=3,
    stage="Production",
)

Archive the Old One

When you promote a new version, move the previous live one aside. With stages that means Archived; with aliases you simply reassign the pointer.

Tag the Decision

Add a tag recording why this version won. Future teammates will thank you for the breadcrumb when they audit the choice.

client.set_model_version_tag(
    "churn-classifier", "3",
    "approved_by", "data-team",
)

Promotion Is Reversible

Because old versions are kept, you can re-point champion back to a previous version instantly if the new one misbehaves. 🔁

Quick Check

What is the main advantage of a model alias like champion?

Serving Stays Decoupled

The big win: your API never names version 3. It asks for the champion, so promotion is a registry change, not a code deploy.

Promote With Confidence

Compare, then promote only what beats the current pick. Tying promotion to metrics keeps weak models out of production.

Recap: Choosing the Live Model

You listed versions, compared metrics, set the champion alias, tagged the reason, and kept the choice reversible. That is safe promotion. ✅

常见问题解答

「将最佳模型推向生产环境」课时是免费的吗?

是的 — 「将最佳模型推向生产环境」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 MLOps Academy 课程的其余内容,请升级到 CoddyKit PRO。 MLOps Academy 课程共包含 4 节课。

「将最佳模型推向生产环境」这节课中我会学到什么?

选出最佳模型,并将其部署到提供服务的阶段 你通过在浏览器中直接运行的动手代码来练习 MLOps Academy,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 MLOps Academy 需要有经验吗?

无需任何先前经验。CoddyKit 上的 MLOps Academy 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 2 节课,共 4 节。

「将最佳模型推向生产环境」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 MLOps Academy 课中编写并运行代码吗?

能。每节 MLOps Academy 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. 训练模型并记录到注册表
  2. 将最佳模型推向生产环境
  3. 提供生产模型服务
  4. 跟踪一次预测请求的完整往返
← 返回 MLOps Academy