mlflow.active_run()
什么都不返回,所以我不能只使用
current_rui_id = mlflow.active_run().info.run_id
我必须在此构造中获取run_id才能继续在另一个块内记录参数、指标和工件,但对于同一模型:
with mlflow.start_run(run_name="test_ololo"):
"""
fitting a model here ...
"""
for name, val in metrics:
mlflow.log_metric(name, np.float(val))
# Log our parameters into mlflow
for k, v in params.items():
mlflow.log_param(key=k, value=v)
pytorch.log_model(learn.model, f'model')
mlflow.log_artifact('./outputs/fig.jpg')
我必须获得当前的run_id才能在同一次跑步中继续训练
with mlflow.start_run(run_id="215d3a71925a4709a9b694c45012988a"):
"""
fit again
log_metrics
"""
pytorch.log_model(learn.model, f'model')
mlflow.log_artifact('./outputs/fig2.jpg')