text stringlengths 5 22M | id stringlengths 12 177 | metadata dict | __index_level_0__ int64 0 1.37k |
|---|---|---|---|
# %%
import logging
import sys
sys.path.append("..")
from utils import *
from tqdm import tqdm
import argparse
from transformers import BertTokenizer
from typing import Dict, List, Tuple
from collections import defaultdict
import json
import os
bert_version = 'bert-large-uncased-whole-word-masking'
tokenizer: BertTok... | ContextualSP/awakening_latent_grounding/scripts/data_preprocess.grounding.py/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/scripts/data_preprocess.grounding.py",
"repo_id": "ContextualSP",
"token_count": 10319
} | 224 |
#!/usr/bin/env bash
wget https://obj.umiacs.umd.edu/elgohary/CANARD_Release.zip
unzip -j CANARD_Release.zip
rm -rf CANARD_Release.zip
python ../../preprocess.py --dataset CANARD | ContextualSP/incomplete_utterance_rewriting/dataset/CANARD/download.sh/0 | {
"file_path": "ContextualSP/incomplete_utterance_rewriting/dataset/CANARD/download.sh",
"repo_id": "ContextualSP",
"token_count": 71
} | 225 |
import argparse
import sys
from allennlp.commands import main
if __name__ == '__main__':
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("--model_file", required=True, type=str,
help="Please specify a model file to evaluate")
arg_parser.add_argument("--test_file"... | ContextualSP/incomplete_utterance_rewriting/src/evaluate.py/0 | {
"file_path": "ContextualSP/incomplete_utterance_rewriting/src/evaluate.py",
"repo_id": "ContextualSP",
"token_count": 371
} | 226 |
# coding: utf-8
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from src.utils.algo_utils import BipartiteGraphSolver
class HingeLoss(nn.Module):
def __init__(self, margin=0.6, aggregation='max', l1_norm_weight=0, entropy_norm_weight=0):
super(HingeLoss, self).__ini... | ContextualSP/interactive_text_to_sql/src/loss.py/0 | {
"file_path": "ContextualSP/interactive_text_to_sql/src/loss.py",
"repo_id": "ContextualSP",
"token_count": 2658
} | 227 |
import glob
import os
from abc import ABCMeta, abstractproperty, abstractmethod
from collections import Sequence
from os.path import join
import tensorflow as tf
from keras.callbacks import ModelCheckpoint, EarlyStopping, TensorBoard
import keras.engine
from tensorflow import Tensor
from gtd.io import JSONPicklable, ... | ContextualSP/lemon/executor/gtd/ml/framework.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/ml/framework.py",
"repo_id": "ContextualSP",
"token_count": 4098
} | 228 |
import numpy as np
import pytest
from gtd.ml.vocab import SimpleVocab, SimpleEmbeddings
@pytest.fixture
def vocab():
return SimpleVocab(['a', 'b', 'c'])
@pytest.fixture
def embeds(vocab):
array = np.eye(len(vocab))
return SimpleEmbeddings(array, vocab)
class TestSimpleVocab(object):
def test_save... | ContextualSP/lemon/executor/gtd/tests/ml/test_vocab.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/tests/ml/test_vocab.py",
"repo_id": "ContextualSP",
"token_count": 214
} | 229 |
from collections import Sequence
import sys
from gtd.io import JSONPicklable
from gtd.utils import cached_property, UnicodeMixin
from strongsup.predicate import Predicate
from strongsup.utils import PredicateList
from strongsup.value import Value
from strongsup.world import World
class Example(JSONPicklable):
... | ContextualSP/lemon/executor/strongsup/example.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/example.py",
"repo_id": "ContextualSP",
"token_count": 5232
} | 230 |
import abc
import os
import pickle
import time
import sys
from dependency.data_directory import DataDirectory
from prettytable import PrettyTable
from strongsup.results.entry import Entry
from strongsup.results.result_value import ResultValue
class Tracker(object, metaclass=abc.ABCMeta):
"""Tracks a set of a resu... | ContextualSP/lemon/executor/strongsup/results/tracker.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/results/tracker.py",
"repo_id": "ContextualSP",
"token_count": 5777
} | 231 |
from gtd.utils import cached_property
from strongsup.executor import Executor, Denotation
from strongsup.predicate import Predicate
from strongsup.utils import EOU
from strongsup.value import Value
from strongsup.tables.structure import (
parse_number,
parse_date,
Date,
ensure_same_typ... | ContextualSP/lemon/executor/strongsup/tables/executor.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/tables/executor.py",
"repo_id": "ContextualSP",
"token_count": 7863
} | 232 |
import pytest
from strongsup.tables.structure import (
parse_number, parse_date, parse_value, Date,
get_type, ensure_same_type,
NeqInfiniteSet, RangeInfiniteSet, GenericDateInfiniteSet,
)
class TestValues(object):
def test_date(self):
assert Date(2012, 12, -1) == Date(201... | ContextualSP/lemon/executor/strongsup/tests/tables/test_structure.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/tests/tables/test_structure.py",
"repo_id": "ContextualSP",
"token_count": 4012
} | 233 |
{"id":"Mercury_7175875","answerKey":"C"}
{"id":"Mercury_SC_409171","answerKey":"B"}
{"id":"Mercury_SC_408547","answerKey":"C"}
{"id":"Mercury_407327","answerKey":"D"}
{"id":"MCAS_2006_9_44","answerKey":"D"}
{"id":"Mercury_7270393","answerKey":"B"}
{"id":"MCAS_2014_5_7","answerKey":"C"}
{"id":"Mercury_7086660","answerKe... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/arc/data-challenge/question-answers.jsonl/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/arc/data-challenge/question-answers.jsonl",
"repo_id": "ContextualSP",
"token_count": 20152
} | 234 |
{"chain_id":"3018Q3ZVOIPYTHOB6LJ337FXF57ARA_1_1","score":0.5}
{"chain_id":"3018Q3ZVOIPYTHOB6LJ337FXF57ARA_1_10","score":0.5}
{"chain_id":"3018Q3ZVOIPYTHOB6LJ337FXF57ARA_1_2","score":0.5}
{"chain_id":"3018Q3ZVOIPYTHOB6LJ337FXF57ARA_1_3","score":0.5}
{"chain_id":"3018Q3ZVOIPYTHOB6LJ337FXF57ARA_1_4","score":0.5}
{"chain_i... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/eqasc/data/dummy_predictions_test.jsonl/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/eqasc/data/dummy_predictions_test.jsonl",
"repo_id": "ContextualSP",
"token_count": 351479
} | 235 |
import unittest
from collections import OrderedDict
from process import process, Process, Conversion, Move, Input, Output
from process.constants import NO_ACTION as NO_ACT, NO_LOCATION as NO_LOC, CREATE, DESTROY, MOVE
class TestProcess(unittest.TestCase):
def test_qa(self):
p = Process(
proc... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/process/test_process.py/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/process/test_process.py",
"repo_id": "ContextualSP",
"token_count": 2016
} | 236 |
import unittest
from text import terms
class TestTerms(unittest.TestCase):
def test_extract_termsets(self):
# one term
self.assertEqual(terms.extract_termsets("dew"), [{'dew'}])
# one term with a word that should not be stemmed
self.assertEqual(terms.extract_termsets("raining"),... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/text/test_terms.py/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/text/test_terms.py",
"repo_id": "ContextualSP",
"token_count": 1720
} | 237 |
This directory contains the training and test files for evaluating predictions,
and a sample prediction file.
The file `train_uniform.jsonl` is the main training data to use for
leaderboard entries (please note that in our paper, we also experiment
with training on an `iid` set (not included here) _**which is not
allo... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/tracie/data/README.md/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/tracie/data/README.md",
"repo_id": "ContextualSP",
"token_count": 295
} | 238 |
import os
############ General Parameters ##############
gan_alpha=0.8
mode='debug'
project_dir = os.getenv('HOME')#"/home/v-xinyupi/"
code_dir=f"{project_dir}/LogicPretrain/code/GAN-new"
model_name = 'LogiGAN'
corpus_dir=f"{project_dir}/LogicPretrain/Logic_gan_new/data/corpus_gan_new/beta"
model_output_dir=f"{project_... | ContextualSP/logigan/pre-training/parameters16g_es_corpusb.py/0 | {
"file_path": "ContextualSP/logigan/pre-training/parameters16g_es_corpusb.py",
"repo_id": "ContextualSP",
"token_count": 1447
} | 239 |
#!/usr/bin/env bash
## generate sketch
bash ./sketch_prediction/evaluate.sh
## preprocess data for traversal path prediction
python preprocess_hierarchical_inference.py
## generate valid traversal path
python ./traversal_path_prediction/MatchZoo-py/evaluate_esim.py
## evaluate, output accuracy score
python evaluate.py... | ContextualSP/poset_decoding/evaluate.sh/0 | {
"file_path": "ContextualSP/poset_decoding/evaluate.sh",
"repo_id": "ContextualSP",
"token_count": 94
} | 240 |
import torch
import numpy as np
import pandas as pd
import matchzoo as mz
import os
import json
print('matchzoo version', mz.__version__)
split = "mcd1"
data_root = "./data/"
model_path = f"./model/traversal_path_esim-{split}"
task = mz.tasks.Classification(num_classes=2)
task.metrics = ['acc']
print("`classification... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/evaluate_esim.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/evaluate_esim.py",
"repo_id": "ContextualSP",
"token_count": 865
} | 241 |
import numpy as np
import matchzoo as mz
from matchzoo.engine.base_callback import BaseCallback
class Ngram(BaseCallback):
"""
Generate the character n-gram for data.
:param preprocessor: The fitted :class:`BasePreprocessor` object, which
contains the n-gram units information.
:param mode: ... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/dataloader/callbacks/ngram.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/dataloader/callbacks/ngram.py",
"repo_id": "ContextualSP",
"token_count": 1888
} | 242 |
"""GloVe Embedding data loader."""
from pathlib import Path
import matchzoo as mz
_glove_embedding_url = "http://nlp.stanford.edu/data/glove.6B.zip"
def load_glove_embedding(dimension: int = 50) -> mz.embedding.Embedding:
"""
Return the pretrained glove embedding.
:param dimension: the size of embeddi... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/datasets/embeddings/load_glove_embedding.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/datasets/embeddings/load_glove_embedding.py",
"repo_id": "ContextualSP",
"token_count": 433
} | 243 |
"""Metric base class and some related utilities."""
import abc
import numpy as np
class BaseMetric(abc.ABC):
"""Metric base class."""
ALIAS = 'base_metric'
@abc.abstractmethod
def __call__(self, y_true: np.array, y_pred: np.array) -> float:
"""
Call to compute the metric.
... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/engine/base_metric.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/engine/base_metric.py",
"repo_id": "ContextualSP",
"token_count": 523
} | 244 |
"""Mean reciprocal ranking metric."""
import numpy as np
from matchzoo.engine.base_metric import (
BaseMetric, sort_and_couple, RankingMetric
)
class MeanReciprocalRank(RankingMetric):
"""Mean reciprocal rank metric."""
ALIAS = ['mean_reciprocal_rank', 'mrr']
def __init__(self, threshold: float = 0... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/metrics/mean_reciprocal_rank.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/metrics/mean_reciprocal_rank.py",
"repo_id": "ContextualSP",
"token_count": 623
} | 245 |
"""An implementation of DSSM, Deep Structured Semantic Model."""
import typing
import torch
import torch.nn.functional as F
from matchzoo import preprocessors
from matchzoo.engine.param_table import ParamTable
from matchzoo.engine.param import Param
from matchzoo.engine.base_model import BaseModel
from matchzoo.engin... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/dssm.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/dssm.py",
"repo_id": "ContextualSP",
"token_count": 1366
} | 246 |
import torch.nn as nn
class RNNDropout(nn.Dropout):
"""Dropout for RNN."""
def forward(self, sequences_batch):
"""Masking whole hidden vector for tokens."""
# B: batch size
# L: sequence length
# D: hidden size
# sequence_batch: BxLxD
ones = sequences_batch.da... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/modules/dropout.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/modules/dropout.py",
"repo_id": "ContextualSP",
"token_count": 310
} | 247 |
import numpy as np
from .unit import Unit
class CharacterIndex(Unit):
"""
CharacterIndexUnit for DIIN model.
The input of :class:'CharacterIndexUnit' should be a list of word
character list extracted from a text. The output is the character
index representation of this text.
:class:`NgramLe... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/character_index.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/character_index.py",
"repo_id": "ContextualSP",
"token_count": 683
} | 248 |
import collections
import numpy as np
from .unit import Unit
class WordHashing(Unit):
"""
Word-hashing layer for DSSM-based models.
The input of :class:`WordHashingUnit` should be a list of word
sub-letter list extracted from one document. The output of is
the word-hashing representation of thi... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/word_hashing.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/word_hashing.py",
"repo_id": "ContextualSP",
"token_count": 1095
} | 249 |
[pytest]
markers =
cron: marks tests as cron (deselect with '-m "not cron"')
slow: marks tests as slow (deselect with '-m "not slow"')
| ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/pytest.ini/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/pytest.ini",
"repo_id": "ContextualSP",
"token_count": 58
} | 250 |
import pytest
import matchzoo as mz
@pytest.fixture
def term_index():
return {'G': 1, 'C': 2, 'D': 3, 'A': 4, '_PAD': 0}
def test_embedding(term_index):
embed = mz.embedding.load_from_file(mz.datasets.embeddings.EMBED_RANK)
matrix = embed.build_matrix(term_index)
assert matrix.shape == (len(term_in... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/test_embedding.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/test_embedding.py",
"repo_id": "ContextualSP",
"token_count": 262
} | 251 |
<jupyter_start><jupyter_code>import torch
import numpy as np
import pandas as pd
import matchzoo as mz
print('matchzoo version', mz.__version__)
ranking_task = mz.tasks.Ranking(losses=mz.losses.RankHingeLoss())
ranking_task.metrics = [
mz.metrics.NormalizedDiscountedCumulativeGain(k=3),
mz.metrics.NormalizedDis... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tutorials/ranking/drmmtks.ipynb/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tutorials/ranking/drmmtks.ipynb",
"repo_id": "ContextualSP",
"token_count": 1026
} | 252 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""
Mainly borrowed from `allennlp.data.fields.production_rule_field.py` to support tree-level copy
Author: Qian Liu
"""
from typing import Dict, List, Optional, NamedTuple
import torch
from overrides import overrides
from allennlp.data.fie... | ContextualSP/semantic_parsing_in_context/context/copy_production_rule_field.py/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/context/copy_production_rule_field.py",
"repo_id": "ContextualSP",
"token_count": 2236
} | 253 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import logging
from typing import Dict, List, Tuple
import torch
import statistics
from allennlp.nn import util
from allennlp.state_machines.constrained_beam_search import ConstrainedBeamSearch
from allennlp.state_machines.states import State
fro... | ContextualSP/semantic_parsing_in_context/models/decode_trainer.py/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/models/decode_trainer.py",
"repo_id": "ContextualSP",
"token_count": 1766
} | 254 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import os
from scripts.eval.evaluation_sqa import Evaluator, build_valid_col_units, rebuild_sql_val, rebuild_sql_col, \
build_foreign_key_map_from_json
from scripts.eval.process_sql import Schema, get_schema, get_sql
_schemas = {}
kmaps = No... | ContextualSP/semantic_parsing_in_context/scripts/sparc_evaluate.py/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/scripts/sparc_evaluate.py",
"repo_id": "ContextualSP",
"token_count": 577
} | 255 |
"""
Utility functions for reading the standardised text2sql datasets presented in
`"Improving Text to SQL Evaluation Methodology" <https://arxiv.org/abs/1806.09029>`_
"""
import json
import os
import sqlite3
from collections import defaultdict
from typing import List, Dict, Optional, Any
from semparse.sql.process_sql i... | ContextualSP/unified_parser_text_to_sql/semparse/sql/spider_utils.py/0 | {
"file_path": "ContextualSP/unified_parser_text_to_sql/semparse/sql/spider_utils.py",
"repo_id": "ContextualSP",
"token_count": 5863
} | 256 |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
class LinearSuper(nn.Linear):
def __init__(self, super_in_dim, super_out_dim, bias=True, uniform_=None, non_linear='linear', scale=False):
super().__init__(super_in_dim, super_out_dim, bias=bias)
# super_in_dim a... | Cream/AutoFormer/model/module/Linear_super.py/0 | {
"file_path": "Cream/AutoFormer/model/module/Linear_super.py",
"repo_id": "Cream",
"token_count": 1177
} | 257 |
from .base import BaseFileHandler
from .json_handler import JsonHandler
from .pickle_handler import PickleHandler
from .yaml_handler import YamlHandler
__all__ = ['BaseFileHandler', 'JsonHandler', 'PickleHandler', 'YamlHandler']
| Cream/CDARTS/CDARTS_detection/mmcv/fileio/handlers/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/fileio/handlers/__init__.py",
"repo_id": "Cream",
"token_count": 66
} | 258 |
import torch
from torch.nn.parallel._functions import _get_stream
def scatter(input, devices, streams=None):
"""Scatters tensor across multiple GPUs.
"""
if streams is None:
streams = [None] * len(devices)
if isinstance(input, list):
chunk_size = (len(input) - 1) // len(devices) + 1
... | Cream/CDARTS/CDARTS_detection/mmcv/parallel/_functions.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/parallel/_functions.py",
"repo_id": "Cream",
"token_count": 1125
} | 259 |
from __future__ import print_function
import logging
import os
import os.path as osp
import time
from datetime import datetime
from threading import Thread
import requests
from six.moves.queue import Empty, Queue
from ...utils import get_host_info, master_only
from .base import LoggerHook
class PaviClient(object):
... | Cream/CDARTS/CDARTS_detection/mmcv/runner/hooks/logger/pavi.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/runner/hooks/logger/pavi.py",
"repo_id": "Cream",
"token_count": 3491
} | 260 |
import sys
from multiprocessing import Pool
from .misc import collections_abc
from .timer import Timer
class ProgressBar(object):
"""A progress bar which can print the progress"""
def __init__(self, task_num=0, bar_width=50, start=True):
self.task_num = task_num
max_bar_width = self._get_max... | Cream/CDARTS/CDARTS_detection/mmcv/utils/progressbar.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/utils/progressbar.py",
"repo_id": "Cream",
"token_count": 2937
} | 261 |
Metadata-Version: 2.1
Name: mmdet
Version: 0.6.0+889383
Summary: Open MMLab Detection Toolbox
Home-page: https://github.com/open-mmlab/mmdetection
License: Apache License 2.0
Keywords: computer vision,object detection
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: Ap... | Cream/CDARTS/CDARTS_detection/mmdet.egg-info/PKG-INFO/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet.egg-info/PKG-INFO",
"repo_id": "Cream",
"token_count": 863
} | 262 |
from .geometry import bbox_overlaps
from .assigners import BaseAssigner, MaxIoUAssigner, AssignResult
from .samplers import (BaseSampler, PseudoSampler, RandomSampler,
InstanceBalancedPosSampler, IoUBalancedNegSampler,
CombinedSampler, SamplingResult)
from .assign_sampling ... | Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/__init__.py",
"repo_id": "Cream",
"token_count": 474
} | 263 |
import numpy as np
import torch
from .base_sampler import BaseSampler
class RandomSampler(BaseSampler):
def __init__(self,
num,
pos_fraction,
neg_pos_ub=-1,
add_gt_as_proposals=True,
**kwargs):
super(RandomSampler, self... | Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/samplers/random_sampler.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/samplers/random_sampler.py",
"repo_id": "Cream",
"token_count": 904
} | 264 |
import mmcv
def split_combined_polys(polys, poly_lens, polys_per_mask):
"""Split the combined 1-D polys into masks.
A mask is represented as a list of polys, and a poly is represented as
a 1-D array. In dataset, all masks are concatenated into a single 1-D
tensor. Here we need to split the tensor int... | Cream/CDARTS/CDARTS_detection/mmdet/core/mask/utils.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/mask/utils.py",
"repo_id": "Cream",
"token_count": 485
} | 265 |
from .compose import Compose
from .formating import (Collect, ImageToTensor, ToDataContainer, ToTensor,
Transpose, to_tensor)
from .loading import LoadAnnotations, LoadImageFromFile, LoadProposals
from .test_aug import MultiScaleFlipAug
from .transforms import (Albu, Expand, MinIoURandomCrop, No... | Cream/CDARTS/CDARTS_detection/mmdet/datasets/pipelines/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/datasets/pipelines/__init__.py",
"repo_id": "Cream",
"token_count": 336
} | 266 |
import torch.nn as nn
from mmcv.cnn import normal_init
from .guided_anchor_head import GuidedAnchorHead, FeatureAdaption
from ..registry import HEADS
from ..utils import bias_init_with_prob, ConvModule
from mmdet.ops import MaskedConv2d
@HEADS.register_module
class GARetinaHead(GuidedAnchorHead):
"""Guided-Ancho... | Cream/CDARTS/CDARTS_detection/mmdet/models/anchor_heads/ga_retina_head.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/anchor_heads/ga_retina_head.py",
"repo_id": "Cream",
"token_count": 2333
} | 267 |
import logging
import torch.nn as nn
from mmcv.cnn import constant_init, kaiming_init
from mmcv.runner import load_checkpoint
from torch.nn.modules.batchnorm import _BatchNorm
from ..registry import BACKBONES
from ..utils import build_norm_layer, build_conv_layer
from .resnet import BasicBlock, Bottleneck
class HRM... | Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/hrnet.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/hrnet.py",
"repo_id": "Cream",
"token_count": 10666
} | 268 |
from torch import nn
from mmdet.utils import build_from_cfg
from .registry import (BACKBONES, NECKS, ROI_EXTRACTORS, SHARED_HEADS, HEADS,
LOSSES, DETECTORS)
def build(cfg, registry, default_args=None):
if isinstance(cfg, list):
modules = [
build_from_cfg(cfg_, registry,... | Cream/CDARTS/CDARTS_detection/mmdet/models/builder.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/builder.py",
"repo_id": "Cream",
"token_count": 406
} | 269 |
import torch
import torch.nn as nn
from .base import BaseDetector
from .test_mixins import RPNTestMixin, BBoxTestMixin, MaskTestMixin
from .. import builder
from ..registry import DETECTORS
from mmdet.core import bbox2roi, bbox2result, build_assigner, build_sampler
@DETECTORS.register_module
class TwoStageDetector(B... | Cream/CDARTS/CDARTS_detection/mmdet/models/detectors/two_stage.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/detectors/two_stage.py",
"repo_id": "Cream",
"token_count": 7444
} | 270 |
import numpy as np
import torch
import torch.nn as nn
from mmcv.cnn import kaiming_init, normal_init
from ..builder import build_loss
from ..registry import HEADS
@HEADS.register_module
class MaskIoUHead(nn.Module):
"""Mask IoU Head.
This head predicts the IoU of predicted masks and corresponding gt masks.
... | Cream/CDARTS/CDARTS_detection/mmdet/models/mask_heads/maskiou_head.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/mask_heads/maskiou_head.py",
"repo_id": "Cream",
"token_count": 3627
} | 271 |
from .single_level import SingleRoIExtractor
__all__ = ['SingleRoIExtractor']
| Cream/CDARTS/CDARTS_detection/mmdet/models/roi_extractors/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/roi_extractors/__init__.py",
"repo_id": "Cream",
"token_count": 25
} | 272 |
#include <torch/extension.h>
#include <cmath>
#include <vector>
int MaskedIm2colForwardLaucher(const at::Tensor im, const int height,
const int width, const int channels,
const int kernel_h, const int kernel_w,
const int pad_... | Cream/CDARTS/CDARTS_detection/mmdet/ops/masked_conv/src/masked_conv2d_cuda.cpp/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/masked_conv/src/masked_conv2d_cuda.cpp",
"repo_id": "Cream",
"token_count": 1532
} | 273 |
import torch.nn as nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair
from . import roi_align_cuda
class RoIAlignFunction(Function):
@staticmethod
def forward(ctx, features, rois, out_size, spatial_scale, sample_num=0):
... | Cream/CDARTS/CDARTS_detection/mmdet/ops/roi_align/roi_align.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/roi_align/roi_align.py",
"repo_id": "Cream",
"token_count": 1502
} | 274 |
import argparse
import json
from collections import defaultdict
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
def cal_train_time(log_dicts, args):
for i, log_dict in enumerate(log_dicts):
print('{}Analyze train time of {}{}'.format('-' * 5, args.json_logs[i],
... | Cream/CDARTS/CDARTS_detection/tools/analyze_logs.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/tools/analyze_logs.py",
"repo_id": "Cream",
"token_count": 3122
} | 275 |
import matplotlib.pyplot as plt
import numpy as np
import torch
def decode_seg_map_sequence(label_masks, dataset='pascal'):
rgb_masks = []
for label_mask in label_masks:
rgb_mask = decode_segmap(label_mask, dataset)
rgb_masks.append(rgb_mask)
rgb_masks = torch.from_numpy(np.array(rgb_masks)... | Cream/CDARTS/CDARTS_segmentation/dataloaders/dataloader_utils.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/dataloaders/dataloader_utils.py",
"repo_id": "Cream",
"token_count": 1646
} | 276 |
# ------------------------------------------------------------------------------
# Builds transformation before data augmentation.
# Written by Bowen Cheng (bcheng9@illinois.edu)
# ------------------------------------------------------------------------------
import warnings
import cv2
import math
import numpy as np
... | Cream/CDARTS/CDARTS_segmentation/dataloaders/transforms/pre_augmentation_transforms.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/dataloaders/transforms/pre_augmentation_transforms.py",
"repo_id": "Cream",
"token_count": 1863
} | 277 |
# ------------------------------------------------------------------------------
# Reference: https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/samplers/distributed_sampler.py
# Modified by Bowen Cheng (bcheng9@illinois.edu)
# --------------------------------------------------------------------... | Cream/CDARTS/CDARTS_segmentation/segmentation/data/samplers/distributed_sampler.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/data/samplers/distributed_sampler.py",
"repo_id": "Cream",
"token_count": 1195
} | 278 |
# ------------------------------------------------------------------------------
# Reference: https://github.com/pytorch/vision/blob/master/torchvision/models/mobilenet.py
# Modified by Bowen Cheng (bcheng9@illinois.edu)
# ------------------------------------------------------------------------------
from torch import... | Cream/CDARTS/CDARTS_segmentation/segmentation/model/backbone/mobilenet.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/model/backbone/mobilenet.py",
"repo_id": "Cream",
"token_count": 3967
} | 279 |
# ------------------------------------------------------------------------------
# Panoptic-DeepLab meta architecture.
# Written by Bowen Cheng (bcheng9@illinois.edu)
# ------------------------------------------------------------------------------
from collections import OrderedDict
import torch
from torch import nn
... | Cream/CDARTS/CDARTS_segmentation/segmentation/model/meta_arch/panoptic_deeplab.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/model/meta_arch/panoptic_deeplab.py",
"repo_id": "Cream",
"token_count": 2832
} | 280 |
# ------------------------------------------------------------------------------
# Utility functions for multi-scale testing.
# Written by Pingjun (https://github.com/bowenc0221/panoptic-deeplab/issues/25)
# Modified by Bowen Cheng (bcheng9@illinois.edu)
# ---------------------------------------------------------------... | Cream/CDARTS/CDARTS_segmentation/segmentation/utils/test_utils.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/utils/test_utils.py",
"repo_id": "Cream",
"token_count": 2171
} | 281 |
# encoding: utf-8
import os
import time
import numpy as np
import numba
import argparse
from collections import OrderedDict
import torch
import torch.distributed as dist
from engine.logger import get_logger
logger = get_logger()
EPS = 1e-10
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet1... | Cream/CDARTS/CDARTS_segmentation/tools/utils/pyt_utils.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/tools/utils/pyt_utils.py",
"repo_id": "Cream",
"token_count": 3973
} | 282 |
_BASE_: Base-PanopticDeepLab-OS16.yaml
MODEL:
WEIGHTS: "detectron2://DeepLab/R-52.pkl"
PIXEL_MEAN: [123.675, 116.280, 103.530]
PIXEL_STD: [58.395, 57.120, 57.375]
BACKBONE:
NAME: "build_resnet_deeplab_backbone"
RESNETS:
DEPTH: 50
NORM: "SyncBN"
RES5_MULTI_GRID: [1, 2, 4]
STEM_TYPE: "deepla... | Cream/CDARTS/CDARTS_segmentation/train/configs/Cityscapes-PanopticSegmentation/panoptic_deeplab_R_52_os16_mg124_poly_90k_bs32_crop_512_1024_dsconv.yaml/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/train/configs/Cityscapes-PanopticSegmentation/panoptic_deeplab_R_52_os16_mg124_poly_90k_bs32_crop_512_1024_dsconv.yaml",
"repo_id": "Cream",
"token_count": 303
} | 283 |
""" Search cell """
import json
import lib.utils.genotypes as gt
from torchscope import scope
from lib.models.model_test import ModelTest
# config
stem_multiplier = 1
n_classes = 1000
init_channels = 48
model_type = 'imagenet'
cell_file = './genotypes.json'
#stem_multiplier = 3
#n_classes = 10
#init_channels = 36
#... | Cream/CDARTS/lib/utils/count_flops.py/0 | {
"file_path": "Cream/CDARTS/lib/utils/count_flops.py",
"repo_id": "Cream",
"token_count": 461
} | 284 |
from lib.models.blocks.residual_block import get_Bottleneck, get_BasicBlock
from lib.models.blocks.inverted_residual_block import InvertedResidual | Cream/Cream/lib/models/blocks/__init__.py/0 | {
"file_path": "Cream/Cream/lib/models/blocks/__init__.py",
"repo_id": "Cream",
"token_count": 44
} | 285 |
# 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
import os
import warnings
import datetime
import torch
import numpy as np
import torch.nn as nn
import _init_paths
from torchscope import scope
f... | Cream/Cream/tools/retrain.py/0 | {
"file_path": "Cream/Cream/tools/retrain.py",
"repo_id": "Cream",
"token_count": 5896
} | 286 |
# --------------------------------------------------------
# Efficient Main (train/validate)
# Copyright (c) 2022 Microsoft
# Adapted from LeViT and Swin Transformer
# LeViT: (https://github.com/facebookresearch/levit)
# Swin: (https://github.com/microsoft/swin-transformer)
# ---------------------------------------... | Cream/EfficientViT/classification/main.py/0 | {
"file_path": "Cream/EfficientViT/classification/main.py",
"repo_id": "Cream",
"token_count": 9525
} | 287 |
# dataset settings
dataset_type = 'VOCDataset'
data_root = 'data/VOCdevkit/'
img_norm_cfg = dict(
mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='LoadAnnotations', with_bbox=True),
dict(type='Resize', img_scale=(1000... | Cream/EfficientViT/downstream/configs/_base_/datasets/voc0712.py/0 | {
"file_path": "Cream/EfficientViT/downstream/configs/_base_/datasets/voc0712.py",
"repo_id": "Cream",
"token_count": 943
} | 288 |
# model settings
model = dict(
type='RetinaNet',
pretrained='torchvision://resnet50',
backbone=dict(
type='EfficientViT_M4',
pretrained="",),
neck=dict(
type='FPN',
in_channels=[256, 512, 1024, 2048],
out_channels=256,
start_level=1,
add_extra_conv... | Cream/EfficientViT/downstream/configs/_base_/models/retinanet_efficientvit_fpn.py/0 | {
"file_path": "Cream/EfficientViT/downstream/configs/_base_/models/retinanet_efficientvit_fpn.py",
"repo_id": "Cream",
"token_count": 916
} | 289 |
# Copyright (c) Open-MMLab. All rights reserved.
from .checkpoint import save_checkpoint
from .epoch_based_runner import EpochBasedRunnerAmp
__all__ = [
'EpochBasedRunnerAmp', 'save_checkpoint'
]
| Cream/EfficientViT/downstream/mmcv_custom/runner/__init__.py/0 | {
"file_path": "Cream/EfficientViT/downstream/mmcv_custom/runner/__init__.py",
"repo_id": "Cream",
"token_count": 69
} | 290 |
import argparse
import datetime
import numpy as np
import time
import torch
import torch.backends.cudnn as cudnn
import json
import os
from pathlib import Path
from timm.data import Mixup
try:
from timm.data import DatasetTar
except ImportError:
# for higher version of timm
from timm.data import ImageData... | Cream/MiniViT/Mini-DeiT/main.py/0 | {
"file_path": "Cream/MiniViT/Mini-DeiT/main.py",
"repo_id": "Cream",
"token_count": 9257
} | 291 |
MODEL:
TYPE: swin
NAME: swin_base_patch4_window7_224
DROP_PATH_RATE: 0.5
SWIN:
EMBED_DIM: 128
DEPTHS: [ 2, 2, 18, 2 ]
NUM_HEADS: [ 4, 8, 16, 32 ]
WINDOW_SIZE: 7 | Cream/MiniViT/Mini-Swin/configs/swin_base_patch4_window7_224.yaml/0 | {
"file_path": "Cream/MiniViT/Mini-Swin/configs/swin_base_patch4_window7_224.yaml",
"repo_id": "Cream",
"token_count": 102
} | 292 |
import os
import time
import datetime
import numpy as np
import torch
import torch.backends.cudnn as cudnn
import torch.distributed as dist
import warnings
warnings.filterwarnings(action="ignore", category=UserWarning)
from timm.loss import LabelSmoothingCrossEntropy, SoftTargetCrossEntropy
from timm.utils import ac... | Cream/MiniViT/Mini-Swin/main.py/0 | {
"file_path": "Cream/MiniViT/Mini-Swin/main.py",
"repo_id": "Cream",
"token_count": 12739
} | 293 |
{
"embed_dim": 512,
"vision_cfg": {
"image_size": 224,
"layers": 12,
"width": 512,
"patch_size": 16
},
"text_cfg": {
"context_length": 77,
"vocab_size": 49408,
"width": 512,
"heads": 8,
"layers": 6
}
}
| Cream/TinyCLIP/src/open_clip/model_configs/TinyCLIP-ViT-39M-16-Text-19M.json/0 | {
"file_path": "Cream/TinyCLIP/src/open_clip/model_configs/TinyCLIP-ViT-39M-16-Text-19M.json",
"repo_id": "Cream",
"token_count": 172
} | 294 |
""" Mixup and Cutmix
Papers:
mixup: Beyond Empirical Risk Minimization (https://arxiv.org/abs/1710.09412)
CutMix: Regularization Strategy to Train Strong Classifiers with Localizable Features (https://arxiv.org/abs/1905.04899)
Code Reference:
CutMix: https://github.com/clovaai/CutMix-PyTorch
Hacked together by / Co... | Cream/TinyViT/data/augmentation/mixup.py/0 | {
"file_path": "Cream/TinyViT/data/augmentation/mixup.py",
"repo_id": "Cream",
"token_count": 8081
} | 295 |
# --------------------------------------------------------
# TinyViT ImageNet 22k Dataset
# Copyright (c) 2022 Microsoft
# --------------------------------------------------------
import io
import os
import torch
from collections import defaultdict
from PIL import Image
import zipfile
class IN22KDataset(torch.utils.... | Cream/TinyViT/data/imagenet22k_dataset.py/0 | {
"file_path": "Cream/TinyViT/data/imagenet22k_dataset.py",
"repo_id": "Cream",
"token_count": 1142
} | 296 |
# --------------------------------------------------------
# TinyViT Model Architecture
# Copyright (c) 2022 Microsoft
# Adapted from LeViT and Swin Transformer
# LeViT: (https://github.com/facebookresearch/levit)
# Swin: (https://github.com/microsoft/swin-transformer)
# Build the TinyViT Model
# ------------------... | Cream/TinyViT/models/tiny_vit.py/0 | {
"file_path": "Cream/TinyViT/models/tiny_vit.py",
"repo_id": "Cream",
"token_count": 12438
} | 297 |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Transforms and data augmentation for both image + bbox.
"""
import random
import PIL
import torch
import torchvision.transforms as T
import torchvision.transforms.functional as F
from util.box_ops import box_xyxy_to_cxcywh
from util.misc impor... | Cream/iRPE/DETR-with-iRPE/datasets/transforms.py/0 | {
"file_path": "Cream/iRPE/DETR-with-iRPE/datasets/transforms.py",
"repo_id": "Cream",
"token_count": 3666
} | 298 |
#include <torch/extension.h>
#include <string>
#include <vector>
using index_t = int;
at::Tensor rpe_index_forward_cpu(torch::Tensor input, torch::Tensor index) {
/*
- Inputs
input: float32 (B, H, L_query, num_buckets)
index: index_t (L_query, L_key)
- Outputs
Y: float32 (B, H, L_query, L_key... | Cream/iRPE/DETR-with-iRPE/rpe_ops/rpe_index.cpp/0 | {
"file_path": "Cream/iRPE/DETR-with-iRPE/rpe_ops/rpe_index.cpp",
"repo_id": "Cream",
"token_count": 2579
} | 299 |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import logging
import os
import pickle as pkl
import pprint
import time
import torch
import torch.nn.parallel
import torch.optim
from torch.utils.collect_env import get_pretty_env_info
from ten... | CvT/tools/test.py/0 | {
"file_path": "CvT/tools/test.py",
"repo_id": "CvT",
"token_count": 1823
} | 300 |
# Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
the rights to use your contribution. For details, visit https://cla.microsoft.com.
When you submit a pu... | anomalydetector/README.md/0 | {
"file_path": "anomalydetector/README.md",
"repo_id": "anomalydetector",
"token_count": 804
} | 301 |
/* Generated by Cython 0.29.16 */
/* BEGIN: Cython Metadata
{
"distutils": {
"define_macros": [
[
"CYTHON_TRACE",
"1"
]
],
"depends": [],
"name": "msanomalydetector._anomaly_kernel_cython",
"sources": [
"msa... | anomalydetector/msanomalydetector/_anomaly_kernel_cython.c/0 | {
"file_path": "anomalydetector/msanomalydetector/_anomaly_kernel_cython.c",
"repo_id": "anomalydetector",
"token_count": 517182
} | 302 |
import unittest
import pandas as pd
import numpy as np
from msanomalydetector import SpectralResidual, DetectMode
class FunctionalyTest(unittest.TestCase):
def test_anomaly_only_mode(self):
frame = pd.DataFrame({'timestamp': pd.date_range('2020-01-01', periods=100, freq='1D'),
... | anomalydetector/tests/test_spectral_residual.py/0 | {
"file_path": "anomalydetector/tests/test_spectral_residual.py",
"repo_id": "anomalydetector",
"token_count": 1183
} | 303 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import inspect
import warnings
from functools import wraps
from typing import Any, Callable, Optional
_deprecate_warnings_set = set()
def deprecated(
message: Optional[str] = None, deprecate_version: Optional[str] = None, remove_version: O... | archai/archai/common/deprecation_utils.py/0 | {
"file_path": "archai/archai/common/deprecation_utils.py",
"repo_id": "archai",
"token_count": 843
} | 304 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from collections import OrderedDict
from enum import Enum
from typing import List, Optional
def _dedup_list(input_list: List[str]) -> List[str]:
return list(OrderedDict.fromkeys(input_list))
class SpecialTokenEnum(Enum):
"""Enumerate ... | archai/archai/datasets/nlp/tokenizer_utils/token_config.py/0 | {
"file_path": "archai/archai/datasets/nlp/tokenizer_utils/token_config.py",
"repo_id": "archai",
"token_count": 1091
} | 305 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import copy
import re
from pathlib import Path
from time import time
from typing import Any, Dict, List, Optional, Tuple, Union
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from archai.discrete_search.api.archai_model ... | archai/archai/discrete_search/api/search_results.py/0 | {
"file_path": "archai/archai/discrete_search/api/search_results.py",
"repo_id": "archai",
"token_count": 4094
} | 306 |
# Copyright (c) DeepSpeed Team - Microsoft Corporation.
# Licensed under the MIT License.
# https://github.com/microsoft/DeepSpeed/blob/master/deepspeed/profiling/flops_profiler/profiler.py
from collections import OrderedDict
from typing import Callable, List, Optional, Tuple, Union
import numpy as np
import torch
im... | archai/archai/discrete_search/evaluators/pt_profiler_utils/pt_profiler_hooks.py/0 | {
"file_path": "archai/archai/discrete_search/evaluators/pt_profiler_utils/pt_profiler_hooks.py",
"repo_id": "archai",
"token_count": 7260
} | 307 |
from archai.discrete_search.search_spaces.cv.segmentation_dag.search_space import SegmentationDagSearchSpace
| archai/archai/discrete_search/search_spaces/cv/__init__.py/0 | {
"file_path": "archai/archai/discrete_search/search_spaces/cv/__init__.py",
"repo_id": "archai",
"token_count": 35
} | 308 |
from typing import Any
from torch import nn
from transformers import PretrainedConfig
from archai.discrete_search.search_spaces.config import ArchConfig
from .backbones import BACKBONES, CONFIGS
class LanguageModel(nn.Module):
def __init__(self, arch_config: ArchConfig, **hf_config_kwargs):
super().__in... | archai/archai/discrete_search/search_spaces/nlp/tfpp/model.py/0 | {
"file_path": "archai/archai/discrete_search/search_spaces/nlp/tfpp/model.py",
"repo_id": "archai",
"token_count": 334
} | 309 |
"""
2023.01.05 Extracted the SSKernel class from
https://github.com/HazyResearch/state-spaces/blob/06dbbdfd0876501a7f12bf3262121badbc7658af/src/models/sequence/ss/kernel.py
We add option to use the shift kernel, and remove the option of SSKernelNPLR
SSM convolution kernels.
SSKernel wraps different kernels with commo... | archai/archai/discrete_search/search_spaces/nlp/tfpp/ops/ssm_utils/ss_kernel.py/0 | {
"file_path": "archai/archai/discrete_search/search_spaces/nlp/tfpp/ops/ssm_utils/ss_kernel.py",
"repo_id": "archai",
"token_count": 3490
} | 310 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
class DepthWiseConvolution(nn.Module):
def __init__(self, d_model: int, kernel_size: Optional[int] = 3) -> None:
super().__init__()
... | archai/archai/discrete_search/search_spaces/nlp/transformer_flex/models/mem_transformer_utils/depth_wise_convolution.py/0 | {
"file_path": "archai/archai/discrete_search/search_spaces/nlp/transformer_flex/models/mem_transformer_utils/depth_wise_convolution.py",
"repo_id": "archai",
"token_count": 423
} | 311 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import types
import torch
from onnx import helper, load_model, numpy_helper, save
from onnxruntime.transformers import quantize_helper
from archai.onnx.onnx_forward import gpt2_onnx_forward
def prepare_model_for_onnx(model: torch.nn.Module, m... | archai/archai/onnx/export_utils.py/0 | {
"file_path": "archai/archai/onnx/export_utils.py",
"repo_id": "archai",
"token_count": 1525
} | 312 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Optional
import torch
from torch._C import dtype
from torch.quantization import MinMaxObserver
from archai.quantization.observers import OnnxDynamicObserver
class FakeDynamicQuant(torch.nn.Module):
"""Fake dynamic quant... | archai/archai/quantization/quantizers.py/0 | {
"file_path": "archai/archai/quantization/quantizers.py",
"repo_id": "archai",
"token_count": 2036
} | 313 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from overrides import overrides
from archai.common.common import get_conf
from archai.supergraph.algos.darts.bilevel_arch_trainer import BilevelArchTrainer
from archai.supergraph.algos.divnas.divnas_finalizers import DivnasFinalizers
from archai... | archai/archai/supergraph/algos/divnas/divnas_exp_runner.py/0 | {
"file_path": "archai/archai/supergraph/algos/divnas/divnas_exp_runner.py",
"repo_id": "archai",
"token_count": 587
} | 314 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Optional
from overrides import overrides
from archai.common.config import Config
from archai.supergraph.nas.arch_trainer import TArchTrainer
from archai.supergraph.nas.finalizers import Finalizers
from archai.supergraph.nas.m... | archai/archai/supergraph/algos/manual/manual_searcher.py/0 | {
"file_path": "archai/archai/supergraph/algos/manual/manual_searcher.py",
"repo_id": "archai",
"token_count": 236
} | 315 |
# 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/mit67_provider.py/0 | {
"file_path": "archai/archai/supergraph/datasets/providers/mit67_provider.py",
"repo_id": "archai",
"token_count": 1099
} | 316 |
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
class ShakeDropFunction(torch.autograd.Function):
@staticmethod
def forward(ctx, x, training=True, p_drop=0.5, alpha_range=[-1, 1]):
if training:
gate = torch.cu... | archai/archai/supergraph/models/shakedrop.py/0 | {
"file_path": "archai/archai/supergraph/models/shakedrop.py",
"repo_id": "archai",
"token_count": 702
} | 317 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Iterable, Optional, Tuple
import numpy as np
import torch
from overrides import overrides
from torch import Tensor, nn
from archai.common import ml_utils
from archai.supergraph.nas.arch_module import ArchModule
from archai.su... | archai/archai/supergraph/nas/model.py/0 | {
"file_path": "archai/archai/supergraph/nas/model.py",
"repo_id": "archai",
"token_count": 2508
} | 318 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Optional, Tuple
import torch
from overrides import EnforceOverrides
from torch import Tensor, nn
from torch.utils.data import DataLoader
from archai.common import ml_utils
from archai.common.apex_utils import ApexUtils
from a... | archai/archai/supergraph/utils/tester.py/0 | {
"file_path": "archai/archai/supergraph/utils/tester.py",
"repo_id": "archai",
"token_count": 2054
} | 319 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
import copy
import itertools
import math
import os
import shutil
import sys
import time
from typing import Any, Dict, Iterator, Optional, Tuple
import torch
import torch.nn as nn
import torch.optim as optim
from overrides import overrides
from p... | archai/archai/trainers/nlp/nvidia_trainer.py/0 | {
"file_path": "archai/archai/trainers/nlp/nvidia_trainer.py",
"repo_id": "archai",
"token_count": 11485
} | 320 |
autoaug:
model:
type: 'wresnet40_2'
loader:
aug: 'fa_reduced_cifar10'
cutout: 16
batch: 512
epochs: 200
lr_schedule:
type: 'cosine'
warmup:
multiplier: 4
epochs: 5
optimizer:
lr: 0.1
type: 'sgd'
nesterov: True
decay: 0.0002 | archai/confs/aug/wresnet40x2_cifar10_b512.yaml/0 | {
"file_path": "archai/confs/aug/wresnet40x2_cifar10_b512.yaml",
"repo_id": "archai",
"token_count": 153
} | 321 |
__include__: './size_224x224_base.yaml' # default dataset settings are for cifar
common:
seed: 0.0
toy_mode: # this section will be used by toy.yaml to setup the toy mode
max_batches: 25
train_batch: 64
test_batch: 64
# we use imagenet only for eval, so search dataset is still cifar10 but eval dataset... | archai/confs/datasets/imagenet.yaml/0 | {
"file_path": "archai/confs/datasets/imagenet.yaml",
"repo_id": "archai",
"token_count": 1279
} | 322 |
#!/bin/bash
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# Runs an interactive bash within the container
# Enhanced security by gVisor / without GPUs
docker run --rm \
--runtime=runsc \
--name nvidia22.10-archai \
--shm-size=10g \
--ipc=host \
--ulimit memlock=-1 \
-... | archai/docker/run_container_with_gvisor.sh/0 | {
"file_path": "archai/docker/run_container_with_gvisor.sh",
"repo_id": "archai",
"token_count": 161
} | 323 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.