text stringlengths 5 22M | id stringlengths 12 177 | metadata dict | __index_level_0__ int64 0 1.37k |
|---|---|---|---|
MODEL_PATH=${1}
SAVE_PATH=${2}
GPU_NUM=16
python -m torch.distributed.launch --nproc_per_node ${GPU_NUM} verifier_multi_es.py --model_path ${MODEL_PATH} --output_dir ${SAVE_PATH}
#python verifier_multi_es.py --model_path ${MODEL_PATH} --output_dir ${SAVE_PATH}
| ContextualSP/logigan/pre-training/run_ver_es.sh/0 | {
"file_path": "ContextualSP/logigan/pre-training/run_ver_es.sh",
"repo_id": "ContextualSP",
"token_count": 105
} | 238 |
# coding=utf-8
import numpy as np
from collections import defaultdict
import re
from nltk.corpus import stopwords
from enum import Enum
from itertools import permutations
import re
import json
import random
from collections import OrderedDict
import pickle
# words = stopwords.words('english')
from collections import ... | ContextualSP/poset_decoding/preprocess_hierarchical_inference.py/0 | {
"file_path": "ContextualSP/poset_decoding/preprocess_hierarchical_inference.py",
"repo_id": "ContextualSP",
"token_count": 8130
} | 239 |
Contributing to MatchZoo-py
----------
> Note: MatchZoo-py is developed under Python 3.6.
Welcome! MatchZoo-py is a community project that aims to work for a wide range of NLP and IR tasks such as Question Answering, Information Retrieval, Paraphrase identification etc. Your experience and what you can contribute are... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/CONTRIBUTING.md/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/CONTRIBUTING.md",
"repo_id": "ContextualSP",
"token_count": 1136
} | 240 |
from .preparer import Preparer
from .prepare import prepare
| ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/auto/preparer/__init__.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/auto/preparer/__init__.py",
"repo_id": "ContextualSP",
"token_count": 15
} | 241 |
import matchzoo as mz
from matchzoo.dataloader import DataLoader
class DataLoaderBuilder(object):
"""
DataLoader Bulider. In essense a wrapped partial function.
Example:
>>> import matchzoo as mz
>>> padding_callback = mz.dataloader.callbacks.BasicPadding()
>>> builder = mz.datalo... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/dataloader/dataloader_builder.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/dataloader/dataloader_builder.py",
"repo_id": "ContextualSP",
"token_count": 541
} | 242 |
from .load_data import load_data
| ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/datasets/snli/__init__.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/datasets/snli/__init__.py",
"repo_id": "ContextualSP",
"token_count": 10
} | 243 |
"""Base task."""
import typing
import abc
import torch
from torch import nn
from matchzoo.engine import base_metric
from matchzoo.utils import parse_metric, parse_loss
class BaseTask(abc.ABC):
"""Base Task, shouldn't be used directly."""
TYPE = 'base'
def __init__(self, losses=None, metrics=None):
... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/engine/base_task.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/engine/base_task.py",
"repo_id": "ContextualSP",
"token_count": 1188
} | 244 |
"""Matching Tensor module."""
import typing
import torch
import torch.nn as nn
import torch.nn.functional as F
class MatchingTensor(nn.Module):
"""
Module that captures the basic interactions between two tensors.
:param matching_dims: Word dimension of two interaction texts.
:param channels: Number ... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/modules/matching_tensor.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/modules/matching_tensor.py",
"repo_id": "ContextualSP",
"token_count": 1024
} | 245 |
import nltk
from .unit import Unit
class Lemmatization(Unit):
"""Process unit for token lemmatization."""
def transform(self, input_: list) -> list:
"""
Lemmatization a sequence of tokens.
:param input_: list of tokens to be lemmatized.
:return tokens: list of lemmatizd tok... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/lemmatization.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/lemmatization.py",
"repo_id": "ContextualSP",
"token_count": 187
} | 246 |
"""Ranking task."""
from matchzoo.engine import base_task
class Ranking(base_task.BaseTask):
"""Ranking Task.
Examples:
>>> ranking_task = Ranking()
>>> ranking_task.metrics = ['map', 'ndcg']
>>> ranking_task.output_shape
(1,)
>>> ranking_task.output_dtype
<cl... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/tasks/ranking.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/tasks/ranking.py",
"repo_id": "ContextualSP",
"token_count": 443
} | 247 |
import os
import shutil
from pathlib import Path
import matchzoo
from matchzoo import utils
from matchzoo.engine.base_model import BaseModel
def test_timer():
timer = utils.Timer()
start = timer.time
timer.stop()
assert timer.time
timer.resume()
assert timer.time > start
def test_list_recur... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/test_utils.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/test_utils.py",
"repo_id": "ContextualSP",
"token_count": 862
} | 248 |
#!/usr/bin/env bash
export model_file=checkpoints_sparc/sparc_concat_none_model
export validation_file=dataset_sparc/dev.json
export validation_out_file=dataset_sparc/dev.jsonl
export prediction_out_file=predict.jsonl
python postprocess.py --valid_file ${validation_file} --valid_out_file ${validation_out_file}
allennlp... | ContextualSP/semantic_parsing_in_context/bash_files/linux/predict.bash/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/bash_files/linux/predict.bash",
"repo_id": "ContextualSP",
"token_count": 234
} | 249 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import logging
from typing import List, Union, Optional
from context.db_context import SparcDBContext
from context.copy_production_rule_field import CopyProductionRule
from typing import Dict
import copy
from context.grammar import A, C, T, Keywo... | ContextualSP/semantic_parsing_in_context/models/states_machine/condition_state_let.py/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/models/states_machine/condition_state_let.py",
"repo_id": "ContextualSP",
"token_count": 3650
} | 250 |
# Copyright (c) Facebook, Inc. and Microsoft Corporation.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import logging
from typing import Dict, List
import torch
from genre.utils import chunk_it
from transformers import... | ContextualSP/unified_parser_text_to_sql/genre/hf_model.py/0 | {
"file_path": "ContextualSP/unified_parser_text_to_sql/genre/hf_model.py",
"repo_id": "ContextualSP",
"token_count": 936
} | 251 |
"""
Based on https://github.com/ryanzhumich/editsql/blob/master/preprocess.py
"""
import argparse
import json
import os
import re
import stanza
import sqlparse
from tqdm import tqdm
from semparse.contexts.spider_db_context import SpiderDBContext
from semparse.sql.spider_utils import disambiguate_items, fix_number_valu... | ContextualSP/unified_parser_text_to_sql/step1_schema_linking.py/0 | {
"file_path": "ContextualSP/unified_parser_text_to_sql/step1_schema_linking.py",
"repo_id": "ContextualSP",
"token_count": 10676
} | 252 |
"""
Based on https://github.com/ElementAI/Unisar/blob/master/Unisar/api.py
"""
import os
import subprocess
from typing import Optional
import torch
from genre.fairseq_model import GENRE
from semparse.contexts.spider_db_context import SpiderDBContext
from semparse.sql.spider import load_original_schemas, load_tables
f... | ContextualSP/unified_parser_text_to_sql/unisar/api.py/0 | {
"file_path": "ContextualSP/unified_parser_text_to_sql/unisar/api.py",
"repo_id": "ContextualSP",
"token_count": 2320
} | 253 |
import random
import numpy as np
import time
import torch
import torch.backends.cudnn as cudnn
from pathlib import Path
from lib.datasets import build_dataset
from lib import utils
from supernet_engine import evaluate
from model.supernet_transformer import Vision_TransformerSuper
import argparse
import os
import yaml... | Cream/AutoFormer/evolution.py/0 | {
"file_path": "Cream/AutoFormer/evolution.py",
"repo_id": "Cream",
"token_count": 11718
} | 254 |
import torch
import torch.nn as nn
import torch.nn.functional as F
class LayerNormSuper(torch.nn.LayerNorm):
def __init__(self, super_embed_dim):
super().__init__(super_embed_dim)
# the largest embed dim
self.super_embed_dim = super_embed_dim
# the current sampled embed dim
... | Cream/AutoFormer/model/module/layernorm_super.py/0 | {
"file_path": "Cream/AutoFormer/model/module/layernorm_super.py",
"repo_id": "Cream",
"token_count": 607
} | 255 |
""" Search cell """
import _init_paths
import os
import torch
import json
import numpy as np
import lib.utils.genotypes as gt
from tensorboardX import SummaryWriter
from lib.models.model_test import ModelTest
from lib.utils import utils
from lib.config import AugmentConfig
from lib.core.augment_function import validat... | Cream/CDARTS/CDARTS/test.py/0 | {
"file_path": "Cream/CDARTS/CDARTS/test.py",
"repo_id": "Cream",
"token_count": 1266
} | 256 |
from six.moves import cPickle as pickle
from .base import BaseFileHandler
class PickleHandler(BaseFileHandler):
def load_from_fileobj(self, file, **kwargs):
return pickle.load(file, **kwargs)
def load_from_path(self, filepath, **kwargs):
return super(PickleHandler, self).load_from_path(
... | Cream/CDARTS/CDARTS_detection/mmcv/fileio/handlers/pickle_handler.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/fileio/handlers/pickle_handler.py",
"repo_id": "Cream",
"token_count": 331
} | 257 |
from torch.nn.parallel import DataParallel
from .scatter_gather import scatter_kwargs
class MMDataParallel(DataParallel):
def scatter(self, inputs, kwargs, device_ids):
return scatter_kwargs(inputs, kwargs, device_ids, dim=self.dim)
| Cream/CDARTS/CDARTS_detection/mmcv/parallel/data_parallel.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/parallel/data_parallel.py",
"repo_id": "Cream",
"token_count": 88
} | 258 |
from __future__ import division
from math import cos, pi
from .hook import Hook
class LrUpdaterHook(Hook):
def __init__(self,
by_epoch=True,
warmup=None,
warmup_iters=0,
warmup_ratio=0.1,
**kwargs):
# validate the "warm... | Cream/CDARTS/CDARTS_detection/mmcv/runner/hooks/lr_updater.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/runner/hooks/lr_updater.py",
"repo_id": "Cream",
"token_count": 3057
} | 259 |
from .io import Cache, VideoReader, frames2video
from .processing import convert_video, resize_video, cut_video, concat_video
from .optflow import (flowread, flowwrite, quantize_flow, dequantize_flow,
flow_warp)
__all__ = [
'Cache', 'VideoReader', 'frames2video', 'convert_video', 'resize_vide... | Cream/CDARTS/CDARTS_detection/mmcv/video/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/video/__init__.py",
"repo_id": "Cream",
"token_count": 168
} | 260 |
import torch
from .max_iou_assigner import MaxIoUAssigner
from ..geometry import bbox_overlaps
class ApproxMaxIoUAssigner(MaxIoUAssigner):
"""Assign a corresponding gt bbox or background to each bbox.
Each proposals will be assigned with `-1`, `0`, or a positive integer
indicating the ground truth index... | Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/assigners/approx_max_iou_assigner.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/assigners/approx_max_iou_assigner.py",
"repo_id": "Cream",
"token_count": 2455
} | 261 |
from .class_names import (coco_classes, dataset_aliases, get_classes,
imagenet_det_classes, imagenet_vid_classes,
voc_classes)
from .eval_hooks import DistEvalHook
from .mean_ap import average_precision, eval_map, print_map_summary
from .recall import (eval_recalls, p... | Cream/CDARTS/CDARTS_detection/mmdet/core/evaluation/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/evaluation/__init__.py",
"repo_id": "Cream",
"token_count": 306
} | 262 |
import torch
import numpy as np
from mmdet.ops import nms
from ..bbox import bbox_mapping_back
def merge_aug_proposals(aug_proposals, img_metas, rpn_test_cfg):
"""Merge augmented proposals (multiscale, flip, etc.)
Args:
aug_proposals (list[Tensor]): proposals from different testing
sche... | Cream/CDARTS/CDARTS_detection/mmdet/core/post_processing/merge_augs.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/post_processing/merge_augs.py",
"repo_id": "Cream",
"token_count": 1476
} | 263 |
import os.path as osp
import warnings
import mmcv
import numpy as np
import pycocotools.mask as maskUtils
from ..registry import PIPELINES
@PIPELINES.register_module
class LoadImageFromFile(object):
def __init__(self, to_float32=False):
self.to_float32 = to_float32
def __call__(self, results):
... | Cream/CDARTS/CDARTS_detection/mmdet/datasets/pipelines/loading.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/datasets/pipelines/loading.py",
"repo_id": "Cream",
"token_count": 2656
} | 264 |
import numpy as np
import torch.nn as nn
from mmcv.cnn import normal_init
from .anchor_head import AnchorHead
from ..registry import HEADS
from ..utils import bias_init_with_prob, ConvModule
from ..bbox_heads.auto_head.build_head import build_search_head
@HEADS.register_module
class RetinaHead(AnchorHead):
def... | Cream/CDARTS/CDARTS_detection/mmdet/models/anchor_heads/retina_head.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/anchor_heads/retina_head.py",
"repo_id": "Cream",
"token_count": 2445
} | 265 |
import torch
import torch.nn as nn
from torch.nn import functional as F
from timm.models import resume_checkpoint
from .builder import *
from ..registry import BACKBONES
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_INCEPT... | Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/mobilenetv3.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/mobilenetv3.py",
"repo_id": "Cream",
"token_count": 8351
} | 266 |
from __future__ import division
import torch
import torch.nn as nn
from .base import BaseDetector
from .test_mixins import RPNTestMixin
from .. import builder
from ..registry import DETECTORS
from mmdet.core import (build_assigner, bbox2roi, bbox2result, build_sampler,
merge_aug_masks)
@DETE... | Cream/CDARTS/CDARTS_detection/mmdet/models/detectors/cascade_rcnn.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/detectors/cascade_rcnn.py",
"repo_id": "Cream",
"token_count": 9343
} | 267 |
import numpy as np
import torch
import torch.nn as nn
from .utils import weighted_loss
from ..registry import LOSSES
@weighted_loss
def balanced_l1_loss(pred,
target,
beta=1.0,
alpha=0.5,
gamma=1.5,
reduction='me... | Cream/CDARTS/CDARTS_detection/mmdet/models/losses/balanced_l1_loss.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/losses/balanced_l1_loss.py",
"repo_id": "Cream",
"token_count": 1001
} | 268 |
# --------------------------------------------------------
# Copyright (c) 2019 Jianyuan Guo (guojianyuan1@huawei.com)
# --------------------------------------------------------
# from .darts_neck_search import DartsNeck
from .hit_neck_search import HitNeck
def build_search_neck(cfg):
"""Build neck model from co... | Cream/CDARTS/CDARTS_detection/mmdet/models/necks/auto_neck/build_neck.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/necks/auto_neck/build_neck.py",
"repo_id": "Cream",
"token_count": 287
} | 269 |
import logging
import torch.nn as nn
from mmcv.cnn import constant_init, kaiming_init
from mmcv.runner import load_checkpoint
from mmdet.core import auto_fp16
from ..backbones import ResNet, make_res_layer
from ..registry import SHARED_HEADS
@SHARED_HEADS.register_module
class ResLayer(nn.Module):
def __init__... | Cream/CDARTS/CDARTS_detection/mmdet/models/shared_heads/res_layer.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/shared_heads/res_layer.py",
"repo_id": "Cream",
"token_count": 1165
} | 270 |
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
setup(
name='deform_conv',
ext_modules=[
CUDAExtension('deform_conv_cuda', [
'src/deform_conv_cuda.cpp',
'src/deform_conv_cuda_kernel.cu',
]),
CUDAExtension(
... | Cream/CDARTS/CDARTS_detection/mmdet/ops/dcn/setup.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/dcn/setup.py",
"repo_id": "Cream",
"token_count": 229
} | 271 |
import numpy as np
import torch
from . import nms_cuda, nms_cpu
from .soft_nms_cpu import soft_nms_cpu
def nms(dets, iou_thr, device_id=None):
"""Dispatch to either CPU or GPU NMS implementations.
The input can be either a torch tensor or numpy array. GPU NMS will be used
if the input is a gpu tensor or... | Cream/CDARTS/CDARTS_detection/mmdet/ops/nms/nms_wrapper.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/nms/nms_wrapper.py",
"repo_id": "Cream",
"token_count": 1208
} | 272 |
#include <ATen/ATen.h>
#include <THC/THCAtomics.cuh>
#define CUDA_1D_KERNEL_LOOP(i, n) \
for (int i = blockIdx.x * blockDim.x + threadIdx.x; i < n; \
i += blockDim.x * gridDim.x)
#define THREADS_PER_BLOCK 1024
inline int GET_BLOCKS(const int N) {
int optimal_block_num = (N + THR... | Cream/CDARTS/CDARTS_detection/mmdet/ops/roi_align/src/roi_align_kernel.cu/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/roi_align/src/roi_align_kernel.cu",
"repo_id": "Cream",
"token_count": 5579
} | 273 |
// modify from
// https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/maskrcnn_benchmark/csrc/SigmoidFocalLoss.h
#include <torch/extension.h>
at::Tensor SigmoidFocalLoss_forward_cuda(const at::Tensor &logits,
const at::Tensor &targets,
... | Cream/CDARTS/CDARTS_detection/mmdet/ops/sigmoid_focal_loss/src/sigmoid_focal_loss.cpp/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/sigmoid_focal_loss/src/sigmoid_focal_loss.cpp",
"repo_id": "Cream",
"token_count": 1138
} | 274 |
import argparse
from collections import OrderedDict
import mmcv
import torch
arch_settings = {50: (3, 4, 6, 3), 101: (3, 4, 23, 3)}
def convert_bn(blobs, state_dict, caffe_name, torch_name, converted_names):
# detectron replace bn with affine channel layer
state_dict[torch_name + '.bias'] = torch.from_numpy... | Cream/CDARTS/CDARTS_detection/tools/detectron2pytorch.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/tools/detectron2pytorch.py",
"repo_id": "Cream",
"token_count": 1966
} | 275 |
import numpy as np
import torch
from torch.utils.data import Dataset
from tqdm import trange
import os
from pycocotools.coco import COCO
from pycocotools import mask
from torchvision import transforms
from dataloaders import custom_transforms as tr
from PIL import Image, ImageFile
ImageFile.LOAD_TRUNCATED_IMAGES = True... | Cream/CDARTS/CDARTS_segmentation/dataloaders/datasets/coco.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/dataloaders/datasets/coco.py",
"repo_id": "Cream",
"token_count": 2863
} | 276 |
# ------------------------------------------------------------------------------
# Builds model.
# Written by Bowen Cheng (bcheng9@illinois.edu)
# ------------------------------------------------------------------------------
import torch
from .backbone import resnet, mobilenet, mnasnet, hrnet, xception
from .meta_ar... | Cream/CDARTS/CDARTS_segmentation/segmentation/model/build.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/model/build.py",
"repo_id": "Cream",
"token_count": 2938
} | 277 |
# ------------------------------------------------------------------------------
# Post-processing to get instance and panoptic segmentation results.
# Written by Bowen Cheng (bcheng9@illinois.edu)
# ------------------------------------------------------------------------------
import torch
import torch.nn.functional ... | Cream/CDARTS/CDARTS_segmentation/segmentation/model/post_processing/instance_post_processing.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/model/post_processing/instance_post_processing.py",
"repo_id": "Cream",
"token_count": 4375
} | 278 |
import os
import cv2
cv2.setNumThreads(0)
import torch
import numpy as np
from random import shuffle
import torch.utils.data as data
class BaseDataset(data.Dataset):
def __init__(self, setting, split_name, preprocess=None, file_length=None):
super(BaseDataset, self).__init__()
self._split_name = ... | Cream/CDARTS/CDARTS_segmentation/tools/datasets/BaseDataset.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/tools/datasets/BaseDataset.py",
"repo_id": "Cream",
"token_count": 2865
} | 279 |
#!/usr/bin/env python2
'''
Visualization demo for panoptic COCO sample_data
The code shows an example of color generation for panoptic data (with
"generate_new_colors" set to True). For each segment distinct color is used in
a way that it close to the color of corresponding semantic class.
'''
from __future__ import ab... | Cream/CDARTS/CDARTS_segmentation/tools/vis/vis_cityscapes.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/tools/vis/vis_cityscapes.py",
"repo_id": "Cream",
"token_count": 1590
} | 280 |
#!/usr/bin/env python3
# encoding: utf-8
import os
import cv2
cv2.setNumThreads(0)
import numpy as np
from utils.visualize import print_iou, show_img, show_prediction
from engine.evaluator import Evaluator
from engine.logger import get_logger
from seg_opr.metric import hist_info, compute_score
logger = get_logger()
... | Cream/CDARTS/CDARTS_segmentation/train/eval.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/train/eval.py",
"repo_id": "Cream",
"token_count": 1176
} | 281 |
import torch
import torch.nn as nn
__all__ = ['OPS', 'ResNetBasicblock', 'SearchSpaceNames']
OPS = {
'none' : lambda C_in, C_out, stride, affine, track_running_stats: Zero(C_in, C_out, stride),
'avg_pool_3x3' : lambda C_in, C_out, stride, affine, track_running_stats: POOLING(C_in, C_out, stride, 'avg', af... | Cream/CDARTS/benchmark201/models/ops.py/0 | {
"file_path": "Cream/CDARTS/benchmark201/models/ops.py",
"repo_id": "Cream",
"token_count": 3465
} | 282 |
from lib.utils.util import *
from timm.models.efficientnet_blocks import *
# ChildNet Builder definition.
class ChildNetBuilder:
def __init__(
self,
channel_multiplier=1.0,
channel_divisor=8,
channel_min=None,
output_stride=32,
pad_type='',
... | Cream/Cream/lib/models/builders/build_childnet.py/0 | {
"file_path": "Cream/Cream/lib/models/builders/build_childnet.py",
"repo_id": "Cream",
"token_count": 4048
} | 283 |
# model settings
model = dict(
type='CascadeRCNN',
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,
... | Cream/EfficientViT/downstream/configs/_base_/models/cascade_mask_rcnn_r50_fpn.py/0 | {
"file_path": "Cream/EfficientViT/downstream/configs/_base_/models/cascade_mask_rcnn_r50_fpn.py",
"repo_id": "Cream",
"token_count": 4560
} | 284 |
# model settings
model = dict(
type='RPN',
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,
styl... | Cream/EfficientViT/downstream/configs/_base_/models/rpn_r50_fpn.py/0 | {
"file_path": "Cream/EfficientViT/downstream/configs/_base_/models/rpn_r50_fpn.py",
"repo_id": "Cream",
"token_count": 1066
} | 285 |
from mmcv.runner import OptimizerHook, HOOKS
try:
import apex
except:
print('apex is not installed')
@HOOKS.register_module()
class DistOptimizerHook(OptimizerHook):
"""Optimizer hook for distributed training."""
def __init__(self, update_interval=1, grad_clip=None, coalesce=True, bucket_size_mb=-1, ... | Cream/EfficientViT/downstream/mmcv_custom/runner/optimizer.py/0 | {
"file_path": "Cream/EfficientViT/downstream/mmcv_custom/runner/optimizer.py",
"repo_id": "Cream",
"token_count": 513
} | 286 |
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as checkpoint
from timm.models.layers import DropPath, to_2tuple, trunc_normal_
class Mlp(nn.Module):
def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.):
super... | Cream/MiniViT/Mini-Swin/models/swin_mlp.py/0 | {
"file_path": "Cream/MiniViT/Mini-Swin/models/swin_mlp.py",
"repo_id": "Cream",
"token_count": 8733
} | 287 |
# TinyCLIP: CLIP Distillation via Affinity Mimicking and Weight Inheritance
:pushpin: This is an official PyTorch implementation of **[ICCV 2023]** - [TinyCLIP: CLIP Distillation via Affinity Mimicking and Weight Inheritance](https://openaccess.thecvf.com/content/ICCV2023/html/Wu_TinyCLIP_CLIP_Distillation_via_Affinit... | Cream/TinyCLIP/README.md/0 | {
"file_path": "Cream/TinyCLIP/README.md",
"repo_id": "Cream",
"token_count": 2293
} | 288 |
import requests
import os
import multiprocessing as mp
from io import BytesIO
import numpy as np
import PIL
from PIL import Image
import pickle
import sys
def grab(line):
"""
Download a single image from the TSV.
"""
uid, split, line = line
try:
caption, url = line.split("\t")[:2]
exce... | Cream/TinyCLIP/src/data/gather_cc.py/0 | {
"file_path": "Cream/TinyCLIP/src/data/gather_cc.py",
"repo_id": "Cream",
"token_count": 1321
} | 289 |
import logging
def setup_logging(log_file, level, include_host=False):
if include_host:
import socket
hostname = socket.gethostname()
formatter = logging.Formatter(
f'%(asctime)s | {hostname} | %(levelname)s | %(message)s', datefmt='%Y-%m-%d,%H:%M:%S')
else:
format... | Cream/TinyCLIP/src/training/logger.py/0 | {
"file_path": "Cream/TinyCLIP/src/training/logger.py",
"repo_id": "Cream",
"token_count": 413
} | 290 |
# Image Augmentation for TinyViT
The code is based on [timm.data](https://github.com/rwightman/pytorch-image-models/tree/master/timm/data) of [pytorch-image-models](https://github.com/rwightman/pytorch-image-models) written by [Ross Wightman](https://github.com/rwightman) and the contributors. Thanks a lot!
We adapt ... | Cream/TinyViT/data/augmentation/README.md/0 | {
"file_path": "Cream/TinyViT/data/augmentation/README.md",
"repo_id": "Cream",
"token_count": 282
} | 291 |
IMG_EXTENSIONS = ('.png', '.jpg', '.jpeg')
| Cream/TinyViT/data/augmentation/parsers/constants.py/0 | {
"file_path": "Cream/TinyViT/data/augmentation/parsers/constants.py",
"repo_id": "Cream",
"token_count": 19
} | 292 |
# Evaluation
Before evaluation, we need to prepare [the ImageNet-1k dataset](./PREPARATION.md) and [the checkpoints in model zoo](../README.md).
Run the following command for evaluation:
**Evaluate TinyViT with pretraining distillation**
<details>
<summary>Evaluate TinyViT-5M <img src="../.figure/distill.png"></sum... | Cream/TinyViT/docs/EVALUATION.md/0 | {
"file_path": "Cream/TinyViT/docs/EVALUATION.md",
"repo_id": "Cream",
"token_count": 1596
} | 293 |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from .detr import build
def build_model(args):
return build(args)
| Cream/iRPE/DETR-with-iRPE/models/__init__.py/0 | {
"file_path": "Cream/iRPE/DETR-with-iRPE/models/__init__.py",
"repo_id": "Cream",
"token_count": 42
} | 294 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from .cls_cvt import *
from .registry import *
from .build import build_model
| CvT/lib/models/__init__.py/0 | {
"file_path": "CvT/lib/models/__init__.py",
"repo_id": "CvT",
"token_count": 53
} | 295 |
"""
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/msanomalydetector/spectral_residual.py/0 | {
"file_path": "anomalydetector/msanomalydetector/spectral_residual.py",
"repo_id": "anomalydetector",
"token_count": 3693
} | 296 |
<h1 align="center">
<img src="https://user-images.githubusercontent.com/9354770/171523113-70c7214b-8298-4d7e-abd9-81f5788f6e19.png" alt="Archai logo" width="384px" />
<br />
</h1>
<div align="center">
<b>Archai</b> accelerates your Neural Architecture Search (NAS) through <b>fast</b>, <b>reproducible</b> and ... | archai/README.md/0 | {
"file_path": "archai/README.md",
"repo_id": "archai",
"token_count": 2036
} | 297 |
from typing import Callable, Tuple
import psutil
import os
import tracemalloc
import torch
from torch import profiler
from torch import nn
import gc
def model_memory(create_model:Callable[[], nn.Module])->Tuple[nn.Module, int]:
# returns model and memory occupied by the model in process
gc.collect()
# bas... | archai/archai/common/ml_perf_utils.py/0 | {
"file_path": "archai/archai/common/ml_perf_utils.py",
"repo_id": "archai",
"token_count": 730
} | 298 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import List
import torch
class Lighting:
"""Lighting transform."""
def __init__(self, std: float, eigval: List[float], eigvec: List[float]) -> None:
"""Initialize the lighting transform.
Args:
... | archai/archai/datasets/cv/transforms/lighting.py/0 | {
"file_path": "archai/archai/datasets/cv/transforms/lighting.py",
"repo_id": "archai",
"token_count": 512
} | 299 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from archai.discrete_search.evaluators.functional import EvaluationFunction
from archai.discrete_search.evaluators.onnx_model import AvgOnnxLatency
from archai.discrete_search.evaluators.progressive_training import (
ProgressiveTraining, RayP... | archai/archai/discrete_search/evaluators/__init__.py/0 | {
"file_path": "archai/archai/discrete_search/evaluators/__init__.py",
"repo_id": "archai",
"token_count": 264
} | 300 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import time
import datetime
import uuid
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any, Dict, List, Optional, Tuple, Union
import torch
from overrides import overrides
from archai.discrete_search.api.arch... | archai/archai/discrete_search/evaluators/remote_azure_benchmark.py/0 | {
"file_path": "archai/archai/discrete_search/evaluators/remote_azure_benchmark.py",
"repo_id": "archai",
"token_count": 4187
} | 301 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from functools import partial
from typing import Optional
import torch
from torch import nn
class NormalConvBlock(nn.Module):
"""Normal Convolutional Block with BatchNorm and ReLU."""
def __init__(
self,
in_channels: i... | archai/archai/discrete_search/search_spaces/cv/segmentation_dag/ops.py/0 | {
"file_path": "archai/archai/discrete_search/search_spaces/cv/segmentation_dag/ops.py",
"repo_id": "archai",
"token_count": 2558
} | 302 |
from typing import Optional, Tuple, Union
import torch
from torch import nn
from transformers.models.codegen.modeling_codegen import (
CodeGenConfig, fixed_pos_embedding, apply_rotary_pos_emb
)
from archai.discrete_search.search_spaces.config import ArchConfig
class CausalSelfAttention(nn.Module):
def __init... | archai/archai/discrete_search/search_spaces/nlp/tfpp/ops/causal_self_attn.py/0 | {
"file_path": "archai/archai/discrete_search/search_spaces/nlp/tfpp/ops/causal_self_attn.py",
"repo_id": "archai",
"token_count": 3028
} | 303 |
import math
import torch
import torch.nn.functional as F
from einops import rearrange
from .fftconv import fftconv_fwd, fftconv_bwd
@torch.jit.script
def _mul_sum(y, q):
return (y * q).sum(dim=1)
# reference convolution with residual connection
def fftconv_ref(u, k, D, dropout_mask, gelu=True, k_rev=None):
... | archai/archai/discrete_search/search_spaces/nlp/tfpp/ops/ssm_utils/ssm_ops/fftconv.py/0 | {
"file_path": "archai/archai/discrete_search/search_spaces/nlp/tfpp/ops/ssm_utils/ssm_ops/fftconv.py",
"repo_id": "archai",
"token_count": 2440
} | 304 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
#
# Copyright (c) 2018, NVIDIA CORPORATION.
# Licensed under the Apache License, Version 2.0.
from typing import Optional, Tuple, Union
import torch
import torch.nn as nn
import torch.nn.functional as F
class OptionalParameterList(nn.Parameter... | archai/archai/discrete_search/search_spaces/nlp/transformer_flex/models/mem_transformer_utils/projected_adaptive_log_softmax.py/0 | {
"file_path": "archai/archai/discrete_search/search_spaces/nlp/transformer_flex/models/mem_transformer_utils/projected_adaptive_log_softmax.py",
"repo_id": "archai",
"token_count": 5037
} | 305 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Optional
from onnx import load_model
from onnxruntime.transformers.onnx_model_gpt2 import Gpt2OnnxModel
from onnxruntime.transformers.optimizer import optimize_by_onnxruntime
from archai.common.file_utils import create_file_n... | archai/archai/onnx/optimization.py/0 | {
"file_path": "archai/archai/onnx/optimization.py",
"repo_id": "archai",
"token_count": 1615
} | 306 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
from typing import Dict, List
import matplotlib.pyplot as plt
import numpy as np
import torch
from overrides import overrides
from torch import nn
from archai.common.common import get_conf, get_expdir
from archai.common.ordered_dict_l... | archai/archai/supergraph/algos/divnas/divnas_rank_finalizer.py/0 | {
"file_path": "archai/archai/supergraph/algos/divnas/divnas_rank_finalizer.py",
"repo_id": "archai",
"token_count": 2988
} | 307 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from overrides import overrides
from archai.common.config import Config
from archai.supergraph.algos.petridish.petridish_op import PetridishOp, TempIdentityOp
from archai.supergraph.algos.random.random_model_desc_builder import (
RandomModel... | archai/archai/supergraph/algos/petridish/petridish_model_desc_builder.py/0 | {
"file_path": "archai/archai/supergraph/algos/petridish/petridish_model_desc_builder.py",
"repo_id": "archai",
"token_count": 1031
} | 308 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from abc import abstractmethod
from typing import Dict, Optional, Tuple, Union
from overrides import EnforceOverrides
from torch.utils.data.dataset import Dataset
from archai.common.config import Config
TrainTestDatasets = Tuple[Optional[Datas... | archai/archai/supergraph/datasets/dataset_provider.py/0 | {
"file_path": "archai/archai/supergraph/datasets/dataset_provider.py",
"repo_id": "archai",
"token_count": 457
} | 309 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
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 (
Dat... | archai/archai/supergraph/datasets/providers/sport8_provider.py/0 | {
"file_path": "archai/archai/supergraph/datasets/providers/sport8_provider.py",
"repo_id": "archai",
"token_count": 969
} | 310 |
# -*- coding: utf-8 -*-
import math
import torch.nn as nn
import torch.nn.functional as F
from archai.supergraph.models.shakeshake.shakeshake import ShakeShake, Shortcut
class ShakeBottleNeck(nn.Module):
def __init__(self, in_ch, mid_ch, out_ch, cardinary, stride=1):
super(ShakeBottleNeck, self).__ini... | archai/archai/supergraph/models/shakeshake/shake_resnext.py/0 | {
"file_path": "archai/archai/supergraph/models/shakeshake/shake_resnext.py",
"repo_id": "archai",
"token_count": 1608
} | 311 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Optional
import tensorwatch as tw
from archai.common.config import Config
from archai.common.ordered_dict_logger import get_global_logger
from archai.supergraph.nas.model import Model
from archai.supergraph.utils.checkpoint i... | archai/archai/supergraph/nas/nas_utils.py/0 | {
"file_path": "archai/archai/supergraph/nas/nas_utils.py",
"repo_id": "archai",
"token_count": 489
} | 312 |
# Copyright (c) @IssamLaradji.
# https://github.com/IssamLaradji/sls/blob/master/src/optimizers/others/cocob.py
import math
from typing import Any, Callable, Dict, Iterable, Optional, Union
import torch
from torch import optim
class CocobBackprop(optim.Optimizer):
"""Coin Betting optimizer with Backpropagation.... | archai/archai/trainers/coin_betting_optimizer.py/0 | {
"file_path": "archai/archai/trainers/coin_betting_optimizer.py",
"repo_id": "archai",
"token_count": 3794
} | 313 |
__include__: "darts.yaml" # defaults are loaded from this file
# XNAS's parameters
nas:
search:
xnas:
to_evict: True
loader:
train_batch: 64
trainer:
grad_clip: 1.0
epochs: 50
optimizer:
type: "sgd"
lr: 0.025
decay: 0.0
momentum: 0.0
n... | archai/confs/algos/xnas.yaml/0 | {
"file_path": "archai/confs/algos/xnas.yaml",
"repo_id": "archai",
"token_count": 281
} | 314 |
Azure
=====
This section contains examples of using Archai on Azure.
.. toctree::
:maxdepth: 2
Notebooks <azure/notebooks> | archai/docs/advanced_guide/cloud/azure.rst/0 | {
"file_path": "archai/docs/advanced_guide/cloud/azure.rst",
"repo_id": "archai",
"token_count": 45
} | 315 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from archai.datasets.cv.mnist_dataset_provider import MnistDatasetProvider
import torch
import pytorch_lightning as pl
class MNistDataModule(pl.LightningDataModule):
def __init__(self, path):
super().__init__()
self.root = pa... | archai/docs/advanced_guide/cloud/azure/notebooks/multi_node_search/scripts/mnist_data_module.py/0 | {
"file_path": "archai/docs/advanced_guide/cloud/azure/notebooks/multi_node_search/scripts/mnist_data_module.py",
"repo_id": "archai",
"token_count": 457
} | 316 |
<jupyter_start><jupyter_text>Task: Text GenerationIn this Notebook we run Archai's [Text Generation](https://github.com/microsoft/archai/tree/main/tasks/text_generation) task on Azure Machine Learning.We'll use the following components:1. [Search](./src/search.yaml) - Run Lightweight Transformer Search (LTS) to discove... | archai/docs/advanced_guide/cloud/azure/notebooks/text_generation/text_generation.ipynb/0 | {
"file_path": "archai/docs/advanced_guide/cloud/azure/notebooks/text_generation/text_generation.ipynb",
"repo_id": "archai",
"token_count": 3035
} | 317 |
Notebooks
=========
These notebooks are designed to help you understand the basics and gain hands-on experience in working with Archai.
.. toctree::
:maxdepth: 2
API <notebooks/api>
Discrete Search <notebooks/discrete_search>
Computer Vision <notebooks/cv>
Natural Language Processing <notebooks/nlp>
| archai/docs/getting_started/notebooks.rst/0 | {
"file_path": "archai/docs/getting_started/notebooks.rst",
"repo_id": "archai",
"token_count": 94
} | 318 |
<jupyter_start><jupyter_text>Discrete Search Spaces<jupyter_code>from typing import List, Optional
from overrides import overrides
import numpy as np
import torch
from torch import nn<jupyter_output><empty_output><jupyter_text>The `ArchaiModel` class The `ArchaiModel` class is a base class used to wrap all model objec... | archai/docs/getting_started/notebooks/discrete_search/search_space.ipynb/0 | {
"file_path": "archai/docs/getting_started/notebooks/discrete_search/search_space.ipynb",
"repo_id": "archai",
"token_count": 3742
} | 319 |
Discrete Search
===============
.. toctree::
:maxdepth: 2
archai.discrete_search.algos
archai.discrete_search.api
archai.discrete_search.evaluators
archai.discrete_search.predictors
archai.discrete_search.search_spaces
archai.discrete_search.utils
| archai/docs/reference/api/archai.discrete_search.rst/0 | {
"file_path": "archai/docs/reference/api/archai.discrete_search.rst",
"repo_id": "archai",
"token_count": 102
} | 320 |
DiDARTS
=======
Architecture Trainer
--------------------
.. automodule:: archai.supergraph.algos.didarts.didarts_arch_trainer
:members:
:undoc-members:
Experiment Runner
-----------------
.. automodule:: archai.supergraph.algos.didarts.didarts_exp_runner
:members:
:undoc-members:
| archai/docs/reference/api/archai.supergraph.algos.didarts.rst/0 | {
"file_path": "archai/docs/reference/api/archai.supergraph.algos.didarts.rst",
"repo_id": "archai",
"token_count": 105
} | 321 |
Computer Vision
===============
PyTorch-Lightning
-----------------
Trainer
^^^^^^^
.. automodule:: archai.trainers.cv.pl_trainer
:members:
:undoc-members:
| archai/docs/reference/api/archai.trainers.cv.rst/0 | {
"file_path": "archai/docs/reference/api/archai.trainers.cv.rst",
"repo_id": "archai",
"token_count": 59
} | 322 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import argparse
import torch
from transformers import AutoModelForCausalLM
from archai.common.file_utils import calculate_torch_model_size
from archai.quantization.ptq import dynamic_quantization_torch
def parse_args() -> argparse.Namespace:
... | archai/scripts/quantization/ptq_with_torch.py/0 | {
"file_path": "archai/scripts/quantization/ptq_with_torch.py",
"repo_id": "archai",
"token_count": 450
} | 323 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import argparse
from typing import Dict, Type
from archai.common import utils
from archai.common.ordered_dict_logger import get_global_logger
from archai.supergraph.algos.darts.darts_exp_runner import DartsExperimentRunner
from archai.supergraph... | archai/scripts/supergraph/main.py/0 | {
"file_path": "archai/scripts/supergraph/main.py",
"repo_id": "archai",
"token_count": 1539
} | 324 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import tensorwatch as tw
from archai.supergraph import models
model_names = ["resnet18", "resnet34", "resnet101", "densenet121"]
for model_name in model_names:
model = getattr(models, model_name)()
model_stats = tw.ModelStats(model, [1... | archai/scripts/supergraph/performance/model_stats.py/0 | {
"file_path": "archai/scripts/supergraph/performance/model_stats.py",
"repo_id": "archai",
"token_count": 175
} | 325 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import re
from setuptools import find_packages, setup
dependencies = [
"azure-ai-ml==1.5.0",
"azure-data-tables",
"azure-identity",
"azure-storage-blob",
"azureml-mlflow",
"datasets>=2.4.0",
"deepspeed",
... | archai/setup.py/0 | {
"file_path": "archai/setup.py",
"repo_id": "archai",
"token_count": 1971
} | 326 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import argparse
import os
import sys
import dateutil.parser
import datetime
from archai.common.store import ArchaiStore
CONNECTION_NAME = 'MODEL_STORAGE_CONNECTION_STRING'
def parse_date(date):
s = f"{date}".strip()
date = dateutil.pars... | archai/tasks/face_segmentation/aml/azure/report_device_usage.py/0 | {
"file_path": "archai/tasks/face_segmentation/aml/azure/report_device_usage.py",
"repo_id": "archai",
"token_count": 1774
} | 327 |
#!/bin/bash
MODEL_NAME="model"
if [ "$1" == "--help" ] ; then
echo "### Usage: convert_tf.sh [model_name]"
echo "Converts the given tensorflow model to .dlc then quantizes it."
echo "Default model path is 'model/model.pb'."
exit 1
fi
if [ "$1" != "" ]; then
MODEL_NAME=$1
fi
if [ ! -f "model/... | archai/tasks/face_segmentation/aml/snpe/convert_tf.sh/0 | {
"file_path": "archai/tasks/face_segmentation/aml/snpe/convert_tf.sh",
"repo_id": "archai",
"token_count": 400
} | 328 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import argparse
import cv2
import numpy as np
import os
import tqdm
import pandas as pd
import sys
import matplotlib.pyplot as plt
from sklearn.metrics import PrecisionRecallDisplay
from PIL import Image
# Check the outputs of the Mask C-RNN mode... | archai/tasks/face_segmentation/aml/vision/collect_metrics.py/0 | {
"file_path": "archai/tasks/face_segmentation/aml/vision/collect_metrics.py",
"repo_id": "archai",
"token_count": 5384
} | 329 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import argparse
import sys
from archai.discrete_search.api import ArchaiModel
from archai.common.config import Config
from archai.discrete_search.evaluators.remote_azure_benchmark import RemoteAzureBenchmarkEvaluator
from aml.util.setup import con... | archai/tasks/face_segmentation/snp_test.py/0 | {
"file_path": "archai/tasks/face_segmentation/snp_test.py",
"repo_id": "archai",
"token_count": 1342
} | 330 |
#
# Config file for NAS search - Debug run
#
# job args
seed: 0
num_jobs_per_gpu: 2
num_latency_measurements: 15
num_input_per_latency_measurement: 15
# search args
num_iters: 7
init_num_models: 32
num_random_mix: 32
num_crossovers: 8
mutations_per_parent: 4
max_unseen_population: 32
# Search space args
r_range: [1,... | archai/tasks/facial_landmark_detection/search_config.yaml/0 | {
"file_path": "archai/tasks/facial_landmark_detection/search_config.yaml",
"repo_id": "archai",
"token_count": 324
} | 331 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import shutil
from archai.datasets.nlp.fast_hf_dataset_provider import FastHfDatasetProvider
TEST_CACHE_DIR='test_fast_hf_dataset_cache'
def test_fast_hf_dataset_provider_from_hub():
dataset_provider = FastHfDatasetProvider.from_hub(
... | archai/tests/datasets/nlp/test_fast_hf_dataset_provider.py/0 | {
"file_path": "archai/tests/datasets/nlp/test_fast_hf_dataset_provider.py",
"repo_id": "archai",
"token_count": 642
} | 332 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import List, Optional
from unittest.mock import MagicMock
from overrides import overrides
from archai.api.dataset_provider import DatasetProvider
from archai.discrete_search.api.archai_model import ArchaiModel
from archai.discrete_s... | archai/tests/discrete_search/api/test_model_evaluator.py/0 | {
"file_path": "archai/tests/discrete_search/api/test_model_evaluator.py",
"repo_id": "archai",
"token_count": 615
} | 333 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import pytest
import torch
from archai.discrete_search.search_spaces.nlp.transformer_flex.models.configuration_gpt2_flex import (
GPT2FlexConfig,
)
from archai.discrete_search.search_spaces.nlp.transformer_flex.models.modeling_gpt2_flex impo... | archai/tests/discrete_search/search_spaces/nlp/transformer_flex/models/test_modeling_gpt2_flex.py/0 | {
"file_path": "archai/tests/discrete_search/search_spaces/nlp/transformer_flex/models/test_modeling_gpt2_flex.py",
"repo_id": "archai",
"token_count": 442
} | 334 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import pytest
import torch
from archai.quantization.modules import (
FakeDynamicQuant,
FakeDynamicQuantConv1d,
FakeDynamicQuantLinear,
FakeQuantEmbedding,
)
@pytest.fixture
def fake_quant_embedding():
return FakeQuantEmbedd... | archai/tests/quantization/test_modules.py/0 | {
"file_path": "archai/tests/quantization/test_modules.py",
"repo_id": "archai",
"token_count": 2523
} | 335 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
import tempfile
import torch
from transformers import GPT2Config, GPT2LMHeadModel
from archai.trainers.nlp.nvidia_trainer import save_checkpoint
def test_save_checkpoint():
output_dir = tempfile.mkdtemp()
model = GPT2LMHeadM... | archai/tests/trainers/nlp/test_nvidia_trainer.py/0 | {
"file_path": "archai/tests/trainers/nlp/test_nvidia_trainer.py",
"repo_id": "archai",
"token_count": 1049
} | 336 |
# --------------------------------------------------------------------------------------------
# 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/exceptions.py/0 | {
"file_path": "azure-devops-python-api/azure-devops/azure/devops/exceptions.py",
"repo_id": "azure-devops-python-api",
"token_count": 507
} | 337 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.