-
Notifications
You must be signed in to change notification settings - Fork 62
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
Restructure et_relay subpackage #124
Conversation
et_replay/ - several high level modules mainly responsible for parsing - tools # previously was on a layer above, moved here to simplify imports management - comm # comm utils and functionalities, to be expanded - __init__.py # to hide files locations yet always export important symbols `train` now doesn't care about actual files' locations.
Hi @amaslenn! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
cc @TaekyungHeo |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
The change is a good move to make et_replay a package. But let's keep the imports absolute, they are not long enough yet for us to make them relative. Relative imports spoil readability, pep8 friendliness and refactoring capabilities. Within this single PR we are importing the |
et_replay/pyproject.toml
Outdated
@@ -7,8 +7,8 @@ name = "et_replay" | |||
version = "0.5.0" | |||
|
|||
[tool.setuptools.package-dir] | |||
"et_replay.lib.comm" = "lib/comm" | |||
"et_replay.tools" = "tools" | |||
"et_replay" = "lib" |
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 makes sense, to call everything under lib
as a part of the et_replay
package.
et_replay/lib/__init__.py
Outdated
@@ -0,0 +1,3 @@ | |||
from .execution_trace import ExecutionTrace |
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.
+1 on exposing the ET class from the package init, but no harm in making this import absolute.
from .. import ExecutionTrace | ||
from . import comms_utils | ||
from .comms_utils import commsArgs | ||
from .pytorch_backend_utils import supportedP2pOps |
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.
can we keep the imports absolute? our absolute import strings are not really that long for us to justify relative imports. they also make code refactoring tricky. absolute imports are also more readable and pep8 friendly.
@sanrise thank you for the feedback! I mainly agree with you on relative imports topic, but there are a reason I made it like this:
Anyway, I can use absolute imports and also keep |
@sanrise has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Sounds like presence of
Do you see a benefit of keeping it around just to have have it remapped in the toml? I don't, and I believe this will make everything more cleaner/easier. Thoughts? |
@amaslenn has updated the pull request. You must reimport the pull request before landing. |
Generally I prefer having a top-level folder for a package or even have src-layout. It makes packaging more standard and manageable. But in our case IMO flat structure is fine too. I've updated my PR accordingly. |
thanks a lot! will import and run the linters / static checks shortly. |
@sanrise has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@sanrise, please don't merge this PR until we inform you. |
et_replay/utils.py
Outdated
@@ -6,7 +6,7 @@ | |||
import uuid | |||
from typing import Any, Dict | |||
|
|||
from et_replay.lib.execution_trace import ExecutionTrace | |||
from et_replay.execution_trace import ExecutionTrace |
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.
nit: for the record, this can also be from et_replay import ExecutionTrace
. But this works too. (y)
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.
Thank you! This makes sense, updated.
@amaslenn has updated the pull request. You must reimport the pull request before landing. |
@TaekyungHeo after import we are seeing some Black formatting error. Did you guys run black formatter already? |
@TaekyungHeo also can you rebase to latest param main commit? |
Summary: 1. Make `et_replay` structure easier to refactor: added an entry point to export public symbols, used it in train code. 2. Enabled tests run as part of GHA CI. Reviewed at facebookresearch#124 Pull Request resolved: facebookresearch#129 Test Plan: CI ## Additional Notes -- Differential Revision: D59178710 Pulled By: sanrise
Summary: Pull Request resolved: facebookresearch#133 1. Make `et_replay` structure easier to refactor: added an entry point to export public symbols, used it in train code. 2. Enabled tests run as part of GHA CI. Reviewed at facebookresearch#124 Pull Request resolved: facebookresearch#129 Test Plan: CI ## Additional Notes -- Differential Revision: D59178710 Pulled By: sanrise
Summary: Pull Request resolved: facebookresearch#133 1. Make `et_replay` structure easier to refactor: added an entry point to export public symbols, used it in train code. 2. Enabled tests run as part of GHA CI. Reviewed at facebookresearch#124 Pull Request resolved: facebookresearch#129 Test Plan: CI ## Additional Notes -- Differential Revision: D59178710 Pulled By: sanrise
Summary: Pull Request resolved: facebookresearch#133 1. Make `et_replay` structure easier to refactor: added an entry point to export public symbols, used it in train code. 2. Enabled tests run as part of GHA CI. Reviewed at facebookresearch#124 Pull Request resolved: facebookresearch#129 Test Plan: CI ## Additional Notes -- Reviewed By: shengfukevin Differential Revision: D59178710 Pulled By: sanrise
Summary: Pull Request resolved: #133 1. Make `et_replay` structure easier to refactor: added an entry point to export public symbols, used it in train code. 2. Enabled tests run as part of GHA CI. Reviewed at #124 Pull Request resolved: #129 Test Plan: CI ## Additional Notes -- Reviewed By: shengfukevin Differential Revision: D59178710 Pulled By: sanrise fbshipit-source-id: 81762730953136d3a3560b17aac2c8b1de7e8343
@sanrise shall we close this PR now? |
Let's reopen if needed. |
Summary
et_replay
structure easier to refactor: added an entry point to export public symbols, used it intrain
code.Test Plan
CI
Additional Notes
—