Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: "slow_conv2d_cpu" not implemented for 'Half' #59

Open
InugYoon opened this issue Apr 7, 2023 · 3 comments
Open

RuntimeError: "slow_conv2d_cpu" not implemented for 'Half' #59

InugYoon opened this issue Apr 7, 2023 · 3 comments

Comments

@InugYoon
Copy link

InugYoon commented Apr 7, 2023

Hello, I followed the cocoop project, and occured the error above.

My progress was as follows.

  1. Env setup: following setups from dassl page and cocoop page
  2. Dataset and json file download
  3. Folder setup: First I git cloned the coop project, then copied dassl folder which was downloaded by git cloning dassl project.
  4. Script: bash script/cocoop/base2new_train.sh caltech101 2

Then I get the following error.
Initialize tensorboard (log_dir=output/base2new/train_base/caltech101/shots_16/CoCoOp/vit_b16_c4_ep10_batch1_ctxv1/seed2/tensorboard)
Traceback (most recent call last):
File "train.py", line 207, in
main(args)
File "train.py", line 150, in main
trainer.train()
File "/root/CoOp/dassl/engine/trainer.py", line 386, in train
super().train(self.start_epoch, self.max_epoch)
File "/root/CoOp/dassl/engine/trainer.py", line 250, in train
self.run_epoch()
File "/root/CoOp/dassl/engine/trainer.py", line 596, in run_epoch
loss_summary = self.forward_backward(batch)
File "/root/CoOp/trainers/cocoop.py", line 264, in forward_backward
loss = model(image, label)
File "/root/anaconda3/envs/coop_test/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/root/CoOp/trainers/cocoop.py", line 178, in forward
image_features = self.image_encoder(image.type(self.dtype))
File "/root/anaconda3/envs/coop_test/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(args, **kwargs)
File "/root/CoOp/clip/model.py", line 220, in forward
x = self.conv1(x) # shape = [
, width, grid, grid]
File "/root/anaconda3/envs/coop_test/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
File "/root/anaconda3/envs/coop_test/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 463, in forward
return self._conv_forward(input, self.weight, self.bias)
File "/root/anaconda3/envs/coop_test/lib/python3.8/site-packages/torch/nn/modules/conv.py", line 459, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: "slow_conv2d_cpu" not implemented for 'Half'

When I google it, only results show the 'whisper' library issue which is from openai.
Do you have any idea about this issue?

@AtsuMiyai
Copy link

@InugYoon
I consider that torch cannot identify GPUs and uses CPUs. Could you check the torch version of your environment?

@Ezio77
Copy link

Ezio77 commented Jun 27, 2023

@InugYoon
I met this error before, and finally figured out that i have installed pytorch with a wrong version. Make sure pytorch version fit your cuda version so that torch.cuda.is_available() is True.

@joy-lewis
Copy link

@InugYoon I'm working on a M2 Mac and I solved this issue by changing the line cfg.TRAINER.COOP.PREC = "fp16" # fp16, fp32, amp to cfg.TRAINER.COOP.PREC = "fp32" # fp16, fp32, amp , inside the CoOp/train.py file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants