Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking ipywidgets is installed for ensure tqdm working #2417

Merged
Merged
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
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [unreleased] - YYYY-MM-DD

### Fixed

- Fixed crashing or wrong displaying progressbar because of missing ipywidgets ([#2417](https://github.com/PyTorchLightning/pytorch-lightning/pull/2417))

### Added


Expand All @@ -20,7 +24,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Fixed


## [0.8.3] - 2020-06-29

### Fixed
Expand Down
9 changes: 8 additions & 1 deletion pytorch_lightning/callbacks/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@
Use or override one of the progress bar callbacks.

"""
import importlib
import sys

from tqdm.auto import tqdm

# check if ipywidgets is installed before importing tqdm.auto
# to ensure it won't fail and a progress bar is displayed
if importlib.util.find_spec('ipywidgets') is not None:
from tqdm.auto import tqdm
else:
from tqdm import tqdm

from pytorch_lightning.callbacks import Callback

Expand Down
12 changes: 10 additions & 2 deletions pytorch_lightning/trainer/lr_finder.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
"""
Trainer Learning Rate Finder
"""
import os
import importlib
from abc import ABC, abstractmethod
from typing import Optional, Sequence, Tuple, List, Union

import numpy as np
import torch
from torch.optim.lr_scheduler import _LRScheduler
from torch.utils.data import DataLoader
from tqdm.auto import tqdm
import os

# check if ipywidgets is installed before importing tqdm.auto
# to ensure it won't fail and a progress bar is displayed
if importlib.util.find_spec('ipywidgets') is not None:
from tqdm.auto import tqdm
else:
from tqdm import tqdm


from pytorch_lightning.core.lightning import LightningModule
from pytorch_lightning.callbacks import Callback
Expand Down