content.raw: If you're a researcher or developing your own model 👀 you might need to take a look at huggingface's ModelHubMixin classes.
content.type: text
content.value: If you're a researcher or developing your own model 👀 you might need to take a look at huggingface's ModelHubMixin classes.
content.type: new_line
content.raw: They are used to seamlessly integrate your AI model with huggingface and to save/ load your model easily 🚀
content.type: text
content.value: They are used to seamlessly integrate your AI model with huggingface and to save/ load your model easily 🚀
content.type: new_line
content.type: new_line
content.raw: 1️⃣ make sure you're using the appropriate library version
content.type: text
content.value: 1️⃣ make sure you're using the appropriate library version
content.type: new_line
content.code: pip install -qU "huggingface_hub>=0.22"
content.raw: ```
  pip install -qU "huggingface_hub>=0.22"
  ```
content.type: code_fence
content.type: new_line
content.raw: 2️⃣  inherit from the appropriate class
content.type: text
content.value: 2️⃣  inherit from the appropriate class
content.type: new_line
content.code: 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)
content.lang: python
content.raw: ```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)
  ```
content.type: code_fence
content.type: new_line
content.raw: 4️⃣ push the model to the hub (or use save_pretrained method to save locally) 
content.type: text
content.value: 4️⃣ push the model to the hub (or use save_pretrained method to save locally) 
content.type: new_line
content.code: first_model.push_to_hub("not-lain/test")
content.lang: python
content.raw: ```python
  first_model.push_to_hub("not-lain/test")
  ```
content.type: code_fence
content.type: new_line
content.raw: 5️⃣  Load and initialize the model from the hub using the original class
content.type: text
content.value: 5️⃣  Load and initialize the model from the hub using the original class
content.type: new_line
content.code: pretrained_model = MyModel.from_pretrained("not-lain/test")
content.lang: python
content.raw: ```python
  pretrained_model = MyModel.from_pretrained("not-lain/test")
  ```
content.type: code_fence
content.type: new_line
rawContent: 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")
  ```
  
reactions.reaction: 👍
reactions.users: DmitryRyumin KvrParaskevi DynaTechSystems osanseviero isidentical cc92yy3344 KingNish Wauplin Ramikan-BR
reactions.reaction: 🔥
reactions.users: KvrParaskevi osanseviero louisbrulenaudet alielfilali01 KingNish Wauplin Ramikan-BR