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

Convert cluster environment methods to properties #12025

Closed
awaelchli opened this issue Feb 21, 2022 · 1 comment
Closed

Convert cluster environment methods to properties #12025

awaelchli opened this issue Feb 21, 2022 · 1 comment
Labels
environment refactor won't fix This will not be worked on

Comments

@awaelchli
Copy link
Contributor

awaelchli commented Feb 21, 2022

Proposed refactor

Convert the getter methods in the cluster environments to properties (read-only).

Motivation

The cluster environment is meant to be a look-up table, read-only

Pitch

Convert the getter methods in the cluster environments to properties (read-only).

PRO:

  • Consistent with the main_address and main_port methods which are already properties.
  • More pythonic?

CON:

  • Implementing a cluster environment requires overriding all methods/properties in the base abstract class. It can easily be forgotten by to add the @property decorator, leading to an error message a beginner might not understand.
  • Backward compatibility is harder to get right. On the metaclass level, we will have to wrap all non-property methods into properties when a developer uses an old environment implementation or implements one but doesn't add the decorator.

Additional context

Continuation from #6303


If you enjoy Lightning, check out our other projects! ⚡

  • Metrics: Machine learning metrics for distributed, scalable PyTorch applications.

  • Lite: enables pure PyTorch users to scale their existing code on any kind of device while retaining full control over their own loops and optimization logic.

  • Flash: The fastest way to get a Lightning baseline! A collection of tasks for fast prototyping, baselining, fine-tuning, and solving problems with deep learning.

  • Bolts: Pretrained SOTA Deep Learning models, callbacks, and more for research and production with PyTorch Lightning and PyTorch.

  • Lightning Transformers: Flexible interface for high-performance research using SOTA Transformers leveraging Pytorch Lightning, Transformers, and Hydra.

cc @justusschock @awaelchli @rohitgr7 @ananthsub

@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because it hasn't had any recent activity. This issue will be closed in 7 days if no further activity occurs. Thank you for your contributions, Pytorch Lightning Team!

@stale stale bot added the won't fix This will not be worked on label Apr 17, 2022
@stale stale bot closed this as completed Apr 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
environment refactor won't fix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant