-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
[FIX] fbgemm version check #3704
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
for more information, see https://pre-commit.ci
Summary of ChangesHello @Datta0, 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 addresses critical stability concerns by implementing a proactive version check for the 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 introduces a version check for fbgemm_gpu to avoid segmentation faults and allocation errors caused by older versions. The change correctly identifies and flags incompatible versions. However, the current implementation will cause unsloth to fail on import if fbgemm_gpu is not installed at all. I've provided a critical review comment with a suggested fix to first check if the package exists before attempting to retrieve its version, which will prevent this crash.
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
793c5d0 to
7b96903
Compare
|
/gemini review |
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 introduces two important version checks to prevent runtime issues: one for fbgemm_gpu and another for torchvision compatibility with torch. The changes are well-structured and address the issue described.
My review includes one high-severity feedback on unsloth/import_fixes.py. There is an inconsistency in the package name used for the fbgemm_gpu check, which could lead to incorrect behavior and user confusion. I've provided a code suggestion to correct the package name to fbgemm-gpu-genai consistently and to simplify the error message for better user experience. The new torchvision_compatibility_check function is well-implemented.
| fbgemm_gpu_version = importlib_version("fbgemm_gpu") | ||
| # We noticed some SegFault or bad alloc errors on lower versions of fbgemm_gpu. | ||
| if Version(fbgemm_gpu_version) < Version("1.4.0"): | ||
| raise ImportError( | ||
| f"Unsloth: fbgemm_gpu=={fbgemm_gpu_version} detected. It might cause unexpected issues. Please uninstall the current one by doing `pip uninstall fbgemm-gpu-genai && pip install fbgemm-gpu-genai` and install fbgemm-gpu-genai==1.4.0 or newer!" | ||
| ) | ||
| elif UNSLOTH_ENABLE_LOGGING: | ||
| print(f"Unsloth: fbgemm_gpu=={fbgemm_gpu_version} detected.") |
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.
There's an inconsistency in the package name. importlib_version is called with "fbgemm_gpu", but the error message refers to fbgemm-gpu-genai for the pip command. importlib_version should be called with the distribution package name (e.g., fbgemm-gpu-genai).
Additionally, the error message is a bit long and the upgrade instructions could be simplified. Using pip install --upgrade is more direct than uninstall followed by install.
Finally, the success log message should also be consistent with the package name.
| fbgemm_gpu_version = importlib_version("fbgemm_gpu") | |
| # We noticed some SegFault or bad alloc errors on lower versions of fbgemm_gpu. | |
| if Version(fbgemm_gpu_version) < Version("1.4.0"): | |
| raise ImportError( | |
| f"Unsloth: fbgemm_gpu=={fbgemm_gpu_version} detected. It might cause unexpected issues. Please uninstall the current one by doing `pip uninstall fbgemm-gpu-genai && pip install fbgemm-gpu-genai` and install fbgemm-gpu-genai==1.4.0 or newer!" | |
| ) | |
| elif UNSLOTH_ENABLE_LOGGING: | |
| print(f"Unsloth: fbgemm_gpu=={fbgemm_gpu_version} detected.") | |
| fbgemm_gpu_version = importlib_version("fbgemm-gpu-genai") | |
| # We noticed some SegFault or bad alloc errors on lower versions of fbgemm_gpu. | |
| if Version(fbgemm_gpu_version) < Version("1.4.0"): | |
| raise ImportError( | |
| f"Unsloth: fbgemm-gpu-genai=={fbgemm_gpu_version} detected. It might cause unexpected issues. " | |
| f"Please upgrade to version 1.4.0 or newer by running: `pip install --upgrade fbgemm-gpu-genai`" | |
| ) | |
| elif UNSLOTH_ENABLE_LOGGING: | |
| print(f"Unsloth: fbgemm-gpu-genai=={fbgemm_gpu_version} detected.") |
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.
@Datta0 see it works
As @rolandtannous noticed, fbgemm 1.3.0 causes issues (Seg fault and bad alloc) so force 1.4.0 or newer if it is installed.
Note that even though one might not be using fp8, mere existence of fbgemm can cause issues with vllm importing it
So we check this before almost anything else
Sample error
Successful case
No fbgemm