Ejemplo n.º 1
0
 def test_model_file_not_found(self):
     with self.assertRaisesRegex(
             EnvironmentError,
             "hf-internal-testing/config-no-model does not appear to have a file named flax_model.msgpack",
     ):
         _ = FlaxAutoModel.from_pretrained(
             "hf-internal-testing/config-no-model")
Ejemplo n.º 2
0
 def test_revision_not_found(self):
     with self.assertRaisesRegex(
             EnvironmentError,
             r"aaaaaa is not a valid git identifier \(branch name, tag name or commit id\)"
     ):
         _ = FlaxAutoModel.from_pretrained(DUMMY_UNKNOWN_IDENTIFIER,
                                           revision="aaaaaa")
Ejemplo n.º 3
0
    def test_roberta_from_pretrained(self):
        for model_name in ["roberta-base-cased", "roberta-large-uncased"]:
            with self.subTest(model_name):
                config = AutoConfig.from_pretrained(model_name)
                self.assertIsNotNone(config)
                self.assertIsInstance(config, BertConfig)

                model = FlaxAutoModel.from_pretrained(model_name)
                self.assertIsNotNone(model)
                self.assertIsInstance(model, FlaxRobertaModel)
Ejemplo n.º 4
0
 def test_repo_not_found(self):
     with self.assertRaisesRegex(
             EnvironmentError,
             "bert-base is not a local folder and is not a valid model identifier"
     ):
         _ = FlaxAutoModel.from_pretrained("bert-base")
Ejemplo n.º 5
0
 def test_model_from_pt_suggestion(self):
     with self.assertRaisesRegex(EnvironmentError,
                                 "Use `from_pt=True` to load this model"):
         _ = FlaxAutoModel.from_pretrained(
             "hf-internal-testing/tiny-bert-pt-only")