fix: Pin expected tensor to same device in online retrieval test - #6777
fix: Pin expected tensor to same device in online retrieval test#6777piyush182004 wants to merge 3 commits into
Conversation
test_get_online_features computes `device` from torch.cuda.is_available()
and passes it when building the expected tensors for `driver_id` and
`trips`, but the `avg_orders_day` assertion omits it.
OnlineResponse.to_tensor() places its output on cuda when a GPU is
present (sdk/python/feast/online_response.py), so on a GPU host the
expected tensor stays on cpu and torch.equal raises:
RuntimeError: Expected all tensors to be on the same device, but got
other is on cpu, different from other tensors on cuda:0
(when checking argument in method wrapper_CUDA__equal)
CI runs CPU-only, where `device` resolves to "cpu" and the omission has
no effect, so this only reproduces on machines with CUDA available.
Verified on a CUDA host: the unmodified test fails with the GPU visible
and passes under CUDA_VISIBLE_DEVICES="", while the patched test passes
in both cases.
Signed-off-by: Piyush Mondal <piyushmondal182004@gmail.com>
There was a problem hiding this comment.
Pull request overview
Pins the expected avg_orders_day tensor to the detected device, fixing the test on CUDA hosts.
Changes:
- Adds
device=deviceto the expected tensor.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6777 +/- ##
=======================================
Coverage 47.08% 47.08%
=======================================
Files 419 419
Lines 51878 51878
Branches 7525 7525
=======================================
Hits 24429 24429
Misses 25700 25700
Partials 1749 1749
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
ISSUE FIXED:- #6778
What this PR does / why we need it:
test_get_online_featurescomputesdevicefromtorch.cuda.is_available()and passes it when building the expected tensors for
driver_idandtrips,but the
avg_orders_dayassertion omits it.OnlineResponse.to_tensor()places its output oncudawhen a GPU is present(
sdk/python/feast/online_response.py), so on a GPU host the expected tensorstays on
cpuandtorch.equalraises:RuntimeError: Expected all tensors to be on the same device, but got other is
on cpu, different from other tensors on cuda:0
(when checking argument in method wrapper_CUDA__equal)
CI runs CPU-only, where
deviceresolves to"cpu"and the omission has noeffect — so this only reproduces on machines with CUDA available.
Verified on a CUDA host (RTX 4050), same machine and same code, varying only
GPU visibility:
CUDA_VISIBLE_DEVICES=""Full unit suite after the change: 2635 passed, 44 skipped.
Which issue(s) this PR fixes:
Checks
git commit -s)Testing Strategy