-
Notifications
You must be signed in to change notification settings - Fork 599
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed __str__ return to include Tensor-Wise information for issue #1439. #1543
Conversation
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 PR reverts hidden tensors and can't be accepted in the current state.
@farizrahman4u Hello!! |
For some reason, I noticed this comment only now, Can you please point me to the documentation for hidden tensors? I didn't know that my commit was affecting something. |
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 have commented on the lines which reverts previous PRs. Seems your git history is messed up.
done it again
Hello!!, I have done it afresh, and checked the comparison as well. This time its showing only the lines I have added and removed.(Previously I think I made a mess while trying to manually compare the files with the pip version.) |
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.
- Move the helper methods (including the logic in
__str__
to a util file, likehub/util/summary.py
- Use snake case everywhere (except class names)
- Instead of changing
__str__
, add.summary()
method to bothTensor
andDataset
.
@farizrahman4u Thank you for the review!! I have made the changes requested and added compression type in the table. Please tell me if it needs other changes. |
hub/core/dataset/dataset.py
Outdated
tensor_name = tensor | ||
tensor_htype = tensor_object.htype | ||
tensor_shape = str(tensor_object.shape) | ||
tensor_dtype = tensor_object.dtype.name |
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.
tensor_object.dtype
could be None and it will not have name
attribute. Just do ds.create_tensor("abc")
to reproduce the error.
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 made the changes. Can you please review it once again? @FayazRahman @farizrahman4u @mikayelh @tatevikh
Handling None Types
@FayazRahman Thank You for the review!! I have added support for None types for all attributes except for tensor_shape (It initializes at (0,)). Also while trying to add new tensors I noticed that with |
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.
- Use
self.tensors
instead ofself.version_state["full_tensors"]
to hide hidden tensors. - Many variables are still in camel case, please switch to snake case as mentioned in the previous review.
- A simple unit test would be nice.
- Move the summary logic for dataset and tensor to a util file, like
hub/util/summary.py
(Again, from previous review).
hub/core/dataset/dataset.py
Outdated
divider = ["-------"] * 5 | ||
tensor_dict = self.version_state[ | ||
"full_tensors" | ||
] # Creating a list of tensors in the dataset |
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.
Comment not required - this is a dict not a list, and should self.tensors
instead of self.version_state["full_tensors"]
Hello!! Thanks alot for the review. I have made the changes. Last time I actually thought that we had to move only the helper functions out to utils(not the ones which were implemented as methods). Sorry about the late reply, had my end terms going. I will write unit tests for both tensor and dataset str methods soon and if its alright in another PR. Please check out the new changes. @farizrahman4u @FayazRahman |
Tests need to in the same PR @neel2299 . Just calling |
Thanks for the review once again :) . I changed the tests for test_stringify according to the new implementation and added summary tests. @farizrahman4u @FayazRahman |
removing unneeded import
added test for local path
Added test for local path (the failed test) @farizrahman4u @FayazRahman |
Merge pull request #15 from neel2299/main
Great job @neel2299. Thanks for your contribution to Hub 馃殌 . |
Learned alot!! @tatevikh . Thanks to community :) |
馃殌 馃殌 Pull Request
Checklist:
coverage-rate
upChanges
Used pandas to_string method to get the tensor information into a table.