-
Notifications
You must be signed in to change notification settings - Fork 291
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 package contraints to torchbench #2318
Conversation
@xuzhao9 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@xuzhao9 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@xuzhao9 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
utils/python_utils.py
Outdated
import sys | ||
constraints_file = REPO_DIR.joinpath("build", "constraints.txt") | ||
if not constraints_file.exists(): | ||
warnings.warn("constraints.txt could not be found, please rerun install.py.") |
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.
My read here is that build/constraints.txt
is an optional constraints file that TorchBench users could provide. But the warning here seems to says that the file is a requirement?
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.
Yes, it is an optional constraint. We could update the warning message to sth like:
The build/constrants.txt
file is not found. Please consider rerunning the install.py
script to generate it.
It is recommended to have the build/constrants.txt
file to prevent unexpected version change of numpy
or torch
.
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.
Ah ok, I see the generate_pkg_constraints
func above now
|
||
|
||
def create_conda_env(pyver: str, name: str): | ||
command = ["conda", "create", "-n", name, "-y", f"python={pyver}"] | ||
subprocess.check_call(command) | ||
|
||
|
||
def pip_install_requirements(requirements_txt="requirements.txt", |
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.
I'm not sure if it's easy to add a verbose option here and when it's set to true, print out the output of the pip install command below. When I used install.py
locally, it installs stuffs silently even with -v
, which makes it a bit slow to figure out which models install what
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.
Adding a verbose option sounds reasonable, but it will be non-trival to turn it on across all models, since each model has its own install.py
.
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 is a nice fix. TIL, there is a pip constraint file
@xuzhao9 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@xuzhao9 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
This PR introduces package constraints because we want to guarantee that certain packages are the same version before and after the installation. This is important for the CI in pytorch/pytorch because overriding critical package versions will break the CI due to ABI incompatibility.
If we find a certain model breaks the constraints in the future, we could ask the model installer to apply the
constraint.txt
file with their requirements.txt file.PyTorch CI Test: pytorch/pytorch#129114