[cdc_services] Remove legacy nl_server and PyTorch dependencies from image - #6655
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request streamlines the datacommons-services container by removing legacy natural language processing components that are no longer required for runtime operations. By offloading NL query resolution to modern infrastructure, the build process is simplified, unnecessary dependencies are eliminated, and the overall container footprint is reduced. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request removes the Natural Language (NL) server, its dependencies (such as PyTorch and nl_server requirements), model downloading steps, and related configurations from the CDC services Dockerfile and startup script. It also introduces a dedicated .dockerignore file for the Docker build context. The review feedback suggests a minor optimization in the Dockerfile to use the --no-cache-dir flag when upgrading pip and setuptools to help minimize the final image size.
Overview
Cleans up the
datacommons-servicescontainer by removing the deprecatednl_serverand its dependencies (such as PyTorch, sentence-transformers, Spacy, and local MiniLM models). Natural language query and variable resolution are now fully handled via Cloud Spanner embeddings and Vertex AI served through Mixer's/v2/resolveendpoint.Performance & Size Impact:
Changes
build/cdc_services/Dockerfile:nl_serverand PyTorch requirement installation steps from Stage 2 (py-servers), and added--no-cache-dirto the initial pip upgrade.nl_app.py,nl_server/, anddeploy/nl/into Stage 2./datacommonsand/tmp/datcom-nl-modelscopies from the final runtime stage (runner).build/cdc_services/run.sh:NL_SERVER_PORT,TOKENIZERS_PARALLELISM,OMP_NUM_THREADS, etc.).nl_serverMixer flag injection (--embeddings_server_url,--resolve_embeddings_indexes).nl_app.pyGunicorn startup block.Verification & Live Testbed Deployment
gcr.io/datcom-website-dev/datacommons-services:calinc-no-nl-server.testbed-1. You can view the live deployment on the Cloud Run Service Console.resolver=indicator) and natural language query fulfillment (/api/explore/detect-and-fulfill) are functioning as intended: