LAVIS
LAVIS copied to clipboard
Running evaluation on cpu - "AssertionError: Torch not compiled with CUDA enabled"
Hi,
Thank you for the great work in publishing this repository. I'm trying to evaluate CLIP in text to image retrieval on flickr30k by running evaluate.py
with --cfg-path lavis/projects/clip/exp_flickr_ret_eval.yaml
. However, I'm receiving the assertion error above, it occurs since PrefetchLoader
defined in dataloader_utils.py
uses the torch.cuda.Stream
class.
I removed the cuda.Stream
from the PrefetchLoader
class and managed to get the evaluation code to extract the text features (lines 729-739 of model.py
, in the function compute_sim_matrix
of the class Clip
), but when reaching the image features computation, nothing seems to be running. I pinned it down and it occurs in line 742 of model.py
when looping over the data loader (for samples in data_loader:
). I even changed the batch size to 2 in case it just takes long and changed num_workers to 1 in case it's something there. I also tried to remove the use of PrefetchLoader
by commenting out the line loader = PrefetchLoader(loader)
in runner_base.py
.
Is there support in the code for running on cpu? if not, what changes should I make to add support to it? I can share the changes that I made in PrefetchLoader if that's a good direction, but I figured there has to be a simpler solution.
Thanks in advance! Gil