-
-
Notifications
You must be signed in to change notification settings - Fork 216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export to Huggingface #50
Conversation
Hey! Thanks for taking this on, very appreciated! I'll review the changes tomorrow. I don't think there's any major concerns with this, it's very straightforward and (should) be plug&play with the existing methods. I think pushing to the hub should be implemented as a |
Just a quick thought: I think loading from the hub could be implemented in This follows the style of the huggingface .from_pretrained() loaders Also, I think it may be good to allow the loading function to take a |
converting to vespa format: Not sure how this format works. So is the idea to have the repo structured in the form of this sample directory?: https://github.com/vespa-engine/sample-apps/tree/master/colbert Containing: services.xml
ext/ <-- the contents of ./ragatouille/indexes/index-name goes here
something.pt
something-else.json
etc.pt
schemas/
doc.sd (same one as in the sample folder) Is this useful broadly or something specific to the Vespa project? |
Hey, my bad -- I just wanted to cite the Vespa example as how I think export functions should be implemented: https://github.com/bclavie/RAGatouille/blob/main/ragatouille/models/utils.py No need to match Vespa's schema at all, or even export the Vespa ONNX file here at all! You can probably copy off the code from However, I think there are a handful of things to take into account here:
[...]
colbert_model = ColBERT(
colbert_path,
colbert_config=colbert_config,
)
print(f"Model loaded... saving export files to disk at {export_path}/model")
try:
save_model = colbert_model.save
except Exception:
save_model = colbert_model.module.save
save_model(str(Path(export_path) / model))
[...] Then, before exporting the index, we'd need to update the Index's config (in |
Hey @sutyum, let me know if you need any assistance with this! The exporting is a bit tricky because it's basically the behaviour we have now, except we need to actively load the I think a structure like the one you used for your manual export, but reversed, could make sense? e.g. the main folder would be the index, and the subfolder |
Would be great if could take a look and see if I am doing something wrong.
If you try the addition to the 01-basic notebook, I have added a section for uploading and using index from hf. Currently it stores the model in |
Hey! Overall I think it's looking like it's shaping up pretty nicely. I think we could probably merge
At its core it's just a normal json file, I think for this specific case there is no issue with loading it a json file (RAGatouille tends to use
I'm not sure I understand what you mean here... do you mean the path of a model downloaded from the hub?
Yeah! Once this is done I think we'll be nearing this being releasable, which opens up a lot of niceties! (e.g. easily download a pre-indexed wikipedia for everyone to try out, etc) Thanks for taking this on 🙏 |
Will close #37
Are there any other concerns this PR should look into. Waiting to understand how best to organise the repo in order to define the push to hub part.