Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/source-pytorch/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,6 @@ def _load_py_module(name: str, location: str) -> ModuleType:
("py:meth", "validation_step"),
("py:class", "wandb.Artifact"),
("py:func", "wandb.init"),
("py:class", "wandb.sdk.lib.RunDisabled"),
("py:class", "wandb.wandb_run.Run"),
("py:class", "litlogger.Experiment"),
]
Expand Down
10 changes: 3 additions & 7 deletions src/lightning/pytorch/loggers/wandb.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@

if TYPE_CHECKING:
from wandb import Artifact
from wandb.sdk.lib import RunDisabled
from wandb.wandb_run import Run

_WANDB_AVAILABLE = RequirementCache("wandb>=0.12.10")
Expand Down Expand Up @@ -302,7 +301,7 @@ def __init__(
anonymous: Optional[bool] = None,
project: Optional[str] = None,
log_model: Union[Literal["all"], bool] = False,
experiment: Union["Run", "RunDisabled", None] = None,
experiment: Optional["Run"] = None,
prefix: str = "",
checkpoint_name: Optional[str] = None,
add_file_policy: Literal["mutable", "immutable"] = "mutable",
Expand Down Expand Up @@ -375,7 +374,7 @@ def __getstate__(self) -> dict[str, Any]:

@property
@rank_zero_experiment
def experiment(self) -> Union["Run", "RunDisabled"]:
def experiment(self) -> "Run":
r"""Actual wandb object. To use wandb features in your :class:`~lightning.pytorch.core.LightningModule` do the
following.

Expand All @@ -387,7 +386,6 @@ def experiment(self) -> Union["Run", "RunDisabled"]:

"""
import wandb
from wandb.sdk.lib import RunDisabled
from wandb.wandb_run import Run

if self._experiment is None:
Expand All @@ -410,9 +408,7 @@ def experiment(self) -> Union["Run", "RunDisabled"]:
self._experiment = wandb.init(**self._wandb_init)

# define default x-axis
if isinstance(self._experiment, (Run, RunDisabled)) and getattr(
self._experiment, "define_metric", None
):
if isinstance(self._experiment, Run) and getattr(self._experiment, "define_metric", None):
if self._wandb_init.get("sync_tensorboard"):
self._experiment.define_metric("*", step_metric="global_step")
else:
Expand Down
1 change: 0 additions & 1 deletion tests/tests_pytorch/loggers/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class RunType: # to make isinstance checks pass
monkeypatch.setitem(sys.modules, "wandb.sdk", wandb_sdk)

wandb_sdk_lib = ModuleType("lib")
wandb_sdk_lib.RunDisabled = RunType
monkeypatch.setitem(sys.modules, "wandb.sdk.lib", wandb_sdk_lib)

wandb_wandb_run = ModuleType("wandb_run")
Expand Down