rajewsky-lab/openst

Bug in openst preprocess when used device to cpu

falsetry1514 opened this issue · 1 comments

Describe the bug

base_options.py", line 136, in parse
if len(opt.gpu_ids) > 0 & opt.device == 'cuda':
AttributeError: 'Namespace' object has no attribute 'device'

Steps to reproduce the bug

openst image_preprocess --image-in e13_mouse_head.tif --image-out restored.tif --device cpu

Expected results

run it successfully

Actual results

report an error

Reason info

openst/preprocess/CUT/options/base_options.py

# set gpu ids
        str_ids = opt.gpu_ids.split(',')
        opt.gpu_ids = []
        for str_id in str_ids:
            id = int(str_id)
            if id >= 0:
                opt.gpu_ids.append(id)
        if len(opt.gpu_ids) > 0:
            torch.cuda.set_device(opt.gpu_ids[0])

This script do not consider that if args.device == 'cpu' so that the opt.gpu_ids is default setting zero, not the setting -1.