diff --git a/tutorials/text/deduplication/fuzzy/fuzzy_e2e.ipynb b/tutorials/text/deduplication/fuzzy/fuzzy_e2e.ipynb index 1786b39810..0d39fbb932 100644 --- a/tutorials/text/deduplication/fuzzy/fuzzy_e2e.ipynb +++ b/tutorials/text/deduplication/fuzzy/fuzzy_e2e.ipynb @@ -267,10 +267,18 @@ "source": [ "import time\n", "\n", + "import torch\n", + "\n", "from nemo_curator.backends.experimental.ray_data import RayDataExecutor\n", "from nemo_curator.core.client import RayClient\n", "\n", - "client = RayClient(num_cpus=64, num_gpus=2) # change as needed\n", + "NUM_GPUS = 2\n", + "\n", + "if torch.cuda.device_count() < NUM_GPUS:\n", + " error_msg = \"The number of GPUs on this machine are lesser than the default this tutorial was tested with, please update `num_gpus` passed into `RayClient`\"\n", + " raise ValueError(error_msg)\n", + "\n", + "client = RayClient(num_cpus=64, num_gpus=NUM_GPUS) # change as needed\n", "client.start()" ] }, @@ -1501,7 +1509,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.12.3" + "version": "3.12.11" } }, "nbformat": 4, diff --git a/tutorials/text/deduplication/semantic/semantic_e2e.ipynb b/tutorials/text/deduplication/semantic/semantic_e2e.ipynb index 61fc7e8c45..258504f62c 100644 --- a/tutorials/text/deduplication/semantic/semantic_e2e.ipynb +++ b/tutorials/text/deduplication/semantic/semantic_e2e.ipynb @@ -253,10 +253,18 @@ } ], "source": [ + "import torch\n", + "\n", "from nemo_curator.core.client import RayClient\n", "\n", "# Number of GPUs should be roughly 2x the memory of the embeddings\n", - "client = RayClient(num_cpus=64, num_gpus=4)\n", + "NUM_GPUS = 4\n", + "\n", + "if torch.cuda.device_count() < NUM_GPUS:\n", + " error_msg = \"The number of GPUs on this machine are lesser than the default this tutorial was tested with, please update `num_gpus` passed into `RayClient`\"\n", + " raise ValueError(error_msg)\n", + "\n", + "client = RayClient(num_cpus=64, num_gpus=NUM_GPUS)\n", "client.start()\n", "try:\n", " workflow.run()\n", @@ -994,7 +1002,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, diff --git a/tutorials/text/deduplication/semantic/semantic_step_by_step.ipynb b/tutorials/text/deduplication/semantic/semantic_step_by_step.ipynb index 54ecdc4037..5fdad1d58b 100644 --- a/tutorials/text/deduplication/semantic/semantic_step_by_step.ipynb +++ b/tutorials/text/deduplication/semantic/semantic_step_by_step.ipynb @@ -122,10 +122,18 @@ "metadata": {}, "outputs": [], "source": [ + "import torch\n", + "\n", "from nemo_curator.core.client import RayClient\n", "\n", "# Number of GPUs should be roughly 2x the memory of the embeddings\n", - "client = RayClient(num_cpus=64, num_gpus=4)\n", + "NUM_GPUS = 4\n", + "\n", + "if torch.cuda.device_count() < NUM_GPUS:\n", + " error_msg = \"The number of GPUs on this machine are lesser than the default this tutorial was tested with, please update `num_gpus` passed into `RayClient`\"\n", + " raise ValueError(error_msg)\n", + "\n", + "client = RayClient(num_cpus=64, num_gpus=NUM_GPUS)\n", "client.start()" ] }, @@ -1142,7 +1150,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" },