Skip to content

Adding tls cert creation and updating num workers in hf notebook #606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions demo-notebooks/additional-demos/hf_interactive.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@
"source": [
"# Create our cluster and submit\n",
"# 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",
"cluster = Cluster(ClusterConfiguration(name='hfgputest', \n",
"cluster_name= \"hfgputest\"\n",
"cluster = Cluster(ClusterConfiguration(name=cluster_name, \n",
" head_gpus=1, # For GPU enabled workloads set the head_gpus and num_gpus\n",
" num_gpus=1,\n",
" num_workers=1,\n",
Expand Down Expand Up @@ -287,6 +288,27 @@
"ray_cluster_uri = cluster.cluster_uri()"
]
},
{
"cell_type": "markdown",
"id": "64d65c3c",
"metadata": {},
"source": [
"Now we can connect directly to our Ray cluster via the Ray python client:"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "60276d86",
"metadata": {},
"outputs": [],
"source": [
"from codeflare_sdk import generate_cert\n",
"# Create required TLS cert and export the environment variables to enable TLS\n",
"generate_cert.generate_tls_cert(cluster_name, cluster.config.namespace)\n",
"generate_cert.export_env(cluster_name, cluster.config.namespace)"
]
},
{
"cell_type": "markdown",
"id": "44dba6a0-8275-4726-8911-6b6ec467b6a3",
Expand Down Expand Up @@ -432,7 +454,7 @@
"\n",
" ray_trainer = TorchTrainer(\n",
" train_func,\n",
" scaling_config=ScalingConfig(num_workers=3, use_gpu=True),\n",
" scaling_config=ScalingConfig(num_workers=2, use_gpu=True),\n",
" # Configure persistent storage that is accessible across \n",
" # all worker nodes.\n",
" # Uncomment and update the RunConfig below to include your storage details.\n",
Expand Down