Skip to content

Instantly share code, notes, and snippets.

View AayushSameerShah's full-sized avatar
🤨
Hmm...

Aayush Shah AayushSameerShah

🤨
Hmm...
View GitHub Profile
@moyix
moyix / codegen_gptj_convert.py
Created July 22, 2022 19:33
Convert a SalesForce CodeGen model's weights to plain GPT-J
#!/usr/bin/env python
import argparse
import torch
from transformers import GPTJForCausalLM, GPTJConfig
# Note: these need the git version of Transformers as of 7/22/2022
from transformers import CodeGenTokenizer, CodeGenForCausalLM
from transformers import CODEGEN_PRETRAINED_MODEL_ARCHIVE_LIST
parser = argparse.ArgumentParser('Convert SalesForce CodeGen model to GPT-J')
@AayushSameerShah
AayushSameerShah / RRMSE.py
Last active April 18, 2024 04:38
Relative Root Mean Squared Error (RRMSE)
def relative_root_mean_squared_error(true, pred):
n = len(true) # update
num = np.sum(np.square(true - pred)) / n # update
den = np.sum(np.square(pred))
squared_error = num/den
rrmse_loss = np.sqrt(squared_error)
return rrmse_loss
@AayushSameerShah
AayushSameerShah / get_row_in_groupby_sql.md
Last active March 14, 2022 16:47
This is the most complex query that I was struggling with... here is the solution

This is the data...

Title Author Pages
A man from sky Aayush 334
I know, what miracle is. Aayush 3134
album001 Sameer 134
How to feel happiness? Sameer 534
The secrets of woderland Sameer 834
An Adventurous Guy Baa 1234
@AayushSameerShah
AayushSameerShah / numpy_triu.py
Last active June 30, 2022 06:20
This will make a mask for heatmap. (TRIANGLE HEATMAP)
plt.figure(figsize=(10, 6))
corr = df.corr()
mask = np.zeros_like(corr)
mask[np.triu_indices_from(mask)] = True
sns.heatmap(corr, mask=mask, square=True, cmap="Blues")