feast-dev / feast-dev/feast

test_get_online_features fails on GPU hosts: expected tensor built on cpu

Open Beginner friendly
#6,778 0 comments 0 reactions 0 assignees View on GitHub
kind/bug priority/p2
Dominant language
Python
Stars
7.3k
Forks
1.4k
Avg merge
1d 21h
Merged PRs (30d)
15

Description

## Expected Behavior

`sdk/python/tests/unit/online_store/test_online_retrieval.py::test_get_online_features` should pass on any host, with or without a CUDA device.

## Current Behavior

On a host with CUDA available, the test fails:

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)

`OnlineResponse.to_tensor()` places its output on `cuda` when a GPU is present (`sdk/python/feast/online_response.py`), but the `avg_orders_day` assertion builds its expected tensor without a `device=` argument, so it stays on `cpu`.

The test already computes `device` and passes it for the `driver_id` and `trips` assertions — only `avg_orders_day` omits it.

## Steps to reproduce

On a machine with CUDA-enabled torch installed:

python -m pytest sdk/python/tests/unit/online_store/test_online_retrieval.py::test_get_online_features

Fails with the GPU visible; passes under `CUDA_VISIBLE_DEVICES=""`. CI is CPU-only, where `device` resolves to `"cpu"` and the omission has no effect.

### Specifications

- Version: master (0.66.0 dev)
- Platform: Ubuntu 24.04 (WSL2), Python 3.11, torch 2.13.0+cu130, RTX 4050
- Subsystem: online store / tests

## Possible Solution

Pass `device=device` to the expected tensor, matching the neighbouring assertions. Submitted as #6777.

Contributor guide

Open the contributing guide

Research direction

Start with sdk/python/tests/unit/online_store/test_online_retrieval.py::test_get_online_features and inspect the neighbouring device-aware tensor assertions. Update the avg_orders_day expected tensor to use the computed device, then run the specified pytest test with and without CUDA visibility to confirm it passes in both environments.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
testing
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
90/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.