repo stringlengths 1 99 | file stringlengths 13 215 | code stringlengths 12 59.2M | file_length int64 12 59.2M | avg_line_length float64 3.82 1.48M | max_line_length int64 12 2.51M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
PyCALI | PyCALI-master/docs/conf.py | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | 2,605 | 31.575 | 79 | py |
sign2text | sign2text-master/model.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from keras.applications.vgg16 import VGG16
from keras.applications.resnet50 import ResNet50
from keras.applications.inception_v3 import InceptionV3
from keras.applications.xception import Xception
from keras.applications.mobilenet import MobileNet
from keras.layers import... | 3,770 | 36.336634 | 109 | py |
sign2text | sign2text-master/feature_extraction.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
FEATURE EXTRACTION
This script extracts features from the final (non-classification) layers of
the pre-trained deep neural network models included in Keras.
"""
from keras.applications.vgg16 import VGG16
from keras.applications.resnet50 import ResNet50
from keras.appl... | 5,035 | 34.464789 | 106 | py |
sign2text | sign2text-master/experiments/frames2word.py | from keras.preprocessing.image import ImageDataGenerator
from keras.models import Sequential
from keras.layers.core import Dense, Dropout, Activation, Flatten
from keras.layers.convolutional import Convolution3D, MaxPooling3D
from keras.optimizers import SGD, RMSprop
from keras.utils import np_utils, generic_utils
im... | 5,822 | 25.468182 | 116 | py |
sign2text | sign2text-master/training_scripts/cnn_scratch.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from keras.layers import Flatten, Dense, Dropout, Convolution2D, Activation, MaxPooling2D
from keras.models import Sequential
from keras.callbacks import ModelCheckpoint, Callback
from keras.preprocessing.image import ImageDataGenerator
from keras.optimizers import Adadelt... | 5,918 | 31.701657 | 141 | py |
sign2text | sign2text-master/training_scripts/new_classifier.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
TRANSFER LEARNING
This script loads pre-trained deep neural network models included in Keras with a custom classification block,
and trains the new model.
"""
from keras.applications.vgg16 import VGG16
from keras.applications.resnet50 import ResNet50
from keras.appl... | 6,762 | 30.165899 | 111 | py |
BBO-via-PGF | BBO-via-PGF-main/BO_Ackley.py | import os
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS']='1'
os.environ['OPENBLAS_NUM_THREADS']='1'
os.environ["NUM_INTER_THREADS"]="1"
os.environ["NUM_INTRA_THREADS"]="1"
os.environ["XLA_FLAGS"] = ("--xla_cpu_multi_thread_eigen=false "
"intra_op_parallelism_threads=1")
... | 2,804 | 25.214953 | 419 | py |
BBO-via-PGF | BBO-via-PGF-main/BO_Griewank5.py | import os
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS']='1'
os.environ['OPENBLAS_NUM_THREADS']='1'
os.environ["NUM_INTER_THREADS"]="1"
os.environ["NUM_INTRA_THREADS"]="1"
os.environ["XLA_FLAGS"] = ("--xla_cpu_multi_thread_eigen=false "
"intra_op_parallelism_threads=1")
... | 2,956 | 26.12844 | 401 | py |
BBO-via-PGF | BBO-via-PGF-main/BO_via_PGF.py | from __future__ import division
import itertools
import numpy
import jax.numpy as np
from jax.numpy.linalg import cholesky, solve, svd
import numpy as onp
import jax
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
from jax import random
from sk... | 29,323 | 37.73712 | 317 | py |
BBO-via-PGF | BBO-via-PGF-main/BO_Ackley5.py | import os
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS']='1'
os.environ['OPENBLAS_NUM_THREADS']='1'
os.environ["NUM_INTER_THREADS"]="1"
os.environ["NUM_INTRA_THREADS"]="1"
os.environ["XLA_FLAGS"] = ("--xla_cpu_multi_thread_eigen=false "
"intra_op_parallelism_threads=1")
... | 2,977 | 23.409836 | 420 | py |
BBO-via-PGF | BBO-via-PGF-main/BO_Griewank.py | import os
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS']='1'
os.environ['OPENBLAS_NUM_THREADS']='1'
os.environ["NUM_INTER_THREADS"]="1"
os.environ["NUM_INTRA_THREADS"]="1"
os.environ["XLA_FLAGS"] = ("--xla_cpu_multi_thread_eigen=false "
"intra_op_parallelism_threads=1")
... | 2,934 | 24.521739 | 393 | py |
BBO-via-PGF | BBO-via-PGF-main/BO_LL.py | import os
#this runs only with jax = 0.2.10 and jaxlib 0.1.64
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS']='1'
os.environ['OPENBLAS_NUM_THREADS']='1'
os.environ["NUM_INTER_THREADS"]="1"
os.environ["NUM_INTRA_THREADS"]="1"
os.environ["XLA_FLAGS"] = ("--xla_cpu_multi_thread_eigen=false "
... | 10,715 | 27.424403 | 408 | py |
tune-sklearn | tune-sklearn-master/tune_sklearn/utils.py | import warnings
from collections import defaultdict
from typing import Dict, List
from ray.tune import Callback
from sklearn.metrics import check_scoring
from sklearn.pipeline import Pipeline
from tune_sklearn._detect_booster import (
is_xgboost_model, is_lightgbm_model_of_required_version, is_catboost_model)
impo... | 12,616 | 39.831715 | 79 | py |
tune-sklearn | tune-sklearn-master/tune_sklearn/_detect_booster.py | def has_xgboost():
try:
import xgboost # noqa: F401
return True
except ImportError:
return False
def is_xgboost_model(clf):
if not has_xgboost():
return False
from xgboost.sklearn import XGBModel # noqa: F401
return isinstance(clf, XGBModel)
def has_lightgbm():
... | 1,409 | 21.380952 | 67 | py |
tune-sklearn | tune-sklearn-master/tune_sklearn/tune_basesearch.py | """Parent class for a cross-validation interface
built with a Ray Tune back-end.
Implementation derived from referencing the equivalent
GridSearchCV interfaces from Dask and Optuna.
https://ray.readthedocs.io/en/latest/tune.html
https://dask.org
https://optuna.org
-- Anthony Yu and Michael Chau
"""
import logging... | 36,019 | 38.625963 | 79 | py |
tune-sklearn | tune-sklearn-master/examples/keras_example.py | """
An example training a Keras model, performing
grid search using TuneGridSearchCV.
"""
from keras.datasets import mnist
from keras.layers import Dense, Activation, Dropout
from keras.models import Sequential
from keras.utils import np_utils
from keras.wrappers.scikit_learn import KerasClassifier
from tune_sklearn i... | 1,821 | 30.964912 | 78 | py |
tune-sklearn | tune-sklearn-master/examples/xgbclassifier.py | """
An example training a XGBClassifier, performing
randomized search using TuneSearchCV.
"""
from tune_sklearn import TuneSearchCV
from sklearn import datasets
from sklearn.model_selection import train_test_split
from xgboost import XGBClassifier
digits = datasets.load_digits()
x = digits.data
y = digits.target
x_tr... | 1,148 | 23.978261 | 71 | py |
tune-sklearn | tune-sklearn-master/examples/torch_nn.py | """
An example training a PyTorch NeuralNetClassifier, performing
grid search using TuneGridSearchCV.
The NeuralNetClassifier is derived from a scikit-learn compatible
neural network library that wraps PyTorch. See more at
https://skorch.readthedocs.io/en/stable/index.html
"""
import numpy as np
from sklearn.datasets ... | 1,453 | 25.925926 | 70 | py |
tune-sklearn | tune-sklearn-master/examples/lgbm.py | """Example using LightGBM, performing randomized search with TuneSearchCV.
Example taken from https://mlfromscratch.com/gridsearch-keras-sklearn/#/
"""
import lightgbm as lgb
from tune_sklearn import TuneSearchCV
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split
# L... | 1,133 | 26 | 74 | py |
tune-sklearn | tune-sklearn-master/tests/test_trainable.py | import unittest
import ray
from ray import tune
from tune_sklearn._trainable import _Trainable
from tune_sklearn._detect_booster import (
has_xgboost, has_required_lightgbm_version, has_catboost)
from sklearn.datasets import make_classification
from sklearn.linear_model import LogisticRegression, SGDClassifier
fro... | 7,609 | 35.941748 | 78 | py |
tune-sklearn | tune-sklearn-master/tests/test_randomizedsearch.py | import time
import numpy as np
from numpy.testing import assert_array_equal
from sklearn.datasets import make_classification, make_regression
from sklearn.decomposition import PCA
from scipy.stats import expon
from sklearn.svm import SVC, LinearSVC
from sklearn.linear_model import LogisticRegression
from sklearn.linea... | 34,108 | 33.911975 | 79 | py |
gpt-neox | gpt-neox-main/tools/convert_sequential_to_hf.py | # Copyright (c) 2023, EleutherAI
#
# 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 writi... | 12,758 | 33.114973 | 137 | py |
gpt-neox | gpt-neox-main/tools/inspect_checkpoints.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 12,066 | 34.91369 | 175 | py |
gpt-neox | gpt-neox-main/tools/preprocess_data_with_mask.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 12,433 | 31.549738 | 197 | py |
gpt-neox | gpt-neox-main/tools/convert_module_to_hf.py | # Copyright (c) 2023, EleutherAI
#
# 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 writi... | 11,681 | 33.871642 | 133 | py |
gpt-neox | gpt-neox-main/tools/convert_raw_llama_weights_to_neox.py | # Copyright (c) 2023, EleutherAI
#
# 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 writi... | 21,319 | 32.522013 | 95 | py |
gpt-neox | gpt-neox-main/tools/merge20b.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 9,451 | 32.399293 | 94 | py |
gpt-neox | gpt-neox-main/tools/preprocess_data.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 7,639 | 30.183673 | 137 | py |
gpt-neox | gpt-neox-main/tools/merge_mp_partitions.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 10,291 | 34.006803 | 106 | py |
gpt-neox | gpt-neox-main/tools/convert_hf_to_sequential.py | import sys
import os
import copy
import deepspeed
# import time
import argparse
import torch
import numpy as np
from functools import reduce
from transformers import GPTNeoXForCausalLM, GPTNeoXConfig
sys.path.append(
os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir))
)
from megatron.neox_a... | 21,981 | 37.296167 | 170 | py |
gpt-neox | gpt-neox-main/tests/common.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 12,476 | 33.94958 | 146 | py |
gpt-neox | gpt-neox-main/tests/model/test_model_checkpoint.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 3,969 | 27.561151 | 157 | py |
gpt-neox | gpt-neox-main/tests/model/test_model_train.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 5,917 | 30.312169 | 157 | py |
gpt-neox | gpt-neox-main/tests/model/test_fused_kernels.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 7,800 | 30.711382 | 86 | py |
gpt-neox | gpt-neox-main/tests/model/test_model_instantiation.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 3,583 | 29.117647 | 88 | py |
gpt-neox | gpt-neox-main/eval_tasks/eval_adapter.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 17,581 | 36.648822 | 145 | py |
gpt-neox | gpt-neox-main/megatron/optimizers.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 15,437 | 36.110577 | 120 | py |
gpt-neox | gpt-neox-main/megatron/initialize.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 8,511 | 35.376068 | 106 | py |
gpt-neox | gpt-neox-main/megatron/logging.py | # Copyright (c) 2021, EleutherAI.
#
# 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 writ... | 12,881 | 33.260638 | 114 | py |
gpt-neox | gpt-neox-main/megatron/text_generation_utils.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 34,185 | 41.204938 | 259 | py |
gpt-neox | gpt-neox-main/megatron/training.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 34,804 | 33.83984 | 178 | py |
gpt-neox | gpt-neox-main/megatron/utils.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 14,954 | 29.89876 | 137 | py |
gpt-neox | gpt-neox-main/megatron/__init__.py | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# 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 appli... | 973 | 33.785714 | 74 | py |
gpt-neox | gpt-neox-main/megatron/checkpointing.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 12,251 | 36.240122 | 156 | py |
gpt-neox | gpt-neox-main/megatron/mup_substitute.py | """
Helper functions for performing coord check.
"""
import os
from copy import copy
from itertools import product
import numpy as np
import pandas as pd
import torch
import torch.nn.functional as F
from mup import coord_check as mup_coord_check
from megatron.training import train_step
def _get_coord_data(
neox... | 7,800 | 35.624413 | 83 | py |
gpt-neox | gpt-neox-main/megatron/gradient_noise_scale/gradient_noise_scale.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 8,147 | 37.616114 | 171 | py |
gpt-neox | gpt-neox-main/megatron/mpu/mappings.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 5,182 | 25.854922 | 106 | py |
gpt-neox | gpt-neox-main/megatron/mpu/initialize.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 10,179 | 33.744027 | 106 | py |
gpt-neox | gpt-neox-main/megatron/mpu/cross_entropy.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 4,799 | 39.677966 | 106 | py |
gpt-neox | gpt-neox-main/megatron/mpu/utils.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 2,776 | 36.026667 | 106 | py |
gpt-neox | gpt-neox-main/megatron/mpu/data.py | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# 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 appli... | 3,886 | 31.123967 | 85 | py |
gpt-neox | gpt-neox-main/megatron/mpu/layers.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 27,891 | 35.796834 | 154 | py |
gpt-neox | gpt-neox-main/megatron/fused_kernels/setup.py | from setuptools import setup, find_packages
from torch.utils import cpp_extension
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
from pathlib import Path
import subprocess
def _get_cuda_bare_metal_version(cuda_dir):
raw_output = subprocess.check_output(
[cuda_dir + "/bin/nvcc", "-V"],... | 2,105 | 29.521739 | 78 | py |
gpt-neox | gpt-neox-main/megatron/fused_kernels/__init__.py | # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# 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 appli... | 1,549 | 32.695652 | 130 | py |
gpt-neox | gpt-neox-main/megatron/fused_kernels/tests/test_fused_kernels.py | import math
import torch
from torch.nn import LayerNorm
from megatron.model.fused_softmax import FusedScaleMaskSoftmax
from megatron.model.gpt2_model import gpt2_attention_mask_func
def test_load_fused_kernels():
try:
import scaled_masked_softmax_cuda
import scaled_upper_triang_masked_softmax_cu... | 9,169 | 29.875421 | 87 | py |
gpt-neox | gpt-neox-main/megatron/data/data_utils.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 18,046 | 34.80754 | 114 | py |
gpt-neox | gpt-neox-main/megatron/data/gpt2_dataset.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 12,708 | 38.104615 | 137 | py |
gpt-neox | gpt-neox-main/megatron/data/blendable_dataset.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 2,624 | 30.626506 | 119 | py |
gpt-neox | gpt-neox-main/megatron/data/indexed_dataset.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
... | 19,328 | 31.322742 | 106 | py |
gpt-neox | gpt-neox-main/megatron/data/samplers.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 6,211 | 36.421687 | 106 | py |
gpt-neox | gpt-neox-main/megatron/model/flash_attention.py | # Based on: https://github.com/HazyResearch/flash-attention/blob/4a6eaa9f27df6fff7ffb2c24e894938a687dd870/flash_attn/flash_attn_interface.py
import torch
import torch.nn as nn
import torch.nn.functional as F
from flash_attn import flash_attn_triton
import flash_attn_cuda
def flash_attn_unpadded_unpacked_func_triton... | 14,304 | 29.763441 | 140 | py |
gpt-neox | gpt-neox-main/megatron/model/positional_embeddings.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 9,387 | 40.910714 | 142 | py |
gpt-neox | gpt-neox-main/megatron/model/gpt2_model.py | # Copyright (c) 2021 EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | 15,362 | 39.428947 | 195 | py |
gpt-neox | gpt-neox-main/megatron/model/fused_bias_dropout.py | # Copyright (c) 2021, EleutherAI contributors
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# 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 L... | 1,871 | 32.428571 | 106 | py |
gpt-neox | gpt-neox-main/megatron/model/utils.py | # Copyright (c) 2021 EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | 13,578 | 39.777778 | 139 | py |
gpt-neox | gpt-neox-main/megatron/model/norms.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 2,823 | 31.45977 | 88 | py |
gpt-neox | gpt-neox-main/megatron/model/init_functions.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 7,073 | 32.685714 | 128 | py |
gpt-neox | gpt-neox-main/megatron/model/transformer.py | # Copyright (c) 2021 EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complianc... | 34,498 | 35.049112 | 222 | py |
gpt-neox | gpt-neox-main/megatron/model/gmlp.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# 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
#
#... | 5,090 | 34.852113 | 106 | py |
gpt-neox | gpt-neox-main/megatron/model/fused_softmax.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 6,992 | 32.946602 | 138 | py |
gpt-neox | gpt-neox-main/megatron/model/activations.py | # Copyright (c) 2021, EleutherAI
# This file is based on code by the authors denoted below and has been modified from its original version.
#
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in complian... | 4,382 | 30.307143 | 106 | py |
gpt-neox | gpt-neox-main/megatron/model/word_embeddings.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 9,624 | 38.772727 | 145 | py |
gpt-neox | gpt-neox-main/megatron/neox_arguments/arguments.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 51,272 | 37.725831 | 242 | py |
gpt-neox | gpt-neox-main/megatron/neox_arguments/neox_args.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 30,595 | 26.076106 | 243 | py |
gpt-neox | gpt-neox-main/megatron/neox_arguments/deepspeed_args.py | # Copyright (c) 2021, EleutherAI
#
# 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 writi... | 11,920 | 31.84022 | 508 | py |
BetaLSTM | BetaLSTM-master/music/utils.py | from scipy.io import loadmat
import torch
import numpy as np
def data_generator(dataset):
if dataset == "JSB":
print('loading JSB data...')
data = loadmat('data/JSB_Chorales.mat')
elif dataset == "Muse":
print('loading Muse data...')
data = loadmat('data/MuseData.mat')
elif... | 821 | 28.357143 | 62 | py |
BetaLSTM | BetaLSTM-master/music/train_music.py | import argparse
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.optim as optim
import sys
# sys.path.append("../../")
from utils import data_generator
import numpy as np
import time
import datetime
import os
from os.path import dirname
import logging
import random
curpath = dirname(... | 13,526 | 38.552632 | 179 | py |
BetaLSTM | BetaLSTM-master/custom/custom_rnn.py | """Implementation of batch-normalized LSTM."""
import torch
from torch import nn
from torch.autograd import Variable
from torch.nn import functional, init
import torch.nn.functional as F
import torch.distributions as tdist
import math
import numpy as np
from custom_utils import to_var
class GumbelNoise(nn.Module):
... | 26,446 | 36.092567 | 134 | py |
BetaLSTM | BetaLSTM-master/custom/custom_utils.py | import numpy as np
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import torch
from torchvision import datasets,transforms
from functools import partial
import torch.distributions as tdist
def kl_anneal_function(anneal_function, step, k, x0):
if anneal_function == 'logistic':
retur... | 5,826 | 32.877907 | 95 | py |
BetaLSTM | BetaLSTM-master/custom/custom_lm_model.py | import torch
import torch.nn as nn
from custom_dropout import LockedDropout,embedded_dropout,WeightDrop
import custom_rnn
class RNNModel(nn.Module):
"""Container module with an encoder, a recurrent module, and a decoder."""
#def __init__(self, args,rnn_type, ntoken, ninp, nhid, nlayers, dropout=0.5, dropouth... | 8,503 | 50.539394 | 166 | py |
BetaLSTM | BetaLSTM-master/custom/custom_model.py | import torch
import torch.nn as nn
from custom_dropout import LockedDropout,embedded_dropout,WeightDrop
import custom_rnn
class RNNModel(nn.Module):
"""Container module with an encoder, a recurrent module, and a decoder."""
#def __init__(self, args,rnn_type, ntoken, ninp, nhid, nlayers, dropout=0.5, dropouth... | 7,437 | 52.128571 | 166 | py |
BetaLSTM | BetaLSTM-master/custom/custom_dropout.py | import torch
from torch.nn import Parameter
import torch.nn as nn
from torch.autograd import Variable
class LockedDropout(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x, dropout=0.5):
if not self.training or not dropout:
return x
m = x.data.new(1, x.... | 3,072 | 37.898734 | 133 | py |
SRD-VC | SRD-VC-master/My_model/inference.py | import numpy as np
import random
import os
import torch
from hparams import hparams as hparams_
from utils import pad_seq_to_2
from utils import quantize_f0_numpy
from model import Generator_6 as F0_Converter
from model import Generator_MI, Generator_Decoder
import pickle
random.seed(137)
np.random.seed(137)
n_test = ... | 7,241 | 36.523316 | 113 | py |
SRD-VC | SRD-VC-master/My_model/main.py | import os
import argparse
from torch.backends import cudnn
from solver import Solver
from data_loader import get_loader
from hparams import hparams, hparams_debug_string
def str2bool(v):
return v.lower() in ('true')
def main(config):
# For fast training.
cudnn.benchmark = True
# Create directories... | 2,749 | 36.671233 | 109 | py |
SRD-VC | SRD-VC-master/My_model/VQ_Encoder.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
class Encoder(nn.Module):
'''
reference from: https://github.com/bshall/VectorQuantizedCPC/blob/master/model.py
'''
def __init__(self, in_channels, channels, n_embeddings, z_dim, c_dim):
super(Encoder, self).__init... | 9,640 | 40.377682 | 145 | py |
SRD-VC | SRD-VC-master/My_model/draw_speaker_embedding.py |
import os
import random
import numpy as np
from sklearn.manifold import TSNE
import matplotlib.pyplot as plt
# from sklearn import datasets
#
# digits = datasets.load_digits(n_class=6)
# X, y = digits.data, digits.target
# n_samples, n_features = X.shape
#
# print(X.shape) # (1083, 64)
# print(y.shape) # (... | 3,587 | 25.577778 | 121 | py |
SRD-VC | SRD-VC-master/My_model/generate.py | import numpy as np
import os
import torch
from hparams import hparams as hparams_
from hparams import hparams__
from utils import pad_seq_to_2
from utils import quantize_f0_numpy
from model import Generator_6 as F0_Converter
from model import Generator_MI, Generator_Decoder
import pickle
MAX_LEN = 128 * 3
root = "/ce... | 5,750 | 44.642857 | 113 | py |
SRD-VC | SRD-VC-master/My_model/mi_estimators.py | '''
Modified from: https://github.com/Linear95/CLUB
'''
import torch
import torch.nn as nn
class CLUB(nn.Module): # CLUB: Mutual Information Contrastive Learning Upper Bound
'''
This class provides the CLUB estimation to I(X,Y)
Method:
mi_est() : provides the estimation with inp... | 10,022 | 49.621212 | 115 | py |
SRD-VC | SRD-VC-master/My_model/data_loader.py | import os
import torch
import pickle
import numpy as np
from functools import partial
from numpy.random import uniform
from multiprocessing import Process, Manager
from torch.utils import data
from torch.utils.data.sampler import Sampler
import pdb
class Utterances(data.Dataset):
"""Dataset class for the Uttera... | 6,127 | 32.124324 | 104 | py |
SRD-VC | SRD-VC-master/My_model/utils.py | import copy
import torch
import numpy as np
from scipy import signal
from librosa.filters import mel
from scipy.signal import get_window
def butter_highpass(cutoff, fs, order=5):
nyq = 0.5 * fs
normal_cutoff = cutoff / nyq
b, a = signal.butter(order, normal_cutoff, btype='high', analog=False)
return ... | 2,430 | 25.714286 | 74 | py |
SRD-VC | SRD-VC-master/My_model/model.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from AdversarialClassifier import AdversarialClassifier
from VQ_Encoder import VQEmbeddingEMA
class LinearNorm(torch.nn.Module):
def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'):
super(LinearNorm, self).__init__()
... | 25,980 | 36.436599 | 126 | py |
SRD-VC | SRD-VC-master/My_model/AdversarialClassifier.py | """
Common classifier and Adversarial classifier
"""
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
from pytorch_revgrad import RevGrad
class LinearNorm(nn.Module):
def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'):
super(LinearNorm, self).__init__()
... | 1,663 | 36.818182 | 111 | py |
SRD-VC | SRD-VC-master/My_model/demo.py | # demo conversion
import torch
import pickle
import numpy as np
from hparams import hparams as hparams_
from utils import pad_seq_to_2
from utils import quantize_f0_numpy
from model import Generator_6 as F0_Converter
from model import Generator_MI, Generator_Decoder
import os
device = 'cuda:0'
use_VQCPC = False
use_V... | 5,502 | 36.951724 | 104 | py |
SRD-VC | SRD-VC-master/My_model/solver.py | from model import Generator_MI, Generator_Decoder
from model import InterpLnr
import torch
import torch.nn.functional as F
import numpy as np
import os
import time
import datetime
import pickle
import torch.nn as nn
from mi_estimators import CLUBSample_reshape
from utils import pad_seq_to_2, quantize_f0_torch, quantize... | 26,055 | 47.702804 | 145 | py |
SRD-VC | SRD-VC-master/My_model/pytorch_revgrad/functional.py | from torch.autograd import Function
class RevGrad(Function):
@staticmethod
def forward(ctx, input_, alpha_):
ctx.save_for_backward(input_, alpha_)
output = input_
return output
@staticmethod
def backward(ctx, grad_output):
grad_input = None
_, alpha_ = ctx.saved... | 468 | 25.055556 | 46 | py |
SRD-VC | SRD-VC-master/My_model/pytorch_revgrad/module.py | from .functional import revgrad
from torch.nn import Module
from torch import tensor
class RevGrad(Module):
def __init__(self, alpha = 1, *args, **kwargs):
'''
A gradient reversal layer
This layer has no parameters, and simply reverses the gradient in the backward through
'''
... | 490 | 27.882353 | 94 | py |
SRD-VC | SRD-VC-master/My_model/pytorch_revgrad/__init__.py | "A pytorch module to reverse gradient"
from .module import RevGrad
from .version import __version__ | 100 | 24.25 | 38 | py |
SRD-VC | SRD-VC-master/autovc/synthesis.py | # coding: utf-8
"""
Synthesis waveform from trained WaveNet.
Modified from https://github.com/r9y9/wavenet_vocoder
"""
import torch
from tqdm import tqdm
# from hparams import hparams
from autovc.hparams import hparams
from wavenet_vocoder import builder
torch.set_num_threads(4)
use_cuda = torch.cuda.is_available()
... | 2,051 | 26.72973 | 89 | py |
UConnRCMPy | UConnRCMPy-master/docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# UConnRCMPy documentation build configuration file, created by
# sphinx-quickstart on Sat Jan 9 10:26:33 2016.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
#... | 10,603 | 31.527607 | 87 | py |
CSL | CSL-main/utils.py | import numpy as np
import torch
from torch import nn, optim
import random
from sklearn.metrics import accuracy_score
from tslearn.clustering import TimeSeriesKMeans
def sample_ts_segments(X, shapelets_size, n_segments=10000):
"""
Sample time series segments for k-Means.
"""
n_ts, n_channels, len_ts =... | 8,044 | 33.676724 | 137 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.