Make AutoProcessor a magic loading class for all modalities (#18963)

* Make AutoProcessor a magic loading class for all modalities

* Quality
This commit is contained in:
Sylvain Gugger
2022-09-14 07:36:12 -04:00
committed by GitHub
parent a2a3afbc8d
commit 6f8f2f6a77
2 changed files with 28 additions and 4 deletions

View File

@@ -202,6 +202,14 @@ class AutoFeatureExtractorTest(unittest.TestCase):
if CustomConfig in PROCESSOR_MAPPING._extra_content:
del PROCESSOR_MAPPING._extra_content[CustomConfig]
def test_auto_processor_creates_tokenizer(self):
processor = AutoProcessor.from_pretrained("hf-internal-testing/tiny-random-bert")
self.assertEqual(processor.__class__.__name__, "BertTokenizerFast")
def test_auto_processor_creates_feature_extractor(self):
processor = AutoProcessor.from_pretrained("hf-internal-testing/tiny-random-convnext")
self.assertEqual(processor.__class__.__name__, "ConvNextFeatureExtractor")
@is_staging_test
class ProcessorPushToHubTester(unittest.TestCase):