[Vision] .to function for ImageProcessors (#20536)

* add v1 with tests

* add checker

* simplified version

* update docstring

* better version

* fix docstring + change order

* make style

* tests + change conditions

* final tests

* modify docstring

* Update src/transformers/feature_extraction_utils.py

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>

* replace by `ValueError`

* fix logic

* apply suggestions

* `dtype` is not needed

* adapt suggestions

* remove `_parse_args_to_device`

Co-authored-by: amyeroberts <22614925+amyeroberts@users.noreply.github.com>
This commit is contained in:
Younes Belkada
2022-12-05 19:10:54 +01:00
committed by GitHub
parent 67d32f4649
commit ef0f85cd57
5 changed files with 102 additions and 14 deletions

View File

@@ -84,6 +84,7 @@ class DeiTFeatureExtractionTester(unittest.TestCase):
class DeiTFeatureExtractionTest(FeatureExtractionSavingTestMixin, unittest.TestCase):
feature_extraction_class = DeiTFeatureExtractor if is_vision_available() else None
test_cast_dtype = True
def setUp(self):
self.feature_extract_tester = DeiTFeatureExtractionTester(self)