-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[ENH]: Add superfast wordllama embedding function #2925
base: main
Are you sure you want to change the base?
Conversation
Reviewer ChecklistPlease leverage this checklist to ensure your code review is thorough before approving Testing, Bugs, Errors, Logs, Documentation
System Compatibility
Quality
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few minor things; otherwise, it looks good. Thanks.
|
||
def __init__( | ||
self, | ||
config: Literal["l2_supercat", "l3_supercat"] = "l2_supercat", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we stick to standard naming conventions and use model_name
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not really a model name, it's a config name which is shorthand for model+some parameters.
And it can be used to load configurations from TOML files, so it's better this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Thanks for clarifying. Can you add this to the param description. Or provide a link in the description to point users where to find more info about it.
We lean heavy on DX so that's why the param name struck with me that for some users might cause a confusion unless explained how it works and where to find info.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a tricky one.
Source code for reference: https://github.com/dleemiller/WordLlama/blob/main/wordllama/wordllama.py
WordLlama stores several predefined configs, but publicly mentions only those two, and i'm not sure if describing what it is here is a good idea.
And it also accepts WordLlamaConfig
, but really with no docs or examples.
From what I see, other configs are used primarily for training, to produce these two fast and small models.
Maybe it's better to leave them just as "configs" with current description, because most intended use-cases use only these parameters anyway.
And, to be precise, load(config: ...
accepts str | WordLlamaConfig
, so we have a choice between describing it here as Literal with two expected choices, or as str
and trying to explain the details user probably does not need (and i may be wrong, because I used only these two choices).
Maybe we should leave this description as it is. I only replaced word 'model' with 'config', to be consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have online docs, link them in the file header.
Added description from the repository to class docstring, and also added a link.
(Added as docstring, and not a file header, because other files mostly using docstrings)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tazarov please check this again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@last-partizan, looks good. Just add some additional info on what the config
parameter is and where to find more info. If you have online docs, link them in the file header. It is always useful to have some pointers about this.
One more point, can you look into updating the docs as well?
|
||
def __init__( | ||
self, | ||
config: Literal["l2_supercat", "l3_supercat"] = "l2_supercat", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Thanks for clarifying. Can you add this to the param description. Or provide a link in the description to point users where to find more info about it.
We lean heavy on DX so that's why the param name struck with me that for some users might cause a confusion unless explained how it works and where to find info.
Description of changes
Added new superfast WordLlama embedding function.
I was playing with SeaGOAT, trying to make it better understand code, and make it faster. It uses chromadb, and embedding function is what defines it's speed and usefulness.
So, i tried adding this one.
(source https://github.com/dleemiller/WordLlama?tab=readme-ov-file#how-fast-zap )
Test plan
pytest
Documentation Changes
I haven't changed any docs, let me know if we need to add it somewhere.