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
# Prerequisites | |
# 1. MSVC 2017 C++ Build Tools | |
# 2. CMAKE 3.0 or up | |
# 3. 64 bits of Windows | |
# 4. Anaconda / MiniConda 64 bits | |
# Prerequisites for CUDA | |
# 1. CUDA 8.0 or up | |
# 2. NVTX( in CUDA as Visual Studio Integration. if fail to install, you can extract | |
# the CUDA installer exe and found the NVTX installer under the CUDAVisualStudioIntegration) |
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
digraph { | |
0 -> "*" [key=0, | |
label="[b]"]; | |
1 -> "*" [key=0, | |
label="[d]"]; | |
enter -> "*" [key=0, | |
label=ε]; | |
"*" -> 0 [key=0, | |
label="[a]"]; | |
"*" -> 1 [key=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
""" | |
Visualize word embeddings, using tsne. | |
First computes cosine distance of the 100 closests words, and then shows a clustering graph | |
of the first 11 closest words (the first one is always the word) | |
IT REQUIRES GLOVE MODEL.txt | |
line 31: glove_file = '../TBIR/glove.840B.300d.txt' MODIFY with the appropiate path | |
To Use it, you can just type: python word_embedding_vis.py <list of words space separated> | |
e.g: python word_embedding_vis.py cake word embedding music | |
""" |
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
from transformers import GPT2Tokenizer, GPT2LMHeadModel | |
import torch | |
from torch.nn import CrossEntropyLoss | |
from tqdm import trange | |
max_length = 24 | |
batch_size = 200 | |
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 | |
# Show username after each process in nvidia-smi | |
# like: | |
# ... | |
# +------------------------------------------------------+ | |
# | Processes: GPU Memory | | |
# | GPU PID Type Process name Usage | | |
# |======================================================| | |
# | 0 150752 C python 830MiB | User: user1 | |
# | 1 2185 C /usr/bin/python 1090MiB | User: user2 |
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 | |
# this script installs GCC 5.4.0 | |
# to use it navigate to your home directory and type: | |
# sh install-gcc-5.4.0.sh | |
# download and install gcc 4.9.3 | |
wget https://github.com/gcc-mirror/gcc/archive/gcc-5_4_0-release.tar.gz | |
tar xzf gcc-5_4_0-release.tar.gz | |
cd gcc-5_4_0-release |
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 torch | |
import torch.nn as nn | |
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence | |
seqs = ['gigantic_string','tiny_str','medium_str'] | |
# make <pad> idx 0 | |
vocab = ['<pad>'] + sorted(set(''.join(seqs))) | |
# make model |
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 torch | |
from transformers import OpenAIGPTTokenizer, OpenAIGPTLMHeadModel | |
from transformers import GPT2Tokenizer, GPT2LMHeadModel | |
import numpy as np | |
from scipy.special import softmax | |
def model_init(model_string, cuda): | |
if model_string.startswith("gpt2"): | |
tokenizer = GPT2Tokenizer.from_pretrained(model_string) | |
model = GPT2LMHeadModel.from_pretrained(model_string) |
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
# LaTeX temporary files | |
*.aux | |
*.log | |
*.toc | |
# PDF output - usually a bad idea to keep this in Git | |
# Latexmk | |
*.fdb_latexmk |
OlderNewer