question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ScaNN index layer cannot be served through TF Serving docker container!

See original GitHub issue

request:

curl --location --request POST 'IP_ADDRESS:8501/v1/models/retrieval:predict' \
--header 'Content-Type: application/json' \
--data-raw '{
    "instances":
        [
            "42"
        ]
}'

Response:

{
    "error": "Op type not registered 'Scann>ScannSearchBatched' in binary running on ea72279e0fdb. Make sure the Op and Kernel are registered in the binary running in this process. Note that if you are loading a saved graph which used ops from tf.contrib, accessing (e.g.) `tf.contrib.resampler` should be done before importing the graph, as contrib ops are lazily registered when the module is first accessed."
}

I also tried:

docker exec -it CONTAINER_ID  pip install scann

but:

ERROR: Could not find a version that satisfies the requirement scann
ERROR: No matching distribution found for scann

I think we have to copy over op source https://github.com/google-research/google-research/blob/master/scann/scann/scann_ops/py/scann_ops.py

into Serving project https://www.tensorflow.org/tfx/serving/custom_op#copy_over_op_source_into_serving_project

but I don’t know how! Can anybody help writing a custom Dockerfile?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
sammymaxcommented, Jan 20, 2021

I’ll work on a ScaNN + TF Serving Dockerfile in the coming weeks–thanks for pointing this out!

2reactions
sammymaxcommented, Feb 9, 2021

The Dockerfiles are ready; they’re on Docker Hub here and instructions are here. The Dockerfiles are in the linked GitHub directory, if you’re interested in seeing how they’re built.

These images were built on Clang-8 with C++17 and AVX2 enabled, while I believe the vanilla TF Serving images are built with GCC 7, C++11, and no AVX2. This means a AVX2-enabled CPU is required (any ~2013 or later x86 CPU should be ok). Otherwise, leave a comment if you run into any issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Efficient serving | TensorFlow Recommenders
# We re-index the ScaNN layer to include the user embeddings in the same model. # This way we can give the saved...
Read more >
google/tf-serving-scann - Docker Hub
Custom TensorFlow Serving builds linked to the ScaNN nearest neighbor search TensorFlow ops. These Docker images allow the deployment of TF SavedModels that ......
Read more >
Can not run tensorflow serving from docker - Stack Overflow
Seems like --mount command does not copy content from savedmodel/1, but as fat as I understood it should make a copy of content...
Read more >
Efficient serving with ScaNN for retrieval (Building ... - YouTube
In this video, we are going to use a more efficient method - Approximate Nearest Neighbours (ANN) and introduce you to the Google...
Read more >
Enhancing Personalization with Realtime Streaming Inference
Serving the model as endpoints with TF serving ... We used google's ScaNN index as our lookup layer, as it's already conveniently baked...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found