s2cnn icon indicating copy to clipboard operation
s2cnn copied to clipboard

AttributeError: module 's2cnn.utils' has no attribute 'cuda'

Open zhixuanli opened this issue 6 years ago • 5 comments

I'm trying to modify the train.py of shrec17 example to multi-gpu version.

Here's the code:

loader = importlib.machinery.SourceFileLoader('model', os.path.join(log_dir, "model.py"))
mod = types.ModuleType(loader.name)
loader.exec_module(mod)
model = mod.Model(60)  
if os.path.exists("./my_run/"+mode+"_"+"state.pkl"):
        model.load_state_dict(torch.load("./my_run/"+mode+"_"+"state.pkl"))
        print("Loading pkl successfully!!!!")
model.cuda()
logger.info("{} paramerters in total".format(sum(x.numel() for x in model.parameters())))
logger.info("{} paramerters in the last layer".format(sum(x.numel() for x in model.out_layer.parameters())))
bw = model.bandwidths[0]

I don't know whether s2cnn is supporting multi-gpu now, but this error AttributeError: module 's2cnn.utils' has no attribute 'cuda' occured when I run the following command: CUDA_VISIBLE_DEVICES=7,6,5,4 python train.py --model_path model.py --log_dir my_run --mode train --batch_size 72 --learning_rate 0.01 --augmentation 5 --num_workers 1 --evalutation cv

Could you please give me some help, thank you so much!!!! @mariogeiger @tscohen @jonas-koehler

zhixuanli avatar Aug 28 '18 09:08 zhixuanli

In s2cnn/soft/s2_fft.py I moved import s2cnn.utils.cuda as cuda_utils from line 42 to line 7, and the problem was solved.

But while training, the average loss keeps increase and the average acc keeps decrease. I used the state.pkl from single gpu, maybe it's not suitable for multi-gpu to initialize with it.

zhixuanli avatar Aug 28 '18 14:08 zhixuanli

I have no idea

mariogeiger avatar Oct 07 '18 10:10 mariogeiger

@mariogeiger Apart from the ring like convolution kernel used here, is it possible for another form's kernel to get better performance?

zhixuanli avatar Oct 10 '18 08:10 zhixuanli

Ring like kernels giving better performance than near identity kernel is only an observation done with shrec17 experiment. It might be that there is an even better kernel form for this dataset. And I also think that the ideal kernel form depends on the dataset.

mariogeiger avatar Oct 10 '18 09:10 mariogeiger

@mariogeiger Thank you for replying me. I just find that the ring like kernel will occupy too much RAM and may be a smaller kernel could be considered such as one quarter sphere.

zhixuanli avatar Oct 10 '18 11:10 zhixuanli