YuanGongND / ast

Code for the Interspeech 2021 paper "AST: Audio Spectrogram Transformer".
BSD 3-Clause "New" or "Revised" License
1.07k stars 205 forks source link

Inference on CPU ? #32

Closed Enescigdem closed 2 years ago

Enescigdem commented 2 years ago

Hello, I tried to do inference on cpu.BUT ; RuntimeError: module must have its parameters and buffers on device cuda:0 error arose. What steps should be done ?

YuanGongND commented 2 years ago

I think you will need to move both the model and input data to the CPU before the forward pass, e.g., something like audio_mode.to('cpu') and input.to('cpu').

-Yuan

Enescigdem commented 2 years ago

Thanks a lot but I had to make CUDA_VISIBLE_DEVICES=-1 to accomplish.

YuanGongND commented 2 years ago

Yes, that should also work as all device will be cpu when you set CUDA_VISIBLE_DEVICES=-1.