Skip to content

Commit

Permalink
[Fix] Fix version check in dataset builder. (open-mmlab#474)
Browse files Browse the repository at this point in the history
* Fix version check in dataset builder.

* Use mmcv version check function.
  • Loading branch information
mzr1996 authored Oct 13, 2021
1 parent 2e6c7cf commit 7eeb54c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mmcls/datasets/builder.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
# Copyright (c) OpenMMLab. All rights reserved.
import platform
import random
from distutils.version import LooseVersion
from functools import partial

import numpy as np
import torch
from mmcv.parallel import collate
from mmcv.runner import get_dist_info
from mmcv.utils import Registry, build_from_cfg
from mmcv.utils import Registry, build_from_cfg, digit_version
from torch.utils.data import DataLoader

from .samplers import DistributedSampler
Expand Down Expand Up @@ -98,7 +97,7 @@ def build_dataloader(dataset,
worker_init_fn, num_workers=num_workers, rank=rank,
seed=seed) if seed is not None else None

if LooseVersion(torch.__version__) >= LooseVersion('1.7.0'):
if digit_version(torch.__version__) >= digit_version('1.8.0'):
kwargs['persistent_workers'] = persistent_workers

data_loader = DataLoader(
Expand Down

0 comments on commit 7eeb54c

Please sign in to comment.