Skip to content
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

[BUG] QueryFaiss returning item ID as -1 causing type error #387

Open
BlakeB415 opened this issue Dec 18, 2023 · 1 comment
Open

[BUG] QueryFaiss returning item ID as -1 causing type error #387

BlakeB415 opened this issue Dec 18, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@BlakeB415
Copy link

BlakeB415 commented Dec 18, 2023

Bug description

The Faiss index returns a -1 item_id when it can't fill the TopK results. This causes Feast to return None for item results causing a type error. The -1 output isn't properly filtered in QueryFaiss.

InferenceServerException: [StatusCode.INTERNAL] Traceback (most recent call last):
  File "/workspace/examples/Building-and-deploying-multi-stage-RecSys/poc_ensemble/executor_model/1/model.py", line 101, in execute
    outputs = self.ensemble.transform(inputs, runtime=TritonExecutorRuntime())
  File "/usr/local/lib/python3.10/dist-packages/merlin/systems/dag/ensemble.py", line 78, in transform
    return runtime.transform(self.graph, transformable)
  File "/usr/local/lib/python3.10/dist-packages/merlin/dag/runtime.py", line 53, in transform
    return self.executor.transform(transformable, [graph.output_node])
  File "/usr/local/lib/python3.10/dist-packages/merlin/dag/executors.py", line 102, in transform
    transformed_data = self._execute_node(node, transformable, capture_dtypes, strict)
  File "/usr/local/lib/python3.10/dist-packages/merlin/dag/executors.py", line 116, in _execute_node
    upstream_outputs = self._run_upstream_transforms(
  File "/usr/local/lib/python3.10/dist-packages/merlin/dag/executors.py", line 130, in _run_upstream_transforms
    node_output = self._execute_node(
  File "/usr/local/lib/python3.10/dist-packages/merlin/dag/executors.py", line 116, in _execute_node
    upstream_outputs = self._run_upstream_transforms(
  File "/usr/local/lib/python3.10/dist-packages/merlin/dag/executors.py", line 130, in _run_upstream_transforms
    node_output = self._execute_node(
  File "/usr/local/lib/python3.10/dist-packages/merlin/dag/executors.py", line 116, in _execute_node
    upstream_outputs = self._run_upstream_transforms(
  File "/usr/local/lib/python3.10/dist-packages/merlin/dag/executors.py", line 130, in _run_upstream_transforms
    node_output = self._execute_node(
  File "/usr/local/lib/python3.10/dist-packages/merlin/dag/executors.py", line 116, in _execute_node
    upstream_outputs = self._run_upstream_transforms(
  File "/usr/local/lib/python3.10/dist-packages/merlin/dag/executors.py", line 130, in _run_upstream_transforms
    node_output = self._execute_node(
  File "/usr/local/lib/python3.10/dist-packages/merlin/dag/executors.py", line 122, in _execute_node
    transform_output = self._run_node_transform(node, transform_input, capture_dtypes, strict)
  File "/usr/local/lib/python3.10/dist-packages/merlin/dag/executors.py", line 250, in _run_node_transform
    raise exc
  File "/usr/local/lib/python3.10/dist-packages/merlin/dag/executors.py", line 237, in _run_node_transform
    transformed_data = node.op.transform(selection, input_data)
  File "/usr/local/lib/python3.10/dist-packages/merlin/systems/dag/ops/feast.py", line 241, in transform
    feature_array = array_constructor(feature_value).astype(
TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType'

Related to #145

Steps/Code to reproduce bug

Building-and-deploying-multi-stage-RecSys

Expected behavior

QueryFaiss should filter the -1 item IDs out of the array.

candidate_ids = np.array(indices).astype(np.int32).flatten()

Environment details

  • Merlin version:
  • Platform:
  • Python version:
  • PyTorch version (GPU?):
  • Tensorflow version (GPU?):

Additional context

I am running the nightly merlin-tensorflow container.

@BlakeB415 BlakeB415 added the bug Something isn't working label Dec 18, 2023
@BlakeB415 BlakeB415 changed the title [BUG] QueryFaiss returning -1 item IDs causing type error [BUG] QueryFaiss returning item ID as -1 causing type error Dec 18, 2023
@BlakeB415
Copy link
Author

BlakeB415 commented Dec 18, 2023

Also seems related to #207 and NVIDIA-Merlin/Merlin#485

I found a temporary workaround that is putting >> LambdaOp(lambda col: col.values[col.values>=0]) after QueryFaiss.

eg.

retrieval = (
    user_features
    >> PredictTensorflow(retrieval_model_path)
    >> QueryFaiss(faiss_index_path, topk=topk_retrieval)
    >> LambdaOp(lambda col: col.values[col.values>=0])
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant