This file contains 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_gpu_with_highest_free_memory(): | |
""" | |
Returns the index of the GPU with the highest free memory. | |
This function sorts the GPUs by PCI bus ID and then returns the index of the GPU with the highest free memory. | |
Returns: | |
list: A list containing the index and free memory of the GPU with the highest free memory. | |
Notes: |
This file contains 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
\usepackage{scalerel,xparse} | |
\NewDocumentCommand\emojismile{}{ | |
\scalerel*{ | |
\includegraphics{EmojiFolder/u1F60A.png} | |
}{X} | |
} | |
% Alternative | |
\NewDocumentCommand\emojismiley{}{ | |
\includegraphics[scale=0.05]{EmojiFolder/u1F60A.png} |
This file contains 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 split_dataframe(df:pd.DataFrame, train_frac:float, shuffle: bool ): | |
""" | |
Splits DataFrame into train and val | |
Args: | |
df: DataFrame to split, note: indexes will be reset | |
train_frac: fraction to use for training | |
shuffle: Shuffles df if true | |
Returns: | |
split_df: DataFrame with splits mentioned in 'split' column | |
""" |
This file contains 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
# https://stackoverflow.com/questions/44544766/how-do-i-check-if-keras-is-using-gpu-version-of-tensorflow/44547144 | |
# confirm TensorFlow sees the GPU | |
from tensorflow.python.client import device_lib | |
assert 'GPU' in str(device_lib.list_local_devices()) | |
# print(device_lib.list_local_devices()) | |
# confirm Keras sees the GPU | |
from keras import backend | |
assert len(backend.tensorflow_backend._get_available_gpus()) > 0 |
This file contains 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
""" | |
Tweet tokenizing script based on the one provided by pennington GloVe coupled with NLTK tweettokenizer | |
Date: 4th October 2019 | |
""" | |
import pickle | |
import sys | |
import re | |
import csv |
This file contains 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
""" | |
preprocess-twitter.py | |
python preprocess-twitter.py "Some random text with #hashtags, @mentions and http://t.co/kdjfkdjf (links). :)" | |
Script for preprocessing tweets by Romain Paulus | |
with small modifications by Jeffrey Pennington | |
with translation to Python by Motoki Wu | |
Translation of Ruby script to create features for GloVe vectors for Twitter data. |
This file contains 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 sent_to_embedding(embedding, data, max_len=None): | |
''' | |
Creates fasttext embedding of given list of sentences | |
input: | |
embedding: fasttext.model | |
data: list of sentences | |
max_len: maximum number of words to consider | |
returns: | |
emb_matrix: numpy matrix containing word level embeddings |
This file contains 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 numpy as np | |
import matplotlib.pyplot as plt | |
from pprint import pprint | |
from tqdm import tqdm | |
class myNN(object): | |
def __init__(self): | |
self.params = None | |
self.layer_dims = None |
This file contains 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
#!/usr/bin/env python3 | |
#DISCLAMER: Provided with no warranty, you are responsible for whatever may befall you | |
# or your property as a result of using this script. | |
#You implicitly agree to this by running this script. | |
#Feel free to improve, modify and distribute | |
import os | |
import sys |
This file contains 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
#!/bin/bash | |
mkdir wordpress-site && cd wordpress-site | |
touch docker-compose.yml | |
cat > docker-compose.yml <<EOL | |
version: "2" | |
services: | |
my-wpdb: |
NewerOlder