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
null
grin-main/lib/datasets/pems_bay.py
import os import numpy as np import pandas as pd from lib import datasets_path from .pd_dataset import PandasDataset from ..utils import sample_mask class PemsBay(PandasDataset): def __init__(self): df, dist, mask = self.load() self.dist = dist super().__init__(dataframe=df, u=None, mask...
4,199
36.837838
96
py
null
grin-main/lib/datasets/synthetic.py
import os.path import numpy as np import torch from einops import rearrange from torch.utils.data import Dataset, DataLoader, Subset from lib import datasets_path def generate_mask(shape, p_block=0.01, p_point=0.01, max_seq=1, min_seq=1, rng=None): """Generate mask in which 1 denotes valid values, 0 missing one...
7,408
36.231156
112
py
null
grin-main/lib/fillers/__init__.py
from .filler import Filler from .britsfiller import BRITSFiller from .graphfiller import GraphFiller from .rgainfiller import RGAINFiller from .multi_imputation_filler import MultiImputationFiller
197
32
58
py
null
grin-main/lib/fillers/britsfiller.py
import torch from . import Filler from ..nn import BRITS class BRITSFiller(Filler): def training_step(self, batch, batch_idx): # Unpack batch batch_data, batch_preprocessing = self._unpack_batch(batch) # Extract mask and target mask = batch_data['mask'].clone().detach() ...
3,431
39.857143
108
py
null
grin-main/lib/fillers/filler.py
import inspect from copy import deepcopy import pytorch_lightning as pl import torch from pytorch_lightning.core.decorators import auto_move_data from pytorch_lightning.metrics import MetricCollection from pytorch_lightning.utilities import move_data_to_device from .. import epsilon from ..nn.utils.metric_base import...
12,351
40.589226
146
py
null
grin-main/lib/fillers/graphfiller.py
import torch from . import Filler from ..nn.models import MPGRUNet, GRINet, BiMPGRUNet class GraphFiller(Filler): def __init__(self, model_class, model_kwargs, optim_class, optim_kwargs, loss_fn, scaled_target=...
5,454
40.015038
108
py
null
grin-main/lib/fillers/multi_imputation_filler.py
import torch from pytorch_lightning.core.decorators import auto_move_data from . import Filler class MultiImputationFiller(Filler): """ Filler with multiple imputation outputs """ def __init__(self, model_class, model_kwargs, optim_class, ...
2,930
35.185185
104
py
null
grin-main/lib/fillers/rgainfiller.py
import torch from torch.nn import functional as F from .multi_imputation_filler import MultiImputationFiller from ..nn.utils.metric_base import MaskedMetric class MaskedBCEWithLogits(MaskedMetric): def __init__(self, mask_nans=False, mask_inf=False, compute_on_s...
6,340
42.136054
110
py
null
grin-main/lib/nn/__init__.py
from .layers import *
22
10.5
21
py
null
grin-main/lib/nn/layers/__init__.py
from .rits import RITS, BRITS from .gril import GRIL, BiGRIL from .spatial_conv import SpatialConvOrderK from .mpgru import MPGRUImputer
137
26.6
43
py
null
grin-main/lib/nn/layers/gcrnn.py
import torch import torch.nn as nn from .spatial_conv import SpatialConvOrderK class GCGRUCell(nn.Module): """ Graph Convolution Gated Recurrent Unit Cell. """ def __init__(self, d_in, num_units, support_len, order, activation='tanh'): """ :param num_units: the hidden dim of rnn ...
3,184
36.470588
117
py
null
grin-main/lib/nn/layers/gril.py
import torch import torch.nn as nn from einops import rearrange from .spatial_conv import SpatialConvOrderK from .gcrnn import GCGRUCell from .spatial_attention import SpatialAttention from ..utils.ops import reverse_tensor class SpatialDecoder(nn.Module): def __init__(self, d_in, d_model, d_out, support_len, or...
11,916
42.652015
133
py
null
grin-main/lib/nn/layers/imputation.py
import math import torch from torch import nn from torch.nn import functional as F class ImputationLayer(nn.Module): def __init__(self, d_in, bias=True): super(ImputationLayer, self).__init__() self.W = nn.Parameter(torch.Tensor(d_in, d_in)) if bias: self.b = nn.Parameter(torc...
897
29.965517
69
py
null
grin-main/lib/nn/layers/mpgru.py
import torch from torch import nn from .gcrnn import GCGRUCell class MPGRUImputer(nn.Module): def __init__(self, input_size, hidden_size, ff_size=None, u_size=None, n_layers=1, dropout=0., kerne...
4,835
38.317073
116
py
null
grin-main/lib/nn/layers/rits.py
import math import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable from torch.nn.parameter import Parameter from ..utils.ops import reverse_tensor class FeatureRegression(nn.Module): def __init__(self, input_size): super(FeatureRegression, self).__init__()...
5,700
32.145349
108
py
null
grin-main/lib/nn/layers/spatial_attention.py
import torch.nn as nn from einops import rearrange class SpatialAttention(nn.Module): def __init__(self, d_in, d_model, nheads, dropout=0.): super(SpatialAttention, self).__init__() self.lin_in = nn.Linear(d_in, d_model) self.self_attn = nn.MultiheadAttention(d_model, nheads, dropout=drop...
971
32.517241
81
py
null
grin-main/lib/nn/layers/spatial_conv.py
import torch from torch import nn from ... import epsilon class SpatialConvOrderK(nn.Module): """ Spatial convolution of order K with possibly different diffusion matrices (useful for directed graphs) Efficient implementation inspired from graph-wavenet codebase """ def __init__(self, c_in, c_o...
2,253
31.2
106
py
null
grin-main/lib/nn/models/__init__.py
from .grin import GRINet from .brits import BRITSNet from .mpgru import MPGRUNet, BiMPGRUNet from .var import VARImputer from .rgain import RGAINNet from .rnn_imputers import BiRNNImputer, RNNImputer
200
27.714286
50
py
null
grin-main/lib/nn/models/brits.py
import torch from torch import nn from ..layers import BRITS class BRITSNet(nn.Module): def __init__(self, d_in, d_hidden=64): super(BRITSNet, self).__init__() self.birits = BRITS(input_size=d_in, hidden_size=d_hidden) def forward...
1,171
36.806452
110
py
null
grin-main/lib/nn/models/grin.py
import torch from einops import rearrange from torch import nn from ..layers import BiGRIL from ...utils.parser_utils import str_to_bool class GRINet(nn.Module): def __init__(self, adj, d_in, d_hidden, d_ff, ff_dropout, ...
3,589
42.253012
105
py
null
grin-main/lib/nn/models/mpgru.py
import torch from einops import rearrange from torch import nn from ..layers import MPGRUImputer, SpatialConvOrderK from ..utils.ops import reverse_tensor from ...utils.parser_utils import str_to_bool class MPGRUNet(nn.Module): def __init__(self, adj, d_in, d_hi...
8,025
42.857923
120
py
null
grin-main/lib/nn/models/rgain.py
import torch from torch import nn from .rnn_imputers import BiRNNImputer from ...utils.parser_utils import str_to_bool class Generator(nn.Module): def __init__(self, d_in, d_model, d_z, dropout=0., inject_noise=True): super(Generator, self).__init__() self.inject_noise = inject_noise self...
2,564
36.173913
102
py
null
grin-main/lib/nn/models/rnn_imputers.py
import torch from torch import nn from ..utils.ops import reverse_tensor class RNNImputer(nn.Module): """Fill the blanks with a 1-step-ahead GRU predictor.""" def __init__(self, d_in, d_model, concat_mask=True, detach_inputs=False, state_init='zero', d_u=0): super(RNNImputer, self).__init__() ...
3,972
37.572816
115
py
null
grin-main/lib/nn/models/var.py
import torch from einops import rearrange from torch import nn from lib import epsilon class VAR(nn.Module): def __init__(self, order, d_in, d_out=None, steps_ahead=1, bias=True): super(VAR, self).__init__() self.order = order self.d_in = d_in self.d_out = d_out if d_out is not No...
2,612
35.802817
82
py
null
grin-main/lib/nn/utils/__init__.py
0
0
0
py
null
grin-main/lib/nn/utils/metric_base.py
from functools import partial import torch from pytorch_lightning.metrics import Metric from torchmetrics.utilities.checks import _check_same_shape class MaskedMetric(Metric): def __init__(self, metric_fn, mask_nans=False, mask_inf=False, comput...
2,660
33.115385
87
py
null
grin-main/lib/nn/utils/metrics.py
from .metric_base import MaskedMetric from .ops import mape from torch.nn import functional as F import torch from torchmetrics.utilities.checks import _check_same_shape from ... import epsilon class MaskedMAE(MaskedMetric): def __init__(self, mask_nans=False, mask_inf=False, ...
4,835
39.3
96
py
null
grin-main/lib/nn/utils/ops.py
import torch import torch.nn.functional as F from einops import reduce from torch.autograd import Variable from ... import epsilon def mae(y_hat, y, reduction='none'): return F.l1_loss(y_hat, y, reduction=reduction) def mape(y_hat, y): return torch.abs((y_hat - y) / y) def wape_loss(y_hat, y): l = to...
1,953
26.138889
88
py
null
grin-main/lib/utils/__init__.py
from .utils import *
21
10
20
py
null
grin-main/lib/utils/numpy_metrics.py
import numpy as np def mae(y_hat, y): return np.abs(y_hat - y).mean() def nmae(y_hat, y): delta = np.max(y) - np.min(y) + 1e-8 return mae(y_hat, y) * 100 / delta def mape(y_hat, y): return 100 * np.abs((y_hat - y) / (y + 1e-8)).mean() def mse(y_hat, y): return np.square(y_hat - y).mean() d...
1,256
19.274194
77
py
null
grin-main/lib/utils/parser_utils.py
import inspect from argparse import Namespace, ArgumentParser from typing import Union def str_to_bool(value): if isinstance(value, bool): return value if value.lower() in {'false', 'f', '0', 'no', 'n', 'off'}: return False elif value.lower() in {'true', 't', '1', 'yes', 'y', 'on'}: ...
3,358
37.170455
114
py
null
grin-main/lib/utils/utils.py
import numpy as np import pandas as pd from sklearn.metrics.pairwise import haversine_distances def sample_mask(shape, p=0.002, p_noise=0., max_seq=1, min_seq=1, rng=None): if rng is None: rand = np.random.random randint = np.random.randint else: rand = rng.random randint = rn...
8,755
40.107981
119
py
null
grin-main/scripts/run_baselines.py
from argparse import ArgumentParser import numpy as np from fancyimpute import MatrixFactorization, IterativeImputer from sklearn.neighbors import kneighbors_graph from lib import datasets from lib.utils import numpy_metrics from lib.utils.parser_utils import str_to_bool metrics = { 'mae': numpy_metrics.masked_m...
7,437
33.119266
108
py
null
grin-main/scripts/run_imputation.py
import copy import datetime import os import pathlib from argparse import ArgumentParser import numpy as np import pytorch_lightning as pl import torch import torch.nn.functional as F import yaml from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.loggers import TensorBoardLog...
12,130
42.636691
114
py
null
grin-main/scripts/run_synthetic.py
import copy import datetime import os import pathlib from argparse import ArgumentParser import numpy as np import pytorch_lightning as pl import torch import torch.nn.functional as F import yaml from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.loggers import TensorBoardLog...
9,402
41.355856
120
py
hats
hats-master/README.md
# Hyper-Accelerated Tree Search (HATS) This is the repo for the paper entitled "Towards Optimally Efficient Search with Deep Learning for Large-Scale MIMO Systems". The key idea of this paper is to train the network towards the optimal heuristic. You can check the [Preprint](https://arxiv.org/abs/2101.02420) online i...
1,938
43.068182
174
md
hats
hats-master/draw.py
import matplotlib.pyplot as plt import itertools import numpy as np from prelude import * omega = [-3, -1, 1, 3] constellation = np.array([x for x in itertools.product(omega, repeat=2)]) constellation = np.expand_dims(constellation, 2) plt.figure() plt.subplot(221) plt.xticks(omega) plt.yticks(omega) plt.scatter(con...
876
22.702703
76
py
hats
hats-master/model.py
import torch.nn as nn from prelude import * class RadiusNet(nn.Module): def __init__(self, n_ant: int): super(RadiusNet, self).__init__() self.n_ant = n_ant n = n_ant * 2 self.layer_1 = nn.Linear(n + n * n, 128) self.layer_2 = nn.Linear(128, 64) self.layer_3 = nn....
3,545
30.945946
75
py
hats
hats-master/prelude.py
import itertools import numpy as np import torch def torch_flat(x): return torch.flatten(x, start_dim=1) def class_name(o): return o.__class__.__name__ def get_bits(x: np.ndarray): return np.where(x <= 0, 0, 1) def count_nonzero(t: np.ndarray): return np.count_nonzero(t) def count_zero(t: np....
2,803
20.569231
96
py
hats
hats-master/search.py
from typing import List from prelude import * from tree import TreeNode, PriorityQueue, AVLTree class AStar: def __init__(self, heuristic=None): self.__queue = PriorityQueue(capacity=np.inf) self.nodes_expanded = 0 self.nodes_generated = 0 self.__heuristic = heuristic def ma...
4,587
28.6
73
py
hats
hats-master/test.py
import time from tabulate import tabulate from model import HeuristicNet from search import * from prelude import * import matplotlib.pyplot as plt def get_heurisitc(n_ant): dnn = HeuristicNet(n_ant) dnn.load() return lambda y, R, psv: dnn.compute(y, R, psv) def get_algorithms(n_ant, mem_size_list): ...
5,749
32.625731
119
py
hats
hats-master/train.py
import random import time from prelude import * from model import HeuristicNet import torch import torch.optim as optim import torch.nn.functional as F def gen_level(y, R, s, lv): cost = np.sum(np.square(y - R @ s)) n = np.copy(s) n[:-lv] = 0 g = tree_g(y, R, n) lv_par = lv - 1 if lv_par ==...
5,359
28.450549
97
py
hats
hats-master/tree.py
import heapq from prelude import * from typing import List from sortedcontainers import SortedList def get_path(data): lv = tree_level(data) if lv == 0: path = "root" else: symbols = data[-lv:, :].flat path = "".join("{:d}".format(int(x)) for x in symbols) return path class...
6,218
24.487705
77
py
PlagueDotTxt
PlagueDotTxt-master/README.md
# Plague Dot Text The Plague.TXT project repository contains data related to the Third Plague Pandemic. This is an ongoing project at the University of Edinburgh involving computer scientists, medical historicans and staff at the University of Edinburgh Library. More information about the project can be found here: ...
366
51.428571
245
md
PlagueDotTxt
PlagueDotTxt-master/source-data/README.md
This directory contains the source data compiled and used as part of the Plague.TXT project. The Third Plague Pandemic was documented in over 100 outbreak reports for most major citiesaround the world. Many of them have been digitised, converted to text via optical characterrecognition (OCR) and are available via the...
504
83.166667
279
md
nftopt
nftopt-master/.travis.yml
language: python dist: trusty sudo: false python: - 2.7 - 3.6 install: - pip install -e . script: - pytest
120
6.5625
20
yml
nftopt
nftopt-master/README.md
# Nakanishi-Fujii-Todo method for scipy.optimize [![Build Status](https://travis-ci.org/ken-nakanishi/nftopt.svg?branch=master)](https://travis-ci.org/ken-nakanishi/nftopt) This is Nakanishi-Fujii-Todo method (arXiv:1903.12166) for `scipy.optimize.minimize`. The optimization function have to satisfy three conditions...
883
20.560976
123
md
nftopt
nftopt-master/setup.py
# -*- coding: utf-8 -*- from setuptools import setup, find_packages with open('README.md') as f: readme = f.read() with open('LICENSE') as f: license = f.read() setup( name='nftopt', version='0.0.1', description='Nakanishi-Fujii-Todo method for scipy.optimize', long_description=readme, a...
579
23.166667
65
py
nftopt
nftopt-master/nftopt/__init__.py
from .nft import nakanishi_fujii_todo
37
37
37
py
nftopt
nftopt-master/nftopt/nft.py
from __future__ import division import numpy as np from scipy.optimize import OptimizeResult def nakanishi_fujii_todo(fun, x0, args=(), maxfev=1024, reset_interval=32, eps=1e-32, callback=None, **_): """ Find the global minimum of a function using the nakanishi_fujii_todo algorithm [1]. Parameters ...
3,156
28.783019
106
py
nftopt
nftopt-master/tests/__init__.py
0
0
0
py
nftopt
nftopt-master/tests/test_nft.py
from __future__ import division import numpy as np import scipy.optimize as opt from nftopt import nakanishi_fujii_todo import pytest def test_nakanishi_fujii_todo(): param = np.linspace(0, 2 * np.pi, 100) fun = lambda x: np.sum(np.cos(x)) res = opt.minimize( fun, param, options=...
527
23
72
py
nni
nni-master/.readthedocs.yaml
# .readthedocs.yaml # Read the Docs configuration file # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details # Required version: 2 # Set the version of Python and other tools you might need build: os: ubuntu-20.04 tools: python: "3.9" nodejs: "16" # specified but actually not used ...
1,047
30.757576
90
yaml
nni
nni-master/README.md
<div align="center"> <img src="docs/img/nni_logo.png" width="600"/> </div> <br/> [![MIT licensed](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE) [![Issues](https://img.shields.io/github/issues-raw/Microsoft/nni.svg)](https://github.com/Microsoft/nni/issues?q=is%3Aissue+is%3Aopen) [![Bugs](https:/...
17,375
60.617021
308
md
nni
nni-master/SECURITY.md
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.5 BLOCK --> ## Security Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), ...
2,781
65.238095
435
md
nni
nni-master/crowdin.yml
project_id_env: CROWDIN_PROJECT_ID api_token_env: CROWDIN_PERSONAL_TOKEN preserve_hierarchy: true files: - source: /docs/en_US/**/* ignore: - /docs/zh_CN/**/* translation: /docs/%locale_with_underscore%/**/%original_file_name% - source: '/**/*.[mM][dD]' ignore: - '/**/*_%locale_with_undersco...
467
28.25
73
yml
nni
nni-master/setup.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. """ Script for installation and distribution. You can use environment variable `NNI_RELEASE` to set release version. If release version is not set, default to a development build whose version string will be `999.dev0`. ## Prepare Environment...
9,762
31.435216
144
py
nni
nni-master/setup_ts.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. """ Script for building TypeScript modules. This script is called by `setup.py` and common users should avoid using this directly. It compiles TypeScript source files in `ts` directory, and copies (or links) JavaScript output as well as dependen...
12,270
35.84985
137
py
nni
nni-master/.github/pull_request_template.md
### Description ### #### Test Options #### - [ ] fast test - [ ] full test - HPO - [ ] full test - NAS - [ ] full test - compression ### Checklist ### - [ ] test case - [ ] doc ### How to test ###
214
12.4375
31
md
nni
nni-master/.github/ISSUE_TEMPLATE/bug-report.md
--- name: Create an issue about: Report an issue or question while using nni instance (deployment). --- **Describe the issue**: **Environment**: - NNI version: - Training service (local|remote|pai|aml|etc): - Client OS: - Server OS (for remote mode only): - Python version: - PyTorch/TensorFlow version: - Is conda...
818
19.475
108
md
nni
nni-master/.github/ISSUE_TEMPLATE/enhancement.md
--- name: Enhancement Request about: Suggest an enhancement to the nni project --- <!-- Please only use this template for submitting enhancement requests --> **What would you like to be added**: **Why is this needed**: **Without this feature, how does current nni work**: **Components that may involve changes**: ...
367
19.444444
74
md
nni
nni-master/.github/ISSUE_TEMPLATE/model-compression-bug-report.md
--- name: Create a model compression/speedup issue about: Report an issue or question while using nni instance (deployment). --- **Describe the bug**: **Environment**: - NNI version: - Training service (local|remote|pai|aml|etc): - Python version: - PyTorch version: - Cpu or cuda version: **Reproduce the proble...
361
14.083333
73
md
nni
nni-master/.github/ISSUE_TEMPLATE/model-compression-enhancement.md
--- name: Enhancement Request(model compression/speedup) about: Suggest an enhancement to the nni project --- <!-- Please only use this template for submitting model compression/speedup enhancement requests --> **Describe the feature**: **Motivations**: **Alternatives**: **Components that may involve changes**: ...
367
19.444444
100
md
nni
nni-master/.github/ISSUE_TEMPLATE/studentProgram.md
--- name: Question for NNI Student Program China / NNI 学生项目问题表单 about: NNI Student Program China issue template on Github --- <!-- Here is an issue template for NNI student program China. You are encouraged to raise concerns about any issue and share your ideas of NNI or our student program. Both Chinese and Engli...
1,454
31.333333
206
md
nni
nni-master/.github/workflows/cffconvert.yml
name: cffconvert on: push: paths: - CITATION.cff jobs: validate: name: "validate" runs-on: ubuntu-latest steps: - name: Check out a copy of the repository uses: actions/checkout@v2 - name: Check whether the citation metadata from CITATION.cff is valid uses: citat...
410
19.55
76
yml
nni
nni-master/.github/workflows/main.yml
# This is a basic workflow to help you get started with Actions name: CI # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the master branch on: push: branches: [ master ] paths: - '**.md' - '**.rst' - '/docs/en_US/**' - '/crowdi...
3,968
43.595506
184
yml
nni
nni-master/docs/_removed/Release_v1.0.md
<p align="center"> <img src=".././img/release-1-title-1.png" width="100%" /> </p> From September 2018 to September 2019, We are still moving on … **Great news!**&nbsp;&nbsp;With the tag of **Scalability** and **Ease of Use**, NNI v1.0 is comming. Based on the various types of [Tuning Algorithms](./Tuner/BuiltinTu...
2,094
64.46875
640
md
nni
nni-master/docs/_removed/Tutorial/NNSpider.md
<!-- <style> table, tr, td{ border: none; } div{ width: 300px; height: 200px; border: 1px solid grey; background: #ccc; box-sizing: border-box; } img{ width: 260px; height: 160px; margin: 20px; } </style> --> <table> <tr> <td> <div> <img style=" ...
2,305
17.448
48
md
nni
nni-master/docs/extension/cardlinkitem.py
""" Directive "cardlinkitem" used in tutorials navigation page. """ import os from docutils.parsers.rst import Directive, directives from docutils.statemachine import StringList from docutils import nodes from sphinx.addnodes import pending_xref TAG_TEMPLATE = """<span class="card-link-tag">{tag}</span>""" TAGS_TEM...
3,505
25.560606
126
py
nni
nni-master/docs/extension/codesnippetcard.py
""" Code snippet card, used in index page. """ from docutils.parsers.rst import Directive, directives from docutils.statemachine import StringList from docutils import nodes from sphinx.addnodes import pending_xref CARD_TEMPLATE_HEADER = """ .. raw:: html <div class="codesnippet-card admonition"> <div cla...
3,111
26.06087
131
py
nni
nni-master/docs/extension/getpartialtext.py
""" Basically same as `sphinx gettext buidler <https://www.sphinx-doc.org/en/master/_modules/sphinx/builders/gettext.html>`_, but only get texts from files in a whitelist. """ import re from docutils import nodes from sphinx.application import Sphinx from sphinx.builders.gettext import MessageCatalogBuilder class P...
880
27.419355
103
py
nni
nni-master/docs/extension/inplace_translation.py
""" Sphinx inplace translation. Please put `xxx_zh_CN.rst` alongside `xxx.rst`. When language is set to `zh_CN`, `xxx_zh_CN.rst` will be used in place of `xxx.rst`. If translation does not exist, it will automatically fallback to the original files, without warning. I write this based on the example of: https://github...
1,218
30.25641
101
py
nni
nni-master/docs/extension/patch_autodoc.py
"""Hack autodoc to get more fine-grained docstring rendering contol. autodoc and autosummary didn't expose many of their controls to sphinx users via config. To customize them, the "correct" approach seems to copy and paste all their code and rewrite some part. To avoid doing this, I monkey-patched some of the functio...
7,792
42.536313
129
py
nni
nni-master/docs/extension/toctree_check.py
""" Make sure pages that contain toctree only has a toctree, because, if our theme is used, other contents will not be visible. """ import re from docutils import nodes from sphinx.application import Sphinx from sphinx.addnodes import toctree from sphinx.util.logging import getLogger logger = getLogger('toctree_chec...
1,480
26.943396
86
py
nni
nni-master/docs/extension/tutorial_links.py
"""Creating hard links for tutorials in each individual topics.""" import os import re HEADER = """.. THIS FILE IS A COPY OF {} WITH MODIFICATIONS. .. TO MAKE ONE TUTORIAL APPEAR IN MULTIPLE PLACES. """ def flatten_filename(filename): return filename.replace('/', '_').replace('.', '_') def copy_tutorials(app):...
1,797
38.086957
120
py
nni
nni-master/docs/source/conf.py
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
13,869
31.712264
141
py
nni
nni-master/docs/source/tutorials/darts.py
""" Searching in DARTS search space =============================== In this tutorial, we demonstrate how to search in the famous model space proposed in `DARTS`_. Through this process, you will learn: * How to use the built-in model spaces from NNI's model space hub. * How to use one-shot exploration strategies to e...
27,483
37.013831
136
py
nni
nni-master/docs/source/tutorials/hello_nas.py
""" Hello, NAS! =========== This is the 101 tutorial of Neural Architecture Search (NAS) on NNI. In this tutorial, we will search for a neural architecture on MNIST dataset with the help of NAS framework of NNI, i.e., *Retiarii*. We use multi-trial NAS as an example to show how to construct and explore a model space. ...
13,690
38.684058
138
py
nni
nni-master/docs/source/tutorials/nasbench_as_dataset.py
""" Use NAS Benchmarks as Datasets ============================== In this tutorial, we show how to use NAS Benchmarks as datasets. For research purposes we sometimes desire to query the benchmarks for architecture accuracies, rather than train them one by one from scratch. NNI has provided query tools so that users ca...
5,557
28.88172
123
py
nni
nni-master/docs/source/tutorials/new_pruning_bert_glue.py
""" Pruning Bert on Task MNLI ========================= This is a new tutorial on pruning transformer in nni v3.0 (`old tutorial <https://nni.readthedocs.io/en/v2.9/tutorials/pruning_bert_glue.html>`__). The main difference between this tutorial and the previous is that it integrates the feature of fusion compression ...
23,836
37.571197
169
py
nni
nni-master/docs/source/tutorials/pruning_quick_start.py
""" Pruning Quickstart ================== Model pruning is a technique to reduce the model size and computation by reducing model weight size or intermediate state size. There are three common practices for pruning a DNN model: #. Pre-training a model -> Pruning the model -> Fine-tuning the pruned model #. Pruning a ...
3,639
32.703704
128
py
nni
nni-master/docs/source/tutorials/pruning_speedup.py
""" Speedup Model with Mask ======================== Introduction ------------ Pruning algorithms usually use weight masks to simulate the real pruning. Masks can be used to check model performance of a specific pruning (or sparsity), but there is no real speedup. Since model speedup is the ultimate goal of model pru...
6,827
27.569038
153
py
nni
nni-master/docs/source/tutorials/quantization_bert_glue.py
""" Quantize BERT on Task GLUE ========================== Here we show an effective transformer simulated quantization process that NNI team has tried, and users can use NNI to discover better process. We use the BERT model and the trainer pipeline in the Transformers to do some experiments. The entire quantization p...
11,273
36.832215
163
py
nni
nni-master/docs/source/tutorials/quantization_quick_start.py
""" Quantization Quickstart ======================= Quantization reduces model size and speeds up inference time by reducing the number of bits required to represent weights or activations. In NNI, both post-training quantization algorithms and quantization-aware training algorithms are supported. Here we use `QATQua...
5,582
31.649123
137
py
nni
nni-master/docs/source/tutorials/quantization_speedup.py
""" Speed Up Quantized Model with TensorRT ====================================== Quantization algorithms quantize a deep learning model usually in a simulated way. That is, to simulate the effect of low-bit computation with float32 operators, the tensors are quantized to the targeted bit number and dequantized back t...
8,548
43.295337
593
py
nni
nni-master/docs/source/tutorials/hpo_nnictl/model.py
""" Port PyTorch Quickstart to NNI ============================== This is a modified version of `PyTorch quickstart`_. It can be run directly and will have the exact same result as original version. Furthermore, it enables the ability of auto tuning with an NNI *experiment*, which will be detailed later. It is recom...
3,954
30.388889
106
py
nni
nni-master/docs/source/tutorials/hpo_quickstart_pytorch/main.py
""" HPO Quickstart with PyTorch =========================== This tutorial optimizes the model in `official PyTorch quickstart`_ with auto-tuning. The tutorial consists of 4 steps: 1. Modify the model for auto-tuning. 2. Define hyperparameters' search space. 3. Configure the experiment. 4. Run the experiment. .. _of...
5,626
35.070513
108
py
nni
nni-master/docs/source/tutorials/hpo_quickstart_pytorch/model.py
""" Port PyTorch Quickstart to NNI ============================== This is a modified version of `PyTorch quickstart`_. It can be run directly and will have the exact same result as original version. Furthermore, it enables the ability of auto tuning with an NNI *experiment*, which will be detailed later. It is recom...
3,954
30.388889
106
py
nni
nni-master/docs/source/tutorials/hpo_quickstart_tensorflow/main.py
""" HPO Quickstart with TensorFlow ============================== This tutorial optimizes the model in `official TensorFlow quickstart`_ with auto-tuning. The tutorial consists of 4 steps: 1. Modify the model for auto-tuning. 2. Define hyperparameters' search space. 3. Configure the experiment. 4. Run the experiment...
5,895
36.316456
108
py
nni
nni-master/docs/source/tutorials/hpo_quickstart_tensorflow/model.py
""" Port TensorFlow Quickstart to NNI ================================= This is a modified version of `TensorFlow quickstart`_. It can be run directly and will have the exact same result as original version. Furthermore, it enables the ability of auto tuning with an NNI *experiment*, which will be detailed later. It...
2,988
32.58427
106
py
nni
nni-master/docs/static/css/index_page.css
/* The following are for index.html */ .wy-table-responsive table td, .wy-table-responsive table th { white-space: normal } .gap { margin-top: 24px; } .gap2 { margin-top: 12px; } .rowHeight { line-height: 24px; } .title { padding-bottom: 6px; border-bottom: 1px solid #ccc; } .second-title ...
3,167
13.334842
105
css
nni
nni-master/docs/static/css/material_custom.css
/* Global font */ body, input { font-family: "Roboto", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif; } code, kbd, pre { font-family: "Roboto Mono", "Consolas", "Courier New", Courier, monospace; } h1, h2, h3, h4, .md-header, .md-tabs, .md-hero { font-family: "Google Sans", "Noto Sans", "Hel...
9,884
19.091463
123
css
nni
nni-master/docs/static/css/material_dropdown.css
/* https://codepen.io/mildrenben/pen/RPwQEY */ @media only screen and (max-width:44.9375em) { .drop { display: none; } } .drop { width: 5.3rem; vertical-align: middle; } @media only screen and (min-width:60em) and (max-width:70em) { .drop { width: 4.7rem; } /* also narrow ...
1,442
17.5
81
css
nni
nni-master/docs/static/css/material_theme.css
/* Theme related customization */ /* https://github.com/bashtage/sphinx-material/pull/122 */ /* first part */ button[data-md-color-primary=custom] { background-color: var(--custom-color-primary) } [data-md-color-primary=custom] .md-typeset a { color: var(--custom-color-primary) } [data-md-color-primary=custo...
3,134
30.989796
89
css
nni
nni-master/docs/static/css/sphinx_gallery.css
/* Customization to sphinx-gallery generated notebooks */ p.sphx-glr-script-out { margin: 0; padding: 0; font-size: .7rem; } .sphx-glr-script-out .highlight { margin: 0 !important; } .sphx-glr-script-out .highlight pre { background-color: #f0f6fa !important; padding: .6rem !important; mar...
2,670
16.688742
99
css
nni
nni-master/docs/static/img/README.md
This folder is deprecated. Please do not put files here in future!
67
33
66
md
nni
nni-master/docs/templates/globaltoc.html
{% set toctree = toctree(maxdepth=theme_globaltoc_depth|toint, collapse=theme_globaltoc_collapse|tobool, includehidden=theme_globaltoc_includehidden|tobool, titles_only=True) %} {% if toctree and sidebars and 'globaltoc.html' in sidebars %} {% set toctree_nodes = derender_toc(toctree, False) %} <ul class="md-nav__l...
1,664
44
177
html
nni
nni-master/docs/templates/header.html
<header class="md-header" data-md-component="header"> <nav class="md-header-nav md-grid"> <div class="md-flex navheader"> <div class="md-flex__cell md-flex__cell--shrink"> <a href="{{ pathto(master_doc)|e }}" title="{{ docstitle|e }}" class="md-header-nav__button md-logo"> <img...
1,562
42.416667
92
html
nni
nni-master/docs/templates/hero.html
{% if pagename in theme_heroes %} {% set hero = theme_heroes[pagename] %} <div class="md-hero{% if nav_bar_tabs %} md-hero--expand{% endif %}" data-md-component="hero"> <div class="md-hero__inner md-grid"> <p>{{ hero }}</p> </div> <div class="md-hero__background"> <img src="{{ pathto('_static/img/hero-bac...
372
30.083333
94
html
nni
nni-master/docs/templates/layout.html
{% extends "!layout.html" %} {#- SPECIFY PARTICULAR FONTS FOR HEADERS #} {% block font %} <link href="https://fonts.gstatic.com/" rel="preconnect" crossorigin> <link href="https://fonts.googleapis.com/css?family=Roboto+Mono:400,500,700|Roboto:400,400i,500,700|Google+Sans:400,500,600|Material+Icons&display=fallback...
1,632
32.326531
252
html