Skip to content

Commit

Permalink
Merge pull request #43 from semi-technologies/gh-42-Add-support-for-e…
Browse files Browse the repository at this point in the history
…xternal-inference-services

Add support for image module and external inference services
  • Loading branch information
antas-marcin authored May 13, 2021
2 parents 4389265 + c66b763 commit da6c005
Show file tree
Hide file tree
Showing 6 changed files with 134 additions and 9 deletions.
4 changes: 2 additions & 2 deletions weaviate/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 13.1.0
version: 13.2.0


# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: v1.3.0
appVersion: v1.4.0
34 changes: 27 additions & 7 deletions weaviate/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,18 +1,38 @@
{{/* Generate the enabled modules config. This can be done a lot nicer once we drop Helm v2 support */}}
{{ define "enabled_modules" }}
{{- if index .Values "modules" "text2vec-contextionary" "enabled" -}}
{{- if index .Values "modules" "text2vec-transformers" "enabled" -}}
{{- if or (index .Values "modules" "text2vec-contextionary" "enabled") (index .Values "modules" "text2vec-contextionary" "inferenceUrl") -}}
{{- if or (index .Values "modules" "text2vec-transformers" "enabled") (index .Values "modules" "text2vec-transformers" "inferenceUrl") -}}
{{ fail "cannot have two text2vec-* modules on at the same time" -}}
{{- end -}}
{{- if index .Values "modules" "qna-transformers" "enabled" -}}
text2vec-contextionary,qna-transformers
{{- if or (index .Values "modules" "qna-transformers" "enabled") (index .Values "modules" "qna-transformers" "inferenceUrl") -}}
{{- if or (index .Values "modules" "img2vec-keras" "enabled") (index .Values "modules" "img2vec-keras" "inferenceUrl") -}}
text2vec-contextionary,qna-transformers,img2vec-keras
{{- else -}}
text2vec-contextionary,qna-transformers
{{- end -}}
{{- else if or (index .Values "modules" "img2vec-keras" "enabled") (index .Values "modules" "img2vec-keras" "inferenceUrl") -}}
{{- if or (index .Values "modules" "qna-transformers" "enabled") (index .Values "modules" "qna-transformers" "inferenceUrl") -}}
text2vec-contextionary,qna-transformers,img2vec-keras
{{- else -}}
text2vec-contextionary,img2vec-keras
{{- end -}}
{{- else -}}
text2vec-contextionary
{{- end -}}
{{- else -}}
{{- if index .Values "modules" "text2vec-transformers" "enabled" -}}
{{- if index .Values "modules" "qna-transformers" "enabled" -}}
text2vec-transformers,qna-transformers
{{- if or (index .Values "modules" "text2vec-transformers" "enabled") (index .Values "modules" "text2vec-transformers" "inferenceUrl") -}}
{{- if or (index .Values "modules" "qna-transformers" "enabled") (index .Values "modules" "qna-transformers" "inferenceUrl") -}}
{{- if or (index .Values "modules" "img2vec-keras" "enabled") (index .Values "modules" "img2vec-keras" "inferenceUrl") -}}
text2vec-transformers,qna-transformers,img2vec-keras
{{- else -}}
text2vec-transformers,qna-transformers
{{- end -}}
{{- else if or (index .Values "modules" "img2vec-keras" "enabled") (index .Values "modules" "img2vec-keras" "inferenceUrl") -}}
{{- if or (index .Values "modules" "qna-transformers" "enabled") (index .Values "modules" "qna-transformers" "inferenceUrl") -}}
text2vec-transformers,qna-transformers,img2vec-keras
{{- else -}}
text2vec-transformers,img2vec-keras
{{- end -}}
{{- else -}}
text2vec-transformers
{{- end -}}
Expand Down
45 changes: 45 additions & 0 deletions weaviate/templates/img2vecKerasDeployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{ if index .Values "modules" "img2vec-keras" "enabled" }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ index .Values "modules" "img2vec-keras" "fullnameOverride" }}
labels:
name: {{ index .Values "modules" "img2vec-keras" "fullnameOverride" }}
app: {{ index .Values "modules" "img2vec-keras" "fullnameOverride" }}
spec:
replicas: {{ index .Values "modules" "img2vec-keras" "replicas" }}
selector:
matchLabels:
app: {{ index .Values "modules" "img2vec-keras" "fullnameOverride" }}
template:
metadata:
labels:
app: {{ index .Values "modules" "img2vec-keras" "fullnameOverride" }}
spec:
containers:
- name: {{ index .Values "modules" "img2vec-keras" "fullnameOverride" }}
image: {{ index .Values "modules" "img2vec-keras" "registry" }}/{{ index .Values "modules" "img2vec-keras" "repo" }}:{{ index .Values "modules" "img2vec-keras" "tag" }}
env:
- name: ENABLE_CUDA
value: "{{ if index .Values "modules" "img2vec-keras" "envconfig" "enable_cuda" }}1{{ else }}0{{ end }}"
{{ if index .Values "modules" "img2vec-keras" "envconfig" "enable_cuda" }}
- name: NVIDIA_VISIBLE_DEVICES
value: {{ index .Values "modules" "img2vec-keras" "envconfig" "nvidia_visible_devices"}}
- name: LD_LIBRARY_PATH
value: {{ index .Values "modules" "img2vec-keras" "envconfig" "ld_library_path"}}
{{ end }}
resources:
{{ index .Values "modules" "img2vec-keras" "resources" | toYaml | indent 10 }}
livenessProbe:
httpGet:
path: /.well-known/live
port: 8080
initialDelaySeconds: 120
periodSeconds: 3
readinessProbe:
httpGet:
path: /.well-known/ready
port: 8080
initialDelaySeconds: 3
periodSeconds: 3
{{ end }}
14 changes: 14 additions & 0 deletions weaviate/templates/img2vecKerasService.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{ if index .Values "modules" "img2vec-keras" "enabled" }}
apiVersion: v1
kind: Service
metadata:
name: {{ index .Values "modules" "img2vec-keras" "fullnameOverride" }}
spec:
type: ClusterIP
selector:
app: {{ index .Values "modules" "img2vec-keras" "fullnameOverride" }}
ports:
- protocol: TCP
port: 8080
targetPort: 8080
{{ end }}
13 changes: 13 additions & 0 deletions weaviate/templates/weaviateStatefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,23 @@ spec:
{{ if index .Values "modules" "text2vec-transformers" "enabled" }}
- name: TRANSFORMERS_INFERENCE_API
value: http://{{ index .Values "modules" "text2vec-transformers" "fullnameOverride" }}.{{ .Release.Namespace }}.svc.cluster.local:8080
{{ else if index .Values "modules" "text2vec-transformers" "inferenceUrl" }}
- name: TRANSFORMERS_INFERENCE_API
value: {{ index .Values "modules" "text2vec-transformers" "inferenceUrl" }}
{{ end }}
{{ if index .Values "modules" "qna-transformers" "enabled" }}
- name: QNA_INFERENCE_API
value: http://{{ index .Values "modules" "qna-transformers" "fullnameOverride" }}.{{ .Release.Namespace }}.svc.cluster.local:8080
{{ else if index .Values "modules" "qna-transformers" "inferenceUrl" }}
- name: QNA_INFERENCE_API
value: {{ index .Values "modules" "qna-transformers" "inferenceUrl" }}
{{ end }}
{{ if index .Values "modules" "img2vec-keras" "enabled" }}
- name: IMAGE_INFERENCE_API
value: http://{{ index .Values "modules" "img2vec-keras" "fullnameOverride" }}.{{ .Release.Namespace }}.svc.cluster.local:8080
{{ else if index .Values "modules" "img2vec-keras" "inferenceUrl" }}
- name: IMAGE_INFERENCE_API
value: {{ index .Values "modules" "img2vec-keras" "inferenceUrl" }}
{{ end }}
ports:
- containerPort: 8080
Expand Down
33 changes: 33 additions & 0 deletions weaviate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,39 @@ modules:
# enable if running with CUDA support
# nvidia.com/gpu: 1

# The img2vec-keras module uses neural networks, such as BERT,
# DistilBERT, to find an aswer in text to a given question
img2vec-keras:
enabled: false
tag: resnet50-61dcbf8
repo: semitechnologies/img2vec-keras
registry: docker.io
replicas: 1
fullnameOverride: img2vec-keras
envconfig:
# enable for CUDA support. Your K8s cluster needs to be configured
# accordingly and you need to explicilty set GPU requests & limits below
enable_cuda: false

# only used when cuda is enabled
nvidia_visible_devices: all

# only used when cuda is enabled
ld_library_path: /usr/local/nvidia/lib64

resources:
requests:
cpu: '1000m'
memory: '3000Mi'

# enable if running with CUDA support
# nvidia.com/gpu: 1
limits:
cpu: '1000m'
memory: '5000Mi'

# enable if running with CUDA support
# nvidia.com/gpu: 1

# by choosing the default vectorizer module, you can tell Weaviate to always
# use this module as the vectorizer if nothing else is specified. Can be
Expand Down

0 comments on commit da6c005

Please sign in to comment.