Guide
Enable GPU Acceleration in Kaggle Notebooks for Faster Deep Learning Training
Enable GPU acceleration in Kaggle Notebooks by configuring Settings → Accelerator → GPU, then verify with nvidia-smi and framework checks. Reduce training time from hours to minutes with these practical steps.
Published by Tasadduq Burney
10 Aug 2026, 13:01 UTC
3 min37.6K views0

Problem: Slow Deep Learning Training on CPU
If you're training deep learning models in Kaggle Notebooks, you've likely experienced painfully slow training times when running on CPU alone. GPU acceleration can reduce training time from hours to minutes, but getting it working requires specific steps.
Prerequisites
- A Kaggle account (free tier includes GPU access)
- An existing Kaggle Notebook or the ability to create a new one
- Training code using TensorFlow, PyTorch, or another GPU-capable framework
- Dataset accessible within your notebook environment
Step-by-Step Procedure
- Open Notebook Settings: In your Kaggle Notebook, click the Settings tab (gear icon) in the left sidebar
- Configure Accelerator: Under Accelerator, select
GPUfrom the dropdown menu. Kaggle offers Tesla T4, P100, or V100 GPUs depending on availability - Save Changes: Click Save at the bottom of the settings panel. The notebook will restart with GPU enabled
- Verify GPU Detection: Run
!nvidia-smiin a code cell. You should see output showing GPU model, driver version, and memory details - Test Framework Integration: For PyTorch, run:
import torch print(f"CUDA available: {torch.cuda.is_available()}") print(f"GPU count: {torch.cuda.device_count()}") print(f"GPU name: {torch.cuda.get_device_name(0)}")For TensorFlow, run:import tensorflow as tf print(tf.config.list_physical_devices('GPU')) - Monitor GPU Usage During Training: Add GPU memory monitoring to your training loop:
import GPUtil GPUtil.showGPUs()
Or for PyTorch, checktorch.cuda.memory_allocated()during training
Expected Checks and Validation
After configuration, verify these specific outputs:
nvidia-smishows a Tesla GPU (T4, P100, or V100) with allocated memory- Framework detection returns
Truefor GPU availability - Training logs indicate GPU memory usage increasing during forward/backward passes
- Training completes significantly faster than CPU-only execution
Common Recovery Options
If GPU allocation fails or training crashes:
- Revert to CPU: Change Accelerator back to
Nonein Settings and restart the notebook - Reduce Batch Size: GPU memory is limited; try halving your batch size if you see CUDA out of memory errors
- Restart Session: Use
Runtime → Restart Runtimeto clear GPU state and reconnect - Check Weekly Quota: Kaggle provides 30 hours of GPU time per week; check your remaining hours in the notebook's top bar
Important Limitations and Quotas
Be aware of these constraints:
- 30-Hour Weekly Limit: GPU time resets every Monday; exceeding this disables GPU until the reset
- 90-Minute Idle Timeout: Notebooks disconnect after 90 minutes of inactivity, releasing the GPU
- CUDA Version Compatibility: Kaggle uses CUDA 11.x; ensure your libraries are compatible with the installed PyTorch/TensorFlow versions
Practical Verification Command
Run this complete verification cell after enabling GPU:
# Verify GPU setup
print("=== NVIDIA-SMI ===")
!nvidia-smi
print("\n=== PyTorch GPU Check ===")
import torch
print(f"CUDA available: {torch.cuda.is_available()}")
if torch.cuda.is_available():
print(f"GPU: {torch.cuda.get_device_name(0)}")
print(f"Memory: {torch.cuda.get_device_properties(0).total_memory / 1e9:.2f} GB")
print("\n=== TensorFlow GPU Check ===")
import tensorflow as tf
gpus = tf.config.list_physical_devices('GPU')
print(f"GPUs found: {gpus}")
Troubleshooting Checklist
- Confirm Settings → Accelerator shows
GPU(notNone) - Check notebook status bar shows GPU icon
- Verify
nvidia-smioutput shows Tesla GPU model - Ensure batch size is appropriate for GPU memory (start with 32 or 64)
- Monitor weekly GPU hours in notebook header
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.