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 |
|---|---|---|---|---|---|
timesfm | v1/experiments/baselines/timegpt_pipeline.py | .py | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 260 | 7,880 |
timesfm | v1/experiments/long_horizon_benchmarks/run_eval.py | .py | # Copyright 2024 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 239 | 7,626 |
timesfm | v1/experiments/extended_benchmarks/utils.py | .py | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 279 | 9,710 |
timesfm | v1/experiments/extended_benchmarks/run_timesfm.py | .py | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 153 | 4,249 |
timesfm | v1/experiments/extended_benchmarks/run_timegpt.py | .py | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 109 | 2,907 |
timesfm | v1/peft/finetune.py | .py | # Copyright 2024 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 403 | 13,525 |
timesfm | v1/tests/test_timesfm.py | .py | # Copyright 2024 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 92 | 3,030 |
timesfm | v1/tests/test_data_loader.py | .py | from pathlib import Path
import numpy as np
import pandas as pd
from timesfm.data_loader import TimeSeriesdata
def test_train_gen_respects_batch_size_when_permute_is_false(tmp_path: Path) -> None:
rows = 12
df = pd.DataFrame(
{
"ds": pd.date_range("2024-01-01", periods=rows, freq="D"),
... | 51 | 1,403 |
timesfm | v1/src/finetuning/finetuning_torch.py | .py | """
TimesFM Finetuner: A flexible framework for finetuning TimesFM models on custom datasets.
"""
import logging
import os
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from typing import Any, Callable, Dict, List, Optional
import torch
import torch.distributed as dist
import torch.nn a... | 400 | 12,456 |
timesfm | v1/src/finetuning/finetuning_example.py | .py | """
Example usage of the TimesFM Finetuning Framework.
For single GPU:
python script.py --training_mode=single
For multiple GPUs:
python script.py --training_mode=multi --gpu_ids=0,1,2
"""
import os
from dataclasses import asdict
from os import path
from typing import Optional, Tuple
import numpy as np
import panda... | 404 | 12,001 |
timesfm | v1/src/timesfm/timesfm_jax.py | .py | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 354 | 12,707 |
timesfm | v1/src/timesfm/patched_decoder.py | .py | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 544 | 19,100 |
timesfm | v1/src/timesfm/timesfm_base.py | .py | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 737 | 27,305 |
timesfm | v1/src/timesfm/pytorch_patched_decoder.py | .py | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 788 | 26,137 |
timesfm | v1/src/timesfm/xreg_lib.py | .py | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 494 | 20,639 |
timesfm | v1/src/timesfm/time_features.py | .py | # Copyright 2024 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 216 | 6,285 |
timesfm | v1/src/timesfm/__init__.py | .py | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 36 | 1,180 |
timesfm | v1/src/timesfm/timesfm_torch.py | .py | # Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 169 | 6,369 |
timesfm | v1/src/timesfm/data_loader.py | .py | # Copyright 2024 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 257 | 8,582 |
timesfm | v1/src/adapter/utils.py | .py | # Copyright 2024 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 488 | 17,697 |
timesfm | v1/src/adapter/dora_layers.py | .py | # Copyright 2024 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 203 | 6,256 |
timesfm | v1/src/adapter/lora_layers.py | .py | # Copyright 2024 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | 167 | 5,029 |
timesfm | timesfm-forecasting/scripts/check_system.py | .py | #!/usr/bin/env python3
"""TimesFM System Requirements Preflight Checker.
MANDATORY: Run this script before loading TimesFM for the first time.
It checks RAM, GPU/VRAM, disk space, Python version, and package
installation so the agent never crashes a user's machine.
Usage:
python check_system.py
python check_s... | 739 | 24,162 |
timesfm | timesfm-forecasting/examples/finetuning/finetune_lora.py | .py | #!/usr/bin/env python3
"""Fine-tune TimesFM 2.5 with LoRA using HuggingFace Transformers + PEFT.
This script demonstrates parameter-efficient fine-tuning of TimesFM 2.5 on a
retail demand forecasting dataset (weekly store sales). It uses the HuggingFace
Transformers checkpoint and the standard PEFT library for LoRA a... | 447 | 15,388 |
timesfm | timesfm-forecasting/examples/covariates-forecasting/demo_covariates.py | .py | #!/usr/bin/env python3
"""
TimesFM Covariates (XReg) Example
Demonstrates the TimesFM covariate API using synthetic retail sales data.
TimesFM 1.0 does NOT support forecast_with_covariates(); that requires
TimesFM 2.5 + `pip install timesfm[xreg]`.
This script:
1. Generates synthetic 3-store weekly retail data (24-... | 569 | 19,694 |
timesfm | timesfm-forecasting/examples/global-temperature/visualize_forecast.py | .py | #!/usr/bin/env python3
"""
Visualize TimesFM forecast results for global temperature anomaly.
Generates a publication-quality figure showing:
- Historical data (2022-2024)
- Point forecast (2025)
- 80% and 90% confidence intervals (fan chart)
Usage:
python visualize_forecast.py
"""
from __future__ import annotat... | 126 | 3,334 |
timesfm | timesfm-forecasting/examples/global-temperature/run_forecast.py | .py | #!/usr/bin/env python3
"""
Run TimesFM forecast on global temperature anomaly data.
Generates forecast output CSV and JSON for the example.
"""
from __future__ import annotations
import json
from pathlib import Path
import numpy as np
import pandas as pd
import timesfm
# Preflight check
print("=" * 60)
print(" TIM... | 169 | 5,290 |
timesfm | tests/test_torch_layers.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 263 | 8,505 |
timesfm | tests/test_torch_utils.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 337 | 12,201 |
timesfm | tests/test_model_loading.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 97 | 3,834 |
timesfm | tests/test_configs.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 197 | 6,621 |
timesfm | tests/test_force_flip_invariance.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 74 | 2,825 |
timesfm | tests/test_base_utils.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 169 | 6,692 |
timesfm | src/timesfm/configs.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 106 | 3,617 |
timesfm | src/timesfm/flax/transformer.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 357 | 11,506 |
timesfm | src/timesfm/flax/util.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 108 | 3,027 |
timesfm | src/timesfm/flax/normalization.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 72 | 2,168 |
timesfm | src/timesfm/flax/dense.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 111 | 3,522 |
timesfm | src/timesfm/timesfm_2p5/timesfm_2p5_base.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 424 | 15,237 |
timesfm | src/timesfm/timesfm_2p5/timesfm_2p5_flax.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 615 | 19,700 |
timesfm | src/timesfm/timesfm_2p5/timesfm_2p5_torch.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 516 | 18,239 |
timesfm | src/timesfm/utils/xreg_lib.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 521 | 20,721 |
timesfm | src/timesfm/torch/transformer.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 371 | 11,720 |
timesfm | src/timesfm/torch/util.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 95 | 2,654 |
timesfm | src/timesfm/torch/normalization.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 40 | 1,204 |
timesfm | src/timesfm/torch/dense.py | .py | # Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | 95 | 3,109 |
mlflow | bin/install.py | .py | """
Install binary tools for MLflow development.
"""
# ruff: noqa: T201
import argparse
import gzip
import hashlib
import http.client
import platform
import re
import shutil
import subprocess
import tarfile
import tempfile
import time
import urllib.request
from dataclasses import dataclass
from pathlib import Path
fro... | 338 | 12,008 |
mlflow | mlflow/environment_variables.py | .py | """
This module defines environment variables used in MLflow.
MLflow's environment variables adhere to the following naming conventions:
- Public variables: environment variable names begin with `MLFLOW_`
- Internal-use variables: For variables used only internally, names start with `_MLFLOW_`
"""
import os
import war... | 1,705 | 80,170 |
mlflow | mlflow/exceptions.py | .py | import json
import logging
from mlflow.error_classification import ErrorClass, SqlState
from mlflow.protos.databricks_pb2 import (
ABORTED,
ALREADY_EXISTS,
BAD_REQUEST,
CANCELLED,
CUSTOMER_UNAUTHORIZED,
DATA_LOSS,
DEADLINE_EXCEEDED,
ENDPOINT_NOT_FOUND,
INTERNAL_ERROR,
INVALID_PA... | 307 | 11,549 |
mlflow | mlflow/runs.py | .py | """
CLI for runs
"""
import json
import click
import mlflow
from mlflow import MlflowClient
from mlflow.entities import RunStatus, ViewType
from mlflow.environment_variables import MLFLOW_EXPERIMENT_ID, MLFLOW_EXPERIMENT_NAME
from mlflow.exceptions import MlflowException
from mlflow.mcp.decorator import mlflow_mcp
f... | 253 | 8,060 |
mlflow | mlflow/__main__.py | .py | from mlflow.cli import cli
cli.main()
| 4 | 39 |
mlflow | mlflow/__init__.py | .py | """
The ``mlflow`` module provides a high-level "fluent" API for starting and managing MLflow runs.
For example:
.. code:: python
import mlflow
mlflow.start_run()
mlflow.log_param("my", "param")
mlflow.log_metric("score", 100)
mlflow.end_run()
You can also use the context manager syntax like thi... | 451 | 14,048 |
mlflow | mlflow/mismatch.py | .py | from __future__ import annotations
import importlib.metadata
import warnings
def _get_version(package_name: str) -> str | None:
try:
return importlib.metadata.version(package_name)
except importlib.metadata.PackageNotFoundError:
return None
def _check_version_mismatch() -> None:
"""
... | 43 | 1,335 |
mlflow | mlflow/version.py | .py | # Copyright 2018 Databricks, Inc.
import importlib.metadata
import re
VERSION = "3.15.2.dev0"
def is_release_version():
return bool(re.match(r"^\d+\.\d+\.\d+$", VERSION))
def _is_package_installed(package_name: str) -> bool:
try:
importlib.metadata.version(package_name)
return True
exce... | 30 | 974 |
mlflow | mlflow/error_classification.py | .py | """Centralized error classification for MLflow exceptions.
Maps error codes to sqlstate codes and error classes for structured error
classification and observability. Client-side errors use the KAM0x/XXM0x
namespace, while server/CP errors use the KAMCx/XXMCx namespace.
Terminology:
error_code: The existing MLflo... | 198 | 9,094 |
mlflow | mlflow/client.py | .py | """
The ``mlflow.client`` module provides a Python CRUD interface to MLflow Experiments, Runs,
Model Versions, and Registered Models. This is a lower level API that directly translates to MLflow
`REST API <../rest-api.html>`_ calls.
For a higher level API for managing an "active run", use the :py:mod:`mlflow` module.
"... | 13 | 407 |
mlflow | mlflow/db.py | .py | import click
@click.group("db")
def commands():
"""
Commands for managing an MLflow tracking database.
"""
@commands.command()
@click.argument("url")
def upgrade(url):
"""
Upgrade the schema of an MLflow tracking database to the latest supported version.
**IMPORTANT**: Schema migrations can... | 359 | 12,646 |
mlflow | mlflow/experiments.py | .py | import json
import os
import click
import mlflow
from mlflow.entities import ExperimentTag, ViewType
from mlflow.exceptions import MlflowException
from mlflow.mcp.decorator import mlflow_mcp
from mlflow.protos import databricks_pb2
from mlflow.tracing.constant import TraceExperimentTagKey
from mlflow.tracking import ... | 420 | 14,909 |
mlflow | mlflow/webhooks/types.py | .py | """Type definitions for MLflow webhook payloads.
This module contains class definitions for all webhook event payloads
that are sent when various model registry events occur.
"""
from typing import Literal, TypeAlias, TypedDict
from mlflow.entities.webhook import WebhookAction, WebhookEntity, WebhookEvent
class Re... | 590 | 15,358 |
mlflow | mlflow/webhooks/__init__.py | .py | """MLflow webhooks module.
This module provides webhook functionality for MLflow model registry and prompt registry events.
"""
from mlflow.webhooks.constants import WEBHOOK_SIGNATURE_HEADER
from mlflow.webhooks.types import (
ModelVersionAliasCreatedPayload,
ModelVersionAliasDeletedPayload,
ModelVersionC... | 43 | 1,248 |
mlflow | mlflow/webhooks/constants.py | .py | # MLflow webhook headers
WEBHOOK_SIGNATURE_HEADER = "X-MLflow-Signature"
WEBHOOK_TIMESTAMP_HEADER = "X-MLflow-Timestamp"
WEBHOOK_DELIVERY_ID_HEADER = "X-MLflow-Delivery-Id"
# Webhook signature version
WEBHOOK_SIGNATURE_VERSION = "v1"
| 8 | 235 |
mlflow | mlflow/webhooks/delivery.py | .py | """Webhook delivery implementation following Standard Webhooks conventions.
This module implements webhook delivery patterns similar to the Standard Webhooks
specification (https://www.standardwebhooks.com), providing consistent and secure
webhook delivery with HMAC signature verification and timestamp-based replay pr... | 357 | 11,847 |
mlflow | mlflow/webhooks/ssrf.py | .py | """Connection-time SSRF protection for outbound webhook delivery.
``_validate_webhook_url`` resolves the webhook hostname and checks that every
resolved IP is public, but it discards the resolved IP and the subsequent
``requests.post`` re-resolves the hostname independently. That TOCTOU gap lets a
DNS-rebinding attack... | 145 | 5,265 |
mlflow | mlflow/johnsnowlabs/__init__.py | .py | """
The ``mlflow.johnsnowlabs`` module provides an API for logging and loading Spark NLP and NLU models.
This module exports the following flavors:
Johnsnowlabs (native) format
Allows models to be loaded as Spark Transformers for scoring in a Spark session.
Models with this flavor can be loaded as NluPipelines... | 892 | 34,834 |
mlflow | mlflow/spacy/__init__.py | .py | """
The ``mlflow.spacy`` module provides an API for logging and loading spaCy models.
This module exports spacy models with the following flavors:
spaCy (native) format
This is the main flavor that can be loaded back into spaCy.
:py:mod:`mlflow.pyfunc`
Produced for use by generic pyfunc-based deployment tools ... | 380 | 14,045 |
mlflow | mlflow/demo/__init__.py | .py | import logging
import mlflow.demo.generators # noqa: F401
from mlflow.demo.base import DEMO_EXPERIMENT_NAME, DEMO_PROMPT_PREFIX, BaseDemoGenerator, DemoResult
from mlflow.demo.registry import demo_registry
from mlflow.utils.workspace_context import WorkspaceContext, get_request_workspace
_logger = logging.getLogger(... | 49 | 1,799 |
mlflow | mlflow/demo/registry.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
from mlflow.demo.base import DemoFeature
if TYPE_CHECKING:
from mlflow.demo.base import BaseDemoGenerator
class DemoRegistry:
"""Registry for demo data generators.
Provides registration and lookup of BaseDemoGenerator subclasses by na... | 44 | 1,447 |
mlflow | mlflow/demo/data.py | .py | from __future__ import annotations
import base64
import functools
import math
import struct
import zlib
from dataclasses import dataclass, field
from typing import Any
from mlflow.demo.base import DEMO_PROMPT_PREFIX
from mlflow.entities.issue import IssueSeverity
from mlflow.entities.model_registry import PromptVersi... | 1,234 | 49,213 |
mlflow | mlflow/demo/base.py | .py | import logging
from abc import ABC, abstractmethod
from dataclasses import dataclass
from enum import Enum
from mlflow.tracking._tracking_service.utils import _get_store
_logger = logging.getLogger(__name__)
DEMO_EXPERIMENT_NAME = "MLflow Demo"
DEMO_PROMPT_PREFIX = "mlflow-demo"
class DemoFeature(str, Enum):
"... | 136 | 4,746 |
mlflow | mlflow/demo/generators/judges.py | .py | from __future__ import annotations
import logging
from mlflow.demo.base import (
DEMO_EXPERIMENT_NAME,
DEMO_PROMPT_PREFIX,
BaseDemoGenerator,
DemoFeature,
DemoResult,
)
from mlflow.genai.scorers.registry import delete_scorer, list_scorers
from mlflow.tracking._tracking_service.utils import _get_st... | 145 | 5,916 |
mlflow | mlflow/demo/generators/evaluation.py | .py | from __future__ import annotations
import contextlib
import hashlib
import io
import logging
import os
from collections.abc import Callable
from typing import TYPE_CHECKING, Literal
import mlflow
if TYPE_CHECKING:
from mlflow.genai.datasets import EvaluationDataset
from mlflow.demo.base import (
DEMO_EXPERI... | 404 | 15,123 |
mlflow | mlflow/demo/generators/__init__.py | .py | from mlflow.demo.generators.evaluation import EvaluationDemoGenerator
from mlflow.demo.generators.issues import IssuesDemoGenerator
from mlflow.demo.generators.judges import JudgesDemoGenerator
from mlflow.demo.generators.prompts import PromptsDemoGenerator
from mlflow.demo.generators.review_queues import ReviewQueuesD... | 29 | 1,277 |
mlflow | mlflow/demo/generators/issues.py | .py | from __future__ import annotations
import logging
from typing import Any
import mlflow
from mlflow import MlflowClient
from mlflow.demo.base import (
DEMO_EXPERIMENT_NAME,
BaseDemoGenerator,
DemoFeature,
DemoResult,
)
from mlflow.demo.data import ASSESSMENT_TO_ISSUE, ROOT_CAUSE_EXPLANATIONS
from mlflo... | 233 | 9,592 |
mlflow | mlflow/demo/generators/review_queues.py | .py | from __future__ import annotations
import logging
from typing import Any
import mlflow
from mlflow.demo.base import (
DEMO_EXPERIMENT_NAME,
BaseDemoGenerator,
DemoFeature,
DemoResult,
)
from mlflow.exceptions import MlflowException
from mlflow.genai.label_schemas import InputCategorical, InputPassFail... | 190 | 7,827 |
mlflow | mlflow/demo/generators/traces.py | .py | from __future__ import annotations
import copy
import hashlib
import json
import logging
import random
import re
from dataclasses import dataclass
from datetime import datetime, timedelta, timezone
from typing import Any, Literal
import mlflow
from mlflow.demo.base import (
DEMO_EXPERIMENT_NAME,
DEMO_PROMPT_P... | 894 | 33,742 |
mlflow | mlflow/demo/generators/prompts.py | .py | from __future__ import annotations
import logging
from mlflow.demo.base import (
DEMO_EXPERIMENT_NAME,
DEMO_PROMPT_PREFIX,
BaseDemoGenerator,
DemoFeature,
DemoResult,
)
from mlflow.demo.data import DEMO_PROMPTS, DemoPromptDef
from mlflow.genai.prompts import (
delete_prompt_alias,
register... | 132 | 4,401 |
mlflow | mlflow/gemini/__init__.py | .py | """
The ``mlflow.gemini`` module provides an API for tracing the interaction with Gemini models.
"""
from mlflow.gemini.autolog import (
async_patched_class_call,
patched_class_call,
patched_module_call,
)
from mlflow.telemetry.events import AutologgingEvent
from mlflow.telemetry.track import _record_event... | 99 | 2,967 |
mlflow | mlflow/gemini/chat.py | .py | import json
import logging
from typing import TYPE_CHECKING
from mlflow.types.chat import (
ChatTool,
Function,
FunctionParams,
FunctionToolDefinition,
ParamProperty,
ToolCall,
)
if TYPE_CHECKING:
from google import genai
_logger = logging.getLogger(__name__)
def convert_gemini_func_to_... | 113 | 3,462 |
mlflow | mlflow/gemini/autolog.py | .py | import inspect
import logging
from typing import Any
import mlflow
import mlflow.gemini
from mlflow.entities import SpanType
from mlflow.entities.span import LiveSpan
from mlflow.gemini.chat import (
convert_gemini_func_to_mlflow_chat_tool,
)
from mlflow.tracing.constant import SpanAttributeKey, TokenUsageKey
from... | 328 | 11,809 |
mlflow | mlflow/gemini/genai_semconv_converter.py | .py | import json
from typing import Any
from mlflow.tracing.constant import GenAiSemconvKey
from mlflow.tracing.export.genai_semconv.converter import GenAiSemconvConverter
class GeminiConverter(GenAiSemconvConverter):
def convert_inputs(self, inputs: dict[str, Any]) -> list[dict[str, Any]] | None:
contents = ... | 127 | 4,972 |
mlflow | mlflow/bedrock/utils.py | .py | import logging
from typing import Any, Callable, Sequence
from mlflow.bedrock import FLAVOR_NAME
from mlflow.environment_variables import _MLFLOW_TESTING
from mlflow.tracing.constant import TokenUsageKey
from mlflow.utils.autologging_utils.config import AutoLoggingConfig
_logger = logging.getLogger(__name__)
# Token... | 213 | 8,539 |
mlflow | mlflow/bedrock/__init__.py | .py | import logging
from mlflow.telemetry.events import AutologgingEvent
from mlflow.telemetry.track import _record_event
from mlflow.utils.autologging_utils import autologging_integration, safe_patch
_logger = logging.getLogger(__name__)
FLAVOR_NAME = "bedrock"
@autologging_integration(FLAVOR_NAME)
def autolog(
lo... | 50 | 1,988 |
mlflow | mlflow/bedrock/chat.py | .py | from typing import Any
from mlflow.types.chat import ChatTool, FunctionToolDefinition
def convert_tool_to_mlflow_chat_tool(tool: dict[str, Any]) -> ChatTool:
"""
Convert Bedrock tool definition into MLflow's standard format (OpenAI compatible).
Ref: https://docs.aws.amazon.com/bedrock/latest/APIReferenc... | 27 | 810 |
mlflow | mlflow/bedrock/_autolog.py | .py | import io
import json
import logging
from typing import Any
from botocore.client import BaseClient
from botocore.response import StreamingBody
import mlflow
from mlflow.bedrock import FLAVOR_NAME
from mlflow.bedrock.chat import convert_tool_to_mlflow_chat_tool
from mlflow.bedrock.stream import ConverseStreamWrapper, ... | 240 | 9,147 |
mlflow | mlflow/bedrock/genai_semconv_converter.py | .py | """
Bedrock Converse API message converter for GenAI Semantic Convention export.
Translates Bedrock's Converse API format (content blocks with text, toolUse,
toolResult, image) into the GenAI semconv parts array format.
"""
import base64
import json
from typing import Any
from mlflow.tracing.constant import GenAiSem... | 149 | 5,306 |
mlflow | mlflow/bedrock/stream.py | .py | import json
import logging
from typing import Any
from botocore.eventstream import EventStream
from mlflow.bedrock.utils import (
capture_exception,
parse_complete_token_usage_from_response,
parse_partial_token_usage_from_response,
)
from mlflow.entities.span import LiveSpan
from mlflow.entities.span_even... | 217 | 7,875 |
mlflow | mlflow/strands/__init__.py | .py | import logging
from mlflow.strands.autolog import setup_strands_tracing, teardown_strands_tracing
from mlflow.telemetry.events import AutologgingEvent
from mlflow.telemetry.track import _record_event
from mlflow.utils.autologging_utils import autologging_integration
FLAVOR_NAME = "strands"
_logger = logging.getLogger... | 42 | 1,440 |
mlflow | mlflow/strands/autolog.py | .py | import json
import logging
import threading
from opentelemetry.context import Context
from opentelemetry.sdk.trace import (
ReadableSpan as OTelReadableSpan,
)
from opentelemetry.sdk.trace import (
Span as OTelSpan,
)
from opentelemetry.sdk.trace import (
TracerProvider as SDKTracerProvider,
)
from opentel... | 180 | 7,137 |
mlflow | mlflow/diffusers/__init__.py | .py | """
The ``mlflow.diffusers`` module provides an API for logging and loading diffusion model
LoRA adapters as MLflow Models. This module exports adapter models with
the following flavors:
:py:mod:`mlflow.diffusers`
Adapter weights in safetensors format, with a reference to the base model.
:py:mod:`mlflow.pyfunc`
... | 541 | 20,534 |
mlflow | mlflow/diffusers/wrapper.py | .py | import io
import logging
import threading
from types import MappingProxyType
from typing import Any
import pandas as pd
from mlflow.diffusers import _detect_device
from mlflow.exceptions import MlflowException
_logger = logging.getLogger(__name__)
class _DiffusersAdapterWrapper:
def __init__(
self,
... | 152 | 5,659 |
mlflow | mlflow/tracing/provider.py | .py | """
This module provides a set of functions to manage the global tracer provider for MLflow tracing.
Every tracing operation in MLflow *MUST* be managed through this module, instead of directly
using the OpenTelemetry APIs. This is because MLflow needs to control the initialization of the
tracer provider and ensure th... | 1,107 | 44,109 |
mlflow | mlflow/tracing/destination.py | .py | """
Trace destination classes are DEPRECATED. Use mlflow.entities.trace_location.TraceLocation instead.
"""
from __future__ import annotations
import logging
from contextvars import ContextVar
from dataclasses import dataclass
import mlflow
from mlflow.entities.trace_location import (
MlflowExperimentLocation,
... | 164 | 6,247 |
mlflow | mlflow/tracing/analysis.py | .py | import math
from dataclasses import dataclass
from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.protos.service_pb2 import CalculateTraceFilterCorrelation
@dataclass
class TraceFilterCorrelationResult(_MlflowObject):
"""
Result of calculating correlation between two trace filter conditions.... | 89 | 3,376 |
mlflow | mlflow/tracing/databricks.py | .py | from mlflow.exceptions import MlflowException
from mlflow.utils.uri import is_databricks_uri
def set_databricks_monitoring_sql_warehouse_id(
sql_warehouse_id: str, experiment_id: str | None = None
) -> None:
"""
Set the SQL warehouse ID used for Databricks production monitoring on traces logged to the giv... | 43 | 1,629 |
mlflow | mlflow/tracing/trace_archival_config.py | .py | from __future__ import annotations
import logging
import threading
import time
from dataclasses import dataclass
from pathlib import Path
from typing import Any
import yaml
from mlflow.environment_variables import MLFLOW_TRACE_ARCHIVAL_CONFIG
from mlflow.exceptions import MlflowException
from mlflow.store.tracking.u... | 258 | 8,675 |
mlflow | mlflow/tracing/trace_manager.py | .py | import contextlib
import logging
import threading
from dataclasses import dataclass, field
from typing import Generator, Sequence
from mlflow.entities import LiveSpan, Trace, TraceData, TraceInfo
from mlflow.entities.model_registry import PromptVersion
from mlflow.environment_variables import MLFLOW_TRACE_TIMEOUT_SECO... | 238 | 9,148 |
mlflow | mlflow/tracing/sampling.py | .py | import contextvars
from opentelemetry.sdk.trace.sampling import (
Sampler,
SamplingResult,
TraceIdRatioBased,
)
# Context variable to override the sampling ratio for a specific trace.
# When set, the sampler uses this ratio instead of the default.
_SAMPLING_RATIO_OVERRIDE = contextvars.ContextVar("samplin... | 49 | 1,579 |
mlflow | mlflow/tracing/__init__.py | .py | from mlflow.tracing.config import configure
from mlflow.tracing.context import context
from mlflow.tracing.databricks import set_databricks_monitoring_sql_warehouse_id
from mlflow.tracing.display import disable_notebook_display, enable_notebook_display
from mlflow.tracing.distributed import (
get_tracing_context_he... | 36 | 1,149 |
mlflow | mlflow/tracing/archival.py | .py | _ERROR_MSG = (
"The `databricks-agents` package is required to use databricks trace archival. "
"Please install it with `pip install databricks-agents`."
)
def enable_databricks_trace_archival(
*,
delta_table_fullname: str,
experiment_id: str | None = None,
) -> None:
"""
Enable archiving ... | 71 | 2,086 |
mlflow | mlflow/tracing/assessment.py | .py | from typing import Any
from mlflow.entities.assessment import (
DEFAULT_FEEDBACK_NAME,
Assessment,
AssessmentError,
Expectation,
Feedback,
FeedbackValueType,
IssueReference,
)
from mlflow.entities.assessment_source import AssessmentSource
from mlflow.exceptions import MlflowException
from m... | 482 | 17,212 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.