Skip to content

Instantly share code, notes, and snippets.

View snakers4's full-sized avatar
🚀
It is by will alone I set my mind in motion.

Alexander Veysov snakers4

🚀
It is by will alone I set my mind in motion.
View GitHub Profile
{"cells":[{"cell_type":"code","execution_count":1,"metadata":{"id":"vA0-1iElD-wr","executionInfo":{"status":"ok","timestamp":1681303032533,"user_tz":-180,"elapsed":10963,"user":{"displayName":"Senhor Maestro","userId":"08176940519269874318"}}},"outputs":[],"source":["import numpy as np\n","import pandas as pd\n","import torch\n","\n","import seaborn as sns\n","import matplotlib.pyplot as plt\n","\n","from sklearn.model_selection import train_test_split\n","from sklearn.feature_selection import mutual_info_regression\n","from sklearn.metrics import accuracy_score\n","#from catboost import CatBoostClassifier"]},{"cell_type":"code","source":["from google.colab import drive\n","drive.mount('/content/drive')"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"2rjmy9OpEYEr","executionInfo":{"status":"ok","timestamp":1681303100348,"user_tz":-180,"elapsed":19790,"user":{"displayName":"Senhor Maestro","userId":"08176940519269874318"}},"outputId":"cac0e451-2165-406b-cba1-f8c3bf6d480f"},"execution_count":
{
"cells": [
{
"cell_type": "code",
"execution_count": 59,
"metadata": {
"id": "1XEMm5oo36Sm"
},
"outputs": [],
"source": [
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@snakers4
snakers4 / examples.md
Created October 6, 2021 15:58
Text Enhancement Examples
Original Model
She heard Missis Gibson talking on in a sweet monotone, and wished to attend to what she was saying, but the Squires visible annoyance struck sharper on her mind. She heard Missis Gibson talking on in a sweet monotone and wished to attend to what she was saying, but the squires visible ann
@snakers4
snakers4 / example.py
Created October 6, 2021 15:54
Silero Text Enhancement Example
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')
@snakers4
snakers4 / gradient_adaptive_factor.py
Created February 2, 2021 12:44
Gradient Adaptive Factor
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)
@snakers4
snakers4 / vad_pytorch.py
Created January 14, 2021 07:12
silero_vad_example
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,
@snakers4
snakers4 / warp_ctc_patch_cuda_10_1.patch
Last active January 28, 2020 10:34
warp_ctc_patch_cuda_10_1
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);
@snakers4
snakers4 / modeling.py
Created March 1, 2019 09:14
Best pretraining for Russian language - embedding bag interfaces
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
@snakers4
snakers4 / send_test_email.sh
Last active February 24, 2019 07:24
Plain temperature monitoring in Ubuntu 18.04
{
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