(self)
| 1732 | ) |
| 1733 | |
| 1734 | def test_training(self): |
| 1735 | if not self.model_tester.is_training: |
| 1736 | self.skipTest(reason=class="st">"ModelTester is not configured to run training tests") |
| 1737 | |
| 1738 | for model_class in self.all_model_classes: |
| 1739 | config, inputs_dict = self.model_tester.prepare_config_and_inputs_for_common() |
| 1740 | config.return_dict = True |
| 1741 | |
| 1742 | if model_class.__name__ in [ |
| 1743 | *get_values(MODEL_MAPPING_NAMES), |
| 1744 | *get_values(MODEL_FOR_BACKBONE_MAPPING_NAMES), |
| 1745 | ]: |
| 1746 | continue |
| 1747 | |
| 1748 | model = model_class(config) |
| 1749 | model.to(torch_device) |
| 1750 | model.train() |
| 1751 | inputs = self._prepare_for_class(inputs_dict, model_class, return_labels=True) |
| 1752 | loss = model(**inputs).loss |
| 1753 | loss.backward() |
| 1754 | |
| 1755 | def test_training_gradient_checkpointing(self): |
| 1756 | class="cm"># Scenario - 1 default behaviour |
nothing calls this directly
no test coverage detected