-
Notifications
You must be signed in to change notification settings - Fork 147
Remove sqlitedict from requirements and import guard #460
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,7 +23,16 @@ | |
| import numpy as np | ||
| import spacy | ||
| from lm_eval.metrics import mean, weighted_mean, weighted_perplexity | ||
| from sqlitedict import SqliteDict | ||
|
|
||
| try: | ||
| from sqlitedict import SqliteDict | ||
|
|
||
| HAS_SQLITEDICT = True | ||
| except ImportError: | ||
| print( | ||
| "Eval harness with sqlitedict is deprecated. Sqlitedict has known vulnerability GHSA-g4r7-86gm-pgqc" | ||
| ) | ||
| HAS_SQLITEDICT = True | ||
|
|
||
|
|
||
| def _SPACY_NLP(*args, **kwargs): | ||
|
|
@@ -607,7 +616,8 @@ def __init__(self, lm, cache_db): | |
| self.cache_db = cache_db | ||
| if os.path.dirname(cache_db): | ||
| os.makedirs(os.path.dirname(cache_db), exist_ok=True) | ||
| self.dbdict = SqliteDict(cache_db, autocommit=True) | ||
| if HAS_SQLITEDICT: | ||
| self.dbdict = SqliteDict(cache_db, autocommit=True) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It honestly probably won't matter but probably best to set
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good suggestion, I've introduced an else statement |
||
|
|
||
| # add hook to lm | ||
| lm.set_cache_hook(self.get_cache_hook()) | ||
|
|
||
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 should be false.
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 catch!