Skip to content

Commit 1d889b1

Browse files
adding tls cert creation and updating num workers in hf notebook
1 parent f100ba1 commit 1d889b1

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

demo-notebooks/additional-demos/hf_interactive.ipynb

+24-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@
8989
"source": [
9090
"# Create our cluster and submit\n",
9191
"# The SDK will try to find the name of your default local queue based on the annotation \"kueue.x-k8s.io/default-queue\": \"true\" unless you specify the local queue manually below\n",
92-
"cluster = Cluster(ClusterConfiguration(name='hfgputest', \n",
92+
"cluster_name= \"hfgputest\"\n",
93+
"cluster = Cluster(ClusterConfiguration(name=cluster_name, \n",
9394
" head_gpus=1, # For GPU enabled workloads set the head_gpus and num_gpus\n",
9495
" num_gpus=1,\n",
9596
" num_workers=1,\n",
@@ -287,6 +288,27 @@
287288
"ray_cluster_uri = cluster.cluster_uri()"
288289
]
289290
},
291+
{
292+
"cell_type": "markdown",
293+
"id": "64d65c3c",
294+
"metadata": {},
295+
"source": [
296+
"Now we can connect directly to our Ray cluster via the Ray python client:"
297+
]
298+
},
299+
{
300+
"cell_type": "code",
301+
"execution_count": null,
302+
"id": "60276d86",
303+
"metadata": {},
304+
"outputs": [],
305+
"source": [
306+
"from codeflare_sdk import generate_cert\n",
307+
"# Create required TLS cert and export the environment variables to enable TLS\n",
308+
"generate_cert.generate_tls_cert(cluster_name, cluster.config.namespace)\n",
309+
"generate_cert.export_env(cluster_name, cluster.config.namespace)"
310+
]
311+
},
290312
{
291313
"cell_type": "markdown",
292314
"id": "44dba6a0-8275-4726-8911-6b6ec467b6a3",
@@ -432,7 +454,7 @@
432454
"\n",
433455
" ray_trainer = TorchTrainer(\n",
434456
" train_func,\n",
435-
" scaling_config=ScalingConfig(num_workers=3, use_gpu=True),\n",
457+
" scaling_config=ScalingConfig(num_workers=2, use_gpu=True),\n",
436458
" # Configure persistent storage that is accessible across \n",
437459
" # all worker nodes.\n",
438460
" # Uncomment and update the RunConfig below to include your storage details.\n",

0 commit comments

Comments
 (0)