code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def load_prompt( self, name_or_uri: str, version: Optional[Union[str, int]] = None, allow_missing: bool = False, ) -> Optional[PromptVersion]: """ Load a :py:class:`Prompt <mlflow.entities.Prompt>` from the MLflow Prompt Registry. The prompt can be specified ...
Load a :py:class:`Prompt <mlflow.entities.Prompt>` from the MLflow Prompt Registry. The prompt can be specified by name and version, or by URI. Example: .. code-block:: python from mlflow import MlflowClient client = MlflowClient(registry_uri="sqlite:///prom...
load_prompt
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def link_prompt_version_to_run(self, run_id: str, prompt: Union[str, PromptVersion]) -> None: """ Link a prompt registered within the MLflow Prompt Registry with an MLflow Run. .. warning:: This API is not thread-safe. If you are linking prompts from multiple threads, c...
Link a prompt registered within the MLflow Prompt Registry with an MLflow Run. .. warning:: This API is not thread-safe. If you are linking prompts from multiple threads, consider using a lock to ensure that only one thread links a prompt to a run at a time. Args: ...
link_prompt_version_to_run
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def link_prompt_version_to_model(self, name: str, version: str, model_id: str) -> None: """ Link a prompt version to a model. Args: name: The name of the prompt. version: The version of the prompt. model_id: The ID of the model to link the prompt version to. ...
Link a prompt version to a model. Args: name: The name of the prompt. version: The version of the prompt. model_id: The ID of the model to link the prompt version to.
link_prompt_version_to_model
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def link_prompt_versions_to_trace( self, prompt_versions: list[PromptVersion], trace_id: str ) -> None: """ Link multiple prompt versions to a trace. Args: prompt_versions: List of PromptVersion objects to link. trace_id: Trace ID to link to each prompt versi...
Link multiple prompt versions to a trace. Args: prompt_versions: List of PromptVersion objects to link. trace_id: Trace ID to link to each prompt version. Example: .. code-block:: python import mlflow from mlflow import Mlfl...
link_prompt_versions_to_trace
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def detach_prompt_from_run(self, run_id: str, prompt_uri: str) -> None: """ Detach a prompt registered within the MLflow Prompt Registry from an MLflow Run. Args: run_id: The ID of the run to log the prompt to. prompt_uri: The prompt URI in the format "prompts:/name/vers...
Detach a prompt registered within the MLflow Prompt Registry from an MLflow Run. Args: run_id: The ID of the run to log the prompt to. prompt_uri: The prompt URI in the format "prompts:/name/version".
detach_prompt_from_run
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def list_logged_prompts(self, run_id: str) -> list[PromptVersion]: """ List all prompts associated with an MLflow Run. Args: run_id: The ID of the run to list the prompts for. Returns: A list of :py:class:`Prompt <mlflow.entities.Prompt>` objects associated with...
List all prompts associated with an MLflow Run. Args: run_id: The ID of the run to list the prompts for. Returns: A list of :py:class:`Prompt <mlflow.entities.Prompt>` objects associated with the run.
list_logged_prompts
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def set_prompt_alias(self, name: str, alias: str, version: int) -> None: """ Set an alias for a :py:class:`Prompt <mlflow.entities.Prompt>`. Args: name: The name of the prompt. alias: The alias to set for the prompt. version: The version of the prompt. ...
Set an alias for a :py:class:`Prompt <mlflow.entities.Prompt>`. Args: name: The name of the prompt. alias: The alias to set for the prompt. version: The version of the prompt.
set_prompt_alias
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def set_prompt_version_tag( self, name: str, version: Union[str, int], key: str, value: str ) -> None: """ Set a tag on a specific prompt version. Args: name: The name of the prompt. version: The version number of the prompt. key: The tag key. ...
Set a tag on a specific prompt version. Args: name: The name of the prompt. version: The version number of the prompt. key: The tag key. value: The tag value.
set_prompt_version_tag
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def parse_prompt_uri(self, uri: str) -> tuple[str, str]: """ Parse prompt URI into prompt name and prompt version. - 'prompt:/<name>/<version>' -> ('<name>', '<version>') - 'prompt:/<name>@<alias>' -> ('<name>', '<version>') """ parsed = urllib.parse.urlparse(uri) ...
Parse prompt URI into prompt name and prompt version. - 'prompt:/<name>/<version>' -> ('<name>', '<version>') - 'prompt:/<name>@<alias>' -> ('<name>', '<version>')
parse_prompt_uri
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def delete_traces( self, experiment_id: str, max_timestamp_millis: Optional[int] = None, max_traces: Optional[int] = None, trace_ids: Optional[list[str]] = None, ) -> int: """ Delete traces based on the specified criteria. - Either `max_timestamp_mill...
Delete traces based on the specified criteria. - Either `max_timestamp_millis` or `trace_ids` must be specified, but not both. - `max_traces` can't be specified if `trace_ids` is specified. Args: experiment_id: ID of the associated experiment. max_timestamp_mil...
delete_traces
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def get_trace(self, trace_id: str, display=True) -> Trace: """ Get the trace matching the specified ``trace_id``. Args: trace_id: String ID of the trace to fetch. display: If ``True``, display the trace on the notebook. Returns: The retrieved :py:cla...
Get the trace matching the specified ``trace_id``. Args: trace_id: String ID of the trace to fetch. display: If ``True``, display the trace on the notebook. Returns: The retrieved :py:class:`Trace <mlflow.entities.Trace>`. .. code-block:: python ...
get_trace
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def start_trace( self, name: str, span_type: str = SpanType.UNKNOWN, inputs: Optional[Any] = None, attributes: Optional[dict[str, str]] = None, tags: Optional[dict[str, str]] = None, experiment_id: Optional[str] = None, start_time_ns: Optional[int] = None,...
Create a new trace object and start a root span under it. This is an imperative API to manually create a new span under a specific trace id and parent span, unlike the higher-level APIs like :py:func:`@mlflow.trace <mlflow.trace>` and :py:func:`with mlflow.start_span() <mlflow.start_sp...
start_trace
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def end_trace( self, trace_id: str, outputs: Optional[Any] = None, attributes: Optional[dict[str, Any]] = None, status: Union[SpanStatus, str] = "OK", end_time_ns: Optional[int] = None, ): """ End the trace with the given trace ID. This will end the ro...
End the trace with the given trace ID. This will end the root span of the trace and log the trace to the backend if configured. If any of children spans are not ended, they will be ended forcefully with the status ``TRACE_STATUS_UNSPECIFIED``. If the trace is already ended, this method...
end_trace
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def _log_trace(self, trace: Trace) -> str: """ Log the complete Trace object to the backend store. # NB: Since the backend API is used directly here, customization of trace ID's # are not possible with this internal API. A backend-generated ID will be generated # directly with t...
Log the complete Trace object to the backend store. # NB: Since the backend API is used directly here, customization of trace ID's # are not possible with this internal API. A backend-generated ID will be generated # directly with this invocation, instead of the one from the given trac...
_log_trace
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def start_span( self, name: str, trace_id: str, parent_id: str, span_type: str = SpanType.UNKNOWN, inputs: Optional[Any] = None, attributes: Optional[dict[str, Any]] = None, start_time_ns: Optional[int] = None, ) -> Span: """ Create a n...
Create a new span and start it without attaching it to the global trace context. This is an imperative API to manually create a new span under a specific trace id and parent span, unlike the higher-level APIs like :py:func:`@mlflow.trace <mlflow.trace>` decorator and :py:func:`...
start_span
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def end_span( self, trace_id: str, span_id: str, outputs: Optional[Any] = None, attributes: Optional[dict[str, Any]] = None, status: Union[SpanStatus, str] = "OK", end_time_ns: Optional[int] = None, ): """ End the span with the given trace ID a...
End the span with the given trace ID and span ID. Args: trace_id: The ID of the trace to end. span_id: The ID of the span to end. outputs: Outputs to set on the span. attributes: A dictionary of attributes to set on the span. If the span already has ...
end_span
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def create_experiment( self, name: str, artifact_location: Optional[str] = None, tags: Optional[dict[str, Any]] = None, ) -> str: """Create an experiment. Args: name: The experiment name, which must be a unique string. artifact_location: The l...
Create an experiment. Args: name: The experiment name, which must be a unique string. artifact_location: The location to store run artifacts. If not provided, the server picks anappropriate default. tags: A dictionary of key-value pairs that are converted int...
create_experiment
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def log_metric( self, run_id: str, key: str, value: float, timestamp: Optional[int] = None, step: Optional[int] = None, synchronous: Optional[bool] = None, dataset_name: Optional[str] = None, dataset_digest: Optional[str] = None, model_id: ...
Log a metric against the run ID. Args: run_id: The run id to which the metric should be logged. key: Metric name. This string may only contain alphanumerics, underscores (_), dashes (-), periods (.), spaces ( ), and slashes (/). All backend store...
log_metric
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def log_param( self, run_id: str, key: str, value: Any, synchronous: Optional[bool] = None ) -> Any: """ Log a parameter (e.g. model hyperparameter) against the run ID. Args: run_id: The run id to which the param should be logged. key: Parameter name. This st...
Log a parameter (e.g. model hyperparameter) against the run ID. Args: run_id: The run id to which the param should be logged. key: Parameter name. This string may only contain alphanumerics, underscores (_), dashes (-), periods (.), spaces ( ), and slashes (/). ...
log_param
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def set_tag( self, run_id: str, key: str, value: Any, synchronous: Optional[bool] = None ) -> Optional[RunOperations]: """ Set a tag on the run with the specified ID. Value is converted to a string. Args: run_id: String ID of the run. key: Tag name. This stri...
Set a tag on the run with the specified ID. Value is converted to a string. Args: run_id: String ID of the run. key: Tag name. This string may only contain alphanumerics, underscores (_), dashes (-), periods (.), spaces ( ), and slashes (/). All backend stores w...
set_tag
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def update_run( self, run_id: str, status: Optional[str] = None, name: Optional[str] = None ) -> None: """Update a run with the specified ID to a new status or name. Args: run_id: The ID of the Run to update. status: The new status of the run to set, if specified. At...
Update a run with the specified ID to a new status or name. Args: run_id: The ID of the Run to update. status: The new status of the run to set, if specified. At least one of ``status`` or ``name`` should be specified. name: The new name of the run to set, if...
update_run
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def log_batch( self, run_id: str, metrics: Sequence[Metric] = (), params: Sequence[Param] = (), tags: Sequence[RunTag] = (), synchronous: Optional[bool] = None, ) -> Optional[RunOperations]: """ Log multiple metrics, params, and/or tags. Args:...
Log multiple metrics, params, and/or tags. Args: run_id: String ID of the run metrics: If provided, List of Metric(key, value, timestamp) instances. params: If provided, List of Param(key, value) instances. tags: If provided, List of RunTag(key, value) i...
log_batch
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def log_inputs( self, run_id: str, datasets: Optional[Sequence[DatasetInput]] = None, models: Optional[Sequence[LoggedModelInput]] = None, ) -> None: """ Log one or more dataset inputs to a run. Args: run_id: String ID of the run. data...
Log one or more dataset inputs to a run. Args: run_id: String ID of the run. datasets: List of :py:class:`mlflow.entities.DatasetInput` instances to log. models: List of :py:class:`mlflow.entities.LoggedModelInput` instances to log. Raises: mlfl...
log_inputs
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def log_artifact(self, run_id, local_path, artifact_path=None) -> None: """Write a local file or directory to the remote ``artifact_uri``. Args: run_id: String ID of run. local_path: Path to the file or directory to write. artifact_path: If provided, the directory in...
Write a local file or directory to the remote ``artifact_uri``. Args: run_id: String ID of run. local_path: Path to the file or directory to write. artifact_path: If provided, the directory in ``artifact_uri`` to write to. .. code-block:: python :caption...
log_artifact
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def log_artifacts( self, run_id: str, local_dir: str, artifact_path: Optional[str] = None ) -> None: """Write a directory of files to the remote ``artifact_uri``. Args: run_id: String ID of run. local_dir: Path to the directory of files to write. artifact...
Write a directory of files to the remote ``artifact_uri``. Args: run_id: String ID of run. local_dir: Path to the directory of files to write. artifact_path: If provided, the directory in ``artifact_uri`` to write to. .. code-block:: python :caption: Exa...
log_artifacts
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def _log_artifact_helper(self, run_id, artifact_file): """Yields a temporary path to store a file, and then calls `log_artifact` against that path. Args: run_id: String ID of the run. artifact_file: The run-relative artifact file path in posixpath format. Returns: ...
Yields a temporary path to store a file, and then calls `log_artifact` against that path. Args: run_id: String ID of the run. artifact_file: The run-relative artifact file path in posixpath format. Returns: Temporary path to store a file.
_log_artifact_helper
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def _log_artifact_async_helper(self, run_id, artifact_file, artifact): """Log artifact asynchronously. Args: run_id: The unique identifier for the run. This ID is used to associate the artifact with a specific run. artifact_file: The file path of the artifact rel...
Log artifact asynchronously. Args: run_id: The unique identifier for the run. This ID is used to associate the artifact with a specific run. artifact_file: The file path of the artifact relative to the run's directory. The path should be in POSIX format, ...
_log_artifact_async_helper
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def log_text(self, run_id: str, text: str, artifact_file: str) -> None: """Log text as an artifact. Args: run_id: String ID of the run. text: String containing text to log. artifact_file: The run-relative artifact file path in posixpath format to which ...
Log text as an artifact. Args: run_id: String ID of the run. text: String containing text to log. artifact_file: The run-relative artifact file path in posixpath format to which the text is saved (e.g. "dir/file.txt"). .. code-block:: python ...
log_text
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def log_dict(self, run_id: str, dictionary: dict[str, Any], artifact_file: str) -> None: """Log a JSON/YAML-serializable object (e.g. `dict`) as an artifact. The serialization format (JSON or YAML) is automatically inferred from the extension of `artifact_file`. If the file extension doesn't exi...
Log a JSON/YAML-serializable object (e.g. `dict`) as an artifact. The serialization format (JSON or YAML) is automatically inferred from the extension of `artifact_file`. If the file extension doesn't exist or match any of [".json", ".yml", ".yaml"], JSON format is used, and we stringify objects...
log_dict
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def log_figure( self, run_id: str, figure: Union["matplotlib.figure.Figure", "plotly.graph_objects.Figure"], artifact_file: str, *, save_kwargs: Optional[dict[str, Any]] = None, ) -> None: """Log a figure as an artifact. The following figure objects are suppor...
Log a figure as an artifact. The following figure objects are supported: - `matplotlib.figure.Figure`_ - `plotly.graph_objects.Figure`_ .. _matplotlib.figure.Figure: https://matplotlib.org/api/_as_gen/matplotlib.figure.Figure.html .. _plotly.graph_objects.Figure: ...
log_figure
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def log_image( self, run_id: str, image: Union["numpy.ndarray", "PIL.Image.Image", "mlflow.Image"], artifact_file: Optional[str] = None, key: Optional[str] = None, step: Optional[int] = None, timestamp: Optional[int] = None, synchronous: Optional[bool] = N...
Logs an image in MLflow, supporting two use cases: 1. Time-stepped image logging: Ideal for tracking changes or progressions through iterative processes (e.g., during model training phases). - Usage: :code:`log_image(image, key=key, step=step, timestamp=timestamp)`...
log_image
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def _check_artifact_file_string(self, artifact_file: str): """Check if the artifact_file contains any forbidden characters. Args: artifact_file: The run-relative artifact file path in posixpath format to which the table is saved (e.g. "dir/file.json"). """ ch...
Check if the artifact_file contains any forbidden characters. Args: artifact_file: The run-relative artifact file path in posixpath format to which the table is saved (e.g. "dir/file.json").
_check_artifact_file_string
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def log_table( self, run_id: str, data: Union[dict[str, Any], "pandas.DataFrame"], artifact_file: str, ) -> None: """ Log a table to MLflow Tracking as a JSON artifact. If the artifact_file already exists in the run, the data would be appended to the existing ...
Log a table to MLflow Tracking as a JSON artifact. If the artifact_file already exists in the run, the data would be appended to the existing artifact_file. Args: run_id: String ID of the run. data: Dictionary or pandas.DataFrame to log. artifact_file: The r...
log_table
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def load_table( self, experiment_id: str, artifact_file: str, run_ids: Optional[list[str]] = None, extra_columns: Optional[list[str]] = None, ) -> "pandas.DataFrame": """ Load a table from MLflow Tracking as a pandas.DataFrame. The table is loaded from the ...
Load a table from MLflow Tracking as a pandas.DataFrame. The table is loaded from the specified artifact_file in the specified run_ids. The extra_columns are columns that are not in the table but are augmented with run information and added to the DataFrame. Args: experimen...
load_table
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def set_terminated( self, run_id: str, status: Optional[str] = None, end_time: Optional[int] = None ) -> None: """Set a run's status to terminated. Args: run_id: The ID of the run to terminate. status: A string value of :py:class:`mlflow.entities.RunStatus`. Defaults...
Set a run's status to terminated. Args: run_id: The ID of the run to terminate. status: A string value of :py:class:`mlflow.entities.RunStatus`. Defaults to "FINISHED". end_time: If not provided, defaults to the current time. .. code-block:: python from...
set_terminated
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def search_runs( self, experiment_ids: list[str], filter_string: str = "", run_view_type: int = ViewType.ACTIVE_ONLY, max_results: int = SEARCH_MAX_RESULTS_DEFAULT, order_by: Optional[list[str]] = None, page_token: Optional[str] = None, ) -> PagedList[Run]: ...
Search for Runs that fit the specified criteria. Args: experiment_ids: List of experiment IDs, or a single int or string id. filter_string: Filter query string, defaults to searching all runs. run_view_type: one of enum values ACTIVE_ONLY, DELETED_ONLY, or ALL runs ...
search_runs
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def create_registered_model( self, name: str, tags: Optional[dict[str, Any]] = None, description: Optional[str] = None, deployment_job_id: Optional[str] = None, ) -> RegisteredModel: """ Create a new registered model in backend store. Args: ...
Create a new registered model in backend store. Args: name: Name of the new model. This is expected to be unique in the backend store. tags: A dictionary of key-value pairs that are converted into :py:class:`mlflow.entities.model_registry.RegisteredModelTag` obj...
create_registered_model
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def update_registered_model( self, name: str, description: Optional[str] = None, deployment_job_id: Optional[str] = None ) -> RegisteredModel: """ Updates metadata for RegisteredModel entity. Input field ``description`` should be non-None. Backend raises exception if a registered mod...
Updates metadata for RegisteredModel entity. Input field ``description`` should be non-None. Backend raises exception if a registered model with given name does not exist. Args: name: Name of the registered model to update. description: (Optional) New description. ...
update_registered_model
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def search_registered_models( self, filter_string: Optional[str] = None, max_results: int = SEARCH_REGISTERED_MODEL_MAX_RESULTS_DEFAULT, order_by: Optional[list[str]] = None, page_token: Optional[str] = None, ) -> PagedList[RegisteredModel]: """ Search for reg...
Search for registered models in backend that satisfy the filter criteria. Args: filter_string: Filter query string (e.g., "name = 'a_model_name' and tag.key = 'value1'"), defaults to searching for all registered models. The following identifiers, comparators...
search_registered_models
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def get_registered_model(self, name: str) -> RegisteredModel: """Get a registered model. Args: name: Name of the registered model to get. Returns: A single :py:class:`mlflow.entities.model_registry.RegisteredModel` object. .. code-block:: python :ca...
Get a registered model. Args: name: Name of the registered model to get. Returns: A single :py:class:`mlflow.entities.model_registry.RegisteredModel` object. .. code-block:: python :caption: Example import mlflow from mlflow import ...
get_registered_model
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def get_latest_versions( self, name: str, stages: Optional[list[str]] = None ) -> list[ModelVersion]: """ Latest version models for each requests stage. If no ``stages`` provided, returns the latest version for each stage. Args: name: Name of the registered model...
Latest version models for each requests stage. If no ``stages`` provided, returns the latest version for each stage. Args: name: Name of the registered model from which to get the latest versions. stages: List of desired stages. If input list is None, return latest vers...
get_latest_versions
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def set_registered_model_tag(self, name, key, value) -> None: """Set a tag for the registered model. Args: name: Registered model name. key: Tag key to log. value: Tag value log. .. code-block:: Python :caption: Example import mlflow...
Set a tag for the registered model. Args: name: Registered model name. key: Tag key to log. value: Tag value log. .. code-block:: Python :caption: Example import mlflow from mlflow import MlflowClient def print_mode...
set_registered_model_tag
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def create_model_version( self, name: str, source: str, run_id: Optional[str] = None, tags: Optional[dict[str, Any]] = None, run_link: Optional[str] = None, description: Optional[str] = None, await_creation_for: int = DEFAULT_AWAIT_MAX_SLEEP_SECONDS, ...
Create a new model version from given source. Args: name: Name for the containing registered model. source: URI indicating the location of the model artifacts. The artifact URI can be run relative (e.g. ``runs:/<run_id>/<model_artifact_path>``), a model ...
create_model_version
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def copy_model_version(self, src_model_uri, dst_name) -> ModelVersion: """ Copy a model version from one registered model to another as a new model version. Args: src_model_uri: The model URI of the model version to copy. This must be a model registry URI with a `"mo...
Copy a model version from one registered model to another as a new model version. Args: src_model_uri: The model URI of the model version to copy. This must be a model registry URI with a `"models:/"` scheme (e.g., `"models:/iris_model@champion"`). dst_name: The...
copy_model_version
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def update_model_version( self, name: str, version: str, description: Optional[str] = None ) -> ModelVersion: """ Update metadata associated with a model version in backend. Args: name: Name of the containing registered model. version: Version number of the m...
Update metadata associated with a model version in backend. Args: name: Name of the containing registered model. version: Version number of the model version. description: New description. Returns: A single :py:class:`mlflow.entities.model_regis...
update_model_version
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def transition_model_version_stage( self, name: str, version: str, stage: str, archive_existing_versions: bool = False ) -> ModelVersion: """ Update model version stage. Args: name: Registered model name. version: Registered model version. stage: ...
Update model version stage. Args: name: Registered model name. version: Registered model version. stage: New desired stage for this model version. archive_existing_versions: If this flag is set to ``True``, all existing model versions in ...
transition_model_version_stage
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def get_model_version(self, name: str, version: str) -> ModelVersion: """ Converts the docstring args and returns to google style. Args: name: Name of the containing registered model. version: Version number as an integer of the model version. Returns: ...
Converts the docstring args and returns to google style. Args: name: Name of the containing registered model. version: Version number as an integer of the model version. Returns: A single :py:class:`mlflow.entities.model_registry.ModelVersion` object. ...
get_model_version
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def get_model_version_download_uri(self, name: str, version: str) -> str: """ Get the download location in Model Registry for this model version. Args: name: Name of the containing registered model. version: Version number as an integer of the model version. Ret...
Get the download location in Model Registry for this model version. Args: name: Name of the containing registered model. version: Version number as an integer of the model version. Returns: A single URI location that allows reads for downloading. ....
get_model_version_download_uri
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def search_model_versions( self, filter_string: Optional[str] = None, max_results: int = SEARCH_MODEL_VERSION_MAX_RESULTS_DEFAULT, order_by: Optional[list[str]] = None, page_token: Optional[str] = None, ) -> PagedList[ModelVersion]: """ Search for model versio...
Search for model versions in backend that satisfy the filter criteria. .. warning: The model version search results may not have aliases populated for performance reasons. Args: filter_string: Filter query string (e.g., ``"name = 'a_model_name' and tag....
search_model_versions
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def set_model_version_tag( self, name: str, version: Optional[str] = None, key: Optional[str] = None, value: Any = None, stage: Optional[str] = None, ) -> None: """Set a tag for the model version. When stage is set, tag will be set for latest model ver...
Set a tag for the model version. When stage is set, tag will be set for latest model version of the stage. Setting both version and stage parameter will result in error. Args: name: Registered model name. version: Registered model version. key: Tag key to log...
set_model_version_tag
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def delete_model_version_tag( self, name: str, version: Optional[str] = None, key: Optional[str] = None, stage: Optional[str] = None, ) -> None: """Delete a tag associated with the model version. When stage is set, tag will be deleted for latest model version...
Delete a tag associated with the model version. When stage is set, tag will be deleted for latest model version of the stage. Setting both version and stage parameter will result in error. Args: name: Registered model name. version: Registered model version. ...
delete_model_version_tag
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def set_registered_model_alias(self, name: str, alias: str, version: str) -> None: """ Set a registered model alias pointing to a model version. Args: name: Registered model name. alias: Name of the alias. Note that aliases of the format ``v<number>``, such as ...
Set a registered model alias pointing to a model version. Args: name: Registered model name. alias: Name of the alias. Note that aliases of the format ``v<number>``, such as ``v9`` and ``v42``, are reserved and cannot be set. version: Registered mode...
set_registered_model_alias
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def delete_registered_model_alias(self, name: str, alias: str) -> None: """Delete an alias associated with a registered model. Args: name: Registered model name. alias: Name of the alias. .. code-block:: Python :caption: Example import mlflow ...
Delete an alias associated with a registered model. Args: name: Registered model name. alias: Name of the alias. .. code-block:: Python :caption: Example import mlflow from mlflow import MlflowClient from mlflow.models import inf...
delete_registered_model_alias
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def get_model_version_by_alias(self, name: str, alias: str) -> ModelVersion: """Get the model version instance by name and alias. Args: name: Registered model name. alias: Name of the alias. Returns: A single :py:class:`mlflow.entities.model_registry.ModelVe...
Get the model version instance by name and alias. Args: name: Registered model name. alias: Name of the alias. Returns: A single :py:class:`mlflow.entities.model_registry.ModelVersion` object. .. code-block:: Python :caption: Example ...
get_model_version_by_alias
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def _raise_if_prompt(self, name: str) -> None: """ Validate if the given name is registered as a Prompt rather than a Registered Model. """ rm = self.get_registered_model(name) if has_prompt_tag(rm._tags): raise _model_not_found(name)
Validate if the given name is registered as a Prompt rather than a Registered Model.
_raise_if_prompt
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def create_logged_model( self, experiment_id: str, name: Optional[str] = None, source_run_id: Optional[str] = None, tags: Optional[dict[str, str]] = None, params: Optional[dict[str, str]] = None, model_type: Optional[str] = None, ) -> LoggedModel: """ ...
Create a new logged model. Args: experiment_id: ID of the experiment to which the model belongs. name: Name of the model. If not specified, a random name will be generated. source_run_id: ID of the run that produced the model. tags: Tags to set on the mo...
create_logged_model
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def log_model_params(self, model_id: str, params: dict[str, str]) -> None: """ Log parameters for a logged model. Args: model_id: ID of the model to log parameters for. params: Dictionary of parameters to log. Returns: None """ _valid...
Log parameters for a logged model. Args: model_id: ID of the model to log parameters for. params: Dictionary of parameters to log. Returns: None
log_model_params
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def delete_logged_model_tag(self, model_id: str, key: str) -> None: """ Delete a tag from the specified logged model. Args: model_id: ID of the model. key: Tag key to delete. """ _validate_model_id_specified(model_id) return self._tracking_client...
Delete a tag from the specified logged model. Args: model_id: ID of the model. key: Tag key to delete.
delete_logged_model_tag
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def search_logged_models( self, experiment_ids: list[str], filter_string: Optional[str] = None, datasets: Optional[list[dict[str, Any]]] = None, max_results: Optional[int] = None, order_by: Optional[list[dict[str, Any]]] = None, page_token: Optional[str] = None, ...
Search for logged models that match the specified search criteria. Args: experiment_ids: List of experiment ids to scope the search. filter_string: A SQL-like filter string to parse. The filter string syntax supports: - Entity specification: ...
search_logged_models
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def create_prompt( self, name: str, description: Optional[str] = None, tags: Optional[dict[str, str]] = None, ) -> Prompt: """ Create a new prompt in the registry. This method delegates directly to the store, providing full Unity Catalog support when ...
Create a new prompt in the registry. This method delegates directly to the store, providing full Unity Catalog support when used with Unity Catalog registries. Args: name: Name of the prompt. description: Optional description of the prompt. tags: Op...
create_prompt
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def create_prompt_version( self, name: str, template: str, description: Optional[str] = None, tags: Optional[dict[str, str]] = None, ) -> PromptVersion: """ Create a new version of an existing prompt. This method delegates directly to the store, provi...
Create a new version of an existing prompt. This method delegates directly to the store, providing full Unity Catalog support when used with Unity Catalog registries. Args: name: Name of the prompt. template: Template text of the prompt version. des...
create_prompt_version
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def get_prompt_version(self, name: str, version: Union[str, int]) -> Optional[PromptVersion]: """ Get a specific prompt version. This method delegates directly to the store, providing full Unity Catalog support when used with Unity Catalog registries. Args: name: Na...
Get a specific prompt version. This method delegates directly to the store, providing full Unity Catalog support when used with Unity Catalog registries. Args: name: Name of the prompt. version: Version of the prompt (number or alias). Returns: ...
get_prompt_version
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def delete_prompt_version(self, name: str, version: str) -> None: """ Delete a specific prompt version. This method delegates directly to the store, providing full Unity Catalog support when used with Unity Catalog registries. Args: name: Name of the prompt. ...
Delete a specific prompt version. This method delegates directly to the store, providing full Unity Catalog support when used with Unity Catalog registries. Args: name: Name of the prompt. version: Version of the prompt to delete. Example: .. ...
delete_prompt_version
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def set_prompt_tag(self, name: str, key: str, value: str) -> None: """ Set a tag on a prompt. This method delegates directly to the store, providing full Unity Catalog support when used with Unity Catalog registries. Args: name: Name of the prompt. key: ...
Set a tag on a prompt. This method delegates directly to the store, providing full Unity Catalog support when used with Unity Catalog registries. Args: name: Name of the prompt. key: Tag key. value: Tag value. Example: .. code-bloc...
set_prompt_tag
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def delete_prompt_tag(self, name: str, key: str) -> None: """ Delete a tag from a prompt. This method delegates directly to the store, providing full Unity Catalog support when used with Unity Catalog registries. Args: name: Name of the prompt. key: Tag ...
Delete a tag from a prompt. This method delegates directly to the store, providing full Unity Catalog support when used with Unity Catalog registries. Args: name: Name of the prompt. key: Tag key to delete. Example: .. code-block:: python ...
delete_prompt_tag
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def get_prompt_version_by_alias(self, name: str, alias: str) -> PromptVersion: """ Get a prompt version by alias. This method delegates directly to the store, providing full Unity Catalog support when used with Unity Catalog registries. Args: name: Name of the promp...
Get a prompt version by alias. This method delegates directly to the store, providing full Unity Catalog support when used with Unity Catalog registries. Args: name: Name of the prompt. alias: Alias of the prompt version. Returns: A PromptV...
get_prompt_version_by_alias
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def search_prompt_versions( self, name: str, max_results: Optional[int] = None, page_token: Optional[str] = None ): """ Search prompt versions for a given prompt name. This method delegates directly to the store. Only supported in Unity Catalog registries. Args: ...
Search prompt versions for a given prompt name. This method delegates directly to the store. Only supported in Unity Catalog registries. Args: name: Name of the prompt to search versions for. max_results: Maximum number of versions to return. page_token: To...
search_prompt_versions
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def delete_prompt(self, name: str) -> None: """ Delete a prompt from the registry. For Unity Catalog registries, this method first checks if any versions exist for the prompt and throws an error if undeleted versions are found. All versions must be explicitly deleted first befor...
Delete a prompt from the registry. For Unity Catalog registries, this method first checks if any versions exist for the prompt and throws an error if undeleted versions are found. All versions must be explicitly deleted first before the prompt itself can be deleted. For other ...
delete_prompt
python
mlflow/mlflow
mlflow/tracking/client.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/client.py
Apache-2.0
def set_experiment( experiment_name: Optional[str] = None, experiment_id: Optional[str] = None ) -> Experiment: """ Set the given experiment as the active experiment. The experiment must either be specified by name via `experiment_name` or by ID via `experiment_id`. The experiment name and ID cannot ...
Set the given experiment as the active experiment. The experiment must either be specified by name via `experiment_name` or by ID via `experiment_id`. The experiment name and ID cannot both be specified. .. note:: If the experiment being set by name does not exist, a new experiment will be ...
set_experiment
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def start_run( run_id: Optional[str] = None, experiment_id: Optional[str] = None, run_name: Optional[str] = None, nested: bool = False, parent_run_id: Optional[str] = None, tags: Optional[dict[str, Any]] = None, description: Optional[str] = None, log_system_metrics: Optional[bool] = None...
Start a new MLflow run, setting it as the active run under which metrics and parameters will be logged. The return value can be used as a context manager within a ``with`` block; otherwise, you must call ``end_run()`` to terminate the current run. If you pass a ``run_id`` or the ``MLFLOW_RUN_ID`` envi...
start_run
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def end_run(status: str = RunStatus.to_string(RunStatus.FINISHED)) -> None: """ End an active MLflow run (if there is one). .. code-block:: python :test: :caption: Example import mlflow # Start run and get status mlflow.start_run() run = mlflow.active_run()...
End an active MLflow run (if there is one). .. code-block:: python :test: :caption: Example import mlflow # Start run and get status mlflow.start_run() run = mlflow.active_run() print(f"run_id: {run.info.run_id}; status: {run.info.status}") # ...
end_run
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def active_run() -> Optional[ActiveRun]: """ Get the currently active ``Run``, or None if no such run exists. .. attention:: This API is **thread-local** and returns only the active run in the current thread. If your application is multi-threaded and a run is started in a different thread, ...
Get the currently active ``Run``, or None if no such run exists. .. attention:: This API is **thread-local** and returns only the active run in the current thread. If your application is multi-threaded and a run is started in a different thread, this API will not retrieve that run. ...
active_run
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def last_active_run() -> Optional[Run]: """Gets the most recent active run. Examples: .. code-block:: python :test: :caption: To retrieve the most recent autologged run: import mlflow from sklearn.model_selection import train_test_split from sklearn.datasets impor...
Gets the most recent active run. Examples: .. code-block:: python :test: :caption: To retrieve the most recent autologged run: import mlflow from sklearn.model_selection import train_test_split from sklearn.datasets import load_diabetes from sklearn.ensemble i...
last_active_run
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def _get_latest_active_run(): """ Get active run from global context by checking all threads. The `mlflow.active_run` API only returns active run from current thread. This API is useful for the case where one needs to get a run started from a separate thread. """ all_active_runs = [ run ...
Get active run from global context by checking all threads. The `mlflow.active_run` API only returns active run from current thread. This API is useful for the case where one needs to get a run started from a separate thread.
_get_latest_active_run
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def log_param(key: str, value: Any, synchronous: Optional[bool] = None) -> Any: """ Log a parameter (e.g. model hyperparameter) under the current run. If no run is active, this method will create a new active run. Args: key: Parameter name. This string may only contain alphanumerics, underscore...
Log a parameter (e.g. model hyperparameter) under the current run. If no run is active, this method will create a new active run. Args: key: Parameter name. This string may only contain alphanumerics, underscores (_), dashes (-), periods (.), spaces ( ), and slashes (/). All backend st...
log_param
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def flush_artifact_async_logging() -> None: """Flush all pending artifact async logging.""" run_id = _get_or_start_run().info.run_id _artifact_repo = _get_artifact_repo(run_id) if _artifact_repo: _artifact_repo.flush_async_logging()
Flush all pending artifact async logging.
flush_artifact_async_logging
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def flush_trace_async_logging(terminate=False) -> None: """ Flush all pending trace async logging. Args: terminate: If True, shut down the logging threads after flushing. """ try: _get_trace_exporter()._async_queue.flush(terminate=terminate) except Exception as e: _logge...
Flush all pending trace async logging. Args: terminate: If True, shut down the logging threads after flushing.
flush_trace_async_logging
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def set_experiment_tag(key: str, value: Any) -> None: """ Set a tag on the current experiment. Value is converted to a string. Args: key: Tag name. This string may only contain alphanumerics, underscores (_), dashes (-), periods (.), spaces ( ), and slashes (/). All backend stores will ...
Set a tag on the current experiment. Value is converted to a string. Args: key: Tag name. This string may only contain alphanumerics, underscores (_), dashes (-), periods (.), spaces ( ), and slashes (/). All backend stores will support keys up to length 250, but some may suppo...
set_experiment_tag
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def set_tag(key: str, value: Any, synchronous: Optional[bool] = None) -> Optional[RunOperations]: """ Set a tag under the current run. If no run is active, this method will create a new active run. Args: key: Tag name. This string may only contain alphanumerics, underscores (_), dashes (-), ...
Set a tag under the current run. If no run is active, this method will create a new active run. Args: key: Tag name. This string may only contain alphanumerics, underscores (_), dashes (-), periods (.), spaces ( ), and slashes (/). All backend stores will support keys up to ...
set_tag
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def log_metric( key: str, value: float, step: Optional[int] = None, synchronous: Optional[bool] = None, timestamp: Optional[int] = None, run_id: Optional[str] = None, model_id: Optional[str] = None, dataset: Optional["Dataset"] = None, ) -> Optional[RunOperations]: """ Log a metr...
Log a metric under the current run. If no run is active, this method will create a new active run. Args: key: Metric name. This string may only contain alphanumerics, underscores (_), dashes (-), periods (.), spaces ( ), and slashes (/). All backend stores will support keys...
log_metric
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def log_metrics( metrics: dict[str, float], step: Optional[int] = None, synchronous: Optional[bool] = None, run_id: Optional[str] = None, timestamp: Optional[int] = None, model_id: Optional[str] = None, dataset: Optional["Dataset"] = None, ) -> Optional[RunOperations]: """ Log multip...
Log multiple metrics for the current run. If no run is active, this method will create a new active run. Args: metrics: Dictionary of metric_name: String -> value: Float. Note that some special values such as +/- Infinity may be replaced by other values depending on the sto...
log_metrics
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def log_params( params: dict[str, Any], synchronous: Optional[bool] = None, run_id: Optional[str] = None ) -> Optional[RunOperations]: """ Log a batch of params for the current run. If no run is active, this method will create a new active run. Args: params: Dictionary of param_name: String...
Log a batch of params for the current run. If no run is active, this method will create a new active run. Args: params: Dictionary of param_name: String -> value: (String, but will be string-ified if not) synchronous: *Experimental* If True, blocks until the parameters are logg...
log_params
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def log_input( dataset: Optional["Dataset"] = None, context: Optional[str] = None, tags: Optional[dict[str, str]] = None, model: Optional[LoggedModelInput] = None, ) -> None: """ Log a dataset used in the current run. Args: dataset: :py:class:`mlflow.data.dataset.Dataset` object to ...
Log a dataset used in the current run. Args: dataset: :py:class:`mlflow.data.dataset.Dataset` object to be logged. context: Context in which the dataset is used. For example: "training", "testing". This will be set as an input tag with key `mlflow.data.context`. tags: Tags ...
log_input
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def log_inputs( datasets: Optional[list[Optional["Dataset"]]] = None, contexts: Optional[list[Optional[str]]] = None, tags_list: Optional[list[Optional[dict[str, str]]]] = None, models: Optional[list[Optional[LoggedModelInput]]] = None, ) -> None: """ Log a batch of datasets used in the current ...
Log a batch of datasets used in the current run. The lists of `datasets`, `contexts`, `tags_list` must have the same length. The entries in these lists can be ``None``, which represents empty value to the corresponding input. Args: datasets: List of :py:class:`mlflow.data.dataset.Dataset`...
log_inputs
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def set_tags(tags: dict[str, Any], synchronous: Optional[bool] = None) -> Optional[RunOperations]: """ Log a batch of tags for the current run. If no run is active, this method will create a new active run. Args: tags: Dictionary of tag_name: String -> value: (String, but will be string-ified i...
Log a batch of tags for the current run. If no run is active, this method will create a new active run. Args: tags: Dictionary of tag_name: String -> value: (String, but will be string-ified if not) synchronous: *Experimental* If True, blocks until tags are logged successfully....
set_tags
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def log_artifact( local_path: str, artifact_path: Optional[str] = None, run_id: Optional[str] = None ) -> None: """ Log a local file or directory as an artifact of the currently active run. If no run is active, this method will create a new active run. Args: local_path: Path to the file to ...
Log a local file or directory as an artifact of the currently active run. If no run is active, this method will create a new active run. Args: local_path: Path to the file to write. artifact_path: If provided, the directory in ``artifact_uri`` to write to. run_id: If specified, log...
log_artifact
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def log_artifacts( local_dir: str, artifact_path: Optional[str] = None, run_id: Optional[str] = None ) -> None: """ Log all the contents of a local directory as artifacts of the run. If no run is active, this method will create a new active run. Args: local_dir: Path to the directory of fil...
Log all the contents of a local directory as artifacts of the run. If no run is active, this method will create a new active run. Args: local_dir: Path to the directory of files to write. artifact_path: If provided, the directory in ``artifact_uri`` to write to. run_id: If specifie...
log_artifacts
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def log_text(text: str, artifact_file: str, run_id: Optional[str] = None) -> None: """ Log text as an artifact. Args: text: String containing text to log. artifact_file: The run-relative artifact file path in posixpath format to which the text is saved (e.g. "dir/file.txt"). ...
Log text as an artifact. Args: text: String containing text to log. artifact_file: The run-relative artifact file path in posixpath format to which the text is saved (e.g. "dir/file.txt"). run_id: If specified, log the artifact to the specified run. If not specified, log th...
log_text
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def log_dict(dictionary: dict[str, Any], artifact_file: str, run_id: Optional[str] = None) -> None: """ Log a JSON/YAML-serializable object (e.g. `dict`) as an artifact. The serialization format (JSON or YAML) is automatically inferred from the extension of `artifact_file`. If the file extension doesn't...
Log a JSON/YAML-serializable object (e.g. `dict`) as an artifact. The serialization format (JSON or YAML) is automatically inferred from the extension of `artifact_file`. If the file extension doesn't exist or match any of [".json", ".yml", ".yaml"], JSON format is used. Args: dictionary: ...
log_dict
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def log_figure( figure: Union["matplotlib.figure.Figure", "plotly.graph_objects.Figure"], artifact_file: str, *, save_kwargs: Optional[dict[str, Any]] = None, ) -> None: """ Log a figure as an artifact. The following figure objects are supported: - `matplotlib.figure.Figure`_ - `plotly....
Log a figure as an artifact. The following figure objects are supported: - `matplotlib.figure.Figure`_ - `plotly.graph_objects.Figure`_ .. _matplotlib.figure.Figure: https://matplotlib.org/api/_as_gen/matplotlib.figure.Figure.html .. _plotly.graph_objects.Figure: https://plotly.c...
log_figure
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def log_image( image: Union["numpy.ndarray", "PIL.Image.Image", "mlflow.Image"], artifact_file: Optional[str] = None, key: Optional[str] = None, step: Optional[int] = None, timestamp: Optional[int] = None, synchronous: Optional[bool] = False, ) -> None: """ Logs an image in MLflow, suppo...
Logs an image in MLflow, supporting two use cases: 1. Time-stepped image logging: Ideal for tracking changes or progressions through iterative processes (e.g., during model training phases). - Usage: :code:`log_image(image, key=key, step=step, timestamp=timestamp)` 2. Artifact fi...
log_image
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def log_table( data: Union[dict[str, Any], "pandas.DataFrame"], artifact_file: str, run_id: Optional[str] = None, ) -> None: """ Log a table to MLflow Tracking as a JSON artifact. If the artifact_file already exists in the run, the data would be appended to the existing artifact_file. Args:...
Log a table to MLflow Tracking as a JSON artifact. If the artifact_file already exists in the run, the data would be appended to the existing artifact_file. Args: data: Dictionary or pandas.DataFrame to log. artifact_file: The run-relative artifact file path in posixpath format to which ...
log_table
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def load_table( artifact_file: str, run_ids: Optional[list[str]] = None, extra_columns: Optional[list[str]] = None, ) -> "pandas.DataFrame": """ Load a table from MLflow Tracking as a pandas.DataFrame. The table is loaded from the specified artifact_file in the specified run_ids. The extra_colum...
Load a table from MLflow Tracking as a pandas.DataFrame. The table is loaded from the specified artifact_file in the specified run_ids. The extra_columns are columns that are not in the table but are augmented with run information and added to the DataFrame. Args: artifact_file: The run-relati...
load_table
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def search_experiments( view_type: int = ViewType.ACTIVE_ONLY, max_results: Optional[int] = None, filter_string: Optional[str] = None, order_by: Optional[list[str]] = None, ) -> list[Experiment]: """ Search for experiments that match the specified search query. Args: view_type: One ...
Search for experiments that match the specified search query. Args: view_type: One of enum values ``ACTIVE_ONLY``, ``DELETED_ONLY``, or ``ALL`` defined in :py:class:`mlflow.entities.ViewType`. max_results: If passed, specifies the maximum number of experiments desired. If not ...
search_experiments
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def create_experiment( name: str, artifact_location: Optional[str] = None, tags: Optional[dict[str, Any]] = None, ) -> str: """ Create an experiment. Args: name: The experiment name, must be a non-empty unique string. artifact_location: The location to store run artifacts. If no...
Create an experiment. Args: name: The experiment name, must be a non-empty unique string. artifact_location: The location to store run artifacts. If not provided, the server picks an appropriate default. tags: An optional dictionary of string keys and values to set as tags ...
create_experiment
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def initialize_logged_model( name: Optional[str] = None, source_run_id: Optional[str] = None, tags: Optional[dict[str, str]] = None, params: Optional[dict[str, str]] = None, model_type: Optional[str] = None, experiment_id: Optional[str] = None, ) -> LoggedModel: """ Initialize a LoggedMo...
Initialize a LoggedModel. Creates a LoggedModel with status ``PENDING`` and no artifacts. You must add artifacts to the model and finalize it to the ``READY`` state, for example by calling a flavor-specific ``log_model()`` method such as :py:func:`mlflow.pyfunc.log_model()`. Args: name: The na...
initialize_logged_model
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def _use_logged_model(model: LoggedModel) -> Generator[LoggedModel, None, None]: """ Context manager to wrap a LoggedModel and update the model status after the context is exited. If any exception occurs, the model status is set to FAILED. Otherwise, it is set to READY. """ try: yiel...
Context manager to wrap a LoggedModel and update the model status after the context is exited. If any exception occurs, the model status is set to FAILED. Otherwise, it is set to READY.
_use_logged_model
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def create_external_model( name: Optional[str] = None, source_run_id: Optional[str] = None, tags: Optional[dict[str, str]] = None, params: Optional[dict[str, str]] = None, model_type: Optional[str] = None, experiment_id: Optional[str] = None, ) -> LoggedModel: """ Create a new LoggedMode...
Create a new LoggedModel whose artifacts are stored outside of MLflow. This is useful for tracking parameters and performance data (metrics, traces etc.) for a model, application, or generative AI agent that is not packaged using the MLflow Model format. Args: name: The name of the model. If n...
create_external_model
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def _create_logged_model( name: Optional[str] = None, source_run_id: Optional[str] = None, tags: Optional[dict[str, str]] = None, params: Optional[dict[str, str]] = None, model_type: Optional[str] = None, experiment_id: Optional[str] = None, ) -> LoggedModel: """ Create a new LoggedModel...
Create a new LoggedModel in the ``PENDING`` state. Args: name: The name of the model. If not specified, a random name will be generated. source_run_id: The ID of the run that the model is associated with. If unspecified and a run is active, the active run ID will be used...
_create_logged_model
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0
def finalize_logged_model( model_id: str, status: Union[Literal["READY", "FAILED"], LoggedModelStatus] ) -> LoggedModel: """ Finalize a model by updating its status. Args: model_id: ID of the model to finalize. status: Final status to set on the model. Returns: The updated ...
Finalize a model by updating its status. Args: model_id: ID of the model to finalize. status: Final status to set on the model. Returns: The updated model. Example: .. code-block:: python :test: import mlflow from mlflow.entities import LoggedMod...
finalize_logged_model
python
mlflow/mlflow
mlflow/tracking/fluent.py
https://github.com/mlflow/mlflow/blob/master/mlflow/tracking/fluent.py
Apache-2.0