transformers/tests/models/vision_text_dual_encoder
Dmitry Rogozhkin 5e2916bc14
tests: fix pytorch tensor placement errors (#33485)
This commit fixes the following errors:
* Fix "expected all tensors to be on the same device" error
* Fix "can't convert device type tensor to numpy"

According to pytorch documentation torch.Tensor.numpy(force=False)
performs conversion only if tensor is on CPU (plus few other restrictions)
which is not the case. For our case we need force=True since we just
need a data and don't care about tensors coherency.

Fixes: #33517
See: https://pytorch.org/docs/2.4/generated/torch.Tensor.numpy.html

Signed-off-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com>
2024-09-25 12:21:53 +01:00
..
__init__.py Move test model folders (#17034) 2022-05-03 14:42:02 +02:00
test_modeling_flax_vision_text_dual_encoder.py tests: fix pytorch tensor placement errors (#33485) 2024-09-25 12:21:53 +01:00
test_modeling_tf_vision_text_dual_encoder.py update ruff version (#30932) 2024-05-22 06:40:15 +02:00
test_modeling_vision_text_dual_encoder.py tests: fix pytorch tensor placement errors (#33485) 2024-09-25 12:21:53 +01:00
test_processor_vision_text_dual_encoder.py Remove repeated prepare_images in processor tests (#33163) 2024-09-09 13:20:27 +01:00