python_code stringlengths 0 679k | repo_name stringlengths 9 41 | file_path stringlengths 6 149 |
|---|---|---|
import torch
from nemo.utils import logging
from rdkit import Chem
from pysmilesutils.augment import SMILESAugmenter
from typing import List
import numpy as np
import math
from nemo_chem.tokenizer import MolEncTokenizer
import time
__all__ = ['PrepareDataset']
class PrepareDataset:
def __init__(self, tokenizer: ... | MegaMolBART-dev | nemo_chem/data/prepare_dataset.py |
# Copyright (c) 2022, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
# 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 re... | MegaMolBART-dev | nemo_chem/data/__init__.py |
# Copyright (c) 2022, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
# 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 re... | MegaMolBART-dev | nemo_chem/data/augment.py |
# coding=utf-8
import os
import re
import math
import mmap
from typing import Optional
from dataclasses import dataclass
import torch
from nemo.core import Dataset, IterableDataset
from nemo.core.classes.dataset import DatasetConfig
from nemo.utils import logging
from nemo.collections.nlp.data.language_modeling.megat... | MegaMolBART-dev | nemo_chem/data/molecule_binary_dataset.py |
# Copyright (c) 2022, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
# 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 re... | MegaMolBART-dev | nemo_chem/data/utils.py |
# Copyright (c) 2022, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
# 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 re... | MegaMolBART-dev | nemo_chem/data/csv_dataset.py |
# Copyright (c) 2020, 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 appl... | MegaMolBART-dev | nemo_chem/data/preprocess/csv_to_binary.py |
# Copyright (c) 2022, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
# 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 re... | MegaMolBART-dev | nemo_chem/data/preprocess/preprocess.py |
import logging
from contextlib import contextmanager
from rdkit import Chem
from hydra import compose, initialize
from nemo_chem.models.megamolbart import NeMoMegaMolBARTWrapper
log = logging.getLogger(__name__)
_INFERER = None
@contextmanager
def load_model(inf_cfg):
global _INFERER
if _INFERER is None:
... | MegaMolBART-dev | tests/test_inference.py |
# # Copyright (c) 2022, NVIDIA CORPORATION.
# # SPDX-License-Identifier: Apache-2.0
# # 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... | MegaMolBART-dev | tests/pre_train_model_test.py |
# Copyright (c) 2022, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
# 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 re... | MegaMolBART-dev | tests/test_tokenizer.py |
# Copyright (c) 2022, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
# 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 re... | MegaMolBART-dev | tests/__init__.py |
# Copyright (c) 2021, 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 appli... | MegaMolBART-dev | examples/chem/megamolbart_eval.py |
# Copyright (c) 2022, NVIDIA CORPORATION.
# SPDX-License-Identifier: Apache-2.0
# 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 re... | MegaMolBART-dev | examples/chem/megamolbart_pretrain.py |
import grpc
import torch
import logging
from megamolbart_pb2_grpc import GenerativeSamplerStub
from megamolbart_pb2 import InputSpec
log = logging.getLogger(__name__)
class InferenceWrapper():
def __init__(self):
channel = grpc.insecure_channel('localhost:50051')
self.stub = GenerativeSamplerStu... | MegaMolBART-dev | examples/chem/nbs/infer.py |
#!/usr/bin/python3
# SPDX-FileCopyrightText: Copyright (c) 2023 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 ... | PLDM-unpack-main | fwpkg_unpack.py |
#!/usr/bin/python3
"""
Auto unit test vector generator. Looks in the GENERATORS_DIR directory for any executable scripts or binaries, and
runs them to generate test vectors. Writes out a manifest file for caching vectors that have already been
generated.
"""
import os
import subprocess
import hashlib
import csv
impo... | MatX-main | test/test_vectors/GenerateTestVectors.py |
#!/usr/bin/env python3
import numpy as np
from scipy import signal
from scipy import io
from numpy import random
import math
import matx_common
from typing import Dict, List
class mvdr_beamformer:
def __init__(self, dtype: str, size: List[int]):
self.size = size
self.dtype = dtype
np.rand... | MatX-main | test/test_vectors/generators/mvdr_beamformer.py |
#!/usr/bin/env python3
import numpy as np
from scipy import linalg as slinalg
from numpy import random
import math
import matx_common
from typing import Dict, List
class inv:
def __init__(self, dtype: str, size: List[int]):
self.size = size
self.dtype = dtype
np.random.seed(1234)
def... | MatX-main | test/test_vectors/generators/00_solver.py |
#!/usr/bin/env python3
import numpy as np
import scipy.signal as ss
from typing import Dict, List
class kron_operator:
def __init__(self, dtype: str, size: List[int]):
pass
def run(self) -> Dict[str, np.array]:
b = np.array([[1, -1], [-1, 1]])
self.square = np.kron(np.eye(4), b)
... | MatX-main | test/test_vectors/generators/00_operators.py |
#!/usr/bin/env python3
import numpy as np
from scipy import fft as sf
from scipy import signal as ss
from numpy import random
from typing import Dict, List
class dct:
def __init__(self, dtype: str, size: List[int]):
self.size = size
self.dtype = dtype
def run(self):
N = self.size[0]
... | MatX-main | test/test_vectors/generators/01_signal.py |
#!/usr/bin/env python3
import numpy as np
import sys
from scipy import special
from scipy.constants import c, pi
import matx_common
from typing import Dict, List
class softmax:
def __init__(self, dtype: str, size: List[int]):
np.random.seed(1234)
self.t1 = matx_common.randn_ndarray((size[-1],), d... | MatX-main | test/test_vectors/generators/00_reductions.py |
#!/usr/bin/env python3
import numpy as np
from scipy import signal
from scipy import io
from numpy import random
import math
import os
import matx_common
import cupy as cp
from typing import Dict, List
class simple_radar_pipeline:
def __init__(self, dtype: str, size: List[int]):
self.size = size
... | MatX-main | test/test_vectors/generators/01_radar.py |
import numpy as np
def tup_2_string(x):
return '_'.join(reversed(list(map(str, x))))
def to_file(var, name):
if (var.dtype == np.complex128):
var.astype(np.complex64).tofile(
f'{name}_{tup_2_string(var.shape)}_complex64.bin')
elif (var.dtype == np.float64):
var.astype(np.floa... | MatX-main | test/test_vectors/generators/matx_common.py |
#!/usr/bin/env python3
import math
import numpy as np
import sys
from scipy import io
from scipy import signal
from scipy.constants import c, pi
from scipy.fft import ifft
import matx_common
from typing import Dict, List
class conv_operators:
def __init__(self, dtype: str, size: List[int]):
np.random.see... | MatX-main | test/test_vectors/generators/00_transforms.py |
#!/usr/bin/env python3
import numpy as np
from typing import Dict, List
import os
class csv:
def __init__(self, dtype: str, sizes: List[int]):
self.dtype = dtype
self.files = ("../test/00_io/small_csv_comma_nh.csv", "../test/00_io/small_csv_complex_comma_nh.csv")
def run(self) -> Dict[str, n... | MatX-main | test/test_vectors/generators/00_file_io.py |
#!/usr/bin/env python3
import numpy as np
import sys
from scipy import io
from scipy.constants import c, pi
import matx_common
from typing import Dict, List
class matx_python_tests:
def __init__(self, dtype: str, size: List[int]):
pass
def run(self) -> Dict[str, np.ndarray]:
seye = np.eye(10... | MatX-main | test/test_vectors/generators/00_python_tests.py |
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... | MatX-main | cmake/rapids-cmake/docs/conf.py |
#!/usr/bin/python3
import os
from pathlib import Path
from subprocess import PIPE, run
examples = [
x for x in Path(__file__).parent.iterdir() if x.is_dir() and (x / 'CMakeLists.txt').exists()
]
assert(len(examples) > 0)
def runCommand(command):
print('- %s' % command)
result = run(command, stdout=PIPE, std... | MatX-main | public/cpm-cmake/examples/build_all.py |
# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
###############################################################################
# Stuart build for host-based unittests.
from edk2nv.stuart import NVIDIACiSettingsManager
class HostBasedTestS... | edk2-nvidia-main | Platform/NVIDIA/HostBasedTests/TestBuild.py |
# Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
###############################################################################
# Stuart build for NVIDIA StandaloneMm UEFI firmware
from pathlib import Path
from edk2nv.stuart import NVI... | edk2-nvidia-main | Platform/NVIDIA/StandaloneMm/PlatformBuild.py |
# Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
###############################################################################
# Stuart build for NVIDIA Jetson UEFI firmware
from edk2nv.stuart import NVIDIASettingsManager, NVIDIAPlatf... | edk2-nvidia-main | Platform/NVIDIA/Jetson/PlatformBuild.py |
# Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
###############################################################################
# Stuart build for NVIDIA Server UEFI firmware
from edk2nv.stuart import NVIDIASettingsManager, NVIDIAPlatf... | edk2-nvidia-main | Platform/NVIDIA/Server/PlatformBuild.py |
# Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
###############################################################################
# Stuart build for NVIDIA TegraVirt UEFI firmware
from edk2nv.stuart import NVIDIASettingsManager, NVIDIAPlatfor... | edk2-nvidia-main | Platform/NVIDIA/TegraVirt/PlatformBuild.py |
# Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
###############################################################################
# Stuart build for NVIDIA StandaloneMm UEFI firmware
from edk2nv.stuart import NVIDIASettingsManager, NVIDIAPlatf... | edk2-nvidia-main | Platform/NVIDIA/StandaloneMmOptee/PlatformBuild.py |
#!/usr/bin/env python3
# Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
import argparse
import io
import os
import sys
DEFAULT_ALIGNMENT = 0x10000
def check_file_exists(filename):
"""
Checks that the given filename exists.
... | edk2-nvidia-main | Silicon/NVIDIA/edk2nv/FormatUefiBinary.py |
# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
'''
Package containing Python-based tools developed by NVIDIA for EDK2.
'''
| edk2-nvidia-main | Silicon/NVIDIA/edk2nv/__init__.py |
#
# This module builds a secure partition pkg file.
#
# Copyright (c) 2021-2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
import struct
import os
import logging
PAGE_SIZE = 4096
OFFSET_MAGIC = struct.pack("!I", 0x52415346)
def sptool(manifest_file, img... | edk2-nvidia-main | Silicon/NVIDIA/edk2nv/sptool.py |
# Copyright (c) 2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
'''
Package containing NVIDIA's extensions to EDK2's stuart build system.
'''
from .builder import * # noqa
from .settings import * # noqa
| edk2-nvidia-main | Silicon/NVIDIA/edk2nv/stuart/__init__.py |
# Copyright (c) Microsoft Corporation.
# Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
import os
import sys
import datetime
import logging
import shutil
from pathlib import Path
from edk2toolext.environment.uefi_build import UefiBuilder
f... | edk2-nvidia-main | Silicon/NVIDIA/edk2nv/stuart/builder.py |
# Copyright (c) Microsoft Corporation.
# Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
import os
import sys
from pathlib import Path
from edk2toolext.invocables.edk2_update import UpdateSettingsManager
from edk2toolext.invocables.edk2_set... | edk2-nvidia-main | Silicon/NVIDIA/edk2nv/stuart/settings.py |
#!/usr/bin/env python3
# Copyright 2020 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | sampleQAT-master | build_engine.py |
#!/usr/bin/env python3
# Copyright 2020 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | sampleQAT-master | postprocess_onnx.py |
#!/usr/bin/env python3
# Copyright 2020 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | sampleQAT-master | fold_constants.py |
#!/usr/bin/env python3
# Copyright 2020 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable... | sampleQAT-master | infer.py |
# Copyright 2020 NVIDIA Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | sampleQAT-master | image_processing.py |
"""
Basic HTTP Multithreaeded Server.
Steps to run:
$ python server.py
Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
"""
import argparse
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
class Handler(BaseHTTPRequestHandler):
def log_request(self, ... | ais-etl-master | bench/http-server/server.py |
"""
A basic web server using Flask for demonstration purposes.
Steps to run:
$ # with built-in flask server
$ flask --app app run
$ # with gunicorn
$ gunicorn -w 4 'app:app'
Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
"""
import logging
from flask import Flask, request
app = Flask(__name__)
@app.r... | ais-etl-master | bench/flask-server/app.py |
"""
A basic web server using FastAPI for demonstration purposes.
Steps to run:
$ # with uvicorn
$ uvicorn main:app --reload
$ # with multiple uvicorn processes managed by gunicorn
$ gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000
Copyright (c) 2023, NVIDIA CORPORATION... | ais-etl-master | bench/fast-api/main.py |
"""
Test client for all the webservers.
Steps to run:
$ pip install locust
$ locust
Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
"""
from locust import HttpUser, task
class MyTestUser(HttpUser):
@task
def test_put_request(self):
self._perform_put_request()
@task
def test_ge... | ais-etl-master | bench/client/locustfile.py |
#!/usr/bin/env python
import os
import importlib.util
from typing import Iterator
from inspect import signature
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
import requests
host_target = os.environ["AIS_TARGET_URL"]
code_file = os.getenv("MOD_NAME")
arg_type = os.... | ais-etl-master | runtime/python/server.py |
#!/usr/bin/env python
#
# Copyright (c) 2022-2023, NVIDIA CORPORATION. All rights reserved.
#
# pylint: disable=missing-docstring, invalid-name
import argparse
import json
import logging
import os
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
import ffmpeg
impor... | ais-etl-master | transformers/ffmpeg/server.py |
#!/usr/bin/env python
import argparse
import hashlib
import requests
import os
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
host_target = os.environ['AIS_TARGET_URL']
class Handler(BaseHTTPRequestHandler):
def log_request(self, code='-', size='-'):
#... | ais-etl-master | transformers/md5/server.py |
#!/usr/bin/env python
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
import argparse
import bz2
import gzip
import json
import logging
import os
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
import requests
host_target = os.environ["AIS_TARGE... | ais-etl-master | transformers/compress/server.py |
"""
A simple echo transformation using FastAPI framework and Gunivorn and Uvicorn webserver.
Steps to run:
$ # with uvicorn
$ uvicorn main:app --reload
$ # with multiple uvicorn processes managed by gunicorn
$ gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000
Copyright ... | ais-etl-master | transformers/echo/main.py |
#!/usr/bin/env python
import argparse
import requests
import os
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
host_target = os.environ['AIS_TARGET_URL']
class Handler(BaseHTTPRequestHandler):
def log_request(self, code='-', size='-'):
# Don't log succ... | ais-etl-master | transformers/echo/http-multithreaded-server/server.py |
"""
A simple hello world transformation using FastAPI framework and Gunicorn and Uvicorn webserver.
Steps to run:
$ # with uvicorn
$ uvicorn main:app --reload
$ # with multiple uvicorn processes managed by gunicorn
$ gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000
Cop... | ais-etl-master | transformers/hello_world/main.py |
#!/usr/bin/env python
import argparse
import requests
import os
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
host_target = os.environ['AIS_TARGET_URL']
class Handler(BaseHTTPRequestHandler):
def log_request(self, code='-', size='-'):
# Don't log succ... | ais-etl-master | transformers/hello_world/http-multithreaded-server/server.py |
"""
Transorming images with Keras API using FastAPI framework and Gunivorn and Uvicorn webserver.
Steps to run:
$ # with uvicorn
$ uvicorn main:app --reload
$ # with multiple uvicorn processes managed by gunicorn
$ gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000
Copyr... | ais-etl-master | transformers/keras_preprocess/main.py |
#!/usr/bin/env python
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
# pylint: disable=missing-class-docstring, missing-function-docstring, missing-module-docstring, broad-exception-caught
import os
import json
import logging
import io
import urllib
import requests
from flask import Flask, request... | ais-etl-master | transformers/keras_preprocess/flask-gunicorn/app.py |
#!/usr/bin/env python
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
import os
import json
import logging
import requests
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
import io
from keras.preprocessing.image import (
ImageDataGenerator,
... | ais-etl-master | transformers/keras_preprocess/http-multithreaded-server/server.py |
"""
Stress testing Keras Transformer for 50k images for all communication types
Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
"""
# pylint: disable=missing-class-docstring, missing-function-docstring, missing-module-docstring
import logging
from datetime import datetime
from tests.base import TestBase
... | ais-etl-master | transformers/tests/test_keras_stress.py |
"""
Stress testing Hello World Transformer for 1 Million objects for all communication types
Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
"""
# pylint: disable=missing-class-docstring, missing-function-docstring, missing-module-docstring
import logging
from datetime import datetime
from aistore.sdk.et... | ais-etl-master | transformers/tests/test_hello_world_stress.py |
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
# pylint: disable=missing-class-docstring, missing-function-docstring, missing-module-docstring
import io
import os
import unittest
from PIL import Image
from torchvision import transforms
from tests.base import TestBase
from tests.utils import git_... | ais-etl-master | transformers/tests/test_torchvision_transformer.py |
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
# pylint: disable=missing-class-docstring, missing-function-docstring, missing-module-docstring
import logging
from aistore.sdk.etl_const import ETL_COMM_HPULL, ETL_COMM_HPUSH, ETL_COMM_HREV
from aistore.sdk.etl_templates import HELLO_WORLD
from tests... | ais-etl-master | transformers/tests/test_hello_world.py |
ais-etl-master | transformers/tests/__init__.py | |
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
# pylint: disable=missing-class-docstring, missing-function-docstring, missing-module-docstring
import json
import os
import shutil
import tarfile
import unittest
import numpy as np
import tensorflow as tf
from PIL import Image
from skimage.metrics i... | ais-etl-master | transformers/tests/test_tar2tf.py |
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
import random
import string
import yaml
def generate_random_str():
return "".join(random.choice(string.ascii_lowercase) for i in range(5))
def git_test_mode_format_image_tag_test(template, img):
template = yaml.safe_load(template)
templ... | ais-etl-master | transformers/tests/utils.py |
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
# pylint: disable=missing-class-docstring, missing-function-docstring, missing-module-docstring
import os
import unittest
from tests.base import TestBase
from tests.utils import git_test_mode_format_image_tag_test
from aistore.sdk.etl_const import ET... | ais-etl-master | transformers/tests/test_go_echo.py |
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
# pylint: disable=missing-class-docstring, missing-function-docstring, missing-module-docstring
import hashlib
import os
import unittest
from aistore.sdk.etl_const import ETL_COMM_HPULL, ETL_COMM_HPUSH, ETL_COMM_HREV
from aistore.sdk.etl_templates imp... | ais-etl-master | transformers/tests/test_md5.py |
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
# pylint: disable=missing-class-docstring, missing-function-docstring, missing-module-docstring
import os
import unittest
from aistore.sdk.etl_const import ETL_COMM_HPULL, ETL_COMM_HPUSH, ETL_COMM_HREV
from aistore.sdk.etl_templates import ECHO
from... | ais-etl-master | transformers/tests/test_echo.py |
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
import json
import os
import unittest
import ffmpeg
from aistore.sdk.etl_const import ETL_COMM_HPULL, ETL_COMM_HPUSH, ETL_COMM_HREV
from aistore.sdk.etl_templates import FFMPEG
from tests.base import TestBase
from tests.utils import git_test_mode_fo... | ais-etl-master | transformers/tests/test_ffmpeg.py |
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
# pylint: disable=missing-class-docstring, missing-function-docstring, missing-module-docstring
import unittest
import io
import os
from tests.base import TestBase
from tests.utils import git_test_mode_format_image_tag_test
from keras.preprocessing.... | ais-etl-master | transformers/tests/test_keras_transformer.py |
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
# pylint: disable=missing-class-docstring, missing-function-docstring, missing-module-docstring
import bz2
import gzip
import json
import os
import unittest
from aistore.sdk.etl_const import ETL_COMM_HPULL, ETL_COMM_HPUSH, ETL_COMM_HREV
from aistore.... | ais-etl-master | transformers/tests/test_compress.py |
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
# pylint: disable=missing-class-docstring, missing-function-docstring, missing-module-docstring
import os
import unittest
from tests.utils import generate_random_str
from aistore import Client
class TestBase(unittest.TestCase):
def setUp(self):
... | ais-etl-master | transformers/tests/base.py |
"""
Transorming images with Keras API using FastAPI framework and Gunivorn and Uvicorn webserver.
Steps to run:
$ # with uvicorn
$ uvicorn main:app --reload
$ # with multiple uvicorn processes managed by gunicorn
$ gunicorn main:app --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:8000
Copyr... | ais-etl-master | transformers/torchvision_preprocess/main.py |
#!/usr/bin/env python
#
# Copyright (c) 2023, NVIDIA CORPORATION. All rights reserved.
#
import argparse
import io
import json
import logging
import os
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
import requests
from PIL import Image
from torchvision import tr... | ais-etl-master | transformers/torchvision_preprocess/http-multithreaded-server/server.py |
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from aistore.tf import Dataset
from aistore.tf.ops import Decode, Convert, Resize
EPOCHS = 5
BATCH_SIZE = 20
# ADJUST Dataset PARAMETERS BELOW
BUCKET_NAME = "tar-bucket"
PROXY_URL = "http://localhost:8080"
# Create Dataset.
# ... | ais-etl-master | examples/imagenet_in_memory.py |
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from aistore.tf import Dataset, default_record_parser
from aistore.tf.ops import Select, Decode, Convert, Resize
def path_generator():
i = 1
while True:
yield "train.record-{}".format(i)
i += 1
EPOCHS =... | ais-etl-master | examples/imagenet_from_disk.py |
import os
import re
import sys
import platform
import subprocess
from setuptools import setup, find_packages, Extension
from setuptools.command.build_ext import build_ext
from distutils.version import LooseVersion
def maybe_install_c_libs():
if sys.platform == 'linux':
cmd = 'sudo apt-get update'
... | dlinput-tf-master | setup.py |
import time
import threading
import os
import numpy as np
import zmq
import msgpack
import tensorflow as tf
from tensorflow.python.platform import test
from tensorflow.python.framework import dtypes
from tensorflow.python.ops import resources
zmq_module = tf.load_op_library('./build/nvzmq_ops/kernel/nvzmq_ops.so')
... | dlinput-tf-master | test/zmq_ops_test.py |
import math
import time
import argparse
import numpy as np
import tensorflow as tf
from nvzmq_ops import ZmqOp
from tensorcom.zcom import Statistics
from math import inf
parser = argparse.ArgumentParser(description='Performance test')
parser.add_argument("-addr", "--address", type=str, default="zsub://127.0.0.1:7880"... | dlinput-tf-master | example/perf_test.py |
from .zmq_ops import ZmqOp
| dlinput-tf-master | nvzmq_ops/__init__.py |
from tensorflow.python.framework import load_library
from tensorflow.python.platform import resource_loader
zmq_ops = load_library.load_op_library(
resource_loader.get_path_to_datafile('nvzmq_ops.so'))
zmq_conn_handle = zmq_ops.zmq_conn_handle
zmq_op = zmq_ops.nv_zmq
'''
TODO: update when kernel changes.
'''
clas... | dlinput-tf-master | nvzmq_ops/zmq_ops.py |
"""
greenflowlab setup
"""
import json
import os
from jupyter_packaging import (
create_cmdclass, install_npm, ensure_targets,
combine_commands, skip_if_exists
)
import setuptools
HERE = os.path.abspath(os.path.dirname(__file__))
# The name of the project
name="greenflowlab"
# Get our version
with open(os.p... | fsi-samples-main | greenflowlab/setup.py |
#!/usr/bin/env python
# coding: utf-8
"""
TODO: Add module docstring
"""
import ipywidgets.widgets as widgets
import ipywidgets
from ipywidgets import DOMWidget
from traitlets import Unicode, List, Dict, Instance
from ._frontend import module_name, module_version
class GreenflowWidget(DOMWidget):
"""TODO: Add d... | fsi-samples-main | greenflowlab/greenflowlab/greenflowmodel.py |
__all__ = ['__version__']
def _fetchVersion():
import json
import os
HERE = os.path.abspath(os.path.dirname(__file__))
for d, _, _ in os.walk(HERE):
try:
with open(os.path.join(d, 'package.json')) as f:
return json.load(f)['version']
except FileNotFoundErr... | fsi-samples-main | greenflowlab/greenflowlab/_version.py |
#!/usr/bin/env python
# coding: utf-8
"""
Information about the frontend package of the widgets.
"""
module_name = "greenflowlab"
module_version = "^0.1.0"
| fsi-samples-main | greenflowlab/greenflowlab/_frontend.py |
import os
import json
import tornado
from jupyter_server.base.handlers import APIHandler
from jupyter_server.utils import url_path_join
from greenflow.dataframe_flow import TaskGraph
from greenflow.dataframe_flow.taskGraph import add_module_from_base64
from greenflow.dataframe_flow.config_nodes_modules import (
get... | fsi-samples-main | greenflowlab/greenflowlab/handlers.py |
import json
import os.path as osp
from ._version import __version__
HERE = osp.abspath(osp.dirname(__file__))
with open(osp.join(HERE, 'labextension', 'package.json')) as fid:
data = json.load(fid)
def _jupyter_labextension_paths():
return [{
'src': 'labextension',
'dest': data['name']
... | fsi-samples-main | greenflowlab/greenflowlab/__init__.py |
import inspect
import uuid
from greenflow.dataframe_flow import TaskGraph
from greenflow.dataframe_flow import Node
from greenflow.dataframe_flow.task import Task
from greenflow.dataframe_flow.output_collector_node import (
OUTPUT_TYPE, OUTPUT_ID)
from greenflow.dataframe_flow import (TaskSpecSchema, PortsSpecSchem... | fsi-samples-main | greenflowlab/greenflowlab/server_utils.py |
#////////////////////////////////////////////////////////////////////////////
#//
#// Copyright (C) NVIDIA Corporation. All rights reserved.
#//
#// NVIDIA Sample Code
#//
#// Please refer to the NVIDIA end user license agreement (EULA) associated
#// with this source code for terms and conditions that govern your use... | fsi-samples-main | backtesting_equity_investment_strats/scripts/coalescePrices.py |
'''
'''
import pathlib
from setuptools import setup, find_packages
here = pathlib.Path(__file__).parent.resolve()
# Get the long description from the README file
long_description = (here / 'README.md').read_text(encoding='utf-8')
install_requires = ['dask[distributed]', 'dask[dataframe]', 'configparser',
... | fsi-samples-main | greenflow/setup.py |
from collections import namedtuple
from collections.abc import Mapping
__all__ = ['_namedtuple_with_defaults']
def _namedtuple_with_defaults(typename, field_names, default_values=()):
# https://stackoverflow.com/a/18348004/3457624
T = namedtuple(typename, field_names)
T.__new__.__defaults__ = (None,) * l... | fsi-samples-main | greenflow/greenflow/_common.py |
from .dataframe_flow import TaskGraph
from .dataframe_flow.node import Node
from .dataframe_flow import PortsSpecSchema
__all__ = ["TaskGraph", "Node", "PortsSpecSchema"]
| fsi-samples-main | greenflow/greenflow/__init__.py |
from greenflow.dataframe_flow import TaskGraph
import argparse
def main():
parser = argparse.ArgumentParser(
description='Evaluate the dataframe flow graph')
parser.add_argument('-t', '--task', help="the yaml task file")
parser.add_argument('output', help="the output nodes", nargs='+')
args = ... | fsi-samples-main | greenflow/greenflow/flow.py |
import copy
from .taskSpecSchema import TaskSpecSchema
module_cache = {}
__all__ = ['Task']
class Task(object):
''' A strong typed Task class that is converted from dictionary.
'''
def __init__(self, task_spec):
self._task_spec = {} # internal dict
# whatever is passed in has to be ... | fsi-samples-main | greenflow/greenflow/dataframe_flow/task.py |
import re
import importlib
from .portsSpecSchema import (PortsSpecSchema, NodePorts)
from .metaSpec import (MetaDataSchema, MetaData)
__all__ = ['NodeExtensionMixin']
TYPES_CACHE = {}
class NodeExtensionMixin:
def _sep_variable(self, variable):
assert isinstance(variable, str)
e = re.search('^\... | fsi-samples-main | greenflow/greenflow/dataframe_flow/_node_extension_mixin.py |
import abc
__all__ = ['_Node']
# compatible with Python 2 *and* 3:
_ABC = abc.ABCMeta('ABC', (object,), {'__slots__': ()})
class _Node(_ABC):
'''Intermediate class to identify Node class instances and avoid cyclic
imports.'''
| fsi-samples-main | greenflow/greenflow/dataframe_flow/_node.py |
import os
import cloudpickle
import base64
import pathlib
def get_file_path(path: str) -> str:
"""
@path: the relative or absolute file path
returns: absolute file path
"""
if path.startswith('/'):
return path
if 'GREENFLOWROOT' in os.environ:
ROOT = pathlib.Path(os.environ['GR... | fsi-samples-main | greenflow/greenflow/dataframe_flow/util.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.