python_code stringlengths 0 679k | repo_name stringlengths 9 41 | file_path stringlengths 6 149 |
|---|---|---|
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Job module
"""
from . import util
from .air_model import AirModel
class Job(AirModel):
"""
Manage a Job
### json
Returns a JSON string representation of the job
... | air_sdk-main | air_sdk/job.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Interface module
"""
from . import util
from .air_model import AirModel
class Interface(AirModel):
"""
View an Interface
### json
Returns a JSON string represent... | air_sdk-main | air_sdk/interface.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
""" Exposes the AIR API client module """
from .air_api import *
| air_sdk-main | air_sdk/__init__.py |
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
ResourceBudget module
"""
from . import util
from .air_model import AirModel
class ResourceBudget(AirModel):
"""
Manage a ResourceBudget
### json
Returns a JSON strin... | air_sdk-main | air_sdk/resource_budget.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Topology module
"""
import io
import os
from . import util
from .air_model import AirModel
class Topology(AirModel):
"""
Manage a Topology
### delete
Delete the... | air_sdk-main | air_sdk/topology.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Marketplace Demo module
"""
from . import util
from .air_model import AirModel
class Marketplace(AirModel):
"""
Manage marketplace demos
"""
_updatable = False
... | air_sdk-main | air_sdk/marketplace.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
SimulationInterface module
"""
from . import util
from .air_model import AirModel
class SimulationInterface(AirModel):
"""
Manage a SimulationInterface
### json
... | air_sdk-main | air_sdk/simulation_interface.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Custom exceptions for the AIR SDK
"""
class AirError(Exception):
"""
Base exception class. All custom exceptions should inherit from this class.
"""
def __init__(se... | air_sdk-main | air_sdk/exceptions.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Login module
"""
from . import util
from .air_model import AirModel
class Login(AirModel):
"""
View login information
### json
Returns a JSON string representati... | air_sdk-main | air_sdk/login.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Node module
"""
from . import util
from .air_model import AirModel
class Node(AirModel):
"""
Manage a Node
### delete
Delete the node. Once successful, the objec... | air_sdk-main | air_sdk/node.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Demo module
"""
from . import util
from .air_model import AirModel
class Demo(AirModel):
"""
View Demos
### json
Returns a JSON string representation of the demo
... | air_sdk-main | air_sdk/demo.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
SimulationNode module
"""
from . import util
from .air_model import AirModel
class SimulationNode(AirModel):
"""
Manage a SimulationNode
### json
Returns a JSON ... | air_sdk-main | air_sdk/simulation_node.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Image module
"""
from . import util
from .air_model import AirModel
class Image(AirModel):
"""
Manage an Image
### delete
Delete the image. Once successful, the ... | air_sdk-main | air_sdk/image.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Account module
"""
from . import util
from .air_model import AirModel
class Account(AirModel):
"""
Manage an Account
### json
Returns a JSON string representation... | air_sdk-main | air_sdk/account.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for simulation.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring,duplicate-code,unused-argument
import datetime as dt
from unittest import TestCase
f... | air_sdk-main | tests/simulation.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for link.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring
from unittest import TestCase
from unittest.mock import MagicMock, patch
from ..air_sdk i... | air_sdk-main | tests/link.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for ssh_key.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring
from unittest import TestCase
from unittest.mock import MagicMock, patch
from ..air_sd... | air_sdk-main | tests/ssh_key.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for worker.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring
from unittest import TestCase
from unittest.mock import MagicMock, patch
from ..air_sdk... | air_sdk-main | tests/worker.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for air_api.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring,protected-access
#pylint: disable=arguments-differ,unused-argument,no-member,too-many-p... | air_sdk-main | tests/air_api.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for service.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring,unused-argument
from unittest import TestCase
from unittest.mock import MagicMock, patc... | air_sdk-main | tests/service.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for capacity.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring,unused-argument
from unittest import TestCase
from unittest.mock import MagicMock, pat... | air_sdk-main | tests/capacity.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for token.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring
from unittest import TestCase
from unittest.mock import MagicMock, patch
from ..air_sdk ... | air_sdk-main | tests/token.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for permission.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring
from unittest import TestCase
from unittest.mock import MagicMock, patch
from ..air... | air_sdk-main | tests/permission.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for util.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring,no-self-use,unused-argument
import datetime
from json import JSONDecodeError
from unitte... | air_sdk-main | tests/util.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for organization.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring,protected-access
from copy import deepcopy
from unittest import TestCase
from unit... | air_sdk-main | tests/organization.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for air_model.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring,unused-argument
#pylint: disable=too-many-public-methods,duplicate-code,protected-acc... | air_sdk-main | tests/air_model.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for job.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring
from unittest import TestCase
from unittest.mock import MagicMock, patch
from ..air_sdk im... | air_sdk-main | tests/job.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for interface.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring
from unittest import TestCase
from unittest.mock import MagicMock, patch
from ..air_... | air_sdk-main | tests/interface.py |
air_sdk-main | tests/__init__.py | |
# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for resource_budget.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring
from unittest import TestCase
from unittest.mock import MagicMock, patch
from ..air... | air_sdk-main | tests/resource_budget.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for topology.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring,unused-argument
import io
from unittest import TestCase
from unittest.mock import Magi... | air_sdk-main | tests/topology.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for marketplace.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring
from unittest import TestCase
from unittest.mock import MagicMock, patch
from ..ai... | air_sdk-main | tests/marketplace.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for simulation_interface.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring,unused-argument
from unittest import TestCase
from unittest.mock import Ma... | air_sdk-main | tests/simulation_interface.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for exceptions.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring
from unittest import TestCase
from ..air_sdk import exceptions
class TestAirError... | air_sdk-main | tests/exceptions.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for login.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring
from unittest import TestCase
from unittest.mock import MagicMock, patch
from ..air_sdk ... | air_sdk-main | tests/login.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for node.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring,unused-argument
from unittest import TestCase
from unittest.mock import MagicMock, patch
... | air_sdk-main | tests/node.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for demo.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring
from unittest import TestCase
from unittest.mock import MagicMock, patch
from ..air_sdk i... | air_sdk-main | tests/demo.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for simulation_node.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring,unused-argument
from unittest import TestCase
from unittest.mock import MagicMo... | air_sdk-main | tests/simulation_node.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for image.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring
from unittest import TestCase
from unittest.mock import MagicMock, patch
from ..air_sdk ... | air_sdk-main | tests/image.py |
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: MIT
"""
Tests for account.py
"""
#pylint: disable=missing-function-docstring,missing-class-docstring
from unittest import TestCase
from unittest.mock import MagicMock
from ..air_sdk impor... | air_sdk-main | tests/account.py |
# Copyright (c) 2014-2018, 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, c... | pynvrtc-master | setup.py |
# Copyright (c) 2014-2015, 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, c... | pynvrtc-master | run-tests.py |
# Copyright (c) 2014-2015, 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, c... | pynvrtc-master | pynvrtc/compiler.py |
# Copyright (c) 2014-2018, 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, c... | pynvrtc-master | pynvrtc/interface.py |
# Copyright (c) 2014-2018, 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, c... | pynvrtc-master | pynvrtc/__init__.py |
# Copyright (c) 2014-2015, 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, c... | pynvrtc-master | tests/util.py |
# Copyright (c) 2014-2015, 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, c... | pynvrtc-master | tests/import-test.py |
# Copyright (c) 2014-2016, 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, c... | pynvrtc-master | tests/compile-tests.py |
# Copyright (c) 2014-2018, 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, c... | pynvrtc-master | samples/ptxgen.py |
# Copyright (c) 2019, 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 applic... | clara-viz-main | src/examples/renderer/gen_volume.py |
# Copyright (c) 2017 NVIDIA Corporation
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import os
import sys
import tensorflow as tf
if hasattr(tf.compat, 'v1'):
tf.compat.v1.disable_eager_execution()
from open_seq... | OpenSeq2Seq-master | run.py |
from frame_asr import FrameASR
import numpy as np
import pyaudio as pa
import time
CHANNELS = 1
RATE = 16000
DURATION = 2.0
CHUNK_SIZE = int(DURATION*RATE)
p = pa.PyAudio()
print('Available audio input devices:')
for i in range(p.get_device_count()):
dev = p.get_device_info_by_index(i)
if dev.get('maxInputCh... | OpenSeq2Seq-master | demo_streaming_asr.py |
# Copyright (c) 2019 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
import numpy as np
import scipy.io.wavfile as wave
import tensorflow as tf
from collections import defaultdict
from open_seq2seq.utils.utils import get_base_config, check_logdir,\
... | OpenSeq2Seq-master | frame_asr.py |
# Copyright (c) 2017 NVIDIA Corporation
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
#from open_seq2seq.data.text2text.text2text import SpecialTextTokens
import argparse
import sentencepiece as spm
import os
import... | OpenSeq2Seq-master | tokenizer_wrapper.py |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# OpenSeq2Seq documentation build configuration file, created by
# sphinx-quickstart on Thu Apr 12 14:49:40 2018.
#
# 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
... | OpenSeq2Seq-master | docs/sources/source/conf.py |
# coding: utf-8
import sys
sys.path.append("./transformerxl")
sys.path.append("./transformerxl/utils")
import argparse
from typing import List
import torch
import random
from utils.vocabulary import Vocab
from torch.nn.utils.rnn import pad_sequence
parser = argparse.ArgumentParser(
description='Process OS2S output w... | OpenSeq2Seq-master | external_lm_rescore/process_beam_dump.py |
import sys
import math
import functools
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
sys.path.append('utils')
from proj_adaptive_softmax import ProjectedAdaptiveLogSoftmax
from log_uniform_sampler import LogUniformSampler, sample_logits
class PositionalEmbedding(nn.Module):
... | OpenSeq2Seq-master | external_lm_rescore/transformerxl/mem_transformer.py |
from collections import defaultdict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class AdaptiveLogSoftmax(nn.Module):
def __init__(self, in_features, n_classes, cutoffs, keep_order=False):
super(AdaptiveLogSoftmax, self).__init__()
cutoffs = list(cutoffs)... | OpenSeq2Seq-master | external_lm_rescore/transformerxl/utils/adaptive_softmax.py |
from torch.nn.parallel import DataParallel
import torch
from torch.nn.parallel._functions import Scatter
from torch.nn.parallel.parallel_apply import parallel_apply
def scatter(inputs, target_gpus, chunk_sizes, dim=0):
r"""
Slices tensors into approximately equal chunks and
distributes them across given G... | OpenSeq2Seq-master | external_lm_rescore/transformerxl/utils/data_parallel.py |
from collections import defaultdict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
CUDA_MAJOR = int(torch.version.cuda.split('.')[0])
CUDA_MINOR = int(torch.version.cuda.split('.')[1])
class ProjectedAdaptiveLogSoftmax(nn.Module):
def __init__(self, n_token, d_embed, d_pro... | OpenSeq2Seq-master | external_lm_rescore/transformerxl/utils/proj_adaptive_softmax.py |
import torch
from torch import nn
import numpy as np
class LogUniformSampler(object):
def __init__(self, range_max, n_sample):
"""
Reference : https://github.com/tensorflow/tensorflow/blob/r1.10/tensorflow/python/ops/candidate_sampling_ops.py
`P(class) = (log(class + 2) - log(class + 1)... | OpenSeq2Seq-master | external_lm_rescore/transformerxl/utils/log_uniform_sampler.py |
import functools
import os, shutil
import numpy as np
import torch
def logging(s, log_path, print_=True, log_=True):
if print_:
print(s)
if log_:
with open(log_path, 'a+') as f_log:
f_log.write(s + '\n')
def get_logger(log_path, **kwargs):
return functools.partial(logging, l... | OpenSeq2Seq-master | external_lm_rescore/transformerxl/utils/exp_utils.py |
import os
from collections import Counter, OrderedDict
import torch
class Vocab(object):
def __init__(self, special=[], min_freq=0, max_size=None, lower_case=True,
delimiter=None, vocab_file=None):
self.counter = Counter()
self.special = special
self.min_freq = min_freq
... | OpenSeq2Seq-master | external_lm_rescore/transformerxl/utils/vocabulary.py |
import numpy as np
import pickle
import tensorflow as tf
def load_test_sample(pickle_file):
with open(pickle_file, 'rb') as f:
seq, label = pickle.load(f, encoding='bytes')
return seq, label
def load_vocab(vocab_file):
vocab = []
with open(vocab_file, 'r') as f:
for line in f:
vocab.append(lin... | OpenSeq2Seq-master | ctc_decoder_with_lm/ctc-test.py |
import pandas as pd
import os
import argparse
def get_corpus(csv_files):
'''
Get text corpus from a list of CSV files
'''
SEP = '\n'
corpus = ''
for f in csv_files:
df = pd.read_csv(f)
corpus += SEP.join(df['transcript']) + SEP
return corpus
if __name__ == '__main__':
parser = argparse.Argume... | OpenSeq2Seq-master | scripts/build_lm.py |
import os
import sys
import argparse
import librosa
parser = argparse.ArgumentParser(description='Conversion parameters')
parser.add_argument("--source_dir", required=False, type=str, default="calibration/sound_files/",
help="Path to source of flac LibriSpeech files")
parser.add_argument("--target_... | OpenSeq2Seq-master | scripts/change_sample_rate.py |
# Copyright (c) 2018 NVIDIA Corporation
import time
import numpy as np
import tensorflow as tf
from open_seq2seq.utils.utils import get_base_config, check_logdir,\
create_model, deco_print
from open_seq2seq.models.text2speech import save_audio
if __name__ == '__main__':
# Defin... | OpenSeq2Seq-master | scripts/tacotron_gst_create_syn_data.py |
# Copyright (c) 2019 NVIDIA Corporation
"""This file takes given a logits output pickle and start and end shifts
words to speech and writes them in a csv file
"""
from __future__ import absolute_import, division, print_function
import pickle
import argparse
import sys
import csv
import os
sys.path.append(os.getcwd()... | OpenSeq2Seq-master | scripts/dump_to_time.py |
# Copyright (c) 2018 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import os
import numpy as np
import pandas as pd
if __name__ == '__main__':
data_root = "/data/speech/MAILABS"
sub_dirs = ["en_US/by_book/male/elliot_miller/hunters_spac... | OpenSeq2Seq-master | scripts/tacotron_gst_combine_csv.py |
# Copyright (c) 2017 NVIDIA Corporation
"""This file helps to calculate word to speech alignments for your model
Please execute get_calibration_files.sh before running this script
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unic... | OpenSeq2Seq-master | scripts/calibrate_model.py |
#!/usr/bin/env python
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Copyright (c) 2018 Mozilla Corporation
from __future__ import absolute_import, division, pri... | OpenSeq2Seq-master | scripts/import_librivox.py |
# Replace the first box of Interactive_Infer_example.ipynb with this
import IPython
import librosa
import numpy as np
import scipy.io.wavfile as wave
import tensorflow as tf
from open_seq2seq.utils.utils import deco_print, get_base_config, check_logdir,\
create_logdir, create_mod... | OpenSeq2Seq-master | scripts/wavenet_naive_infer.py |
# Copyright (c) 2018 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import os
import numpy as np
import pandas as pd
if __name__ == '__main__':
MAILABS_data_root = "/data/speech/MAILABS"
libri_data_root = "/data/speech/librispeech"
li... | OpenSeq2Seq-master | scripts/tacotron_gst_create_infer_csv.py |
'''
Interface to Baidu's CTC decoders
from https://github.com/PaddlePaddle/DeepSpeech/decoders/swig
'''
import argparse
import pickle
import numpy as np
from ctc_decoders import Scorer
from ctc_decoders import ctc_greedy_decoder
from ctc_decoders import ctc_beam_search_decoder_batch, ctc_beam_search_decoder
from col... | OpenSeq2Seq-master | scripts/decode.py |
# Copyright (c) 2018 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import string
import os
import pandas as pd
if __name__ == '__main__':
synthetic_data_root = "/data/speech/librispeech-syn/"
synthetic_data_sample = synthetic_data_root ... | OpenSeq2Seq-master | scripts/nsr_create_syn_train_csv.py |
%matplotlib inline
# Replace the first box of Interactive_Infer_example.ipynb with this
import IPython
import librosa
import numpy as np
import scipy.io.wavfile as wave
import tensorflow as tf
import matplotlib.pyplot as plt
from open_seq2seq.utils.utils import deco_print, get_base_config, check_logdir,\
... | OpenSeq2Seq-master | scripts/tacotron_save_spec.py |
import numpy as np
import pickle
import tensorflow as tf
from ctc_decoders import Scorer, ctc_beam_search_decoder
def load_test_sample(pickle_file):
with open(pickle_file, 'rb') as f:
seq, label = pickle.load(f, encoding='bytes')
return seq, label
def load_vocab(vocab_file):
vocab = []
with open(vocab... | OpenSeq2Seq-master | scripts/ctc_decoders_test.py |
import pandas as pd
import os
import argparse
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Build N-gram LM model from text file')
parser.add_argument('text', metavar='text', type=str,
help='text file')
parser.add_argument('--n', type=int, help='n for n-grams', d... | OpenSeq2Seq-master | scripts/build_lm_text.py |
'''
Return the best evaluation accuracy from a file
output-ed by the sentiment analysis model
'''
import sys
def get_best_accuracy(output_file):
output = open(output_file, 'r')
keyword = "*** EVAL Accuracy: "
best_acc = 0.0
loss, stat, step = '', '', ''
get_stat = False
n = len(keyword)
m = len("*** Val... | OpenSeq2Seq-master | scripts/get_best_accuracy.py |
"""Set up paths for DS2"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os.path
import sys
def add_path(path):
if path not in sys.path:
sys.path.insert(0, path)
this_dir = os.path.dirname(__file__)
# Add project path to PYTHONPATH
... | OpenSeq2Seq-master | decoders/_init_paths.py |
OpenSeq2Seq-master | decoders/__init__.py | |
"""Script to build and install decoder package."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from setuptools import setup, Extension, distutils
import glob
import platform
import os, sys
import multiprocessing.pool
import argparse
parser = argparse.Ar... | OpenSeq2Seq-master | decoders/setup.py |
"""Wrapper for various CTC decoders in SWIG."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import swig_decoders
class Scorer(swig_decoders.Scorer):
"""Wrapper for Scorer.
:param alpha: Parameter associated with language model. Don't use
... | OpenSeq2Seq-master | decoders/ctc_decoders.py |
# Copyright (c) 2017 NVIDIA Corporation
"""
This package provides multi-node, multi-GPU sequence to sequence learning
""" | OpenSeq2Seq-master | open_seq2seq/__init__.py |
# Copyright (c) 2019 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import tensorflow as tf
from .loss import Loss
class Text2SpeechLoss(Loss):
"""
Default text-to-speech loss.
"""
@staticmethod
def get_optional_params():
re... | OpenSeq2Seq-master | open_seq2seq/losses/text2speech_loss.py |
# Copyright (c) 2018 NVIDIA Corporation
import tensorflow as tf
from .loss import Loss
class WavenetLoss(Loss):
def __init__(self, params, model, name="wavenet_loss"):
super(WavenetLoss, self).__init__(params, model, name)
self._n_feats = self._model.get_data_layer().params["num_audio_features"]
def ge... | OpenSeq2Seq-master | open_seq2seq/losses/wavenet_loss.py |
# Copyright (c) 2018 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import tensorflow as tf
from open_seq2seq.utils.utils import mask_nans, deco_print
from .loss import Loss
def dense_to_sparse(dense_tensor, sequence_length):
indices = ... | OpenSeq2Seq-master | open_seq2seq/losses/ctc_loss.py |
# Copyright (c) 2018 NVIDIA Corporation
"""
Losses to be used in seq2seq models
"""
from .sequence_loss import BasicSequenceLoss, CrossEntropyWithSmoothing, \
PaddedCrossEntropyLossWithSmoothing, BasicSampledSequenceLoss
from .ctc_loss import CTCLoss
from .cross_entropy_loss import CrossEntropyLoss
from .wavenet_lo... | OpenSeq2Seq-master | open_seq2seq/losses/__init__.py |
# Copyright (c) 2018 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import tensorflow as tf
from .loss import Loss
from .ctc_loss import CTCLoss
from .sequence_loss import BasicSequenceLoss
# To-Do Replace this with a generic multi-task lo... | OpenSeq2Seq-master | open_seq2seq/losses/jca_loss.py |
# Copyright (c) 2017 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import numpy as np
import tensorflow as tf
from open_seq2seq.losses.sequence_loss import CrossEntropyWithSmoothing, \
BasicSequenceLoss
class CrossEntropyWithSmoothingEq... | OpenSeq2Seq-master | open_seq2seq/losses/sequence_loss_test.py |
# Copyright (c) 2018 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import abc
import copy
import six
import tensorflow as tf
from open_seq2seq.utils.utils import check_params, cast_types
@six.add_metaclass(abc.ABCMeta)
class Loss:
"""A... | OpenSeq2Seq-master | open_seq2seq/losses/loss.py |
# Copyright (c) 2018 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import tensorflow as tf
from .loss import Loss
class CrossEntropyLoss(Loss):
"""Implementation of the usual cross_entropy loss with softmax."""
def __init__(self, pa... | OpenSeq2Seq-master | open_seq2seq/losses/cross_entropy_loss.py |
# Copyright (c) 2018 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
import tensorflow as tf
from .loss import Loss
class BasicSequenceLoss(Loss):
"""
Basic sequence-to-sequence loss. This one does not use one-hot encodings
"""
@sta... | OpenSeq2Seq-master | open_seq2seq/losses/sequence_loss.py |
OpenSeq2Seq-master | open_seq2seq/test_utils/__init__.py | |
# Copyright (c) 2017 NVIDIA Corporation
from __future__ import absolute_import, division, print_function
from __future__ import unicode_literals
from six.moves import range
import numpy as np
import os
import errno
import io
import shutil
def create_source(size, source_vocab, vocab_map):
source = []
for i in ran... | OpenSeq2Seq-master | open_seq2seq/test_utils/create_reversed_examples.py |
OpenSeq2Seq-master | open_seq2seq/test_utils/test_speech_configs/__init__.py | |
# pylint: skip-file
from __future__ import absolute_import, division, print_function
import tensorflow as tf
from open_seq2seq.models import Speech2Text
from open_seq2seq.encoders import DeepSpeech2Encoder
from open_seq2seq.decoders import FullyConnectedCTCDecoder
from open_seq2seq.data import Speech2TextDataLayer
from... | OpenSeq2Seq-master | open_seq2seq/test_utils/test_speech_configs/ds2_test_config.py |
# pylint: skip-file
from __future__ import absolute_import, division, print_function
import tensorflow as tf
from open_seq2seq.models import Speech2Text
from open_seq2seq.encoders import TDNNEncoder
from open_seq2seq.decoders import FullyConnectedCTCDecoder
from open_seq2seq.data import Speech2TextDataLayer
from open_s... | OpenSeq2Seq-master | open_seq2seq/test_utils/test_speech_configs/w2l_test_config.py |
# pylint: skip-file
import tensorflow as tf
from open_seq2seq.models import Speech2Text
from open_seq2seq.encoders import TDNNEncoder
from open_seq2seq.decoders import FullyConnectedCTCDecoder
from open_seq2seq.data.speech2text.speech2text import Speech2TextDataLayer
from open_seq2seq.losses import CTCLoss
from open_se... | OpenSeq2Seq-master | open_seq2seq/test_utils/test_speech_configs/jasper_res_blockout_test_config.py |
# Copyright (c) 2019 NVIDIA Corporation
"""This file has a CTC Greedy decoder"""
import numpy as np
def ctc_greedy_decoder(logits, wordmap, step_size,
blank_idx, start_shift, end_shift):
"""Decodes logits to chars using greedy ctc format,
outputs start and end time for every word
Args :
... | OpenSeq2Seq-master | open_seq2seq/utils/ctc_decoder.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.