Hugging Face
Models
Datasets
Spaces
Buckets
new
Docs
Enterprise
Pricing
Website
Tasks
HuggingChat
Collections
Languages
Organizations
Community
Blog
Posts
Daily Papers
Hardware
Learn
Discord
Forum
GitHub
Solutions
Team & Enterprise
Hugging Face PRO
Enterprise Support
Inference Providers
Inference Endpoints
Storage Buckets
Log In
Sign Up
陈超
cc92yy3344
Follow
0 followers
·
1 following
AI & ML interests
None yet
Recent Activity
updated
a dataset
6 days ago
cc92yy3344/coco8
published
a dataset
7 days ago
cc92yy3344/coco8
reacted
to
not-lain
's
post
with 👍
about 2 years ago
If you're a researcher or developing your own model 👀 you might need to take a look at huggingface's ModelHubMixin classes. They are used to seamlessly integrate your AI model with huggingface and to save/ load your model easily 🚀 1️⃣ make sure you're using the appropriate library version ``` pip install -qU "huggingface_hub>=0.22" ``` 2️⃣ inherit from the appropriate class ```python from huggingface_hub import PyTorchModelHubMixin from torch import nn class MyModel(nn.Module,PyTorchModelHubMixin): def __init__(self, a, b): super().__init__() self.layer = nn.Linear(a,b) def forward(self,inputs): return self.layer(inputs) first_model = MyModel(3,1) ``` 4️⃣ push the model to the hub (or use save_pretrained method to save locally) ```python first_model.push_to_hub("not-lain/test") ``` 5️⃣ Load and initialize the model from the hub using the original class ```python pretrained_model = MyModel.from_pretrained("not-lain/test") ```
View all activity
Organizations
None yet
models
0
None public yet
datasets
2
Sort: Recently updated
cc92yy3344/coco8
Viewer
•
Updated
6 days ago
•
8
•
76
cc92yy3344/vegetable
Preview
•
Updated
Mar 29, 2023
•
28