chipling commited on
Commit
927e447
·
verified ·
1 Parent(s): 8a8a55b

Upload main.ipynb with huggingface_hub

Browse files
Files changed (1) hide show
  1. main.ipynb +2 -2
main.ipynb CHANGED
@@ -643,7 +643,7 @@
643
  "# Quick memory test\n",
644
  "with torch.no_grad():\n",
645
  " test_input = torch.randint(0, 50257, (config.batch_size, config.seq_len), device=device)\n",
646
- " _ = model.compute_loss(test_input)\n",
647
  " print(f\"Memory after forward: {torch.cuda.memory_allocated() / 1e9:.2f} GB / {torch.cuda.get_device_properties(0).total_memory / 1e9:.1f} GB\")\n",
648
  " del test_input, _\n",
649
  " torch.cuda.empty_cache()\n",
@@ -1874,7 +1874,7 @@
1874
  " tokens_processed += batch.numel()\n",
1875
  "\n",
1876
  " with autocast('cuda', dtype=torch.float16):\n",
1877
- " result = model.compute_loss(batch)\n",
1878
  " loss = result['loss'] / config.grad_accum_steps\n",
1879
  "\n",
1880
  " scaler.scale(loss).backward()\n",
 
643
  "# Quick memory test\n",
644
  "with torch.no_grad():\n",
645
  " test_input = torch.randint(0, 50257, (config.batch_size, config.seq_len), device=device)\n",
646
+ " _ = model_unwrapped.compute_loss(test_input)\n",
647
  " print(f\"Memory after forward: {torch.cuda.memory_allocated() / 1e9:.2f} GB / {torch.cuda.get_device_properties(0).total_memory / 1e9:.1f} GB\")\n",
648
  " del test_input, _\n",
649
  " torch.cuda.empty_cache()\n",
 
1874
  " tokens_processed += batch.numel()\n",
1875
  "\n",
1876
  " with autocast('cuda', dtype=torch.float16):\n",
1877
+ " result = model_unwrapped.compute_loss(batch)\n",
1878
  " loss = result['loss'] / config.grad_accum_steps\n",
1879
  "\n",
1880
  " scaler.scale(loss).backward()\n",