text
stringlengths
5
22M
id
stringlengths
12
177
metadata
dict
__index_level_0__
int64
0
1.37k
import torch from mmcv.cnn import constant_init, kaiming_init from torch import nn def last_zero_init(m): if isinstance(m, nn.Sequential): constant_init(m[-1], val=0) else: constant_init(m, val=0) class ContextBlock(nn.Module): def __init__(self, inplanes, ...
Cream/CDARTS/CDARTS_detection/mmdet/ops/gcb/context_block.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/gcb/context_block.py", "repo_id": "Cream", "token_count": 1982 }
307
# ---------------------------------------------------------- # Soft-NMS: Improving Object Detection With One Line of Code # Copyright (c) University of Maryland, College Park # Licensed under The MIT License [see LICENSE for details] # Written by Navaneeth Bodla and Bharat Singh # Modified by Kai Chen # ---------------...
Cream/CDARTS/CDARTS_detection/mmdet/ops/nms/src/soft_nms_cpu.pyx/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/nms/src/soft_nms_cpu.pyx", "repo_id": "Cream", "token_count": 2233 }
308
from torch.nn.modules.module import Module from ..functions.roi_pool import roi_pool class RoIPool(Module): def __init__(self, out_size, spatial_scale): super(RoIPool, self).__init__() self.out_size = out_size self.spatial_scale = float(spatial_scale) def forward(self, features, roi...
Cream/CDARTS/CDARTS_detection/mmdet/ops/roi_pool/modules/roi_pool.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/roi_pool/modules/roi_pool.py", "repo_id": "Cream", "token_count": 159 }
309
import logging from mmcv.runner import get_dist_info def get_root_logger(log_file=None, log_level=logging.INFO): """Get the root logger. The logger will be initialized if it has not been initialized. By default a StreamHandler will be added. If `log_file` is specified, a FileHandler will also be add...
Cream/CDARTS/CDARTS_detection/mmdet/utils/logger.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/mmdet/utils/logger.py", "repo_id": "Cream", "token_count": 960 }
310
from __future__ import division import argparse import torch # torch.multiprocessing.set_sharing_strategy('file_system') # for file_descriptor, but cause shm leak while nas optimizer import os from mmcv import Config from mmdet import __version__ from mmdet.datasets import build_dataset from mmdet.apis import (trai...
Cream/CDARTS/CDARTS_detection/train.py/0
{ "file_path": "Cream/CDARTS/CDARTS_detection/train.py", "repo_id": "Cream", "token_count": 1567 }
311
# ------------------------------------------------------------------------------ # Base class for loading a segmentation Dataset. # Written by Bowen Cheng (bcheng9@illinois.edu) # ------------------------------------------------------------------------------ import os import numpy as np from PIL import Image, ImageOp...
Cream/CDARTS/CDARTS_segmentation/dataloaders/segdatasets/base_dataset.py/0
{ "file_path": "Cream/CDARTS/CDARTS_segmentation/dataloaders/segdatasets/base_dataset.py", "repo_id": "Cream", "token_count": 2967 }
312
# ------------------------------------------------------------------------------ # Reference: https://github.com/facebookresearch/detectron2/blob/master/detectron2/evaluation/cityscapes_evaluation.py # Modified by Bowen Cheng (bcheng9@illinois.edu) # ---------------------------------------------------------------------...
Cream/CDARTS/CDARTS_segmentation/segmentation/evaluation/instance.py/0
{ "file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/evaluation/instance.py", "repo_id": "Cream", "token_count": 1811 }
313
# ------------------------------------------------------------------------------ # Panoptic-DeepLab decoder. # Written by Bowen Cheng (bcheng9@illinois.edu) # ------------------------------------------------------------------------------ from collections import OrderedDict from functools import partial import torch f...
Cream/CDARTS/CDARTS_segmentation/segmentation/model/decoder/panoptic_deeplab.py/0
{ "file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/model/decoder/panoptic_deeplab.py", "repo_id": "Cream", "token_count": 3101 }
314
from .save_annotation import ( save_annotation, save_instance_annotation, save_panoptic_annotation, save_center_image, save_heatmap_image, save_heatmap_and_center_image, save_offset_image) from .flow_vis import flow_compute_color from .utils import AverageMeter from .debug import save_debug_images
Cream/CDARTS/CDARTS_segmentation/segmentation/utils/__init__.py/0
{ "file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/utils/__init__.py", "repo_id": "Cream", "token_count": 99 }
315
from .cityscapes import Cityscapes __all__ = ['Cityscapes']
Cream/CDARTS/CDARTS_segmentation/tools/datasets/cityscapes/__init__.py/0
{ "file_path": "Cream/CDARTS/CDARTS_segmentation/tools/datasets/cityscapes/__init__.py", "repo_id": "Cream", "token_count": 20 }
316
import os import math import numpy as np import torch import shutil from torch.autograd import Variable import time from tqdm import tqdm from genotypes import PRIMITIVES import matplotlib # Force matplotlib to not use any Xwindows backend. matplotlib.use('Agg') from matplotlib import pyplot as plt from pdb import set_...
Cream/CDARTS/CDARTS_segmentation/tools/utils/darts_utils.py/0
{ "file_path": "Cream/CDARTS/CDARTS_segmentation/tools/utils/darts_utils.py", "repo_id": "Cream", "token_count": 6285 }
317
# encoding: utf-8 from __future__ import absolute_import from __future__ import division from __future__ import print_function import os.path as osp import sys import numpy as np from easydict import EasyDict as edict C = edict() config = C cfg = C C.seed = 12345 """please config ROOT_dir and user when u first usi...
Cream/CDARTS/CDARTS_segmentation/train/config_test.py/0
{ "file_path": "Cream/CDARTS/CDARTS_segmentation/train/config_test.py", "repo_id": "Cream", "token_count": 875 }
318
__all__ = ['ConvNorm', 'BasicResidual1x', 'BasicResidual_downup_1x', 'BasicResidual2x', 'BasicResidual_downup_2x', 'FactorizedReduce', 'OPS', 'OPS_name', 'OPS_Class', 'Self_Attn'] from pdb import set_trace as bp import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from thop import prof...
Cream/CDARTS/CDARTS_segmentation/train/operations.py/0
{ "file_path": "Cream/CDARTS/CDARTS_segmentation/train/operations.py", "repo_id": "Cream", "token_count": 19889 }
319
import torch import torch.nn as nn import torch.nn.functional as F from utils import utils from models.loss import Loss_interactive def search(train_loader, valid_loader, model, optimizer, w_optim, alpha_optim, epoch, writer, logger, config): # interactive retrain and kl device = torch.device("cuda") crit...
Cream/CDARTS/benchmark201/core/search_function.py/0
{ "file_path": "Cream/CDARTS/benchmark201/core/search_function.py", "repo_id": "Cream", "token_count": 4846 }
320
import torch import torch.nn as nn class DistillHeadCIFAR(nn.Module): def __init__(self, C, size, num_classes, bn_affine=True): """assuming input size 8x8 or 16x16""" super(DistillHeadCIFAR, self).__init__() self.features = nn.Sequential( nn.ReLU(), nn.AvgPool2d(si...
Cream/CDARTS/lib/models/aux_head.py/0
{ "file_path": "Cream/CDARTS/lib/models/aux_head.py", "repo_id": "Cream", "token_count": 1858 }
321
# Train Workspace
Cream/Cream/experiments/workspace/train/README.md/0
{ "file_path": "Cream/Cream/experiments/workspace/train/README.md", "repo_id": "Cream", "token_count": 5 }
322
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # Written by Hao Du and Houwen Peng # email: haodu8-c@my.cityu.edu.hk and houwen.peng@microsoft.com # This dictionary is generated from calculating each operation of each layer to quickly search for layers. # flops_op_dict[which_stage][which_oper...
Cream/Cream/lib/utils/op_by_layer_dict.py/0
{ "file_path": "Cream/Cream/lib/utils/op_by_layer_dict.py", "repo_id": "Cream", "token_count": 908 }
323
# EfficientViT for Image Classification The codebase implements the image classification with EfficientViT. ## Model Zoo |Model | Data | Input | Acc@1 | Acc@5 | #FLOPs | #Params | Throughput | Link | | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | |EfficientViT-M0 | ImageNet-1k |224x224|...
Cream/EfficientViT/classification/README.md/0
{ "file_path": "Cream/EfficientViT/classification/README.md", "repo_id": "Cream", "token_count": 3341 }
324
model = dict( type='FasterRCNN', pretrained='torchvision://resnet50', backbone=dict( type='ResNet', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch'...
Cream/EfficientViT/downstream/configs/_base_/models/faster_rcnn_r50_fpn.py/0
{ "file_path": "Cream/EfficientViT/downstream/configs/_base_/models/faster_rcnn_r50_fpn.py", "repo_id": "Cream", "token_count": 2202 }
325
"""Build iRPE (image RPE) Functions""" from setuptools import setup, Extension import torch from torch.utils import cpp_extension ext_t = cpp_extension.CppExtension ext_fnames = ['rpe_index.cpp'] define_macros = [] extra_compile_args = dict(cxx=['-fopenmp', '-O3'], nvcc=['-O3']) if torch.cud...
Cream/MiniViT/Mini-DeiT/rpe_ops/setup.py/0
{ "file_path": "Cream/MiniViT/Mini-DeiT/rpe_ops/setup.py", "repo_id": "Cream", "token_count": 402 }
326
from .build import build_loader
Cream/MiniViT/Mini-Swin/data/__init__.py/0
{ "file_path": "Cream/MiniViT/Mini-Swin/data/__init__.py", "repo_id": "Cream", "token_count": 7 }
327
from torch import optim as optim def build_optimizer(config, model): """ Build optimizer, set weight decay of normalization to 0 by default. """ skip = {} skip_keywords = {} if hasattr(model, 'no_weight_decay'): skip = model.no_weight_decay() if hasattr(model, 'no_weight_decay_keyw...
Cream/MiniViT/Mini-Swin/optimizer.py/0
{ "file_path": "Cream/MiniViT/Mini-Swin/optimizer.py", "repo_id": "Cream", "token_count": 819 }
328
import torch from PIL import Image import open_clip # manual inheritance # arch = 'TinyCLIP-ViT-39M-16-Text-19M' # model, _, preprocess = open_clip.create_model_and_transforms(arch, pretrained='YFCC15M') # arch = 'TinyCLIP-ViT-8M-16-Text-3M' # model, _, preprocess = open_clip.create_model_and_transforms(arch, pretrai...
Cream/TinyCLIP/inference.py/0
{ "file_path": "Cream/TinyCLIP/inference.py", "repo_id": "Cream", "token_count": 572 }
329
imagenet_classnames = ["tench", "goldfish", "great white shark", "tiger shark", "hammerhead shark", "electric ray", "stingray", "rooster", "hen", "ostrich", "brambling", "goldfinch", "house finch", "junco", "indigo bunting", "American robin", "bulbul", "jay", "magpie", "c...
Cream/TinyCLIP/src/open_clip/imagenet_zeroshot_data.py/0
{ "file_path": "Cream/TinyCLIP/src/open_clip/imagenet_zeroshot_data.py", "repo_id": "Cream", "token_count": 10252 }
330
""" timm model adapter Wraps timm (https://github.com/rwightman/pytorch-image-models) models for use as a vision tower in CLIP model. """ from collections import OrderedDict import torch.nn as nn try: import timm from timm.models.layers import Mlp, to_2tuple except: timm = None try: from timm.models....
Cream/TinyCLIP/src/open_clip/timm_model.py/0
{ "file_path": "Cream/TinyCLIP/src/open_clip/timm_model.py", "repo_id": "Cream", "token_count": 2156 }
331
import argparse def get_default_params(model_name): # Params from paper (https://arxiv.org/pdf/2103.00020.pdf) model_name = model_name.lower() if "vit" in model_name: return {"lr": 5.0e-4, "beta1": 0.9, "beta2": 0.98, "eps": 1.0e-6} else: return {"lr": 5.0e-4, "beta1": 0.9, "beta2": 0....
Cream/TinyCLIP/src/training/params.py/0
{ "file_path": "Cream/TinyCLIP/src/training/params.py", "repo_id": "Cream", "token_count": 5891 }
332
MODEL: NAME: TinyViT-11M-22k-distill TYPE: tiny_vit DROP_PATH_RATE: 0.0 TINY_VIT: DEPTHS: [ 2, 2, 6, 2 ] NUM_HEADS: [ 2, 4, 8, 14 ] WINDOW_SIZES: [ 7, 7, 14, 7 ] EMBED_DIMS: [64, 128, 256, 448] TRAIN: EPOCHS: 90 BASE_LR: 2.5e-4 WARMUP_EPOCHS: 5 WEIGHT_DECAY: 0.01 DATA: DATASET: im...
Cream/TinyViT/configs/22k_distill/tiny_vit_11m_22k_distill.yaml/0
{ "file_path": "Cream/TinyViT/configs/22k_distill/tiny_vit_11m_22k_distill.yaml", "repo_id": "Cream", "token_count": 218 }
333
DEFAULT_CROP_PCT = 0.875 IMAGENET_DEFAULT_MEAN = (0.485, 0.456, 0.406) IMAGENET_DEFAULT_STD = (0.229, 0.224, 0.225) IMAGENET_INCEPTION_MEAN = (0.5, 0.5, 0.5) IMAGENET_INCEPTION_STD = (0.5, 0.5, 0.5) IMAGENET_DPN_MEAN = (124 / 255, 117 / 255, 104 / 255) IMAGENET_DPN_STD = tuple([1 / (.0167 * 255)] * 3)
Cream/TinyViT/data/augmentation/constants.py/0
{ "file_path": "Cream/TinyViT/data/augmentation/constants.py", "repo_id": "Cream", "token_count": 162 }
334
""" Dataset parser interface that wraps TFDS datasets Wraps many (most?) TFDS image-classification datasets from https://github.com/tensorflow/datasets https://www.tensorflow.org/datasets/catalog/overview#image_classification Hacked together by / Copyright 2020 Ross Wightman """ import math import torch import torch....
Cream/TinyViT/data/augmentation/parsers/parser_tfds.py/0
{ "file_path": "Cream/TinyViT/data/augmentation/parsers/parser_tfds.py", "repo_id": "Cream", "token_count": 6076 }
335
# -------------------------------------------------------- # Logger # Copyright (c) 2022 Microsoft # Based on the code: Swin Transformer # (https://github.com/microsoft/swin-transformer) # -------------------------------------------------------- import os import sys import logging import functools from termcolor imp...
Cream/TinyViT/logger.py/0
{ "file_path": "Cream/TinyViT/logger.py", "repo_id": "Cream", "token_count": 570 }
336
"""The implementation of iRPE (image relative position encoding).""" from easydict import EasyDict as edict import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F try: from rpe_ops.rpe_index import RPEIndexFunction except ImportError: RPEIndexFunction = None import...
Cream/iRPE/DETR-with-iRPE/models/rpe_attention/irpe.py/0
{ "file_path": "Cream/iRPE/DETR-with-iRPE/models/rpe_attention/irpe.py", "repo_id": "Cream", "token_count": 14289 }
337
from __future__ import absolute_import from __future__ import division from __future__ import print_function import torch @torch.no_grad() def accuracy(output, target, topk=(1,)): """Computes the precision@k for the specified values of k""" if isinstance(output, list): output = output[-1] maxk =...
CvT/lib/core/evaluate.py/0
{ "file_path": "CvT/lib/core/evaluate.py", "repo_id": "CvT", "token_count": 268 }
338
from .build import build_lr_scheduler
CvT/lib/scheduler/__init__.py/0
{ "file_path": "CvT/lib/scheduler/__init__.py", "repo_id": "CvT", "token_count": 12 }
339
import pandas as pd from msanomalydetector import SpectralResidual, DetectMode import matplotlib import matplotlib.pyplot as plt import logging from azureml.core.run import Run import os def log_plot_result(input_df, output_df, col_name, mode): fig = plt.figure(figsize=(20, 10)) ax1 = fig.add_subplot(211) ...
anomalydetector/aml_component/sr_detector.py/0
{ "file_path": "anomalydetector/aml_component/sr_detector.py", "repo_id": "anomalydetector", "token_count": 1091 }
340
""" Copyright (C) Microsoft Corporation. All rights reserved.​ ​ Microsoft Corporation ("Microsoft") grants you a nonexclusive, perpetual, royalty-free right to use, copy, and modify the software code provided by us ("Software Code"). You may not sublicense the Software Code or any use of it (except to your affiliates...
anomalydetector/srcnn/evalue.py/0
{ "file_path": "anomalydetector/srcnn/evalue.py", "repo_id": "anomalydetector", "token_count": 3083 }
341
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import logging import os import sys from logging import Filter, Formatter, Logger, LogRecord, StreamHandler from logging.handlers import TimedRotatingFileHandler FORMATTER = Formatter("%(asctime)s - %(name)s — %(levelname)s — %(message)s") LOG_F...
archai/archai/common/ordered_dict_logger_utils.py/0
{ "file_path": "archai/archai/common/ordered_dict_logger_utils.py", "repo_id": "archai", "token_count": 885 }
342
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from typing import Callable, Optional from overrides import overrides from torch.utils.data import Dataset from torchvision.datasets import ImageFolder from torchvision.transforms import ToTensor from archai.api.dataset_provider import DatasetP...
archai/archai/datasets/cv/image_folder_dataset_provider.py/0
{ "file_path": "archai/archai/datasets/cv/image_folder_dataset_provider.py", "repo_id": "archai", "token_count": 936 }
343
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import random from itertools import chain from typing import Any, Callable, Dict, List, Optional, Union import numpy as np from datasets.arrow_dataset import Dataset from datasets.dataset_dict import DatasetDict, IterableDatasetDict from dataset...
archai/archai/datasets/nlp/hf_dataset_provider_utils.py/0
{ "file_path": "archai/archai/datasets/nlp/hf_dataset_provider_utils.py", "repo_id": "archai", "token_count": 3433 }
344
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import random from pathlib import Path from typing import List, Optional from overrides import overrides from tqdm import tqdm from archai.common.ordered_dict_logger import OrderedDictLogger from archai.discrete_search.api.archai_model import A...
archai/archai/discrete_search/algos/regularized_evolution.py/0
{ "file_path": "archai/archai/discrete_search/algos/regularized_evolution.py", "repo_id": "archai", "token_count": 3881 }
345
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import copy import pathlib import shutil import timeit from typing import Any, Dict, List, Optional import numpy as np import torch from onnxruntime import InferenceSession from overrides import overrides from archai.discrete_search.api.archai_...
archai/archai/discrete_search/evaluators/nlp/transformer_flex_latency.py/0
{ "file_path": "archai/archai/discrete_search/evaluators/nlp/transformer_flex_latency.py", "repo_id": "archai", "token_count": 2384 }
346
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from archai.discrete_search.search_spaces.config.arch_config import ArchConfig from archai.discrete_search.search_spaces.config.arch_param_tree import ArchParamTree from archai.discrete_search.search_spaces.config.discrete_choice import DiscreteC...
archai/archai/discrete_search/search_spaces/config/__init__.py/0
{ "file_path": "archai/archai/discrete_search/search_spaces/config/__init__.py", "repo_id": "archai", "token_count": 139 }
347
from typing import Optional import torch import torch.nn as nn from torch import Tensor from transformers import PretrainedConfig from archai.discrete_search.search_spaces.config import ArchConfig try: from flash_attn.modules.mlp import FusedMLP except ImportError: FusedMLP = None from ...utils import get_op...
archai/archai/discrete_search/search_spaces/nlp/tfpp/backbones/codegen/block.py/0
{ "file_path": "archai/archai/discrete_search/search_spaces/nlp/tfpp/backbones/codegen/block.py", "repo_id": "archai", "token_count": 1308 }
348
''' Modified from https://github.com/HazyResearch/flash-attention/ ''' import math from warnings import warn from typing import Tuple, Optional import torch import torch.nn as nn import torch.nn.functional as F from transformers import PretrainedConfig from einops import rearrange try: from flash_attn.ops.fused_...
archai/archai/discrete_search/search_spaces/nlp/tfpp/ops/mha.py/0
{ "file_path": "archai/archai/discrete_search/search_spaces/nlp/tfpp/ops/mha.py", "repo_id": "archai", "token_count": 7395 }
349
from typing import Any, Dict, Union, List, Tuple from itertools import chain, product import os import json import yaml import warnings from transformers import PretrainedConfig import numpy as np import torch try: from yaml import CLoader as Loader except ImportError: from yaml import Loader def get_optim...
archai/archai/discrete_search/search_spaces/nlp/tfpp/utils.py/0
{ "file_path": "archai/archai/discrete_search/search_spaces/nlp/tfpp/utils.py", "repo_id": "archai", "token_count": 1900 }
350
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from typing import Any, Dict, List import numpy as np from archai.discrete_search.api.archai_model import ArchaiModel from archai.discrete_search.api.search_objectives import SearchObjectives def get_pareto_frontier( models: List[ArchaiMo...
archai/archai/discrete_search/utils/multi_objective.py/0
{ "file_path": "archai/archai/discrete_search/utils/multi_objective.py", "repo_id": "archai", "token_count": 2700 }
351
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from __future__ import annotations from typing import Any, Dict, Optional import torch from torch.nn import functional as F from archai.quantization.quantizers import FakeDynamicQuant class FakeQuantEmbedding(torch.nn.Embedding): """Tran...
archai/archai/quantization/modules.py/0
{ "file_path": "archai/archai/quantization/modules.py", "repo_id": "archai", "token_count": 4841 }
352
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from typing import Iterator, Optional, Tuple import torch import torch.nn.functional as F from overrides import overrides from torch import nn from archai.common.utils import zip_eq from archai.supergraph.nas.arch_params import ArchParams from ...
archai/archai/supergraph/algos/darts/mixed_op.py/0
{ "file_path": "archai/archai/supergraph/algos/darts/mixed_op.py", "repo_id": "archai", "token_count": 1335 }
353
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from overrides import overrides from archai.supergraph.algos.gumbelsoftmax.gs_arch_trainer import GsArchTrainer from archai.supergraph.algos.gumbelsoftmax.gs_finalizers import GsFinalizers from archai.supergraph.algos.gumbelsoftmax.gs_model_desc...
archai/archai/supergraph/algos/gumbelsoftmax/gs_exp_runner.py/0
{ "file_path": "archai/archai/supergraph/algos/gumbelsoftmax/gs_exp_runner.py", "repo_id": "archai", "token_count": 300 }
354
import copy from typing import List import numpy as np def prune(model_matrix:np.ndarray, vertex_ops:List[str]): """Prune the extraneous parts of the graph. General procedure: 1) Remove parts of graph not connected to input. 2) Remove parts of graph not connected to output. 3) Reorde...
archai/archai/supergraph/algos/nasbench101/model_matrix.py/0
{ "file_path": "archai/archai/supergraph/algos/nasbench101/model_matrix.py", "repo_id": "archai", "token_count": 1097 }
355
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import copy import random from typing import List, Optional, Tuple from overrides import overrides from archai.common.config import Config from archai.supergraph.nas.model_desc import ( AuxTowerDesc, CellDesc, CellType, ConvMacr...
archai/archai/supergraph/algos/random/random_model_desc_builder.py/0
{ "file_path": "archai/archai/supergraph/algos/random/random_model_desc_builder.py", "repo_id": "archai", "token_count": 1525 }
356
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import torchvision from overrides import overrides from torchvision.transforms import transforms from archai.common import utils from archai.common.config import Config from archai.supergraph.datasets.dataset_provider import ( DatasetProvide...
archai/archai/supergraph/datasets/providers/cifar100_provider.py/0
{ "file_path": "archai/archai/supergraph/datasets/providers/cifar100_provider.py", "repo_id": "archai", "token_count": 745 }
357
import os from collections import namedtuple import torch import torch.nn as nn import torch.nn.functional as F __all__ = ['GoogLeNet', 'googlenet'] _GoogLeNetOuputs = namedtuple('GoogLeNetOuputs', ['logits', 'aux_logits2', 'aux_logits1']) def googlenet(pretrained=False, progress=True, device='cpu', **kwargs): ...
archai/archai/supergraph/models/googlenet.py/0
{ "file_path": "archai/archai/supergraph/models/googlenet.py", "repo_id": "archai", "token_count": 4034 }
358
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from collections import UserDict from typing import Iterable, Iterator, Optional, Tuple, Union from torch import nn _param_suffix = '_arch_param' # all arch parameter names must have this suffix NNTypes = Union[nn.Parameter, nn.ParameterDict, ...
archai/archai/supergraph/nas/arch_params.py/0
{ "file_path": "archai/archai/supergraph/nas/arch_params.py", "repo_id": "archai", "token_count": 1336 }
359
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from typing import Optional import torch import torch.nn.functional as F from torch.nn.modules.loss import _WeightedLoss class SmoothCrossEntropyLoss(_WeightedLoss): """Cross entropy loss with label smoothing support.""" def __init__(...
archai/archai/trainers/losses.py/0
{ "file_path": "archai/archai/trainers/losses.py", "repo_id": "archai", "token_count": 876 }
360
dataset: name: imagenet autoaug: model: type: resnet200 loader: aug: fa_reduced_imagenet cutout: 0 batch: 256 epochs: 270 lr_schedule: type: 'resnet' warmup: multiplier: 2 epochs: 3 optimizer: type: sgd lr: 0.05 nesterov: True decay: 0.0001 clip: 0
archai/confs/aug/resnet200_b256.yaml/0
{ "file_path": "archai/confs/aug/resnet200_b256.yaml", "repo_id": "archai", "token_count": 163 }
361
name: nas-env channels: - conda-forge dependencies: - python=3.10 - pip - pip: - "archai[cv,nlp] @ git+https://github.com/microsoft/archai.git"
archai/docs/advanced_guide/cloud/azure/notebooks/quickstart/conda.yaml/0
{ "file_path": "archai/docs/advanced_guide/cloud/azure/notebooks/quickstart/conda.yaml", "repo_id": "archai", "token_count": 67 }
362
<jupyter_start><jupyter_text>Training NLP-based Models with Hugging FaceTraining an NLP-based model involves several steps, including loading the data, encoding the data, defining the model architecture, and conducting the actual training process.Archai implements abstract base classes that defines the expected behavio...
archai/docs/getting_started/notebooks/nlp/hf_trainer.ipynb/0
{ "file_path": "archai/docs/getting_started/notebooks/nlp/hf_trainer.ipynb", "repo_id": "archai", "token_count": 1305 }
363
Natural Language Processing =========================== .. toctree:: :maxdepth: 2 archai.datasets.nlp.tokenizer_utils Hugging Face ------------ Dataset Provider ^^^^^^^^^^^^^^^^ .. automodule:: archai.datasets.nlp.hf_dataset_provider :members: :undoc-members: Dataset Provider (Utilities) ^^^^^^^^^^^^^...
archai/docs/reference/api/archai.datasets.nlp.rst/0
{ "file_path": "archai/docs/reference/api/archai.datasets.nlp.rst", "repo_id": "archai", "token_count": 458 }
364
Transformer++ ============= Backbones ^^^^^^^^^ CodeGen ------- .. automodule:: archai.discrete_search.search_spaces.nlp.tfpp.backbones.codegen.block :members: :undoc-members: .. automodule:: archai.discrete_search.search_spaces.nlp.tfpp.backbones.codegen.model :members: :undoc-members: Operators ^^^^^...
archai/docs/reference/api/archai.discrete_search.search_spaces.nlp.tfpp.rst/0
{ "file_path": "archai/docs/reference/api/archai.discrete_search.search_spaces.nlp.tfpp.rst", "repo_id": "archai", "token_count": 847 }
365
Random ====== Experiment Runner ----------------- .. automodule:: archai.supergraph.algos.random.random_exp_runner :members: :undoc-members: Model Description Builder ------------------------- .. automodule:: archai.supergraph.algos.random.random_model_desc_builder :members: :undoc-members:
archai/docs/reference/api/archai.supergraph.algos.random.rst/0
{ "file_path": "archai/docs/reference/api/archai.supergraph.algos.random.rst", "repo_id": "archai", "token_count": 98 }
366
Copyright ========= This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusio...
archai/docs/support/copyright.rst/0
{ "file_path": "archai/docs/support/copyright.rst", "repo_id": "archai", "token_count": 586 }
367
from archai.common.config import Config def get_dataroot() -> str: conf = Config(config_filepath="confs/algos/manual.yaml") return conf["dataset"]["dataroot"]
archai/scripts/supergraph/download_datasets/dataset_utils.py/0
{ "file_path": "archai/scripts/supergraph/download_datasets/dataset_utils.py", "repo_id": "archai", "token_count": 64 }
368
import argparse import math import os import time from typing import List, Mapping, Optional, Tuple import numpy as np import torch import torchvision import torchvision.transforms as transforms import yaml from torch import nn from torch.nn.modules.loss import _Loss from torch.optim.lr_scheduler import _LRScheduler f...
archai/scripts/supergraph/nasbench101/nasbench101_var.py/0
{ "file_path": "archai/scripts/supergraph/nasbench101/nasbench101_var.py", "repo_id": "archai", "token_count": 5657 }
369
# Experiment: {exp_name} Job count: {job_count} {summary_text}
archai/scripts/supergraph/reports/summary.md/0
{ "file_path": "archai/scripts/supergraph/reports/summary.md", "repo_id": "archai", "token_count": 25 }
370
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import argparse import os import sys import uuid from archai.common.store import ArchaiStore CONNECTION_NAME = 'MODEL_STORAGE_CONNECTION_STRING' USAGE_TABLE_NAME = 'USAGE_TABLE_NAME' USAGE_TABLE = 'usage' CONNECTION_STRING = '' def get_all_us...
archai/tasks/face_segmentation/aml/azure/usage.py/0
{ "file_path": "archai/tasks/face_segmentation/aml/azure/usage.py", "repo_id": "archai", "token_count": 671 }
371
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import argparse from onnxruntime import InferenceSession, get_available_providers import os import numpy as np import cv2 import sys import tqdm from create_data import DataGenerator def test_onnx(dataset_dir, model, out_dir, test_size=1000, sho...
archai/tasks/face_segmentation/aml/snpe/test_onnx.py/0
{ "file_path": "archai/tasks/face_segmentation/aml/snpe/test_onnx.py", "repo_id": "archai", "token_count": 1734 }
372
from pathlib import Path from typing import Optional from overrides import overrides from pytorch_lightning import Trainer from torch.utils.data import DataLoader from archai.discrete_search.api import ModelEvaluator, DatasetProvider, ArchaiModel from .pl_trainer import SegmentationTrainingLoop class PartialTrainin...
archai/tasks/face_segmentation/training/partial_training_evaluator.py/0
{ "file_path": "archai/tasks/face_segmentation/training/partial_training_evaluator.py", "repo_id": "archai", "token_count": 912 }
373
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import math from typing import Tuple import cv2 import numpy as np import torch from torch import Tensor from torchvision.transforms import Compose, ToTensor from torchvision.transforms import functional as F class Sample: """A sample of ...
archai/tasks/facial_landmark_detection/transforms.py/0
{ "file_path": "archai/tasks/facial_landmark_detection/transforms.py", "repo_id": "archai", "token_count": 1923 }
374
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import warnings from archai.common.deprecation_utils import deprecated def test_deprecated_decorator(): def my_func(): pass def my_func2(): pass def my_func3(): pass def my_func4(): pass ...
archai/tests/common/test_deprecation_utils.py/0
{ "file_path": "archai/tests/common/test_deprecation_utils.py", "repo_id": "archai", "token_count": 865 }
375
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. from random import Random import pytest from archai.discrete_search.api.search_objectives import SearchObjectives from archai.discrete_search.evaluators.functional import EvaluationFunction @pytest.fixture def search_objectives(): rng1 = ...
archai/tests/discrete_search/algos/fixtures/objectives.py/0
{ "file_path": "archai/tests/discrete_search/algos/fixtures/objectives.py", "repo_id": "archai", "token_count": 291 }
376
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import pytest from torch import nn from torch.nn import functional as F from archai.discrete_search.api.archai_model import ArchaiModel from archai.discrete_search.evaluators.pt_profiler import TorchNumParameters from archai.discrete_search.eval...
archai/tests/discrete_search/evaluators/nlp/test_parameters.py/0
{ "file_path": "archai/tests/discrete_search/evaluators/nlp/test_parameters.py", "repo_id": "archai", "token_count": 977 }
377
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import pytest import torch from transformers import PretrainedConfig from archai.onnx.config_utils.onnx_config_base import OnnxConfig, OnnxConfigWithPast @pytest.fixture def dummy_config(): class DummyConfig(PretrainedConfig): max_...
archai/tests/onnx/config_utils/test_onnx_config_base.py/0
{ "file_path": "archai/tests/onnx/config_utils/test_onnx_config_base.py", "repo_id": "archai", "token_count": 1704 }
378
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import unittest from copy import deepcopy from typing import Callable, List, Tuple import numpy as np from tqdm import tqdm import archai.supergraph.algos.divnas.analyse_activations as aa from archai.supergraph.algos.divnas.analyse_activations ...
archai/tests/supergraph/test_divnas.py/0
{ "file_path": "archai/tests/supergraph/test_divnas.py", "repo_id": "archai", "token_count": 4502 }
379
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import torch from archai.trainers.losses import SmoothCrossEntropyLoss def test_smooth_cross_entropy_loss(): inputs = torch.randn(3, 5) targets = torch.tensor([1, 2, 3]) # Assert that the loss is reduced correctly (mean) loss_...
archai/tests/trainers/test_losses.py/0
{ "file_path": "archai/tests/trainers/test_losses.py", "repo_id": "archai", "token_count": 392 }
380
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/released/task/__init__.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/released/task/__init__.py", "repo_id": "azure-devops-python-api", "token_count": 395 }
381
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/released/work/__init__.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/released/work/__init__.py", "repo_id": "azure-devops-python-api", "token_count": 880 }
382
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_0/build/build_client.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_0/build/build_client.py", "repo_id": "azure-devops-python-api", "token_count": 57157 }
383
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_0/customer_intelligence/customer_intelligence_client.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_0/customer_intelligence/customer_intelligence_client.py", "repo_id": "azure-devops-python-api", "token_count": 504 }
384
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_0/feature_management/models.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_0/feature_management/models.py", "repo_id": "azure-devops-python-api", "token_count": 3539 }
385
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_0/graph/models.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_0/graph/models.py", "repo_id": "azure-devops-python-api", "token_count": 14047 }
386
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_0/pipelines_checks/models.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_0/pipelines_checks/models.py", "repo_id": "azure-devops-python-api", "token_count": 7870 }
387
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_0/provenance/provenance_client.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_0/provenance/provenance_client.py", "repo_id": "azure-devops-python-api", "token_count": 872 }
388
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_0/service_endpoint/__init__.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_0/service_endpoint/__init__.py", "repo_id": "azure-devops-python-api", "token_count": 553 }
389
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_0/task_agent/task_agent_client.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_0/task_agent/task_agent_client.py", "repo_id": "azure-devops-python-api", "token_count": 29949 }
390
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_0/upack_api/__init__.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_0/upack_api/__init__.py", "repo_id": "azure-devops-python-api", "token_count": 216 }
391
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_0/work_item_tracking_process/models.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_0/work_item_tracking_process/models.py", "repo_id": "azure-devops-python-api", "token_count": 21780 }
392
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_1/cix/cix_client.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_1/cix/cix_client.py", "repo_id": "azure-devops-python-api", "token_count": 3011 }
393
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_1/dashboard/dashboard_client.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_1/dashboard/dashboard_client.py", "repo_id": "azure-devops-python-api", "token_count": 12710 }
394
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_1/feed/models.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_1/feed/models.py", "repo_id": "azure-devops-python-api", "token_count": 21924 }
395
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_1/identity/models.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_1/identity/models.py", "repo_id": "azure-devops-python-api", "token_count": 11205 }
396
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_1/nuget/__init__.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_1/nuget/__init__.py", "repo_id": "azure-devops-python-api", "token_count": 246 }
397
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_1/policy/models.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_1/policy/models.py", "repo_id": "azure-devops-python-api", "token_count": 5377 }
398
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_1/py_pi_api/py_pi_api_client.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_1/py_pi_api/py_pi_api_client.py", "repo_id": "azure-devops-python-api", "token_count": 6933 }
399
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_1/service_hooks/__init__.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_1/service_hooks/__init__.py", "repo_id": "azure-devops-python-api", "token_count": 443 }
400
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_1/test/test_client.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_1/test/test_client.py", "repo_id": "azure-devops-python-api", "token_count": 30477 }
401
# -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # -------------------------------------------------------------------...
azure-devops-python-api/azure-devops/azure/devops/v7_1/work_item_tracking_process_template/models.py/0
{ "file_path": "azure-devops-python-api/azure-devops/azure/devops/v7_1/work_item_tracking_process_template/models.py", "repo_id": "azure-devops-python-api", "token_count": 3282 }
402
trigger: - main pr: - main schedules: - cron: "0 9 * * Sat" displayName: 'Build for Component Governance' branches: include: - main always: true jobs: - job: "Build_Azure_Quantum_Python" displayName: Build "azure-quantum" package pool: vmImage: 'windows-latest' steps: - task: UsePythonVe...
azure-quantum-python/.ado/ci.yml/0
{ "file_path": "azure-quantum-python/.ado/ci.yml", "repo_id": "azure-quantum-python", "token_count": 907 }
403
# ------------------------------------ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ import logging import sys from azure.core.exceptions import ClientAuthenticationError from azure.identity import CredentialUnavailableError from azure.core.credentials ...
azure-quantum-python/azure-quantum/azure/quantum/_authentication/_chained.py/0
{ "file_path": "azure-quantum-python/azure-quantum/azure/quantum/_authentication/_chained.py", "repo_id": "azure-quantum-python", "token_count": 2064 }
404
# Marker file for PEP 561.
azure-quantum-python/azure-quantum/azure/quantum/_client/py.typed/0
{ "file_path": "azure-quantum-python/azure-quantum/azure/quantum/_client/py.typed", "repo_id": "azure-quantum-python", "token_count": 10 }
405
## # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. ## import logging import time import json from typing import TYPE_CHECKING from azure.quantum._client.models import JobDetails from azure.quantum.job.job_failed_with_results_error import JobFailedWithResultsError from a...
azure-quantum-python/azure-quantum/azure/quantum/job/job.py/0
{ "file_path": "azure-quantum-python/azure-quantum/azure/quantum/job/job.py", "repo_id": "azure-quantum-python", "token_count": 2690 }
406