-
-
Notifications
You must be signed in to change notification settings - Fork 150
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
chore(*): change installation of spacy weights to runtime #462
chore(*): change installation of spacy weights to runtime #462
Conversation
manual steup instruciton in README.md
installion from both the install scripts
This is how pytest will look like when we do not have the required spacy weight model installed:
|
@abrichr Ready for review! |
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 I do pip install openadapt
, will this also download the spacy weights?
Also I don't think the PR title should be a feat
. I think chore
might be better since this is more like an internal process adjustment or a change related to the build process rather than introducing a new user-facing feature. What do you think?
Now spacy weight will be downloaded in runtime. So whenever the user had to use the scrub code either via record or pytest or visualization, then it will check for the installation for the spacy weight and if not found it will install and then it will continue. This will be pure runtime and no need of adding this to installtion scripts or manual setup or toml or poetry ;-) |
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.
lgtm!
Thanks @KrishPatel13 ! What do you think about the approach mentioned here explosion/spaCy#4592 (comment) :
Also, what do you think about skipping tests which depend on spacy if the model is not installed with |
Good point, I will include that. |
We will ahve to skip all of the test functions in test_scrub if the required spacy is not installed. Hence, A better approach: https://docs.pytest.org/en/7.1.x/how-to/skipping.html#:~:text=Skip%20all%20test%20functions%20of%20a%20class%20or%20module&text=If%20you%20want%20to%20skip,skipif(...) |
address comment: OpenAdaptAI#462 (comment)
spacy miodel is ont installed
How pytest will be working if spacy model is not found
|
@abrichr Ready for merging ;-) addressed your comment |
from openadapt import config | ||
|
||
if not spacy.util.is_package(config.SPACY_MODEL_NAME): | ||
pytestmark = pytest.mark.skip(reason="SpaCy model not installed.") |
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.
This does not appear to be used anywhere, is that intentional?
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 is used when running pytest.
Basically, when the user does not have the Spacy Model installed then all of the tests in the file will be skipped.
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 the model is installed then, it will import scrub and continue to run the tests
…I#462) * remove spacy from manual steup instruciton in README.md * remove spacy installion from both the install scripts * add todo * test runtime code for spacy installtion * pyetst passes even if spacy model is not installed * addressing: OpenAdaptAI#462 (comment) * add spacy-trnasformers address comment: OpenAdaptAI#462 (comment) * skip all the tests in test_scrub if spacy miodel is ont installed * format
What kind of change does this PR introduce?
feature
Summary
Motivation: #461
Checklist
How can your code be run and tested?
Other information