[Bug] Fix torch dynamo warning Dynamo detected a call to a functools.lru_cache#29038
[Bug] Fix torch dynamo warning Dynamo detected a call to a functools.lru_cache#29038youkaichao merged 3 commits intomainfrom
functools.lru_cache#29038Conversation
Signed-off-by: yewentao256 <zhyanwentao@126.com>
There was a problem hiding this comment.
Code Review
This pull request successfully resolves a torch.dynamo warning by replacing a functools.cache decorator with a module-level variable. While this fixes the warning, the changes to the test suite to accommodate this are not ideal. Specifically, the modification in conftest.py introduces a global side effect by setting an environment variable at the module level, which breaks test isolation. I've provided a critical suggestion to revert to a pytest fixture, using monkeypatch.setattr to ensure test isolation and proper setup/teardown. A related high-severity suggestion is made in test_batch_invariance.py to align with this improved testing pattern, making the test cleaner and more robust.
Signed-off-by: yewentao256 <zhyanwentao@126.com>
|
Nice, thanks for fixing this. |
….lru_cache` (vllm-project#29038) Signed-off-by: yewentao256 <zhyanwentao@126.com>
….lru_cache` (vllm-project#29038) Signed-off-by: yewentao256 <zhyanwentao@126.com> Signed-off-by: Runkai Tao <rt572@physics.rutgers.edu>
….lru_cache` (vllm-project#29038) Signed-off-by: yewentao256 <zhyanwentao@126.com>
….lru_cache` (vllm-project#29038) Signed-off-by: yewentao256 <zhyanwentao@126.com>
Purpose
The warning is from @cache in batch invariant variable, this PR fixes that
Test
All batch invariant unit tests pass