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 |
|---|---|---|---|---|---|---|
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_xlnet.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# 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 Lice... | 72,560 | 52.002922 | 169 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_xlm.py | # coding=utf-8
# Copyright 2019-present, Facebook, Inc and the HuggingFace Inc. team.
#
# 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
#
# Un... | 45,543 | 50.34611 | 163 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_ctrl.py | # coding=utf-8
# Copyright 2018 Salesforce and HuggingFace Inc. team.
# 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.
# You may obtain a copy of the License at
#
# h... | 23,436 | 47.22428 | 134 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/tokenization_transfo_xl.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# 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 Lice... | 21,824 | 36.62931 | 133 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_transfo_xl_utilities.py | # coding=utf-8
# Copyright 2018 Google AI, Google Brain and Carnegie Mellon University Authors and the HuggingFace Inc. team.
# 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 Lice... | 13,568 | 39.747748 | 132 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/modeling_roberta.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# 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.
# You may obtain a cop... | 25,678 | 53.52017 | 151 | py |
CLUE | CLUE-master/baselines/models_pytorch/classifier_pytorch/transformers/tokenization_utils.py | # coding=utf-8
# Copyright 2018 The Open AI Team Authors and The HuggingFace Inc. team.
#
# 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
#
# ... | 54,979 | 50.431244 | 372 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/google_albert_pytorch_modeling.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
# 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.
# You may obtain a copy... | 22,556 | 42.885214 | 119 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/run_c3.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
#
# 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/LICENS... | 34,700 | 41.061818 | 120 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/test_mrc.py | import argparse
import collections
import json
import os
from glob import glob
import torch
from torch.utils.data import TensorDataset, DataLoader
from tqdm import tqdm
from pytorch_modeling import BertConfig, BertForQuestionAnswering, ALBertConfig, ALBertForQA
from google_albert_pytorch_modeling import AlbertConfig,... | 7,116 | 44.33121 | 110 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/run_mrc.py | import argparse
import collections
import json
import os
import random
import numpy as np
import torch
from google_albert_pytorch_modeling import AlbertConfig, AlbertForMRC
from preprocess.cmrc2018_evaluate import get_eval
from pytorch_modeling import BertConfig, BertForQuestionAnswering, ALBertConfig, ALBertForQA
fro... | 13,603 | 45.749141 | 112 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/pytorch_modeling.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
# 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.
# You may obtain a copy... | 57,982 | 45.798224 | 130 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/convert_tf_checkpoint_to_pytorch.py | # coding=utf-8
# Copyright 2018 The HugginFace Inc. team.
#
# 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 ... | 5,188 | 40.18254 | 105 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/test_multichoice_mrc.py | from __future__ import print_function
import argparse
import os
from glob import glob
import torch
from google_albert_pytorch_modeling import AlbertConfig, AlbertForMultipleChoice
from preprocess.CHID_preprocess import RawResult, get_final_predictions, write_predictions, \
generate_input
from pytorch_modeling imp... | 9,007 | 49.044444 | 118 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/run_multichoice_mrc.py | """
@name = 'roberta_wwm_ext_large'
@author = 'zhangxinrui'
@time = '2019/11/15'
roberta_wwm_ext_large 的baseline版本
coding=utf-8
Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
Licensed under the Apache License, Version 2.0 ... | 16,489 | 50.69279 | 118 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/tools/pytorch_optimization.py | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HugginFace Inc. team.
#
# 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/LICENS... | 8,435 | 41.606061 | 116 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/tools/utils.py | import collections
import os
import re
from glob import glob
import tensorflow as tf
import tensorflow.contrib.slim as slim
import torch
def check_args(args):
args.setting_file = os.path.join(args.checkpoint_dir, args.setting_file)
args.log_file = os.path.join(args.checkpoint_dir, args.log_file)
os.maked... | 4,999 | 33.013605 | 117 | py |
CLUE | CLUE-master/baselines/models_pytorch/mrc_pytorch/tools/file_utils.py | """
Utilities for working with the local dataset cache.
This file is adapted from the AllenNLP library at https://github.com/allenai/allennlp
Copyright by the AllenNLP authors.
"""
import json
import logging
import os
import shutil
import tempfile
from functools import wraps
from hashlib import sha256
from pathlib imp... | 8,020 | 32.560669 | 98 | py |
pointnerf | pointnerf-master/options/base_options.py | import argparse
import os
from models import find_model_class_by_name
from data import find_dataset_class_by_name
import torch
class BaseOptions:
def initialize(self, parser: argparse.ArgumentParser):
#================================ global ================================#
parser.add_argument('-... | 7,159 | 38.125683 | 107 | py |
pointnerf | pointnerf-master/models/base_rendering_model.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from utils import format as fmt
import os
from .base_model import BaseModel
from .rendering.diff_render_func import find_render_function, find_blend_function, find_tone_map, alpha_blend
from .rendering.diff_ray_marching import find_r... | 28,653 | 41.45037 | 160 | py |
pointnerf | pointnerf-master/models/mvs_points_volumetric_model.py | from .base_rendering_model import *
from .neural_points_volumetric_model import NeuralPointsVolumetricModel
from .neural_points.neural_points import NeuralPoints
from .mvs.mvs_points_model import MvsPointsModel
from .mvs import mvs_utils
from. import base_model
from .aggregators.point_aggregators import PointAggregator... | 16,910 | 48.017391 | 519 | py |
pointnerf | pointnerf-master/models/base_model.py | import torch
from torch import nn
import os
from .helpers.networks import get_scheduler
class BaseModel:
@staticmethod
def modify_commandline_options(parser, is_train):
return parser
def name(self):
return self.__class__.__name__
def initialize(self, opt):
self.opt = opt
... | 5,600 | 34.675159 | 146 | py |
pointnerf | pointnerf-master/models/neural_points_volumetric_model.py | from .base_rendering_model import *
from .neural_points.neural_points import NeuralPoints
from .aggregators.point_aggregators import PointAggregator
import os
class NeuralPointsVolumetricModel(BaseRenderingModel):
@staticmethod
def modify_commandline_options(parser, is_train=True):
BaseRenderingModel... | 17,131 | 46.065934 | 416 | py |
pointnerf | pointnerf-master/models/neural_points/point_query.py | import torch
import torch.nn
import torch.nn.functional as F
import os
import numpy as np
from numpy import dot
from math import sqrt
import matplotlib.pyplot as plt
import pickle
import time
from models.rendering.diff_ray_marching import near_far_linear_ray_generation, near_far_disparity_linear_ray_generation
parent_d... | 5,914 | 53.768519 | 209 | py |
pointnerf | pointnerf-master/models/neural_points/query_point_indices_worldcoords.py | import os
import numpy as np
from numpy import dot
from math import sqrt
import pycuda
from pycuda.compiler import SourceModule
import pycuda.driver as drv
import pycuda.gpuarray as gpuarray
import matplotlib.pyplot as plt
import torch
import pickle
import time
from models.rendering.diff_ray_marching import near_far_li... | 51,817 | 55.385201 | 484 | py |
pointnerf | pointnerf-master/models/neural_points/neural_points.py | import torch
import torch.nn as nn
from data.load_blender import load_blender_cloud
import numpy as np
from ..helpers.networks import init_seq, positional_encoding
import matplotlib.pyplot as plt
import torch.nn.utils.prune as prune_param
class NeuralPoints(nn.Module):
@staticmethod
def modify_commandline_op... | 35,753 | 47.978082 | 368 | py |
pointnerf | pointnerf-master/models/neural_points/query_point_indices.py | import os
import numpy as np
from numpy import dot
from math import sqrt
import pycuda
from pycuda.compiler import SourceModule
import pycuda.driver as drv
import pycuda.gpuarray as gpuarray
import matplotlib.pyplot as plt
# from mpl_toolkits.mplot3d import Axes3D
import torch
import pickle
import time
# import cupy
# ... | 55,075 | 57.467091 | 475 | py |
pointnerf | pointnerf-master/models/depth_estimators/mvsnet.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from .module import *
class FeatureNet(nn.Module):
def __init__(self):
super(FeatureNet, self).__init__()
self.inplanes = 32
self.conv0 = ConvBnReLU(3, 8, 3, 1, 1)
self.conv1 = ConvBnReLU(8, 8, 3, 1, 1)
se... | 5,505 | 35.95302 | 147 | py |
pointnerf | pointnerf-master/models/depth_estimators/module.py | import torch
import torch.nn as nn
import torch.nn.functional as F
class ConvBnReLU(nn.Module):
def __init__(self, in_channels, out_channels, kernel_size=3, stride=1, pad=1):
super(ConvBnReLU, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, stride=stride, padding=pad... | 6,155 | 39.235294 | 118 | py |
pointnerf | pointnerf-master/models/helpers/geometrics.py | import torch
def homogenize(m):
"""Adds homogeneous coordinates to a [..., N,N] matrix, returning [..., N+1, N+1]."""
assert m.shape[-1] == m.shape[-2] # Must be square
n = m.shape[-1]
eye_n_plus_1 = torch.eye(n + 1).cuda().expand(list(m.shape[:-2]) + [-1, -1])
extra_col = eye_n_plus_1[..., :-1, ... | 2,890 | 39.71831 | 125 | py |
pointnerf | pointnerf-master/models/helpers/networks.py | import torch
import torch.nn as nn
from torch.nn import init
import functools
from torch.optim import lr_scheduler
import torch.nn.functional as F
import numpy as np
def get_nonlinearity_layer(activation_type='PReLU'):
if activation_type == 'ReLU':
nonlinearity_layer = nn.ReLU(True)
elif activation_ty... | 7,692 | 39.489474 | 125 | py |
pointnerf | pointnerf-master/models/rendering/diff_ray_marching.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
def find_ray_generation_method(name):
assert isinstance(name, str), 'ray generation method name must be string'
if name == 'cube':
return cube_ray_generation
elif name == 'near_far_linear':
return near_fa... | 23,672 | 40.314136 | 290 | py |
pointnerf | pointnerf-master/models/rendering/diff_render_func.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from utils import format as fmt
def find_render_function(name):
if name == 'radiance':
return radiance_render
elif name == 'white':
return white_color
raise RuntimeError('Unknown render function: ' + name... | 1,620 | 22.838235 | 73 | py |
pointnerf | pointnerf-master/models/aggregators/point_aggregators.py | import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from ..helpers.networks import init_seq, positional_encoding
from utils.spherical import SphericalHarm_table as SphericalHarm
from ..helpers.geometrics import compute_world2local_dist
class PointAggregator(torch.nn.Module):
@... | 37,876 | 45.417892 | 330 | py |
pointnerf | pointnerf-master/models/mvs/renderer.py | import torch
import torch.nn.functional as F
from .mvs_utils import normal_vect, index_point_feature, build_color_volume
def depth2dist(z_vals, cos_angle):
# z_vals: [N_ray N_sample]
device = z_vals.device
dists = z_vals[..., 1:] - z_vals[..., :-1]
dists = torch.cat([dists, torch.Tensor([1e10]).to(devi... | 7,260 | 38.461957 | 153 | py |
pointnerf | pointnerf-master/models/mvs/mvs_utils.py | import os, torch, cv2, re
import numpy as np
from torch_scatter import scatter_min, segment_coo, scatter_mean
from PIL import Image
import torch.nn.functional as F
import torchvision.transforms as T
from functools import partial
import matplotlib.pyplot as plt
from scipy.spatial.transform import Rotation as R
# Misc
... | 26,948 | 43.397035 | 318 | py |
pointnerf | pointnerf-master/models/mvs/mvs_points_model.py | import torch
import os
from torch.utils.data import DataLoader
import imageio
# models
from .models import *
from .renderer import *
from .mvs_utils import *
from . import filter_utils
from ..helpers.networks import init_seq
from ..depth_estimators.mvsnet import MVSNet as Ofcl_MVSNet
from torch.optim.lr_scheduler impo... | 22,547 | 54.674074 | 414 | py |
pointnerf | pointnerf-master/models/mvs/filter_utils.py | import sys
import os
import pathlib
# sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import torch.nn.functional as F
import copy
import torch
import numpy as np
import time
from models.mvs import mvs_utils
from tqdm import tqdm
import cv2
from PIL import Image
def reproject_with_depth(... | 16,375 | 53.586667 | 287 | py |
pointnerf | pointnerf-master/models/mvs/models.py | import torch
torch.autograd.set_detect_anomaly(True)
import torch.nn as nn
from .mvs_utils import *
from .mvs_utils import homo_warp
from inplace_abn import InPlaceABN
from .renderer import run_network_mvs
from ..depth_estimators.mvsnet import MVSNet as Ofcl_MVSNet
device = torch.device("cuda" if torch.cuda.is_availab... | 37,147 | 35.963184 | 166 | py |
pointnerf | pointnerf-master/run/editing.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import glob
import copy
import torch
import numpy as np
import time
from options import TrainOptions
from options import EditOptions
from data import create_data_loader, create_dataset
from models import cr... | 11,213 | 42.465116 | 774 | py |
pointnerf | pointnerf-master/run/evaluate.py | import os, sys, time, argparse, cv2
import numpy as np
try:
from skimage.measure import compare_ssim
from skimage.measure import compare_psnr
except:
from skimage.metrics import structural_similarity
from skimage.metrics import peak_signal_noise_ratio as compare_psnr
def compare_ssim(gt, img, win_s... | 9,769 | 61.229299 | 324 | py |
pointnerf | pointnerf-master/run/train_ft_nonstop.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import glob
import copy
import torch
import numpy as np
import time
from options import TrainOptions
from data import create_data_loader, create_dataset
from models import create_model
from models.mvs.mvs_p... | 60,868 | 55.308048 | 392 | py |
pointnerf | pointnerf-master/run/render_vid.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import copy
import torch
import numpy as np
import time
from options import TestOptions
from data import create_data_loader, create_dataset
from models import create_model
from utils.visualizer import Visu... | 4,702 | 34.097015 | 110 | py |
pointnerf | pointnerf-master/run/train_ft.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import glob
import copy
import torch
import numpy as np
import time
from options import TrainOptions
from data import create_data_loader, create_dataset
from models import create_model
from models.mvs.mvs_p... | 60,882 | 55.268946 | 392 | py |
pointnerf | pointnerf-master/run/test_ft.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import glob
import copy
import torch
import numpy as np
import time
from options import TrainOptions
from data import create_data_loader, create_dataset
from models import create_model
from models.mvs.mvs_p... | 17,612 | 48.754237 | 331 | py |
pointnerf | pointnerf-master/run/train.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import copy
import torch
import numpy as np
import time
from options import TrainOptions
from data import create_data_loader, create_dataset
from models import create_model
from utils.visualizer import Vis... | 17,776 | 47.438692 | 219 | py |
pointnerf | pointnerf-master/run/visualize.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import copy
import torch
import numpy as np
import time
from options import TestOptions
from data import create_data_loader, create_dataset
from models import create_model
from utils.visualizer import Visu... | 1,721 | 29.75 | 90 | py |
pointnerf | pointnerf-master/run/vis_grow_train.py | import sys
import os
import pathlib
sys.path.append(os.path.join(pathlib.Path(__file__).parent.absolute(), '..'))
import glob
import copy
import torch
import numpy as np
import time
from options import TrainOptions
from data import create_data_loader, create_dataset
from models import create_model
from models.mvs.mvs_p... | 2,394 | 34.746269 | 183 | py |
pointnerf | pointnerf-master/utils/visualizer.py | import numpy as np
import os
from PIL import Image
import shutil
from collections import OrderedDict
import time
import datetime
import torch
import imageio
from utils.util import to8b
from models.mvs.mvs_utils import *
def mse2psnr(x): return -10.* torch.log(x)/np.log(10.)
def save_image(img_array, filepath):
a... | 7,619 | 40.639344 | 101 | py |
pointnerf | pointnerf-master/utils/util.py | from __future__ import print_function
import torch
import numpy as np
from PIL import Image
import os
from torchvision.utils import make_grid
from os.path import join
import torch.nn.functional as F
import matplotlib as mpl
import matplotlib.cm as cm
import matplotlib.pyplot as plt
from scipy.spatial.transform import R... | 2,196 | 30.84058 | 109 | py |
pointnerf | pointnerf-master/utils/spherical.py | import torch
from scipy.special import sph_harm, lpmn, lpmv
from scipy.special import factorial
import numpy as np
import math
import time
class SphericalHarm(object):
def __init__(self, total_deg):
self.total_deg = total_deg
self.orderIds, self.lIds, self.mIds, self.num_at_deg, self.m0inorder, se... | 9,061 | 37.236287 | 129 | py |
pointnerf | pointnerf-master/data/llff_ft_dataset.py | from models.mvs.mvs_utils import read_pfm
import os
import numpy as np
import cv2
from PIL import Image
import torch
from torchvision import transforms as T
import torchvision.transforms.functional as F
from kornia import create_meshgrid
import time
import json
from . import data_utils
import glob
from torch.utils.data... | 30,712 | 39.358739 | 184 | py |
pointnerf | pointnerf-master/data/nerf_synth_ft_dataset.py | from models.mvs.mvs_utils import read_pfm
import os
import numpy as np
import cv2
from PIL import Image
import torch
from torchvision import transforms as T
import torchvision.transforms.functional as F
from kornia import create_meshgrid
import time
import json
from torch.utils.data import Dataset, DataLoader
import t... | 26,636 | 39.055639 | 174 | py |
pointnerf | pointnerf-master/data/dtu_dataset.py | from models.mvs.mvs_utils import read_pfm
import os
import numpy as np
import cv2
from PIL import Image
import torch
from torchvision import transforms as T
import torchvision.transforms.functional as F
from torch.utils.data import Dataset, DataLoader
import torch
import os
from PIL import Image
import h5py
from da... | 28,325 | 41.595489 | 174 | py |
pointnerf | pointnerf-master/data/base_dataset.py | import torch.utils.data as data
from PIL import Image
class BaseDataset(data.Dataset):
def __init__(self):
super(BaseDataset, self).__init__()
def name(self):
return self.__class__.__name__
@staticmethod
def modify_commandline_options(parser, is_train):
return parser
def... | 440 | 20 | 53 | py |
pointnerf | pointnerf-master/data/dtu_ft_dataset.py | from models.mvs.mvs_utils import read_pfm
import os
import numpy as np
import cv2
from PIL import Image
import torch
from torchvision import transforms as T
import torchvision.transforms.functional as F
from kornia import create_meshgrid
import time
import itertools
import random
from torch.utils.data import Dataset, D... | 40,122 | 41.912299 | 174 | py |
pointnerf | pointnerf-master/data/scannet_ft_dataset.py | from models.mvs.mvs_utils import read_pfm
import os
import numpy as np
import cv2
import torch
from torchvision import transforms as T
import torchvision.transforms.functional as F
from kornia import create_meshgrid
import time
import json
from tqdm import tqdm
from torch.utils.data import Dataset, DataLoader
import to... | 32,944 | 43.162198 | 321 | py |
pointnerf | pointnerf-master/data/nerf_synth360_ft_dataset.py | from models.mvs.mvs_utils import read_pfm
import os
import numpy as np
import cv2
from PIL import Image
import torch
from torchvision import transforms as T
import torchvision.transforms.functional as F
from kornia import create_meshgrid
import time
import json
from . import data_utils
from plyfile import PlyData, PlyE... | 30,908 | 40.488591 | 321 | py |
pointnerf | pointnerf-master/data/__init__.py | import importlib
import torch.utils.data
import sys
sys.path.append("../")
from utils.ncg_string import underscore2camelcase
from .base_dataset import BaseDataset
import numpy as np
import time
def find_dataset_class_by_name(name):
'''
Input
name: string with underscore representation
Output
datas... | 2,880 | 31.738636 | 120 | py |
pointnerf | pointnerf-master/data/load_blender.py | import os
import numpy as np
import imageio
import json
import torch
import pickle, random
# trans_t = lambda t : tf.convert_to_tensor([
# [1,0,0,0],
# [0,1,0,0],
# [0,0,1,t],
# [0,0,0,1],
# ], dtype=tf.float32)
#
# rot_phi = lambda phi : tf.convert_to_tensor([
# [1,0,0,0],
# [0,tf.cos(phi),-t... | 3,956 | 29.206107 | 166 | py |
pointnerf | pointnerf-master/data/tt_ft_dataset.py | from models.mvs.mvs_utils import read_pfm
import os
import numpy as np
import cv2
from PIL import Image
import torch
from torchvision import transforms as T
import torchvision.transforms.functional as F
from kornia import create_meshgrid
import time
import json
from . import data_utils
from plyfile import PlyData, PlyE... | 31,438 | 39.82987 | 175 | py |
variational_dropout | variational_dropout-master/train.py | import argparse
import torch as t
import torch.nn as nn
import torchvision.transforms as transforms
from tensorboardX import SummaryWriter
from torch.autograd import Variable
from torch.optim import Adam
from torchvision import datasets
from models import *
if __name__ == "__main__":
parser = argparse.ArgumentP... | 4,518 | 39.348214 | 120 | py |
variational_dropout | variational_dropout-master/models/dropout_model.py | import torch.nn as nn
import torch.nn.functional as F
class DropoutModel(nn.Module):
def __init__(self):
super(DropoutModel, self).__init__()
self.fc = nn.ModuleList([
nn.Linear(784, 500),
nn.Linear(500, 50),
nn.Linear(50, 10)
])
def forward(self, ... | 1,009 | 27.857143 | 96 | py |
variational_dropout | variational_dropout-master/models/simple_model.py | import torch.nn as nn
import torch.nn.functional as F
class SimpleModel(nn.Module):
def __init__(self):
super(SimpleModel, self).__init__()
self.fc = nn.Sequential(
nn.Linear(784, 500),
nn.ELU(),
nn.Linear(500, 50),
nn.ELU(),
nn.Linear(5... | 744 | 24.689655 | 96 | py |
variational_dropout | variational_dropout-master/models/variational_dropout_model.py | import torch.nn as nn
import torch.nn.functional as F
from variational_dropout.variational_dropout import VariationalDropout
class VariationalDropoutModel(nn.Module):
def __init__(self):
super(VariationalDropoutModel, self).__init__()
self.fc = nn.ModuleList([
VariationalDropout(784,... | 1,648 | 31.333333 | 111 | py |
variational_dropout | variational_dropout-master/variational_dropout/variational_dropout.py | import math
import torch as t
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from torch.nn.parameter import Parameter
class VariationalDropout(nn.Module):
def __init__(self, input_size, out_size, log_sigma2=-10, threshold=3):
"""
:param input_size: An in... | 2,575 | 31.2 | 111 | py |
P3O | P3O-main/baselines/run.py | import sys
import re
import multiprocessing
import os.path as osp
import gym
from collections import defaultdict
import tensorflow as tf
import numpy as np
from baselines.common.vec_env import VecFrameStack, VecNormalize, VecEnv
from baselines.common.vec_env.vec_video_recorder import VecVideoRecorder
from baselines.co... | 8,357 | 29.50365 | 176 | py |
DeepForcedAligner | DeepForcedAligner-main/scratch_pred.py | import argparse
import numpy as np
import torch
from dfa.audio import Audio
from dfa.duration_extraction import extract_durations_with_dijkstra, extract_durations_beam
from dfa.model import Aligner
from dfa.text import Tokenizer
from dfa.utils import read_metafile
from dfa.utils import read_config
from dfa.paths impo... | 2,103 | 34.661017 | 103 | py |
DeepForcedAligner | DeepForcedAligner-main/extract_durations.py | import argparse
from multiprocessing import cpu_count
from multiprocessing.pool import Pool
from pathlib import Path
from typing import Tuple
import numpy as np
import torch
import tqdm
from dfa.dataset import new_dataloader
from dfa.duration_extraction import extract_durations_with_dijkstra, extract_durations_beam
f... | 4,546 | 45.397959 | 111 | py |
DeepForcedAligner | DeepForcedAligner-main/train.py | import argparse
import torch
from torch import optim
from dfa.model import Aligner
from dfa.paths import Paths
from dfa.utils import read_config, unpickle_binary
from trainer import Trainer
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Preprocessing for DeepForcedAligner.')
parser.a... | 2,128 | 45.282609 | 107 | py |
DeepForcedAligner | DeepForcedAligner-main/preprocess.py | import argparse
from multiprocessing import cpu_count
from multiprocessing.pool import Pool
from pathlib import Path
from typing import Dict, Union
import numpy as np
import tqdm
from dfa.audio import Audio
from dfa.paths import Paths
from dfa.text import Tokenizer
from dfa.utils import get_files, read_config, pickle... | 3,446 | 39.081395 | 105 | py |
DeepForcedAligner | DeepForcedAligner-main/trainer.py | import numpy as np
import torch
import tqdm
from torch.nn import CTCLoss
from torch.optim import Adam
from torch.utils.tensorboard import SummaryWriter
from dfa.dataset import new_dataloader, get_longest_mel_id
from dfa.duration_extraction import extract_durations_with_dijkstra
from dfa.model import Aligner
from dfa.p... | 4,759 | 45.666667 | 113 | py |
DeepForcedAligner | DeepForcedAligner-main/dfa/utils.py | import pickle
import os
from pathlib import Path
from typing import Dict, List, Any, Union
import torch
import yaml
def read_metafile(path: str, folder, dur_path) -> Dict[str, str]:
text_dict = {}
txt_files = []
audio_files = []
print(path)
for filename in os.listdir(folder):
if filename.... | 2,358 | 33.188406 | 93 | py |
DeepForcedAligner | DeepForcedAligner-main/dfa/model.py | import torch
import torch.nn as nn
class BatchNormConv(nn.Module):
def __init__(self, in_channels: int, out_channels: int, kernel_size: int):
super().__init__()
self.conv = nn.Conv1d(
in_channels, out_channels, kernel_size,
stride=1, padding=kernel_size // 2, bias=False)
... | 1,868 | 29.639344 | 90 | py |
DeepForcedAligner | DeepForcedAligner-main/dfa/dataset.py | from pathlib import Path
from random import Random
from typing import List
import numpy as np
import torch
from torch.nn.utils.rnn import pad_sequence
from torch.utils.data.dataloader import DataLoader
from torch.utils.data.dataset import Dataset
from torch.utils.data.sampler import Sampler
from dfa.utils import unpi... | 3,653 | 36.670103 | 93 | py |
trx | trx-main/video_reader.py | import torch
from torchvision import datasets, transforms
from PIL import Image
import os
import zipfile
import io
import numpy as np
import random
import re
import pickle
from glob import glob
from videotransforms.video_transforms import Compose, Resize, RandomCrop, RandomRotation, ColorJitter, RandomHorizontalFlip, ... | 12,944 | 36.850877 | 207 | py |
trx | trx-main/utils.py | import torch
import torch.nn.functional as F
import os
import math
from enum import Enum
import sys
class TestAccuracies:
"""
Determines if an evaluation on the validation set is better than the best so far.
In particular, this handles the case for meta-dataset where we validate on multiple datasets and w... | 6,529 | 37.639053 | 126 | py |
trx | trx-main/model.py | import torch
import torch.nn as nn
from collections import OrderedDict
from utils import split_first_dim_linear
import math
from itertools import combinations
from torch.autograd import Variable
import torchvision.models as models
NUM_SAMPLES=1
class PositionalEncoding(nn.Module):
"Implement the PE function."
... | 9,264 | 38.935345 | 140 | py |
trx | trx-main/run.py | import torch
import numpy as np
import argparse
import os
import pickle
from utils import print_and_log, get_log_files, TestAccuracies, loss, aggregate_accuracy, verify_checkpoint_dir, task_confusion
from model import CNN_TRX
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # Quiet TensorFlow warnings
import tensorflow as tf
... | 13,447 | 47.901818 | 168 | py |
trx | trx-main/videotransforms/stack_transforms.py | import numpy as np
import PIL
import torch
from videotransforms.utils import images as imageutils
class ToStackedTensor(object):
"""Converts a list of m (H x W x C) numpy.ndarrays in the range [0, 255]
or PIL Images to a torch.FloatTensor of shape (m*C x H x W)
in the range [0, 1.0]
"""
def __in... | 1,699 | 33 | 80 | py |
trx | trx-main/videotransforms/volume_transforms.py | import numpy as np
from PIL import Image
import torch
from videotransforms.utils import images as imageutils
class ClipToTensor(object):
"""Convert a list of m (H x W x C) numpy.ndarrays in the range [0, 255]
to a torch.FloatTensor of shape (C x m x H x W) in the range [0, 1.0]
"""
def __init__(self... | 2,152 | 30.202899 | 81 | py |
trx | trx-main/videotransforms/functional.py | import numbers
#import cv2
import numpy as np
import PIL
#from skimage.transform import resize
import torchvision
def crop_clip(clip, min_h, min_w, h, w):
if isinstance(clip[0], np.ndarray):
cropped = [img[min_h:min_h + h, min_w:min_w + w, :] for img in clip]
elif isinstance(clip[0], PIL.Image.Image... | 2,493 | 32.702703 | 76 | py |
trx | trx-main/videotransforms/video_transforms.py | import numbers
import random
#import cv2
from matplotlib import pyplot as plt
import numpy as np
import PIL
import scipy
import torch
import torchvision
from . import functional as F
class Compose(object):
"""Composes several transforms
Args:
transforms (list of ``Transform`` objects): list of transfor... | 13,108 | 31.44802 | 119 | py |
DDoS | DDoS-master/analyse_dataset.py | import argparse
import logging
import math
import os
import random
import statistics
import sys
import numpy as np
import pandas as pd
import torch
import torch.autograd.profiler as profiler
import torch.nn.functional as F
from torch.cuda.amp import autocast
from torch.utils.tensorboard import SummaryWriter
from tqdm ... | 18,510 | 58.330128 | 239 | py |
DDoS | DDoS-master/train_DDoS_baseline_nondyn.py | import argparse
import logging
import math
import os
import random
import statistics
import sys
import numpy as np
import torch
import torch.autograd.profiler as profiler
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchio as tio
from torch.cuda.amp import GradScaler, autoc... | 26,386 | 53.972917 | 230 | py |
DDoS | DDoS-master/apply_DDoS_baseline.py | import argparse
import logging
import math
import os
import random
import statistics
import sys
import numpy as np
import pandas as pd
import torch
import torch.autograd.profiler as profiler
import torch.nn.functional as F
from torch.cuda.amp import autocast
from torch.utils.tensorboard import SummaryWriter
from tqdm ... | 20,417 | 59.587537 | 239 | py |
DDoS | DDoS-master/apply_DDoS.py | import argparse
import logging
import math
import os
import random
import statistics
import sys
import numpy as np
import pandas as pd
import torch
import torch.autograd.profiler as profiler
import torch.nn.functional as F
from torch.cuda.amp import autocast
from torch.utils.tensorboard import SummaryWriter
from tqdm ... | 21,258 | 59.566952 | 240 | py |
DDoS | DDoS-master/train_DDoS_baseline.py | import argparse
import logging
import math
import os
import random
import statistics
import sys
import numpy as np
import torch
import torch.autograd.profiler as profiler
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchio as tio
from torch.cuda.amp import GradScaler, autoc... | 26,396 | 53.99375 | 230 | py |
DDoS | DDoS-master/train_DDoS.py | import argparse
import logging
import math
import os
import random
import statistics
import sys
import numpy as np
import torch
import torch.autograd.profiler as profiler
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchio as tio
from torch.cuda.amp import GradScaler, autoc... | 26,365 | 53.929167 | 230 | py |
DDoS | DDoS-master/models/unet3DMSS.py | # Adapted from https://discuss.pytorch.org/t/unet-implementation/426
import torch
from torch import nn
import torch.nn.functional as F
import torchcomplex.nn.functional as cF
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany... | 7,232 | 38.961326 | 128 | py |
DDoS | DDoS-master/models/SRCNN3Dv3.py | import numpy as np
import torch
import torch.nn as nn
__author__ = "Soumick Chatterjee, Geetha Doddapaneni Gopinath"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Soumick Chatterjee", "Geetha Doddapaneni Gopinath"]
__license__ = "GPL"
__v... | 5,034 | 53.728261 | 165 | py |
DDoS | DDoS-master/models/densenet.py | # Source: https://github.com/kenshohara/3D-ResNets-PyTorch/blob/master/models/densenet.py
# Paper Ref: https://arxiv.org/abs/2004.04968
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of ... | 7,339 | 37.631579 | 114 | py |
DDoS | DDoS-master/models/SRCNN3D.py | import numpy as np
import torch
import torch.nn as nn
__author__ = "Soumick Chatterjee, Geetha Doddapaneni Gopinath"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Soumick Chatterjee", "Geetha Doddapaneni Gopinath"]
__license__ = "GPL"
__v... | 4,427 | 56.506494 | 125 | py |
DDoS | DDoS-master/models/brokenconv.py | import numpy as np
import torch
import torch.nn as nn
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Soumick Chatterjee"]
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "Soumick Chatterjee"
__e... | 2,300 | 37.35 | 111 | py |
DDoS | DDoS-master/models/SRCNN3Dv2.py | import numpy as np
import torch
import torch.nn as nn
__author__ = "Soumick Chatterjee, Geetha Doddapaneni Gopinath"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Soumick Chatterjee", "Geetha Doddapaneni Gopinath"]
__license__ = "GPL"
__v... | 4,709 | 51.921348 | 135 | py |
DDoS | DDoS-master/models/unet3D_DeepSup.py | # from __future__ import print_function, division
import torch
import torch.nn as nn
import torch.utils.data
__author__ = "Kartik Prabhu, Mahantesh Pattadkal, and Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Kartik P... | 5,263 | 29.783626 | 110 | py |
DDoS | DDoS-master/models/ThisNewNet.py | import math
import torch.nn as nn
from models import *
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Soumick Chatterjee"]
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "Soumick Chatterjee"
__... | 2,283 | 46.583333 | 218 | py |
DDoS | DDoS-master/models/unet3D.py | # Adapted from https://discuss.pytorch.org/t/unet-implementation/426
import torch
from torch import nn
import torch.nn.functional as F
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Soumick Chatterjee", "... | 5,245 | 38.443609 | 128 | py |
DDoS | DDoS-master/models/ReconResNet.py | #!/usr/bin/env python
import torch.nn as nn
from tricorder.torch.transforms import Interpolator
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Soumick Chatterjee & OvGU:ESF:MEMoRIAL"
__credits__ = ["Soumick Chatterjee"]
__license__ = "GPL"
__version__ = "1.0.0"
__email__ = "soumick.chatterjee@ovg... | 9,909 | 36.537879 | 257 | py |
DDoS | DDoS-master/models/unet3DvSeg_DeepSup.py | # from __future__ import print_function, division
import torch
import torch.nn as nn
import torch.utils.data
__author__ = "Kartik Prabhu, Mahantesh Pattadkal, and Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Kartik P... | 5,263 | 29.783626 | 110 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.