python_code stringlengths 0 229k |
|---|
import logging
from typing import Optional, Tuple, List
import torch
from torch import Tensor, nn
from torch.nn import Module
_LG = logging.getLogger(__name__)
class LayerNorm(nn.LayerNorm):
"""Layer norm with transpose"""
def forward(self, input: Tensor) -> Tensor:
x = input.transpose(-2, -1)
... |
from .import_huggingface import import_huggingface_model
from .import_fairseq import import_fairseq_model
__all__ = [
'import_huggingface_model',
'import_fairseq_model',
]
|
"""Import Hugging Face transformers's wav2vec2.0 pretrained weights to torchaudios's format.
"""
import logging
from torch.nn import Module
from ..model import Wav2Vec2Model, wav2vec2_model
_LG = logging.getLogger(__name__)
def _get_config(cfg):
config = {
'extractor_mode': f'{cfg.feat_extract_norm}_no... |
"""Import fariseq's wav2vec2.0 pretrained weights to torchaudios's format.
For this module to work, you need `fairseq`.
"""
import re
from torch.nn import Module
from ..model import Wav2Vec2Model, wav2vec2_model
def _parse_config(w2v_model):
encoder = w2v_model.encoder
conv_layers = w2v_model.feature_extra... |
import math
from typing import List, Optional, Tuple
import torch
__all__ = ["Emformer"]
def _lengths_to_padding_mask(lengths: torch.Tensor) -> torch.Tensor:
batch_size = lengths.shape[0]
max_length = int(torch.max(lengths).item())
padding_mask = torch.arange(
max_length, device=lengths.device,... |
from .emformer import Emformer
__all__ = ["Emformer"]
|
from . import kaldi
__all__ = [
'kaldi',
]
|
from typing import Tuple
import math
import torch
from torch import Tensor
import torchaudio
__all__ = [
'get_mel_banks',
'inverse_mel_scale',
'inverse_mel_scale_scalar',
'mel_scale',
'mel_scale_scalar',
'spectrogram',
'fbank',
'mfcc',
'vtln_warp_freq',
'vtln_warp_mel_freq',
]... |
import os
from typing import List, Tuple, Optional
import torch
import torchaudio
from torchaudio._internal import module_utils as _mod_utils
from torchaudio.utils.sox_utils import list_effects
@_mod_utils.requires_sox()
def init_sox_effects():
"""Initialize resources required to use sox effects.
Note:
... |
from torchaudio._internal import module_utils as _mod_utils
from .sox_effects import (
init_sox_effects,
shutdown_sox_effects,
effect_names,
apply_effects_tensor,
apply_effects_file,
)
if _mod_utils.is_sox_available():
import atexit
init_sox_effects()
atexit.register(shutdown_sox_effec... |
import math
import warnings
from typing import Optional
import torch
from torch import Tensor
def _dB2Linear(x: float) -> float:
return math.exp(x * math.log(10) / 20.0)
def _generate_wave_table(
wave_type: str,
data_type: str,
table_size: int,
min: float,
max: float,
phase: float,
... |
from .functional import (
amplitude_to_DB,
compute_deltas,
compute_kaldi_pitch,
create_dct,
melscale_fbanks,
linear_fbanks,
DB_to_amplitude,
detect_pitch_frequency,
inverse_spectrogram,
griffinlim,
mask_along_axis,
mask_along_axis_iid,
mu_law_encoding,
mu_law_deco... |
# -*- coding: utf-8 -*-
from collections.abc import Sequence
import io
import math
import warnings
from typing import Optional, Tuple
import torch
from torch import Tensor
from torchaudio._internal import module_utils as _mod_utils
import torchaudio
__all__ = [
"spectrogram",
"inverse_spectrogram",
"grif... |
#!/usr/bin/env python3
"""
This script should use a very simple, functional programming style.
Avoid Jinja macros in favor of native Python functions.
Don't go overboard on code generation; use Python only to generate
content that can't be easily declared statically using CircleCI's YAML API.
Data declarations (e.g.... |
#!/usr/bin/env python
"""A wrapper script around clang-format, suitable for linting multiple files
and to use for continuous integration.
This is an alternative API for the clang-format command line.
It runs over multiple files and directories in parallel.
A diff output is produced and a sensible exit code is returned... |
import asyncio
import aiohttp # type: ignore
import math
import os
import datetime
import re
import boto3 # type: ignore
import json
import io
import argparse
import gzip
import os
from cryptography.hazmat.backends import default_backend
import jwt
import requests
import time
from typing import *
BUCKET = os.getenv... |
#!/usr/bin/env python3
from pathlib import Path
import jinja2
import os
from dataclasses import dataclass
from typing import Any
REPO_ROOT = Path(__file__).resolve().parent.parent.parent
GITHUB_DIR = REPO_ROOT / ".github"
CRONS = {
"5 minutes": "*/5 * * * *",
"1 hour": "0 * * * *",
}
@dataclass
class Bra... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
|
#!/usr/bin/env python3
from __future__ import absolute_import, division, print_function, unicode_literals
import json
import logging
import os
import os.path
import shutil
import subprocess
import tarfile
import textwrap
import urllib.request
import uuid
import zipfile
from os import walk
from shutil import copyfile
... |
from __future__ import absolute_import, division, print_function, unicode_literals
import util
# Create a Kubernetes specs and YAML job file based on user inputs
def configure(args):
util.configure_yaml(args)
util.configure_json(args)
# Deploys a Kubernetes cluster
def setup(args):
# Install AKS Engine... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# PyTorch documentation build configuration file, created by
# sphinx-quickstart on Fri Dec 23 13:31:47 2016.
#
# 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
# au... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
"""
For each rst file, generates a corresponding rst file
that redirects http://pytorch.o... |
#!/usr/bin/env python3
import io
import os
import pprint
import sys
import torch.distributed as dist
if __name__ == "__main__":
env_dict = {
k: os.environ[k]
for k in (
"LOCAL_RANK",
"RANK",
"GROUP_RANK",
"WORLD_SIZE",
"MASTER_ADDR",
... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
r"""
Source: `pytorch imagenet example <https://github.com/pytorch/examples/blob/master/i... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import sys
import time
def wait_for(msg, timeout: float = 300, interval: int = 1, print... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import getpass
import logging
import os
import random
import string
from jinja2 import ... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
|
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import getpass
import json
import logging
import os
import sys
from os.pa... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import shutil
import tarfile as tar
import tempfile
log = logg... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
from enum import Enum, unique
from jinja2 import Template
from ... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import abc
import boto3
class AwsSessionProvider:
"""
Provides AWS credentials... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from .session import AwsSessionProvider
def get_session(region):
return AwsSessionP... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
|
#!/usr/bin/env/python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from torch.distributed.launcher.api import ( # noqa F401
elastic_launch,
launch... |
#!/usr/bin/env/python3
# Copyright (c) Facebook, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
os.environ["LOGLEVEL"] = "INFO"
# Since logger initialized during imoprt stat... |
from subprocess import check_output, STDOUT, CalledProcessError
import sys
import pytest
import glob
PYTHON_CODE_DIR = "python_code"
ALL_FILES = glob.glob(PYTHON_CODE_DIR + "/*.py")
@pytest.mark.parametrize('file_path', ALL_FILES)
def test_run_file(file_path):
if 'nvidia' in file_path:
# FIXME: NVIDIA m... |
valid_tags = ['vision',
'nlp',
'generative',
'audio',
'scriptable',
]
|
import argparse
import os
import glob
from urllib.request import urlopen, HTTPError
from tags import valid_tags
import yaml
import mistune
class ValidMD:
def __init__(self, filename):
self.filename = filename
self.required_user_fields = ['title', 'summary', 'image', 'author',
... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from elf.options import auto_import_options, PyOptionSpec
from rlpytorch import Model
from elfg... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
from elf import GCWrapper, ContextArgs, MoreLabels
from elf.o... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
from elf import GCWrapper, ContextArgs, MoreLabels
from elf.o... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from torch.autograd import Variable
from elf.options import auto_import_options, PyOptionSpec
fr... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from elf.options import auto_import_options, PyOptionSpec
from rlpytorch import Model
from elfg... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
import torch
import torch.nn as nn
import torch.distributed as dist
from elf.options import auto_import_opt... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from torch.autograd import Variable
import elf.logging as logging
from elf.options import auto_i... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from .model_base import Model
from .model_loader import ModelLoader, load_env
from .model_interface import ModelInterfa... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
from collections import OrderedDict
from copy import deepcopy
from time import sleep
import torch
import tor... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import importlib
import pprint
import random
import time
import torch
import warnings
from elf.options import import_o... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from collections import deque
import torch
import torch.cuda
import torch.optim
from elf.options import auto_import_o... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from torch.autograd import Variable
from elf.options import auto_import_options, PyOptionSpec
from .utils import add_e... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from elf.options import auto_import_options, PyOptionSpec
from .policy_gradient import PolicyGradient
from .discounted_... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from torch.autograd import Variable
from elf.options import auto_import_options, PyOptionSpec
f... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from .actor_critic import ActorCritic
from .rnn_actor_critic import RNNActorCritic
from .q_learning import Q_learning
f... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from elf.options import auto_import_options, PyOptionSpec
class DiscountedReward(object):
@classmethod
def ge... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
def average_norm_clip(grad, clip_val):
'''
Compute the norm and clip it if necessary.
The first dimension ... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
from torch.autograd import Variable
from elf.options import auto_import_options, Py... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import torch.nn as nn
from torch.autograd import Variable
from elf.options import auto_import_options, PyOptionSpec
fr... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from .single_process import SingleProcessRun
# from .multi_process import MultiProcessRun
from .eval_iters import EvalI... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from elf.options import auto_import_options, PyOptionSpec
from ..stats import Stats
class EvalItersBasic(object):
... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import tqdm
from elf.options import auto_import_options, PyOptionSpec
from .parameter_server import SharedData
class... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# XXX hack fix path
import os
import random
import sys
import torch.multiprocessing as _mp
import utils_elf
sys.pat... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import threading
from elf.options import auto_import_options, PyOptionSpec
class SingleProcessRun(object):
@clas... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# From https://code.activestate.com/recipes/577504/
from __future__ import print_function
from sys import getsizeof, st... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from .hist_states import HistState
|
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import math
import queue
from collections import defaultdict, Counter
from datetime import datetime
import numpy as np... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from collections import defaultdict, deque
class HistState:
def __init__(self, T, init_state_func=None):
... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import torch
from rlpytorch import Model
def apply_nonrecursive(module, fn):
"""Applies a given function only to ... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from .sampler import Sampler
from .sample_methods import sample_multinomial, epsilon_greedy
|
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import numpy as np
import torch
import sys
def uniform_multinomial(batchsize, num_action, use_cuda=True):
''' Sam... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from elf.options import auto_import_options, PyOptionSpec
from .sample_methods import sample_multinomial, epsilon_greed... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from .stats import EvalCount, RewardCount, WinRate, Stats
|
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from elf.options import import_options, PyOptionSpec
class EvalCount(object):
''' Eval Count. Run games and recor... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from datetime import datetime
import time
from collections import defaultdict
class RLTimer:
''' A customized tim... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from .utils import ModelSaver, MultiCounter, topk_accuracy
from .trainer import Trainer, Evaluator
from .lstm_trainer i... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from datetime import datetime
import torch
from torch.autograd import Variable
from elf.options import auto_import_op... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
from collections import defaultdict, deque, Counter
from datetime import datetime
from elf.options import au... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
import sys
from datetime import datetime
from elf.options import auto_import_options, import_options, PyOpti... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import sys
from collections import defaultdict
import numpy as np
import torch
class Allocator(object):
''' A wr... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from elf.options import auto_import_options, PyOptionSpec
class ContextArgs(object):
@classmethod
def get_opt... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# C++ imports
from _elf import *
# Other imports
from .context_utils import ContextArgs
from .more_labels import MoreL... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import zmq
class ZMQCtx:
def __init__(self):
pass
def __enter__(self):
pass
def __exit_... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from elf.options import auto_import_options, PyOptionSpec
class MoreLabels(object):
@classmethod
def get_opti... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from .import_options import auto_import_options, import_options
from .py_option_map import PyOptionMap
from .py_option_... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import json
import sys
import elf
from _elf import _options
# We can get rid of this and just eval()... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import json
import elf
from _elf import _options
class PyOptionMap(_options.OptionMap):
"""Override C++ OptionMa... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import argparse
def import_options(obj, option_map, option_spec, namespace=None):
"""Stores the parameters from a... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from elf.options import auto_import_options, PyOptionSpec
from . import LoggerLevel, set_level
class GlobalLoggingCo... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
# Let's import C++ logging functions/classes as-is.
from _elf._logging import *
from .configuration import GlobalLoggi... |
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import inspect
import traceback
from collections import Counter
def move2xy(v):
if v.lower() == "pass":
r... |
#!/usr/bin/env python
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
import sys
import torch
from console_lib import GoConsoleGTP
from rlpytorch import E... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
import sys
import time
import re
from datetime import datetime... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2018-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import os
import sys
import re
import time
import torch
from rlpytorch... |
addrs = {
"myserver": "[XXX.XXX.XXX.XXX]",
}
|
import os
import re
import sys
from pathlib import Path
import argparse
import torch
import platform
import importlib
import subprocess
import torch._dynamo
import torch.nn as nn
import torch.nn.functional as F
gpu_arch_ver = os.getenv("MATRIX_GPU_ARCH_VERSION")
gpu_arch_type = os.getenv("MATRIX_GPU_ARCH_TYPE")
channe... |
r"""
It's used to check basic rnn features with cuda.
For example, it would throw exception if some components are missing
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
class SimpleCNN(nn.Module):
def __init__(self):
super().__init__()
self.conv... |
r"""
It's used to check basic rnn features with cuda.
For example, it would throw exception if missing some components are missing
"""
import torch
import torch.nn as nn
device = torch.device("cuda:0")
rnn = nn.RNN(10, 20, 2).to(device)
inputs = torch.randn(5, 3, 10).to(device)
h0 = torch.randn(2, 3, 20).to(device)
o... |
# Logic copied from PEP 513
def is_manylinux1_compatible():
# Only Linux, and only x86-64 / i686
from distutils.util import get_platform
if get_platform() not in ["linux-x86_64", "linux-i686"]:
return False
# Check for presence of _manylinux module
try:
import _manylinux
re... |
# cf. https://github.com/pypa/manylinux/issues/53
GOOD_SSL = "https://google.com"
BAD_SSL = "https://self-signed.badssl.com"
import sys
print("Testing SSL certificate checking for Python:", sys.version)
if (sys.version_info[:2] < (2, 7)
or sys.version_info[:2] < (3, 4)):
print("This version never checks SSL... |
#!/usr/bin/env python
import argparse
import time
from os import path, makedirs
from datetime import datetime
from collections import defaultdict
from typing import Iterator, List, Type, Dict, Set, TypeVar, Optional
from re import sub, match, search
from packaging.version import parse
import boto3
S3 = boto3.resou... |
#!/usr/bin/env python3
# Downloads domain pytorch and library packages from channel
# And backs them up to S3
# Do not use unless you know what you are doing
# Usage: python backup_conda.py --version 1.6.0
import conda.api
import boto3
from typing import List, Optional
import urllib
import os
import hashlib
import ar... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.