Skip to content

Commit

Permalink
Revert "[examples] better PL version check (huggingface#8429)"
Browse files Browse the repository at this point in the history
This reverts commit 4c7582c.
  • Loading branch information
fabiocapsouza authored Nov 15, 2020
1 parent 5c2ac98 commit 0efe3b1
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions examples/lightning_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from pathlib import Path
from typing import Any, Dict

import packaging
import pytorch_lightning as pl
from pytorch_lightning.utilities import rank_zero_info

Expand Down Expand Up @@ -34,17 +33,15 @@

logger = logging.getLogger(__name__)

try:
pkg = "pytorch_lightning"
min_ver = "1.0.4"
pkg_resources.require(f"{pkg}>={min_ver}")
except pkg_resources.VersionConflict:
logger.warning(
f"{pkg}>={min_ver} is required for a normal functioning of this module, but found {pkg}=={pkg_resources.get_distribution(pkg).version}. Try pip install -r examples/requirements.txt"
)

def require_min_ver(pkg, min_ver):
got_ver = pkg_resources.get_distribution(pkg).version
if packaging.version.parse(got_ver) < packaging.version.parse(min_ver):
logger.warning(
f"{pkg}>={min_ver} is required for a normal functioning of this module, but found {pkg}=={got_ver}. "
"Try: pip install -r examples/requirements.txt"
)


require_min_ver("pytorch_lightning", "1.0.4")

MODEL_MODES = {
"base": AutoModel,
Expand Down

0 comments on commit 0efe3b1

Please sign in to comment.