Serge-weihao / CCNet-Pure-Pytorch

Criss-Cross Attention (2d&3d) for Semantic Segmentation in pure Pytorch with a faster and more precise implementation.
MIT License
183 stars 21 forks source link

Apex error #8

Closed shrutishrestha closed 3 years ago

shrutishrestha commented 3 years ago

It is stated that if we do not need either Cuda extension or apex. And we can run only from python 3 and pytorch. But, when I began used "python train.py --data-dir /data/datasets/Cityscapes/ --random-mirror --random-scale --restore-from ./dataset/resnet101-imagenet.pth --gpu 0,1,2,3 --learning-rate 0.01 --input-size 769,769 --weight-decay 0.0001 --batch-size 4 --num-steps 60000 --recurrence 2 --ohem 1 --ohem-thres 0.7 --ohem-keep 100000 --model ccnet "

It gave this error stating apex is needed. Traceback (most recent call last): File "/home/shrutisth/PycharmProjects/CCNet-Pure-Pytorch/engine.py", line 19, in from apex.parallel import DistributedDataParallel, SyncBatchNorm ModuleNotFoundError: No module named 'apex'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "train.py", line 26, in from engine import Engine File "/home/shrutisth/PycharmProjects/CCNet-Pure-Pytorch/engine.py", line 22, in "Please install apex from https://www.github.com/nvidia/apex .") ImportError: Please install apex from https://www.github.com/nvidia/apex .

How can we use this repo without CUDA extension and apex?

Serge-weihao commented 3 years ago

you can remove from "from apex.parallel import DistributedDataParallel, SyncBatchNorm" and sentences included "DistributedDataParallel", because you do not use DistributedDataParallel. or you can replace " try: from apex.parallel import DistributedDataParallel, SyncBatchNorm except ImportError: raise ImportError( "Please install apex from https://www.github.com/nvidia/apex .") " with " from torch.nn.parallel import DistributedDataParallel "