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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add torchvision maintainers guide #7109

Merged
merged 14 commits into from
Jan 30, 2023
Merged

Conversation

NicolasHug
Copy link
Member

@NicolasHug NicolasHug commented Jan 18, 2023

This guide properly documents our deprecation policy (which was introduced a while ago) and establishes the distinction between public and private APIs - following the torch core policy.

Rendered version

CC @pmeier

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.

Mostly minor comments, thanks Nicolas. Otherwise I agree to have something like that. Let's pull in @vfdev-5 too as the three of us are the only active maintainers at this point.

maintainer_guide.md Outdated Show resolved Hide resolved

### What is public and what is private?

For the Python API, torchvision largely follows the [torch core
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm never sure how we should call core: torch or PyTorch?

Copy link
Member Author

Choose a reason for hiding this comment

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

over here it's usually "torch core" or "core", but "PyTorch" isn't ambiguous either. Happy with whatever you prefer

Copy link
Collaborator

Choose a reason for hiding this comment

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

In that case, I'm in favor of "torch" since with that we don't have a disconnect in the naming scheme when talking about "torchvision". (I really hate that in conda install pytorch torchvision -c pytorch)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry to be pedantic but "torch" may refer to the original Lua torch ? https://en.wikipedia.org/wiki/Torch_(machine_learning)

maintainer_guide.md Outdated Show resolved Hide resolved
Comment on lines 18 to 19
- objects that start with a leading underscore are private unless they're
exposed / aliased as public in a public `__init__.py` file
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are you referring to the situation discussed offline, i.e. defining public function in a private namespace and expose them in a public one? If so, can we clarify the text? The "exposed / aliased" implies for me that if we expose _foo in a public __init__.py, it can be considered public. Was that your intention?

Copy link
Member Author

Choose a reason for hiding this comment

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

Happy to clarify, I tried "exposed / aliased as public" but maybe it's not clear enough. Perhaps

exposed / aliased as public (i.e. without a leading underscore) in a public __init__.py file

?

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe a simpler way is to just say:

Any object exposed in a public __init__.py is public unless it has a leading underscore in its immediate name

?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, I like that a lot better

Copy link
Member Author

Choose a reason for hiding this comment

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

So it's just a special case of what we have above:

  • objects in a public file that don't have a leading underscore are public

Do you think it's worth re-iterating that with __init__.py ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Technically yes, since __init__.py itself is not a public file given its underscores. But since have stated above that our definition might technically not be perfect and this should be common knowledge for Python devs, I'm ok to merge the two.

maintainer_guide.md Outdated Show resolved Hide resolved
maintainer_guide.md Outdated Show resolved Hide resolved
maintainer_guide.md Outdated Show resolved Hide resolved
NicolasHug and others added 3 commits January 18, 2023 14:40
Co-authored-by: Philip Meier <github.pmeier@posteo.de>
Co-authored-by: Philip Meier <github.pmeier@posteo.de>
Comment on lines 43 to 49
### Deprecation policy.

Because they're disruptive, **deprecations should only be used sparingly**.

We largely follow the [torch core
policy](https://github.com/pytorch/pytorch/wiki/PyTorch's-Python-Frontend-Backward-and-Forward-Compatibility-Policy):
breaking changes require a deprecation period of at least 2 versions.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would assume that this document is not intended to users. However this part and other part about C++ being private, it worth exposing to the users.

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 agree...
At the same time, I don't know where we could expose it properly. Pytorch typically doesn't have that in the online docs (I think?), it's rather in the Wiki which most users wouldn't unless they're actively searching for it.

Perhaps changing the title from maintiner_guie to policies or something like that? Happy to hear any other suggestion

@NicolasHug
Copy link
Member Author

@pmeier @vfdev-5 any additional concern / comment I can address before merging?

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.

Two nits, but otherwise LGTM! Thanks Nicolas!

maintainer_guide.md Outdated Show resolved Hide resolved
maintainer_guide.md Outdated Show resolved Hide resolved
Co-authored-by: Philip Meier <github.pmeier@posteo.de>
Copy link
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

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

LGTM as well, thanks @NicolasHug

@NicolasHug NicolasHug merged commit 6a85ef2 into pytorch:main Jan 30, 2023
@github-actions
Copy link

Hey @NicolasHug!

You merged this PR, but no labels were added. The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py

@NicolasHug NicolasHug added the other if you have no clue or if you will manually handle the PR in the release notes label Jan 30, 2023
facebook-github-bot pushed a commit that referenced this pull request Feb 8, 2023
Summary: Co-authored-by: Philip Meier <github.pmeier@posteo.de>

Reviewed By: vmoens

Differential Revision: D43116115

fbshipit-source-id: c5c343ae1aecfbc4779fc88c16369f53f397d30c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla signed other if you have no clue or if you will manually handle the PR in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants