* Networking improvements by Pierrci and lhoestq (21 and 22)
* **Adding mixin class for ease saving, uploading, downloading a PyTorch model**. See PR 11 by vasudevgupta7
Example usage:
python
from huggingface_hub import ModelHubMixin
class MyModel(nn.Module, ModelHubMixin):
def __init__(self, **kwargs):
super().__init__()
self.config = kwargs.pop("config", None)
self.layer = ...
def forward(self, ...):
return ...
model = MyModel()
saving model to local directory & pushing to hub
model.save_pretrained("mymodel", push_to_hub=True, config={"act": "gelu"})
initiatizing model & loading it from trained-weights
model = MyModel.from_pretrained("username/mymodelmain")
Thanks a ton for your contributions ♥️