Skip to content

Instantly share code, notes, and snippets.

View morganmcg1's full-sized avatar
💭
Trying to ML

Morgan McGuire morganmcg1

💭
Trying to ML
View GitHub Profile
@morganmcg1
morganmcg1 / minGPT-Fastai_Play_Char.ipynb
Created August 22, 2020 00:04
Karpathy's minGPT in Fastai
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
class BatchNormFP32(nn.BatchNorm2d):
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs)
def forward(self, x): return super().forward(x.float()) # CAST BatchNorm input to float
# SWAP OUT REGUALR BN FOR BatchNormFP32 IN YOUR MODEL
def swap_batch_norm(model, layer_type_old, layer_type_new, copy_data=True):
conversion_count = 0
#TODO : make sure device is correct
for name, module in reversed(model._modules.items()):
if len(list(module.children())) > 0:
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "view-in-github"
},
"source": [
"<a href=\"https://colab.research.google.com/github/sheikmohdimran/Experiments_2020/blob/master/NLP/SWT_fastai.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@morganmcg1
morganmcg1 / Transformer Tricks to Try
Last active February 12, 2021 13:02
A bunch of random tricks to try and create the ultimate transformer!
ARCHITECCTURE
- ADMIN Initialisation
- {{[[TODO]]}} Deeper encoder, shallower decoder
- {{[[TODO]]}} Mish
- DONE? {{[[TODO]]}} Test Impact of embedding tying (would need shared vocab)
- {{[[TODO]]}} Use [[PreLayerNorm]]
- Try #ELU and #[[Shifted RELU]]
- Try [[EDITOR]] transformer: https://jlibovicky.github.io/2020/12/12/MT-Weekly-Editor.html
- Gradient Adaptive Clipping
- Snake Activation: https://twitter.com/EdwardDixon3/status/1360211045491617792?s=20
@morganmcg1
morganmcg1 / _admin_init.ipynb
Created February 21, 2021 22:08
Testing out ADMIN with BTE, trained SentencePieceUnigram and PreTrained T5 Tokenizers
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
https://colab.research.google.com/drive/1D6krVG0PPJR2Je9g5eN_2h6JP73_NUXz
@morganmcg1
morganmcg1 / gist:7efefc5dabac971a8198c3e2f6dd15a6
Last active March 20, 2021 14:57
Colab auto-click, prevent close due to inactivity
In case you want to use this google colab to fine-tune your model, you should make sure that
your training doesn't stop due to inactivity. A simple hack to prevent this is to paste the
following code into the console of this tab (right mouse click -> inspect -> Console tab and insert code).
```
function ConnectButton(){
console.log("Connect pushed");
document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click()
}
setInterval(ConnectButton,60000);
@morganmcg1
morganmcg1 / sklearn_metrics_logging.ipynb
Created April 6, 2021 20:08
F1 score using wandb.sklearn.plot_summary_metrics
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@morganmcg1
morganmcg1 / debug-internal.log
Created April 7, 2021 10:29
wandb run crash - wandb/xlsr-irish/d1isczie
This file has been truncated, but you can view the full file.
2021-04-06 10:29:46,421 INFO MainThread:30933 [internal.py:wandb_internal():88] W&B internal server running at pid: 30933, started at: 2021-04-06 10:29:46.421160
2021-04-06 10:29:46,423 DEBUG SenderThread:30933 [sender.py:send():160] send: header
2021-04-06 10:29:46,423 DEBUG HandlerThread:30933 [handler.py:handle_request():120] handle_request: check_version
2021-04-06 10:29:46,423 INFO WriterThread:30933 [datastore.py:open_for_write():77] open: /home/morgan/ml/projects/xlsr_finetune/notebooks/wandb/run-20210406_102945-d1isczie/run-d1isczie.wandb
2021-04-06 10:29:46,424 DEBUG SenderThread:30933 [sender.py:send():160] send: request
2021-04-06 10:29:46,424 DEBUG SenderThread:30933 [sender.py:send_request():169] send_request: check_version
2021-04-06 10:29:46,501 DEBUG SenderThread:30933 [sender.py:send():160] send: run
2021-04-06 10:29:46,718 INFO SenderThread:30933 [sender.py:_start_run_threads():651] run started: d1isczie with start time 1617701385
2021-04-06 10:29:46,718 DEBUG SenderThre