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 |
|---|---|---|---|---|---|
wandb | wandb/integration/metaflow/__init__.py | .py | """W&B Integration for Metaflow.
Defines a custom step and flow decorator `wandb_log` that automatically logs
flow parameters and artifacts to W&B.
"""
from .metaflow import wandb_log, wandb_track, wandb_use
__all__ = ["wandb_log", "wandb_track", "wandb_use"]
| 10 | 263 |
wandb | wandb/integration/metaflow/data_pytorch.py | .py | """Support for PyTorch datatypes.
May raise MissingDependencyError on import.
"""
from __future__ import annotations
from typing_extensions import Any, TypeIs
import wandb
from . import errors
try:
import torch
import torch.nn as nn
except ImportError as e:
warning = (
"`torch` (PyTorch) not i... | 76 | 1,712 |
wandb | wandb/integration/metaflow/data_pandas.py | .py | """Support for Pandas datatypes.
May raise MissingDependencyError on import.
"""
from __future__ import annotations
from typing_extensions import Any, TypeIs
import wandb
from . import errors
try:
import pandas as pd
except ImportError as e:
warning = (
"`pandas` not installed >>"
" @wandb... | 75 | 1,713 |
wandb | wandb/integration/metaflow/data_sklearn.py | .py | """Support for sklearn datatypes.
May raise MissingDependencyError on import.
"""
from __future__ import annotations
import pickle
from typing_extensions import Any, TypeIs
import wandb
from . import errors
try:
from sklearn.base import BaseEstimator
except ImportError as e:
warning = (
"`sklearn... | 77 | 1,753 |
wandb | wandb/integration/huggingface/__init__.py | .py | __all__ = ("autolog",)
from .huggingface import autolog
| 4 | 57 |
wandb | wandb/integration/huggingface/huggingface.py | .py | import logging
from wandb.sdk.integration_utils.auto_logging import AutologAPI
from .resolver import HuggingFacePipelineRequestResponseResolver
logger = logging.getLogger(__name__)
resolver = HuggingFacePipelineRequestResponseResolver()
autolog = AutologAPI(
name="transformers",
symbols=("Pipeline.__call__... | 19 | 443 |
wandb | wandb/integration/huggingface/resolver.py | .py | from __future__ import annotations
import logging
import os
from collections.abc import Sequence
from datetime import datetime
from typing import Any
import pytz
import wandb
from wandb.sdk.integration_utils.auto_logging import Response
from wandb.sdk.lib.runid import generate_id
logger = logging.getLogger(__name__... | 217 | 7,857 |
wandb | wandb/integration/catboost/catboost.py | .py | """catboost init."""
from __future__ import annotations
from pathlib import Path
from types import SimpleNamespace
from catboost import CatBoostClassifier, CatBoostRegressor # type: ignore
import wandb
from wandb.sdk.lib import telemetry as wb_telemetry
class WandbCallback:
"""`WandbCallback` automatically i... | 186 | 6,009 |
wandb | wandb/integration/catboost/__init__.py | .py | """W&B callback for CatBoost."""
from .catboost import WandbCallback, log_summary
__all__ = ["log_summary", "WandbCallback"]
| 6 | 127 |
wandb | wandb/integration/fastai/__init__.py | .py | """Hooks that add fast.ai v1 Learners to Weights & Biases through a callback.
Requested logged data can be configured through the callback constructor.
Examples:
WandbCallback can be used when initializing the Learner::
```
from wandb.fastai import WandbCallback
[...]
learn = Learner(... | 248 | 9,372 |
wandb | wandb/integration/openai/fine_tuning.py | .py | from __future__ import annotations
import base64
import datetime
import io
import json
import os
import re
import tempfile
import time
from typing import Any
from packaging.version import parse
import wandb
from wandb import util
from wandb.data_types import Table
from wandb.sdk.lib import telemetry
openai = util.g... | 483 | 18,470 |
wandb | wandb/integration/sb3/__init__.py | .py | from .sb3 import WandbCallback
__all__ = ["WandbCallback"]
| 4 | 60 |
wandb | wandb/integration/sb3/sb3.py | .py | """W&B callback for sb3.
Really simple callback to get logging for each tree
Example usage:
```python
import gym
from stable_baselines3 import PPO
from stable_baselines3.common.monitor import Monitor
from stable_baselines3.common.vec_env import DummyVecEnv, VecVideoRecorder
import wandb
from wandb.integration.sb3 im... | 152 | 4,829 |
wandb | wandb/integration/xgboost/xgboost.py | .py | """xgboost init!"""
from __future__ import annotations
import json
import warnings
from collections.abc import Callable
from pathlib import Path
from typing import TYPE_CHECKING, NamedTuple, TypeAlias, cast
import xgboost as xgb
import xgboost.callback
from typing_extensions import override
import wandb
from wandb.... | 207 | 6,891 |
wandb | wandb/integration/xgboost/__init__.py | .py | """W&B callback for xgboost.
Simple callback to get logging for each tree
Use the `wandb_callback` to add `wandb` logging to any `XGboost` model. However, it will
be deprecated in favor of WandbCallback. Use it instead for more features.
"""
from .xgboost import WandbCallback, wandb_callback
__all__ = ["wandb_callb... | 12 | 343 |
wandb | wandb/integration/sklearn/utils.py | .py | """Shared utilities for the modules in wandb.sklearn."""
from collections.abc import Iterable, Sequence
import numpy as np
import pandas as pd
import scipy
import sklearn
import wandb
chart_limit = 1000
def check_against_limit(count, chart, limit=None):
if limit is None:
limit = chart_limit
if cou... | 183 | 5,794 |
wandb | wandb/integration/sklearn/__init__.py | .py | """Create informative charts for scikit-learn models and log them to W&B."""
from .plot import (
plot_calibration_curve,
plot_class_proportions,
plot_classifier,
plot_clusterer,
plot_confusion_matrix,
plot_elbow_curve,
plot_feature_importances,
plot_learning_curve,
plot_outlier_cand... | 38 | 861 |
wandb | wandb/integration/sklearn/calculate/feature_importances.py | .py | from warnings import simplefilter
import numpy as np
import wandb
# ignore all future warnings
simplefilter(action="ignore", category=FutureWarning)
def feature_importances(model, feature_names):
attributes_to_check = ["feature_importances_", "feature_log_prob_", "coef_"]
found_attribute = check_for_attrib... | 68 | 2,261 |
wandb | wandb/integration/sklearn/calculate/calibration_curves.py | .py | from warnings import simplefilter
import numpy as np
import sklearn
from sklearn import model_selection, naive_bayes
from sklearn.calibration import CalibratedClassifierCV
from sklearn.linear_model import LogisticRegression
import wandb
from wandb.integration.sklearn import utils
# ignore all future warnings
simplef... | 127 | 3,863 |
wandb | wandb/integration/sklearn/calculate/confusion_matrix.py | .py | import itertools
from warnings import simplefilter
import numpy as np
from sklearn import metrics
from sklearn.utils.multiclass import unique_labels
import wandb
from .. import utils
# ignore all future warnings
simplefilter(action="ignore", category=FutureWarning)
def validate_labels(*args, **kwargs): # FIXME
... | 94 | 2,543 |
wandb | wandb/integration/sklearn/calculate/learning_curve.py | .py | from warnings import simplefilter
import numpy as np
from sklearn import model_selection
import wandb
from wandb.integration.sklearn import utils
# ignore all future warnings
simplefilter(action="ignore", category=FutureWarning)
def learning_curve(
model,
X, # noqa: N803
y,
cv=None,
shuffle=Fa... | 65 | 1,728 |
wandb | wandb/integration/sklearn/calculate/elbow_curve.py | .py | import time
from warnings import simplefilter
import numpy as np
from joblib import Parallel, delayed
from sklearn.base import clone
import wandb
# ignore all future warnings
simplefilter(action="ignore", category=FutureWarning)
def elbow_curve(clusterer, X, cluster_ranges, n_jobs, show_cluster_time): # noqa: N80... | 56 | 1,482 |
wandb | wandb/integration/sklearn/calculate/decision_boundaries.py | .py | from warnings import simplefilter
import wandb
# ignore all future warnings
simplefilter(action="ignore", category=FutureWarning)
def decision_boundaries(
decision_boundary_x,
decision_boundary_y,
decision_boundary_color,
train_x,
train_y,
train_color,
test_x,
test_y,
test_color,... | 41 | 1,087 |
wandb | wandb/integration/sklearn/calculate/__init__.py | .py | """Calculates and formats metrics and charts for introspecting sklearn models.
The functions in these modules are designed to be called by functions from the
plot submodule that have been exported into the namespace of the wandb.sklearn
submodule, rather than being called directly.
"""
from .calibration_curves import... | 33 | 1,055 |
wandb | wandb/integration/sklearn/calculate/summary_metrics.py | .py | from warnings import simplefilter
import numpy as np
import sklearn
import wandb
from wandb.integration.sklearn import utils
# ignore all future warnings
simplefilter(action="ignore", category=FutureWarning)
def summary_metrics(model=None, X=None, y=None, X_test=None, y_test=None): # noqa: N803
"""Calculate s... | 63 | 2,010 |
wandb | wandb/integration/sklearn/calculate/outlier_candidates.py | .py | from warnings import simplefilter
import numpy as np
import wandb
from wandb.integration.sklearn import utils
# ignore all future warnings
simplefilter(action="ignore", category=FutureWarning)
def outlier_candidates(regressor, X, y): # noqa: N803
# Fit a linear model to X and y to compute MSE
regressor.fi... | 70 | 1,946 |
wandb | wandb/integration/sklearn/calculate/silhouette.py | .py | from warnings import simplefilter
import numpy as np
from sklearn.metrics import silhouette_samples, silhouette_score
from sklearn.preprocessing import LabelEncoder
import wandb
from wandb.integration.sklearn import utils
# ignore all future warnings
simplefilter(action="ignore", category=FutureWarning)
def silhou... | 119 | 3,321 |
wandb | wandb/integration/sklearn/calculate/residuals.py | .py | from warnings import simplefilter
from sklearn import model_selection
import wandb
from wandb.integration.sklearn import utils
# ignore all future warnings
simplefilter(action="ignore", category=FutureWarning)
def residuals(regressor, X, y): # noqa: N803
# Create the train and test splits
x_train, x_test,... | 87 | 2,399 |
wandb | wandb/integration/sklearn/calculate/class_proportions.py | .py | from warnings import simplefilter
import numpy as np
from sklearn.utils.multiclass import unique_labels
import wandb
from wandb.integration.sklearn import utils
# ignore all future warnings
simplefilter(action="ignore", category=FutureWarning)
def class_proportions(y_train, y_test, labels):
# Get the unique va... | 67 | 2,088 |
wandb | wandb/integration/sklearn/plot/clusterer.py | .py | """Define plots for clustering models built with scikit-learn."""
from warnings import simplefilter
import pandas as pd
import sklearn
import wandb
from wandb.integration.sklearn import calculate, utils
# ignore all future warnings
simplefilter(action="ignore", category=FutureWarning)
def clusterer(model, X_train... | 147 | 4,917 |
wandb | wandb/integration/sklearn/plot/classifier.py | .py | """Define plots for classification models built with scikit-learn."""
from warnings import simplefilter
import numpy as np
from sklearn import naive_bayes
import wandb
import wandb.plot
from wandb.integration.sklearn import calculate, utils
from . import shared
# ignore all future warnings
simplefilter(action="ign... | 330 | 11,753 |
wandb | wandb/integration/sklearn/plot/regressor.py | .py | """Define plots for regression models built with scikit-learn."""
from warnings import simplefilter
import numpy as np
import wandb
from wandb.integration.sklearn import calculate, utils
from . import shared
# ignore all future warnings
simplefilter(action="ignore", category=FutureWarning)
def regressor(model, X... | 122 | 3,943 |
wandb | wandb/integration/sklearn/plot/__init__.py | .py | """Create and logs charts introspecting models built with scikit-learn to W&B."""
from .classifier import calibration_curve as plot_calibration_curve
from .classifier import class_proportions as plot_class_proportions
from .classifier import classifier as plot_classifier
from .classifier import confusion_matrix as plo... | 36 | 1,368 |
wandb | wandb/integration/sklearn/plot/shared.py | .py | """Define plots used by multiple sklearn model classes."""
from warnings import simplefilter
import numpy as np
import wandb
from wandb.integration.sklearn import calculate, utils
# ignore all future warnings
simplefilter(action="ignore", category=FutureWarning)
def summary_metrics(model=None, X=None, y=None, X_t... | 92 | 2,763 |
wandb | wandb/integration/dspy/__init__.py | .py | """W&B DSPy integration package."""
from .dspy import WandbDSPyCallback
__all__ = ["WandbDSPyCallback"]
| 6 | 106 |
wandb | wandb/integration/dspy/dspy.py | .py | """DSPy ↔ Weights & Biases integration."""
from __future__ import annotations
import logging
import os
from collections.abc import Mapping, Sequence
from typing import Any, Literal
import wandb
import wandb.util
from wandb.sdk.lib import telemetry
from wandb.sdk.wandb_run import Run
dspy = wandb.util.get_module(
... | 424 | 15,546 |
wandb | wandb/integration/keras/__init__.py | .py | """Tools for integrating `wandb` with [`Keras`](https://keras.io/)."""
__all__ = (
"WandbMetricsLogger",
"WandbModelCheckpoint",
"WandbEvalCallback",
)
from .callbacks import WandbEvalCallback, WandbMetricsLogger, WandbModelCheckpoint
| 10 | 249 |
wandb | wandb/integration/keras/keras.py | .py | """Keras integration helpers."""
import sys
import wandb
from wandb.util import add_import_hook
def _check_keras_version() -> None:
from keras import __version__ as keras_version
from packaging.version import parse
if parse(keras_version) < parse("2.4.0"):
wandb.termwarn(
f"Keras ve... | 28 | 643 |
wandb | wandb/integration/keras/callbacks/model_checkpoint.py | .py | from __future__ import annotations
import os
import string
from typing import Any, Literal
import tensorflow as tf # type: ignore
from tensorflow.keras import callbacks # type: ignore
import wandb
from wandb.sdk.lib import telemetry
from wandb.sdk.lib.paths import StrPath
from ..keras import patch_tf_keras
Mode ... | 191 | 8,512 |
wandb | wandb/integration/keras/callbacks/tables_builder.py | .py | from __future__ import annotations
import abc
from typing import Any
from tensorflow.keras.callbacks import Callback # type: ignore
import wandb
from wandb.sdk.lib import telemetry
class WandbEvalCallback(Callback, abc.ABC):
"""Abstract base class to build Keras callbacks for model prediction visualization.
... | 231 | 8,880 |
wandb | wandb/integration/keras/callbacks/metrics_logger.py | .py | from __future__ import annotations
from typing import Any, Literal
import tensorflow as tf # type: ignore
from tensorflow.keras import callbacks
import wandb
from wandb.integration.keras.keras import patch_tf_keras
from wandb.sdk.lib import telemetry
LogStrategy = Literal["epoch", "batch"]
patch_tf_keras()
cla... | 132 | 4,911 |
wandb | wandb/integration/weave/weave.py | .py | """Integration module for automatic Weave initialization with W&B.
This module provides automatic initialization of Weave when:
1. Weave is installed
2. A W&B run is active with a project
3. Weave is imported (init-on-import)
The integration can be disabled by setting the WANDB_DISABLE_WEAVE environment variable
to a... | 223 | 6,506 |
wandb | wandb/integration/weave/__init__.py | .py | """Weave integration for W&B."""
from .interface import RunPath, active_run_path
from .weave import (
build_project_path,
ensure_version,
init_weave,
init_weave_if_imported,
)
__all__ = (
"active_run_path",
"RunPath",
"build_project_path",
"ensure_version",
"init_weave",
"init_... | 19 | 342 |
wandb | wandb/integration/weave/media_adapters.py | .py | """Helpers for converting wandb rich media types to Weave-native types for eval logging."""
from __future__ import annotations
from collections.abc import Callable
from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal, get_args
import wandb
from wandb.sdk.data_types.audio import Audio
from wandb.sd... | 344 | 11,624 |
wandb | wandb/integration/weave/interface.py | .py | """Internal APIs for integrating with weave.
The public functions here are intended to be called by weave and care should
be taken to maintain backward compatibility.
"""
from __future__ import annotations
import dataclasses
from wandb.sdk import wandb_setup
@dataclasses.dataclass(frozen=True)
class RunPath:
... | 50 | 1,165 |
wandb | wandb/integration/lightning/fabric/logger.py | .py | from __future__ import annotations
import os
from argparse import Namespace
from collections.abc import Mapping
from pathlib import Path
from typing import TYPE_CHECKING, Any, Literal
from packaging import version
from typing_extensions import override
import wandb
from wandb import Artifact
from wandb.sdk.lib impor... | 773 | 27,329 |
wandb | wandb/integration/lightning/fabric/__init__.py | .py | from wandb.integration.lightning.fabric.logger import WandbLogger
__all__ = ("WandbLogger",)
| 4 | 94 |
wandb | wandb/integration/tensorboard/__init__.py | .py | """wandb integration tensorboard module."""
from .log import _log, log, reset_state, tf_summary_to_dict
from .monkeypatch import patch, unpatch
__all__ = [
"patch",
"unpatch",
"log",
]
| 11 | 199 |
wandb | wandb/integration/tensorboard/monkeypatch.py | .py | """monkeypatch: patch code to add tensorboard hooks."""
from __future__ import annotations
import os
import re
import socket
from typing import Any
import wandb
import wandb.util
TENSORBOARD_C_MODULE = "tensorflow.python.ops.gen_summary_ops"
TENSORBOARD_X_MODULE = "tensorboardX.writer"
TENSORFLOW_PY_MODULE = "tenso... | 189 | 6,906 |
wandb | wandb/integration/tensorboard/log.py | .py | from __future__ import annotations
import io
import re
import time
from typing import TYPE_CHECKING, Any
import wandb
import wandb.util
from wandb.sdk.lib import telemetry
if TYPE_CHECKING:
import numpy as np
from wandb.sdk.internal.tb_watcher import TBHistory
# We have at least the default namestep and a ... | 354 | 14,055 |
wandb | wandb/integration/sacred/__init__.py | .py | import warnings
import numpy
from sacred.dependencies import get_digest
from sacred.observers import RunObserver
import wandb
class WandbObserver(RunObserver):
"""Log sacred experiment data to W&B.
Args:
Accepts all the arguments accepted by wandb.init().
name — A display name for this run... | 120 | 5,780 |
wandb | wandb/integration/torch/wandb_torch.py | .py | """PyTorch-specific functionality."""
from __future__ import annotations
import itertools
from functools import reduce
from operator import mul
from typing import TYPE_CHECKING
import wandb
from wandb import util
from wandb.data_types import Node
torch = None
if TYPE_CHECKING:
from torch import Tensor
from... | 557 | 21,546 |
wandb | wandb/plot/histogram.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
from wandb.plot.custom_chart import plot_table
if TYPE_CHECKING:
import wandb
from wandb.plot.custom_chart import CustomChart
def histogram(
table: wandb.Table,
value: str,
title: str = "",
split_table: bool = False,
) -> C... | 67 | 1,701 |
wandb | wandb/plot/confusion_matrix.py | .py | from __future__ import annotations
from collections.abc import Sequence
from typing import TYPE_CHECKING, TypeVar
import wandb
from wandb import util
from wandb.plot.custom_chart import plot_table
if TYPE_CHECKING:
from wandb.plot.custom_chart import CustomChart
T = TypeVar("T")
def confusion_matrix(
prob... | 187 | 6,366 |
wandb | wandb/plot/utils.py | .py | from collections.abc import Iterable, Sequence
import wandb
from wandb import util
def test_missing(**kwargs):
np = util.get_module("numpy", required="Logging plots requires numpy")
pd = util.get_module("pandas", required="Logging dataframes requires pandas")
scipy = util.get_module("scipy", required="Lo... | 183 | 6,688 |
wandb | wandb/plot/pr_curve.py | .py | from __future__ import annotations
import numbers
from collections.abc import Iterable
from typing import TYPE_CHECKING, TypeVar
import wandb
from wandb import util
from wandb.plot.custom_chart import plot_table
from wandb.plot.utils import test_missing, test_types
if TYPE_CHECKING:
from wandb.plot.custom_chart ... | 188 | 6,636 |
wandb | wandb/plot/__init__.py | .py | """Chart Visualization Utilities
This module offers a collection of predefined chart types, along with functionality
for creating custom charts, enabling flexible visualization of your data beyond the
built-in options.
"""
__all__ = [
"line",
"histogram",
"scatter",
"bar",
"roc_curve",
"pr_cur... | 31 | 863 |
wandb | wandb/plot/line_series.py | .py | from __future__ import annotations
from collections.abc import Iterable
from typing import TYPE_CHECKING, Any
import wandb
from wandb.plot.custom_chart import plot_table
if TYPE_CHECKING:
from wandb.plot.custom_chart import CustomChart
def line_series(
xs: Iterable[Iterable[Any]] | Iterable[Any],
ys: I... | 175 | 5,613 |
wandb | wandb/plot/viz.py | .py | from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from wandb.data_types import Table
from wandb.errors import Error
@dataclass
class VisualizeSpec:
name: str
key: str = ""
@property
def config_value(self) -> dict[str, Any]:
return {
"id"... | 42 | 943 |
wandb | wandb/plot/bar.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
from wandb.plot.custom_chart import plot_table
if TYPE_CHECKING:
import wandb
from wandb.plot.custom_chart import CustomChart
def bar(
table: wandb.Table,
label: str,
value: str,
title: str = "",
split_table: bool = Fal... | 72 | 2,036 |
wandb | wandb/plot/custom_chart.py | .py | from __future__ import annotations
from dataclasses import dataclass
from typing import Any
import wandb
@dataclass
class CustomChartSpec:
spec_name: str
fields: dict[str, Any]
string_fields: dict[str, Any]
key: str = ""
panel_type: str = "Vega2"
split_table: bool = False
@property
... | 148 | 5,010 |
wandb | wandb/plot/scatter.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
from wandb.plot.custom_chart import plot_table
if TYPE_CHECKING:
import wandb
from wandb.plot.custom_chart import CustomChart
def scatter(
table: wandb.Table,
x: str,
y: str,
title: str = "",
split_table: bool = False,
... | 67 | 2,045 |
wandb | wandb/plot/line.py | .py | from __future__ import annotations
from typing import TYPE_CHECKING
from wandb.plot.custom_chart import plot_table
if TYPE_CHECKING:
import wandb
from wandb.plot.custom_chart import CustomChart
def line(
table: wandb.Table,
x: str,
y: str,
stroke: str | None = None,
title: str = "",
... | 76 | 2,369 |
wandb | wandb/plot/roc_curve.py | .py | from __future__ import annotations
import numbers
from collections.abc import Sequence
from typing import TYPE_CHECKING
import wandb
from wandb import util
from wandb.plot.custom_chart import plot_table
from wandb.plot.utils import test_missing, test_types
if TYPE_CHECKING:
from wandb.plot.custom_chart import Cu... | 165 | 5,653 |
wandb | wandb/errors/errors.py | .py | from __future__ import annotations
class Error(Exception):
"""Base W&B Error."""
def __init__(self, message: str, context: dict | None = None) -> None:
super().__init__(message)
self.message = message
# sentry context capture
if context:
self.context = context
cl... | 38 | 931 |
wandb | wandb/errors/warnings.py | .py | class WandbWarning(Warning):
"""Base W&B Warning."""
| 3 | 57 |
wandb | wandb/errors/util.py | .py | from __future__ import annotations
from wandb.proto import wandb_internal_pb2 as pb
from . import AuthenticationError, CommError, Error, UnsupportedError, UsageError
to_exception_map = {
pb.ErrorInfo.UNKNOWN: Error,
pb.ErrorInfo.COMMUNICATION: CommError,
pb.ErrorInfo.AUTHENTICATION: AuthenticationError,
... | 58 | 1,713 |
wandb | wandb/errors/__init__.py | .py | __all__ = (
"Error",
"CommError",
"AuthenticationError",
"UsageError",
"UnsupportedError",
"WandbCoreNotAvailableError",
)
from .errors import (
AuthenticationError,
CommError,
Error,
UnsupportedError,
UsageError,
WandbCoreNotAvailableError,
)
| 18 | 293 |
wandb | wandb/errors/term.py | .py | """Global functions for interacting with the terminal for wandb.
The functions termlog, termwarn and termerror print to stderr.
The function terminput prints to stderr and reads from stdin.
We print to stderr because wandb does not output any messages that are useful
to pipe to another program. Using stderr allows u... | 577 | 16,941 |
wandb | wandb/errors/links.py | .py | """Module containing the WBURLs class and WBURL dataclass.
Used to store predefined URLs that can be associated with a name. The URLs are
shortened using with the `wandb.me` domain, using dub.co as the shortening service.
If the URLs need to be updates, use the dub.co service to point to the new URL.
"""
from __futur... | 74 | 2,520 |
wandb | wandb/cli/beta.py | .py | """Beta versions of wandb CLI commands.
These commands are experimental and may change or be removed in future versions.
"""
from __future__ import annotations
import pathlib
import click
from wandb.analytics import get_sentry
from wandb.errors import WandbCoreNotAvailableError
from wandb.util import get_core_path... | 259 | 6,602 |
wandb | wandb/cli/leet.py | .py | """The `wandb leet` command.
W&B LEET, the Lightweight Experiment Exploration Tool, is a terminal UI
for viewing W&B runs.
"""
from __future__ import annotations
import dataclasses
import os
import pathlib
import subprocess
import sys
import urllib.parse
from typing import Any
import click
from typing_extensions im... | 330 | 10,110 |
wandb | wandb/cli/beta_core.py | .py | """Implements `wandb beta core` helpers.
These helpers manage a detached `wandb-core` process intended to be reused by
multiple independent Python processes on the same host.
Discovery is explicit via the WANDB_SERVICE environment variable.
"""
from __future__ import annotations
import logging
import click
from w... | 113 | 3,679 |
wandb | wandb/cli/clean.py | .py | """Implements `wandb clean`."""
from __future__ import annotations
import dataclasses
import pathlib
import re
import shutil
from datetime import datetime
import click
from wandb.errors import term
from wandb.sdk import wandb_setup
# Patched in tests.
_DATETIME_NOW = datetime.now
@click.command()
@click.pass_con... | 228 | 6,722 |
wandb | wandb/cli/beta_sandbox.py | .py | from __future__ import annotations
import json
from datetime import datetime
import click
from cwsandbox.cli.shell import _validate_cmd as _cwsandbox_validate_cmd
from wandb.sandbox import CWSandboxError, Sandbox, SandboxStatus
from wandb.sandbox._auth import override_sandbox_entity
_STATUS_CHOICES = [s.value for s... | 302 | 8,031 |
wandb | wandb/cli/cli.py | .py | from __future__ import annotations
import asyncio
import getpass
import json
import logging
import os
import pathlib
import shlex
import shutil
import subprocess
import sys
import tempfile
import textwrap
import time
import traceback
from functools import wraps
from typing import Any
import click
import yaml
from cli... | 3,755 | 118,910 |
wandb | wandb/cli/beta_sync.py | .py | """Implements `wandb sync` using wandb-core."""
from __future__ import annotations
import asyncio
import contextlib
import pathlib
from collections.abc import Iterable, Iterator
import wandb
from wandb.errors import term
from wandb.proto.wandb_sync_pb2 import ServerSyncResponse
from wandb.sdk import wandb_setup
from... | 389 | 11,551 |
wandb | wandb/analytics/__init__.py | .py | __all__ = (
"get_sentry",
"TelemetryContext",
"TelemetryRecorder",
)
from .opentelemetry import TelemetryContext, TelemetryRecorder
from .sentry import get_sentry
| 9 | 176 |
wandb | wandb/analytics/sentry.py | .py | from __future__ import annotations
import atexit
import contextlib
import functools
import os
import pathlib
import sys
import threading
from collections.abc import Callable
from types import TracebackType
from typing import Any, Concatenate, Literal, TypeVar
from urllib.parse import quote
from typing_extensions impo... | 310 | 9,329 |
wandb | wandb/analytics/opentelemetry/__init__.py | .py | """OpenTelemetry-based analytics for the wandb SDK.
Forwards telemetry events (metrics and logs) to wandb-core.
Wandb-core then forwards the telemetry events to the W&B backend for ingestion
into Datadog.
"""
__all__ = (
"TelemetryContext",
"TelemetryRecorder",
)
from .opentelemetry_proxy import TelemetryCon... | 14 | 344 |
wandb | wandb/analytics/opentelemetry/opentelemetry_proxy.py | .py | from __future__ import annotations
import contextlib
import functools
import platform
import traceback
from collections.abc import Callable
from dataclasses import dataclass, fields
from typing import TYPE_CHECKING, Concatenate
from opentelemetry._logs import SeverityNumber
from typing_extensions import Never, ParamS... | 359 | 12,850 |
wandb | wandb/sync/__init__.py | .py | """module sync."""
from .sync import TFEVENT_SUBSTRING, SyncManager, get_run_from_path, get_runs
| 4 | 98 |
wandb | wandb/sync/sync.py | .py | """sync."""
from __future__ import annotations
import atexit
import datetime
import fnmatch
import os
import queue
import sys
import tempfile
import threading
import time
from urllib.parse import quote as url_quote
import wandb
from wandb.proto import wandb_internal_pb2 # type: ignore
from wandb.sdk.interface.inter... | 454 | 15,979 |
wandb | wandb/filesync/dir_watcher.py | .py | from __future__ import annotations
import abc
import fnmatch
import glob
import logging
import os
import queue
import time
from collections.abc import Mapping, MutableMapping, MutableSet
from typing import TYPE_CHECKING, Any
from wandb import util
from wandb.sdk.lib.filesystem import GlobStr
from wandb.sdk.lib.paths ... | 408 | 16,340 |
wandb | wandb/filesync/stats.py | .py | import threading
from collections.abc import MutableMapping
from typing import NamedTuple
from wandb.sdk.lib import filenames
class FileStats(NamedTuple):
deduped: bool
total: int
uploaded: int
failed: bool
artifact_file: bool
class Summary(NamedTuple):
uploaded_bytes: int
total_bytes: ... | 102 | 2,968 |
wandb | wandb/filesync/step_upload.py | .py | """Batching file prepare requests to our API."""
from __future__ import annotations
import concurrent.futures
import logging
import queue
import sys
import threading
from collections.abc import Callable, MutableMapping, MutableSequence, MutableSet
from typing import TYPE_CHECKING, NamedTuple
from wandb.errors.term i... | 282 | 10,221 |
wandb | wandb/filesync/upload_job.py | .py | from __future__ import annotations
import logging
import os
from typing import TYPE_CHECKING
import wandb
from wandb.analytics import get_sentry
from wandb.sdk.lib.paths import LogicalPath
if TYPE_CHECKING:
from wandb.filesync import dir_watcher, stats, step_upload
from wandb.sdk.internal import file_stream,... | 146 | 5,534 |
wandb | wandb/filesync/step_prepare.py | .py | """Batching file prepare requests to our API."""
from __future__ import annotations
import queue
import threading
import time
from collections.abc import Callable, Mapping, Sequence
from typing import TYPE_CHECKING, NamedTuple
if TYPE_CHECKING:
from wandb.sdk.internal.internal_api import (
Api,
C... | 172 | 5,438 |
wandb | wandb/filesync/step_checksum.py | .py | """Batching file prepare requests to our API."""
from __future__ import annotations
import concurrent.futures
import functools
import os
import queue
import shutil
import threading
from typing import TYPE_CHECKING, NamedTuple, cast
from wandb.filesync import step_upload
from wandb.sdk.lib import filesystem, runid
fr... | 145 | 4,670 |
wandb | wandb/proto/wandb_otel_pb2.py | .py | import google.protobuf
protobuf_version = google.protobuf.__version__[0]
if protobuf_version == "5":
from wandb.proto.v5.wandb_otel_pb2 import *
elif protobuf_version == "6":
from wandb.proto.v6.wandb_otel_pb2 import *
elif protobuf_version == "7":
from wandb.proto.v7.wandb_otel_pb2 import *
else:
rai... | 17 | 531 |
wandb | wandb/proto/wandb_base_pb2.py | .py | import google.protobuf
protobuf_version = google.protobuf.__version__[0]
if protobuf_version == "5":
from wandb.proto.v5.wandb_base_pb2 import *
elif protobuf_version == "6":
from wandb.proto.v6.wandb_base_pb2 import *
elif protobuf_version == "7":
from wandb.proto.v7.wandb_base_pb2 import *
| 11 | 307 |
wandb | wandb/proto/wandb_server_pb2.py | .py | import google.protobuf
protobuf_version = google.protobuf.__version__[0]
if protobuf_version == "5":
from wandb.proto.v5.wandb_server_pb2 import *
elif protobuf_version == "6":
from wandb.proto.v6.wandb_server_pb2 import *
elif protobuf_version == "7":
from wandb.proto.v7.wandb_server_pb2 import *
| 11 | 313 |
wandb | wandb/proto/wandb_api_pb2.py | .py | import google.protobuf
protobuf_version = google.protobuf.__version__[0]
if protobuf_version == "5":
from wandb.proto.v5.wandb_api_pb2 import *
elif protobuf_version == "6":
from wandb.proto.v6.wandb_api_pb2 import *
elif protobuf_version == "7":
from wandb.proto.v7.wandb_api_pb2 import *
else:
raise ... | 17 | 528 |
wandb | wandb/proto/wandb_sync_pb2.py | .py | import google.protobuf
protobuf_version = google.protobuf.__version__[0]
if protobuf_version == "5":
from wandb.proto.v5.wandb_sync_pb2 import *
elif protobuf_version == "6":
from wandb.proto.v6.wandb_sync_pb2 import *
elif protobuf_version == "7":
from wandb.proto.v7.wandb_sync_pb2 import *
| 11 | 307 |
wandb | wandb/proto/wandb_internal_pb2.py | .py | import google.protobuf
protobuf_version = google.protobuf.__version__[0]
if protobuf_version == "5":
from wandb.proto.v5.wandb_internal_pb2 import *
elif protobuf_version == "6":
from wandb.proto.v6.wandb_internal_pb2 import *
elif protobuf_version == "7":
from wandb.proto.v7.wandb_internal_pb2 import *
e... | 17 | 543 |
wandb | wandb/proto/wandb_telemetry_pb2.py | .py | import google.protobuf
protobuf_version = google.protobuf.__version__[0]
if protobuf_version == "5":
from wandb.proto.v5.wandb_telemetry_pb2 import *
elif protobuf_version == "6":
from wandb.proto.v6.wandb_telemetry_pb2 import *
elif protobuf_version == "7":
from wandb.proto.v7.wandb_telemetry_pb2 import ... | 11 | 322 |
wandb | wandb/proto/wandb_settings_pb2.py | .py | import google.protobuf
protobuf_version = google.protobuf.__version__[0]
if protobuf_version == "5":
from wandb.proto.v5.wandb_settings_pb2 import *
elif protobuf_version == "6":
from wandb.proto.v6.wandb_settings_pb2 import *
elif protobuf_version == "7":
from wandb.proto.v7.wandb_settings_pb2 import *
| 11 | 319 |
wandb | wandb/agents/pyagent.py | .py | """Agent - Agent object.
Manage wandb agent.
"""
import ctypes
import logging
import os
import queue
import socket
import sys
import threading
import time
import traceback
from typing import Any
import wandb
from wandb.apis import InternalApi
from wandb.sdk.launch.sweeps import SweepNotFoundError
from wandb.sdk.lau... | 431 | 16,259 |
wandb | core/hatch.py | .py | """Builds wandb-core."""
from __future__ import annotations
import os
import pathlib
import shutil
import subprocess
from collections.abc import Mapping
def build_wandb_core(
go_binary: pathlib.Path,
output_path: pathlib.PurePath,
with_code_coverage: bool,
with_race_detection: bool,
with_cgo: bo... | 161 | 5,345 |
wandb | tests/conftest.py | .py | from __future__ import annotations
import logging
import os
import pathlib
import shutil
import subprocess
import sys
import time
import unittest.mock
from collections.abc import Callable, Generator
from pathlib import Path
from queue import Queue
from typing import Any
from wandb.sdk import wandb_setup
# Don't writ... | 362 | 11,120 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.