Skip to content

Minor changes to prototype datasets #5282

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

Merged
merged 12 commits into from
Jan 27, 2022

Conversation

NicolasHug
Copy link
Member

Some minor changes we discussed earlier with @pmeier

@facebook-github-bot
Copy link

facebook-github-bot commented Jan 26, 2022

💊 CI failures summary and remediations

As of commit 0a2563e (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@@ -23,8 +23,7 @@ def register(dataset: Dataset) -> None:
register(obj())


# This is exposed as 'list', but we avoid that here to not shadow the built-in 'list'
def _list() -> List[str]:
def list_names() -> List[str]:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went for list_names since it corresponds to the name parameter of the load() function. Alternatives I could think of were more verbose (e.g. list_available_datasets()) but I'm happy to hear others thoughts

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To recap: list is a fitting name and this works fine if you do something like

from torchvision.prototype import datasets
datasets.list()

but you cannot (or better should not) do

from torchvision.prototype.datasets import list

Since we don't want to enforce a specific style on the user, we should use a name that works in both cases.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TensorFlow datasets uses list_builders probably for the same reason. That would correspond to lists_datasets for us, which I like a little better than list_names.

Copy link
Collaborator

@pmeier pmeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments inline. Thanks a lot @NicolasHug!

@@ -23,8 +23,7 @@ def register(dataset: Dataset) -> None:
register(obj())


# This is exposed as 'list', but we avoid that here to not shadow the built-in 'list'
def _list() -> List[str]:
def list_names() -> List[str]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To recap: list is a fitting name and this works fine if you do something like

from torchvision.prototype import datasets
datasets.list()

but you cannot (or better should not) do

from torchvision.prototype.datasets import list

Since we don't want to enforce a specific style on the user, we should use a name that works in both cases.

@@ -23,8 +23,7 @@ def register(dataset: Dataset) -> None:
register(obj())


# This is exposed as 'list', but we avoid that here to not shadow the built-in 'list'
def _list() -> List[str]:
def list_names() -> List[str]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TensorFlow datasets uses list_builders probably for the same reason. That would correspond to lists_datasets for us, which I like a little better than list_names.

@NicolasHug NicolasHug merged commit b94004a into pytorch:main Jan 27, 2022
facebook-github-bot pushed a commit that referenced this pull request Feb 3, 2022
Summary:
* Some Qs

* Some modifications

* don't need _loader in __init__

* list_names -> list_datasets

* Update torchvision/prototype/datasets/utils/_resource.py

* Remove unsued import

* fix tests

* Some missing renames

Reviewed By: kazhang

Differential Revision: D33927488

fbshipit-source-id: f30c15e79b8a5c41b56845adfc970cc40130b92c

Co-authored-by: Philip Meier <[email protected]>
Co-authored-by: Philip Meier <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants