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 package contraints to torchbench #2318

Closed
wants to merge 8 commits into from
Closed

Add package contraints to torchbench #2318

wants to merge 8 commits into from

Conversation

xuzhao9
Copy link
Contributor

@xuzhao9 xuzhao9 commented Jun 19, 2024

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

@xuzhao9 xuzhao9 requested a review from eellison June 19, 2024 19:25
@xuzhao9 xuzhao9 had a problem deploying to docker-s3-upload June 19, 2024 19:42 — with GitHub Actions Failure
@xuzhao9 xuzhao9 had a problem deploying to docker-s3-upload June 19, 2024 19:42 — with GitHub Actions Failure
@xuzhao9 xuzhao9 had a problem deploying to docker-s3-upload June 19, 2024 19:58 — with GitHub Actions Failure
@xuzhao9 xuzhao9 had a problem deploying to docker-s3-upload June 19, 2024 19:58 — with GitHub Actions Failure
@xuzhao9 xuzhao9 removed the request for review from eellison June 19, 2024 21:02
@xuzhao9 xuzhao9 had a problem deploying to docker-s3-upload June 19, 2024 22:35 — with GitHub Actions Failure
@xuzhao9 xuzhao9 had a problem deploying to docker-s3-upload June 19, 2024 22:36 — with GitHub Actions Failure
@xuzhao9 xuzhao9 had a problem deploying to docker-s3-upload June 19, 2024 23:22 — with GitHub Actions Failure
@xuzhao9 xuzhao9 had a problem deploying to docker-s3-upload June 19, 2024 23:22 — with GitHub Actions Failure
@xuzhao9 xuzhao9 temporarily deployed to docker-s3-upload June 20, 2024 02:33 — with GitHub Actions Inactive
@xuzhao9 xuzhao9 temporarily deployed to docker-s3-upload June 20, 2024 02:33 — with GitHub Actions Inactive
@facebook-github-bot
Copy link
Contributor

@xuzhao9 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@xuzhao9 xuzhao9 requested a review from huydhn June 20, 2024 13:01
@facebook-github-bot
Copy link
Contributor

@xuzhao9 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@xuzhao9 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

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.")
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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",
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

@huydhn huydhn left a 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

@facebook-github-bot
Copy link
Contributor

@xuzhao9 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@xuzhao9 has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@xuzhao9 merged this pull request in 53faa0a.

@xuzhao9 xuzhao9 deleted the xz9/fix-numpy branch June 21, 2024 00:13
facebook-github-bot pushed a commit that referenced this pull request Jun 21, 2024
Summary:
Unfortunately, #2318 has a bug that breaks the `soft_actor_critic` model.

Pull Request resolved: #2326

Reviewed By: aaronenyeshi

Differential Revision: D58871386

Pulled By: xuzhao9

fbshipit-source-id: 5f8b5fbe00722ccb647b08a8089fd52a7719208c
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