{"id":27240826,"url":"https://github.com/vdaas/vald-tensorflow-ingress-filter","last_synced_at":"2025-04-10T19:55:59.711Z","repository":{"id":54529681,"uuid":"492696561","full_name":"vdaas/vald-tensorflow-ingress-filter","owner":"vdaas","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-12T04:38:58.000Z","size":49,"stargazers_count":0,"open_issues_count":11,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-12T05:26:20.370Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vdaas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-16T05:34:17.000Z","updated_at":"2024-08-07T02:38:09.000Z","dependencies_parsed_at":"2024-02-16T05:26:15.166Z","dependency_job_id":"70ff6771-5603-4c7a-961a-b0d353534264","html_url":"https://github.com/vdaas/vald-tensorflow-ingress-filter","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdaas%2Fvald-tensorflow-ingress-filter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdaas%2Fvald-tensorflow-ingress-filter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdaas%2Fvald-tensorflow-ingress-filter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdaas%2Fvald-tensorflow-ingress-filter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vdaas","download_url":"https://codeload.github.com/vdaas/vald-tensorflow-ingress-filter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248285470,"owners_count":21078296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-10T19:55:58.960Z","updated_at":"2025-04-10T19:55:59.702Z","avatar_url":"https://github.com/vdaas.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vald-tensorflow-ingress-filter\n\n[![Snyk](https://img.shields.io/snyk/vulnerabilities/github/vdaas/vald-tensorflow-ingress-filter)](https://snyk.io/test/github/vdaas/vald-tensorflow-ingress-filter)\n[![docker image](https://img.shields.io/docker/pulls/vdaas/vald-tensorflow-ingress-filter?label=vdaas%2Fvald-tensorflow-ingress-filter\u0026logo=docker\u0026style=flat-square)](https://hub.docker.com/r/vdaas/vald-tensorflow-ingress-filter)\n\nvald-tensorflow-ingress-filter is one of the official ingress filter components provided by Vald.\n\nIts custom logic requires the input of the Tensorflow SavedModel as a request and outputs the result from the Tensorflow SavedModel as the request of the Vald Agent.\n\nUsing this component lets users vectorize various data such as text and images using the Tensorflow SavedModel only inside the Vald cluster without external APIs.\n\n## Usage\n\n### Deploy vald-tensorflow-ingress-filter\n\n```\ngit clone https://github.com/vdaas/vald-tensorflow-ingress-filter.git\nkubectl apply -f vald-tensorflow-ingress-filter/k8s\n```\n\nThe official image only supports amd64.\n\nNOTE: The example manifest files use BERT from [Tensorflow Hub](https://www.tensorflow.org/hub) as the Tensorflow SavedModel. You can change the model by editing k8s/deployment.yaml.\n\n```\n...\n  - |\n    curl -L \"https://tfhub.dev/tensorflow/bert_en_uncased_L-12_H-768_A-12/4?tf-hub-format=compressed\" -o /model/sample.tar.gz  #FIXME\n...\n  env:\n    - name: MODEL_PATH\n      value: \"/model\"  #FIXME\n    - name: INPUT_TENSOR_NAMES\n      value: \"name1 name2\"  #FIXME\n    - name: OUTPUT_TENSOR_NAME\n      value: \"name\"  #FIXME\n    - name: REQUEST_TYPE\n      value: \"int32\"  #FIXME\n```\n\n### Deploy Vald cluster with filter gateway\n\nPlease edit the example/helm/values.yaml in the Vald repository to make vald-filter-gateway available and use it for deployment.\n\n```\ngit clone https://github.com/vdaas/vald.git\ncd vald\n\nvim example/helm/values.yaml\n---\n...\ngateway:\n...\n    filter:\n        enabled: true\n...\nagent:\n    ngt:\n        dimension: 768\n```\n\n## Sample code with [vald-client-python](https://github.com/vdaas/vald-client-python)\n\n```python\nimport grpc\nimport numpy as np\nimport tensorflow_hub as hub\nimport tensorflow_text as text\nfrom vald.v1.payload import payload_pb2\nfrom vald.v1.vald import (\n    filter_pb2_grpc,\n    search_pb2_grpc,\n)\n\n# preprocess\npreprocess = hub.load('https://tfhub.dev/tensorflow/bert_en_uncased_preprocess/1')\ntoken = preprocess([\"TF Hub makes BERT easy!\"])\nsample = np.vstack([i for i in token.values()])\n\nchannel = grpc.insecure_channel(\"localhost:8081\")\n\n# Insert\nstub = filter_pb2_grpc.FilterStub(channel)\nresize_vector = payload_pb2.Object.ReshapeVector(\n    object=sample.tobytes(),\n    shape=[3, 128],\n)\nresize_vector = resize_vector.SerializeToString()\n\nreq = payload_pb2.Insert.ObjectRequest(\n    object=payload_pb2.Object.Blob(\n        id=\"0\",\n        object=resize_vector\n    ),\n    config=payload_pb2.Insert.Config(skip_strict_exist_check=False),\n    vectorizer=payload_pb2.Filter.Target(\n        host=\"vald-tensorflow-ingress-filter\",\n        port=8081,\n    )\n)\nstub.InsertObject(req)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdaas%2Fvald-tensorflow-ingress-filter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvdaas%2Fvald-tensorflow-ingress-filter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdaas%2Fvald-tensorflow-ingress-filter/lists"}