Пример #1
0
# MAGIC 
# MAGIC You can add descriptions to registered models as well as model versions: 
# MAGIC * Model version descriptions are useful for detailing the unique attributes of a particular model version (e.g., the methodology and algorithm used to develop the model). 
# MAGIC * Registered model descriptions are useful for recording information that applies to multiple model versions (e.g., a general overview of the modeling problem and dataset).

# COMMAND ----------

# MAGIC %md Add a high-level description to the registered model, including the machine learning problem and dataset.

# COMMAND ----------

from mlflow.tracking.client import MlflowClient

client = MlflowClient()
client.update_registered_model(
  name=model_details.name,
  description="This model forecasts the power output of a wind farm based on weather data. The weather data consists of three features: wind speed, wind direction, and air temperature."
)

# COMMAND ----------

# MAGIC %md Add a model version description with information about the model architecture and machine learning framework.

# COMMAND ----------

client.update_model_version(
  name=model_details.name,
  version=model_details.version,
  description="This model version was built using Keras. It is a feed-forward neural network with one hidden layer."
)

# COMMAND ----------
Пример #2
0
#latest_model = client.get_latest_versions(name = model_name, stages=[stage])[0]
latest_model = client.get_model_version(name = model_name, version = model_version)
#print(latest_model[0])

# COMMAND ----------

model_uri="runs:/{}/model".format(latest_model.run_id)
latest_sk_model = mlflow.sklearn.load_model(model_uri)

# COMMAND ----------

from mlflow.tracking.client import MlflowClient

client = MlflowClient()
client.update_registered_model(
  name=model_name,
  description="This model forecasts the wine quality based on the characteristics."
)

client.update_model_version(
  name=model_name,
  version=model_version,
  description="This model version was built using sklearn."
)

# COMMAND ----------

client.transition_model_version_stage(
  name=model_name,
  version=model_version,
  stage=stage,
  archive_existing_versions=True
        status = ModelVersionStatus.from_string(model_version_details.status)
        print("Model status: %s" % ModelVersionStatus.to_string(status))
        if status == ModelVersionStatus.READY:
            break
        time.sleep(1)


wait_until_ready(model_details.name, model_details.version)

# COMMAND ----------

# MAGIC %md ### Add model descriptions
# MAGIC
# MAGIC You can add descriptions to registered models as well as model versions:
# MAGIC * Model version descriptions are useful for detailing the unique attributes of a particular model version (e.g., the methodology and algorithm used to develop the model).
# MAGIC * Registered model descriptions are useful for recording information that applies to multiple model versions (e.g., a general overview of the modeling problem and dataset).

# COMMAND ----------

# MAGIC %md Add a high-level description to the registered model, including the machine learning problem and dataset.

# COMMAND ----------

from mlflow.tracking.client import MlflowClient

client = MlflowClient()
client.update_registered_model(name=model_details.name,
                               description="This model recognizes text.")

# COMMAND ----------