Skip to content

Commit

Permalink
use pkg_resources instead of packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
peterAsapp committed Jul 30, 2020
1 parent 224ec3f commit 6c90882
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pytorch_lightning/trainer/distrib_data_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def train_fx(trial_hparams, cluster_manager, _):
from time import sleep
import numpy as np
from os.path import abspath
from packaging.version import parse
from pkg_resources import parse_version

import torch
from pytorch_lightning import _logger as log
Expand Down Expand Up @@ -616,7 +616,7 @@ def transfer_distrib_spawn_state_on_fit_end(self, model, mp_queue, results):
# Can't use the new zipfile serialization for 1.6.0 because there's a bug in
# torch.hub.load_state_dict_from_url() that prevents it from loading the new files.
# More details can be found here: https://github.com/pytorch/pytorch/issues/42239
if parse(torch.__version__) == parse('1.6.0'):
if parse_version(torch.__version__) == parse_version('1.6.0'):
torch.save(model.state_dict(), last_path, _use_new_zipfile_serialization=False)
else:
torch.save(model.state_dict(), last_path)
Expand Down
4 changes: 2 additions & 2 deletions pytorch_lightning/trainer/training_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
import signal
from abc import ABC
from subprocess import call
from packaging.version import parse
from pkg_resources import parse_version

import torch
import torch.distributed as torch_distrib
Expand Down Expand Up @@ -264,7 +264,7 @@ def _atomic_save(self, checkpoint, filepath: str):
# Can't use the new zipfile serialization for 1.6.0 because there's a bug in
# torch.hub.load_state_dict_from_url() that prevents it from loading the new files.
# More details can be found here: https://github.com/pytorch/pytorch/issues/42239
if parse(torch.__version__) == parse('1.6.0'):
if parse_version(torch.__version__) == parse_version('1.6.0'):
torch.save(checkpoint, tmp_path, _use_new_zipfile_serialization=False)
else:
torch.save(checkpoint, tmp_path)
Expand Down

0 comments on commit 6c90882

Please sign in to comment.