-
Notifications
You must be signed in to change notification settings - Fork 631
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
Intrinsics #2207
Intrinsics #2207
Conversation
@@ -20,13 +21,15 @@ def __setstate__(self, state: Dict[str, Any]): | |||
|
|||
def tobytes(self) -> bytes: | |||
d = {str(k): v for k, v in self.__getstate__().items()} | |||
return bytes(json.dumps(d, sort_keys=True, indent=4), "utf-8") | |||
return bytes( | |||
json.dumps(d, sort_keys=True, indent=4, cls=HubJsonEncoder), "utf-8" |
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.
why do we need this change?
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.
Because intrinsics are numpy arrays.
|
||
@classmethod | ||
def frombuffer(cls, buffer: bytes): | ||
instance = cls() | ||
if len(buffer) > 0: | ||
instance.__setstate__(json.loads(buffer)) | ||
instance.__setstate__(json.loads(buffer, cls=HubJsonDecoder)) |
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.
and here?
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.
We should check the dimensions of intrinsics samples during upload
🚀 🚀 Pull Request
Checklist:
coverage-rate
upChanges
Add intrinsics htype.