LAin

not-lain

AI & ML interests

custom architectures with huggingface

Articles

Organizations

Posts 6

view post
Post
298
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
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)
first_model.push_to_hub("not-lain/test")

5๏ธโƒฃ Load and initialize the model from the hub using the original class
pretrained_model = MyModel.from_pretrained("not-lain/test")

view post
Post
679
I'm looking for open-source image embedding models for RAG applications and/or multimodel embedding models if they exist in the first place.

if you have any extra resources about using, creating, or finetuning them feel free to share them below ๐Ÿค—