Skip to content
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

Fix Grokking Notebook #450

Merged
merged 2 commits into from
Nov 21, 2023
Merged

Conversation

ArthurConmy
Copy link
Collaborator

This used several old imports.

Changed to install TL main and https://github.com/neelnanda-io/neel-plotly

@@ -188,7 +190,8 @@
"outputs": [],
"source": [
"# where we save the model\n",
"PTH_LOCATION = \"/workspace/_scratch/grokking_demo.pth\""
"PTH_LOCATION = \"/workspace/_scratch/grokking_demo.pth\"\n",
"assert os.path.exists(Path(PTH_LOCATION).parent), f\"Please create the folder {Path(PTH_LOCATION).parent} before running this notebook\""
Copy link
Contributor

@Aprillion Aprillion Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably bettern than before but TBH, the AssertionError is not really that much fun to see after returning to the Colab after letting it install and run for a few minutes ... would os.mkdir(...) be possible instead?

tested in https://colab.research.google.com/github/neelnanda-io/TransformerLens/blob/3f331759ddab8da81df41b55a49b9d79e80b59e6/demos/Grokking_Demo.ipynb

Copy link
Contributor

@Aprillion Aprillion Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, what's the deal with absolute paths? does Google Colab map root folder to something I can create?

FTR relative path (without starting /) seems to work fine in Colab:

Screenshot 2023-11-21 at 17 08 25

@@ -3497,7 +3515,7 @@
}
],
"source": [
"print(loss_fn(all_logits, labels))"
"print(loss_fn(all_logits, labels)) # This bugged on models not fully trained "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 thanks for the comment ... it does indeed 😅

@@ -3274,7 +3292,7 @@
"get_metrics(model, metric_cache, get_cos_sim, \"cos_sim\")\n",
Copy link
Contributor

@Aprillion Aprillion Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FTR this bugs out on the free Colab GPU:

OutOfMemoryError: CUDA out of memory. Tried to allocate 76.00 MiB. GPU 0 has a total capacty of 14.75 GiB of which 26.81 MiB is free. Process 2651 has 14.72 GiB memory in use. Of the allocated memory 14.05 GiB is allocated by PyTorch, and 512.72 MiB is reserved by PyTorch but unallocated. If reserved but unallocated memory is large try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

Copy link
Contributor

@Aprillion Aprillion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM in general

@ArthurConmy
Copy link
Collaborator Author

Thanks! Test fail seems unrelated so I'm merging

@ArthurConmy ArthurConmy merged commit 7bbe71d into TransformerLensOrg:main Nov 21, 2023
6 of 7 checks passed
ojh31 pushed a commit to ojh31/TransformerLens that referenced this pull request Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants