[Bugfix] Enforce installed FlashInfer version to match optional requirement#24671
[Bugfix] Enforce installed FlashInfer version to match optional requirement#24671mgoin wants to merge 1 commit intovllm-project:mainfrom
Conversation
Signed-off-by: mgoin <mgoin64@gmail.com>
There was a problem hiding this comment.
Code Review
This pull request effectively addresses the need to enforce a specific version of FlashInfer. By centralizing the version number in vllm/version.py and using it in setup.py, you've improved maintainability. The addition of a runtime version check in vllm/utils/flashinfer.py is a great step towards preventing user errors and ensuring compatibility. I have one suggestion to make the version validation even more robust.
| except (ImportError, AttributeError): | ||
| return False |
There was a problem hiding this comment.
The try...except block does not handle a potential ValueError (or packaging.version.InvalidVersion) that can be raised by packaging.version.parse() if flashinfer.__version__ is not a valid PEP 440 version string. An unhandled exception here would crash the application during initialization. It's safer to catch this exception to prevent such crashes.
| except (ImportError, AttributeError): | |
| return False | |
| except (ImportError, AttributeError, ValueError): | |
| return False |
| # Parse both versions to handle version comparison properly | ||
| expected = parse(FLASHINFER_VERSION) | ||
| actual = parse(flashinfer.__version__) | ||
| return actual == expected |
pavanimajety
left a comment
There was a problem hiding this comment.
Thanks, I agree enforcing FI version is good considering we test a given commit / release of vLLM against a specific FI version.
|
This pull request has merge conflicts that must be resolved before it can be |
|
Not needed with #26443 |
Purpose
Previously there was no enforcement on the installed version of FlashInfer, just that the imported function exists. This enforcement should help guide users to install FI using the official pathway and reduce user error when FI function behavior changes.
Test Plan
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.