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/gateway/providers/portkey.py
.py
from mlflow.gateway.config import PortkeyConfig from mlflow.gateway.providers.openai_compatible import OpenAICompatibleProvider class PortkeyProvider(OpenAICompatibleProvider): DISPLAY_NAME = "Portkey" CONFIG_TYPE = PortkeyConfig DEFAULT_API_BASE = "https://api.portkey.ai/v1" @property def header...
44
2,203
mlflow
mlflow/gateway/providers/groq.py
.py
from mlflow.gateway.config import _OpenAICompatibleConfig from mlflow.gateway.providers.openai_compatible import OpenAICompatibleProvider class GroqProvider(OpenAICompatibleProvider): DISPLAY_NAME = "Groq" CONFIG_TYPE = _OpenAICompatibleConfig DEFAULT_API_BASE = "https://api.groq.com/openai/v1"
9
310
mlflow
mlflow/gateway/providers/databricks.py
.py
from collections.abc import AsyncIterable from typing import Any from mlflow.gateway.base_models import ConfigModel from mlflow.gateway.config import EndpointConfig, EndpointType from mlflow.gateway.providers.base import PassthroughAction from mlflow.gateway.providers.openai_compatible import ( OpenAICompatibleAda...
167
6,518
mlflow
mlflow/gateway/providers/xai.py
.py
from mlflow.gateway.config import _OpenAICompatibleConfig from mlflow.gateway.providers.openai_compatible import OpenAICompatibleProvider class XAIProvider(OpenAICompatibleProvider): DISPLAY_NAME = "xAI" CONFIG_TYPE = _OpenAICompatibleConfig DEFAULT_API_BASE = "https://api.x.ai/v1"
9
297
mlflow
mlflow/gateway/providers/mlflow.py
.py
import time from pydantic import BaseModel, StrictFloat, StrictStr, ValidationError, field_validator from mlflow.gateway.config import EndpointConfig, MlflowModelServingConfig from mlflow.gateway.constants import MLFLOW_SERVING_RESPONSE_KEY from mlflow.gateway.exceptions import AIGatewayException from mlflow.gateway....
240
8,780
mlflow
mlflow/gateway/providers/bedrock.py
.py
import asyncio import json import queue import time from enum import Enum from typing import Any, AsyncIterable from mlflow.gateway.config import ( AmazonBedrockConfig, AWSBearerToken, AWSIdAndKey, AWSRole, EndpointConfig, ) from mlflow.gateway.constants import ( MLFLOW_AI_GATEWAY_ANTHROPIC_DEF...
756
28,695
mlflow
mlflow/gateway/providers/__init__.py
.py
from mlflow.gateway.config import Provider from mlflow.gateway.providers.base import BaseProvider def get_provider(provider: Provider) -> type[BaseProvider]: from mlflow.gateway.provider_registry import provider_registry return provider_registry.get(provider)
9
271
mlflow
mlflow/gateway/providers/anthropic.py
.py
import json import logging import time from typing import Any, AsyncIterable from mlflow.gateway.config import AnthropicConfig, EndpointConfig from mlflow.gateway.constants import ( MLFLOW_AI_GATEWAY_ANTHROPIC_DEFAULT_MAX_TOKENS, MLFLOW_AI_GATEWAY_ANTHROPIC_MAXIMUM_MAX_TOKENS, ) from mlflow.gateway.exceptions ...
824
32,274
mlflow
mlflow/gateway/providers/mistral.py
.py
import json import time from collections.abc import AsyncIterable from typing import Any from mlflow.gateway.config import EndpointConfig, MistralConfig from mlflow.gateway.providers.base import BaseProvider, ProviderAdapter from mlflow.gateway.providers.utils import send_request, send_stream_request from mlflow.gatew...
299
10,553
mlflow
mlflow/gateway/providers/openai_compatible.py
.py
""" Base provider for OpenAI-compatible APIs. Many LLM providers (Groq, DeepSeek, xAI, etc.) expose APIs that follow the OpenAI chat/completions/embeddings format. This module provides a reusable base class so that adding a new such provider requires only a config class, a DISPLAY_NAME, and a default base URL. """ fr...
386
13,935
mlflow
mlflow/gateway/providers/palm.py
.py
import time import warnings from typing import Any from mlflow.gateway.config import EndpointConfig, PaLMConfig from mlflow.gateway.exceptions import AIGatewayException from mlflow.gateway.providers.base import BaseProvider from mlflow.gateway.providers.utils import rename_payload_keys, send_request from mlflow.gatewa...
230
8,158
mlflow
mlflow/gateway/providers/ollama.py
.py
from mlflow.gateway.config import _OpenAICompatibleConfig from mlflow.gateway.providers.openai_compatible import OpenAICompatibleProvider class OllamaConfig(_OpenAICompatibleConfig): # Ollama runs locally and doesn't require an API key by default api_key: str = "ollama" class OllamaProvider(OpenAICompatible...
21
771
mlflow
mlflow/gateway/providers/togetherai.py
.py
import json from typing import Any, AsyncGenerator, AsyncIterable from mlflow.exceptions import MlflowException from mlflow.gateway.config import EndpointConfig, TogetherAIConfig from mlflow.gateway.exceptions import AIGatewayException from mlflow.gateway.providers.base import BaseProvider, ProviderAdapter from mlflow...
452
17,148
mlflow
mlflow/gateway/providers/cohere.py
.py
import json import time import warnings from typing import Any, AsyncGenerator, AsyncIterable from mlflow.gateway.config import CohereConfig, EndpointConfig from mlflow.gateway.exceptions import AIGatewayException from mlflow.gateway.providers.base import BaseProvider, ProviderAdapter from mlflow.gateway.providers.uti...
465
16,252
mlflow
mlflow/gateway/providers/ai21labs.py
.py
import time from mlflow.gateway.config import AI21LabsConfig, EndpointConfig from mlflow.gateway.exceptions import AIGatewayException from mlflow.gateway.providers.base import BaseProvider from mlflow.gateway.providers.utils import rename_payload_keys, send_request from mlflow.gateway.schemas import completions clas...
93
3,351
mlflow
mlflow/gateway/providers/openrouter.py
.py
from mlflow.gateway.config import _OpenAICompatibleConfig from mlflow.gateway.providers.openai_compatible import OpenAICompatibleProvider class OpenRouterProvider(OpenAICompatibleProvider): DISPLAY_NAME = "OpenRouter" CONFIG_TYPE = _OpenAICompatibleConfig DEFAULT_API_BASE = "https://openrouter.ai/api/v1"
9
320
mlflow
mlflow/gateway/providers/huggingface.py
.py
import time from typing import Any from mlflow.gateway.config import EndpointConfig, HuggingFaceTextGenerationInferenceConfig from mlflow.gateway.exceptions import AIGatewayException from mlflow.gateway.providers.base import BaseProvider from mlflow.gateway.providers.utils import ( rename_payload_keys, send_re...
121
4,810
mlflow
mlflow/gateway/providers/litellm.py
.py
from __future__ import annotations import importlib.util import json from typing import Any, AsyncIterable from mlflow.exceptions import MlflowException from mlflow.gateway.config import EndpointConfig, LiteLLMConfig from mlflow.gateway.providers.anthropic import _normalize_anthropic_input_tokens from mlflow.gateway....
597
24,036
mlflow
mlflow/gateway/providers/base.py
.py
from abc import ABC, abstractmethod from enum import Enum from typing import Any, AsyncIterable import numpy as np import mlflow from mlflow.entities import SpanType from mlflow.entities.gateway_endpoint import FallbackStrategy from mlflow.exceptions import MlflowException from mlflow.gateway.base_models import Confi...
896
35,606
mlflow
mlflow/gateway/providers/deepseek.py
.py
from mlflow.gateway.config import _OpenAICompatibleConfig from mlflow.gateway.providers.openai_compatible import OpenAICompatibleProvider class DeepSeekProvider(OpenAICompatibleProvider): DISPLAY_NAME = "DeepSeek" CONFIG_TYPE = _OpenAICompatibleConfig DEFAULT_API_BASE = "https://api.deepseek.com/v1"
9
315
mlflow
mlflow/xgboost/__init__.py
.py
""" The ``mlflow.xgboost`` module provides an API for logging and loading XGBoost models. This module exports XGBoost models with the following flavors: XGBoost (native) format This is the main flavor that can be loaded back into XGBoost. :py:mod:`mlflow.pyfunc` Produced for use by generic pyfunc-based deploym...
924
38,561
mlflow
mlflow/xgboost/_autolog.py
.py
import logging import xgboost from packaging.version import Version # Suppress a false positive pylint error: https://github.com/PyCQA/pylint/issues/1630 from mlflow.utils.autologging_utils import ExceptionSafeAbstractClass _logger = logging.getLogger(__name__) def _patch_metric_names(metric_dict): # XGBoost p...
74
2,774
mlflow
mlflow/sklearn/utils.py
.py
import inspect import logging import pkgutil import platform import warnings from copy import deepcopy from importlib import import_module from numbers import Number from operator import itemgetter from typing import Any, Callable, NamedTuple import numpy as np from packaging.version import Version from mlflow import...
1,037
38,418
mlflow
mlflow/sklearn/__init__.py
.py
""" The ``mlflow.sklearn`` module provides an API for logging and loading scikit-learn models. This module exports scikit-learn models with the following flavors: Python (native) `pickle <https://scikit-learn.org/stable/modules/model_persistence.html>`_ format This is the main flavor that can be loaded back into s...
2,100
90,635
mlflow
mlflow/assistant/types.py
.py
import json from enum import Enum from typing import Any, Literal from pydantic import BaseModel, Field # Message interface between assistant providers and the assistant client # Inspired by https://github.com/anthropics/claude-agent-sdk-python/blob/29c12cd80b256e88f321b2b8f1f5a88445077aa5/src/claude_agent_sdk/types....
138
4,369
mlflow
mlflow/assistant/gateway_connection.py
.py
"""Store Assistant-managed vendor keys as Gateway LLM Connections.""" from mlflow.entities.gateway_endpoint import GatewayEndpointModelConfig, GatewayModelLinkageType from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import RESOURCE_DOES_NOT_EXIST, ErrorCode from mlflow.tracking._tracking...
79
2,774
mlflow
mlflow/assistant/__init__.py
.py
from functools import lru_cache from mlflow.assistant.config import AssistantConfig @lru_cache(maxsize=100) def get_project_path(experiment_id: str) -> str | None: """Get the project path for a given experiment ID. Args: experiment_id: The experiment ID to look up. Returns: The project ...
26
668
mlflow
mlflow/assistant/skill_installer.py
.py
""" Manage skill installation Skills are maintained in the mlflow/assistant/skills subtree in the MLflow repository, which points to the https://github.com/mlflow/skills repository. """ import shutil from dataclasses import dataclass from importlib import resources from pathlib import Path from mlflow.ai_commands.ai...
107
3,239
mlflow
mlflow/assistant/cli.py
.py
"""MLflow CLI commands for Assistant integration.""" import sys import threading import time from pathlib import Path import click from mlflow.assistant.config import AssistantConfig, ProjectConfig, SkillsConfig from mlflow.assistant.providers import AssistantProvider, list_providers from mlflow.assistant.providers....
518
17,346
mlflow
mlflow/assistant/config.py
.py
from pathlib import Path from typing import Literal from pydantic import BaseModel, Field MLFLOW_ASSISTANT_HOME = Path.home() / ".mlflow" / "assistant" CONFIG_PATH = MLFLOW_ASSISTANT_HOME / "config.json" class PermissionsConfig(BaseModel): """Permission settings for the assistant provider.""" allow_edit_fi...
165
5,344
mlflow
mlflow/assistant/custom_view.py
.py
"""Custom View delivery for structured-output providers (Claude Code and Codex). This module converts a structured response envelope into a terminal ``client_tool_call``. Native-tool providers use ``tool_executor`` instead. """ import json import uuid from typing import Any, Literal from pydantic import BaseModel, C...
159
6,001
mlflow
mlflow/assistant/providers/claude_code.py
.py
""" Claude Code provider for MLflow Assistant. This module provides the Claude Code integration for the assistant API, enabling AI-powered trace analysis through the Claude Code CLI. """ import asyncio import json import logging import os import shutil import subprocess import tempfile from pathlib import Path from t...
852
38,926
mlflow
mlflow/assistant/providers/__init__.py
.py
import logging from mlflow.assistant.providers.base import AssistantProvider from mlflow.assistant.providers.claude_code import ClaudeCodeProvider from mlflow.assistant.providers.codex import CodexProvider from mlflow.assistant.providers.mlflow_gateway import MlflowGatewayProvider from mlflow.assistant.providers.ollam...
62
1,851
mlflow
mlflow/assistant/providers/mlflow_gateway.py
.py
"""MLflow AI Gateway preset of the OpenAI-compatible assistant provider.""" import logging from typing import ClassVar from mlflow.assistant.providers.openai_compatible import OpenAICompatibleProvider _logger = logging.getLogger(__name__) class MlflowGatewayProvider(OpenAICompatibleProvider): """OpenAI-compati...
63
2,330
mlflow
mlflow/assistant/providers/codex.py
.py
import asyncio import json import logging import os import shutil import subprocess import tempfile from pathlib import Path from typing import Any, AsyncGenerator, Callable, Literal from mlflow.assistant.custom_view import ( STRINGIFIED_CUSTOM_VIEW_RESPONSE_SCHEMA, STRINGIFIED_CUSTOM_VIEW_STRUCTURED_OUTPUT_IN...
382
14,206
mlflow
mlflow/assistant/providers/openai_compatible.py
.py
"""Generic OpenAI-compatible chat-completions provider for MLflow Assistant. Drives any server that exposes `POST /v1/chat/completions` in OpenAI SSE form: MLflow AI Gateway, Ollama (via its `/v1` shim), vLLM, LM Studio, etc. :class:`OpenAICompatibleProvider` owns the shared streaming/tool-loop machinery. Concrete pr...
779
36,964
mlflow
mlflow/assistant/providers/ollama.py
.py
"""Ollama preset of the OpenAI-compatible assistant provider.""" from typing import ClassVar import requests from mlflow.assistant.providers.openai_compatible import OpenAICompatibleProvider class OllamaProvider(OpenAICompatibleProvider): """OpenAI-compatible provider for a locally running Ollama server.""" ...
39
1,563
mlflow
mlflow/assistant/providers/prompts.py
.py
"""Shared system prompt for MLflow assistant providers.""" ASSISTANT_SYSTEM_PROMPT = """\ You are an MLflow assistant helping users with their MLflow projects. Users interact with you through the MLflow UI. You can answer questions about MLflow, read and analyze data from MLflow, integrate MLflow with a codebase, run ...
344
14,632
mlflow
mlflow/assistant/providers/tool_executor.py
.py
import asyncio import logging import os import shlex from pathlib import Path from typing import Any from mlflow.assistant.config import PermissionsConfig from mlflow.assistant.custom_view import RENDER_CUSTOM_VIEW_TOOL_NAME _logger = logging.getLogger(__name__) _FILE_TOOLS = {"Read", "Write", "Edit"} # Restricted m...
308
11,421
mlflow
mlflow/assistant/providers/base.py
.py
from abc import ABC, abstractmethod from functools import lru_cache from pathlib import Path from typing import Any, AsyncGenerator, Callable, Literal from mlflow.assistant.config import AssistantConfig, ProviderConfig from mlflow.assistant.types import Event ClientToolDelivery = Literal["tool", "structured", "unsupp...
132
4,259
mlflow
mlflow/dspy/callback.py
.py
import logging import threading from collections import defaultdict from functools import wraps from typing import Any import dspy from dspy.utils.callback import BaseCallback import mlflow from mlflow.dspy.constant import FLAVOR_NAME from mlflow.dspy.util import ( log_dspy_lm_state, log_dspy_module_params, ...
456
17,789
mlflow
mlflow/dspy/util.py
.py
import json import logging import tempfile from collections import defaultdict from pathlib import Path from typing import Any import dspy from dspy import Example import mlflow from mlflow.entities import LoggedModelOutput _logger = logging.getLogger(__name__) EXCLUDE_LM_PARAMS = {"api_key", "api_base", "azure_ad_...
159
5,166
mlflow
mlflow/dspy/load.py
.py
import inspect import json import logging import os import cloudpickle from mlflow.dspy.save import ( _DSPY_SETTINGS_FILE_NAME, _MODEL_CONFIG_FILE_NAME, _MODEL_DATA_PATH, ) from mlflow.dspy.wrapper import DspyChatModelWrapper, DspyModelWrapper from mlflow.environment_variables import MLFLOW_ALLOW_PICKLE_D...
162
6,374
mlflow
mlflow/dspy/__init__.py
.py
from mlflow.dspy.autolog import autolog from mlflow.version import IS_TRACING_SDK_ONLY __all__ = ["autolog"] # Import model logging APIs only if mlflow skinny or full package is installed, # i.e., skip if only mlflow-tracing package is installed. if not IS_TRACING_SDK_ONLY: from mlflow.dspy.load import _load_pyfu...
18
503
mlflow
mlflow/dspy/autolog.py
.py
import logging from packaging.version import Version import mlflow from mlflow.dspy.constant import FLAVOR_NAME from mlflow.telemetry.events import AutologgingEvent from mlflow.telemetry.track import _record_event from mlflow.tracing.provider import trace_disabled from mlflow.tracing.utils import construct_full_input...
280
11,171
mlflow
mlflow/dspy/save.py
.py
"""Functions for saving DSPY models to MLflow.""" import json import logging import os from pathlib import Path from typing import Any import cloudpickle import yaml from packaging.version import Version import mlflow from mlflow import pyfunc from mlflow.dspy.constant import FLAVOR_NAME from mlflow.dspy.wrapper imp...
438
16,923
mlflow
mlflow/dspy/wrapper.py
.py
import json from dataclasses import asdict, is_dataclass from typing import TYPE_CHECKING, Any from packaging.version import Version if TYPE_CHECKING: import dspy from mlflow.exceptions import INVALID_PARAMETER_VALUE, MlflowException from mlflow.protos.databricks_pb2 import ( INVALID_PARAMETER_VALUE, ) from ...
237
9,004
mlflow
mlflow/cli/datasets.py
.py
import json from typing import Any, Literal import click from mlflow import MlflowClient from mlflow.environment_variables import MLFLOW_EXPERIMENT_ID from mlflow.utils.string_utils import _create_table from mlflow.utils.time import conv_longdate_to_str EXPERIMENT_ID = click.option( "--experiment-id", "-x", ...
139
3,906
mlflow
mlflow/cli/__init__.py
.py
import contextlib import json import logging import os import re import sys import warnings from datetime import timedelta from pathlib import Path import click from click import UsageError from click.core import ParameterSource from dotenv import load_dotenv import mlflow.db import mlflow.deployments.cli import mlfl...
1,452
54,143
mlflow
mlflow/cli/scorers.py
.py
import json from typing import Literal import click from mlflow.environment_variables import MLFLOW_EXPERIMENT_ID from mlflow.genai.judges import make_judge from mlflow.genai.scorers import get_all_scorers from mlflow.genai.scorers import list_scorers as list_scorers_api from mlflow.mcp.decorator import mlflow_mcp fr...
251
8,041
mlflow
mlflow/cli/skills.py
.py
"""CLI commands for inspecting MLflow Assistant skills.""" import click from mlflow.assistant.skill_installer import BundledSkill, list_bundled_skills def _echo_skill_details(skill: BundledSkill): skill_name_styled = click.style(skill.name, fg="cyan", bold=True) skill_path_styled = click.style(f" ({skill.pa...
47
1,475
mlflow
mlflow/cli/demo.py
.py
import contextlib import logging import os import threading import time import webbrowser from collections.abc import Generator from pathlib import Path from urllib.parse import urljoin import click NOISY_LOGGERS = [ "alembic", "mlflow.store", "mlflow.tracking", "mlflow.tracing", "mlflow.genai", ...
303
9,723
mlflow
mlflow/cli/eval.py
.py
""" CLI commands for evaluating traces with scorers. """ import json from typing import Literal import click import pandas as pd import mlflow from mlflow.cli.genai_eval_utils import ( extract_assessments_from_results, format_table_output, resolve_scorers, ) from mlflow.entities import Trace from mlflow....
129
4,217
mlflow
mlflow/cli/genai_eval_utils.py
.py
""" Utility functions for trace evaluation output formatting. """ from dataclasses import dataclass from typing import Any import click import pandas as pd from mlflow.exceptions import MlflowException from mlflow.genai.scorers import Scorer, get_all_scorers, get_scorer from mlflow.tracing.constant import Assessment...
278
9,160
mlflow
mlflow/cli/traces.py
.py
""" Comprehensive MLflow Traces CLI for managing trace data, assessments, and metadata. This module provides a complete command-line interface for working with MLflow traces, including search, retrieval, deletion, tagging, and assessment management. It supports both table and JSON output formats with flexible field se...
882
30,350
mlflow
mlflow/cli/crypto.py
.py
import os import click from mlflow.exceptions import MlflowException from mlflow.tracking import _get_store from mlflow.utils.crypto import ( CRYPTO_KEK_PASSPHRASE_ENV_VAR, CRYPTO_KEK_VERSION_ENV_VAR, KEKManager, rotate_secret_encryption, ) @click.group("crypto", help="Commands for managing MLflow's...
212
8,346
mlflow
mlflow/pydantic_ai/utils.py
.py
import logging from dataclasses import asdict, is_dataclass from typing import Any from mlflow.tracing.constant import TokenUsageKey _logger = logging.getLogger(__name__) _SAFE_PRIMITIVE_TYPES = (str, int, float, bool) def is_safe_for_serialization(value: Any) -> bool: if value is None: return False ...
115
4,364
mlflow
mlflow/pydantic_ai/__init__.py
.py
import functools import inspect import logging import typing from packaging.version import Version from mlflow.pydantic_ai.autolog import ( patched_agent_init, patched_async_class_call, patched_async_stream_call, patched_capability_model_request, patched_class_call, patched_sync_stream_call, )...
259
9,814
mlflow
mlflow/pydantic_ai/autolog.py
.py
import contextvars import inspect import logging from contextlib import asynccontextmanager from dataclasses import is_dataclass from typing import Any import mlflow from mlflow.entities import SpanType from mlflow.entities.span import LiveSpan from mlflow.pydantic_ai.utils import parse_usage as _parse_usage from mlfl...
498
19,723
mlflow
mlflow/pydantic_ai/autolog_v2.py
.py
import functools import inspect import logging import sys from contextlib import asynccontextmanager from typing import Any import mlflow from mlflow.entities import SpanType from mlflow.entities.span import LiveSpan from mlflow.pydantic_ai.utils import ( extract_safe_attributes, model_request_inputs, pars...
477
16,270
mlflow
mlflow/keras/callback.py
.py
"""Keras 3 callback to log information to MLflow.""" import keras from mlflow import log_metrics, log_params, log_text from mlflow.utils.autologging_utils import ExceptionSafeClass class MlflowCallback(keras.callbacks.Callback, metaclass=ExceptionSafeClass): """Callback for logging Keras metrics/params/model/.....
103
3,968
mlflow
mlflow/keras/utils.py
.py
import numpy as np from mlflow.models import ModelSignature from mlflow.types import Schema, TensorSpec def get_model_signature(model): def replace_none_in_shape(shape): return [-1 if dim_size is None else dim_size for dim_size in shape] input_shape = model.input_shape input_dtype = model.input_...
34
1,127
mlflow
mlflow/keras/load.py
.py
"""Functions for loading Keras models saved with MLflow.""" import os import keras import numpy as np import pandas as pd from mlflow.exceptions import INVALID_PARAMETER_VALUE, MlflowException from mlflow.models import Model from mlflow.models.model import MLMODEL_FILE_NAME from mlflow.tracking.artifact_utils import...
157
5,710
mlflow
mlflow/keras/__init__.py
.py
# MLflow Keras 3 flavor. import keras from packaging.version import Version if Version(keras.__version__).major < 3: from mlflow.tensorflow import ( # Redirect `mlflow.keras._load_pyfunc` to `mlflow.tensorflow._load_pyfunc`, # For backwards compatibility on loading keras model saved by old mlflow v...
49
1,232
mlflow
mlflow/keras/autologging.py
.py
"""MLflow autologging support for Keras 3.""" import logging import keras import numpy as np import mlflow from mlflow.data.code_dataset_source import CodeDatasetSource from mlflow.data.numpy_dataset import from_numpy from mlflow.data.tensorflow_dataset import from_tensorflow from mlflow.entities.logged_model_input ...
279
11,143
mlflow
mlflow/keras/save.py
.py
"""Functions for saving Keras models to MLflow.""" import importlib import logging import os import shutil import tempfile from typing import Any import keras import yaml import mlflow from mlflow import pyfunc from mlflow.exceptions import INVALID_PARAMETER_VALUE, MlflowException from mlflow.models import ( Mod...
366
13,032
mlflow
mlflow/h2o/__init__.py
.py
""" The ``mlflow.h2o`` module provides an API for logging and loading H2O models. This module exports H2O models with the following flavors: H20 (native) format This is the main flavor that can be loaded back into H2O. :py:mod:`mlflow.pyfunc` Produced for use by generic pyfunc-based deployment tools and batch ...
378
12,679
mlflow
mlflow/data/spark_delta_utils.py
.py
import logging import os from mlflow.utils.string_utils import _backtick_quote _logger = logging.getLogger(__name__) def _is_delta_table(table_name: str) -> bool: """Checks if a Delta table exists with the specified table name. Returns: True if a Delta table exists with the specified table name. Fa...
118
3,987
mlflow
mlflow/data/artifact_dataset_sources.py
.py
import re import warnings from pathlib import Path from typing import Any, TypeVar from urllib.parse import urlparse from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.store.artifact.artifact_repository_registry import get_registered_artifact_repo...
172
6,833
mlflow
mlflow/data/code_dataset_source.py
.py
from typing import Any from typing_extensions import Self from mlflow.data.dataset_source import DatasetSource class CodeDatasetSource(DatasetSource): def __init__( self, tags: dict[Any, Any], ): self._tags = tags @staticmethod def _get_source_type() -> str: return "...
41
880
mlflow
mlflow/data/huggingface_dataset.py
.py
import json import logging from functools import cached_property from typing import TYPE_CHECKING, Any, Mapping, Sequence 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 Ev...
259
10,499
mlflow
mlflow/data/dataset_registry.py
.py
import inspect import warnings from contextlib import suppress from typing import Callable import mlflow.data from mlflow.data.dataset import Dataset from mlflow.exceptions import MlflowException from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE from mlflow.utils.plugins import get_entry_points class ...
169
6,451
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