Add-support for commit description (#26704)
* fix * update * revert * add dosctring * good to go * update * add a test
This commit is contained in:
@@ -1119,6 +1119,23 @@ class ModelPushToHubTester(unittest.TestCase):
|
||||
for p1, p2 in zip(model.parameters(), new_model.parameters()):
|
||||
self.assertTrue(torch.equal(p1, p2))
|
||||
|
||||
def test_push_to_hub_with_description(self):
|
||||
config = BertConfig(
|
||||
vocab_size=99, hidden_size=32, num_hidden_layers=5, num_attention_heads=4, intermediate_size=37
|
||||
)
|
||||
model = BertModel(config)
|
||||
COMMIT_DESCRIPTION = """
|
||||
The commit description supports markdown synthax see:
|
||||
```python
|
||||
>>> form transformers import AutoConfig
|
||||
>>> config = AutoConfig.from_pretrained("bert-base-uncased")
|
||||
```
|
||||
"""
|
||||
commit_details = model.push_to_hub(
|
||||
"test-model", use_auth_token=self._token, create_pr=True, commit_description=COMMIT_DESCRIPTION
|
||||
)
|
||||
self.assertEqual(commit_details.commit_description, COMMIT_DESCRIPTION)
|
||||
|
||||
@unittest.skip("This test is flaky")
|
||||
def test_push_to_hub_in_organization(self):
|
||||
config = BertConfig(
|
||||
|
||||
Reference in New Issue
Block a user