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 |
|---|---|---|---|---|---|---|
nepali-ner | nepali-ner-master/utils/dataloader.py | #!/usr/bin/env python3
'''
NER Dataloader
Author: Oyesh Mann Singh
Date: 10/14/2019
Data format:
<WORD> <NER-tag>
'''
import os
import numpy as np
import pickle
import torch
from torchtext import data
from torchtext import vocab
from torchtext.datasets import SequenceTaggingDataset
from un... | 6,000 | 34.720238 | 116 | py |
nepali-ner | nepali-ner-master/utils/eval.py | '''
Writes result into the file
Author: Oyesh Mann Singh
'''
import os
import torch
from tqdm import tqdm
import utils.conlleval_perl as e
tqdm.pandas(desc='Progress')
class Evaluator:
def __init__(self, config, logger, model, dataloader, model_name):
self.config = config
self.logger = l... | 5,892 | 34.5 | 112 | py |
frozen-in-time | frozen-in-time-main/test.py | import argparse
import pandas as pd
import torch
import transformers
from sacred import Experiment
from tqdm import tqdm
import glob
import data_loader.data_loader as module_data
import model.metric as module_metric
import model.model as module_arch
from model.model import compute_similarity
from parse_config import C... | 11,571 | 39.603509 | 160 | py |
frozen-in-time | frozen-in-time-main/trainer/trainer.py | import numpy as np
import torch
from torch import nn
from tqdm.auto import tqdm
from base import BaseTrainer
from model.model import sim_matrix
from utils import inf_loop
class Trainer(BaseTrainer):
"""
Trainer class
Note:
Inherited from BaseTrainer.
"""
def __init__(self, model, loss, ... | 10,116 | 43.179039 | 119 | py |
frozen-in-time | frozen-in-time-main/data_loader/transforms.py | from torchvision import transforms
def init_transform_dict(input_res=224,
center_crop=256,
randcrop_scale=(0.5, 1.0),
color_jitter=(0, 0, 0),
norm_mean=(0.485, 0.456, 0.406),
norm_std=(0.229, 0.224,... | 1,160 | 35.28125 | 112 | py |
frozen-in-time | frozen-in-time-main/logger/visualization.py | import importlib
from utils import Timer
class TensorboardWriter:
def __init__(self, log_dir, logger, enabled):
self.writer = None
self.selected_module = ""
if enabled:
log_dir = str(log_dir)
# Retrieve visualization writer.
for module in ["torch.util... | 2,909 | 35.375 | 120 | py |
frozen-in-time | frozen-in-time-main/base/base_model.py | import torch.nn as nn
import numpy as np
from abc import abstractmethod
class BaseModel(nn.Module):
"""
Base class for all models
"""
@abstractmethod
def forward(self, *inputs):
"""
Forward pass logic
:return: Model output
"""
raise NotImplementedError
... | 646 | 23.884615 | 79 | py |
frozen-in-time | frozen-in-time-main/base/base_trainer.py | from abc import abstractmethod
import torch
from numpy import inf
class BaseTrainer:
"""
Base class for all trainers
"""
def __init__(self, model, loss, metrics, optimizer, config, writer=None, init_val=False):
self.config = config
self.logger = config.get_logger('trainer', config['tr... | 9,470 | 38.962025 | 117 | py |
frozen-in-time | frozen-in-time-main/base/base_dataset.py | import os
import random
from abc import abstractmethod
import av
import cv2
import decord
import numpy as np
import torch
from PIL import Image
from torch.utils.data import Dataset, get_worker_info
from torchvision import transforms
class TextVideoDataset(Dataset):
def __init__(self,
dataset_nam... | 8,634 | 35.434599 | 116 | py |
frozen-in-time | frozen-in-time-main/base/base_data_loader.py | import numpy as np
from torch.utils.data import DataLoader
from torch.utils.data.dataloader import default_collate
from torch.utils.data.sampler import SubsetRandomSampler
class BaseDataLoader(DataLoader):
"""
Base class for all data loaders
"""
def __init__(self, dataset, batch_size, shuffle, validat... | 3,447 | 30.633028 | 130 | py |
frozen-in-time | frozen-in-time-main/utils/custom_transforms.py | import numbers
from typing import List, Tuple
import torch
from torch import Tensor
from torchvision.transforms import functional_pil as F_pil, functional_tensor as F_t
from torchvision.transforms.functional import center_crop, crop
def _get_image_size(img: Tensor) -> List[int]:
"""Returns image size as [w, h]
... | 4,569 | 33.360902 | 109 | py |
frozen-in-time | frozen-in-time-main/utils/video.py | import random
import cv2
import numpy as np
import torch
def load_frames_from_video_path(path, num_frames, sample='rand'):
cap = cv2.VideoCapture(path)
assert (cap.isOpened())
vlen = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
acc_samples = min(num_frames, vlen)
intervals = np.linspace(start=0, stop=v... | 1,264 | 29.853659 | 80 | py |
frozen-in-time | frozen-in-time-main/utils/visualisation.py | import matplotlib
import numpy as np
import torch
matplotlib.use('Agg')
def visualise_path(pred, target, window):
"""
:param pred: (P, 2) Tensor where P is the number of predictions, and 2 is the (i,j) coordinate
:param target: (T, 2) Tensor where T is the number of targets, and 2 is the (i,j) coordinate... | 1,768 | 28.983051 | 104 | py |
frozen-in-time | frozen-in-time-main/utils/visualizer.py | """A simple HTML visualizer.
It is based on the Cycle-GAN codebase:
https://github.com/junyanz/pytorch-CycleGAN-and-pix2pix
"""
import os
from pathlib import Path
import numpy as np
from . import html
class RetrievalVis:
"""This class includes several functions that can display/save images.
It uses a Pyth... | 6,109 | 36.030303 | 89 | py |
frozen-in-time | frozen-in-time-main/model/loss.py | import torch
import torch.nn.functional as F
from torch import nn
class NormSoftmaxLoss(nn.Module):
def __init__(self, temperature=0.05):
super().__init__()
self.temperature = temperature
def forward(self, x):
"Assumes input x is similarity matrix of N x M \in [-1, 1], computed using... | 2,813 | 27.424242 | 132 | py |
frozen-in-time | frozen-in-time-main/model/model.py | import timm
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers import AutoModel
from base import BaseModel
from model.video_transformer import SpaceTimeTransformer
from utils.util import state_dict_data_parallel_fix
class FrozenInTime(BaseModel):
def __init__(self,
... | 7,958 | 43.463687 | 116 | py |
frozen-in-time | frozen-in-time-main/model/video_transformer.py | """
Implementations of Video Transformers in PyTorch
A PyTorch implementation of space-time transformer as described in
'Frozen in Time: A Joint Image and Video Encoder for End-to-End Retrieval' - https://arxiv.org/abs/2104.00650
A PyTorch implementation of timesformer as described in
'Is Space-Time Attention All You... | 14,164 | 40.784661 | 145 | py |
frozen-in-time | frozen-in-time-main/model/metric.py | """Module for computing performance metrics
"""
from pathlib import Path
import numpy as np
import scipy.stats
import torch
def t2v_metrics(sims, query_masks=None):
"""Compute retrieval metrics from a similarity matrix.
Args:
sims (th.Tensor): N x M matrix of similarities between embeddings, where
... | 14,381 | 38.839335 | 93 | py |
corrfitter | corrfitter-master/doc/source/conf.py | # -*- coding: utf-8 -*-
#
# corrfitter documentation build configuration file, created by
# sphinx-quickstart on Thu Jan 14 23:21:34 2010.
#
# 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
# autogenerated file.
#
# ... | 6,976 | 32.382775 | 81 | py |
deepgoplus-stability | deepgoplus-stability-master/modified_files/main.py | #!/usr/bin/env python
import os
from threadpoolctl import threadpool_limits, threadpool_info
import click as ck
import numpy as np
import pandas as pd
from tensorflow.keras.models import load_model
from subprocess import Popen, PIPE
import time
from utils import Ontology, NAMESPACES
from aminoacids import to_onehot
im... | 9,185 | 37.596639 | 109 | py |
torchTT | torchTT-main/setup.py | from setuptools import setup, Extension
import platform
logo_ascii = """
_ _ _____ _____
| |_ ___ _ __ ___| |_|_ _|_ _|
| __/ _ \| '__/ __| '_ \| | | |
| || (_) | | | (__| | | | | | |
\__\___/|_| \___|_| |_|_| |_|
"""
try:
from torc... | 1,847 | 27.875 | 156 | py |
torchTT | torchTT-main/conf.py | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... | 4,105 | 36.669725 | 107 | py |
torchTT | torchTT-main/examples/random_tt.py | #%% Imports
import torch as tn
import torchtt as tntt
#%% Variance 1.0
x = tntt.randn([30]*5,[1,8,16,16,8,1])
x_full = x.full()
print('Var = ',tn.std(x_full).numpy()**2,' (has to be comparable to 1.0)')
#%% Variance 4.0
x = tntt.randn([30]*5,[1,8,16,16,8,1],var = 4.0)
x_full = x.full()
print('Var = ',tn.std(x_full).... | 708 | 28.541667 | 75 | py |
torchTT | torchTT-main/examples/automatic_differentiation.py | """
# Automatic differentiation
Being based on `pytorch`, `torchtt` can handle automatic differentiation with respect to the TT cores.
"""
#%% Imports
import torch as tn
import torchtt as tntt
#%% First, a function to differentiate is created and some tensors:
N = [2,3,4,5]
A = tntt.randn([(n,n) for n in N],[1]+[2]... | 1,353 | 33.717949 | 203 | py |
torchTT | torchTT-main/examples/system_solvers.py | """
Linear solvers in the TT format
This tutorial addresses solving multilinear systems $\mathsf{Ax}=\mathsf{b}$ in the TT format.
"""
#%% Imports
import torch as tn
import torchtt as tntt
import datetime
#%% Small example
# A random tensor operator $\mathsf{A}$ is created in the TT format. We create a random rig... | 2,835 | 34.898734 | 188 | py |
torchTT | torchTT-main/examples/tensor_completion.py | #%% Imports
import torchtt as tntt
import torch as tn
import numpy as np
import datetime
#%% Preparation
# create a random tensor
N = 20
target = tntt.random([N]*4,[1,4,5,3,1])
Xs = tntt.meshgrid([tn.linspace(0,1,N, dtype = tn.float64)]*4)
target = Xs[0]+1+Xs[1]+Xs[2]+Xs[3]+Xs[0]*Xs[1]+Xs[1]*Xs[2]+tntt.TT(tn.sin(Xs[0... | 2,005 | 28.5 | 138 | py |
torchTT | torchTT-main/examples/basic_nn.py | #!/usr/bin/env python
# coding: utf-8
#%% Tensor Train layers for neural networks
# In this section, the TT layers are introduced.
# Imports:
import torch as tn
import torch.nn as nn
import datetime
import torchtt as tntt
#%% We consider a linear layer $\mathcal{LTT}(\mathsf{x}) = \mathsf{Wx}+\mathsf{b}$ acting on a... | 4,041 | 42.462366 | 534 | py |
torchTT | torchTT-main/examples/mnist_nn.py | #!/usr/bin/env python
# coding: utf-8
#%% Digit recognition using TT neural networks
# The TT layer is applied to the MNIST dataset.
# Imports:
import torch as tn
import torch.nn as nn
import torchtt as tntt
from torch import optim
from torchvision import datasets
from torchvision.transforms import ToTensor
from torch... | 2,759 | 31.470588 | 167 | py |
torchTT | torchTT-main/examples/cuda.py | """
# GPU acceleration
The package `torchtt` can use the built-in GPU acceleration from `pytorch`.
"""
#%% Imports and check if any CUDA device is available.
import datetime
import torch as tn
try:
import torchtt as tntt
except:
print('Installing torchTT...')
# %pip install git+https://github.com/ion-g-i... | 3,398 | 30.472222 | 145 | py |
torchTT | torchTT-main/examples/basic_tutorial.py | """
Basic tutorial
This notebook is a tutorial on how to use the basic functionalities of the `torchtt` package.
"""
#%% Imports
import torch as tn
import torchtt as tntt
#%% Decomposition of a full tensor in TT format
# We now create a 4d `torch.tensor` which we will use later
tens_full = tn.reshape(tn.arange(... | 6,346 | 48.976378 | 491 | py |
torchTT | torchTT-main/examples/cross_interpolation.py | """
# Cross approximation in the TT format
Using the `torchtt.TT` constructor, a TT decomposition of a given tensor can be obtained.
However, in the cases where the entries of the tensor are computed using a given function, building full tensors becomes unfeasible.
It is possible to construct a TT decomposition usin... | 4,130 | 66.721311 | 389 | py |
torchTT | torchTT-main/examples/manifold.py |
import torch as tn
import torchtt as tntt
N = [10,11,12,13,14]
Rt = [1,3,4,5,6,1]
Rx = [1,6,6,6,6,1]
target = tntt.randn(N,Rt).round(0)
func = lambda x: 0.5*(x-target).norm(True)
x0 = tntt.randn(N,Rx)
x =x0.clone()
for i in range(20):
# compute riemannian gradient using AD
gr = tntt.manifold.riemannian... | 746 | 19.189189 | 80 | py |
torchTT | torchTT-main/examples/efficient_linalg.py | """
# AMEN and DMRG for fast TT operations
The torchtt package includes DMRG and AMEN schemes for fast matrix vector product and elementwise inversion in the TT format.
"""
#%% Imports
import torch as tn
import torchtt as tntt
import datetime
#%% Efficient matrix vector product
# When performing the multiplication ... | 3,337 | 42.921053 | 217 | py |
torchTT | torchTT-main/examples/basic_linalg.py | """
# Basic linear algebra in torchTT
This notebook is an introduction into the basic linar algebra operations that can be perfromed using the `torchtt` package.
The basic operations such as +,-,*,@,norm,dot product can be performed between `torchtt.TT` instances without computing the full format by computing the TT ... | 6,009 | 44.530303 | 299 | py |
torchTT | torchTT-main/tests/test_decomposition.py | import unittest
import torchtt as tntt
import torch as tn
import numpy as np
err_rel = lambda t, ref : tn.linalg.norm(t-ref).numpy() / tn.linalg.norm(ref).numpy() if ref.shape == t.shape else np.inf
class TestDecomposition(unittest.TestCase):
basic_dtype = tn.complex128
def test_init(self):
"""
... | 9,242 | 37.836134 | 241 | py |
torchTT | torchTT-main/tests/test_solvers.py | """
Test the multilinear solvers.
"""
import unittest
import torchtt
import torch as tn
import numpy as np
err_rel = lambda t, ref : tn.linalg.norm(t-ref).numpy() / tn.linalg.norm(ref).numpy() if ref.shape == t.shape else np.inf
class TestSolvers(unittest.TestCase):
basic_dtype = tn.complex128... | 4,164 | 41.938144 | 122 | py |
torchTT | torchTT-main/tests/test_algebra_2.py | """
Test the advanced multilinear algebra operations between torchtt.TT objects.
Some operations (matvec for large ranks and elemntwise division) can be only computed using optimization (AMEN and DMRG).
"""
import unittest
import torchtt as tntt
import torch as tn
import numpy as np
err_rel = lambda t, ref : tn.linal... | 3,746 | 31.868421 | 122 | py |
torchTT | torchTT-main/tests/test_ad.py | """
Test all the AD related functions.
@author: ion
"""
import torch as tn
import torchtt
import unittest
err_rel = lambda t, ref : tn.linalg.norm(t-ref).numpy() / tn.linalg.norm(ref).numpy() if ref.shape == t.shape else np.inf
class TestAD(unittest.TestCase):
def test_manifold(self):
"""
Com... | 3,188 | 34.831461 | 151 | py |
torchTT | torchTT-main/tests/test_linalg.py | """
Test the basic multilinear algebra operations between torchtt.TT objects.
"""
import unittest
import torchtt as tntt
import torch as tn
import numpy as np
err_rel = lambda t, ref : (tn.linalg.norm(t-ref).numpy() / tn.linalg.norm(ref).numpy() if tn.linalg.norm(ref).numpy()>0 else tn.linalg.norm(t-ref).numpy() ) if... | 23,011 | 38.00339 | 244 | py |
torchTT | torchTT-main/tests/test_cross.py | """
Test the cross approximation method.
"""
import unittest
import torchtt as tntt
import torch as tn
import numpy as np
err_rel = lambda t, ref : tn.linalg.norm(t-ref).numpy() / tn.linalg.norm(ref).numpy() if ref.shape == t.shape else np.inf
class TestCrossApproximation(unittest.TestCase):
def test_dmrg_... | 1,972 | 36.226415 | 122 | py |
torchTT | torchTT-main/torchtt/_dmrg.py | """
DMRG implementation for fast matvec product.
Inspired by TT-Toolbox from MATLAB.
@author: ion
"""
import torchtt
import torch as tn
from torchtt._decomposition import rank_chop, QR, SVD
import datetime
import opt_einsum as oe
try:
import torchttcpp
_flag_use_cpp = True
except:
import warnings
war... | 16,355 | 42.384615 | 171 | py |
torchTT | torchTT-main/torchtt/_aux_ops.py | """
Additional operations.
@author: ion
"""
import torch as tn
def apply_mask(cores, R, indices):
"""
compute the entries
Args:
cores ([type]): [description]
R ([type]): [description]
indices ([type]): [description]
"""
d = len(cores)
dt = cores[0].dtype
M = len(... | 2,198 | 25.817073 | 135 | py |
torchTT | torchTT-main/torchtt/errors.py | """
Contains the errors used in the `torchtt` package.
"""
class ShapeMismatch(Exception):
"""The shape of the tensors does not match.
This means that the inputs have shapes that do not match.
"""
pass
class RankMismatch(Exception):
"""The TT-ranks do not match.
This means that t... | 720 | 23.033333 | 96 | py |
torchTT | torchTT-main/torchtt/nn.py | """
Implements a basic TT layer for constructing deep TT networks.
"""
import torch as tn
import torch.nn as nn
import torchtt
from ._aux_ops import dense_matvec
from .errors import *
class LinearLayerTT(nn.Module):
"""
Basic class for TT layers. See `Tensorizing Neural Networks <https://arxiv.org/abs/1509.0... | 3,607 | 41.447059 | 222 | py |
torchTT | torchTT-main/torchtt/_extras.py | """
This file implements additional functions that are visible in the module.
"""
import torch as tn
import torch.nn.functional as tnf
from torchtt._decomposition import mat_to_tt, to_tt, lr_orthogonal, round_tt, rl_orthogonal, QR, SVD, rank_chop
from torchtt._division import amen_divide
import numpy as np
import ma... | 37,410 | 37.291709 | 202 | py |
torchTT | torchTT-main/torchtt/manifold.py | """
Manifold gradient module.
"""
import torch as tn
from torchtt._decomposition import mat_to_tt, to_tt, lr_orthogonal, round_tt, rl_orthogonal
from . import TT
from torchtt.errors import *
def _delta2cores(tt_cores, R, Sds, is_ttm = False, ortho = None):
"""
Convert the detla notation to TT.
Implements... | 5,672 | 31.603448 | 138 | py |
torchTT | torchTT-main/torchtt/__init__.py |
r"""
Provides Tensor-Train (TT) decomposition using `pytorch` as backend.
Contains routines for computing the TT decomposition and all the basisc linear algebra in the TT format. Additionally, GPU support can be used thanks to the `pytorch` backend.
It also has linear solvers in TT and cross approximation as well ... | 1,287 | 46.703704 | 264 | py |
torchTT | torchTT-main/torchtt/_decomposition.py | """
Basic decomposition and orthogonalization.
@author: ion
"""
import torch as tn
import numpy as np
def QR(mat):
"""
Compute the QR decomposition. Backend can be changed.
Parameters
----------
mat : tn array
DESCRIPTION.
Returns
-------
Q : the Q matrix
R : t... | 10,713 | 25.324324 | 188 | py |
torchTT | torchTT-main/torchtt/_division.py | """
Elementwise division using AMEN
@author: ion
"""
import torch as tn
import numpy as np
import datetime
from torchtt._decomposition import QR, SVD, rl_orthogonal, lr_orthogonal
from torchtt._iterative_solvers import BiCGSTAB_reset, gmres_restart
import opt_einsum as oe
def local_product(Phi_right, Phi_left, coreA,... | 20,269 | 41.494759 | 203 | py |
torchTT | torchTT-main/torchtt/_tt_base.py | """
This file implements the core TT class.
"""
import torch as tn
import torch.nn.functional as tnf
from torchtt._decomposition import mat_to_tt, to_tt, lr_orthogonal, round_tt, rl_orthogonal, QR, SVD, rank_chop
from torchtt._division import amen_divide
import numpy as np
import math
from torchtt._dmrg import dmrg_... | 64,632 | 42.818983 | 237 | py |
torchTT | torchTT-main/torchtt/_torchtt.py | """
Basic class for TT decomposition.
It contains the base TT class as well as additional functions.
The TT class implements tensors in the TT format as well as tensors operators in TT format. Once in the TT format, linear algebra operations (`+`, `-`, `*`, `@`, `/`) can be performed without resorting to the full forma... | 97,941 | 40.448159 | 297 | py |
torchTT | torchTT-main/torchtt/solvers.py | """
System solvers in the TT format.
"""
import torch as tn
import numpy as np
import torchtt
import datetime
from torchtt._decomposition import QR, SVD, lr_orthogonal, rl_orthogonal
from torchtt._iterative_solvers import BiCGSTAB_reset, gmres_restart
import opt_einsum as oe
from .errors import *
try:
import tor... | 30,074 | 44.022455 | 269 | py |
torchTT | torchTT-main/torchtt/grad.py | """
Adds AD functionality to torchtt.
"""
import torch as tn
from torchtt import TT
def watch(tens, core_indices = None):
"""
Watch the TT-cores of a given tensor.
Necessary for autograd.
Args:
tens (torchtt.TT): the TT-object to be watched.
core_indices (list[int], optional): Th... | 2,852 | 30.01087 | 154 | py |
torchTT | torchTT-main/torchtt/_iterative_solvers.py | """
Contains iteratiove solvers like GMRES and BiCGSTAB
@author: ion
"""
import torch as tn
import datetime
import numpy as np
def BiCGSTAB(Op, rhs, x0, eps=1e-6, nmax = 40):
pass
def BiCGSTAB_reset(Op,rhs,x0,eps=1e-6,nmax=40):
"""
BiCGSTAB solver.
"""
# initial residual
r = rhs - Op.matvec... | 5,472 | 26.094059 | 138 | py |
torchTT | torchTT-main/torchtt/interpolate.py | """
Implements the cross approximation methods (DMRG).
"""
import torch as tn
import numpy as np
import torchtt
import datetime
from torchtt._decomposition import QR, SVD, rank_chop, lr_orthogonal, rl_orthogonal
from torchtt._iterative_solvers import BiCGSTAB_reset, gmres_restart
import opt_einsum as oe
def _LU(M):... | 29,837 | 43.139053 | 399 | py |
torchTT | torchTT-main/torchtt/cpp.py | """
Module for the C++ backend.
"""
import warnings
try:
import torchttcpp
_cpp_available = True
except:
warnings.warn("\x1B[33m\nC++ implementation not available. Using pure Python.\n\033[0m")
_cpp_available = False
def cpp_avaible():
"""
Return True if C++ backend is available.
Re... | 430 | 16.958333 | 92 | py |
plotnine | plotnine-main/doc/conf.py | #
# plotnine documentation build configuration file, created by
# sphinx-quickstart on Wed Dec 23 22:32:29 2015.
#
# 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
# autogenerated file.
#
# All configuration values... | 15,504 | 29.581854 | 79 | py |
VQA_LSTM_CNN | VQA_LSTM_CNN-master/prepro.py | """
Preoricess a raw json dataset into hdf5/json files.
Caption: Use spaCy or NLTK or split function to get tokens.
"""
import copy
from random import shuffle, seed
import sys
import os.path
import argparse
import glob
import numpy as np
from scipy.misc import imread, imresize
import scipy.io
import pdb
import string... | 9,689 | 35.156716 | 153 | py |
JOELIN | JOELIN-master/train_shared.py | #!/usr/bin/env python3
import os
import csv
import time
import copy
import argparse
import numpy as np
import pandas as pd
from tqdm import tqdm
from sklearn import metrics
from prediction import new_data_predict
from transformers import (
AutoTokenizer, AutoConfig,
AdamW, get_linear_schedule_with_warmup)
impo... | 32,010 | 41.511288 | 174 | py |
JOELIN | JOELIN-master/extract_data.py | #!/usr/bin/env python3
import os
import csv
import time
import copy
import argparse
import numpy as np
import pandas as pd
from tqdm import tqdm
from sklearn import metrics
from pprint import pprint
from transformers import (
BertTokenizerFast, BertPreTrainedModel, BertModel, BertConfig,
AutoTokenizer, AutoMod... | 8,815 | 41.796117 | 142 | py |
JOELIN | JOELIN-master/model.py | from transformers import BertTokenizer, BertTokenizerFast, BertPreTrainedModel, BertModel, BertConfig, AdamW, get_linear_schedule_with_warmup
from transformers import AutoTokenizer, AutoModel, AutoConfig
from torch import nn
import torch.nn.functional as F
from torch.utils.data import Dataset, DataLoader
import torch
... | 13,239 | 42.267974 | 141 | py |
JOELIN | JOELIN-master/prediction_shared.py | #!/usr/bin/env python3
import os
import csv
import time
import copy
import argparse
import numpy as np
import pandas as pd
from tqdm import tqdm
from sklearn import metrics
# from prediction import new_data_predict
from transformers import (
AutoTokenizer, AutoConfig,
AdamW, get_linear_schedule_with_warmup)
im... | 24,679 | 40.689189 | 146 | py |
JOELIN | JOELIN-master/preprocessing/loadData.py |
from transformers import BertTokenizer, BertTokenizerFast
import torch
from torch.utils.data import Dataset, DataLoader
import logging
import os
from preprocessing.preprocessData import splitDatasetIntoTrainDevTest, preprocessDataAndSave
from preprocessing.utils import loadFromPickleFile
from preprocessing import con... | 8,848 | 36.655319 | 110 | py |
bayesmix | bayesmix-master/docs/conf.py | import os
import sys
import subprocess
sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath('../python'))
sys.path.insert(0, os.path.abspath('../python/bayesmixpy'))
def configureDoxyfile(input_dir, output_dir):
with open('Doxyfile.in', 'r') as file... | 1,563 | 23.825397 | 68 | py |
pix2pix3D | pix2pix3D-main/legacy.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 16,675 | 50.153374 | 154 | py |
pix2pix3D | pix2pix3D-main/camera_utils.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 6,814 | 44.738255 | 142 | py |
pix2pix3D | pix2pix3D-main/train.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 31,932 | 57.808471 | 223 | py |
pix2pix3D | pix2pix3D-main/training/dual_discriminator.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 13,110 | 51.23506 | 149 | py |
pix2pix3D | pix2pix3D-main/training/loss_utils.py | import torch
import torch.nn.functional as F
def cross_entropy2d(input, target, weight=None, size_average=True):
n, c, h, w = input.size()
nt, ht, wt = target.size()
if (h != ht) or (w != wt):
# upsample labels
input = F.interpolate(input, size=(ht, wt), mode='bilinear', align_corners=True... | 519 | 29.588235 | 88 | py |
pix2pix3D | pix2pix3D-main/training/superresolution.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 18,911 | 52.123596 | 140 | py |
pix2pix3D | pix2pix3D-main/training/loss.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 58,286 | 55.865366 | 472 | py |
pix2pix3D | pix2pix3D-main/training/augment.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 26,919 | 59.904977 | 366 | py |
pix2pix3D | pix2pix3D-main/training/dataset.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 20,459 | 37.676749 | 159 | py |
pix2pix3D | pix2pix3D-main/training/crosssection_utils.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 1,199 | 45.153846 | 154 | py |
pix2pix3D | pix2pix3D-main/training/triplane.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 7,562 | 54.610294 | 258 | py |
pix2pix3D | pix2pix3D-main/training/training_loop.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 45,240 | 55.410224 | 266 | py |
pix2pix3D | pix2pix3D-main/training/networks_stylegan2.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 40,563 | 49.83208 | 164 | py |
pix2pix3D | pix2pix3D-main/training/networks_stylegan3.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 26,322 | 49.816602 | 141 | py |
pix2pix3D | pix2pix3D-main/training/triplane_cond.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 68,256 | 53.6056 | 313 | py |
pix2pix3D | pix2pix3D-main/training/volumetric_rendering/renderer.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 23,948 | 53.553531 | 211 | py |
pix2pix3D | pix2pix3D-main/training/volumetric_rendering/ray_sampler.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 2,783 | 43.190476 | 250 | py |
pix2pix3D | pix2pix3D-main/training/volumetric_rendering/ray_marcher.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 2,747 | 42.619048 | 147 | py |
pix2pix3D | pix2pix3D-main/training/volumetric_rendering/math_utils.py | # MIT License
# Copyright (c) 2022 Petr Kellnhofer
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge... | 4,708 | 38.571429 | 124 | py |
pix2pix3D | pix2pix3D-main/torch_utils/custom_ops.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 6,780 | 41.38125 | 146 | py |
pix2pix3D | pix2pix3D-main/torch_utils/training_stats.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 10,834 | 38.98155 | 118 | py |
pix2pix3D | pix2pix3D-main/torch_utils/persistence.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 9,866 | 37.846457 | 144 | py |
pix2pix3D | pix2pix3D-main/torch_utils/misc.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 11,902 | 41.359431 | 133 | py |
pix2pix3D | pix2pix3D-main/torch_utils/ops/bias_act.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 9,927 | 45.830189 | 185 | py |
pix2pix3D | pix2pix3D-main/torch_utils/ops/grid_sample_gradfix.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 3,134 | 38.1875 | 132 | py |
pix2pix3D | pix2pix3D-main/torch_utils/ops/conv2d_gradfix.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 9,494 | 46.475 | 280 | py |
pix2pix3D | pix2pix3D-main/torch_utils/ops/upfirdn2d.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 16,506 | 41.109694 | 120 | py |
pix2pix3D | pix2pix3D-main/torch_utils/ops/filtered_lrelu.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 12,998 | 45.927798 | 164 | py |
pix2pix3D | pix2pix3D-main/torch_utils/ops/conv2d_resample.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 6,879 | 46.123288 | 130 | py |
pix2pix3D | pix2pix3D-main/torch_utils/ops/fma.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 2,161 | 33.31746 | 105 | py |
pix2pix3D | pix2pix3D-main/metrics/metric_utils.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 12,059 | 41.765957 | 167 | py |
pix2pix3D | pix2pix3D-main/metrics/equivariance.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 10,982 | 39.677778 | 165 | py |
pix2pix3D | pix2pix3D-main/metrics/perceptual_path_length.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 5,370 | 40.960938 | 131 | py |
pix2pix3D | pix2pix3D-main/metrics/metric_main.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 5,789 | 36.115385 | 147 | py |
pix2pix3D | pix2pix3D-main/metrics/precision_recall.py | # SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
#
# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
# property and proprietary rights in and to this material, related
# documentation ... | 3,758 | 56.830769 | 159 | py |
pix2pix3D | pix2pix3D-main/applications/extract_mesh.py | import sys
sys.path.append('./')
import os
import re
from typing import List, Optional, Tuple, Union
import click
import dnnlib
import numpy as np
import PIL.Image
import torch
from tqdm import tqdm
import legacy
from camera_utils import LookAtPoseSampler
from matplotlib import pyplot as plt
from pathlib import P... | 12,502 | 45.827715 | 218 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.