Minor fixes for ollama deployment notebook

PiperOrigin-RevId: 817513895
This commit is contained in:
Vertex MG Team
2025-10-10 00:21:23 -07:00
committed by Copybara-Service
parent 571d498d08
commit 065a674305
4 changed files with 17 additions and 10 deletions
@@ -868,7 +868,7 @@
"per_node_accelerator_count = 8\n",
"boot_disk_size_gb = 500\n",
"dws_kwargs = {\n",
" \"max_wait_duration\": 1800, # 30 minutes\n",
" \"max_wait_duration\": 5400, # 90 minutes\n",
" \"scheduling_strategy\": gca_custom_job_compat.Scheduling.Strategy.FLEX_START,\n",
"}\n",
"is_dynamic_workload_scheduler = True\n",
@@ -521,7 +521,7 @@
"per_node_accelerator_count = 8\n",
"boot_disk_size_gb = 500\n",
"dws_kwargs = {\n",
" \"max_wait_duration\": 1800, # 30 minutes\n",
" \"max_wait_duration\": 5400, # 90 minutes\n",
" \"scheduling_strategy\": gca_custom_job_compat.Scheduling.Strategy.FLEX_START,\n",
"}\n",
"is_dynamic_workload_scheduler = True\n",
@@ -823,7 +823,7 @@
"per_node_accelerator_count = 8\n",
"boot_disk_size_gb = 500\n",
"dws_kwargs = {\n",
" \"max_wait_duration\": 1800, # 30 minutes\n",
" \"max_wait_duration\": 5400, # 90 minutes\n",
" \"scheduling_strategy\": gca_custom_job_compat.Scheduling.Strategy.FLEX_START,\n",
"}\n",
"is_dynamic_workload_scheduler = True\n",
@@ -102,7 +102,7 @@
},
"outputs": [],
"source": [
"%pip install --upgrade --force-reinstall --quiet 'google-cloud-aiplatform>=1.106.0' 'openai' 'google-auth' 'requests'"
"%pip install --upgrade --force-reinstall --quiet 'google-cloud-aiplatform>=1.106.0' 'openai' 'google-auth==2.27.0' 'requests==2.32.3'"
]
},
{
@@ -160,14 +160,19 @@
"\n",
"import vertexai\n",
"\n",
"PROJECT_ID = \"[your-project-id]\" # @param {type: \"string\", placeholder: \"[your-project-id]\", isTemplate: true}\n",
"PROJECT_ID = \"\" # @param {type: \"string\", placeholder: \"[your-project-id]\", isTemplate: true}\n",
"\n",
"if not PROJECT_ID or PROJECT_ID == \"[your-project-id]\":\n",
" PROJECT_ID = str(os.environ.get(\"GOOGLE_CLOUD_PROJECT\"))\n",
"if not PROJECT_ID:\n",
" PROJECT_ID = os.environ.get(\"GOOGLE_CLOUD_PROJECT\")\n",
"\n",
"REGION = os.environ.get(\"GOOGLE_CLOUD_REGION\", \"us-central1\")\n",
"REGION = \"\" # @param {type: \"string\", placeholder: \"[your-region]\", isTemplate: true}\n",
"\n",
"vertexai.init(project=PROJECT_ID, location=REGION)"
"if not REGION:\n",
" REGION = os.environ.get(\"GOOGLE_CLOUD_REGION\", \"us-central1\")\n",
"\n",
"vertexai.init(project=PROJECT_ID, location=REGION)\n",
"\n",
"print(f\"Project: {PROJECT_ID}\\nLocation: {REGION}\")"
]
},
{
@@ -224,6 +229,8 @@
"else:\n",
" raise ValueError(f\"Unsupported model id: {MODEL_ID}\")\n",
"\n",
"endpoints = {}\n",
"\n",
"# The pre-built serving docker image for Ollama.\n",
"OLLAMA_DOCKER_URI = \"us-docker.pkg.dev/deeplearning-platform-release/vertex-model-garden/ollama-serve.cu125.0-5.ubuntu2204.py310\"\n",
"\n",
@@ -259,7 +266,7 @@
" machine_type=machine_type,\n",
" accelerator_type=accelerator_type,\n",
" accelerator_count=accelerator_count,\n",
" dedicated_endpoint_enabled=use_dedicated_endpoint,\n",
" use_dedicated_endpoint=use_dedicated_endpoint,\n",
")\n",
"\n",
"# @markdown Click \"Show Code\" to see more details."