ssnl/dataset-distillation

ImportError: cannot import name 'reduce_op'

north-horse opened this issue · 4 comments

when i run the code
python main.py --mode distill_basic --dataset MNIST --arch LeNet
i got this
`Traceback (most recent call last):
File "F:\dataset_dis\dataset-distillation-master\utils\distributed.py", line 5, in
from torch.distributed import ReduceOp
ImportError: cannot import name 'ReduceOp'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 11, in
from base_options import options
File "F:\dataset_dis\dataset-distillation-master\base_options.py", line 6, in
import utils
File "F:\dataset_dis\dataset-distillation-master\utils_init_.py", line 3, in
from . import distributed
File "F:\dataset_dis\dataset-distillation-master\utils\distributed.py", line 7, in
from torch.distributed import reduce_op
ImportError: cannot import name 'reduce_op'`
is this because of the version of pytorch or something else?

ssnl commented

Yes this is because of your pytorch version. Make sure that you have 1.0.0 or later.

Yes this is because of your pytorch version. Make sure that you have 1.0.0 or later.

oh, i am so sorry that i see you reply now, thanks for you help, it works.

image

i am using torch 1.0.0 but this issue still occurs. Any clue on the problem? Thanks.
ssnl commented

@xjwangsjtu Fixed in ef46862

torch.distributed is apparently only available on Linux. I added a check before the importing.