pypi huggingface-hub 0.0.7
v0.0.7: Networking improvements + PyTorch mixin

latest releases: 0.21.3, 0.21.2, 0.21.1...
2 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.