LAin
AI & ML interests
Articles
Organizations
not-lain's activity
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")
if you have any extra resources about using, creating, or finetuning them feel free to share them below π€
reel
thank you sooooo much β€οΈβ€οΈ
I came back with another one this time π€
in this blog you will learn π :
* How to train custom AI models with the trainer API π
* integrate your AI models with HF using the mixin classes π₯
happy reading everyone π€
πlink: https://huggingface.co/blog/not-lain/trainer-api-and-mixin-classes
I see you're using the image slider component too, nice work β€οΈβ€οΈ
Nice work @abhishek β¨
πthe most interesting thing about it is that you can use the FAISS index in the datasets library to retrieve your most similar documents.
πhttps://huggingface.co/blog/not-lain/rag-chatbot-using-llama3
Happy reading everyone β¨
Did anyone say HF?
literally on π₯
Nice work π₯³π₯³
nope it's not a bug, the posts feature is now open for everyone
βοΈ you can now push your custom pipelines easily to π€, allowing people to easily use your model in a more friendly, unified way.
π€ I already updated my blog to match the new feature https://huggingface.co/blog/not-lain/custom-architectures-with-huggingface.
πA list of some repos that have custom pipelines :
* briaai/RMBG-1.4
* p1atdev/siglip-tagger-test-3
* sgugger/test-dynamic-pipeline
x3 download speed in HfFileSystem = π₯π
I also really loved using the PyTorchModelHubMixin class π€π€
try adding labels
parameter to the forward function in my version of of the RMBG-1.4 model in here https://huggingface.co/not-lain/CustomCodeForRMBG/blob/main/briarmbg.py#L392, this should allow the model to be finetuned easily using the trainer API.
find out more about the labels parameter in this documentation :
https://huggingface.co/docs/transformers/custom_models#writing-a-custom-model
it should look somethind like this :
any open contributions are welcome.
Made a little contribution and it is now easier than ever to use the model via the transformers library
all you have to do is use the following code to access the model :
checkout more details in this pull request : https://huggingface.co/briaai/RMBG-1.4/discussions/9
or like make it a badge in their profiles if they exceed 100 contributions, could be a nice motive for people to make them engage more in the hub
maybe π§ββοΈπ§ββοΈ for open sorcerers out there
leaving this for future readers, huggingface has a really nice documentation about RAG which i highly recommend reading if you're interested about using them. It incorporates clear examples and neatly formatted code :
https://huggingface.co/docs/transformers/model_doc/rag
we're actually an anime/meme group and i made this community for AI + anime related stuff \(οΏ£οΈΆοΏ£*\))
@Tonic
we just reached 300000 members yerterday on FB π₯³π₯³