.to
on a PreTrainedModel
throws a Pyright type check error. What is the correct way to put a model to the device that does not throw type check errors?
#38052
Labels
System Info
(venv) nicholas@B367309:tmp(master)$ transformers-cli env
Copy-and-paste the text below in your GitHub issue and FILL OUT the two last points.
transformers
version: 4.51.1Who can help?
No response
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
Here is a small snippet
This code runs fine and correctly puts the model to the device, however,
Pyright
throws a pre-runtime type check error on the `model.to("cuda:0") call. This is the error,What is the correct way to put a model to the device that will satisfy the type checker?
Expected behavior
There should be know static type check error when doing
model.to(<device>)
The text was updated successfully, but these errors were encountered: