-
Notifications
You must be signed in to change notification settings - Fork 476
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
Notebook/fix vector search #448
Notebook/fix vector search #448
Conversation
superduperdb/core/component.py
Outdated
@@ -16,6 +16,15 @@ class Component(Serializable): | |||
|
|||
variety: t.ClassVar[str] | |||
|
|||
def init(self, db): |
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.
?
superduperdb/core/model.py
Outdated
@dc.dataclass | ||
class Model(Component): | ||
class Model(PredictMixin, Component): |
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.
Model(Component, PredictMixin)
from superduperdb.encoders.torch.tensor import tensor | ||
|
||
t = tensor(torch.float, shape=(64,)) | ||
|
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.
you can remove extra lines in this entire file
if isinstance(r, dict): | ||
out = [] | ||
for k, v in r.items(): | ||
if isinstance(v, dict) and 'file_id' in v: |
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.
a nitpick:
we can make these hardcoded strings as constants
return hash(self.artifact) | ||
except TypeError as e: | ||
if isinstance(self.artifact, list): | ||
return hash(str(self.artifact[:100])) |
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.
:100 magic number?
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 is just to handle cases where something is not hashable.
db: 'BaseDatabase' = None, # type: ignore[name-defined] | ||
select: t.Optional[Select] = None, | ||
distributed: bool = False, | ||
ids: t.Optional[t.List[str]] = None, |
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.
t.Sequence
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 seems to cause problems with themypy
.
superduperdb/core/serializable.py
Outdated
|
||
|
||
def load_artifacts(d, getter, cache): | ||
if isinstance(d, dict) or isinstance(d, list): |
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 isinstance(d, [dict, list])
superduperdb/core/serializable.py
Outdated
serializer=v['serializer'], | ||
) | ||
d[k] = cache[v['file_id']] | ||
elif isinstance(v, dict) or isinstance(v, list): |
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.
same here
@@ -36,6 +36,7 @@ | |||
# to the rest of the code. | |||
# It should be moved to the Server's initialization code where it can be available to | |||
# all threads. | |||
from ...core.artifact import Artifact, get_artifacts, infer_artifacts | |||
from ...core.job import FunctionJob, ComponentJob, Job |
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.
I think we should be consistant with the imports style
Description
The vector-index notebooks were broken after the big refactoring which pivoted all
Component
subclassesto
@dataclass
. This PR provides the necessary changes.Related Issue(s)
This points towards the need to smoke-test at least some of the notebooks #389.