how to registered the log_model in MLflow?

Viewed 12

I have tried to load the deep learning model on mlflow, it's perfectly loaded, but the model is not stored in the model registry, can any one guide me how to register the model and its dataset for inference?
Thanks

from mlflow import MlflowClient experiment_name = "nlp_model"

try:
    exp_id = mlflow.create_experiment(name=experiment_name) # set the experiment id 
except Exception as e:
    exp_id = mlflow.get_experiment_by_name(experiment_name).experiment_id

with mlflow.start_run(experiment_id=exp_id):
    run_id = mlflow.active_run().info.run_id
    print(run_id)
    mlflow.sklearn.autolog(log_models=True)
    print(mlflow.tracking.get_tracking_uri())
    model = Demucs(**args.demucs, sample_rate=args.sample_rate)# fitting the model
    """
    loaded model on mlflow
    """
    mlflow.sklearn.log_model(model, "nlp_model")
    """
    saved model on mlflow model registory
    """
    client = MlflowClient()
    model = client.create_model_version(
        name="denoiser_nlp_model",
        source=f"./mlruns/{exp_id}/{run_id}/artifacts/nlp_model",
        run_id=mlflow.active_run().info.run_id
    )

#Here is the error msg [1]: https://i.stack.imgur.com/LNAsc.png

0 Answers
Related