This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| # here a path to a folder with files | |
| PATH = r'C:\folder_to_rename' | |
| # Filename extension | |
| extension = '.png' | |
| # in this case it numerates files from 0 to N, where N is a number of files. | |
| i = 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib.pyplot as plt | |
| plt.rcParams.update({ "axes.facecolor":"383838", "axes.edgecolor":"white", "axes.labelcolor":"white", "xtick.color":"white", "ytick.color":"white"}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def print_matrix(M,precision=3): | |
| M_copy = M.copy() | |
| M_copy = np.round(M_copy,precision) | |
| for row in M_copy: | |
| print(str("{:>10} "*len(M)).format(*row)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| X = torch.rand((8,8)) | |
| p = 0.3 | |
| X = (X > p)*X/(1-p) # dropout itself |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print(sum(p.numel() for p in model.parameters() if p.requires_grad)*NUM_MODELS) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from IPython.display import FileLink | |
| FileLink(r'file_name.csv') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def get_vocab(texts): | |
| id2word = {0 : "<pad>", 1 : "<unk>"} | |
| word2id = {"<pad>" : 0, 1 : "<unk>"} | |
| i = 1 | |
| for text in texts: | |
| for word in text: | |
| word = word.lower() | |
| if word not in word2id.keys(): | |
| word2id[word] = i | |
| id2word[i] = word |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| nan_idx = [] | |
| for i in range(len(df)): | |
| if True in list(df.iloc[i].isnull()): | |
| nan_idx.append(i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюяё |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !pip install kaggle | |
| !mkdir ~/.kaggle | |
| !cp kaggle.json ~/.kaggle/ | |
| !chmod 600 ~/.kaggle/kaggle.json | |
| !kaggle datasets download <dataset-name> | |
| !unzip /content/<dataset-name>.zip |
OlderNewer