Skip to content

Commit

Permalink
More fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vfdev-5 committed Oct 17, 2024
1 parent 794ada9 commit b19c789
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions ignite/handlers/visdom_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def __init__(
**kwargs: Any,
):
try:
import visdom # type: ignore[import-not-found]
import visdom
except ImportError:
raise ModuleNotFoundError(
"This contrib module requires visdom package. "
Expand Down Expand Up @@ -187,15 +187,15 @@ def __init__(

self.vis = visdom.Visdom(server=server, port=port, raise_exceptions=raise_exceptions, **kwargs)

if not self.vis.offline and not self.vis.check_connection():
if not self.vis.offline and not self.vis.check_connection(): # type: ignore[attr-defined]
raise RuntimeError(f"Failed to connect to Visdom server at {server}. Did you run python -m visdom.server ?")

self.executor: Union[_DummyExecutor, "ThreadPoolExecutor"] = _DummyExecutor()
if num_workers > 0:
self.executor = ThreadPoolExecutor(max_workers=num_workers)

def _save(self) -> None:
self.vis.save([self.vis.env])
self.vis.save([self.vis.env]) # type: ignore[attr-defined]

def close(self) -> None:
self.executor.shutdown()
Expand Down Expand Up @@ -240,7 +240,7 @@ def add_scalar(
kwargs = {
"X": [global_step],
"Y": [v],
"env": logger.vis.env,
"env": logger.vis.env, # type: ignore[attr-defined]
"win": self.windows[k]["win"],
"update": update,
"opts": self.windows[k]["opts"],
Expand Down
2 changes: 1 addition & 1 deletion ignite/handlers/wandb_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def score_function(engine):

def __init__(self, *args: Any, **kwargs: Any):
try:
import wandb # type: ignore[import-not-found]
import wandb

self._wandb = wandb
except ImportError:
Expand Down

0 comments on commit b19c789

Please sign in to comment.