record model input&output, save model to file system

This commit is contained in:
2023-02-22 16:25:26 +08:00
parent 6e80927c40
commit 7015b5c1a5
4 changed files with 45 additions and 20 deletions

View File

@ -13,9 +13,12 @@ if __name__ == '__main__':
mlflow.set_tracking_uri('http://127.0.0.1:5000')
# load production model
model = mlflow.pytorch.load_model('models:/cls_model/production')
model = mlflow.pytorch.load_model('models:/fortune_predict_model/production')
# predict
fake_data = torch.randn(10)
output = model(fake_data)
print(output)
my_personal_info = torch.randn(5)
my_fortune = model(my_personal_info)
print(my_fortune)
# save model and env to local file system
mlflow.pytorch.save_model(model, './fortune_predict_model')