def test_model_load_from_remote_uri_succeeds(model_path, mock_s3_bucket): model, _, inference_dataframe = arma_model() mlflow.statsmodels.save_model(statsmodels_model=model, path=model_path) artifact_root = "s3://{bucket_name}".format(bucket_name=mock_s3_bucket) artifact_path = "model" artifact_repo = S3ArtifactRepository(artifact_root) artifact_repo.log_artifacts(model_path, artifact_path=artifact_path) model_uri = artifact_root + "/" + artifact_path reloaded_model = mlflow.statsmodels.load_model(model_uri=model_uri) start_date, end_date = _get_dates_from_df(inference_dataframe) np.testing.assert_array_almost_equal( model.predict(start=start_date, end=end_date), reloaded_model.predict(start=start_date, end=end_date), )
def test_statsmodels_autolog_ends_auto_created_run(): mlflow.statsmodels.autolog() arma_model() assert mlflow.active_run() is None