github huggingface/huggingface_hub v0.0.7
v0.0.7: Networking improvements + PyTorch mixin

latest releases: v0.24.6, v0.24.5, v0.24.4...
3 years ago
  • 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:

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/mymodel@main")

Thanks a ton for your contributions ♥️

Don't miss a new huggingface_hub release

NewReleases is sending notifications on new releases.