repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
Proper-Learning-of-LDS | Proper-Learning-of-LDS-master/ncpop/functions.py | import sys
sys.path.append("/home/zhouqua1/NCPOP")
from inputlds import*
from ncpol2sdpa import*
import numpy as np
import pandas as pd
from math import sqrt
def SimCom(Y,T,level):
# Define a function for solving the NCPO problems with
# given standard deviations of process noise and observtion noise,
# length of e... | 9,353 | 45.078818 | 137 | py |
Proper-Learning-of-LDS | Proper-Learning-of-LDS-master/ncpop/ncpop_stock.py | import sys
#sys.path.append("/home/zhouqua1")
sys.path.append("/home/zhouqua1/NCPOP")
from functions import*
from ncpol2sdpa import*
import numpy as np
import pandas as pd
"""
# Load stock-market data
load_path = 'setting6.mat'
load_data = sio.loadmat(load_path)
seq=flatten(load_data['seq_d0'].tolist())
"""
ts=pd.r... | 703 | 27.16 | 79 | py |
Proper-Learning-of-LDS | Proper-Learning-of-LDS-master/ncpop/ncpop100_higherorder.py | import sys
sys.path.append("/home/zhouqua1")
sys.path.append("/home/zhouqua1/NCPOP")
from inputlds import*
from functions import*
from ncpol2sdpa import*
import numpy as np
import pandas as pd
from math import sqrt
# Set parameters
start=0.1
stop=1.0
step=0.1
T=20
level=1
# Collect the nrmse value for each experime... | 1,098 | 22.891304 | 81 | py |
Proper-Learning-of-LDS | Proper-Learning-of-LDS-master/ncpop/ncpop_momentdegree.py | import sys
sys.path.append("/home/zhouqua1/NCPOP")
from inputlds import*
from functions import*
from ncpol2sdpa import*
import numpy as np
import pandas as pd
from math import sqrt
# first change moment order to 2
# Set parameters
start=0.1
stop=1.0
step=0.3
T=20
level=2
# Collect the nrmse value for each experiment
... | 1,033 | 21.977778 | 65 | py |
Proper-Learning-of-LDS | Proper-Learning-of-LDS-master/ncpop/ncpop_parameters.py | import sys
sys.path.append("/home/zhouqua1/NCPOP")
from inputlds import*
from functions import*
from ncpol2sdpa import*
import numpy as np
import pandas as pd
from math import sqrt
# set std of noises to be 0.5
# tune c1 and c2
level=1
pro_std=0.5
obs_std=0.5
T=20
g = np.matrix([[0.9,0.2],[0.1,0.1]])
f_dash = np.matr... | 871 | 19.27907 | 57 | py |
Proper-Learning-of-LDS | Proper-Learning-of-LDS-master/ncpop/ncpop100.py | import sys
sys.path.append("/home/zhouqua1")
sys.path.append("/home/zhouqua1/NCPOP")
from inputlds import*
from functions import*
from ncpol2sdpa import*
import numpy as np
import pandas as pd
from math import sqrt
# Set parameters
start=0.1
stop=1.0
step=0.1
T=20
level=1
# Collect the nrmse value for each experime... | 1,044 | 22.75 | 65 | py |
Proper-Learning-of-LDS | Proper-Learning-of-LDS-master/ncpop/ncpop300.py | import sys
#sys.path.append("/home/zhouqua1")
sys.path.append("/home/zhouqua1/NCPOP")
from inputlds import*
from functions import*
from ncpol2sdpa import*
import numpy as np
import pandas as pd
from math import sqrt
# Set parameters
start=0.1
stop=1.0
step=0.1
repeat=30
T=20
level=1
# Collect the nrmse value for ea... | 1,155 | 25.272727 | 95 | py |
dnc | dnc-master/setup.py | from setuptools import setup
setup(
name='dnc',
version='0.0.2',
description='This package provides an implementation of the Differentiable Neural Computer, as published in Nature.',
license='Apache Software License 2.0',
packages=['dnc'],
author='DeepMind',
keywords=['tensorflow', 'differe... | 466 | 34.923077 | 137 | py |
dnc | dnc-master/train.py | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 6,136 | 35.529762 | 80 | py |
dnc | dnc-master/dnc/access_test.py | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 6,087 | 36.121951 | 80 | py |
dnc | dnc-master/dnc/dnc.py | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 5,005 | 34.006993 | 103 | py |
dnc | dnc-master/dnc/addressing.py | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 16,943 | 40.226277 | 82 | py |
dnc | dnc-master/dnc/repeat_copy.py | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 15,531 | 38.521628 | 80 | py |
dnc | dnc-master/dnc/access.py | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 12,988 | 39.717868 | 80 | py |
dnc | dnc-master/dnc/addressing_test.py | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 16,127 | 36.859155 | 80 | py |
dnc | dnc-master/dnc/util.py | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 2,743 | 36.589041 | 123 | py |
dnc | dnc-master/dnc/__init__.py | 0 | 0 | 0 | py | |
dnc | dnc-master/dnc/util_test.py | # Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | 2,017 | 29.119403 | 80 | py |
BeatNet | BeatNet-main/setup.py | """
Created 07-01-21 by Mojtaba Heydari
"""
# Local imports
# None.
# Third party imports
# None.
# Python standard library imports
import setuptools
from setuptools import find_packages
import distutils.cmd
# Required packages
REQUIRED_PACKAGES = [
'numpy',
'cython',
'librosa>=0.8.0',
'numba==0.5... | 1,983 | 22.619048 | 167 | py |
BeatNet | BeatNet-main/src/BeatNet/example.py | def add_one(number):
return number + 1 | 42 | 20.5 | 21 | py |
BeatNet | BeatNet-main/src/BeatNet/BeatNet.py | # This is the script handler of the BeatNet. First, it extracts the input embeddings of the current frame or the whole song, depending on the working mode.
# Then by feeding them into the selected pre-trained model, it calculates the beat/downbeat activation probabilities.
# Finally, it infers beats and downbeats of t... | 12,681 | 58.539906 | 296 | py |
BeatNet | BeatNet-main/src/BeatNet/particle_filtering_cascade.py | import numpy as np
import matplotlib.pyplot as plt
from numpy.random import default_rng
rng = default_rng()
from madmom.features.beats_hmm import BarStateSpace, BarTransitionModel # importing the bar pointer state space implemented in Madmom
from madmom.ml.hmm import TransitionModel, ObservationModel
class BDObser... | 23,574 | 53.071101 | 210 | py |
BeatNet | BeatNet-main/src/BeatNet/model.py | import torch.nn as nn
import torch
import torch.nn.functional as F
import numpy as np
class BDA(nn.Module): #beat_downbeat_activation
def __init__(self, dim_in, num_cells, num_layers, device):
super(BDA, self).__init__()
self.dim_in = dim_in
self.dim_hd = num_cells
self.num_layer... | 2,088 | 34.40678 | 132 | py |
BeatNet | BeatNet-main/src/BeatNet/common.py | # My imports
# None of my imports used
# Regular imports
from abc import abstractmethod
import numpy as np
import librosa
class FeatureModule(object):
"""
Implements a generic music feature extraction module wrapper.
"""
def __init__(self, sample_rate, hop_length, num_channels=1, decibels=True):
... | 5,808 | 23.614407 | 86 | py |
BeatNet | BeatNet-main/src/BeatNet/log_spect.py | from madmom.audio.signal import SignalProcessor, FramedSignalProcessor
from madmom.audio.stft import ShortTimeFourierTransformProcessor
from madmom.audio.spectrogram import (
FilteredSpectrogramProcessor, LogarithmicSpectrogramProcessor,
SpectrogramDifferenceProcessor)
from madmom.processors import ParallelProc... | 2,077 | 49.682927 | 118 | py |
BeatNet | BeatNet-main/src/BeatNet/__init__.py | 0 | 0 | 0 | py | |
BeatNet | BeatNet-main/src/BeatNet/models/__init__.py | 0 | 0 | 0 | py | |
PaperRobot | PaperRobot-master/New paper writing/test.py | import gc
import os
import time
import torch
import pickle
import argparse
import torch.nn as nn
from eval_final import Evaluate
from loader.preprocessing import prepare_mapping, AssembleMem, printcand, filter_stopwords
from loader.loader import load_file_with_terms
from memory_generator.seq2seq import Seq2seq
from m... | 3,280 | 28.558559 | 103 | py |
PaperRobot | PaperRobot-master/New paper writing/eval.py | import pickle
import collections
import sys
sys.path.append('pycocoevalcap')
from pycocoevalcap.bleu.bleu import Bleu
from pycocoevalcap.rouge.rouge import Rouge
from pycocoevalcap.meteor.meteor import Meteor
#from pycocoevalcap.cider.cider import Cider
class Evaluate(object):
def __init__(self):
self.sco... | 2,844 | 31.701149 | 99 | py |
PaperRobot | PaperRobot-master/New paper writing/train.py | import gc
import os
import sys
import time
import torch
import pickle
import argparse
import torch.nn as nn
from collections import OrderedDict
from eval import Evaluate
from loader.logger import Tee
from loader.loader import load_file_with_terms
from loader.preprocessing import prepare_mapping, AssembleMem
from util... | 9,621 | 32.065292 | 116 | py |
PaperRobot | PaperRobot-master/New paper writing/input.py | import torch
import pickle
import argparse
import torch.nn as nn
from loader.preprocessing import prepare_mapping, filter_stopwords
from memory_generator.seq2seq import Seq2seq
from memory_generator.Encoder import EncoderRNN
from memory_generator.Encoder import TermEncoder
from memory_generator.predictor import Predic... | 4,304 | 30.888889 | 111 | py |
PaperRobot | PaperRobot-master/New paper writing/eval_final.py | import pickle
import os
import collections
import sys
sys.path.append('pycocoevalcap')
from pycocoevalcap.bleu.bleu import Bleu
from pycocoevalcap.rouge.rouge import Rouge
from pycocoevalcap.meteor.meteor import Meteor
#from pycocoevalcap.cider.cider import Cider
class Evaluate(object):
def __init__(self):
... | 2,840 | 31.284091 | 99 | py |
PaperRobot | PaperRobot-master/New paper writing/pycocoevalcap/__init__.py | __author__ = 'tylin'
| 21 | 10 | 20 | py |
PaperRobot | PaperRobot-master/New paper writing/pycocoevalcap/meteor/meteor.py | # -*- coding: utf-8 -*-
# Python wrapper for METEOR implementation, by Xinlei Chen
# Acknowledge Michael Denkowski for the generous discussion and help
import os
import threading
import subprocess
import pkg_resources
METEOR_JAR = 'meteor-1.5.jar'
class Meteor(object):
def __init__(self, language='en', norm=True)... | 2,083 | 32.079365 | 123 | py |
PaperRobot | PaperRobot-master/New paper writing/pycocoevalcap/meteor/__init__.py | __author__ = 'tylin'
| 21 | 10 | 20 | py |
PaperRobot | PaperRobot-master/New paper writing/pycocoevalcap/rouge/rouge.py |
# -*- coding: utf-8 -*-
# File Name : rouge.py
#
# Description : Computes ROUGE-L metric as described by Lin and Hovey (2004)
#
# Creation Date : 2015-01-07 06:03
# Author : Ramakrishna Vedantam <vrama91@vt.edu>
import numpy as np
def my_lcs(string, sub):
"""
Calculates longest common subsequence for a pair ... | 3,591 | 34.564356 | 122 | py |
PaperRobot | PaperRobot-master/New paper writing/pycocoevalcap/rouge/__init__.py | __author__ = 'vrama91'
| 23 | 11 | 22 | py |
PaperRobot | PaperRobot-master/New paper writing/pycocoevalcap/cider/cider_scorer.py | # -*- coding: utf-8 -*-
# Tsung-Yi Lin <tl483@cornell.edu>
# Ramakrishna Vedantam <vrama91@vt.edu>
import copy
from collections import defaultdict
import numpy as np
import math
def precook(s, n=4, out=False):
"""
Takes a string as input and returns an object that can be given to
either cook_refs or cook_... | 7,634 | 39.184211 | 116 | py |
PaperRobot | PaperRobot-master/New paper writing/pycocoevalcap/cider/__init__.py | __author__ = 'tylin'
| 21 | 10 | 20 | py |
PaperRobot | PaperRobot-master/New paper writing/pycocoevalcap/cider/cider.py | # -*- coding: utf-8 -*-
# Filename: cider.py
#
# Description: Describes the class to compute the CIDEr (Consensus-Based Image Description Evaluation) Metric
# by Vedantam, Zitnick, and Parikh (http://arxiv.org/abs/1411.5726)
#
# Creation Date: Sun Feb 8 14:16:54 2015
#
# Authors: Ramakrishna Vedantam <vr... | 1,631 | 31 | 121 | py |
PaperRobot | PaperRobot-master/New paper writing/pycocoevalcap/bleu/bleu_scorer.py | # -*- coding: utf-8 -*-
# bleu_scorer.py
# David Chiang <chiang@isi.edu>
# Copyright (c) 2004-2006 University of Maryland. All rights
# reserved. Do not redistribute without permission from the
# author. Not for commercial use.
# Modified by:
# Hao Fang <hfang@uw.edu>
# Tsung-Yi Lin <tl483@cornell.edu>
'''Provides:
... | 8,704 | 31.849057 | 150 | py |
PaperRobot | PaperRobot-master/New paper writing/pycocoevalcap/bleu/bleu.py | # -*- coding: utf-8 -*-
# File Name : bleu.py
#
# Description : Wrapper for BLEU scorer.
#
# Creation Date : 06-01-2015
# Last Modified : Thu 19 Mar 2015 09:13:28 PM PDT
# Authors : Hao Fang <hfang@uw.edu> and Tsung-Yi Lin <tl483@cornell.edu>
from .bleu_scorer import BleuScorer
class Bleu:
def __init__(self, n=4)... | 1,187 | 26.627907 | 79 | py |
PaperRobot | PaperRobot-master/New paper writing/pycocoevalcap/bleu/__init__.py | __author__ = 'tylin'
| 21 | 10 | 20 | py |
PaperRobot | PaperRobot-master/New paper writing/loader/preprocessing.py | from collections import Counter
import torch
import json
import string
# Mask variable
def _mask(prev_generated_seq, device, eos_id):
prev_mask = torch.eq(prev_generated_seq, eos_id)
lengths = torch.argmax(prev_mask, dim=1)
max_len = prev_generated_seq.size(1)
mask = []
for i in range(prev_generat... | 11,373 | 42.746154 | 1,494 | py |
PaperRobot | PaperRobot-master/New paper writing/loader/logger.py | import logging
import sys
def get_logger(name, level=logging.INFO, handler=sys.stdout, filename=None,
formatter='%(asctime)s %(name)s %(levelname)s %(message)s'
):
logger = logging.getLogger(name)
logger.setLevel(logging.INFO)
formatter = logging.Formatter(formatter)
stre... | 1,007 | 25.526316 | 75 | py |
PaperRobot | PaperRobot-master/New paper writing/loader/__init__.py | 0 | 0 | 0 | py | |
PaperRobot | PaperRobot-master/New paper writing/loader/loader.py | import os
import json
import gzip
import lzma
import torch
import torch.nn as nn
from loader.preprocessing import create_mapping
def load_files(path):
sources = []
targets = []
words = []
for line in open(path, 'r'):
line = line.strip()
file = json.loads(line)
sources.append(f... | 6,934 | 27.539095 | 121 | py |
PaperRobot | PaperRobot-master/New paper writing/utils/optim.py | import torch.optim as optim
def get_optimizer(model, lr_method, lr_rate):
"""
parse optimization method parameters, and initialize optimizer function
"""
lr_method_name = lr_method
# initialize optimizer function
if lr_method_name == 'sgd':
optimizer = optim.SGD(model.parameters(), lr... | 901 | 36.583333 | 85 | py |
PaperRobot | PaperRobot-master/New paper writing/utils/__init__.py | 0 | 0 | 0 | py | |
PaperRobot | PaperRobot-master/New paper writing/memory_generator/Decoder.py | import sys
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from .baseRNN import BaseRNN
from .utils import MemoryComponent
class DecoderRNN(BaseRNN):
def __init__(self, vocab_size, embedding, word_dim, sos_id, eos_id, unk_id,
max_len=150, input_dropout_p=0, l... | 18,992 | 50.332432 | 120 | py |
PaperRobot | PaperRobot-master/New paper writing/memory_generator/predictor.py | import gc
from itertools import groupby
import torch
import statistics
def filter_duplicate(sents):
sents = sents.split('.')
used = []
used_s = []
tmp = ""
for ss in sents:
tttmp = ''
for s in ss.split(','):
if s not in used:
if len(s) < 2:
... | 7,888 | 37.862069 | 111 | py |
PaperRobot | PaperRobot-master/New paper writing/memory_generator/seq2seq.py | import torch.nn as nn
class Seq2seq(nn.Module):
def __init__(self, ref_encoder, term_encoder, decoder):
super(Seq2seq, self).__init__()
self.ref_encoder = ref_encoder
self.term_encoder = term_encoder
self.decoder = decoder
def forward(self, batch_s, batch_o_s, source_len, max... | 924 | 45.25 | 113 | py |
PaperRobot | PaperRobot-master/New paper writing/memory_generator/baseRNN.py | """ A base class for RNN. """
import torch.nn as nn
class BaseRNN(nn.Module):
def __init__(self, vocab_size, hidden_size, input_dropout_p, n_layers, rnn_cell):
super(BaseRNN, self).__init__()
self.vocab_size = vocab_size
self.hidden_size = hidden_size
self.n_layers = n_layers
... | 735 | 32.454545 | 85 | py |
PaperRobot | PaperRobot-master/New paper writing/memory_generator/utils.py | import torch
import copy
import math
import torch.nn as nn
import torch.nn.functional as F
def clones(module, N):
"Produce N identical layers."
return nn.ModuleList([copy.deepcopy(module) for _ in range(N)])
class MemoryComponent(nn.Module):
def __init__(self, hop, h, d_model, dropout_p):
super... | 1,774 | 38.444444 | 118 | py |
PaperRobot | PaperRobot-master/New paper writing/memory_generator/Encoder.py | import torch.nn as nn
from .baseRNN import BaseRNN
class EncoderRNN(BaseRNN):
def __init__(self, vocab_size, embedding, hidden_size, input_dropout_p,
n_layers=1, bidirectional=True, rnn_type='gru'):
super(EncoderRNN, self).__init__(vocab_size, hidden_size, input_dropout_p, n_layers, rnn_... | 1,429 | 31.5 | 102 | py |
PaperRobot | PaperRobot-master/Existing paper reading/test.py | from __future__ import division
from __future__ import print_function
import time
import argparse
import numpy as np
import torch
import torch.nn.functional as F
import torch.optim as optim
from torch.utils import data
import os, sys, math, pickle, gc
from utils.utils import convert_index, get_subgraph, adjust_sent_o... | 7,048 | 38.161111 | 125 | py |
PaperRobot | PaperRobot-master/Existing paper reading/train.py | from __future__ import division
from __future__ import print_function
import time
import argparse
import numpy as np
import torch
import torch.nn.functional as F
import torch.optim as optim
from torch.utils import data
import os, sys, math, pickle, gc
from utils.utils import convert_index, get_subgraph, adjust_sent_o... | 10,576 | 35.347079 | 121 | py |
PaperRobot | PaperRobot-master/Existing paper reading/utils/data_loader.py | import torch
from torch.utils.data import Dataset, DataLoader
import numpy as np
from .utils import generate_corrupt_triples, load_triple_dict
from torch.utils import data
class LinkPredictionDataset(Dataset):
def __init__(self, kg_file, txt_file, id2ent, num_ent):
self.triples, self.triple_dict, self.tri... | 2,949 | 34.119048 | 116 | py |
PaperRobot | PaperRobot-master/Existing paper reading/utils/utils.py | import numpy as np
from sys import getsizeof
import torch
import math
import networkx as nx
import json
import pickle
import codecs
from collections import defaultdict, Counter
class KnowledgeGraph:
def __init__(self):
self.G = nx.DiGraph()
self.triples = []
def load_file(self, fn, delimiter,... | 7,972 | 27.783394 | 104 | py |
PaperRobot | PaperRobot-master/Existing paper reading/utils/__init__.py | 0 | 0 | 0 | py | |
PaperRobot | PaperRobot-master/Existing paper reading/model/TAT.py | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
class TAT(nn.Module):
"""
A Bi-LSTM layer with attention
"""
def __init__(self, embedding_dim, voc_size):
... | 1,173 | 36.870968 | 82 | py |
PaperRobot | PaperRobot-master/Existing paper reading/model/graph_attention.py | import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class GraphAttentionLayer(nn.Module):
"""
Simple GAT layer, similar to https://arxiv.org/abs/1710.10903
"""
def __init__(self, in_features, out_features, dropout, alpha, concat=True):
super(GraphAttentionLay... | 1,938 | 40.255319 | 220 | py |
PaperRobot | PaperRobot-master/Existing paper reading/model/__init__.py | 0 | 0 | 0 | py | |
PaperRobot | PaperRobot-master/Existing paper reading/model/GAT.py | import torch.nn as nn
import torch
import torch.nn.functional as F
from .graph_attention import GraphAttentionLayer
class GAT(nn.Module):
def __init__(self, nfeat, nhid, dropout, alpha, nheads):
super(GAT, self).__init__()
self.dropout = dropout
self.attentions = [GraphAttentionLayer(nfeat... | 763 | 35.380952 | 126 | py |
PaperRobot | PaperRobot-master/Existing paper reading/model/GATA.py | # --------- Link Prediction Model with both TAT and GAT contained -----------
import torch.nn as nn
import torch
from .GAT import GAT
from .TAT import TAT
class GATA(nn.Module):
def __init__(self, emb_dim, hid_dim, out_dim, num_voc, num_heads, num_ent, num_rel, dropout, alpha, **kwargs):
super(GATA, self)... | 1,737 | 41.390244 | 114 | py |
speech-resynthesis | speech-resynthesis-main/inference.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# Adapted from https://github.com/jik876/hifi-gan
import argparse
import glob
import json
import os
import random
import s... | 10,958 | 32.411585 | 121 | py |
speech-resynthesis | speech-resynthesis-main/utils.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# Adapted from https://github.com/jik876/hifi-gan
import glob
import os
import shutil
import matplotlib
import torch
from... | 2,008 | 24.1125 | 64 | py |
speech-resynthesis | speech-resynthesis-main/dataset.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# Adapted from https://github.com/jik876/hifi-gan
import random
from pathlib import Path
import amfm_decompy.basic_tools ... | 15,169 | 33.555809 | 115 | py |
speech-resynthesis | speech-resynthesis-main/train_f0_vq.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# Adapted from https://github.com/jik876/hifi-gan
import warnings
warnings.simplefilter(action='ignore', category=FutureW... | 8,872 | 39.701835 | 115 | py |
speech-resynthesis | speech-resynthesis-main/models.py | # adapted from https://github.com/jik876/hifi-gan
import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.nn import Conv1d, ConvTranspose1d, AvgPool1d, Conv2d
from torch.nn.utils import weight_norm, remove_weight_norm, spectral_norm
from modules.jukebox import Encoder, Decoder
from utils import ... | 14,478 | 36.31701 | 120 | py |
speech-resynthesis | speech-resynthesis-main/infer_vqvae_codes.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import json
import os
import random
import sys
from multiprocessing import Manager, Pool
from pathlib impor... | 3,868 | 24.123377 | 86 | py |
speech-resynthesis | speech-resynthesis-main/train.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# Adapted from https://github.com/jik876/hifi-gan
import warnings
warnings.simplefilter(action='ignore', category=FutureWa... | 15,924 | 46.966867 | 137 | py |
speech-resynthesis | speech-resynthesis-main/modules/vq.py | # Adapted from https://github.com/openai/jukebox
import numpy as np
import torch as t
import torch.nn as nn
import torch.nn.functional as F
import modules.dist as dist
class BottleneckBlock(nn.Module):
def __init__(self, k_bins, emb_width, mu):
super().__init__()
self.k_bins = k_bins
sel... | 8,566 | 33.268 | 120 | py |
speech-resynthesis | speech-resynthesis-main/modules/resnet.py | # Adapted from https://github.com/openai/jukebox
import math
import torch.nn as nn
import modules.dist as dist
class ResConvBlock(nn.Module):
def __init__(self, n_in, n_state):
super().__init__()
self.model = nn.Sequential(
nn.ReLU(),
nn.Conv2d(n_in, n_state, 3, 1, 1),
... | 2,603 | 30.373494 | 110 | py |
speech-resynthesis | speech-resynthesis-main/modules/dist.py | # Adapted from https://github.com/openai/jukebox
from enum import Enum
import torch.distributed as dist
class ReduceOp(Enum):
SUM = 0,
PRODUCT = 1,
MIN = 2,
MAX = 3
def ToDistOp(self):
return {
self.SUM: dist.ReduceOp.SUM,
self.PRODUCT: dist.ReduceOp.PRODUCT,
... | 2,013 | 17.477064 | 56 | py |
speech-resynthesis | speech-resynthesis-main/modules/__init__.py | 0 | 0 | 0 | py | |
speech-resynthesis | speech-resynthesis-main/modules/jukebox.py | # Adapted from https://github.com/openai/jukebox
import numpy as np
import torch.nn as nn
from modules.resnet import Resnet1D
def assert_shape(x, exp_shape):
assert x.shape == exp_shape, f"Expected {exp_shape} got {x.shape}"
class EncoderConvBlock(nn.Module):
def __init__(self, input_emb_width, output_emb_... | 7,855 | 42.888268 | 120 | py |
speech-resynthesis | speech-resynthesis-main/examples/__init__.py | 0 | 0 | 0 | py | |
speech-resynthesis | speech-resynthesis-main/examples/speech_to_speech_translation/inference.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# Adapted from https://github.com/jik876/hifi-gan
import argparse
import glob
import json
import os
import random
import s... | 9,266 | 31.861702 | 121 | py |
speech-resynthesis | speech-resynthesis-main/examples/speech_to_speech_translation/models.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# Adapted from https://github.com/jik876/hifi-gan
import torch
import torch.nn as nn
import torch.nn.functional as F
from... | 4,834 | 35.908397 | 96 | py |
speech-resynthesis | speech-resynthesis-main/examples/speech_to_speech_translation/__init__.py | 0 | 0 | 0 | py | |
speech-resynthesis | speech-resynthesis-main/examples/speech_to_speech_translation/train.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# Adapted from https://github.com/jik876/hifi-gan
import warnings
warnings.simplefilter(action='ignore', category=FutureWa... | 14,559 | 45.967742 | 137 | py |
speech-resynthesis | speech-resynthesis-main/scripts/parse_hubert_codes.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import random
from pathlib import Path
from tqdm import tqdm
def parse_manifest(manifest):
audio_fil... | 3,440 | 28.410256 | 70 | py |
speech-resynthesis | speech-resynthesis-main/scripts/parse_cpc_codes.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import random
from pathlib import Path
import soundfile as sf
from tqdm import tqdm
def parse_manifest(m... | 3,657 | 29.739496 | 85 | py |
speech-resynthesis | speech-resynthesis-main/scripts/__init__.py | 0 | 0 | 0 | py | |
speech-resynthesis | speech-resynthesis-main/scripts/parse_vqvae_codes.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import random
from pathlib import Path
import torchaudio
from tqdm import tqdm
def parse_manifest(manife... | 3,321 | 28.39823 | 70 | py |
speech-resynthesis | speech-resynthesis-main/scripts/preprocess.py | # Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
from functools import partial
from multiprocessing import Pool
from pathlib import Path
import numpy as np... | 1,654 | 27.534483 | 82 | py |
t-leap | t-leap-main/test.py | import os
from datetime import datetime
# scipy imports
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# Pytorch imports
import torch
import torch.nn as nn
from torch.utils.data import DataLoader
from datasets.seq_pose_dataset import SequentialPoseDataset
from torch.optim import Adam, lr_sched... | 5,451 | 34.633987 | 138 | py |
t-leap | t-leap-main/train_seq.py | # #############################################################################
# Copyright 2022 Helena Russello
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... | 11,265 | 39.235714 | 176 | py |
t-leap | t-leap-main/core/evaluate.py | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Source: https://github.com/microsoft/human-pose-estimation.pytorch/
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# Adapted by Helena Russello (helena@russello.dev)
# ---------... | 4,643 | 38.355932 | 107 | py |
t-leap | t-leap-main/core/config.py | # #############################################################################
# Copyright 2022 Helena Russello
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... | 7,639 | 35.908213 | 118 | py |
t-leap | t-leap-main/core/__init__.py | 0 | 0 | 0 | py | |
t-leap | t-leap-main/models/tleap.py | # #############################################################################
# Copyright 2022 Helena Russello
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... | 7,665 | 43.312139 | 144 | py |
t-leap | t-leap-main/models/__init__.py | 0 | 0 | 0 | py | |
t-leap | t-leap-main/datasets/seq_pose_dataset.py | # #############################################################################
# Copyright 2022 Helena Russello
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... | 23,293 | 40.155477 | 178 | py |
t-leap | t-leap-main/datasets/__init__.py | 0 | 0 | 0 | py | |
t-leap | t-leap-main/utils/data_utils.py | # #############################################################################
# Copyright 2022 Helena Russello
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... | 7,253 | 37.585106 | 171 | py |
t-leap | t-leap-main/utils/plotting_utils.py | # #############################################################################
# Copyright 2022 Helena Russello
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... | 4,876 | 38.016 | 173 | py |
t-leap | t-leap-main/utils/train_utils.py | # #############################################################################
# Copyright 2022 Helena Russello
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/l... | 2,444 | 29.949367 | 125 | py |
t-leap | t-leap-main/utils/__init__.py | 0 | 0 | 0 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.