Writing Skills
writing-skills
效率与协作技能,来自 obra/superpowers,查看原文获取完整用途和操作说明。
mlops-observability【部署与运维】Make an ML system a glass box with reproducible runs, MLflow dataset lineage, drift monitoring, alerting, and SHAP explanations. Use when a deployed model needs traceability, monitoring, alerting, or explanation.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
To implement a "Glass Box" system where every result is Reproducible, every asset has Lineage, and system health is Monitored, Alerted on, and Explained.
Preserve existing work and repository visibility. Prepare local changes first; commit, push, change remote settings, publish, or deploy only with user authorization.
Consistency is key. For instance:
random, numpy, torch, tensorflow.uv.lock is the reproducibility mechanism for Python. It records the exact resolved version and hash of every direct and transitive dependency, and uv sync --frozen installs the subset selected by platform markers and dependency groups without checking lock freshness; use uv lock --check to check freshness.mise.lock does the same job for the binaries that are not Python packages (dprint, gitleaks, trivy, actionlint, zizmor, ...), recording version, URL, and checksum per platform. Commit both lockfiles; between them, "works on my machine" stops being a category of bug.mise run build is a plain uv build producing a wheel and an sdist. Runtime lockfiles do not pin isolated build requirements. Pin or constrain those separately when reproducible distribution builds are required.docker image (uv sync --frozen), so the runtime matches what was tested.Know the origin of your data. For instance:
mlflow.data.from_pandas.mlflow.log_input.sqlite:///mlflow.db locally, Postgres or a tracking server in production). The legacy file store is in maintenance mode and lacks current SQL-backed capabilities. Keep the SQL backend used by the reference package.data/v1.csv) or use DVC.Watch for silent failures. For instance:
mlflow.validate_evaluation_results (MLflow 3). Evaluate the exact positive integer version returned by training before changing an alias. A string version is interpreted as an alias by the reference package, so convert the returned value with int(model_version.version).evidently to compare reference (training) vs current (production) data.
log_system_metrics=True) for CPU/GPU.Don't stare at dashboards. For instance:
plyer for desktop notifications during long training runs.PagerDuty (critical) or Slack (warnings).Trust but verify. For instance:
SHAP values to explain individual predictions.Optimize resources. For instance:
project, env, user.run_time and instance type to estimate ROI.The pipeline that produces the model needs the same treatment.
mise run all (format -> check -> test -> build) is the signal that a change is releasable. CI runs that exact task, so a green pipeline and a green laptop mean the same thing.ty run inside mise run check, alongside the pip-audit, gitleaks, and trivy scans — quality signals you get on every commit, not once a quarter.AGENTS.md records the commands, the definition of done, and the conventions, so an AI assistant debugging a production incident reads the same runbook a human does.uv.lock and mise.lock committed, and does the image install with --frozen?log_system_metrics enabled?mise run all pass, and does CI run that same task?In the reference package, mise run project runs PipelineJob from confs/pipeline.yaml. It validates the full tuning model configuration plus selected parameters before training, saves selected_params.json, and links training to tuning with a tuning_run_id tag. Evaluation, promotion, inference and explanations use that same immutable model version. Failed evaluation preserves the existing champion; standalone promotion requires an explicit positive version. Do not infer the candidate from the latest registered version or a moving alias.