python_code
stringlengths
0
679k
repo_name
stringlengths
9
41
file_path
stringlengths
6
149
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license. import logging import os import torch import torch.utils.data as TD import torchvision import torchvision.transforms as transforms from utils.comm import get_world_size from . import dataset as D from . import samplers from .transforms import...
transformer-ls-master
imagenet/dat/loader.py
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license. import os import base64 from io import BytesIO import json from PIL import Image import torch.utils.data as data from .utils.tsv_file import TSVFile from .utils.load_files import load_linelist_file, load_from_yaml_file from .utils.load_files i...
transformer-ls-master
imagenet/dat/dataset/tsv_dataset.py
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license. import base64 from io import BytesIO import json from PIL import Image from .tsv_dataset import TSVYamlDataset class ClsTsvDataset(TSVYamlDataset): """ Generic TSV dataset format for Classification. """ def __init__(self, yaml...
transformer-ls-master
imagenet/dat/dataset/cls_tsv.py
""" This file is from https://github.com/microsoft/vision-longformer """ import os.path as op from zipfile import ZipFile, BadZipFile import torch.utils.data as data from PIL import Image from io import BytesIO import multiprocessing _VALID_IMAGE_TYPES = ['.jpg', '.jpeg', '.tiff', '.bmp', '.png'] class ZipData(data....
transformer-ls-master
imagenet/dat/dataset/zipdata.py
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license. from .tsv_dataset import TSVDataset, TSVYamlDataset from .zipdata import ZipData from .cls_tsv import ClsTsvDataset __all__ = [ "TSVDataset", "TSVYamlDataset", "ZipData", "ClsTsvDataset", ]
transformer-ls-master
imagenet/dat/dataset/__init__.py
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license. import os.path as op def config_tsv_dataset_args(cfg, dataset_file): full_yaml_file = op.join(cfg.DATA.PATH, dataset_file) assert op.isfile(full_yaml_file) args = dict( yaml_file=full_yaml_file, ) tsv_dataset_nam...
transformer-ls-master
imagenet/dat/dataset/utils/config_args.py
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license. import base64 import json import os import os.path as op import cv2 import numpy as np from tqdm import tqdm from utils.miscellaneous import mkdir from .tsv_file import TSVFile def img_from_base64(imagestring): try: jpgbytestrin...
transformer-ls-master
imagenet/dat/dataset/utils/tsv_file_ops.py
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license. import os import os.path as op import errno import yaml from collections import OrderedDict def load_labelmap_file(labelmap_file): label_dict = None if labelmap_file is not None and op.isfile(labelmap_file): label_dict = Order...
transformer-ls-master
imagenet/dat/dataset/utils/load_files.py
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license. import logging import os import os.path as op def create_lineidx(filein, idxout): idxout_tmp = idxout + '.tmp' with open(filein, 'r') as tsvin, open(idxout_tmp,'w') as tsvout: fsize = os.fstat(tsvin.fileno()).st_size f...
transformer-ls-master
imagenet/dat/dataset/utils/tsv_file.py
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license. from __future__ import absolute_import from __future__ import division from __future__ import print_function from timm.data import create_transform from PIL import ImageFilter import logging import random import torchvision.transforms as T ...
transformer-ls-master
imagenet/dat/transforms/build.py
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license. from .build import build_transforms
transformer-ls-master
imagenet/dat/transforms/__init__.py
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license. from .ra_sampler import RASampler __all__ = ["RASampler"]
transformer-ls-master
imagenet/dat/samplers/__init__.py
# Copyright (c) 2015-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the CC-by-NC license found in the # LICENSE file in the root directory of this source tree. # import torch import torch.distributed as dist import math class RASampler(torch.utils.data.Sampler): """Sampler t...
transformer-ls-master
imagenet/dat/samplers/ra_sampler.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from bisect import bisect_right import torch import math # FIXME ideally this would be achieved with a CombinedLRScheduler, # separating MultiStepLR with WarmupLR # but the current LRScheduler design doesn't allow it class WarmupMultiStepLR(torc...
transformer-ls-master
imagenet/optim/lr_scheduler.py
""" This file is from https://github.com/microsoft/vision-longformer """ # Copyright 2018 The Google AI Language 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 ...
transformer-ls-master
imagenet/optim/optimization.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import torch import logging from .optimization import AdamW, Lamb from .lr_scheduler import WarmupMultiStepLR from .lr_scheduler import WarmupCosineAnnealingLR from .lr_scheduler import WarmupLinearSchedule from .qhm import QHM def get_opt(cfg...
transformer-ls-master
imagenet/optim/__init__.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import torch from torch.optim import Optimizer class QHM(Optimizer): r""" Stochastic gradient method with Quasi-Hyperbolic Momentum (QHM): h(k) = (1 - \beta) * g(k) + \beta * h(k-1) d(k) = (1 - \nu) * g(k) + \nu * h(k) ...
transformer-ls-master
imagenet/optim/qhm.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from collections import defaultdict from collections import deque import os import torch from .comm import is_main_process class SmoothedValue(object): """Track a series of values and provide access to smoothed values over a window or t...
transformer-ls-master
imagenet/utils/metric_logger.py
""" This file is from https://github.com/microsoft/vision-longformer """ import os import math import logging import shutil import torch from collections import OrderedDict from .comm import is_main_process import torch.distributed as dist # def is_dist_avail_and_initialized(): # if not dist.is_available(): # ...
transformer-ls-master
imagenet/utils/checkpoint.py
""" This file is from https://github.com/microsoft/vision-longformer """ """ This file contains primitives for multi-gpu communication. This is useful when doing distributed training. """ import pickle import torch import torch.distributed as dist def get_world_size(): if not dist.is_available(): return...
transformer-ls-master
imagenet/utils/comm.py
transformer-ls-master
imagenet/utils/__init__.py
""" This file is from https://github.com/microsoft/vision-longformer """ import errno import os import os.path as op import logging import numpy as np import torch import random import shutil from .comm import is_main_process import yaml def mkdir(path): # if it is the current folder, skip. # otherwise the o...
transformer-ls-master
imagenet/utils/miscellaneous.py
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license. # Written by Pengchuan Zhang, penzhan@microsoft.com import logging import torch.nn as nn import torchvision.models as tvmodels from .msvit import MsViT def build_model(cfg): # ResNet models from torchvision resnet_model_names = sorted...
transformer-ls-master
imagenet/models/__init__.py
"""Code for the vision transformer model based on ViL. Adapted from https://github.com/microsoft/vision-longformer by Chen Zhu (zhuchen.eric@gmail.com) """ import math from functools import partial import logging import torch from torch import nn from timm.models.layers import DropPath, trunc_normal_, to_2tuple from .l...
transformer-ls-master
imagenet/models/msvit.py
# Copyright (c) 2021 Microsoft Corporation. Licensed under the MIT license. # Written by Pengchuan Zhang, penzhan@microsoft.com from torch import nn import torch from timm.models.layers import trunc_normal_ class Attention(nn.Module): def __init__(self, dim, num_heads=8, qkv_bias=False, qk_scale=None, ...
transformer-ls-master
imagenet/models/layers/full_attention.py
# Written by Chen Zhu during an internship at NVIDIA, zhuchen.eric@gmail.com from .transformer_ls import AttentionLS from .full_attention import Attention
transformer-ls-master
imagenet/models/layers/__init__.py
# Copyright (c) 2021 NVIDIA CORPORATION. Licensed under the MIT license. # Written by Chen Zhu during an internship at NVIDIA, zhuchen.eric@gmail.com from torch import nn import torch from timm.models.layers import trunc_normal_ import torch.nn.functional as F class AttentionLS(nn.Module): """Implementation for ...
transformer-ls-master
imagenet/models/layers/transformer_ls.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
setup.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
tests/test_utils.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
tests/test_container.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
tests/test_pipeline_utils.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
tests/test_topology_sort.py
clara-pipeline-operator-sizing-tool-main
tests/__init__.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
tests/test_triton_utils.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
tests/test_cli.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
tests/test_main.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
tests/test_clarac_utils.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
src/triton_utils.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
src/clarac_utils.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
src/constants.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
src/topology_sort.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
src/__init__.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
src/container.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
src/cli.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
src/utils.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
src/main.py
# Copyright 2021 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 in writi...
clara-pipeline-operator-sizing-tool-main
src/pipeline_utils.py
import matplotlib matplotlib.use("Agg") import matplotlib.pylab as plt import numpy as np def save_figure_to_numpy(fig): # save it to a numpy array. data = np.fromstring(fig.canvas.tostring_rgb(), dtype=np.uint8, sep='') data = data.reshape(fig.canvas.get_width_height()[::-1] + (3,)) return data def...
mellotron-master
plotting_utils.py
import tensorflow as tf from text.symbols import symbols def create_hparams(hparams_string=None, verbose=False): """Create model hyperparameters. Parse nondefault from given string.""" hparams = tf.contrib.training.HParams( ################################ # Experiment Parameters # ...
mellotron-master
hparams.py
import re import numpy as np import music21 as m21 import torch import torch.nn.functional as F from text import text_to_sequence, get_arpabet, cmudict CMUDICT_PATH = "data/cmu_dictionary" CMUDICT = cmudict.CMUDict(CMUDICT_PATH) PHONEME2GRAPHEME = { 'AA': ['a', 'o', 'ah'], 'AE': ['a', 'e'], 'AH': ['u', 'e...
mellotron-master
mellotron_utils.py
import torch import numpy as np from scipy.signal import get_window import librosa.util as librosa_util def window_sumsquare(window, n_frames, hop_length=200, win_length=800, n_fft=800, dtype=np.float32, norm=None): """ # from librosa 0.6 Compute the sum-square envelope of a window fu...
mellotron-master
audio_processing.py
import random import torch from tensorboardX import SummaryWriter from plotting_utils import plot_alignment_to_numpy, plot_spectrogram_to_numpy from plotting_utils import plot_gate_outputs_to_numpy class Tacotron2Logger(SummaryWriter): def __init__(self, logdir): super(Tacotron2Logger, self).__init__(logd...
mellotron-master
logger.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 FLOAT_TYPES = (torch.FloatTensor, torch.cuda.FloatTensor) HALF_TYPES = (torch.H...
mellotron-master
fp16_optimizer.py
from math import sqrt import numpy as np from numpy import finfo import torch from torch.autograd import Variable from torch import nn from torch.nn import functional as F from layers import ConvNorm, LinearNorm from utils import to_gpu, get_mask_from_lengths from modules import GST drop_rate = 0.5 def load_model(hpa...
mellotron-master
model.py
""" BSD 3-Clause License Copyright (c) 2017, Prem Seetharaman All rights reserved. * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of...
mellotron-master
stft.py
import torch import torch.distributed as dist from torch.nn.modules import Module from torch.autograd import Variable def _flatten_dense_tensors(tensors): """Flatten dense tensors into a contiguous 1D buffer. Assume tensors are of same dense type. Since inputs are dense, the resulting tensor will be a conc...
mellotron-master
distributed.py
import random import os import re import numpy as np import torch import torch.utils.data import librosa import layers from utils import load_wav_to_torch, load_filepaths_and_text from text import text_to_sequence, cmudict from yin import compute_yin class TextMelLoader(torch.utils.data.Dataset): """ 1) ...
mellotron-master
data_utils.py
from torch import nn class Tacotron2Loss(nn.Module): def __init__(self): super(Tacotron2Loss, self).__init__() def forward(self, model_output, targets): mel_target, gate_target = targets[0], targets[1] mel_target.requires_grad = False gate_target.requires_grad = False ...
mellotron-master
loss_function.py
import numpy as np from scipy.io.wavfile import read import torch def get_mask_from_lengths(lengths): max_len = torch.max(lengths).item() ids = torch.arange(0, max_len, out=torch.cuda.LongTensor(max_len)) mask = (ids < lengths.unsqueeze(1)).bool() return mask def load_wav_to_torch(full_path): sa...
mellotron-master
utils.py
import os import time import argparse import math from numpy import finfo import torch from distributed import apply_gradient_allreduce import torch.distributed as dist from torch.utils.data.distributed import DistributedSampler from torch.utils.data import DataLoader from model import load_model from data_utils impo...
mellotron-master
train.py
# adapted from https://github.com/patriceguyot/Yin import numpy as np def differenceFunction(x, N, tau_max): """ Compute difference function of data x. This corresponds to equation (6) in [1] This solution is implemented directly with Numpy fft. :param x: audio data :param N: length of data ...
mellotron-master
yin.py
# adapted from https://github.com/KinglittleQ/GST-Tacotron/blob/master/GST.py # MIT License # # Copyright (c) 2018 MagicGirl Sakura # # 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 r...
mellotron-master
modules.py
import torch from librosa.filters import mel as librosa_mel_fn from audio_processing import dynamic_range_compression, dynamic_range_decompression from stft import STFT class LinearNorm(torch.nn.Module): def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'): super(LinearNorm, self).__init__...
mellotron-master
layers.py
import time import torch import sys import subprocess argslist = list(sys.argv)[1:] num_gpus = torch.cuda.device_count() argslist.append('--n_gpus={}'.format(num_gpus)) workers = [] job_id = time.strftime("%Y_%m_%d-%H%M%S") argslist.append("--group_name=group_{}".format(job_id)) for i in range(num_gpus): argslist...
mellotron-master
multiproc.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...
mellotron-master
loss_scaler.py
""" from https://github.com/keithito/tacotron """ import re valid_symbols = [ 'AA', 'AA0', 'AA1', 'AA2', 'AE', 'AE0', 'AE1', 'AE2', 'AH', 'AH0', 'AH1', 'AH2', 'AO', 'AO0', 'AO1', 'AO2', 'AW', 'AW0', 'AW1', 'AW2', 'AY', 'AY0', 'AY1', 'AY2', 'B', 'CH', 'D', 'DH', 'EH', 'EH0', 'EH1', 'EH2', 'ER', 'ER0', 'ER1', 'E...
mellotron-master
text/cmudict.py
""" from https://github.com/keithito/tacotron """ import re import random from text import cleaners from text.symbols import symbols # Mappings from symbol to numeric ID and vice versa: _symbol_to_id = {s: i for i, s in enumerate(symbols)} _id_to_symbol = {i: s for i, s in enumerate(symbols)} # Regular expression ma...
mellotron-master
text/__init__.py
""" from https://github.com/keithito/tacotron """ import inflect import re _inflect = inflect.engine() _comma_number_re = re.compile(r'([0-9][0-9\,]+[0-9])') _decimal_number_re = re.compile(r'([0-9]+\.[0-9]+)') _pounds_re = re.compile(r'£([0-9\,]*[0-9]+)') _dollars_re = re.compile(r'\$([0-9\.\,]*[0-9]+)') _ordinal_r...
mellotron-master
text/numbers.py
""" from https://github.com/keithito/tacotron """ ''' Defines the set of symbols used in text input to the model. The default is a set of ASCII characters that works well for English or text that has been run through Unidecode. For other data, you can modify _characters. See TRAINING_DATA.md for details. ''' from tex...
mellotron-master
text/symbols.py
""" from https://github.com/keithito/tacotron """ ''' Cleaners are transformations that run over the input text at both training and eval time. Cleaners can be selected by passing a comma-delimited list of cleaner names as the "cleaners" hyperparameter. Some cleaners are English-specific. You'll typically want to use...
mellotron-master
text/cleaners.py
#!/usr/bin/env python2 # Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. # # 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 # th...
tegra-uboot-scripts-master
gen-uboot-script.py
#!/usr/bin/env python2 # Copyright (c) 2011-2013, NVIDIA CORPORATION. All rights reserved. # # 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...
tegra-uboot-scripts-master
part-uuid.py
from yum.plugins import PluginYumExit, TYPE_CORE, TYPE_INTERACTIVE from yum.packages import YumInstalledPackage from yum.constants import * from rpmUtils.miscutils import compareEVR import sys import os import re sys.path.insert(0,'/usr/share/yum-cli/') import yum from yum.Errors import * from utils import YumUtilBa...
yum-packaging-nvidia-plugin-main
nvidia-yum.py
from __future__ import absolute_import from __future__ import unicode_literals import os import shutil from functools import cmp_to_key from dnf.cli.option_parser import OptionParser import dnf import dnf.cli import dnf.sack import libdnf.transaction DRIVER_PKG_NAME = 'nvidia-driver' KERNEL_PKG_NAME = 'kernel' KERNE...
yum-packaging-nvidia-plugin-main
nvidia-dnf.py
# Copyright (c) 2013, NVIDIA CORPORATION. All rights reserved. # # 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, m...
tegra-uboot-flasher-scripts-master
tegraboardconfigs.py
# ali_funcs.py 3/27/2018 # # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Alibaba (ali) Cloud Service Provider specific functions # # HELPTEXT: "Alibaba Cloud Service Provider" # import json import time import subprocess from cspbaseclass import CSPBas...
ngc-examples-master
ncsp/ali_funcs.py
# gcp_funcs.py 3/27/2018 # # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Google Cloud Service Provider specific functions # # HELPTEXT: "Google Cloud Service Provider" # # See: https://cloud.google.com/sdk/docs/scripting-gcloud # import json import ti...
ngc-examples-master
ncsp/gcp_funcs.py
# template_funcs.py 3/23/2018 # # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # <CSP> specific class Template functions - starting point for new <CSP> development # Copy this file to your CSP specific name, and fill in functions # # The following line is use ...
ngc-examples-master
ncsp/template_funcs.py
#!/usr/bin/python # csp 3/22/2018 # # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Top level generic CSP (Cloud Service Provider) interface # # Demonstrates how to use python to create a consistent interface # across multiple different c...
ngc-examples-master
ncsp/ncsp.py
# aws_funcs.py 3/23/2018 # # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Amazon (aws) Cloud Service Provider specific functions # # HELPTEXT: "Amazon Cloud Service Provider" # import json import time import sys from cspbaseclass import CSPBaseClass fro...
ngc-examples-master
ncsp/aws_funcs.py
# cspbaseclass.py 3/23/2018 # # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # Cloud Service Provider base class # import os import sys import time import subprocess import json g_trace_level = 0 # global trace level, see trace_do and debug funcs ...
ngc-examples-master
ncsp/cspbaseclass.py
# SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: MIT # # 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 res...
ProViz-AI-Samples-master
inference_partner_training/TensorRT/Models/fetch_model.py
# SPDX-FileCopyrightText: Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: MIT # # 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 res...
ProViz-AI-Samples-master
inference_partner_training/TensorRT/TRTPluginSample/replace_bn.py
# Copyright (c) 2017 NVIDIA Corporation import argparse from math import sqrt parser = argparse.ArgumentParser(description='RMSE_calculator') parser.add_argument('--path_to_predictions', type=str, default="", metavar='N', help='Path file with actual ratings and predictions') parser.add_argument('-...
DeepRecommender-master
compute_RMSE.py
# Copyright (c) 2017 NVIDIA Corporation import torch import argparse from reco_encoder.data import input_layer from reco_encoder.model import model import torch.optim as optim from torch.optim.lr_scheduler import MultiStepLR import torch.nn as nn from torch.autograd import Variable import copy import time from pathlib ...
DeepRecommender-master
run.py
# THIS FILE IS COPY-PASTED FROM HERE: https://github.com/yunjey/pytorch-tutorial/tree/master/tutorials/04-utils/tensorboard # Code referenced from https://gist.github.com/gyglim/1f8dfb1b5c82627ae3efcfbbadb9f514 import tensorflow as tf import numpy as np import scipy.misc try: from StringIO import StringIO # Python...
DeepRecommender-master
logger.py
# Copyright (c) 2017 NVIDIA Corporation import torch import argparse import copy from reco_encoder.data import input_layer from reco_encoder.model import model from torch.autograd import Variable from pathlib import Path parser = argparse.ArgumentParser(description='RecoEncoder') parser.add_argument('--drop_prob', ty...
DeepRecommender-master
infer.py
# Copyright (c) 2017 NVIDIA Corporation import unittest import sys import torch.optim as optim from torch.autograd import Variable from reco_encoder.data.input_layer import UserItemRecDataProvider from reco_encoder.model.model import AutoEncoder, MSEloss sys.path.append('data') sys.path.append('model') class iRecAutoE...
DeepRecommender-master
test/test_model.py
# Copyright (c) 2017 NVIDIA Corporation
DeepRecommender-master
test/__init__.py
# Copyright (c) 2017 NVIDIA Corporation import unittest from reco_encoder.data.input_layer import UserItemRecDataProvider class UserItemRecDataProviderTest(unittest.TestCase): def test_1(self): print("Test 1 started") params = {} params['batch_size'] = 64 params['data_dir'] = 'test/testData_iRec' ...
DeepRecommender-master
test/data_layer_tests.py
# Copyright (c) 2017 NVIDIA Corporation from os import listdir, path, makedirs import random import sys import time import datetime def print_stats(data): total_ratings = 0 print("STATS") for user in data: total_ratings += len(data[user]) print("Total Ratings: {}".format(total_ratings)) print("Total User...
DeepRecommender-master
data_utils/netflix_data_convert.py
# Copyright (c) 2017 NVIDIA Corporation import sys import datetime import random from math import floor def print_stats(data): total_ratings = 0 print("STATS") for user in data: total_ratings += len(data[user]) print("Total Ratings: {}".format(total_ratings)) print("Total User count: {}".format(len(data....
DeepRecommender-master
data_utils/movie_lense_data_converter.py
# Copyright (c) 2017 NVIDIA Corporation
DeepRecommender-master
reco_encoder/__init__.py
# Copyright (c) 2017 NVIDIA Corporation
DeepRecommender-master
reco_encoder/model/__init__.py
# Copyright (c) 2017 NVIDIA Corporation import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as weight_init from torch.autograd import Variable def activation(input, kind): #print("Activation: {}".format(kind)) if kind == 'selu': return F.selu(input) elif kind == 'relu': ...
DeepRecommender-master
reco_encoder/model/model.py
# Copyright (c) 2017 NVIDIA Corporation
DeepRecommender-master
reco_encoder/data/__init__.py
# Copyright (c) 2017 NVIDIA Corporation """Data Layer Classes""" from os import listdir, path from random import shuffle import torch class UserItemRecDataProvider: def __init__(self, params, user_id_map=None, item_id_map=None): self._params = params self._data_dir = self.params['data_dir'] self._extensi...
DeepRecommender-master
reco_encoder/data/input_layer.py
# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # See LICENSE for license information. import ctypes from functools import lru_cache import os from pathlib import Path import re import shutil import subprocess from subprocess import CalledProcessError import sys import tempfile from ...
TransformerEngine-main
setup.py
# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # See LICENSE for license information. """Test TE Paddle Layer-level APIs""" import math import os import pytest from utils import assert_allclose import paddle import transformer_engine.paddle as te from transformer_engine.paddle.fp8...
TransformerEngine-main
tests/paddle/test_layers.py
# Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # See LICENSE for license information. """Test TE operators""" import struct import numpy as np import pytest import paddle import paddle.nn.functional as F from utils import assert_allclose, create_fp8_meta import transformer_engine ...
TransformerEngine-main
tests/paddle/test_operators.py