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
#pip3 install transformers==2.8.0 | |
import torch | |
from transformers import AutoTokenizer, AutoModelWithLMHead | |
tokenizer = AutoTokenizer.from_pretrained("sberbank-ai/rugpt3large_based_on_gpt2") | |
model = AutoModelWithLMHead.from_pretrained("sberbank-ai/rugpt3large_based_on_gpt2") | |
model.eval() | |
model = model.to('cuda') | |
def generate_text(prompts, lenght): | |
chars = 0 | |
while chars < lenght: |
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 | |
from scipy.io import wavfile | |
fps = 24 | |
path_to_audio = 'path_to_audio.wav' | |
try: | |
rate, signal = wavfile.read(path_to_audio) | |
signal = np.mean(signal, axis=1) | |
except: |
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 | |
def parse_prompt_attention(text): | |
import re | |
re_attention = re.compile(r""" | |
\\\(| | |
\\\)| | |
\\\[| | |
\\]| | |
\\\\| |