diff --git a/.circleci/create_circleci_config.py b/.circleci/create_circleci_config.py index f44b500a80a..63894cddd1b 100644 --- a/.circleci/create_circleci_config.py +++ b/.circleci/create_circleci_config.py @@ -398,12 +398,13 @@ examples_flax_job = CircleCIJob( hub_job = CircleCIJob( "hub", + additional_env={"HUGGINGFACE_CO_STAGING": True}, install_steps=[ "sudo apt-get -y update && sudo apt-get install git-lfs", 'git config --global user.email "ci@dummy.com"', 'git config --global user.name "ci"', "pip install --upgrade --upgrade-strategy eager pip", - "pip install -U --upgrade-strategy eager .[torch,sentencepiece,testing]", + "pip install -U --upgrade-strategy eager .[torch,sentencepiece,testing,vision]", ], marker="is_staging_test", pytest_num_workers=1, diff --git a/tests/test_image_processing_utils.py b/tests/test_image_processing_utils.py index d74da63249b..5211a541d3e 100644 --- a/tests/test_image_processing_utils.py +++ b/tests/test_image_processing_utils.py @@ -57,6 +57,17 @@ class ImageProcessorUtilTester(unittest.TestCase): "https://huggingface.co/hf-internal-testing/tiny-random-vit/resolve/main/preprocessor_config.json" ) + def test_image_processor_from_pretrained_subfolder(self): + with self.assertRaises(OSError): + # config is in subfolder, the following should not work without specifying the subfolder + _ = AutoImageProcessor.from_pretrained("hf-internal-testing/stable-diffusion-all-variants") + + config = AutoImageProcessor.from_pretrained( + "hf-internal-testing/stable-diffusion-all-variants", subfolder="feature_extractor" + ) + + self.assertIsNotNone(config) + @is_staging_test class ImageProcessorPushToHubTester(unittest.TestCase): @@ -133,7 +144,7 @@ class ImageProcessorPushToHubTester(unittest.TestCase): # This has added the proper auto_map field to the config self.assertDictEqual( image_processor.auto_map, - {"ImageProcessor": "custom_image_processing.CustomImageProcessor"}, + {"AutoImageProcessor": "custom_image_processing.CustomImageProcessor"}, ) new_image_processor = AutoImageProcessor.from_pretrained( @@ -141,14 +152,3 @@ class ImageProcessorPushToHubTester(unittest.TestCase): ) # Can't make an isinstance check because the new_image_processor is from the CustomImageProcessor class of a dynamic module self.assertEqual(new_image_processor.__class__.__name__, "CustomImageProcessor") - - def test_image_processor_from_pretrained_subfolder(self): - with self.assertRaises(OSError): - # config is in subfolder, the following should not work without specifying the subfolder - _ = AutoImageProcessor.from_pretrained("hf-internal-testing/stable-diffusion-all-variants") - - config = AutoImageProcessor.from_pretrained( - "hf-internal-testing/stable-diffusion-all-variants", subfolder="feature_extractor" - ) - - self.assertIsNotNone(config)