🐛 Properly raise RepoNotFoundError when not authenticated (#17651)

* Raise RepoNotFoundError in case of 401

* Include changes from revert-17646-skip_repo_not_found

* Add a comment

* 💄 Code quality

* 💚 Update `get_from_cache` test

* 💚 Code quality & skip failing test
This commit is contained in:
Simon Brandeis
2022-06-10 15:41:53 +02:00
committed by GitHub
parent 35b16032cb
commit c99ddcc441
10 changed files with 30 additions and 23 deletions

View File

@@ -88,7 +88,6 @@ class AutoConfigTest(unittest.TestCase):
if "custom" in CONFIG_MAPPING._extra_content:
del CONFIG_MAPPING._extra_content["custom"]
@unittest.skip("Temp bug in the Hub not returning RepoNotFound errors.")
def test_repo_not_found(self):
with self.assertRaisesRegex(
EnvironmentError, "bert-base is not a local folder and is not a valid model identifier"

View File

@@ -76,7 +76,6 @@ class AutoFeatureExtractorTest(unittest.TestCase):
config = AutoFeatureExtractor.from_pretrained(SAMPLE_FEATURE_EXTRACTION_CONFIG)
self.assertIsInstance(config, Wav2Vec2FeatureExtractor)
@unittest.skip("Temp bug in the Hub not returning RepoNotFound errors.")
def test_repo_not_found(self):
with self.assertRaisesRegex(
EnvironmentError, "bert-base is not a local folder and is not a valid model identifier"

View File

@@ -328,7 +328,6 @@ class AutoModelTest(unittest.TestCase):
if CustomConfig in mapping._extra_content:
del mapping._extra_content[CustomConfig]
@unittest.skip("Temp bug in the Hub not returning RepoNotFound errors.")
def test_repo_not_found(self):
with self.assertRaisesRegex(
EnvironmentError, "bert-base is not a local folder and is not a valid model identifier"

View File

@@ -77,7 +77,6 @@ class FlaxAutoModelTest(unittest.TestCase):
eval(**tokens).block_until_ready()
@unittest.skip("Temp bug in the Hub not returning RepoNotFound errors.")
def test_repo_not_found(self):
with self.assertRaisesRegex(
EnvironmentError, "bert-base is not a local folder and is not a valid model identifier"

View File

@@ -265,7 +265,6 @@ class TFAutoModelTest(unittest.TestCase):
if NewModelConfig in mapping._extra_content:
del mapping._extra_content[NewModelConfig]
@unittest.skip("Temp bug in the Hub not returning RepoNotFound errors.")
def test_repo_not_found(self):
with self.assertRaisesRegex(
EnvironmentError, "bert-base is not a local folder and is not a valid model identifier"

View File

@@ -142,7 +142,6 @@ class AutoTokenizerTest(unittest.TestCase):
self.assertEqual(tokenizer.model_max_length, 512)
@unittest.skip("Temp bug in the Hub not returning RepoNotFound errors.")
@require_tokenizers
def test_tokenizer_identifier_non_existent(self):
for tokenizer_class in [BertTokenizer, BertTokenizerFast, AutoTokenizer]:
@@ -330,7 +329,6 @@ class AutoTokenizerTest(unittest.TestCase):
else:
self.assertEqual(tokenizer.__class__.__name__, "NewTokenizer")
@unittest.skip("Temp bug in the Hub not returning RepoNotFound errors.")
def test_repo_not_found(self):
with self.assertRaisesRegex(
EnvironmentError, "bert-base is not a local folder and is not a valid model identifier"