quic / aimet-model-zoo

Other
296 stars 53 forks source link

`--use-cuda` flag is useless - unable to run any code without cuda #42

Open FelixSchwarz opened 1 year ago

FelixSchwarz commented 1 year ago

Currently the code 1 uses

parser.add_argument('--use-cuda', help='Use cuda', default=True, type=bool)

to parse the CLI parameters. The documentation mentions that this CLI flag should be used to tell the code "whether to run on GPU or cpu".

However argparse does not work that way: When --use-cuda is specified, it will store True but if the user omits the flag, default=True kicks in and sets use_cuda := True.

To make the parameter work as intended I see the following options:

On top of that at least the torch/resnet code uses .cuda() unconditionally so the user setting will not have an effect anyway. I think the cleanest solution would be to pass a device parameter from the script to ResNet.

quic-mangal commented 1 year ago

@quic-hanwxion could you please look at this as well. Thanks

FelixSchwarz commented 1 year ago

Thank you, I added PR #43 to make the resnet eval code runnable without cuda.