transformers/tests/models/jukebox
Alex McKinney 9d7afd2536
Replaces calls to .cuda with .to(torch_device) in tests (#25571)
* Replaces calls to `.cuda` with `.to(torch_device)` in tests
`torch.Tensor.cuda()` is a pre-0.4 solution to changing a tensor's device. It is recommended to prefer `.to(...)` for greater flexibility and error handling. Furthermore, this makes it more consistent with other tests (that tend to use `.to(torch_device)`) and ensures the correct device backend is used (if `torch_device` is neither `cpu` or `cuda`).

* addressing review comments

* more formatting changes in Bloom test

* `make style`

* Update tests/models/bloom/test_modeling_bloom.py

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>

* fixes style failures

---------

Co-authored-by: Arthur <48595927+ArthurZucker@users.noreply.github.com>
2023-08-18 12:40:40 +02:00
..
__init__.py Add Jukebox model (replaces #16875) (#17826) 2022-11-10 21:05:27 +01:00
test_modeling_jukebox.py Replaces calls to .cuda with .to(torch_device) in tests (#25571) 2023-08-18 12:40:40 +02:00
test_tokenization_jukebox.py Apply ruff flake8-comprehensions (#21694) 2023-02-22 09:14:54 +01:00