{"id":18291140,"url":"https://github.com/rhecosystemappeng/kserve-nim-playground","last_synced_at":"2025-04-05T10:30:56.402Z","repository":{"id":241979494,"uuid":"808365524","full_name":"RHEcosystemAppEng/kserve-nim-playground","owner":"RHEcosystemAppEng","description":null,"archived":true,"fork":false,"pushed_at":"2024-09-13T22:33:28.000Z","size":74,"stargazers_count":1,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-21T02:51:17.540Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RHEcosystemAppEng.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-05-30T23:26:11.000Z","updated_at":"2025-02-27T20:50:33.000Z","dependencies_parsed_at":"2024-06-26T00:31:18.885Z","dependency_job_id":"1cb7a812-55bb-4d3c-aa94-08ca37910308","html_url":"https://github.com/RHEcosystemAppEng/kserve-nim-playground","commit_stats":null,"previous_names":["tomerfi/nim-playground"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RHEcosystemAppEng%2Fkserve-nim-playground","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RHEcosystemAppEng%2Fkserve-nim-playground/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RHEcosystemAppEng%2Fkserve-nim-playground/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RHEcosystemAppEng%2Fkserve-nim-playground/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RHEcosystemAppEng","download_url":"https://codeload.github.com/RHEcosystemAppEng/kserve-nim-playground/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247324492,"owners_count":20920656,"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":"2024-11-05T14:13:21.064Z","updated_at":"2025-04-05T10:30:56.039Z","avatar_url":"https://github.com/RHEcosystemAppEng.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NIM KServe Playground\n\nThis repository hosts example projects used for exploring [KServe][kserve] and [Nvidia NIM][nim]\nwith the goal of integrating [Nvidia NIM][nim] into [Red Hat OpenShift AI][aoi].\n\n- The [pocs](pocs) folder hosts the various POC scenarios designed with [Kustomize][kustomize].\n- The [builds](builds) folder hosts built manifests from the above-mentioned _pocs_ for accessibility.\n\n\u003e All POC executions require [Red Hat OpenShift AI][aoi].\n\n## POCs\n\n### Deployment Types\n\n[Kserve][kserve] supports three types of deployment. We explored two of them. Serverless, and Raw.\n\n#### Serverless Deployment\n\n_Serverless Deployment_, the default deployment type for [Kserve][kserve], it leverages\n[Knative][knative].\n\n|                  |                                                  |\n|------------------|--------------------------------------------------|\n| Model Used       | _kserve-sklearnserver_                           |\n| POC Instructions | [Click here](pocs/deployment-types/serverless)   |\n| Built Manifests  | [Click here](builds/deployment-types/serverless) |\n\n**Key Takeaways**\n\n- The _storageUri_ specification from the _InferenceService_ is used for triggering _Kserve_'s\n  _Storage Initializer Container_ for downloading the model prior to runtime.\n\n#### Raw Deployment\n\nWith _Raw Deployment_, [Kserve][kserve] leverages _Kubernetes_ core resources.\n\n|                  |                                           |\n|------------------|-------------------------------------------|\n| Model Used       | _kserve-sklearnserver_                    |\n| POC Instructions | [Click here](pocs/deployment-types/raw)   |\n| Built Manifests  | [Click here](builds/deployment-types/raw) |\n\n**Key Takeaways**\n\n- The _storageUri_ specification from the _InferenceService_ is used for triggering _Kserve_'s\n  _Storage Initializer Container_ for downloading the model prior to runtime.\n- Annotating the _InferenceService_ with `serving.kserve.io/deploymentMode: RawDeployment` triggers\n  a _Raw Deployment_.\n\n### Persistence and Caching\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003ePrerequisites!\u003c/strong\u003e\u003c/summary\u003e\n\nBefore proceeding, grab your _NGC API Key_ and create the following two secret data files (git-ignored):\n\n\u003e The files are saved in the _no-cache_ POC folder but are used by all scenarios in this context.\n\n```shell\n# the following will be used in an opaque secret mounted into the runtime\necho \"NGC_API_KEY=ngcapikeygoeshere\" \u003e pocs/persistence-and-caching/no-cache/ngc.env\n```\n\n```shell\n# the following will be used as the pull image secret for the underlying runtime deployment\necho \"{\n  \\\"auths\\\": {\n    \\\"nvcr.io\\\": {\n      \\\"username\\\": \\\"\\$oauthtoken\\\",\n      \\\"password\\\": \\\"ngcapikeygoeshere\\\"\n    }\n  }\n}\" \u003e pocs/persistence-and-caching/no-cache/ngcdockerconfig.json\n```\n\n\u003c/details\u003e\n\n#### No caching or Persistence\n\nIn this scenario, [Nvidia NIM][nim] is in charge of downloading the required models; however, the\ntarget volume is not persistent, and the download process will occur for every Pod created and will\nbe reflected in scaling time.\n\n|                  |                                                       |\n|------------------|-------------------------------------------------------|\n| Model Used       | _nvidia-nim-llama3-8b-instruct_                       |\n| POC Instructions | [Click here](pocs/persistence-and-caching/no-cache)   |\n| Built Manifests  | [Click here](builds/persistence-and-caching/no-cache) |\n\n**Key Takeaways**\n\n- The _storageUri_ specification from the _InferenceService_ is NOT required.\n- We set the _NIM_CACHE_PATH_ environment variable is set to _/mnt/models_ ([empty-dir][emptydir]).\n\n#### Knative PVC Feature\n\nIn this scenario, [Nvidia NIM][nim] is in charge of downloading the required models; the download\ntarget is a PVC.\n\n```yaml\nkubernetes.podspec-persistent-volume-claim: \"enabled\"\nkubernetes.podspec-persistent-volume-write: \"enabled\"\n```\n\n|                  |                                                          |\n|------------------|----------------------------------------------------------|\n| Model Used       | _nvidia-nim-llama3-8b-instruct_                          |\n| POC Instructions | [Click here](pocs/persistence-and-caching/knative-pvc)   |\n| Built Manifests  | [Click here](builds/persistence-and-caching/knative-pvc) |\n\n**Key Takeaways**\n\n- The _storageUri_ specification from the _InferenceService_ is NOT required.\n- We added a _PVC_ setting the storage class to OpenShift's default _gp3-csi_.\n- We added a _Volume_ to the _ServingRuntime_ connected to the above-mentioned _PVC_.\n- We added a _VolumeMount_ to the _ServingRuntime_ mounting the above-mentioned _Volume_ to\n  _/mnt/nim/models_.\n- We set the _NIM_CACHE_PATH_ environment variable is set to above-mentioned _/mnt/nim/models_.\n\n#### Kserve Raw NIM Deployment\n\nIn this scenario, [Nvidia NIM][nim] is in charge of downloading the required models; the download\ntarget is a PVC. Using writable PVCs is applicable with [Kserve][kserve]'s _Raw Deployment_.\n\n|                  |                                                      |\n|------------------|------------------------------------------------------|\n| Model Used       | _nvidia-nim-llama3-8b-instruct_                      |\n| POC Instructions | [Click here](pocs/persistence-and-caching/raw-pvc)   |\n| Built Manifests  | [Click here](builds/persistence-and-caching/raw-pvc) |\n\n**Key Takeaways**\n\n- The _storageUri_ specification from the _InferenceService_ is NOT required.\n- We added a _PVC_ setting the storage class to OpenShift's default _gp3-csi_.\n- We added a _Volume_ to the _ServingRuntime_ connected to the above-mentioned _PVC_.\n- We added a _VolumeMount_ to the _ServingRuntime_ mounting the above-mentioned _Volume_ to\n  _/mnt/nim/models_.\n- We set the _NIM_CACHE_PATH_ environment variable is set to above-mentioned _/mnt/nim/models_.\n- Annotating the _InferenceService_ with `serving.kserve.io/deploymentMode: RawDeployment` triggers\n  a _Raw Deployment_.\n- We added _maxReplicas_ for the _Predictor_, which is required for using [HPA][hpa].\n\n[aoi]: https://www.redhat.com/en/technologies/cloud-computing/openshift/openshift-ai\n[emptydir]: https://kubernetes.io/docs/concepts/storage/volumes/#emptydir\n[hpa]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/\n[knative]: https://knative.dev/docs/\n[knative-pvc]: https://knative.dev/docs/serving/configuration/feature-flags/#kubernetes-persistentvolumeclaim-pvc\n[kserve]: https://kserve.github.io/website/latest/\n[kustomize]: https://kustomize.io/\n[nim]: https://www.nvidia.com/en-us/ai/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhecosystemappeng%2Fkserve-nim-playground","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frhecosystemappeng%2Fkserve-nim-playground","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frhecosystemappeng%2Fkserve-nim-playground/lists"}