-
Notifications
You must be signed in to change notification settings - Fork 573
Moved common requirements from docker and setup.py to file #1880
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
Conversation
Summary of ChangesHello @nvmbreughe, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the project's dependency management by introducing a central Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request is a great step towards improving dependency management by consolidating common requirements into a single requirements.txt file. This reduces duplication between setup.py and the Docker build process. My review includes a few suggestions to enhance the robustness and efficiency of these changes. Specifically, I recommend removing torch from requirements.txt to avoid installation conflicts, ensuring the build fails if requirements.txt is missing, and combining pip installation commands in the Docker script for better performance.
| packaging>=24.2 | ||
| requests | ||
| tabulate | ||
| 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.
torch is installed separately in docker/install/install_python_packages.sh using a specific index URL based on the CUDA version. Including it in requirements.txt is redundant and can lead to version conflicts or incorrect installations. For users installing via setup.py, it's standard practice to expect them to have torch pre-installed according to their specific hardware and CUDA setup. Please remove torch from this file.
| if not requirements_file.exists(): | ||
| return [] |
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.
Silently returning an empty list when requirements.txt is missing can lead to a successful installation with missing dependencies, which will cause hard-to-debug runtime errors. It's better to let the build fail fast if requirements.txt is not found. Removing this check will allow path.read_text() to raise a FileNotFoundError, which is the desired behavior.
| pip3 install -r requirements.txt | ||
| pip3 install responses pytest scipy build cuda-python nvidia-nvshmem-cu12 |
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.
To improve efficiency, you can combine these two pip install commands into a single call. This allows pip to perform dependency resolution once for all packages, which is faster and can help avoid potential dependency conflicts.
| pip3 install -r requirements.txt | |
| pip3 install responses pytest scipy build cuda-python nvidia-nvshmem-cu12 | |
| pip3 install -r requirements.txt responses pytest scipy build cuda-python nvidia-nvshmem-cu12 |
|
/bot run |
|
This is failing because requirements.txt lives in root, and the docker build command is invoked in the docker directory. If we want this to work we either need to move requirements.txt into the docker directory, or update the docker build command. Preference is the latter. |
Agreed with the latter |
yzh119
left a comment
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.
LGTM
<!-- .github/pull_request_template.md --> ## 📌 Description This PR fixes the dev container after #1880. <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete. ### ✅ Pre-commit Checks - [ ] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [ ] I have installed the hooks with `pre-commit install`. - [ ] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). ## 🧪 Tests - [ ] Tests have been added or updated as needed. - [ ] All tests are passing (`unittest`, etc.). ## Reviewer Notes <!-- Optional: anything you'd like reviewers to focus on, concerns, etc. -->
<!-- .github/pull_request_template.md --> ## 📌 Description This PR fixes the dev container after flashinfer-ai#1880. <!-- What does this PR do? Briefly describe the changes and why they’re needed. --> ## 🔍 Related Issues <!-- Link any related issues here --> ## 🚀 Pull Request Checklist Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete. ### ✅ Pre-commit Checks - [ ] I have installed `pre-commit` by running `pip install pre-commit` (or used your preferred method). - [ ] I have installed the hooks with `pre-commit install`. - [ ] I have run the hooks manually with `pre-commit run --all-files` and fixed any reported issues. > If you are unsure about how to set up `pre-commit`, see [the pre-commit documentation](https://pre-commit.com/). ## 🧪 Tests - [ ] Tests have been added or updated as needed. - [ ] All tests are passing (`unittest`, etc.). ## Reviewer Notes <!-- Optional: anything you'd like reviewers to focus on, concerns, etc. -->
📌 Description
To avoid duplication bugs between Dockerfile (install_python_packages.sh) and setup.py, the common dependencies were moved into requirements.txt
🔍 Related Issues
🚀 Pull Request Checklist
Thank you for contributing to FlashInfer! Before we review your pull request, please make sure the following items are complete.
✅ Pre-commit Checks
pre-commitby runningpip install pre-commit(or used your preferred method).pre-commit install.pre-commit run --all-filesand fixed any reported issues.🧪 Tests
unittest, etc.).Reviewer Notes