python_code stringlengths 0 679k | repo_name stringlengths 9 41 | file_path stringlengths 6 149 |
|---|---|---|
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/09-BestPractice/ComputationInAdvance/main.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/09-BestPractice/ComputationInAdvance/Convert3DMMTo2DMM/main.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/51-Uncategorized/getVersion.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/51-Uncategorized/Number/buildDataTypeMD.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/00-MNISTData/extractMnistData.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/00-MNISTData/loadMnistData.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/52-Deprecated/ShapeLayer-TRT8/main.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/52-Deprecated/FullyConnectedLayer-TRT8.4/main.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/52-Deprecated/RNNLayer-TRT8/main.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/52-Deprecated/ErrorWhenParsePadNode-TRT-8.4/main.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/52-Deprecated/UsePluginV2IOExt-TRT8.6/testAddScalarPlugin.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/52-Deprecated/MatrixMultiplyDeprecatedLayer-TRT8/main.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/52-Deprecated/FullyConnectedLayerWhenUsingParserTRT-8.4/pyTorchToTensorRT.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/52-Deprecated/UsePluginV2Ext-TRT8.5/testAddScalarPlugin.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/52-Deprecated/ResizeLayer-TRT8/Align_corners.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/52-Deprecated/BindingEliminate-TRT8/main.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/52-Deprecated/max_workspace_size-TRT8.4/main.py |
#
# Copyright (c) 2021-2023, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by... | trt-samples-for-hackathon-cn-master | cookbook/52-Deprecated/MultiContext-TRT8/main.py |
#!/usr/bin/env python
# Copyright 2017 The Kubernetes 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 appli... | k8s-operator-libs-main | vendor/k8s.io/kubectl/pkg/util/i18n/translations/extract.py |
# transformer_main.py
import argparse
import os
import sys
import time
import math
import random
import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
from fp16 import FP16_Module, FP16_Optimizer
import data
import model as m
from model import DistributedDataParallel as DDP
from ... | sentiment-discovery-master | pretrain.py |
###############################################################################
# Language Modeling on Penn Tree Bank
#
# This file generates new sentences sampled from the language model
#
###############################################################################
import os
import math
import argparse
import to... | sentiment-discovery-master | generate.py |
###############################################################################
# BSD 3-Clause License
#
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Author & Contact: Raul Puri (raulp@nvidia.com)
###############################################################################
from configure_data ... | sentiment-discovery-master | arguments.py |
###############################################################################
# BSD 3-Clause License
#
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Copyright (c) 2017, openai. All rights reserved.
###############################################################################
"""
Modified ver... | sentiment-discovery-master | logreg_utils.py |
import torch
import itertools
# At pain of messing up a good thing, also collect standard deviation (total) -- divided by total items for average
def update_info_dict(info_dict, labels, preds, threshold=0.5, std=None):
preds = (torch.tensor(preds) > threshold).long()
labels = (torch.tensor(labels) > threshold)... | sentiment-discovery-master | metric_utils.py |
from torch.optim.lr_scheduler import _LRScheduler
import math
class LinearLR(_LRScheduler):
"""
A scheduler for linear learning rate decay to 0 over a specified number of steps.
Args:
optimizer (Optimizer): Wrapped optimizer.
max_iters (int): Period of learning rate decay. When last_iter==m... | sentiment-discovery-master | learning_rates.py |
import argparse
import os
import time
import math
import collections
from tqdm import tqdm
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
import numpy as np
import pandas as pd
from reparameterization import apply_weight_norm, remove_weight_norm
from model imp... | sentiment-discovery-master | run_classifier.py |
from sklearn import metrics
import itertools
import argparse
import torch
import numpy as np
import pandas as pd
from metric_utils import update_info_dict, get_metric
from collections import defaultdict
from tqdm import tqdm
def binary_threshold(args, labels=None):
preds = pd.read_csv(args.preds_file, header=None)... | sentiment-discovery-master | threshold.py |
import argparse
import os
import sys
import time
import math
import random
import collections
import pandas as pd
import pickle as pkl
import json
import torch
import torch.nn as nn
from torch.autograd import Variable
import numpy as np
from logreg_utils import train_logreg
from fp16 import FP16_Module, FP16_Optimize... | sentiment-discovery-master | finetune_classifier.py |
import argparse
import os
import time
import math
import collections
import pickle as pkl
from tqdm import tqdm
import torch
import torch.nn as nn
from torch.autograd import Variable
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
from logreg_utils import train_logreg
from... | sentiment-discovery-master | transfer.py |
import os
from setuptools import setup, find_packages
import torch
print("torch.__version__ = ", torch.__version__)
TORCH_MAJOR = int(torch.__version__.split('.')[0])
TORCH_MINOR = int(torch.__version__.split('.')[1])
if TORCH_MAJOR == 0 and TORCH_MINOR < 4:
raise RuntimeError("Sentiment Discovery requires Pyt... | sentiment-discovery-master | setup.py |
import os
import copy
import data_utils
class DataConfig(object):
def __init__(self, parser, defaults={}):
super(DataConfig,self).__init__()
self.parser = parser
self.defaults = defaults
def apply(self, opt):
print('configuring data')
self.apply_defaults(opt)
r... | sentiment-discovery-master | configure_data.py |
import argparse
import os
import sys
import time
import math
import torch
import torch.nn as nn
from torch.autograd import Variable
from fp16 import FP16_Module, FP16_Optimizer
import data
import model
from model import DistributedDataParallel as DDP
from apex.reparameterization import apply_weight_norm, remove_wei... | sentiment-discovery-master | main.py |
import torch
import sys
import os
import subprocess
argslist = list(sys.argv)[1:]
LOGDIR = 'distributed_logs'
if '--save' in argslist:
savepath = os.path.splitext(os.path.basename(argslist[argslist.index('--save')+1]))[0]
else:
savepath = 'model'
LOGDIR = os.path.join(LOGDIR, savepath)
if not os.path.exists(L... | sentiment-discovery-master | multiproc.py |
import argparse
import itertools
import sys
import subprocess
import os
if __name__ == '__main__':
parser = argparse.ArgumentParser("Let's run some multihead experiments!")
parser.add_argument('--gpu', type=int, default=0,
help='which gpu to run on')
parser.add_argument('--train', t... | sentiment-discovery-master | experiments/run_clf_multihead.py |
import argparse
import itertools
import sys
import subprocess
import os
if __name__ == '__main__':
parser = argparse.ArgumentParser("Let's run some sst experiments!")
parser.add_argument('--gpu', type=int, default=0,
help='which gpu to run on')
args = parser.parse_args()
env =... | sentiment-discovery-master | experiments/run_clf_sst.py |
import argparse
import itertools
import sys
import subprocess
import os
if __name__ == '__main__':
parser = argparse.ArgumentParser("Let's run some singlehead experiments!")
parser.add_argument('--gpu', type=int, default=0,
help='which gpu to run on')
parser.add_argument('--train', ... | sentiment-discovery-master | experiments/run_clf_single_head.py |
import argparse
import itertools
import sys
import subprocess
import os
if __name__ == '__main__':
parser = argparse.ArgumentParser("Let's run some binary sentiment experiments!")
parser.add_argument('--gpu', type=int, default=0,
help='which gpu to run on')
parser.add_argument('--tr... | sentiment-discovery-master | experiments/run_clf_binary.py |
import os
import mmap
import pickle as pkl
import time
from itertools import accumulate
from threading import Lock
import torch
def get_lazy_path(path):
"""
Gets path where lazy files are stored.
"""
return os.path.splitext(path)[0]+'.lazy'
def exists_lazy(path, data_type='data'):
"""
Check i... | sentiment-discovery-master | data_utils/lazy_loader.py |
import os
import re
import html
import unicodedata
import unidecode
import torch
try:
import emoji
except:
print(Warning("emoji import unavailable"))
HTML_CLEANER_REGEX = re.compile('<.*?>')
def clean_html(text):
"""remove html div tags"""
text = str(text)
return re.sub(HTML_CLEANER_REGEX, ' ',... | sentiment-discovery-master | data_utils/preprocess.py |
import collections
import sys
if sys.version_info[0] == 2:
import Queue as queue
string_classes = basestring
else:
import queue
string_classes = (str, bytes)
import threading
import traceback
import math
import time
import torch
from torch.utils import data
import torch.multiprocessing as multiprocessi... | sentiment-discovery-master | data_utils/loaders.py |
import os
import time
from operator import itemgetter
from bisect import bisect_left, bisect_right
import json
from itertools import accumulate
import csv
import collections
import torch
from torch.utils import data
import pandas as pd
import numpy as np
from .preprocess import process_str, binarize_labels
from .lazy... | sentiment-discovery-master | data_utils/datasets.py |
class array_cache(object):
"""
Arguments:
cache_strs (list-like): List like object with __len__ and __getitem__
cache_block_size (int): number of strings to cache in one cache block. Default: 64
cache_size (int): number of caches blocks to store before removing (LRU). Default: 32
Att... | sentiment-discovery-master | data_utils/cache.py |
import os
import math
from .samplers import BatchSampler, DistributedBatchSampler, TransposedSampler, RandomShardSampler, BatchShardSampler, DistributedBatchShardSampler
from .loaders import DataLoader, ShardLoader
from .preprocess import tokenize_str_batch, binarize_labels, process_str, process_tweet, batch_tokens
fr... | sentiment-discovery-master | data_utils/__init__.py |
from collections import namedtuple
import random
import os
import sentencepiece as spm
def make_tokenizer(tokenizer_type, corpus, model_path=None, vocab_size=None, model_type='bpe', pad_token=0, character_coverage=1.0):
tokenizer_class = tokenizer_type
if isinstance(tokenizer_class, str):
tokenizer_cl... | sentiment-discovery-master | data_utils/tokenization.py |
import math
import os
import sys
import torch
from torch.utils import data
import numpy as np
from .datasets import data_shard
class DistributedBatchSampler(data.sampler.BatchSampler):
"""
similar to normal implementation of distributed batch sampler, except if sampler is transposed sampler
has option to... | sentiment-discovery-master | data_utils/samplers.py |
import torch
from .weight_norm import WeightNorm
from .reparameterization import Reparameterization
def apply_weight_norm(module, name='', dim=0, hook_child=True):
"""
Applies weight normalization to a parameter in the given module.
If no parameter is provided, applies weight normalization to all
param... | sentiment-discovery-master | reparameterization/__init__.py |
import torch
from torch.nn.parameter import Parameter
#from ..utils import FusedNorm
import time
from .reparameterization import Reparameterization
def _norm(p, dim):
"""Computes the norm over all dimensions except dim"""
if dim is None:
return p.norm()
elif dim == 0:
output_size = (p.size... | sentiment-discovery-master | reparameterization/weight_norm.py |
import torch
from torch.nn.parameter import Parameter
import sys
class Reparameterization(object):
"""
Class interface for performing weight reparameterizations
Arguments:
name (str): name of weight parameter
dim (int): dimension over which to compute the norm
module (nn.Module): par... | sentiment-discovery-master | reparameterization/reparameterization.py |
###############################################################################
# BSD 3-Clause License
#
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Copyright (c) 2016, Facebook, inc (Adam Paszke). All rights reserved.
###########################################################################... | sentiment-discovery-master | model/checkpoint.py |
###############################################################################
# BSD 3-Clause License
#
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Copyright (c) 2017, Facebook, inc. All rights reserved.
###############################################################################
'''
Code ... | sentiment-discovery-master | model/transformer_utils.py |
from .distributed import *
from .model import *
from .sentiment_classifier import *
from .transformer import *
from .transformer_utils import * | sentiment-discovery-master | model/__init__.py |
import math
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
from .RNN_utils import RNN
from .transformer_utils import Embedding
from .transformer import TransformerDecoder
class RNNModel(nn.Module):
"""Container module with an encoder, a recurrent module, an... | sentiment-discovery-master | model/model.py |
import torch
from torch import nn
import torch.nn.functional as F
import numpy as np
from itertools import chain
from .model import RNNFeaturizer, TransformerFeaturizer
from .transformer_utils import GeLU
class BinaryClassifier(nn.Module):
def __init__(self, num_features=4096, **kwargs):
super().__init__(... | sentiment-discovery-master | model/sentiment_classifier.py |
import torch
from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
import torch.distributed as dist
from torch.nn.modules import Module
from torch.autograd import Variable
class DistributedDataParallel(Module):
def __init__(self, module):
super(DistributedDataParallel, self).__init__(... | sentiment-discovery-master | model/distributed.py |
###############################################################################
# BSD 3-Clause License
#
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Copyright (c) 2017, Facebook, inc. All rights reserved.
###############################################################################
'''
Code ... | sentiment-discovery-master | model/transformer.py |
import torch
import torch.nn as nn
from torch.autograd import Variable
import torch.nn.functional as F
import math
#This function could have some real bad perf penalties if used incorrectly
#Uses in the RNN API should be fine. DIDN'T USE!
def reverse_dir_tensor(tensor, dim=0):
"""
reverse_dir_tensor stub
... | sentiment-discovery-master | model/RNN_utils/RNN/RNNBackend.py |
import torch
# from torch.nn._functions.rnn import LSTMCell, RNNReLUCell, RNNTanhCell, GRUCell
from .RNNBackend import bidirectionalRNN, stackedRNN, RNNCell
from .cells import mLSTMRNNCell, mLSTMCell
_VF = torch._C._VariableFunctions
_rnn_impls = {
'LSTM': _VF.lstm_cell,
'GRU': _VF.gru_cell,
'RNN_TANH': ... | sentiment-discovery-master | model/RNN_utils/RNN/models.py |
from .models import LSTM, GRU, ReLU, Tanh, mLSTM
__all__ = ['models']
| sentiment-discovery-master | model/RNN_utils/RNN/__init__.py |
import torch
import torch.nn as nn
import torch.nn.functional as F
from .RNNBackend import RNNCell
# from torch.nn._functions.thnn import rnnFusedPointwise as fusedBackend
_VF = torch._C._VariableFunctions
import math
class mLSTMRNNCell(RNNCell):
"""
mLSTMRNNCell stub
"""
def __init__(self, input... | sentiment-discovery-master | model/RNN_utils/RNN/cells.py |
import torch
from torch import nn
from torch.autograd import Variable
from torch.nn.parameter import Parameter
from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
from .loss_scaler import DynamicLossScaler, LossScaler
from .fp16util import model_grads_to_master_grads, master_params_to_model_param... | sentiment-discovery-master | fp16/fp16.py |
from .fp16 import *
from .loss_scaler import *
| sentiment-discovery-master | fp16/__init__.py |
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
class tofp16(nn.Module):
"""
Model wrapper that implements::
def forward(self, input):
return input.half()
"""
def __init__(self):
... | sentiment-discovery-master | fp16/fp16util.py |
import torch
class LossScaler:
def __init__(self, scale=1):
self.cur_scale = scale
# `params` is a list / generator of torch.Variable
def has_overflow(self, params):
return False
# `x` is a torch.Tensor
def _has_inf_or_nan(x):
return False
# `overflow` is boolean ind... | sentiment-discovery-master | fp16/loss_scaler.py |
# Copyright 2019-2020 Nvidia Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | GraphQSat-main | add_metadata.py |
# Copyright 2019-2020 Nvidia Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | GraphQSat-main | evaluate.py |
# Copyright 2019-2020 Nvidia Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | GraphQSat-main | dqn.py |
#################################################################################################################################
# All the source files in `minisat` folder were initially copied and later modified from https://github.com/feiwang3311/minisat #
# (which was taken from the MiniSat source at https://github... | GraphQSat-main | minisat/__init__.py |
#################################################################################################################################
# All the source files in `minisat` folder were initially copied and later modified from https://github.com/feiwang3311/minisat #
# (which was taken from the MiniSat source at https://github... | GraphQSat-main | minisat/minisat/__init__.py |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.12
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info >= (2, 7, 0):
def swig_... | GraphQSat-main | minisat/minisat/gym/GymSolver.py |
#################################################################################################################################
# All the source files in `minisat` folder were initially copied and later modified from https://github.com/feiwang3311/minisat #
# (which was taken from the MiniSat source at https://github... | GraphQSat-main | minisat/minisat/gym/MiniSATEnv.py |
### The code in this file was originally copied from the Pytorch Geometric library and modified later:
### https://pytorch-geometric.readthedocs.io/en/latest/_modules/torch_geometric/nn/meta.html#MetaLayer
### Pytorch geometric license is below
# Copyright (c) 2019 Matthias Fey <matthias.fey@tu-dortmund.de>
#
# Permis... | GraphQSat-main | gqsat/models.py |
# Copyright 2019-2020 Nvidia Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | GraphQSat-main | gqsat/__init__.py |
# Copyright 2019-2020 Nvidia Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | GraphQSat-main | gqsat/agents.py |
# Copyright 2019-2020 Nvidia Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | GraphQSat-main | gqsat/learners.py |
# Copyright 2019-2020 Nvidia Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | GraphQSat-main | gqsat/utils.py |
# Copyright 2019-2020 Nvidia Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | GraphQSat-main | gqsat/buffer.py |
# Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
"""TLT YOLOv4 Tiny example."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
| tao_tutorials-main | notebooks/tao_launcher_starter_kit/yolo_v4_tiny/__init__.py |
# Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
"""Script to prepare train/val dataset for LPRNet tutorial."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import cv2
def parse_args(args=None):
"""par... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/lprnet/preprocess_openalpr_benchmark.py |
anthropometic_3D_landmarks = [[0.463302314, 0.499617226, 2.824620485],
[0.433904979, 0.505937393, 2.644347876],
[0.39794359, 0.54824712, 2.468309015],
[0.347156364, 0.608686736, 2.301015556],
[0.261349984, 0.708693571, 2.164755151],
[0.149679065, 0.846413877, 2.038914531],
[0.020857666, 1.000756979, 1.96136412],
[-0.12... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/gazenet/face_model_nv68.py |
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
"""GazeNet visualization util scripts."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import os
import numpy as np
import json
import face_model_nv68
MIN_LANDMARK_FOR_PNP = 4
NU... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/gazenet/utils_gazeviz.py |
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
"""GazeNet public dataset conversion scripts."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import errno
import os
import json
import argparse
import scipy.io as scio
def mkdi... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/gazenet/mpiifacegaze_convert.py |
# Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
"""TLT DSSD example."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
| tao_tutorials-main | notebooks/tao_launcher_starter_kit/dssd/__init__.py |
# Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
"""TLT SSD example."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
| tao_tutorials-main | notebooks/tao_launcher_starter_kit/ssd/__init__.py |
# Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
"""Script to generate splitted dataset for SSD/DSSD/Retinanet tutorial."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
import shutil
def parse_args(args=No... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/ssd/generate_split.py |
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
"""TLT FpeNet example."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
| tao_tutorials-main | notebooks/tao_launcher_starter_kit/fpenet/__init__.py |
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
"""Helper script to sample calibration data for INT8 post-training quantization."""
import argparse
import json
import os
import random
import cv2
import numpy as np
# Color definition for stdout logs.
CRED = '\033[91m'
CGREEN = '\033[92m'
CYELLOW = '\0... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/fpenet/sample_calibration_images.py |
# Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved.
"""FPENet data conversion utils."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import cv2
import os
import numpy as np
import json
def get_keypoints_from_file(keypoints_file):
'''
... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/fpenet/data_utils.py |
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
import argparse
import numpy as np
import h5py
import cv2
import os
import csv
def build_command_line_parser(parser=None):
"""Build command line parser for dataset_convert.
Args:
parser (subparser): Provided from the wrapper script to bu... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/heartratenet/process_cohface.py |
# Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
"""TLT Multitask Classification example."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
| tao_tutorials-main | notebooks/tao_launcher_starter_kit/multitask_classification/__init__.py |
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
"""Helper script to sample calibration data for INT8 post-training quantization."""
import argparse
import os
import random
import subprocess
import joblib
from pycocotools.coco import COCO
def build_command_line_parser(parser=None):
"""
Sampl... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/bpnet/sample_calibration_images.py |
"""
Converts Retail Product Checkout (https://www.kaggle.com/datasets/diyer22/retail-product-checkout-dataset) dataset to classification dataset. Ready for MLRecogNet training.
"""
import os, zipfile
import glob
import cv2
from pycocotools.coco import COCO
from tqdm import tqdm
import numpy as np
import shutil
def c... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/metric_learning_recognition/process_retail_product_checkout_dataset.py |
# Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
"""TLT DetectNet v2 example."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
| tao_tutorials-main | notebooks/tao_launcher_starter_kit/detectnet_v2/__init__.py |
import os
from os.path import join as join_path
import re
import glob
import shutil
from random import shuffle
from tqdm import tqdm
DATA_DIR=os.environ.get('LOCAL_DATA_DIR')
source_dir_orig = join_path(DATA_DIR, "VOCdevkit/VOC2012")
target_dir_orig = join_path(DATA_DIR, "formatted")
suffix = '_trainval.txt'
classes... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/classification_tf1/tao_voc/prepare_voc.py |
tao_tutorials-main | notebooks/tao_launcher_starter_kit/gesturenet/__init__.py | |
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
"""Helper script to sample calibration data for INT8 post-training quantization."""
import argparse
import json
import os
import random
import cv2
# Color definition for stdout logs.
CYELLOW = '\033[93m'
CEND = '\033[0m'
def build_command_line_parser... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/gesturenet/sample_calibration_images.py |
# Copyright (c) 2017-2020, NVIDIA CORPORATION. All rights reserved.
"""Script to transform HGR dataset to Label Studio format for Gesturenet tutorial."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
from collections import defaultdict
i... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/gesturenet/convert_hgr_to_tlt_data.py |
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
import os
import sys
def drop_class(label_dir, classes):
"""drop label by class names."""
labels = os.listdir(label_dir)
labels = [os.path.join(label_dir, x) for x in labels]
for gt in labels:
print("Processing ", gt)
wit... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/pointpillars/specs/drop_class.py |
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
import os
import argparse
import numpy as np
from nvidia_tao_pytorch.pointcloud.pointpillars.pcdet.utils.object3d_kitti import (
get_objects_from_label
)
from nvidia_tao_pytorch.pointcloud.pointpillars.pcdet.utils.calibration_kitti import (
Cali... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/pointpillars/specs/gen_lidar_labels.py |
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
import os
import sys
def split(list_file, lidar, label, output_lidar, output_label):
"""train/val split of the KITTI dataset."""
with open(list_file) as lf:
file_names = lf.readlines()
file_names = [f.strip() for f in file_names]
... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/pointpillars/specs/kitti_split.py |
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
import os
import argparse
import numpy as np
from skimage import io
from nvidia_tao_pytorch.pointcloud.pointpillars.pcdet.utils.calibration_kitti import (
Calibration
)
def parse_args():
parser = argparse.ArgumentParser("Limit LIDAR points to ... | tao_tutorials-main | notebooks/tao_launcher_starter_kit/pointpillars/specs/gen_lidar_points.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.