-
Notifications
You must be signed in to change notification settings - Fork 830
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: Input type (c10::Half) and bias type (float) should be the same #319
Comments
dinov2/dinov2/layers/patch_embed.py Line 75 in da4b382
Expected output.scalar_type() == at::ScalarType::Half to be true, but got false. (Could this error message be improved? If so, please report an enhancement request to PyTorch.)
File "/home/zsuri/prototyping_dinov2/dinov2/layers/block.py", line 181, in get_attn_bias_and_cat
cat_tensors = index_select_cat([x.flatten(1) for x in x_list], branges).view(1, -1, x_list[0].shape[-1])
File "/home/zsuri/prototyping_dinov2/dinov2/layers/block.py", line 201, in drop_add_residual_stochastic_depth_list
attn_bias, x_cat = get_attn_bias_and_cat(x_list, branges)
File "/home/zsuri/prototyping_dinov2/dinov2/layers/block.py", line 227, in forward_nested
x_list = drop_add_residual_stochastic_depth_list(
File "/home/zsuri/prototyping_dinov2/dinov2/layers/block.py", line 259, in forward
return self.forward_nested(x_or_x_list)
File "/home/zsuri/prototyping_dinov2/dinov2/models/vision_transformer.py", line 40, in forward
x = b(x)
File "/home/zsuri/prototyping_dinov2/dinov2/models/vision_transformer.py", line 241, in forward_features_list
x = blk(x)
File "/home/zsuri/prototyping_dinov2/dinov2/models/vision_transformer.py", line 260, in forward_features
return self.forward_features_list(x, masks)
File "/home/zsuri/prototyping_dinov2/dinov2/models/vision_transformer.py", line 329, in forward
ret = self.forward_features(*args, **kwargs)
File "/home/zsuri/prototyping_dinov2/dinov2/train/ssl_meta_arch.py", line 235, in forward_backward
student_global_backbone_output_dict, student_local_backbone_output_dict = self.student.backbone(
File "/home/zsuri/prototyping_dinov2/dinov2/train/train.py", line 246, in do_train
loss_dict = model.forward_backward(data, teacher_temp=teacher_temp)
File "/home/zsuri/prototyping_dinov2/dinov2/train/train.py", line 314, in main
do_train(cfg, model, resume=not args.no_resume)
File "/home/zsuri/prototyping_dinov2/dinov2/run/train/train.py", line 29, in __call__
train_main(self.args)
File "/home/zsuri/prototyping_dinov2/dinov2/run/train/train.py", line 60, in main
t()
File "/home/zsuri/prototyping_dinov2/dinov2/run/train/train.py", line 65, in <module>
sys.exit(main())
RuntimeError: Expected output.scalar_type() == at::ScalarType::Half to be true, but got false. (Could this error message be improved? If so, please report an enhancement request to PyTorch.)
``` |
did you cast the model to .half() ? |
@qasfb, I had to manually cast particular layers to same dtype as the input in multiple places |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Error when trying to run training
Setup exactly as mentioned in README.
The text was updated successfully, but these errors were encountered: