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 |
|---|---|---|---|---|---|---|
ocp | ocp-main/ocpmodels/trainers/forces_trainer.py | """
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.
"""
import logging
import os
import pathlib
from collections import defaultdict
from pathlib import Path
from typing import Optional
import nump... | 31,922 | 37.554348 | 127 | py |
msvi | msvi-main/experiments/rmnist/val.py | from types import SimpleNamespace
import torch
import wandb
from tqdm import tqdm
from einops import reduce
import msvi.utils.rmnist as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = SimpleNamespace(**vars(argpa... | 1,789 | 25.323529 | 121 | py |
msvi | msvi-main/experiments/rmnist/test.py | from types import SimpleNamespace
import torch
import wandb
from tqdm import tqdm
from einops import reduce
import msvi.utils.rmnist as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = SimpleNamespace(**vars(argpa... | 1,815 | 25.705882 | 121 | py |
msvi | msvi-main/experiments/rmnist/utils.py | import os
from collections import deque
import numpy as np
import torch
import msvi.posterior
from einops import rearrange
ndarray = np.ndarray
Tensor = torch.Tensor
def set_seed(seed):
np.random.seed(seed)
torch.manual_seed(seed)
def save_model(model, path, name):
if not os.path.isdir(path):
... | 4,823 | 30.122581 | 121 | py |
msvi | msvi-main/experiments/rmnist/train.py | from types import SimpleNamespace
import torch
import torch.nn as nn
import torch.optim as optim
import wandb
from tqdm import tqdm
import msvi.utils.rmnist as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = Simpl... | 3,556 | 29.663793 | 107 | py |
msvi | msvi-main/experiments/tests/lv_vms.py | from types import SimpleNamespace
import torch.optim as optim
from tqdm import tqdm
import utils
param = {
"T": 50, # terminal time
"M": 250, # number of observations in [0, T]
"sigY": 0.001, # observation noise
"seed": 1400, # random seed
"max_len": 201, # truncation length for the traje... | 1,390 | 27.979167 | 85 | py |
msvi | msvi-main/experiments/tests/lv_avms.py | from types import SimpleNamespace
import torch.optim as optim
from tqdm import tqdm
import utils
param = {
"T": 50, # terminal time
"M": 250, # number of observations in [0, T]
"sigY": 0.001, # observation noise
"max_len": 201, # truncation length for the trajectories
"seed": 1400, # rand... | 1,733 | 25.676923 | 85 | py |
msvi | msvi-main/experiments/tests/lv_vss.py | from types import SimpleNamespace
import torch.optim as optim
from tqdm import tqdm
import utils
param = {
"T": 50, # terminal time
"M": 250, # number of observations in [0, T]
"sigY": 0.001, # observation noise
"seed": 1400, # random seed
"max_len": 10, # truncation length for the trajec... | 1,388 | 27.9375 | 85 | py |
msvi | msvi-main/experiments/tests/utils.py | import numpy as np
import scipy.integrate
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
from torch.utils.data import DataLoader
from einops import rearrange
from einops.layers.torch import Rearrange
import msvi.decoder
import msvi.trans_func
import msvi.rec_net
import msvi.model
import... | 7,855 | 31.733333 | 126 | py |
msvi | msvi-main/experiments/pendulum/val.py | from types import SimpleNamespace
import torch
import wandb
from tqdm import tqdm
from einops import reduce
import msvi.utils.pendulum as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = SimpleNamespace(**vars(arg... | 1,791 | 25.352941 | 121 | py |
msvi | msvi-main/experiments/pendulum/test.py | from types import SimpleNamespace
import torch
import wandb
from tqdm import tqdm
from einops import reduce
import msvi.utils.pendulum as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = SimpleNamespace(**vars(arg... | 1,817 | 25.735294 | 121 | py |
msvi | msvi-main/experiments/pendulum/utils.py | import os
from collections import deque
import numpy as np
import torch
import msvi.posterior
from einops import rearrange
ndarray = np.ndarray
Tensor = torch.Tensor
def set_seed(seed):
np.random.seed(seed)
torch.manual_seed(seed)
def save_model(model, path, name):
if not os.path.isdir(path):
... | 4,823 | 30.122581 | 121 | py |
msvi | msvi-main/experiments/pendulum/train.py | from types import SimpleNamespace
import torch
import torch.nn as nn
import torch.optim as optim
import wandb
from tqdm import tqdm
import msvi.utils.pendulum as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = Sim... | 3,558 | 29.681034 | 107 | py |
msvi | msvi-main/experiments/bballs/val.py | from types import SimpleNamespace
import torch
import wandb
from tqdm import tqdm
from einops import reduce
import msvi.utils.bballs as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = SimpleNamespace(**vars(argpa... | 1,789 | 25.323529 | 121 | py |
msvi | msvi-main/experiments/bballs/test.py | from types import SimpleNamespace
import torch
import wandb
from tqdm import tqdm
from einops import reduce
import msvi.utils.bballs as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = SimpleNamespace(**vars(argpa... | 1,815 | 25.705882 | 121 | py |
msvi | msvi-main/experiments/bballs/utils.py | import os
from collections import deque
import numpy as np
import torch
import msvi.posterior
from einops import rearrange
ndarray = np.ndarray
Tensor = torch.Tensor
def set_seed(seed):
np.random.seed(seed)
torch.manual_seed(seed)
def save_model(model, path, name):
if not os.path.isdir(path):
... | 4,823 | 30.122581 | 121 | py |
msvi | msvi-main/experiments/bballs/train.py | from types import SimpleNamespace
import torch
import torch.nn as nn
import torch.optim as optim
import wandb
from tqdm import tqdm
import msvi.utils.bballs as data_utils
import utils
torch.backends.cudnn.benchmark = True # type: ignore
# Read parameters.
argparser = data_utils.create_argparser()
param = Simpl... | 3,556 | 29.663793 | 107 | py |
msvi | msvi-main/msvi/model.py | from typing import Union
from abc import ABC, abstractmethod
import torch
import torch.nn as nn
from torch.distributions.normal import Normal
from torch.distributions.bernoulli import Bernoulli
from torch.distributions.continuous_bernoulli import ContinuousBernoulli
from einops import reduce
from msvi.decoder impo... | 6,335 | 29.315789 | 127 | py |
msvi | msvi-main/msvi/dataset.py | from typing import Union
import torch
from torch.utils.data import Dataset
Tensor = torch.Tensor
class TrajectoryDataset(Dataset):
"""Stores trajectories and time grids.
Used to store trajectories `y` and the corresponding time grids `t`.
Each trajectory is assumed to have three dimensions:
(ti... | 1,444 | 31.840909 | 99 | py |
msvi | msvi-main/msvi/decoder.py | from abc import ABC, abstractmethod
import torch
import torch.nn as nn
Tensor = torch.Tensor
Module = nn.Module
Parameter = nn.parameter.Parameter
class IDecoder(Module, ABC):
@abstractmethod
def forward(self, x: Tensor) -> Tensor:
"""Maps latent state to parameters of p(y|x).
Args:
... | 4,429 | 34.15873 | 104 | py |
msvi | msvi-main/msvi/tf_encoder.py | import torch
import torch.nn as nn
Tensor = torch.Tensor
Module = nn.Module
class TFEncoder(nn.Module):
# Modified https://pytorch.org/docs/stable/_modules/torch/nn/modules/transformer.html#TransformerEncoderLayer
def __init__(
self,
d_model: int,
self_attn: Module,
t: Tensor... | 1,465 | 27.745098 | 113 | py |
msvi | msvi-main/msvi/elbo.py | from abc import ABC, abstractmethod
import torch
import torch.nn as nn
from msvi.model import IModel
from msvi.posterior import IVariationalPosterior, AmortizedMultipleShootingPosterior
from einops import repeat
Tensor = torch.Tensor
class IELBO(nn.Module, ABC):
@abstractmethod
def forward(
self,... | 6,622 | 31.465686 | 125 | py |
msvi | msvi-main/msvi/attention.py | from abc import ABC, abstractmethod
from typing import Union
import numpy as np
import torch
import torch.nn as nn
Tensor = torch.Tensor
Module = nn.Module
class IAttention(Module, ABC):
@abstractmethod
def forward(
self,
x: Tensor,
return_weights: bool = True
) -> Union[tuple[... | 8,637 | 33.690763 | 117 | py |
msvi | msvi-main/msvi/trans_func.py | from abc import ABC, abstractmethod
import torch
import torch.nn as nn
from torchdiffeq import odeint
from torchdiffeq import odeint_adjoint
from einops import rearrange
Tensor = torch.Tensor
Module = nn.Module
Parameter = nn.parameter.Parameter
class ITransitionFunction(Module, ABC):
@abstractmethod
def... | 6,931 | 34.917098 | 118 | py |
msvi | msvi-main/msvi/pos_enc.py | from typing import Union
import numpy as np
import torch
import torch.nn as nn
Tensor = torch.Tensor
Module = nn.Module
Sequential = nn.Sequential
class DiscreteSinCosPositionalEncoding(Module):
# Modified https://pytorch.org/tutorials/beginner/transformer_tutorial.html
def __init__(self, d_model: int, t: T... | 4,793 | 35.045113 | 133 | py |
msvi | msvi-main/msvi/posterior.py | from abc import ABC, abstractmethod
import torch
import torch.nn as nn
from msvi.trans_func import ITransitionFunction
from msvi.rec_net import RecognitionNet
Tensor = torch.Tensor
Module = nn.Module
ParameterDict = nn.ParameterDict
class IVariationalPosterior(ABC, Module):
@property
@abstractmethod
d... | 8,083 | 33.4 | 147 | py |
msvi | msvi-main/msvi/rec_net.py | import torch
import torch.nn as nn
from einops import rearrange
Tensor = torch.Tensor
Module = nn.Module
class RecognitionNet(Module):
def __init__(
self,
phi_enc: Module,
phi_agg: Module,
phi_gamma: Module,
phi_tau: Module,
tau_min: float,
) -> None:
... | 3,937 | 31.01626 | 103 | py |
msvi | msvi-main/msvi/utils/utils.py | from types import SimpleNamespace
import torch
import torch.nn as nn
from einops import rearrange
from msvi.pos_enc import (
DiscreteSinCosPositionalEncoding,
ContinuousSinCosPositionalEncoding,
RelativePositionalEncodingInterp,
RelativePositionalEncodingNN
)
from msvi.attention import (
DotProd... | 6,830 | 31.221698 | 105 | py |
msvi | msvi-main/msvi/utils/pendulum.py | import os
import pickle
import argparse
from typing import Union
from types import SimpleNamespace
import torch
import torch.nn as nn
import torchvision.transforms
from torch.nn.parameter import Parameter
from torch.utils.data import DataLoader
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sn... | 15,776 | 39.557841 | 158 | py |
msvi | msvi-main/msvi/utils/bballs.py | import os
import pickle
import argparse
from typing import Union
from types import SimpleNamespace
import torch
import torch.nn as nn
import torchvision.transforms
from torch.nn.parameter import Parameter
from torch.utils.data import DataLoader
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sn... | 16,068 | 39.992347 | 176 | py |
msvi | msvi-main/msvi/utils/rmnist.py | import os
import pickle
import argparse
from typing import Union
from types import SimpleNamespace
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
from torch.utils.data import DataLoader
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from msvi.model import Mode... | 15,338 | 40.013369 | 157 | py |
Disease-Detection-and-Diagnostic-Image-Feature | Disease-Detection-and-Diagnostic-Image-Feature-main/util/util/backbone/Backbone.py | import os
import torch
import torch.nn as nn
from util.model.initialize_load_r21d import initialize_load_model
from util.loader.LUMC_A4C.loader_vid import create_dataloader
from util.checkpoint.checkpoint_train import checkpoint_train
from util.checkpoint.checkpoint_test import checkpoint_test
from torch.utils.tensorb... | 7,196 | 48.979167 | 143 | py |
Disease-Detection-and-Diagnostic-Image-Feature | Disease-Detection-and-Diagnostic-Image-Feature-main/util/util/checkpoint/checkpoint_test.py | import os
import numpy as np
import torch
from util.checkpoint.create_header import create_header_clas, create_header_seg, create_header_regres
from util.eval.eval import one_epoch_avg_clas, one_epoch_avg_seg, one_epoch_avg_regres
def checkpoint_test(one_epoch, model, save_folder, subfolder, task,
... | 1,894 | 50.216216 | 131 | py |
Disease-Detection-and-Diagnostic-Image-Feature | Disease-Detection-and-Diagnostic-Image-Feature-main/util/util/checkpoint/checkpoint_train.py | import os
import numpy as np
import torch
from util.checkpoint.create_header import create_header_clas, create_header_seg, create_header_regres
from util.eval.eval import one_epoch_avg_clas, one_epoch_avg_seg, one_epoch_avg_regres
def checkpoint_train(itr, one_epoch_train, one_epoch_val, one_epoch_test, model, save_f... | 3,481 | 43.641026 | 164 | py |
Disease-Detection-and-Diagnostic-Image-Feature | Disease-Detection-and-Diagnostic-Image-Feature-main/util/util/loader/LUMC_A4C/loader_vid.py | import numpy as np
import torch
from torch.utils.data.dataset import Dataset
import random
from skimage.transform import rotate
class loader(Dataset):
def __init__(self, X_list, aug=False, rgb_channel=3, **kwargs):
self.X_list = X_list
self.aug = aug
self.rgb_channel = rgb_channel
def... | 1,640 | 36.295455 | 160 | py |
Disease-Detection-and-Diagnostic-Image-Feature | Disease-Detection-and-Diagnostic-Image-Feature-main/util/util/model/initialize_load_r21d.py | import torch
import torch.nn as nn
import torchvision
def initialize_load_model(mode, model_path='scratch', in_channel=3, out_channel=3, device="cuda", **kwargs):
def r21d(in_channel, out_channel, pretrain=False, echo_pretrain=False):
model = torchvision.models.video.__dict__["r2plus1d_18"](pretrained=pre... | 984 | 34.178571 | 132 | py |
Disease-Detection-and-Diagnostic-Image-Feature | Disease-Detection-and-Diagnostic-Image-Feature-main/projectDDDIF/main.py | import os
import torch
import torch.nn as nn
# import numpy as np
from util.backbone.Backbone import Backbone
from util.loader.LUMC_A4C.loader_vid import create_dataloader
from util.model.initialize_load_r21d import initialize_load_model
from analyze import analyze
def forward(batch, model, device, return_one_batch, ... | 1,139 | 26.804878 | 98 | py |
Disease-Detection-and-Diagnostic-Image-Feature | Disease-Detection-and-Diagnostic-Image-Feature-main/projectDDDIF/analyze.py | import os
import torch
import torch.nn as nn
import torchvision
import matplotlib.pyplot as plt
from skimage.transform import resize
import numpy as np
import cv2
# import cmapy
from pydicom import dcmread
from pydicom.uid import ExplicitVRLittleEndian
from captum.attr import GradientShap, DeepLift, DeepLiftShap, Integ... | 5,747 | 39.478873 | 135 | py |
MetaHIN | MetaHIN-master/code/main.py | # coding: utf-8
# author: lu yf
# create date: 2019-11-21 17:27
import gc
import glob
import random
import time
import numpy as np
import torch
from HeteML_new import HML
from DataHelper import DataHelper
from tqdm import tqdm
from Config import states
# random.seed(13)
np.random.seed(13)
torch.manual_seed(13)
def tr... | 5,711 | 35.615385 | 130 | py |
MetaHIN | MetaHIN-master/code/MetaLearner_new.py | # coding: utf-8
# author: lu yf
# create date: 2019-12-10 14:25
import torch
from torch.nn import functional as F
class MetaLearner(torch.nn.Module):
def __init__(self,config):
super(MetaLearner, self).__init__()
self.embedding_dim = config['embedding_dim']
self.fc1_in_dim = 32 + config['i... | 4,108 | 35.6875 | 122 | py |
MetaHIN | MetaHIN-master/code/DataHelper.py | # coding: utf-8
# author: lu yf
# create date: 2019-11-24 13:16
import gc
import glob
import os
import pickle
# from DataProcessor import Movielens
from tqdm import tqdm
from multiprocessing import Process, Pool
from multiprocessing.pool import ThreadPool
import numpy as np
import torch
class DataHelper:
def __in... | 7,817 | 45.814371 | 133 | py |
MetaHIN | MetaHIN-master/code/EmbeddingInitializer.py | # coding: utf-8
# author: lu yf
# create date: 2019-12-10 14:22
import torch
from torch.autograd import Variable
# Movielens dataset
class UserEmbeddingML(torch.nn.Module):
def __init__(self, config):
super(UserEmbeddingML, self).__init__()
self.num_gender = config['num_gender']
self.num_... | 6,165 | 32.51087 | 115 | py |
MetaHIN | MetaHIN-master/code/HeteML_new.py | # coding: utf-8
# author: lu yf
# create date: 2019-12-02 11:25
import numpy as np
import torch
from torch.nn import functional as F
from Evaluation import Evaluation
from MetaLearner_new import MetapathLearner, MetaLearner
class HML(torch.nn.Module):
def __init__(self, config, model_name):
super(HML, se... | 24,851 | 55.869565 | 162 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/benchpress.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas and Chris Cummins.
#
# 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... | 16,345 | 33.340336 | 169 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/reinforcement_learning/reinforcement_models.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 13,200 | 40.382445 | 130 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/reinforcement_learning/memory.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 2,825 | 29.387097 | 74 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/reinforcement_learning/data_generator.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 5,794 | 36.62987 | 120 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/reinforcement_learning/model.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 11,311 | 38.141869 | 115 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/reinforcement_learning/agent.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 48,376 | 46.945491 | 184 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/reinforcement_learning/env.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 11,257 | 40.389706 | 126 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/features/hidden_state.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 4,677 | 33.397059 | 151 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/sequence_masking.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 35,295 | 41.019048 | 165 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/telemetry.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas and Chris Cummins.
#
# 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... | 6,194 | 37.006135 | 131 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/bert_flags.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 1,617 | 33.425532 | 107 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/builders.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas and Chris Cummins.
#
# 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... | 12,534 | 31.72846 | 157 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/lm_data_generator.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas and Chris Cummins.
#
# 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... | 46,191 | 40.689531 | 164 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/from_pretrained.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas and Chris Cummins.
#
# 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... | 7,766 | 38.426396 | 146 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/language_models.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas and Chris Cummins.
#
# 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... | 26,387 | 38.621622 | 178 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/backends.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas and Chris Cummins.
#
# 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... | 3,511 | 34.12 | 80 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/tf_sequential/tf_sequential.py | # Copyright (c) 2016-2020 Chris Cummins.
#
# clgen is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# clgen is distributed in the hope... | 23,354 | 34.493921 | 133 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/keras_sequential/keras_sequential.py | # Copyright (c) 2016-2020 Chris Cummins.
#
# clgen is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# clgen is distributed in the hope... | 9,992 | 35.075812 | 94 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/torch_bert/modeling_utils.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors, Facebook AI Research authors and The HuggingFace Inc. team and Foivos Tsimpourlas.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except i... | 47,214 | 45.063415 | 180 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/torch_bert/data_generator.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 59,181 | 43.800908 | 205 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/torch_bert/model.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team and Foivos Tsimpourlas.
# Copyright (c) 2018, 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.... | 44,186 | 39.316606 | 188 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/torch_bert/config.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team and Foivos Tsimpourlas.
# Copyright (c) 2018, 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.... | 19,055 | 56.225225 | 273 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/torch_bert/compiler.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 22,498 | 44.178715 | 220 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/torch_bert/generation_utils.py | # coding=utf-8
# Copyright 2022 The Google AI Language Team Authors, Facebook AI Research authors and The HuggingFace Inc. team and Foivos Tsimpourlas.
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except i... | 45,882 | 44.160433 | 242 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/torch_bert/datasets.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 17,820 | 39.410431 | 221 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/torch_bert/torch_bert.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 61,629 | 44.889799 | 238 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/torch_bert/activations.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 2,059 | 31.1875 | 111 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/torch_bert/optimizer.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team and Foivos Tsimpourlas.
#
# 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.apac... | 12,217 | 40 | 129 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/incoder/example_api.py | import typing
from deeplearning.benchpress.util import pytorch
torch = pytorch.torch
# signals the start of a document
BOS = "<|endoftext|>"
# signals the end of a generated infill
EOM = "<|endofmask|>"
def make_sentinel(i):
# signals (1) a location to insert an infill and (2) the start of the infill generation
... | 4,614 | 40.954545 | 136 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/incoder/incoder.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 17,189 | 41.339901 | 202 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/incoder/data_generator.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 7,533 | 48.565789 | 169 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/models/tf_bert/model.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors.
#
# 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 ... | 42,818 | 38.464516 | 130 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/util/pytorch.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 3,833 | 32.33913 | 107 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/util/distrib.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 7,491 | 28.380392 | 80 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/scratchpad/feature_transformer.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 13,876 | 35.518421 | 185 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/scratchpad/test_torch_sampler.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 2,289 | 33.179104 | 137 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/active_models/data_generator.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 6,852 | 31.478673 | 105 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/active_models/active_models.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 7,599 | 37.77551 | 130 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/active_models/downstream_tasks.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 32,769 | 35.451613 | 165 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/active_models/committee/active_committee.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 33,727 | 42.407979 | 324 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/active_models/committee/models.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 8,757 | 31.557621 | 112 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/active_models/committee/optimizer.py | # coding=utf-8
# Copyright 2022 The Google AI Language Team Authors, The HuggingFace Inc. team and Foivos Tsimpourlas.
#
# 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.... | 12,214 | 39.989933 | 129 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/active_models/expected_error_reduction/model.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 3,600 | 32.036697 | 94 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/active_models/expected_error_reduction/eer.py | # coding=utf-8
# Copyright 2022 Foivos Tsimpourlas.
#
# 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 a... | 34,761 | 45.164675 | 203 | py |
BenchPress | BenchPress-master/deeplearning/benchpress/active_models/expected_error_reduction/optimizer.py | # coding=utf-8
# Copyright 2022 The Google AI Language Team Authors, The HuggingFace Inc. team and Foivos Tsimpourlas.
#
# 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.... | 12,214 | 39.989933 | 129 | py |
DeepGlow | DeepGlow-main/DeepGlow/DGmain.py | import numpy as np
from tensorflow import keras
import importlib.resources
class Emulator(object):
def __init__(self, simtype='ism'):
if simtype == 'ism':
with importlib.resources.path('DeepGlow', 'data') as data_path:
scale_path = data_path / "scale_facs_ism_final.csv"
... | 3,302 | 43.04 | 88 | py |
DeepGlow | DeepGlow-main/paper/boxfit_clrDLtrain.py | from CLR.clr_callback import CyclicLR
from sklearn.preprocessing import StandardScaler
import numpy as np
from tensorflow.keras.losses import MeanAbsoluteError
from keras import layers
import keras
from tensorflow.keras import backend as K
import tensorflow as tf
import pandas as pd
import os
os.environ["CUDA_VISIBLE_D... | 4,003 | 36.773585 | 112 | py |
DeepGlow | DeepGlow-main/paper/boxfit_clrDLtrain_wind.py | from CLR.clr_callback import CyclicLR
from sklearn.preprocessing import StandardScaler
import numpy as np
from tensorflow.keras.losses import MeanAbsoluteError
from keras import layers
import keras
from tensorflow.keras import backend as K
import tensorflow as tf
import pandas as pd
import os
os.environ["CUDA_VISIBLE_D... | 3,833 | 35.169811 | 136 | py |
GL-AT | GL-AT-master/pytorch/inference.py | import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '../utils'))
import numpy as np
import argparse
import librosa
import matplotlib.pyplot as plt
import torch
from utilities import create_folder, get_filename
from models import *
from pytorch_utils import move_data_to_device
import config
def audio_ta... | 7,172 | 34.161765 | 101 | py |
GL-AT | GL-AT-master/pytorch/main.py | import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '../utils'))
import numpy as np
import argparse
import h5py
import math
import time
import logging
import matplotlib.pyplot as plt
from sklearn import metrics
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim... | 15,044 | 37.676093 | 148 | py |
GL-AT | GL-AT-master/pytorch/losses.py | import torch
import torch.nn.functional as F
def clip_bce(output_dict, target_dict):
"""Binary crossentropy loss.
"""
return F.binary_cross_entropy(
output_dict['local_prob'], target_dict['target'])
def get_loss_func(loss_type):
if loss_type == 'clip_bce':
return clip_bce | 308 | 21.071429 | 57 | py |
GL-AT | GL-AT-master/pytorch/test.py | import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '../utils'))
import numpy as np
import argparse
import librosa
import matplotlib.pyplot as plt
import torch
from utilities import create_folder, get_filename
from models import *
from pytorch_utils import move_data_to_device
import config
def audio_ta... | 9,038 | 40.847222 | 295 | py |
GL-AT | GL-AT-master/pytorch/evaluate.py | from sklearn import metrics
from pytorch_utils import forward
class Evaluator(object):
def __init__(self, model, model_G):
"""Evaluator.
Args:
model: object
"""
self.model = model
self.model_G = model_G
def evaluate(self, data_loader):
"""Fo... | 1,176 | 25.75 | 76 | py |
GL-AT | GL-AT-master/pytorch/finetune_template.py | import os
import sys
sys.path.insert(1, os.path.join(sys.path[0], '../utils'))
import numpy as np
import argparse
import h5py
import math
import time
import logging
import matplotlib.pyplot as plt
import torch
torch.backends.cudnn.benchmark=True
torch.manual_seed(0)
import torch.nn as nn
import torch.nn.functional as ... | 3,979 | 30.587302 | 88 | py |
GL-AT | GL-AT-master/pytorch/models.py | import os
import sys
import math
import time
import numpy as np
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as cp
from torch.nn.parameter import Parameter
from torchlibrosa.stft import Spectrogram, LogmelFilterBank
from torchlibrosa.... | 33,592 | 38.708038 | 144 | py |
GL-AT | GL-AT-master/pytorch/pytorch_utils.py | import numpy as np
import time
import torch
import torch.nn as nn
def move_data_to_device(x, device):
if 'float' in str(x.dtype):
x = torch.Tensor(x)
elif 'int' in str(x.dtype):
x = torch.LongTensor(x)
else:
return x
return x.to(device)
def do_mixup(x, mixup_lambda):
"""... | 8,446 | 32.387352 | 127 | py |
gbm-bench | gbm-bench-master/algorithms.py | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions a... | 17,038 | 34.204545 | 97 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.