Search is not available for this dataset
repo
stringlengths
2
152
⌀
file
stringlengths
15
239
code
stringlengths
0
58.4M
file_length
int64
0
58.4M
avg_line_length
float64
0
1.81M
max_line_length
int64
0
12.7M
extension_type
stringclasses
364 values
nni
nni-master/nni/tools/nnictl/algo_management.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import importlib import json import nni from nni.tools import package_utils from .common_utils import print_error, print_green, get_yml_content def read_reg_meta_list(meta_path): content = get_yml_content(meta_path) if content.get('algor...
3,328
37.264368
123
py
nni
nni-master/nni/tools/nnictl/command_utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from subprocess import call, check_output import sys import os import time import signal import psutil from .common_utils import print_error, print_warning def check_output_command(file_path, head=None, tail=None): """call check_output comm...
5,647
34.3
123
py
nni
nni-master/nni/tools/nnictl/common_utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import sys import json import tempfile import time import socket import string import random import glob from colorama import Fore import filelock import psutil import yaml from .constants import ERROR_INFO, NORMAL_INFO, WARNING_INFO ...
3,893
28.725191
126
py
nni
nni-master/nni/tools/nnictl/config_schema.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import json import os from schema import And, Optional, Or, Regex, Schema, SchemaError from nni.tools.package_utils.tuner_factory import create_validator_instance from .common_utils import get_yml_content, print_warning from .constants import S...
31,486
48.900158
137
py
nni
nni-master/nni/tools/nnictl/config_utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import sqlite3 import nni from .constants import NNI_HOME_DIR from .common_utils import get_file_lock def config_v0_to_v1(config: dict) -> dict: if 'clusterMetaData' not in config: return config elif 'trainingServicePla...
7,383
40.954545
138
py
nni
nni-master/nni/tools/nnictl/constants.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os from colorama import Fore NNI_HOME_DIR = os.path.join(os.path.expanduser('~'), 'nni-experiments') ERROR_INFO = 'ERROR: ' NORMAL_INFO = 'INFO: ' WARNING_INFO = 'WARNING: ' DEFAULT_REST_PORT = 8080 REST_TIME_OUT = 20 EXPERIMENT_SUCCES...
4,186
51.3375
126
py
nni
nni-master/nni/tools/nnictl/hello.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. """ Provide ``nnictl hello`` command to generate quickstart example. """ from pathlib import Path import shutil from colorama import Fore import nni_assets def create_example(_args): example_path = Path(nni_assets.__path__[0], 'hello_hpo'...
844
30.296296
107
py
nni
nni-master/nni/tools/nnictl/launcher.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import logging from pathlib import Path from colorama import Fore import yaml from nni.experiment import Experiment, RunMode from nni.experiment.config import ExperimentConfig, convert, utils # used for v1-only legacy setup, remove them later ...
4,924
36.59542
126
py
nni
nni-master/nni/tools/nnictl/launcher_utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os from schema import SchemaError from .config_schema import NNIConfigSchema from .common_utils import print_normal def expand_path(experiment_config, key): '''Change '~' to user home directory''' if experiment_config.get(key): ...
7,862
56.394161
125
py
nni
nni-master/nni/tools/nnictl/legacy_launcher.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import json import os from pathlib import Path import sys import string import random import time import re from subprocess import Popen, check_call, CalledProcessError, PIPE, STDOUT from nni.experiment.config import ExperimentConfig, convert fro...
29,784
48.476744
140
py
nni
nni-master/nni/tools/nnictl/nnictl.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import argparse import logging import os import pkg_resources from colorama import init from .common_utils import print_error from .launcher import create_experiment, resume_experiment, view_experiment from .updater import update_searchspace, upd...
27,542
52.585603
140
py
nni
nni-master/nni/tools/nnictl/nnictl_utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import csv import os import sys import json import time import shutil import subprocess from functools import cmp_to_key import traceback from datetime import datetime, timezone from subprocess import Popen from .rest_utils import rest_get, rest_...
43,599
44.322245
133
py
nni
nni-master/nni/tools/nnictl/rest_utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import time import requests from .url_utils import check_status_url from .constants import REST_TIME_OUT from .common_utils import print_error def rest_put(url, data, timeout, show_error=False): '''Call rest put method''' try: re...
2,903
31.266667
114
py
nni
nni-master/nni/tools/nnictl/ssh_utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os from .common_utils import print_error from .command_utils import install_package_command def check_environment(): '''check if paramiko is installed''' try: import paramiko except: install_package_command('pa...
2,113
33.655738
94
py
nni
nni-master/nni/tools/nnictl/ts_management.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import importlib import json from nni.runtime.config import get_config_file from .common_utils import print_error, print_green _builtin_training_services = [ 'local', 'remote', 'openpai', 'pai', 'aml', 'dlc', 'kubeflow',...
2,077
24.341463
84
py
nni
nni-master/nni/tools/nnictl/updater.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import json import os from .rest_utils import rest_put, rest_post, rest_get, check_rest_server_quick, check_response from .url_utils import experiment_url, import_data_url from .config_utils import Config, Experiments from .common_utils import ge...
6,583
40.408805
125
py
nni
nni-master/nni/tools/nnictl/url_utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import socket import psutil BASE_URL = 'http://localhost' API_ROOT_URL = '/api/v1/nni' EXPERIMENT_API = '/experiment' CLUSTER_METADATA_API = '/experiment/cluster-metadata' IMPORT_DATA_API = '/experiment/import-data' CHECK_STATUS_API = '/che...
2,299
25.744186
91
py
nni
nni-master/nni/tools/package_utils/__init__.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from .common import * from .config_manager import * from .tuner_factory import *
155
21.285714
38
py
nni
nni-master/nni/tools/package_utils/common.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from __future__ import annotations __all__ = ['AlgoMeta'] from typing import NamedTuple from typing_extensions import Literal class AlgoMeta(NamedTuple): name: str alias: str | None class_name: str | None accept_class_args: bo...
2,027
33.372881
103
py
nni
nni-master/nni/tools/package_utils/config_manager.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from __future__ import annotations __all__ = [ 'get_algo_meta', 'get_all_algo_meta', 'register_algo_meta', 'unregister_algo_meta', ] from collections import defaultdict import yaml from nni.runtime.config import get_builtin_co...
2,459
29.75
78
py
nni
nni-master/nni/tools/package_utils/tuner_factory.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from __future__ import annotations __all__ = [ 'create_builtin_class_instance', 'create_customized_class_instance', ] import importlib import os import sys from typing import Any from typing_extensions import Literal from . import con...
6,014
30.492147
100
py
nni
nni-master/nni/tools/trial_tool/__init__.py
0
0
0
py
nni
nni-master/nni/tools/trial_tool/aml_channel.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from azureml.core.run import Run # pylint: disable=import-error from .base_channel import BaseChannel from .log_utils import LogType, nni_log class AMLChannel(BaseChannel): def __init__(self, args): self.args = args self.run...
1,651
33.416667
96
py
nni
nni-master/nni/tools/trial_tool/base_channel.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import json import threading import time from abc import ABC, abstractmethod from queue import Empty, Queue from .log_utils import LogType, nni_log from .commands import CommandType INTERVAL_SECONDS = 0.5 class BaseChannel(ABC): def __ini...
5,323
32.484277
122
py
nni
nni-master/nni/tools/trial_tool/commands.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from enum import Enum class CommandType(Enum): Initialize = b'IN' RequestTrialJobs = b'GE' ReportMetricData = b'ME' ReportGpuInfo = b'GI' UpdateSearchSpace = b'SS' ImportData = b'FD' AddCustomizedTrialJob = b'AD' ...
557
20.461538
38
py
nni
nni-master/nni/tools/trial_tool/constants.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os API_ROOT_URL = '/api/v1/nni-pai' BASE_URL = 'http://{}' LOG_DIR = os.environ['NNI_OUTPUT_DIR'] NNI_PLATFORM = os.environ['NNI_PLATFORM'] STDOUT_FULL_PATH = os.path.join(LOG_DIR, 'stdout') STDERR_FULL_PATH = os.path.join(LOG_DIR, '...
590
22.64
50
py
nni
nni-master/nni/tools/trial_tool/file_channel.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os from .base_channel import BaseChannel command_path = "./commands" runner_commands_file_name_prefix = "runner_commands" manager_commands_file_name = "manager_commands.txt" class FileChannel(BaseChannel): def __init__(self, args)...
2,386
30.407895
99
py
nni
nni-master/nni/tools/trial_tool/gpu.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import subprocess import time import traceback from xml.dom import minidom def collect_gpu_usage(node_id): cmd = 'nvidia-smi -q -x'.split() info = None try: smi_output = subprocess.check_output(cmd) info = parse_nvid...
2,479
34.428571
85
py
nni
nni-master/nni/tools/trial_tool/hdfsClientUtility.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import posixpath from .log_utils import LogType, nni_log def copyHdfsDirectoryToLocal(hdfsDirectory, localDirectory, hdfsClient): '''Copy directory from HDFS to local''' if not os.path.exists(localDirectory): os.makedir...
4,259
44.806452
136
py
nni
nni-master/nni/tools/trial_tool/log_utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import sys import json import logging import logging.handlers import time import threading import re from datetime import datetime from enum import Enum, unique from logging import StreamHandler from queue import Queue from .rest_uti...
6,640
29.186364
140
py
nni
nni-master/nni/tools/trial_tool/rest_utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import requests def rest_get(url, timeout): '''Call rest get method''' try: response = requests.get(url, timeout=timeout) return response except Exception as e: print('Get exception {0} when sending http get t...
1,568
33.866667
114
py
nni
nni-master/nni/tools/trial_tool/trial.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import ctypes import os import sys import shlex import tarfile import time from datetime import datetime from subprocess import Popen import psutil from .log_utils import LogType, RemoteLogger, StdOutputType, nni_log from .commands import Comma...
6,945
41.353659
133
py
nni
nni-master/nni/tools/trial_tool/trial_keeper.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import argparse import ctypes import json import logging import os import re import shlex import sys import threading import time from subprocess import Popen import pkg_resources from pyhdfs import HdfsClient from .constants import (LOG_DIR, M...
11,702
43.162264
132
py
nni
nni-master/nni/tools/trial_tool/trial_runner.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import argparse import json import os import random import re import sys import time import traceback from datetime import datetime, timedelta import pkg_resources from .gpu import collect_gpu_usage idle_timeout_seconds = 10 * 60 gpu_refressh_...
10,431
39.909804
130
py
nni
nni-master/nni/tools/trial_tool/url_utils.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from .constants import API_ROOT_URL, BASE_URL, STDOUT_API, NNI_TRIAL_JOB_ID, NNI_EXP_ID, VERSION_API, PARAMETER_META_API def gen_send_stdout_url(ip, port): '''Generate send stdout url''' return '{0}:{1}{2}{3}/{4}/{5}'.format(BASE_URL.fo...
759
37
125
py
nni
nni-master/nni/tools/trial_tool/web_channel.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import asyncio import os import websockets from .base_channel import BaseChannel from .log_utils import LogType, nni_log class WebChannel(BaseChannel): def __init__(self, args): self.node_id = args.node_id self.args = args...
1,905
31.862069
134
py
nni
nni-master/nni_assets/__init__.py
0
0
0
py
nni
nni-master/nni_assets/compression/__init__.py
0
0
0
py
nni
nni-master/nni_assets/compression/mnist_model.py
from pathlib import Path # define the model import torch from torch import nn from torch.nn import functional as F class TorchModel(nn.Module): def __init__(self): super().__init__() self.conv1 = nn.Conv2d(1, 6, 5, 1) self.conv2 = nn.Conv2d(6, 16, 5, 1) self.fc1 = nn.Linear(16 * 4 ...
3,352
33.927083
123
py
nni
nni-master/nni_assets/hello_hpo/main.py
""" NNI hyperparameter optimization example. Check the online tutorial for details: https://nni.readthedocs.io/en/stable/tutorials/hpo_quickstart_pytorch/main.html """ from pathlib import Path import signal from nni.experiment import Experiment # Define search space search_space = { 'features': {'_type': 'choic...
944
26.794118
79
py
nni
nni-master/nni_assets/hello_hpo/model.py
""" Run main.py to start. This script is modified from PyTorch quickstart: https://pytorch.org/tutorials/beginner/basics/quickstart_tutorial.html """ import nni import torch from torch import nn from torch.utils.data import DataLoader from torchvision import datasets from torchvision.transforms import ToTensor # Get...
2,104
29.955882
99
py
nni
nni-master/pipelines/build-vm-image-linux.yml
# FIXME: This pipeline is broken due to resource group location limitation. trigger: none pr: none variables: resource_group: nni-image-builder gallery_name: nniImageGalleryV2 network_security_group: nni-image-builder-nsg managed_image_name: nni-linux-image image_definition_name: nniLinuxImage packer_conf...
453
21.7
75
yml
nni
nni-master/pipelines/build-vm-image-windows.yml
# FIXME: This pipeline is broken due to resource group location limitation. trigger: none pr: none variables: resource_group: nni-image-builder gallery_name: nniImageGalleryV2 network_security_group: nni-image-builder-nsg managed_image_name: nni-windows-image image_definition_name: nniWindowsImage packer_...
471
22.6
75
yml
nni
nni-master/pipelines/cache-dependencies.yml
trigger: none pr: none schedules: - cron: "0 16 * * *" branches: include: [ master ] always: true jobs: - job: ubuntu_latest pool: vmImage: ubuntu-latest steps: - template: templates/cache-dependencies-template.yml parameters: platform: ubuntu-latest - job: ubuntu_legacy pool: vmImag...
1,089
18.122807
55
yml
nni
nni-master/pipelines/fast-test.yml
trigger: none schedules: - cron: 0 16 * * * branches: include: [ master ] always: true variables: filter.modified.globs: 'pipelines/fast-test.yml,!.github/**,!docs/**,!examples/**' filter.prbody.heading: '#### Test Options' filter.prbody.optionIndex: 0 stages: - stage: lint jobs: - job: copyright ...
7,328
27.08046
125
yml
nni
nni-master/pipelines/full-test-compression.yml
resources: repositories: - repository: mmdetRepo type: github endpoint: mmdetection name: open-mmlab/mmdetection trigger: none schedules: - cron: 0 18 * * * branches: include: [ master ] always: true variables: filter.modified.globs: 'examples/model_compress/**,nni/algorithms/compression/**...
1,523
23.190476
204
yml
nni
nni-master/pipelines/full-test-hpo.yml
trigger: none schedules: - cron: 0 18 * * * branches: include: [ master ] always: true variables: filter.modified.globs: 'examples/tuners/**,nni/algorithms/hpo/**,pipelines/full-test-hpo.yml,' filter.prbody.heading: '#### Test Options' filter.prbody.optionIndex: 1 stages: - stage: filter jobs: - jo...
1,477
24.482759
118
yml
nni
nni-master/pipelines/full-test-nas.yml
trigger: none schedules: - cron: 0 18 * * * branches: include: [ master ] always: true variables: filter.modified.globs: 'examples/nas/**,nni/algorithms/nas/**,nni/nas/**,nni/retiarii/**,pipelines/full-test-nas.yml,test/ut/nas/**,test/algo/nas/**' filter.prbody.heading: '#### Test Options' filter.prbody...
1,914
22.072289
151
yml
nni
nni-master/pipelines/integration-test-aml.yml
trigger: none pr: none schedules: - cron: 0 20 * * * branches: include: [ master ] always: true jobs: - job: aml pool: vmImage: ubuntu-latest timeoutInMinutes: 120 steps: - template: templates/install-dependencies.yml parameters: platform: ubuntu-latest - template: templates/install-d...
1,479
26.407407
114
yml
nni
nni-master/pipelines/integration-test-frameworkcontroller.yml
trigger: none pr: none # Unstable. Disable trigger. # schedules: # - cron: 0 16 * * * # branches: # include: [ master ] # variables set on VSO: (mostly for security concern) # manager_ip # docker_hub_password jobs: - job: frameworkcontroller pool: NNI CI KUBE CLI timeoutInMinutes: 120 steps: - scri...
2,405
33.371429
194
yml
nni
nni-master/pipelines/integration-test-hybrid.yml
trigger: none pr: none schedules: - cron: 0 20 * * * branches: include: [ master ] always: true jobs: - job: hybrid pool: nni-it-1es-11 timeoutInMinutes: 90 steps: # TODO: consider adding GPU tests here - template: templates/install-dependencies.yml parameters: platform: ubuntu-latest ...
2,405
30.246753
134
yml
nni
nni-master/pipelines/integration-test-kubeflow.yml
trigger: none pr: none # Unstable. Disable trigger. # schedules: # - cron: 0 16 * * * # branches: # include: [ master ] # variables set on VSO: (mostly for security concern) # manager_ip # docker_hub_password jobs: - job: kubeflow pool: NNI CI KUBE CLI timeoutInMinutes: 120 steps: - script: | ...
2,845
33.707317
183
yml
nni
nni-master/pipelines/integration-test-local-linux.yml
trigger: none pr: none schedules: - cron: 0 20 * * * branches: include: [ master ] always: true jobs: - job: linux pool: nni-it-1es-11 timeoutInMinutes: 60 steps: - template: templates/check-gpu-status.yml - template: templates/install-dependencies.yml parameters: platform: ubuntu-latest-...
669
19.9375
116
yml
nni
nni-master/pipelines/integration-test-local-windows.yml
trigger: none pr: none schedules: - cron: 0 20 * * * branches: include: [ master ] always: true jobs: - job: windows pool: nni-it-1es-windows timeoutInMinutes: 120 steps: - template: templates/check-gpu-status.yml parameters: platform: windows - template: templates/install-dependencies.ym...
1,142
21.411765
116
yml
nni
nni-master/pipelines/integration-test-openpai-linux.yml
trigger: none pr: none # Unstable. Disable trigger. # schedules: # - cron: 0 16 * * * # branches: # include: [ master ] # variables set on VSO: (mostly for security concern) # pai_user # pai_token # manager_ip # docker_hub_password jobs: - job: pai pool: NNI CI PAI LINUX CLI timeoutInMinutes: 120 ...
3,085
32.182796
115
yml
nni
nni-master/pipelines/integration-test-remote-l2l.yml
trigger: none pr: none schedules: - cron: 0 20 * * * branches: include: [ master ] always: true # variables set on VSO: (for security concern) # manager_ip # worker_ip # password_in_docker jobs: - job: remote_linux2linux pool: nni-it-1es-11 timeoutInMinutes: 120 steps: # TODO: We don't currentl...
3,383
32.176471
134
yml
nni
nni-master/pipelines/integration-test-remote-w2w.yml
trigger: none pr: none schedules: - cron: 0 20 * * * branches: include: [ master ] always: true variables: ssh_user: NNIUser ssh_password: P@ssW0rD! jobs: - job: remote_windows2windows pool: nni-it-1es-windows timeoutInMinutes: 120 steps: # FIXME: GPU is not supported yet. - template: templates...
1,350
24.018519
117
yml
nni
nni-master/pipelines/integration-test-trt.yml
trigger: none pr: none schedules: - cron: 0 16 * * * branches: include: [ master ] jobs: - job: trt pool: NNI CI TENSORRT timeoutInMinutes: 120 steps: - script: | export NNI_RELEASE=999.$(date -u +%Y%m%d%H%M%S) echo "##vso[task.setvariable variable=PATH]${PATH}:${HOME}/ENTER/bin" echo ...
1,000
25.342105
94
yml
nni
nni-master/pipelines/release.yml
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. trigger: none pr: none jobs: - job: validate_version_number pool: vmImage: ubuntu-latest steps: - template: templates/config-version.yml parameters: platform: ubuntu-latest - script: | echo $(build_type) echo ...
4,400
29.992958
111
yml
nni
nni-master/pipelines/deprecated/integration-test-adl.yml
trigger: none pr: none schedules: - cron: 0 16 * * * branches: include: [ master ] jobs: - job: adl pool: NNI CI KUBE CLI timeoutInMinutes: 120 steps: - script: | export NNI_RELEASE=999.$(date -u +%Y%m%d%H%M%S) echo "##vso[task.setvariable variable=PATH]${PATH}:${HOME}/.local/bin" echo...
2,143
32.5
150
yml
nni
nni-master/pipelines/deprecated/integration-test-remote-l2w.yml
trigger: none pr: none schedules: - cron: 0 16 * * * branches: include: [ master ] variables: worker: remote_nni-ci-gpu-04-w # variables set on VSO: (for security concern) # manager_ip # worker_ip # worker_port # worker_password jobs: - job: remote_linux2windows pool: NNI CI EAST US REMOTE CLI ti...
2,546
28.616279
118
yml
nni
nni-master/pipelines/deprecated/integration-test-remote-w2l.yml
trigger: none pr: none schedules: - cron: 0 16 * * * branches: include: [ master ] variables: worker: remote-nni-ci-gpu-04 # variables set on VSO: # manager_ip # worker_ip # password_in_docker jobs: - job: remote_windows2linux pool: NNI CI WINDOWS REMOTE CLI timeoutInMinutes: 120 steps: - scri...
2,184
28.527027
135
yml
nni
nni-master/pipelines/templates/build-vm-image-template.yml
# BEFORE READING: # # 1. We are now running agents on 1ES, all the notes about VMSS can be safely ignored. # 2. Many actions can be done on both cloud shell and web portal. Choose whichever you prefer. steps: - script: | curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash displayName: Install azcli # Update ...
7,341
44.320988
208
yml
nni
nni-master/pipelines/templates/cache-dependencies-template.yml
parameters: - name: platform type: string # variables set on VSO: (for security concern) # sas_token # # its value should be: # sp=racw&st=2022-04-01T00:00:00Z&se=...... # # how to re-generate: # 1. find the storage on azure portal: nni (resource group) -> nni (storage account) -> cache (container) # 2. sett...
4,087
36.851852
131
yml
nni
nni-master/pipelines/templates/check-gpu-status.yml
parameters: - name: platform type: string default: linux steps: # Install GPU driver on Windows. # Installer has already been downloaded and saved in the image. - powershell: | Start-Process -Verb RunAs -FilePath "$env:ProgramData\driver_installer.exe" -ArgumentList "/s /n" -Wait displayName: (Windows) Inst...
506
25.684211
107
yml
nni
nni-master/pipelines/templates/config-version.yml
parameters: - name: platform type: string - name: python_env type: string default: default values: - default - noop - venv steps: # UsePythonVersion task only works when the specific Python version is already installed. # The following is for linux. # Reference: https://dev.to/akaszynski/create-an-azur...
1,936
29.746032
104
yml
nni
nni-master/pipelines/templates/download-test-data.yml
# The test data should be uploaded to: # https://nni.blob.core.windows.net/testdata/mnist.zip # https://nni.blob.core.windows.net/testdata/cifar10.zip # ... # # We can't upload the data regularly on pipelines, # because it's not easy to setup auto-download for some datasets. # See cache-dependencies-template.yml ...
973
28.515152
93
yml
nni
nni-master/pipelines/templates/install-customized-tuner.yml
steps: - ${{ if contains(variables['Agent.OS'], 'Windows') }}: powershell: | cd examples/tuners/customized_tuner python setup.py develop --user nnictl algo register --meta meta_file.yml ${{ else }}: script: | set -e cd examples/tuners/customized_tuner python setup.py devel...
411
26.466667
55
yml
nni
nni-master/pipelines/templates/install-dependencies-aml.yml
steps: # Need to have a service principal (SP) to login to Azure services (e.g., AzureML). # Refer to external account section in OneNote for how to generate / renew the authorization. # According to docs, the secrets need to be refreshed at least once per year. # After the tokens are updated, pipeline secret varibles...
862
40.095238
93
yml
nni
nni-master/pipelines/templates/install-dependencies.yml
parameters: - name: platform type: string - name: python_env type: string default: default values: - default - noop - venv # variables set on VSO: # sas_cache # # its value should be: # sp=racw&st=2022-04-01T00:00:00Z&se=...... # # how to re-generate: # 1. find the storage on azure portal: nni (res...
3,419
33.545455
131
yml
nni
nni-master/pipelines/templates/install-nni.yml
parameters: - name: user type: boolean default: true - name: wheel type: boolean default: false - name: extra_dep type: string default: "" steps: - ${{ if eq(parameters.wheel, true) }}: script: | echo "Install NNI (wheel)" export NNI_RELEASE=999.$(date -u +%Y%m%d%H%M%S) echo "##vso[t...
858
25.84375
85
yml
nni
nni-master/pipelines/templates/save-crashed-info.yml
# Upload crashed experiments to artifact, # so that further offline investigations are possible. parameters: - name: training_service type: string default: unknown steps: - script: | set -e export EXPERIMENT_DIR=$(readlink -f ~/nni-experiments/_latest) echo "Latest experiment directory: ${EXPERIMENT_...
3,015
40.315068
146
yml
nni
nni-master/pipelines/templates/stage-filter.yml
steps: - task: NodeTool@0 inputs: versionSpec: '16.x' - script: | npm install npm@latest -g npx https://github.com/microsoft/azure-pipeline-filter.git name: execution displayName: NPM Install & Filter
220
19.090909
62
yml
nni
nni-master/test/algo/__init__.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. """ Extra tests for "algorithms", complementary to UT. If the test satisfies one of the following conditions, it should be put here: 1. The test could take a while to finish. 2. The test doesn't work on the free agent. It needs accelerators lik...
748
36.45
109
py
nni
nni-master/test/algo/compression/__init__.py
0
0
0
py
nni
nni-master/test/algo/compression/test_fusion_compress.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import pytest from nni.compression.distillation import ( DynamicLayerwiseDistiller, Adaptive1dLayerwiseDistiller ) from nni.compression.pruning import ( LevelPruner, L1NormPruner, L2NormPruner, FPGMPruner, SlimPruner,...
1,881
29.354839
124
py
nni
nni-master/test/algo/compression/assets/__init__.py
from .common import create_model
33
16
32
py
nni
nni-master/test/algo/compression/assets/common.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from pathlib import Path import torch from .device import device from .simple_mnist import SimpleLightningModel, SimpleTorchModel log_dir = Path(__file__).parent.parent / 'logs' def create_model(model_type: str): pruning_torch_config_li...
2,565
47.415094
224
py
nni
nni-master/test/algo/compression/assets/device.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
158
21.714286
69
py
nni
nni-master/test/algo/compression/assets/simple_mnist/__init__.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from .simple_lightning_model import SimpleLightningModel, MNISTDataModule from .simple_torch_model import SimpleTorchModel, training_model, evaluating_model, finetuning_model, training_step from .simple_evaluator import create_lighting_evaluator,...
346
48.571429
115
py
nni
nni-master/test/algo/compression/assets/simple_mnist/simple_evaluator.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from __future__ import annotations from pathlib import Path import torch from torch.optim.lr_scheduler import ExponentialLR import pytorch_lightning as pl from pytorch_lightning.loggers import TensorBoardLogger import nni from nni.compression...
1,506
34.880952
117
py
nni
nni-master/test/algo/compression/assets/simple_mnist/simple_lightning_model.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from __future__ import annotations import pytorch_lightning as pl import torch import torch.nn.functional as F from torch.optim.lr_scheduler import ExponentialLR from torch.utils.data import random_split, DataLoader from torchmetrics.functional...
3,358
30.688679
112
py
nni
nni-master/test/algo/compression/assets/simple_mnist/simple_torch_model.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from __future__ import annotations from typing import Callable, Tuple import torch from torch.nn import Module import torch.nn.functional as F from torch.optim import Optimizer from torch.utils.data import DataLoader from torchvision.datasets i...
3,368
33.377551
111
py
nni
nni-master/test/algo/compression/base/__init__.py
0
0
0
py
nni
nni-master/test/algo/compression/base/test_compressor.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from __future__ import annotations import pytest from collections import defaultdict import torch from nni.compression.base.compressor import Pruner, Quantizer from ..assets.simple_mnist import SimpleTorchModel def test_compressor(): #...
1,276
29.404762
75
py
nni
nni-master/test/algo/compression/base/test_fused_wrapper.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from __future__ import annotations import pytest import sys from copy import deepcopy import torch import torch.nn.functional as F from nni.compression.base.wrapper import IdentityModuleWrapper, register_wrappers from ..assets.simple_mnist imp...
1,653
30.807692
102
py
nni
nni-master/test/algo/compression/base/test_setting.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from __future__ import annotations import pytest import torch from nni.compression.base.setting import canonicalize_settings @pytest.mark.parametrize("module_cls_or_name", ['instance', 'cls', 'name']) def test_setting(module_cls_or_name: str...
1,868
29.145161
112
py
nni
nni-master/test/algo/compression/base/test_wrapper.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from __future__ import annotations import pytest import torch from torch.nn.functional import conv2d from nni.compression.base.wrapper import ModuleWrapper, register_wrappers from ..assets.simple_mnist import SimpleTorchModel def test_wrapp...
6,724
36.569832
116
py
nni
nni-master/test/algo/compression/distillation/__init__.py
0
0
0
py
nni
nni-master/test/algo/compression/distillation/test_distil_label_patcher.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from __future__ import annotations import hashlib import pytest import torch from torch.utils.data import Dataset, DataLoader from nni.contrib.distillation.label_patcher import DistilLabelPatcher from nni.contrib.distillation.uid_dataset impor...
3,443
34.875
129
py
nni
nni-master/test/algo/compression/distillation/test_distiller.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import pytest import torch from nni.compression.distillation import ( Adaptive1dLayerwiseDistiller, DynamicLayerwiseDistiller ) from ..assets.device import device from ..assets.simple_mnist import ( create_lighting_evaluator, c...
1,647
34.826087
125
py
nni
nni-master/test/algo/compression/pruning/__init__.py
0
0
0
py
nni
nni-master/test/algo/compression/pruning/test_auto_conv.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import unittest import torch import torch.nn.functional as F from nni.compression.pruning import L1NormPruner from nni.compression.speedup import ModelSpeedup from nni.compression.utils import ( compute_sparsity_compact2origin, compute_...
5,959
29.10101
108
py
nni
nni-master/test/algo/compression/pruning/test_channel_dependency.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import pytest import torch from nni.common.concrete_trace_utils import concrete_trace from nni.compression.speedup.dependency import build_channel_dependency # should have dependency between conv1 and conv2 and conv3 and conv4 class PatternA(t...
2,081
32.580645
118
py
nni
nni-master/test/algo/compression/pruning/test_concrete_trace_dce.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import pytest import torch import torchvision.models as models from nni.common.concrete_trace_utils import concrete_trace model_list = [ models.alexnet, models.convnext_base, models.densenet121, models.efficientnet_b0, mode...
2,134
30.397059
83
py
nni
nni-master/test/algo/compression/pruning/test_concrete_trace_mix_trace.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import pytest import torch import torchvision.models as models from nni.common.concrete_trace_utils import concrete_trace model_list = [ models.alexnet, models.convnext_base, models.densenet121, models.efficientnet_b0, mode...
1,554
26.767857
73
py
nni
nni-master/test/algo/compression/pruning/test_concrete_trace_mmdetection.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import pytest import os import torch import mmcv.cnn as mmcv_cnn import mmdet.models as mmdet_models from mmdet.apis import init_detector from mmdet.testing import demo_mm_inputs, get_detector_cfg from mmengine import Config from nni.common.conc...
11,975
42.868132
147
py
nni
nni-master/test/algo/compression/pruning/test_concrete_trace_super.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import unittest import torch import torch.nn.functional as F from nni.common.concrete_trace_utils import concrete_trace class Foo(torch.nn.Module): def __init__(self): super().__init__() def forward(self, x: torch.Tensor) -> t...
1,309
22.392857
64
py
nni
nni-master/test/algo/compression/pruning/test_pruner.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import pytest from typing import Dict, Type import torch from nni.compression.pruning import ( LevelPruner, L1NormPruner, L2NormPruner, FPGMPruner, SlimPruner, TaylorPruner, MovementPruner, LinearPruner, AGP...
6,724
41.295597
152
py
nni
nni-master/test/algo/compression/pruning/test_speedup_init_mask.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import unittest import functools import torch import torch.nn.functional as F from nni.common.concrete_trace_utils import concrete_trace from nni.compression.pruning import L1NormPruner from nni.compression.speedup import ModelSpeedup from nni....
4,207
31.122137
111
py