Ejemplo n.º 1
0
    def test_model_card_from_and_save_pretrained(self):
        model_card_first = ModelCard.from_dict(self.inputs_dict)

        with tempfile.TemporaryDirectory() as tmpdirname:
            model_card_first.save_pretrained(tmpdirname)
            model_card_second = ModelCard.from_pretrained(tmpdirname)

        self.assertEqual(model_card_second.to_dict(), model_card_first.to_dict())
Ejemplo n.º 2
0
    def test_model_card_to_json_file(self):
        model_card_first = ModelCard.from_dict(self.inputs_dict)

        with tempfile.TemporaryDirectory() as tmpdirname:
            filename = os.path.join(tmpdirname, "modelcard.json")
            model_card_first.to_json_file(filename)
            model_card_second = ModelCard.from_json_file(filename)

        self.assertEqual(model_card_second.to_dict(), model_card_first.to_dict())
Ejemplo n.º 3
0
 def test_model_card_common_properties(self):
     modelcard = ModelCard.from_dict(self.inputs_dict)
     self.assertTrue(hasattr(modelcard, "model_details"))
     self.assertTrue(hasattr(modelcard, "intended_use"))
     self.assertTrue(hasattr(modelcard, "factors"))
     self.assertTrue(hasattr(modelcard, "metrics"))
     self.assertTrue(hasattr(modelcard, "evaluation_data"))
     self.assertTrue(hasattr(modelcard, "training_data"))
     self.assertTrue(hasattr(modelcard, "quantitative_analyses"))
     self.assertTrue(hasattr(modelcard, "ethical_considerations"))
     self.assertTrue(hasattr(modelcard, "caveats_and_recommendations"))
Ejemplo n.º 4
0
 def test_model_card_common_properties(self):
     modelcard = ModelCard.from_dict(self.inputs_dict)
     self.assertTrue(hasattr(modelcard, 'model_details'))
     self.assertTrue(hasattr(modelcard, 'intended_use'))
     self.assertTrue(hasattr(modelcard, 'factors'))
     self.assertTrue(hasattr(modelcard, 'metrics'))
     self.assertTrue(hasattr(modelcard, 'evaluation_data'))
     self.assertTrue(hasattr(modelcard, 'training_data'))
     self.assertTrue(hasattr(modelcard, 'quantitative_analyses'))
     self.assertTrue(hasattr(modelcard, 'ethical_considerations'))
     self.assertTrue(hasattr(modelcard, 'caveats_and_recommendations'))
Ejemplo n.º 5
0
 def test_model_card_to_json_string(self):
     modelcard = ModelCard.from_dict(self.inputs_dict)
     obj = json.loads(modelcard.to_json_string())
     for key, value in self.inputs_dict.items():
         self.assertEqual(obj[key], value)