Skip to content

Commit

Permalink
Fix rich import error in Google Colab (#17156)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Carlos Mocholí <carlossmocholi@gmail.com>

(cherry picked from commit 66e2111)
  • Loading branch information
awaelchli authored and Borda committed Mar 31, 2023
1 parent 2ca1fb9 commit 7dc61c6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/pytorch_lightning/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

- Fixed `num_nodes` not being set for `DDPFullyShardedNativeStrategy` ([#17160](https://github.com/Lightning-AI/lightning/pull/17160))

- Fixed the availability check for `rich` that prevented Lightning to be imported in Google Colab ([#17156](https://github.com/Lightning-AI/lightning/pull/17156))



- The `psutil` package is now required for CPU monitoring ([#17010](https://github.com/Lightning-AI/lightning/pull/17010))

Expand Down
4 changes: 2 additions & 2 deletions src/pytorch_lightning/callbacks/rich_model_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
from typing import List, Tuple

from pytorch_lightning.callbacks import ModelSummary
from pytorch_lightning.utilities.imports import _RICH_AVAILABLE
from pytorch_lightning.callbacks.progress.rich_progress import _RICH_AVAILABLE
from pytorch_lightning.utilities.model_summary import get_human_readable_count

if _RICH_AVAILABLE:
if _RICH_AVAILABLE: # type: ignore[has-type]
from rich import get_console
from rich.table import Table

Expand Down
1 change: 0 additions & 1 deletion src/pytorch_lightning/utilities/imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
_KINETO_AVAILABLE = torch.profiler.kineto_available()
_OMEGACONF_AVAILABLE = package_available("omegaconf")
_POPTORCH_AVAILABLE = package_available("poptorch")
_RICH_AVAILABLE = package_available("rich") and compare_version("rich", operator.ge, "10.2.2")
_TORCH_QUANTIZE_AVAILABLE = bool([eg for eg in torch.backends.quantized.supported_engines if eg != "none"])
_TORCHVISION_AVAILABLE = RequirementCache("torchvision")

Expand Down

0 comments on commit 7dc61c6

Please sign in to comment.