repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
mlflow
mlflow/data/tensorflow_dataset.py
.py
import json import logging from functools import cached_property from typing import Any import numpy as np from mlflow.data.dataset import Dataset from mlflow.data.dataset_source import DatasetSource from mlflow.data.digest_utils import ( MAX_ROWS, compute_numpy_digest, get_normalized_md5_digest, ) from m...
345
13,319
mlflow
mlflow/data/uc_volume_dataset_source.py
.py
import logging from typing import Any from mlflow.data.dataset_source import DatasetSource from mlflow.exceptions import MlflowException _logger = logging.getLogger(__name__) class UCVolumeDatasetSource(DatasetSource): """Represents the source of a dataset stored in Databricks Unified Catalog Volume. If yo...
82
3,201
mlflow
mlflow/data/evaluation_dataset.py
.py
import hashlib import json import logging import math import struct import sys from packaging.version import Version import mlflow from mlflow.entities import RunTag from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.utils.string_utils import gen...
565
20,783
mlflow
mlflow/data/evaluation_dataset_source.py
.py
from typing import Any from mlflow.data.dataset_source import DatasetSource class EvaluationDatasetSource(DatasetSource): """ Represents the source of an evaluation dataset stored in MLflow's tracking store. """ def __init__(self, dataset_id: str): """ Args: dataset_id: T...
63
1,797
mlflow
mlflow/data/filesystem_dataset_source.py
.py
from abc import abstractmethod from typing import Any from mlflow.data.dataset_source import DatasetSource class FileSystemDatasetSource(DatasetSource): """ Represents the source of a dataset stored on a filesystem, e.g. a local UNIX filesystem, blob storage services like S3, etc. """ @property ...
82
2,540
mlflow
mlflow/data/http_dataset_source.py
.py
import os import re from typing import Any from urllib.parse import urlparse from mlflow.data.dataset_source import DatasetSource from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.utils.file_utils import create_tmp_dir from mlflow.utils.rest_util...
146
4,599
mlflow
mlflow/data/__init__.py
.py
import sys from contextlib import suppress from mlflow.data import dataset_registry from mlflow.data import sources as mlflow_data_sources from mlflow.data.dataset import Dataset from mlflow.data.dataset_source import DatasetSource from mlflow.data.dataset_source_registry import ( get_dataset_source_from_json, ...
78
2,559
mlflow
mlflow/data/numpy_dataset.py
.py
import json import logging from functools import cached_property from typing import Any import numpy as np from mlflow.data.dataset import Dataset from mlflow.data.dataset_source import DatasetSource from mlflow.data.digest_utils import compute_numpy_digest from mlflow.data.evaluation_dataset import EvaluationDataset...
220
8,154
mlflow
mlflow/data/pyfunc_dataset_mixin.py
.py
from abc import abstractmethod from dataclasses import dataclass from typing import TYPE_CHECKING from mlflow.data.evaluation_dataset import EvaluationDataset if TYPE_CHECKING: from mlflow.models.utils import PyFuncInput, PyFuncOutput @dataclass class PyFuncInputsOutputs: inputs: list["PyFuncInput"] out...
32
942
mlflow
mlflow/data/dataset_source_registry.py
.py
import warnings from typing import Any from mlflow.data.dataset_source import DatasetSource from mlflow.data.http_dataset_source import HTTPDatasetSource from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import RESOURCE_DOES_NOT_EXIST from mlflow.utils.plugins import get_entry_points cl...
234
8,743
mlflow
mlflow/data/schema.py
.py
from typing import Any from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.types.schema import Schema class TensorDatasetSchema: """ Represents the schema of a dataset with tensor features and targets. """ def __init__(self, feat...
77
2,650
mlflow
mlflow/data/dataset_source.py
.py
import json from abc import abstractmethod from typing import Any class DatasetSource: """ Represents the source of a dataset used in MLflow Tracking, providing information such as cloud storage location, delta table name / version, etc. """ @staticmethod @abstractmethod def _get_source_t...
111
3,550
mlflow
mlflow/data/huggingface_dataset_source.py
.py
from typing import TYPE_CHECKING, Any, Mapping, Sequence, Union from packaging.version import Version from mlflow.data.dataset_source import DatasetSource if TYPE_CHECKING: import datasets class HuggingFaceDatasetSource(DatasetSource): """Represents the source of a Hugging Face dataset used in MLflow Track...
117
4,554
mlflow
mlflow/data/pandas_dataset.py
.py
import json import logging from functools import cached_property from typing import Any import pandas as pd from mlflow.data.dataset import Dataset from mlflow.data.dataset_source import DatasetSource from mlflow.data.digest_utils import compute_pandas_digest from mlflow.data.evaluation_dataset import EvaluationDatas...
230
8,174
mlflow
mlflow/data/spark_dataset.py
.py
import json import logging from functools import cached_property from typing import TYPE_CHECKING, Any from packaging.version import Version from mlflow.data.dataset import Dataset from mlflow.data.dataset_source import DatasetSource from mlflow.data.delta_dataset_source import DeltaDatasetSource from mlflow.data.dig...
405
16,592
mlflow
mlflow/data/delta_dataset_source.py
.py
import logging from typing import Any from mlflow.data.dataset_source import DatasetSource from mlflow.exceptions import MlflowException from mlflow.protos.databricks_managed_catalog_messages_pb2 import ( GetTable, GetTableResponse, ) from mlflow.protos.databricks_managed_catalog_service_pb2 import DatabricksU...
168
5,993
mlflow
mlflow/data/dataset.py
.py
import json from abc import abstractmethod from typing import Any from mlflow.data.dataset_source import DatasetSource from mlflow.entities import Dataset as DatasetEntity class Dataset: """ Represents a dataset for use with MLflow Tracking, including the name, digest (hash), schema, and profile of the d...
127
4,237
mlflow
mlflow/data/meta_dataset.py
.py
import hashlib import json from typing import Any from mlflow.data.dataset import Dataset from mlflow.data.dataset_source import DatasetSource from mlflow.types import Schema class MetaDataset(Dataset): """Dataset that only contains metadata. This class is used to represent a dataset that only contains meta...
103
3,708
mlflow
mlflow/data/digest_utils.py
.py
import hashlib from typing import Any from packaging.version import Version from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE MAX_ROWS = 10000 def compute_pandas_digest(df) -> str: """Computes a digest for the given Pandas DataFrame. Args: ...
108
2,924
mlflow
mlflow/data/spark_dataset_source.py
.py
from typing import Any from mlflow.data.dataset_source import DatasetSource from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE class SparkDatasetSource(DatasetSource): """ Represents the source of a dataset stored in a spark table. """ def ...
75
2,110
mlflow
mlflow/data/polars_dataset.py
.py
import json import logging from functools import cached_property from inspect import isclass from typing import Any, Final, TypedDict import polars as pl from packaging.version import Version if Version(pl.__version__).major < 1: raise ImportError(f"mlflow.data.polars_dataset requires polars>=1.0.0, found {pl.__v...
358
12,087
mlflow
mlflow/transformers/peft.py
.py
""" PEFT (Parameter-Efficient Fine-Tuning) is a library for efficiently adapting large pretrained models without fine-tuning all of model parameters but only a small number of (extra) parameters. Users can define a PEFT model that wraps a Transformer model to apply a thin adapter layer on top of the base model. The PEF...
52
2,190
mlflow
mlflow/transformers/llm_inference_utils.py
.py
from __future__ import annotations import time import uuid from typing import TYPE_CHECKING, Any import numpy as np import pandas as pd from mlflow.exceptions import MlflowException from mlflow.models import ModelSignature from mlflow.protos.databricks_pb2 import BAD_REQUEST, INVALID_PARAMETER_VALUE from mlflow.tran...
469
17,406
mlflow
mlflow/transformers/model_io.py
.py
from __future__ import annotations import logging import pathlib import shutil from typing import TYPE_CHECKING, Any from mlflow.environment_variables import ( MLFLOW_HUGGINGFACE_DISABLE_ACCELERATE_FEATURES, MLFLOW_HUGGINGFACE_MODEL_MAX_SHARD_SIZE, ) from mlflow.exceptions import MlflowException from mlflow.p...
367
14,413
mlflow
mlflow/transformers/flavor_config.py
.py
from __future__ import annotations import json import os from typing import TYPE_CHECKING, Any from packaging.version import Version from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import ALREADY_EXISTS, INVALID_PARAMETER_VALUE from mlflow.transformers.peft import _PEFT_ADAPTOR_DIR_NA...
281
10,000
mlflow
mlflow/transformers/__init__.py
.py
"""MLflow module for HuggingFace/transformer support.""" from __future__ import annotations import ast import base64 import binascii import contextlib import copy import functools import importlib import json import logging import os import pathlib import re import shutil import string import sys from types import Ma...
3,236
142,668
mlflow
mlflow/transformers/signature.py
.py
import json import logging import numpy as np from mlflow.environment_variables import MLFLOW_INPUT_EXAMPLE_INFERENCE_TIMEOUT from mlflow.models.signature import ModelSignature, infer_signature from mlflow.models.utils import _contains_params from mlflow.types.schema import ColSpec, DataType, Schema, TensorSpec from ...
183
7,438
mlflow
mlflow/transformers/torch_utils.py
.py
from __future__ import annotations from typing import TYPE_CHECKING from packaging.version import Version from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE if TYPE_CHECKING: import torch _TORCH_DTYPE_KEY = "torch_dtype" # transformers 4.56.0 renamed ...
79
2,686
mlflow
mlflow/prophet/__init__.py
.py
""" The ``mlflow.prophet`` module provides an API for logging and loading Prophet models. This module exports univariate Prophet models in the following flavors: Prophet (native) format This is the main flavor that can be accessed with Prophet APIs. :py:mod:`mlflow.pyfunc` Produced for use by generic pyfunc-ba...
405
14,768
mlflow
mlflow/agno/utils.py
.py
import importlib import logging import pkgutil from agno.models.base import Model from agno.storage.base import Storage _logger = logging.getLogger(__name__) def discover_storage_backends(): # 1. Import all storage modules import agno.storage as pkg for _, modname, _ in pkgutil.iter_modules(pkg.__path_...
52
1,455
mlflow
mlflow/agno/__init__.py
.py
import inspect import logging from mlflow.telemetry.events import AutologgingEvent from mlflow.telemetry.track import _record_event from mlflow.utils.annotations import experimental as experimental from mlflow.utils.autologging_utils import autologging_integration, safe_patch FLAVOR_NAME = "agno" _logger = logging.ge...
113
4,117
mlflow
mlflow/agno/autolog_v2.py
.py
""" Autologging logic for Agno V2 (>= 2.0.0) using OpenTelemetry instrumentation. """ import importlib.metadata as _meta import logging from opentelemetry import trace from opentelemetry.context import Context from opentelemetry.trace import Tracer, TracerProvider from mlflow.exceptions import MlflowException from m...
127
4,527
mlflow
mlflow/agno/autolog_v1.py
.py
""" Autologging logic for Agno V1 using MLflow's tracing API. """ import logging from typing import Any import mlflow from mlflow.entities import SpanType from mlflow.entities.span import LiveSpan from mlflow.tracing.constant import SpanAttributeKey, TokenUsageKey from mlflow.tracing.utils import construct_full_input...
194
6,385
mlflow
mlflow/onnx/__init__.py
.py
""" The ``mlflow.onnx`` module provides APIs for logging and loading ONNX models in the MLflow Model format. This module exports MLflow Models with the following flavors: ONNX (native) format This is the main flavor that can be loaded back as an ONNX model object. :py:mod:`mlflow.pyfunc` Produced for use by ge...
613
25,827
mlflow
mlflow/models/wheeled_model.py
.py
import os import platform import shutil import subprocess import sys import yaml import mlflow from mlflow import MlflowClient from mlflow.environment_variables import MLFLOW_WHEELED_MODEL_PIP_DOWNLOAD_OPTIONS from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import BAD_REQUEST from mlfl...
318
13,312
mlflow
mlflow/models/flavor_backend.py
.py
from abc import ABCMeta, abstractmethod from mlflow.utils.annotations import developer_stable @developer_stable class FlavorBackend: """ Abstract class for Flavor Backend. This class defines the API interface for local model deployment of MLflow model flavors. """ __metaclass__ = ABCMeta de...
104
3,321
mlflow
mlflow/models/utils.py
.py
import base64 import datetime as dt import decimal import importlib import json import logging import os import re import shutil import sys import tempfile import uuid from contextlib import contextmanager from copy import deepcopy from pathlib import Path from typing import Any, Dict, List, Union import numpy as np i...
2,077
84,552
mlflow
mlflow/models/model_config.py
.py
import os from typing import Any import yaml from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE __mlflow_model_config__ = None class ModelConfig: """ ModelConfig used in code to read a YAML configuration file or a dictionary. Args: de...
151
5,072
mlflow
mlflow/models/python_api.py
.py
import logging import os import shutil from io import StringIO from typing import ForwardRef, get_args, get_origin from mlflow.exceptions import MlflowException from mlflow.models.flavor_backend_registry import get_flavor_backend from mlflow.utils import env_manager as _EnvManager from mlflow.utils.databricks_utils im...
379
16,191
mlflow
mlflow/models/model.py
.py
import json import logging import os import shutil import uuid from datetime import datetime, timezone from pathlib import Path from pprint import pformat from typing import Any, Callable, Literal, NamedTuple from urllib.parse import urlparse import yaml from packaging.requirements import InvalidRequirement, Requireme...
1,661
68,804
mlflow
mlflow/models/dependencies_schemas.py
.py
import json import logging import warnings from abc import ABC, abstractmethod from contextlib import contextmanager from dataclasses import dataclass, field from enum import Enum from typing import TYPE_CHECKING, Any if TYPE_CHECKING: from mlflow.models.model import Model _logger = logging.getLogger(__name__) ...
298
10,208
mlflow
mlflow/models/flavor_backend_registry.py
.py
""" Registry of supported flavor backends. Contains a mapping of flavors to flavor backends. This mapping is used to select suitable flavor when deploying generic MLflow models. Flavor backend can deploy particular flavor locally to generate predictions, deploy as a local REST api endpoint, or build a docker image for...
54
2,094
mlflow
mlflow/models/docker_utils.py
.py
import logging import os import subprocess from subprocess import Popen from typing import Literal from urllib.parse import urlparse from packaging.version import Version from mlflow.environment_variables import MLFLOW_DOCKER_OPENJDK_VERSION from mlflow.utils import env_manager as em from mlflow.utils.file_utils impo...
230
8,519
mlflow
mlflow/models/__init__.py
.py
""" The ``mlflow.models`` module provides an API for saving machine learning models in "flavors" that can be understood by different downstream tools. The built-in flavors are: - :py:mod:`mlflow.catboost` - :py:mod:`mlflow.dspy` - :py:mod:`mlflow.h2o` - :py:mod:`mlflow.langchain` - :py:mod:`mlflow.lightgbm` - :py:mod...
97
2,702
mlflow
mlflow/models/signature.py
.py
""" The :py:mod:`mlflow.models.signature` module provides an API for specification of model signature. Model signature defines schema of model input and output. See :py:class:`mlflow.types.schema.Schema` for more details on Schema and data types. """ import inspect import logging import re import warnings from copy i...
650
25,444
mlflow
mlflow/models/auth_policy.py
.py
from mlflow.models.resources import Resource, _ResourceBuilder class UserAuthPolicy: """ A minimal list of scopes that the user should have access to in order to invoke this model Note: This is only compatible with Databricks Environment currently. TODO: Add Databricks Documentation for User Auth...
80
2,305
mlflow
mlflow/models/rag_signatures.py
.py
from dataclasses import dataclass, field from mlflow.models import ModelSignature from mlflow.types.schema import ( Array, ColSpec, DataType, Object, Property, Schema, ) from mlflow.utils.annotations import deprecated @deprecated("mlflow.types.llm.ChatMessage") @dataclass class Message: r...
118
3,091
mlflow
mlflow/models/display_utils.py
.py
import html from pathlib import Path from mlflow.models.model import ModelInfo from mlflow.models.signature import ModelSignature from mlflow.types import schema from mlflow.utils import databricks_utils def _is_input_string(inputs: schema.Schema) -> bool: return ( not inputs.has_input_names() an...
159
5,346
mlflow
mlflow/models/cli.py
.py
import logging import click from mlflow.mcp.decorator import mlflow_mcp from mlflow.models import python_api from mlflow.models.flavor_backend_registry import get_flavor_backend from mlflow.models.model import update_model_requirements from mlflow.utils import cli_args from mlflow.utils import env_manager as _EnvMana...
354
12,849
mlflow
mlflow/models/resources.py
.py
import os from abc import ABC, abstractmethod from enum import Enum from typing import Any import yaml DEFAULT_API_VERSION = "1" class ResourceType(Enum): """ Enum to define the different types of resources needed to serve a model. """ UC_CONNECTION = "uc_connection" VECTOR_SEARCH_INDEX = "vect...
342
12,220
mlflow
mlflow/models/notebook_resources/eval_with_dataset_example.py
.py
# ruff: noqa: F821, I001 {{pipInstall}} import pandas as pd import mlflow evals = [ { "request": { "messages": [ {"role": "user", "content": "How do I convert a Spark DataFrame to Pandas?"} ], }, # Optional, needed for judging correctness. "e...
23
574
mlflow
mlflow/models/notebook_resources/eval_with_synthetic_example.py
.py
# ruff: noqa: F821, I001 {{pipInstall}} from databricks.agents.evals import generate_evals_df import mlflow agent_description = "A chatbot that answers questions about Databricks." question_guidelines = """ # User personas - A developer new to the Databricks platform # Example questions - What API lets me parallelize...
23
730
mlflow
mlflow/models/container/__init__.py
.py
""" Initialize the environment and start model serving in a Docker container. To be executed only during the model deployment. """ import logging import multiprocessing import os import shlex import shutil import signal import sys from pathlib import Path from subprocess import Popen, check_call import mlflow from ...
256
9,006
mlflow
mlflow/models/evaluation/default_evaluator.py
.py
import copy import inspect import json import logging import pathlib import pickle import shutil import tempfile import traceback from abc import abstractmethod from typing import Any, Callable, NamedTuple, Optional import numpy as np import pandas as pd import mlflow from mlflow import MlflowClient, MlflowException ...
984
41,785
mlflow
mlflow/models/evaluation/evaluator_registry.py
.py
import warnings from mlflow.exceptions import MlflowException from mlflow.utils.import_hooks import register_post_import_hook from mlflow.utils.plugins import get_entry_points class ModelEvaluatorRegistry: """ Scheme-based registry for model evaluator implementations """ def __init__(self): ...
81
3,014
mlflow
mlflow/models/evaluation/__init__.py
.py
from mlflow.data.evaluation_dataset import EvaluationDataset from mlflow.models.evaluation.base import ( EvaluationArtifact, EvaluationMetric, EvaluationResult, ModelEvaluator, evaluate, list_evaluators, make_metric, ) from mlflow.models.evaluation.validation import MetricThreshold __all__ ...
24
528
mlflow
mlflow/models/evaluation/lift_curve.py
.py
import matplotlib.pyplot as plt import numpy as np def _cumulative_gain_curve(y_true, y_score, pos_label=None): """ This method is copied from scikit-plot package. See https://github.com/reiinakano/scikit-plot/blob/2dd3e6a76df77edcbd724c4db25575f70abb57cb/scikitplot/helpers.py#L157 This function gene...
179
6,165
mlflow
mlflow/models/evaluation/calibration_curve.py
.py
import matplotlib.pyplot as plt import numpy as np from matplotlib.figure import Figure from sklearn.calibration import CalibrationDisplay, calibration_curve def make_multi_class_calibration_plot( n_classes, y_true, y_probs, calibration_config, label_list ) -> Figure: """Generate one calibration plot for all ...
113
4,277
mlflow
mlflow/models/evaluation/artifacts.py
.py
import json import pathlib import pickle from json import JSONDecodeError from typing import NamedTuple import matplotlib.pyplot as plt import numpy as np import pandas as pd from mlflow.environment_variables import MLFLOW_ALLOW_PICKLE_DESERIALIZATION from mlflow.exceptions import MlflowException from mlflow.models.e...
204
7,197
mlflow
mlflow/models/evaluation/deprecated.py
.py
import functools import warnings from mlflow.models.evaluation import evaluate as model_evaluate @functools.wraps(model_evaluate) def evaluate(*args, **kwargs): warnings.warn( "The `mlflow.evaluate` API has been deprecated as of MLflow 3.0.0. " "Please use these new alternatives:\n\n" " -...
20
767
mlflow
mlflow/models/evaluation/base.py
.py
import inspect import json import keyword import logging import os import pathlib import signal import urllib.parse from abc import ABCMeta, abstractmethod from contextlib import contextmanager, nullcontext from dataclasses import dataclass from inspect import Parameter, Signature from types import FunctionType from ty...
1,812
81,237
mlflow
mlflow/models/evaluation/_shap_patch.py
.py
import pickle import shap from shap._serializable import Deserializer, Serializable, Serializer class _PatchedKernelExplainer(shap.KernelExplainer): def save(self, out_file, model_saver=None, masker_saver=None): """ This patched `save` method fix `KernelExplainer.save`. Issues in original...
52
2,548
mlflow
mlflow/models/evaluation/validation.py
.py
import logging import operator import os from decimal import Decimal from mlflow.exceptions import MlflowException from mlflow.models.evaluation import EvaluationResult from mlflow.protos.databricks_pb2 import BAD_REQUEST, INVALID_PARAMETER_VALUE _logger = logging.getLogger(__name__) class MetricThreshold: """ ...
434
18,147
mlflow
mlflow/models/evaluation/evaluators/default.py
.py
import logging import os import time from typing import Optional import numpy as np import pandas as pd import mlflow from mlflow.entities.metric import Metric from mlflow.exceptions import MlflowException from mlflow.metrics import ( MetricValue, ari_grade_level, exact_match, flesch_kincaid_grade_lev...
237
8,493
mlflow
mlflow/models/evaluation/evaluators/classifier.py
.py
import logging import math from contextlib import contextmanager from typing import Any, Callable, NamedTuple, Optional import numpy as np import pandas as pd from sklearn import metrics as sk_metrics import mlflow from mlflow import MlflowException from mlflow.environment_variables import _MLFLOW_EVALUATE_SUPPRESS_C...
712
26,949
mlflow
mlflow/models/evaluation/evaluators/regressor.py
.py
from typing import Optional import numpy as np from sklearn import metrics as sk_metrics import mlflow from mlflow.models.evaluation.base import EvaluationMetric, EvaluationResult, _ModelType from mlflow.models.evaluation.default_evaluator import ( BuiltInEvaluator, _extract_output_and_other_columns, _ext...
97
3,342
mlflow
mlflow/models/evaluation/evaluators/shap.py
.py
import functools import logging from typing import Optional import numpy as np from packaging.version import Version from sklearn.pipeline import Pipeline as sk_Pipeline import mlflow from mlflow import MlflowException from mlflow.models.evaluation.base import EvaluationMetric, EvaluationResult, _ModelType from mlflo...
292
11,879
mlflow
mlflow/models/evaluation/utils/metric.py
.py
import logging from dataclasses import dataclass from typing import Any, Callable import numpy as np from mlflow.metrics.base import MetricValue from mlflow.models.evaluation.base import EvaluationMetric _logger = logging.getLogger(__name__) @dataclass class MetricDefinition: """ A dataclass representing a...
129
4,532
mlflow
mlflow/models/evaluation/utils/trace.py
.py
import contextlib import inspect import logging from typing import Any, Callable from mlflow.ml_package_versions import FLAVOR_TO_MODULE_NAME from mlflow.utils.autologging_utils import ( AUTOLOGGING_INTEGRATIONS, autologging_conf_lock, get_autolog_function, is_autolog_supported, ) from mlflow.utils.aut...
180
8,278
mlflow
mlflow/azure/client.py
.py
""" This module provides utilities for performing Azure Blob Storage operations without requiring the heavyweight azure-storage-blob library dependency """ import logging import urllib from copy import deepcopy from mlflow.utils import rest_utils from mlflow.utils.file_utils import read_chunk _logger = logging.getLo...
320
11,509
mlflow
mlflow/projects/env_type.py
.py
DOCKER = "docker_env" PYTHON = "python_env" CONDA = "conda_env" ALL = [DOCKER, PYTHON, CONDA]
5
94
mlflow
mlflow/projects/utils.py
.py
import logging import os import pathlib import re import shutil import tempfile import urllib.parse import zipfile from io import BytesIO from mlflow import tracking from mlflow.entities import Param, SourceType from mlflow.environment_variables import MLFLOW_EXPERIMENT_ID, MLFLOW_RUN_ID, MLFLOW_TRACKING_URI from mlfl...
351
12,649
mlflow
mlflow/projects/databricks.py
.py
import hashlib import json import logging import os import posixpath import re import tempfile import textwrap import time import uuid from pathlib import Path from shlex import quote from mlflow import tracking from mlflow.entities import RunStatus from mlflow.environment_variables import MLFLOW_EXPERIMENT_ID, MLFLOW...
612
24,796
mlflow
mlflow/projects/_project_spec.py
.py
"""Internal utilities for parsing MLproject YAML files.""" import os import yaml from mlflow.exceptions import ExecutionException, MlflowException from mlflow.projects import env_type from mlflow.tracking import artifact_utils from mlflow.utils import data_utils from mlflow.utils.environment import _PYTHON_ENV_FILE_...
374
15,108
mlflow
mlflow/projects/submitted_run.py
.py
import logging import os import signal from abc import abstractmethod from mlflow.entities import RunStatus from mlflow.utils.annotations import developer_stable _logger = logging.getLogger(__name__) @developer_stable class SubmittedRun: """ Wrapper around an MLflow project run (e.g. a subprocess running an...
107
3,529
mlflow
mlflow/projects/kubernetes.py
.py
import logging import os import time from datetime import datetime from shlex import quote, split from threading import RLock import docker import kubernetes from kubernetes.config.config_exception import ConfigException from mlflow.entities import RunStatus from mlflow.exceptions import ExecutionException from mlflo...
166
6,363
mlflow
mlflow/projects/__init__.py
.py
""" The ``mlflow.projects`` module provides an API for running MLflow projects locally or remotely. """ import json import logging import os import yaml import mlflow.projects.databricks from mlflow import tracking from mlflow.entities import RunStatus from mlflow.exceptions import ExecutionException, MlflowExceptio...
448
17,350
mlflow
mlflow/projects/docker.py
.py
import logging import os import posixpath import shutil import subprocess import tempfile import urllib.parse import urllib.request import docker from mlflow import tracking from mlflow.environment_variables import MLFLOW_TRACKING_URI from mlflow.exceptions import ExecutionException from mlflow.projects.utils import ...
168
6,305
mlflow
mlflow/projects/backend/abstract_backend.py
.py
from abc import ABCMeta, abstractmethod from mlflow.utils.annotations import developer_stable @developer_stable class AbstractBackend: """ Abstract plugin class defining the interface needed to execute MLflow projects. You can define subclasses of ``AbstractBackend`` and expose them as third-party plugin...
51
2,113
mlflow
mlflow/projects/backend/__init__.py
.py
""" This module defines developer APIs for defining pluggable execution backends for MLflow projects. See `MLflow Plugins <../../plugins.html>`_ for more information. """ from mlflow.projects.backend.abstract_backend import AbstractBackend __all__ = ["AbstractBackend"]
9
272
mlflow
mlflow/projects/backend/loader.py
.py
import logging from mlflow.projects.backend.local import LocalBackend from mlflow.utils.plugins import get_entry_points ENTRYPOINT_GROUP_NAME = "mlflow.project_backend" _logger = logging.getLogger(__name__) # Statically register backend defined in mlflow MLFLOW_BACKENDS = { "local": LocalBackend, } def load_...
36
932
mlflow
mlflow/projects/backend/local.py
.py
import logging import os import platform import posixpath import subprocess import sys from pathlib import Path import mlflow from mlflow import tracking from mlflow.environment_variables import ( MLFLOW_KERBEROS_TICKET_CACHE, MLFLOW_KERBEROS_USER, MLFLOW_PYARROW_EXTRA_CONF, ) from mlflow.exceptions import...
429
17,192
mlflow
mlflow/types/utils.py
.py
import logging import warnings from collections import defaultdict from copy import deepcopy from typing import Any, Dict, List import numpy as np import pandas as pd import pydantic from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.types import...
742
27,468
mlflow
mlflow/types/responses.py
.py
import json from collections.abc import Sequence from itertools import tee from typing import Any, Generator, Iterator from uuid import uuid4 from pydantic import BaseModel, ConfigDict, model_validator from mlflow.types.agent import ChatContext from mlflow.types.responses_helpers import ( BaseRequestPayload, ...
567
21,457
mlflow
mlflow/types/__init__.py
.py
""" The :py:mod:`mlflow.types` module defines data types and utilities to be used by other mlflow components to describe interface independent of other frameworks or languages. """ from mlflow.version import IS_TRACING_SDK_ONLY if not IS_TRACING_SDK_ONLY: try: import numpy as _np # noqa: F401 _H...
38
949
mlflow
mlflow/types/chat.py
.py
from __future__ import annotations import warnings from typing import Annotated, Any, Literal from uuid import uuid4 from pydantic import BaseModel, ConfigDict, Field, model_serializer class TextContentPart(BaseModel): type: Literal["text"] text: str class ImageUrl(BaseModel): """ Represents an im...
369
11,530
mlflow
mlflow/types/llm.py
.py
from __future__ import annotations import time import uuid from dataclasses import asdict, dataclass, field, fields from typing import Any, Literal from mlflow.types.schema import AnyType, Array, ColSpec, DataType, Map, Object, Property, Schema # TODO: Switch to pydantic in a future version of MLflow. # For no...
952
37,735
mlflow
mlflow/types/type_hints.py
.py
import base64 import logging from datetime import datetime from functools import lru_cache from types import UnionType from typing import Any, NamedTuple, Optional, TypeVar, Union, get_args, get_origin import pydantic import pydantic.fields from mlflow.environment_variables import _MLFLOW_IS_IN_SERVING_ENVIRONMENT fr...
633
24,613
mlflow
mlflow/types/schema.py
.py
from __future__ import annotations import builtins import datetime as dt import json import string from abc import ABC, abstractmethod from copy import deepcopy from dataclasses import is_dataclass from enum import Enum from types import UnionType from typing import Any, TypedDict, Union, get_args, get_origin import ...
1,518
56,238
mlflow
mlflow/types/agent.py
.py
from typing import Any from pydantic import ConfigDict, model_validator from mlflow.types.chat import BaseModel, ChatUsage, ToolCall from mlflow.types.llm import ( _custom_inputs_col_spec, _custom_outputs_col_spec, _token_usage_stats_col_spec, ) from mlflow.types.schema import ( Array, ColSpec, ...
236
9,118
mlflow
mlflow/types/responses_helpers.py
.py
import warnings from typing import Any from pydantic import BaseModel, ConfigDict, Field, model_validator """ Classes are inspired by classes for Response and ResponseStreamEvent in openai-python https://github.com/openai/openai-python/blob/ed53107e10e6c86754866b48f8bd862659134ca8/src/openai/types/responses/response...
430
12,574
mlflow
mlflow/claude_code/__init__.py
.py
"""Claude Code integration for MLflow. This module provides automatic tracing of Claude Code conversations to MLflow. Usage: mlflow autolog claude [directory] [options] After setup, use the regular 'claude' command and traces will be automatically captured. To enable tracing for the Claude Agent SDK, use `mlflo...
27
644
mlflow
mlflow/claude_code/hooks.py
.py
"""Legacy compatibility helpers for the retired Python Claude hook runtime.""" import json import sys from mlflow.claude_code.tracing import get_hook_response def stop_hook_handler() -> None: """No-op shim for repositories still wired to the old Python hook.""" print(json.dumps(get_hook_response())) # noqa...
17
531
mlflow
mlflow/claude_code/tracing.py
.py
"""MLflow tracing integration for Claude Code interactions.""" import dataclasses import json import logging import os import sys from datetime import datetime from pathlib import Path from typing import Any import dateutil.parser import mlflow from mlflow.claude_code.config import ( MLFLOW_TRACING_ENABLED, ...
882
32,646
mlflow
mlflow/claude_code/cli.py
.py
"""MLflow CLI commands for Claude Code integration.""" import os import sys from pathlib import Path import click from mlflow.claude_code.config import get_tracing_status, setup_environment_config from mlflow.claude_code.hooks import stop_hook_handler from mlflow.claude_code.plugin import ( disable_tracing_plugi...
353
11,286
mlflow
mlflow/claude_code/config.py
.py
"""Configuration management for Claude Code integration with MLflow.""" import json import os from dataclasses import dataclass from pathlib import Path from typing import Any from mlflow.environment_variables import ( MLFLOW_EXPERIMENT_ID, MLFLOW_EXPERIMENT_NAME, MLFLOW_TRACKING_URI, ) # Configuration f...
193
6,366
mlflow
mlflow/claude_code/plugin.py
.py
"""Plugin bootstrap helpers for Claude Code tracing.""" from __future__ import annotations import shutil import subprocess from pathlib import Path from typing import Any import click from mlflow.claude_code.config import ( ENVIRONMENT_FIELD, MLFLOW_EXPERIMENT_ID, MLFLOW_EXPERIMENT_NAME, MLFLOW_TRAC...
109
2,768
mlflow
mlflow/pmdarima/__init__.py
.py
""" The ``mlflow.pmdarima`` module provides an API for logging and loading ``pmdarima`` models. This module exports univariate ``pmdarima`` models in the following formats: Pmdarima format Serialized instance of a ``pmdarima`` model using pickle. :py:mod:`mlflow.pyfunc` Produced for use by generic pyfunc-based...
651
23,878
mlflow
mlflow/crewai/__init__.py
.py
""" The ``mlflow.crewai`` module provides an API for tracing CrewAI AI agents. """ import importlib import logging from packaging.version import Version from mlflow.crewai.autolog import ( patched_class_call, patched_native_tool_call, patched_standalone_call, ) from mlflow.telemetry.events import Autolog...
126
4,681
mlflow
mlflow/crewai/autolog.py
.py
import inspect import json import logging import warnings from contextlib import contextmanager, nullcontext from typing import Any from packaging.version import Version import mlflow from mlflow.entities import SpanType from mlflow.entities.span import LiveSpan from mlflow.tracing.constant import SpanAttributeKey, T...
481
16,629