Skip to content
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

Merged
merged 27 commits into from
Apr 7, 2022

Conversation

neel2299
Copy link
Contributor

@neel2299 neel2299 commented Mar 15, 2022

馃殌 馃殌 Pull Request

Checklist:

  • My code follows the style guidelines of this project and the Contributing document
  • I have commented my code, particularly in hard-to-understand areas
  • I have kept the coverage-rate up
  • I have performed a self-review of my own code and resolved any problems
  • I have checked to ensure there aren't any other open Pull Requests for the same change
  • I have described and made corresponding changes to the relevant documentation
  • New and existing unit tests pass locally with my changes

Changes

Used pandas to_string method to get the tensor information into a table.

@CLAassistant
Copy link

CLAassistant commented Mar 15, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@farizrahman4u farizrahman4u left a 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.

hub/core/dataset/dataset.py Outdated Show resolved Hide resolved
@neel2299
Copy link
Contributor Author

neel2299 commented Mar 15, 2022

@farizrahman4u Hello!!
I made the logic this time, please check it out...

@neel2299
Copy link
Contributor Author

This PR reverts hidden tensors and can't be accepted in the current state.

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.

Copy link
Contributor

@farizrahman4u farizrahman4u left a 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.

hub/core/dataset/dataset.py Outdated Show resolved Hide resolved
hub/core/dataset/dataset.py Outdated Show resolved Hide resolved
hub/core/dataset/dataset.py Outdated Show resolved Hide resolved
hub/core/dataset/dataset.py Outdated Show resolved Hide resolved
hub/core/dataset/dataset.py Outdated Show resolved Hide resolved
hub/core/dataset/dataset.py Outdated Show resolved Hide resolved
hub/core/dataset/dataset.py Outdated Show resolved Hide resolved
hub/core/dataset/dataset.py Outdated Show resolved Hide resolved
hub/core/dataset/dataset.py Outdated Show resolved Hide resolved
@neel2299 neel2299 reopened this Mar 17, 2022
@neel2299
Copy link
Contributor Author

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.)

@neel2299 neel2299 mentioned this pull request Mar 19, 2022
2 tasks
Copy link
Contributor

@farizrahman4u farizrahman4u left a 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, like hub/util/summary.py
  • Use snake case everywhere (except class names)
  • Instead of changing __str__, add .summary() method to both Tensor and Dataset.

@neel2299
Copy link
Contributor Author

neel2299 commented Mar 27, 2022

@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.

tensor_name = tensor
tensor_htype = tensor_object.htype
tensor_shape = str(tensor_object.shape)
tensor_dtype = tensor_object.dtype.name
Copy link
Contributor

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.

Copy link
Contributor Author

@neel2299 neel2299 Apr 3, 2022

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

@neel2299
Copy link
Contributor Author

@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 ds.create_tensor("abc") , along with "abc" we get another tensor "_abc_id" . This was happening with the current main hub repo as well. Is it getting created for some specific reason?
image

Copy link
Contributor

@farizrahman4u farizrahman4u left a 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 of self.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).

divider = ["-------"] * 5
tensor_dict = self.version_state[
"full_tensors"
] # Creating a list of tensors in the dataset
Copy link
Contributor

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"]

@neel2299
Copy link
Contributor Author

neel2299 commented Apr 5, 2022

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

@farizrahman4u
Copy link
Contributor

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 .summary on tensors and datasets with htype specified and unspecified, compression specified and unspecified etc would do.

@neel2299
Copy link
Contributor Author

neel2299 commented Apr 6, 2022

Thanks for the review once again :) . I changed the tests for test_stringify according to the new implementation and added summary tests. @farizrahman4u @FayazRahman

@farizrahman4u farizrahman4u added the trigger-test Label trigger to run tests on PRs label Apr 6, 2022
@activeloop-bot activeloop-bot removed the trigger-test Label trigger to run tests on PRs label Apr 6, 2022
@neel2299
Copy link
Contributor Author

neel2299 commented Apr 6, 2022

Added test for local path (the failed test) @farizrahman4u @FayazRahman

@FayazRahman FayazRahman added the trigger-test Label trigger to run tests on PRs label Apr 7, 2022
@activeloop-bot activeloop-bot removed the trigger-test Label trigger to run tests on PRs label Apr 7, 2022
@tatevikh tatevikh merged commit 9fd9a23 into activeloopai:main Apr 7, 2022
@tatevikh
Copy link
Collaborator

tatevikh commented Apr 7, 2022

Great job @neel2299. Thanks for your contribution to Hub 馃殌 .

@neel2299
Copy link
Contributor Author

neel2299 commented Apr 8, 2022

Learned alot!! @tatevikh . Thanks to community :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants