Fix Colab T4 GPU checkpoint loading hang (bfloat16 β float16) #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
π Bug Fix
Fixes the checkpoint loading hang issue when running notebooks 1-4 on Google Colab with T4 GPUs.
π Problem
Users reported that notebooks were hanging indefinitely at:
Root Cause: Notebooks used hardcoded
torch.bfloat16in BitsAndBytesConfig, but T4 GPUs don't support bfloat16, causing the loading process to hang.β Solution
Implemented intelligent GPU detection that auto-selects the appropriate dtype:
torch.float16torch.bfloat16torch.float16π§ Changes
Model Loading Code (Notebooks 1-4)
torch.cuda.get_device_name(0)low_cpu_mem_usage=Trueto reduce memory spikesFiles Modified
notebooks/01_Introduction_First_Jailbreak.ipynbnotebooks/02_Basic_Jailbreak_Techniques.ipynbnotebooks/03_Intermediate_Attacks_Encoding_Crescendo.ipynbnotebooks/04_Advanced_Jailbreaks_Skeleton_Key.ipynbπ§ͺ Testing
All notebooks have been validated for:
π Impact
Before
After
π― Benefits
low_cpu_mem_usage=Truereduces loading spikesπ How to Test
π Additional Notes
Ready to merge! This fixes a critical blocker for Colab users. π
π€ Generated with Claude Code