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 | |
model, example_texts, languages, punct, apply_te = torch.hub.load(repo_or_dir='snakers4/silero-models', | |
model='silero_te') | |
input_text = input('Enter input text\n') | |
apply_te(input_text, lan='en') |
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 itertools | |
# Based on https://github.com/bfs18/tacotron2 | |
def grads_for_params(loss, parameters, optimizer): | |
optimizer.zero_grad() | |
loss.backward(retain_graph=True) |
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 gc | |
import tqdm | |
import faiss | |
import bcolz | |
import os,sys | |
import numpy as np | |
from tqdm import tqdm | |
# open the stored bcolz array | |
# note that these vectors have to be 280 dimensional |
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 | |
torch.set_num_threads(1) | |
from pprint import pprint | |
model, utils = torch.hub.load(repo_or_dir='snakers4/silero-vad', | |
model='silero_vad', | |
force_reload=True) | |
(get_speech_ts, | |
_, read_audio, |
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
# add 7z tar and zip archivers | |
FROM nvidia/cuda:9.0-cudnn7-devel | |
# https://docs.docker.com/engine/examples/running_ssh_service/ | |
RUN apt-get update && apt-get install -y openssh-server | |
RUN mkdir /var/run/sshd | |
RUN echo 'root:Ubuntu@41' | chpasswd | |
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config | |
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config | |
RUN mkdir ~/.ssh/ |
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
class BertEmbeddingBag(nn.Module): | |
"""Construct the embeddings from word, position and token_type embeddings. | |
""" | |
def __init__(self, config): | |
super(BertEmbeddingBag, self).__init__() | |
# self.word_embeddings = nn.Embedding(config.vocab_size, config.hidden_size) | |
ngram_matrix=np.load(config.ngram_matrix_path) | |
self.old_bag = config.old_bag |
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 printProgressBar (iteration, total, prefix = '', suffix = '', decimals = 1, length = 100, fill = '█'): | |
""" | |
Call in a loop to create terminal progress bar | |
@params: | |
iteration - Required : current iteration (Int) | |
total - Required : total iterations (Int) | |
prefix - Optional : prefix string (Str) | |
suffix - Optional : suffix string (Str) | |
decimals - Optional : positive number of decimals in percent complete (Int) | |
length - Optional : character length of bar (Int) |
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
diff --git a/include/contrib/moderngpu/include/device/intrinsics.cuh b/include/contrib/moderngpu/include/device/intrinsics.cuh | |
index a601443..c212a38 100644 | |
--- a/include/contrib/moderngpu/include/device/intrinsics.cuh | |
+++ b/include/contrib/moderngpu/include/device/intrinsics.cuh | |
@@ -112,7 +112,7 @@ __device__ __forceinline__ float shfl_up(float var, | |
unsigned int delta, int width = 32) { | |
#if __CUDA_ARCH__ >= 300 | |
- var = __shfl_up(var, delta, width); | |
+ var = __shfl_up_sync(0xFFFFFFFF, var, delta, width); |
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
{ | |
echo To: YOUR_EMAIL@gmail.com | |
echo From: YOUR_EMAIL@gmail.com | |
echo Subject: Temperature warning! $TIMESTAMP | |
echo Current CPU temperature is $TEMP | |
} | ssmtp YOUR_EMAIL@gmail.com |
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 tqdm import tqdm | |
import numpy as np | |
import pandas as pd | |
from multiprocessing import Pool | |
def _apply_df(args): | |
df, func, num, kwargs = args | |
return num, df.apply(func, **kwargs) | |
def apply_by_multiprocessing(df,func,**kwargs): |