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 |
|---|---|---|---|---|---|---|
cyphercat | cyphercat-master/cyphercat/datadefs/__init__.py | from .cyphercat_dataset import CCATDataset
from .voices_dataset import *
| 74 | 17.75 | 42 | py |
cyphercat | cyphercat-master/cyphercat/tests/test_libri_load.py | import sys
sys.path.insert(0, '../../')
import cyphercat as cc
print('Downloading')
cc.download_and_preprocess_data(cc.DATASETS_DIR)
print('Loading splits')
dfs = cc.Libri_preload_and_split()
print('Initializing dataset')
test_set = cc.LibriSpeechDataset(df=dfs[4])
print('Succesfully loaded libri-speech')
| 308 | 24.75 | 48 | py |
cyphercat | cyphercat-master/cyphercat/tests/test_VOiCES_load.py | import sys
sys.path.insert(0, '../../')
import cyphercat as cc
print('Loading splits')
dfs = cc.Voices_preload_and_split()
print('Initializing dataset')
test_set = cc.LibriSpeechDataset(df=dfs[4])
print('Succesfully loaded VOiCES')
| 233 | 22.4 | 43 | py |
cyphercat | cyphercat-master/cyphercat/tests/test_dim_reduction.py | import sys
sys.path.insert(0, '../../')
import cyphercat as cc
import torch
import torch.nn as nn
import numpy as np
class test_cnn(nn.Module):
def __init__(self, n_in=3, n_classes=10, n_filters=64, size=64):
super(test_cnn, self).__init__()
self.size = size
self.n_filte... | 2,350 | 31.205479 | 77 | py |
cyphercat | cyphercat-master/cyphercat/tests/__init__.py | 0 | 0 | 0 | py | |
cyphercat | cyphercat-master/cyphercat/utils/config_utils.py | from __future__ import print_function
import os
import sys
import yaml
from .utils import set_to_string, keys_to_string, color_mode_dict
from cyphercat.definitions import REPO_DIR
# Ensure basic, necessary fields are in the config file
def check_fields(cfg=None, tset=None):
seen = set()
for key, value in c... | 5,803 | 35.049689 | 132 | py |
cyphercat | cyphercat-master/cyphercat/utils/utils.py | from __future__ import print_function
# Dictionary printer
def print_dict(dct):
for key, value in sorted(dct.items(), reverse=True):
print("{}: {}".format(key, value))
# Set string printer
def set_to_string(iset=None):
sstr = ', '.join([str(i) for i in iset])
return sstr
# Dictionary string ke... | 565 | 20.769231 | 56 | py |
cyphercat | cyphercat-master/cyphercat/utils/file_utils.py | import os
import sys
import shutil
import requests
import zipfile
import tarfile
def downloader(save_dir='', url=''):
"""
Function to download file from
url to specified destination file.
If file already exists, or the url
is a path to a valid local file,
then simply returns path to local file... | 2,507 | 27.179775 | 102 | py |
cyphercat | cyphercat-master/cyphercat/utils/__init__.py | # __init__.py
from .utils import *
from .svc_utils import *
from .file_utils import *
from .config_utils import *
| 115 | 15.571429 | 27 | py |
cyphercat | cyphercat-master/cyphercat/utils/visualize_utils.py | #!/usr/bin/python3
"""
Set of functions used to call a series of algorithms used to visualize the object localization of a pre-trained
network in PyTorch. The different algorithms are discussed in several papers, while the implementation is based,
roughly, on work in the following repository (https://github.com/sar-... | 8,630 | 31.085502 | 117 | py |
cyphercat | cyphercat-master/cyphercat/utils/svc_utils.py | from __future__ import print_function
import os
import numpy as np
import torch
import torchvision
from sklearn import svm
from sklearn.decomposition import PCA
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import MinMaxScaler
from sklearn.externals import joblib
def load(dataloader):
"... | 3,817 | 29.790323 | 118 | py |
3DDFA | 3DDFA-master/main.py | #!/usr/bin/env python3
# coding: utf-8
__author__ = 'cleardusk'
"""
The pipeline of 3DDFA prediction: given one image, predict the 3d face vertices, 68 landmarks and visualization.
[todo]
1. CPU optimization: https://pmchojnacki.wordpress.com/2018/10/07/slow-pytorch-cpu-performance
"""
import torch
import torchvisi... | 9,511 | 45.174757 | 121 | py |
3DDFA | 3DDFA-master/video_demo.py | #!/usr/bin/env python3
# coding: utf-8
import torch
import torchvision.transforms as transforms
import mobilenet_v1
import numpy as np
import cv2
import dlib
from utils.ddfa import ToTensorGjz, NormalizeGjz
import scipy.io as sio
from utils.inference import (
parse_roi_box_from_landmark,
crop_img,
predict_6... | 3,552 | 31.3 | 88 | py |
3DDFA | 3DDFA-master/benchmark.py | #!/usr/bin/env python3
# coding: utf-8
import torch
import torch.nn as nn
import torch.utils.data as data
import torchvision.transforms as transforms
import torch.backends.cudnn as cudnn
import mobilenet_v1
import time
import numpy as np
from benchmark_aflw2000 import calc_nme as calc_nme_alfw2000
from benchmark_aflw... | 3,554 | 28.87395 | 111 | py |
3DDFA | 3DDFA-master/benchmark_aflw.py | #!/usr/bin/env python3
# coding: utf-8
import os.path as osp
import numpy as np
from math import sqrt
from utils.io import _load
d = 'test.configs'
yaw_list = _load(osp.join(d, 'AFLW_GT_crop_yaws.npy'))
roi_boxs = _load(osp.join(d, 'AFLW_GT_crop_roi_box.npy'))
pts68_all = _load(osp.join(d, 'AFLW_GT_pts68.npy'))
pts21... | 3,341 | 30.828571 | 103 | py |
3DDFA | 3DDFA-master/speed_cpu.py | #!/usr/bin/env python3
# coding: utf-8
import timeit
import numpy as np
SETUP_CODE = '''
import mobilenet_v1
import torch
model = mobilenet_v1.mobilenet_1()
model.eval()
data = torch.rand(1, 3, 120, 120)
'''
TEST_CODE = '''
with torch.no_grad():
model(data)
'''
def main():
repeat, number = 5, 100
res ... | 693 | 18.277778 | 78 | py |
3DDFA | 3DDFA-master/wpdc_loss.py | #!/usr/bin/env python3
# coding: utf-8
import torch
import torch.nn as nn
from math import sqrt
from utils.io import _numpy_to_cuda
from utils.params import *
_to_tensor = _numpy_to_cuda # gpu
def _parse_param_batch(param):
"""Work for both numpy and tensor"""
N = param.shape[0]
p_ = param[:, :12].view... | 4,540 | 33.664122 | 108 | py |
3DDFA | 3DDFA-master/vdc_loss.py | #!/usr/bin/env python3
# coding: utf-8
import torch
import torch.nn as nn
from utils.io import _load, _numpy_to_cuda, _numpy_to_tensor
from utils.params import *
_to_tensor = _numpy_to_cuda # gpu
def _parse_param_batch(param):
"""Work for both numpy and tensor"""
N = param.shape[0]
p_ = param[:, :12].v... | 3,606 | 34.362745 | 104 | py |
3DDFA | 3DDFA-master/benchmark_aflw2000.py | #!/usr/bin/env python3
# coding: utf-8
"""
Notation (2019.09.15): two versions of spliting AFLW2000-3D:
1) AFLW2000-3D.pose.npy: according to the fitted pose
2) AFLW2000-3D-new.pose: according to AFLW labels
There is no obvious difference between these two splits.
"""
import os.path as osp
import numpy as np
from ... | 3,402 | 27.596639 | 97 | py |
3DDFA | 3DDFA-master/train.py | #!/usr/bin/env python3
# coding: utf-8
import os.path as osp
from pathlib import Path
import numpy as np
import argparse
import time
import logging
import torch
import torch.nn as nn
import torchvision.transforms as transforms
from torch.utils.data import DataLoader
import mobilenet_v1
import torch.backends.cudnn as ... | 9,938 | 34.244681 | 105 | py |
3DDFA | 3DDFA-master/visualize.py | #!/usr/bin/env python3
# coding: utf-8
from benchmark import extract_param
from utils.ddfa import reconstruct_vertex
from utils.io import _dump, _load
import os.path as osp
from skimage import io
import matplotlib.pyplot as plt
from benchmark_aflw2000 import convert_to_ori
import scipy.io as sio
def aflw2000():
... | 3,510 | 27.544715 | 118 | py |
3DDFA | 3DDFA-master/mobilenet_v1.py | #!/usr/bin/env python3
# coding: utf-8
from __future__ import division
"""
Creates a MobileNet Model as defined in:
Andrew G. Howard Menglong Zhu Bo Chen, et.al. (2017).
MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications.
Copyright (c) Yang Lu, 2017
Modified By cleardusk
"""
import... | 5,224 | 32.709677 | 110 | py |
3DDFA | 3DDFA-master/training/train.py | ../train.py | 11 | 11 | 11 | py |
3DDFA | 3DDFA-master/c++/convert_to_onnx.py | #!/usr/bin/env python3
# coding: utf-8
import torch
import mobilenet_v1
def main():
# checkpoint_fp = 'weights/phase1_wpdc_vdc.pth.tar'
checkpoint_fp = 'weights/mb_1.p'
arch = 'mobilenet_1'
checkpoint = torch.load(checkpoint_fp, map_location=lambda storage, loc: storage)['state_dict']
model = get... | 1,135 | 32.411765 | 100 | py |
3DDFA | 3DDFA-master/c++/mobilenet_v1.py | #!/usr/bin/env python3
# coding: utf-8
from __future__ import division
"""
Creates a MobileNet Model as defined in:
Andrew G. Howard Menglong Zhu Bo Chen, et.al. (2017).
MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications.
Copyright (c) Yang Lu, 2017
Modified By cleardusk
"""
import... | 5,224 | 32.709677 | 110 | py |
3DDFA | 3DDFA-master/demo@obama/rendering_demo.py | #!/usr/bin/env python3
# coding: utf-8
"""
A demo for rendering mesh generated by `main.py`
"""
from rendering import cfg, _to_ctype, RenderPipeline
import scipy.io as sio
import imageio
import numpy as np
import matplotlib.pyplot as plt
def test():
# 1. first, using main.py to generate dense vertices, like emm... | 974 | 23.375 | 79 | py |
3DDFA | 3DDFA-master/demo@obama/convert_imgs_to_video.py | #!/usr/bin/env python3
# coding: utf-8
import os
import os.path as osp
import sys
from glob import glob
import imageio
def main():
assert len(sys.argv) >= 2
d = sys.argv[1]
fps = glob(osp.join(d, '*.jpg'))
fps = sorted(fps, key=lambda x: int(x.split('/')[-1].replace('.jpg', '')))
imgs = []
... | 634 | 19.483871 | 87 | py |
3DDFA | 3DDFA-master/demo@obama/rendering.py | #!/usr/bin/env python3
# coding: utf-8
import sys
sys.path.append('../')
import os
import os.path as osp
from glob import glob
from utils.lighting import RenderPipeline
import numpy as np
import scipy.io as sio
import imageio
cfg = {
'intensity_ambient': 0.3,
'color_ambient': (1, 1, 1),
'intensity_direc... | 1,420 | 23.084746 | 83 | py |
3DDFA | 3DDFA-master/utils/inference.py | #!/usr/bin/env python3
# coding: utf-8
__author__ = 'cleardusk'
import numpy as np
from math import sqrt
import scipy.io as sio
import matplotlib.pyplot as plt
from .ddfa import reconstruct_vertex
def get_suffix(filename):
"""a.jpg -> jpg"""
pos = filename.rfind('.')
if pos == -1:
return ''
r... | 6,805 | 28.463203 | 120 | py |
3DDFA | 3DDFA-master/utils/render.py | #!/usr/bin/env python3
# coding: utf-8
"""
Modified from https://raw.githubusercontent.com/YadiraF/PRNet/master/utils/render.py
"""
__author__ = 'cleardusk'
import numpy as np
from .cython import mesh_core_cython
from .params import pncc_code
def is_point_in_tri(point, tri_points):
''' Judge whether the point... | 6,290 | 27.084821 | 141 | py |
3DDFA | 3DDFA-master/utils/cv_plot.py | #!/usr/bin/env python3
# coding: utf-8
"""
Modified from: https://sourcegraph.com/github.com/YadiraF/PRNet@master/-/blob/utils/cv_plot.py
"""
import numpy as np
import cv2
from utils.inference import calc_hypotenuse
end_list = np.array([17, 22, 27, 42, 48, 31, 36, 68], dtype=np.int32) - 1
def plot_kpt(image, kpt... | 3,134 | 30.35 | 129 | py |
3DDFA | 3DDFA-master/utils/lighting.py | #!/usr/bin/env python3
# coding: utf-8
import sys
sys.path.append('../')
import numpy as np
from utils import render
from utils.cython import mesh_core_cython
_norm = lambda arr: arr / np.sqrt(np.sum(arr ** 2, axis=1))[:, None]
def norm_vertices(vertices):
vertices -= vertices.min(0)[None, :]
vertices /= v... | 3,753 | 36.54 | 103 | py |
3DDFA | 3DDFA-master/utils/paf.py | #!/usr/bin/env python3
# coding: utf-8
import numpy as np
from .ddfa import _parse_param
from .params import u_filter, w_filter, w_exp_filter, std_size, param_mean, param_std
def reconstruct_paf_anchor(param, whitening=True):
if whitening:
param = param * param_std + param_mean
p, offset, alpha_shp, ... | 1,816 | 28.306452 | 112 | py |
3DDFA | 3DDFA-master/utils/__init__.py | 0 | 0 | 0 | py | |
3DDFA | 3DDFA-master/utils/params.py | #!/usr/bin/env python3
# coding: utf-8
import os.path as osp
import numpy as np
from .io import _load
def make_abs_path(d):
return osp.join(osp.dirname(osp.realpath(__file__)), d)
d = make_abs_path('../train.configs')
keypoints = _load(osp.join(d, 'keypoints_sim.npy'))
w_shp = _load(osp.join(d, 'w_shp_sim.npy'... | 1,194 | 26.159091 | 65 | py |
3DDFA | 3DDFA-master/utils/io.py | #!/usr/bin/env python3
# coding: utf-8
import os
import numpy as np
import torch
import pickle
import scipy.io as sio
def mkdir(d):
"""only works on *nix system"""
if not os.path.isdir(d) and not os.path.exists(d):
os.system('mkdir -p {}'.format(d))
def _get_suffix(filename):
"""a.jpg -> jpg"""... | 3,012 | 24.974138 | 97 | py |
3DDFA | 3DDFA-master/utils/estimate_pose.py | #!/usr/bin/env python3
# coding: utf-8
"""
Reference: https://github.com/YadiraF/PRNet/blob/master/utils/estimate_pose.py
"""
from math import cos, sin, atan2, asin, sqrt
import numpy as np
from .params import param_mean, param_std
def parse_pose(param):
param = param * param_std + param_mean
Ps = param[:12... | 1,870 | 22.3875 | 114 | py |
3DDFA | 3DDFA-master/utils/ddfa.py | #!/usr/bin/env python3
# coding: utf-8
import os.path as osp
from pathlib import Path
import numpy as np
import torch
import torch.utils.data as data
import cv2
import pickle
import argparse
from .io import _numpy_to_tensor, _load_cpu, _load_gpu
from .params import *
def _parse_param(param):
"""Work for both nu... | 4,316 | 26.673077 | 118 | py |
3DDFA | 3DDFA-master/utils/cython/setup.py | '''
python setup.py build_ext -i
to compile
'''
# setup.py
from distutils.core import setup, Extension
# from Cython.Build import cythonize
from Cython.Distutils import build_ext
import numpy
setup(
name='mesh_core_cython',
cmdclass={'build_ext': build_ext},
ext_modules=[Extension("mesh_core_cython",
... | 504 | 24.25 | 77 | py |
3DDFA | 3DDFA-master/utils/cython/__init__.py | 0 | 0 | 0 | py | |
BioFLAIR | BioFLAIR-master/fine_tune.py | from flair.data import Corpus
from flair.datasets import ColumnCorpus
columns = {0: 'text', 1: 'pos', 3: 'ner'}
# this is the folder in which train, test and dev files reside
data_folder = 'data/ner/bc5dr'
# init a corpus using column format, data folder and the names of the train, dev and test files
corpus: Corpus ... | 1,590 | 36 | 118 | py |
BioFLAIR | BioFLAIR-master/pre_train.py | from flair.data import Dictionary
from flair.models import LanguageModel
from flair.trainers.language_model_trainer import LanguageModelTrainer, TextCorpus
from flair.embeddings import FlairEmbeddings
dictionary: Dictionary = Dictionary.load('chars')
#dictionary: Dictionary = language_model.dictionary
language_model = ... | 783 | 33.086957 | 82 | py |
Squeezeformer | Squeezeformer-main/setup.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 2,026 | 43.065217 | 115 | py |
Squeezeformer | Squeezeformer-main/examples/squeezeformer/test.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 8,644 | 37.59375 | 117 | py |
Squeezeformer | Squeezeformer-main/src/__init__.py | 0 | 0 | 0 | py | |
Squeezeformer | Squeezeformer-main/src/models/base_model.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 6,880 | 35.026178 | 111 | py |
Squeezeformer | Squeezeformer-main/src/models/conformer_encoder.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 23,551 | 39.191126 | 124 | py |
Squeezeformer | Squeezeformer-main/src/models/ctc.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 5,608 | 41.172932 | 113 | py |
Squeezeformer | Squeezeformer-main/src/models/conformer.py | import tensorflow as tf
from tensorflow.python.keras.utils import losses_utils
from tensorflow.python.framework import ops
from tensorflow.python.eager import def_function
from .ctc import CtcModel
from .conformer_encoder import ConformerEncoder
from ..augmentations.augmentation import SpecAugmentation
from ..utils im... | 9,029 | 39.493274 | 160 | py |
Squeezeformer | Squeezeformer-main/src/models/__init__.py | 0 | 0 | 0 | py | |
Squeezeformer | Squeezeformer-main/src/models/submodules/multihead_attention.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 10,251 | 37.397004 | 116 | py |
Squeezeformer | Squeezeformer-main/src/models/submodules/time_reduction.py | import tensorflow as tf
from ...utils import shape_util
class TimeReductionLayer(tf.keras.layers.Layer):
def __init__(
self,
input_dim,
output_dim,
kernel_size=5,
stride=2,
dropout=0.0,
name="time_reduction",
**kwargs,
):
super(TimeReducti... | 2,287 | 42.169811 | 101 | py |
Squeezeformer | Squeezeformer-main/src/models/submodules/subsampling.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 4,228 | 43.989362 | 108 | py |
Squeezeformer | Squeezeformer-main/src/models/submodules/glu.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 1,132 | 31.371429 | 74 | py |
Squeezeformer | Squeezeformer-main/src/models/submodules/positional_encoding.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 1,965 | 38.32 | 104 | py |
Squeezeformer | Squeezeformer-main/src/models/submodules/__init__.py | 0 | 0 | 0 | py | |
Squeezeformer | Squeezeformer-main/src/datasets/asr_dataset.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 9,392 | 37.338776 | 125 | py |
Squeezeformer | Squeezeformer-main/src/datasets/__init__.py | 0 | 0 | 0 | py | |
Squeezeformer | Squeezeformer-main/src/augmentations/augmentation.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 3,294 | 38.698795 | 109 | py |
Squeezeformer | Squeezeformer-main/src/augmentations/__init__.py | 0 | 0 | 0 | py | |
Squeezeformer | Squeezeformer-main/src/configs/config.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 2,796 | 43.396825 | 106 | py |
Squeezeformer | Squeezeformer-main/src/configs/__init__.py | 0 | 0 | 0 | py | |
Squeezeformer | Squeezeformer-main/src/featurizers/speech_featurizers.py | # Copyright 2020 Huy Le Nguyen (@usimarit) and Huy Phan (@pquochuy)
#
# 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 a... | 9,943 | 36.104478 | 122 | py |
Squeezeformer | Squeezeformer-main/src/featurizers/text_featurizers.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 6,995 | 34.51269 | 91 | py |
Squeezeformer | Squeezeformer-main/src/featurizers/__init__.py | 0 | 0 | 0 | py | |
Squeezeformer | Squeezeformer-main/src/utils/file_util.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 3,440 | 33.41 | 110 | py |
Squeezeformer | Squeezeformer-main/src/utils/layer_util.py |
# Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 ... | 1,002 | 32.433333 | 74 | py |
Squeezeformer | Squeezeformer-main/src/utils/shape_util.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 1,129 | 33.242424 | 78 | py |
Squeezeformer | Squeezeformer-main/src/utils/math_util.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 4,208 | 33.785124 | 123 | py |
Squeezeformer | Squeezeformer-main/src/utils/data_util.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 1,437 | 28.346939 | 74 | py |
Squeezeformer | Squeezeformer-main/src/utils/training_utils.py | import tensorflow as tf
from tensorflow.python.keras import backend
from tensorflow.python.framework import sparse_tensor
from tensorflow.python.framework import ops
from tensorflow.python.eager import context
from tensorflow.python.util import nest
from tensorflow.python.ops import variables
from tensorflow.python.op... | 3,574 | 37.44086 | 97 | py |
Squeezeformer | Squeezeformer-main/src/utils/metric_util.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 3,240 | 34.615385 | 96 | py |
Squeezeformer | Squeezeformer-main/src/utils/feature_util.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 979 | 34 | 85 | py |
Squeezeformer | Squeezeformer-main/src/utils/app_util.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 2,138 | 43.5625 | 85 | py |
Squeezeformer | Squeezeformer-main/src/utils/__init__.py | 0 | 0 | 0 | py | |
Squeezeformer | Squeezeformer-main/src/utils/env_util.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 2,814 | 32.915663 | 105 | py |
Squeezeformer | Squeezeformer-main/src/utils/logging_util.py | import wandb
import tensorflow as tf
import numpy as np
from numpy import linalg as la
from . import env_util
logger = env_util.setup_environment()
class StepLossMetric(tf.keras.metrics.Metric):
def __init__(self, name='step_loss', **kwargs):
super(StepLossMetric, self).__init__(name=name, **kwargs)
... | 1,090 | 24.97619 | 79 | py |
Squeezeformer | Squeezeformer-main/src/losses/ctc_loss.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 1,560 | 34.477273 | 90 | py |
Squeezeformer | Squeezeformer-main/src/losses/__init__.py | 0 | 0 | 0 | py | |
Squeezeformer | Squeezeformer-main/scripts/create_librispeech_trans.py | # Copyright 2020 Huy Le Nguyen (@usimarit)
#
# 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 t... | 1,982 | 33.789474 | 98 | py |
Squeezeformer | Squeezeformer-main/scripts/create_librispeech_trans_all.py | import os
import csv
import subprocess
import argparse
def arg_parse():
parser = argparse.ArgumentParser()
parser.add_argument('--mode', type=str, default='all', choices=['all', 'test-only'])
parser.add_argument('--dataset_dir', type=str, required=True)
parser.add_argument('--output_dir', type=str, req... | 1,978 | 30.919355 | 92 | py |
asari | asari-master/asari/api.py | import pathlib
import onnxruntime as rt
from asari.preprocess import tokenize
class Sonar:
def __init__(self):
pipeline_file = pathlib.Path(__file__).parent / "data" / "pipeline.onnx"
self.sess = rt.InferenceSession(str(pipeline_file))
self.input_name = self.sess.get_inputs()[0].name
... | 812 | 30.269231 | 112 | py |
asari | asari-master/asari/__init__.py | 0 | 0 | 0 | py | |
asari | asari-master/asari/train.py | """
Train a baseline model.
"""
import argparse
import json
import pathlib
import numpy as np
from skl2onnx import to_onnx
from sklearn.calibration import CalibratedClassifierCV
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics import classification_report
from sklearn.model_selection im... | 2,340 | 29.402597 | 104 | py |
asari | asari-master/asari/preprocess.py | from janome.tokenizer import Tokenizer
t = Tokenizer(wakati=True)
def tokenize(text: str) -> str:
return " ".join(t.tokenize(text))
| 139 | 16.5 | 38 | py |
asari | asari-master/tests/test_api.py | import unittest
from pprint import pprint
from asari.api import Sonar
class TestAPI(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.text = "広告多すぎる♡"
def test_ping(self):
sonar = Sonar()
res = sonar.ping(self.text)
pprint(res)
self.assertIn("text", res)
... | 783 | 28.037037 | 57 | py |
asari | asari-master/tests/__init__.py | 0 | 0 | 0 | py | |
pyjsd | pyjsd-main/distributions.py | # -*- coding: utf-8 -*-
import numpy as __np
import scipy.stats as __stats
# distributions for use in JSD function as the theoretical (assumed) distributions
norm={
"cdf": lambda params,x: __stats.norm.cdf(x,loc=params[0],scale=params[1]),
"likelihood": lambda params,data: -__np.sum(__stats.norm.logpdf(data,l... | 1,867 | 38.744681 | 123 | py |
pyjsd | pyjsd-main/jsd.py | # -*- coding: utf-8 -*-
import numpy as __np
from scipy.optimize import minimize as __minimize
# Estimation of the empirical cdf
def __EmpiricalCDF(bins,data):
empiricalHistogram=__np.histogram(data,bins=bins)[0]
empiricalCH=__np.cumsum(empiricalHistogram)
return empiricalCH/empiricalCH[-1]
# Maximum lik... | 2,989 | 39.958904 | 86 | py |
pyjsd | pyjsd-main/__init__.py | # -*- coding: utf-8 -*-
from .jsd import JSD
__all__=["JSD"]
| 63 | 9.666667 | 23 | py |
ReBATE | ReBATE-master/setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
def calculate_version():
initpy = open('rebate/_version.py').read().split('\n')
version = list(filter(lambda x: '__version__' in x, initpy))[0].split('\'')[1]
return version
package_version = calculate_version()
set... | 1,792 | 36.354167 | 145 | py |
ReBATE | ReBATE-master/rebate/setup_surf.py | """
Copyright (c) 2016 Peter R. Schmitt and Ryan J. Urbanowicz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, me... | 1,323 | 40.375 | 74 | py |
ReBATE | ReBATE-master/rebate/Common.py | """
Copyright (c) 2016 Peter R. Schmitt and Ryan J. Urbanowicz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, me... | 6,508 | 34.375 | 79 | py |
ReBATE | ReBATE-master/rebate/mmDistance.py | # Wed Aug 24 14:51:56 EDT 2016
"""
Copyright (c) 2016 Peter R. Schmitt and Ryan J. Urbanowicz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the ... | 3,628 | 31.401786 | 79 | py |
ReBATE | ReBATE-master/rebate/_version.py | # -*- coding: utf-8 -*-
"""
scikit-rebate was primarily developed at the University of Pennsylvania by:
- Randal S. Olson (rso@randalolson.com)
- Pete Schmitt (pschmitt@upenn.edu)
- Ryan J. Urbanowicz (ryanurb@upenn.edu)
- Weixuan Fu (weixuanf@upenn.edu)
- and many more generous open source contrib... | 1,375 | 48.142857 | 103 | py |
ReBATE | ReBATE-master/rebate/IO.py | # Thu Jul 22 14:41 EDT 2016
"""
Copyright (c) 2016 Peter R. Schmitt and Ryan J. Urbanowicz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rig... | 13,846 | 35.729443 | 111 | py |
ReBATE | ReBATE-master/rebate/Turf.py | # Tue Aug 16 13:26:42 EDT 2016
"""
Copyright (c) 2016 Peter R. Schmitt and Ryan J. Urbanowicz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the ... | 5,880 | 39.840278 | 124 | py |
ReBATE | ReBATE-master/rebate/setup_relieff.py | """
Copyright (c) 2016 Peter R. Schmitt and Ryan J. Urbanowicz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, me... | 1,410 | 41.757576 | 74 | py |
ReBATE | ReBATE-master/rebate/rebate.py | #!/usr/bin/env python
# REBATE CLI
# Thu Apr 6 13:15:38 CDT 2017
"""
Copyright (c) 2016 Peter R. Schmitt and Ryan J. Urbanowicz
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restrictio... | 7,824 | 40.184211 | 172 | py |
ReBATE | ReBATE-master/rebate/__init__.py | # -*- coding: utf-8 -*-
"""
scikit-rebate was primarily developed at the University of Pennsylvania by:
- Randal S. Olson (rso@randalolson.com)
- Pete Schmitt (pschmitt@upenn.edu)
- Ryan J. Urbanowicz (ryanurb@upenn.edu)
- Weixuan Fu (weixuanf@upenn.edu)
- and many more generous open source contrib... | 1,355 | 49.222222 | 103 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.