[英]MLFlow unable to log pytorch model
After training a model, I am trying to log it to mlflow with mlflow.pytorch.log_model(model, artifact_path="model",pickle_module=pickle)
but i get the error:训练模型后,我尝试使用
mlflow.pytorch.log_model(model, artifact_path="model",pickle_module=pickle)
将其记录到 mlflow,但出现错误:
yaml.representer.RepresenterError: ('cannot represent an object', '1.11.0+cu102')
I definitely send the model to cpu before doing so and confirm its there with next(model.parameters()).device
.在这样做之前,我肯定会将模型发送到 cpu 并使用
next(model.parameters()).device
确认它。 How can I get mlflow to log my model?如何让 mlflow 记录我的模型?
I haven't used MLflow with PyTorch but in the worst case, you can avoid using the PyTorch flavor and just do something like我没有将 MLflow 与 PyTorch 一起使用,但在最坏的情况下,您可以避免使用 PyTorch 风格,而只需执行类似的操作
with tempfile.TemporaryDirectory() as path:
model.save(path)
mlflow.log_artifacts(path, artifact_path="model")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.