text stringlengths 5 22M | id stringlengths 12 177 | metadata dict | __index_level_0__ int64 0 1.37k |
|---|---|---|---|
#include <vector>
#include <iostream>
#include <ATen/ATen.h>
#include <cuda.h>
#include <cuda_runtime.h>
#include <cuda_fp16.h>
#include <cuda_bf16.h>
#include <cuda_profiler_api.h>
#include "THC/THC.h"
#include <ATen/cuda/CUDAContext.h>
#include <torch/extension.h>
#include <math.h>
#include "softmax.h"
// symbol t... | COCO-LM/fairseq/fused_ops/csrc/softmax_dropout/softmax_dropout_kernel.cu/0 | {
"file_path": "COCO-LM/fairseq/fused_ops/csrc/softmax_dropout/softmax_dropout_kernel.cu",
"repo_id": "COCO-LM",
"token_count": 3577
} | 194 |
[build-system]
requires = ["setuptools", "wheel", "cython"]
build-backend = "setuptools.build_meta"
| COCO-LM/fairseq/pyproject.toml/0 | {
"file_path": "COCO-LM/fairseq/pyproject.toml",
"repo_id": "COCO-LM",
"token_count": 37
} | 195 |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""
Split a large file into shards while respecting document boundaries. Documents
should be separated by a single empty... | COCO-LM/fairseq/scripts/shard_docs.py/0 | {
"file_path": "COCO-LM/fairseq/scripts/shard_docs.py",
"repo_id": "COCO-LM",
"token_count": 775
} | 196 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# This file defines example configuration arguments for quantizing
# a transformer model with product quantization
n_centroids:
Linear:
... | COCO-LM/fairseq/tests/gpu/transformer_quantization_config.yaml/0 | {
"file_path": "COCO-LM/fairseq/tests/gpu/transformer_quantization_config.yaml",
"repo_id": "COCO-LM",
"token_count": 321
} | 197 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import numpy as np
from fairseq.data.data_utils_fast import batch_by_size_fn
from fairseq.data.data_utils_fast import batch_b... | COCO-LM/fairseq/tests/test_data_utils.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_data_utils.py",
"repo_id": "COCO-LM",
"token_count": 2629
} | 198 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
from fairseq.modules.multihead_attention import MultiheadAttention
class TestMultiheadAttention(unittest.TestC... | COCO-LM/fairseq/tests/test_multihead_attention.py/0 | {
"file_path": "COCO-LM/fairseq/tests/test_multihead_attention.py",
"repo_id": "COCO-LM",
"token_count": 1044
} | 199 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# The script is largely adapted from the huggingface transformers library
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
import math
import os
import torch
from torch import nn
from torch.nn.... | COCO-LM/huggingface/cocolm/modeling_cocolm.py/0 | {
"file_path": "COCO-LM/huggingface/cocolm/modeling_cocolm.py",
"repo_id": "COCO-LM",
"token_count": 16630
} | 200 |
---
title: ClimaX
template: home.html
---
<!-- Welcome to CliMax -->
| ClimaX/docs/index.md/0 | {
"file_path": "ClimaX/docs/index.md",
"repo_id": "ClimaX",
"token_count": 26
} | 201 |
# year_strings = [
# '185001010600-187001010000',
# '187001010600-189001010000',
# '189001010600-191001010000',
# '191001010600-193001010000',
# '193001010600-195001010000',
# '195001010600-197001010000',
# '197001010600-199001010000',
# '199001010600-201001010000',
# '201001010600-... | ClimaX/snakemake_configs/MPI-ESM/Snakefile/0 | {
"file_path": "ClimaX/snakemake_configs/MPI-ESM/Snakefile",
"repo_id": "ClimaX",
"token_count": 1520
} | 202 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Any
import torch
from pytorch_lightning import LightningModule
from climax.arch import ClimaX
from climax.utils.lr_scheduler import LinearWarmupCosineAnnealingLR
from climax.utils.metrics import lat_weighted_mse
class Pretr... | ClimaX/src/climax/pretrain/module.py/0 | {
"file_path": "ClimaX/src/climax/pretrain/module.py",
"repo_id": "ClimaX",
"token_count": 1644
} | 203 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.networks.base_network import BaseNetwork
from models.networks.normalization import get_nonspade_norm_layer
import util.util as util
class MultiscaleDiscriminator(Ba... | CoCosNet-v2/models/networks/discriminator.py/0 | {
"file_path": "CoCosNet-v2/models/networks/discriminator.py",
"repo_id": "CoCosNet-v2",
"token_count": 2207
} | 204 |
# Code Search
## Data Preprocess
Both training and validation datasets are created in a way that positive and negative samples are balanced. Negative samples consist of balanced number of instances with randomly replaced NL and PL.
We follow the official evaluation metric to calculate the Mean Reciprocal Rank (MRR) ... | CodeBERT/CodeBERT/codesearch/README.md/0 | {
"file_path": "CodeBERT/CodeBERT/codesearch/README.md",
"repo_id": "CodeBERT",
"token_count": 732
} | 205 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | CodeBERT/CodeExecutor/pretrain/run.py/0 | {
"file_path": "CodeBERT/CodeExecutor/pretrain/run.py",
"repo_id": "CodeBERT",
"token_count": 8982
} | 206 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from evaluator.CodeBLEU.parser import DFG_python, DFG_java, DFG_ruby, DFG_go, DFG_php, DFG_javascript, DFG_csharp
from evaluator.CodeBLEU.parser import (remove_comments_and_docstrings,
tree_to_token_index,
... | CodeBERT/CodeReviewer/code/evaluator/CodeBLEU/syntax_match.py/0 | {
"file_path": "CodeBERT/CodeReviewer/code/evaluator/CodeBLEU/syntax_match.py",
"repo_id": "CodeBERT",
"token_count": 1383
} | 207 |
pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
pip install --upgrade scipy transformers tqdm fuzzywuzzy tree_sitter datasets
lang=$1 #programming language
lr=2e-4
batch_size=16
beam_size=5
source_length=3968
target_length=128
global_leng... | CodeBERT/LongCoder/run.sh/0 | {
"file_path": "CodeBERT/LongCoder/run.sh",
"repo_id": "CodeBERT",
"token_count": 555
} | 208 |
# coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a cop... | CodeBERT/UniXcoder/downstream-tasks/code-completion/run.py/0 | {
"file_path": "CodeBERT/UniXcoder/downstream-tasks/code-completion/run.py",
"repo_id": "CodeBERT",
"token_count": 11216
} | 209 |
# CodeT: Code Generation with Generated Tests
# Overview
In the paper, we present **CodeT** (for **Code** Generation with Generated **T**ests), a simple yet effective approach to empower large pre-trained language models for code generation, which could achieve surprising improvements over previous methods. For examp... | CodeT/CodeT/README.md/0 | {
"file_path": "CodeT/CodeT/README.md",
"repo_id": "CodeT",
"token_count": 2949
} | 210 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from collections import defaultdict, Counter
import logging
import math
logging.basicConfig(
format="SystemLog: [%(asctime)s][%(name)s][%(levelname)s] - %(message)s",
datefmt="%Y-%m-%d %H:%M:%S",
level=logging.INFO,
)
logger = logg... | CodeT/CodeT/src/agreement.py/0 | {
"file_path": "CodeT/CodeT/src/agreement.py",
"repo_id": "CodeT",
"token_count": 3811
} | 211 |
# RepoCoder: Repository-Level Code Completion Through Iterative Retrieval and Generation
# Overview
In the paper, we present **RepoCoder**, a simple, generic, and effective framework to tackle the repository-level code completion task, which is to continue writing the unfinished code based on a broader context of the... | CodeT/RepoCoder/README.md/0 | {
"file_path": "CodeT/RepoCoder/README.md",
"repo_id": "CodeT",
"token_count": 1968
} | 212 |
# Cognitive Service Powershell context
## Using Speech Synthesis
This project includes speech synthesized playback for your query outputs using the azure cognitive services speech cli. As noted in the previous section about contexts, this is a certain behavior of the model that is included in the sample `powershell-v... | Codex-CLI/contexts/CognitiveServiceContext.md/0 | {
"file_path": "Codex-CLI/contexts/CognitiveServiceContext.md",
"repo_id": "Codex-CLI",
"token_count": 565
} | 213 |
###
# PowerShell script to setup Codex CLI for PowerShell
###
param
(
[Parameter()]
[System.IO.FileInfo]
[ValidateScript( {
if (-Not ($_ | Test-Path) ) {
throw "Folder does not exist. Did you clone the Codex CLI repo?"
}
return $true
})]
[str... | Codex-CLI/scripts/powershell_setup.ps1/0 | {
"file_path": "Codex-CLI/scripts/powershell_setup.ps1",
"repo_id": "Codex-CLI",
"token_count": 1412
} | 214 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: large_face_list_face.py
Description: Large Face List Face section of the Cognitive Face API.
"""
from . import util
def add(image, large_face_list_id, user_data=None, target_face=None):
"""Add a face to a large face list.
The input face is specified as ... | Cognitive-Face-Python/cognitive_face/large_face_list_face.py/0 | {
"file_path": "Cognitive-Face-Python/cognitive_face/large_face_list_face.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 1976
} | 215 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: test_person_group.py
Description: Unittests for Person Group section of the Cognitive Face API.
"""
import uuid
import unittest
import cognitive_face as CF
from . import util
class TestPersonGroup(unittest.TestCase):
"""Unittests for Person Group section.... | Cognitive-Face-Python/cognitive_face/tests/test_person_group.py/0 | {
"file_path": "Cognitive-Face-Python/cognitive_face/tests/test_person_group.py",
"repo_id": "Cognitive-Face-Python",
"token_count": 894
} | 216 |
[nosetests]
exe=1
verbosity=2
| Cognitive-Face-Python/setup.cfg/0 | {
"file_path": "Cognitive-Face-Python/setup.cfg",
"repo_id": "Cognitive-Face-Python",
"token_count": 15
} | 217 |
DUMPY_STRING_FOR_EMPTY_ANS = "no answer"
| ContextualSP/adaptershare/data_utils/my_statics.py/0 | {
"file_path": "ContextualSP/adaptershare/data_utils/my_statics.py",
"repo_id": "ContextualSP",
"token_count": 19
} | 218 |
import os
import argparse
import random
from sys import path
path.append(os.getcwd())
from experiments.superglue.superglue_utils import save, TASKS, LOAD_FUNCS
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--data_dir', type=str, default='data directory')
parser.add_argument('--... | ContextualSP/adaptershare/experiments/superglue/superglue_fairseq.py/0 | {
"file_path": "ContextualSP/adaptershare/experiments/superglue/superglue_fairseq.py",
"repo_id": "ContextualSP",
"token_count": 862
} | 219 |
# coding=utf-8
# Copyright (c) Microsoft. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
class LayerNorm(nn.Module):
# ref: https://github.com/pytorch/pytorch/issues/1959
# :https://arxiv.org/pdf/1607.06450.pdf
def __init_... | ContextualSP/adaptershare/module/sub_layers.py/0 | {
"file_path": "ContextualSP/adaptershare/module/sub_layers.py",
"repo_id": "ContextualSP",
"token_count": 446
} | 220 |
#!/bin/bash
usage() {
echo "Usage: ${0} [-g|--gpu_num] [-o|--output_dir] [-m|--model_dir] [-tr|--train_datasets] [-te|--test_datasets] [-ls|--log_step] [-ss|--save_step]" 1>&2
exit 1
}
while [ $# -gt 0 ]
do
key=${1}
case ${key} in
-g|--gpu_num)
GPU_NUM=${2}
shift 2
;;
-o|--output_dir)... | ContextualSP/adaptershare/scripts/adapter_diff_train.sh/0 | {
"file_path": "ContextualSP/adaptershare/scripts/adapter_diff_train.sh",
"repo_id": "ContextualSP",
"token_count": 1092
} | 221 |
#!/bin/bash
set -e
set -x
SRCDIR=`dirname $0`
CODEDIR=`dirname $SRCDIR`
WORKDIR=`mktemp -d $SRCDIR/mt-dnn-tests-XXX`
mkdir -p $WORKDIR/mt_dnn_models
mkdir -p $WORKDIR/checkpoints
function delete {
rm -rf $1
}
# tests begin here
i=0
for hparams in "" ; do
# train
python $CODEDIR/train.py --data_dir ... | ContextualSP/adaptershare/tests/test.sh/0 | {
"file_path": "ContextualSP/adaptershare/tests/test.sh",
"repo_id": "ContextualSP",
"token_count": 680
} | 222 |
python eval.py \
--checkpoint checkpoints/wtq_grounding_model/model.pt \
--data_path data/wtq_grounding/dev \
--threshold 0.15
| ContextualSP/awakening_latent_grounding/eval_wtq_ground.sh/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/eval_wtq_ground.sh",
"repo_id": "ContextualSP",
"token_count": 55
} | 223 |
import os
import torch
import torch.nn as nn
from transformers import BertTokenizer, AdamW, get_linear_schedule_with_warmup
from models import *
from utils import *
from datetime import datetime
import logging
from dataclasses import dataclass, field
@dataclass
class TrainingArgs:
learning_rate: float = field(def... | ContextualSP/awakening_latent_grounding/train.py/0 | {
"file_path": "ContextualSP/awakening_latent_grounding/train.py",
"repo_id": "ContextualSP",
"token_count": 6300
} | 224 |
from .element_wise import ElementWiseMatrixAttention | ContextualSP/incomplete_utterance_rewriting/src/similar_functions/__init__.py/0 | {
"file_path": "ContextualSP/incomplete_utterance_rewriting/src/similar_functions/__init__.py",
"repo_id": "ContextualSP",
"token_count": 12
} | 225 |
from src.components.nl_modiifer import NLModifier
from src.components.question_generator import QuestionGenerator
| ContextualSP/interactive_text_to_sql/src/components/__init__.py/0 | {
"file_path": "ContextualSP/interactive_text_to_sql/src/components/__init__.py",
"repo_id": "ContextualSP",
"token_count": 31
} | 226 |
import io
vector_file_path = 'data/common/wiki-news-300d-1M-subword.vec'
def load_vectors(fname):
fin = io.open(fname, 'r', encoding='utf-8', newline='\n', errors='ignore')
n, d = map(int, fin.readline().split())
data = {}
for line in fin:
tokens = line.rstrip().split(' ')
data[tokens[... | ContextualSP/interactive_text_to_sql/src/utils/fasttext.py/0 | {
"file_path": "ContextualSP/interactive_text_to_sql/src/utils/fasttext.py",
"repo_id": "ContextualSP",
"token_count": 160
} | 227 |
import json
import sys
import copy
from itertools import combinations, permutations
from random import choice, choices, shuffle
import math
import argparse
from multiprocessing import Pool
import multiprocessing
from collections import Counter
from functools import reduce
from math import gcd
from random import sample
... | ContextualSP/lemon/corpus_generation/scene_corpus_generation.py/0 | {
"file_path": "ContextualSP/lemon/corpus_generation/scene_corpus_generation.py",
"repo_id": "ContextualSP",
"token_count": 3406
} | 228 |
import os
from collections import defaultdict, deque, OrderedDict
from contextlib import contextmanager
from os.path import join
import logging
import tensorflow as tf
import time
from keras import backend as K
class TensorDebugger(object):
"""Debug your TensorFlow model.
EXAMPLE BELOW:
tf.reset_defaul... | ContextualSP/lemon/executor/gtd/ml/utils.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/ml/utils.py",
"repo_id": "ContextualSP",
"token_count": 7407
} | 229 |
import pytest
from gtd.log import Metadata, SyncedMetadata
class TestMetadata(object):
@pytest.fixture
def m(self):
m = Metadata()
m['a'] = 10 # this is overwritten
m['b'] = 'test'
# namescope setitem
with m.name_scope('c'):
m['foo'] = 140
# nest... | ContextualSP/lemon/executor/gtd/tests/test_log.py/0 | {
"file_path": "ContextualSP/lemon/executor/gtd/tests/test_log.py",
"repo_id": "ContextualSP",
"token_count": 624
} | 230 |
import numpy as np
from collections import Sequence, Counter
from abc import ABCMeta, abstractmethod
from gtd.chrono import verboserate
from gtd.utils import flatten
from strongsup.parse_case import ParseCase, ParsePath
from strongsup.utils import epsilon_greedy_sample, softmax
from strongsup.utils import sample_wit... | ContextualSP/lemon/executor/strongsup/exploration_policy.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/exploration_policy.py",
"repo_id": "ContextualSP",
"token_count": 13697
} | 231 |
# from gtd.utils import cached_property
from strongsup.executor import Executor, Denotation
from strongsup.rlong.value import RLongStateValue
from strongsup.rlong.state import RLongObject
################################
# Denotation
class RLongDenotation(tuple, Denotation):
"""A pretty lightweight class repres... | ContextualSP/lemon/executor/strongsup/rlong/executor.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/rlong/executor.py",
"repo_id": "ContextualSP",
"token_count": 3694
} | 232 |
"""Generate predicates based on the context (utterance + graph)
- FuzzyMatchGenerator:
Generate predicates that fuzzily match an utterance span.
- NERValueGenerator:
Generate predicates from NER values (numbers, dates, etc.)
detected in the utterance
- FloatingPredicatesGenerator:
Generate predicates th... | ContextualSP/lemon/executor/strongsup/tables/predicates_computer.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/tables/predicates_computer.py",
"repo_id": "ContextualSP",
"token_count": 5837
} | 233 |
from gtd.utils import Bunch
from strongsup.example import Example, Context
from strongsup.experiment import example_to_supervised_cases
from strongsup.tests.utils import PredicateGenerator
from strongsup.utils import EOS
def test_example_to_supervised_cases():
class DummyTablePath(object):
graph = 'GRAPH... | ContextualSP/lemon/executor/strongsup/tests/test_experiment.py/0 | {
"file_path": "ContextualSP/lemon/executor/strongsup/tests/test_experiment.py",
"repo_id": "ContextualSP",
"token_count": 396
} | 234 |
import json
import random
import sys
from allennlp_reasoning_explainqa.common.constants import CORRECT_OPTION_TAG
from allennlp_reasoning_explainqa.training.metrics.confusion_matrix import (
F1MeasureCustomRetrievalEval,
)
from allennlp_reasoning_explainqa.training.metrics.explanation_eval import (
Explanation... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/eqasc/code/allennlp_reasoning_explainqa/evaluator/evaluator.py/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/eqasc/code/allennlp_reasoning_explainqa/evaluator/evaluator.py",
"repo_id": "ContextualSP",
"token_count": 1196
} | 235 |
from evaluation.metric import Metric
from evaluation.evaluation import Evaluation
| ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/evaluation/__init__.py/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/evaluation/__init__.py",
"repo_id": "ContextualSP",
"token_count": 17
} | 236 |
#!/bin/bash
set -euo pipefail
echo
echo --------------------------------
echo Building image
echo --------------------------------
echo
set -x
docker build -t propara-evaluator-local .
set +x
echo
echo --------------------------------
echo Running
echo --------------------------------
echo
set -x
T=$(mktemp -d... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/test-in-docker.sh/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/test-in-docker.sh",
"repo_id": "ContextualSP",
"token_count": 281
} | 237 |
## Test case: Too few predictions
* answers.tsv has answers to three processes.
* predictions.tsv has a prediction of one process.
An evaluation on this prediction should abort.
| ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/testfiles-5/README.md/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/propara/evaluator/testfiles-5/README.md",
"repo_id": "ContextualSP",
"token_count": 44
} | 238 |
## TRACIE Evaluator
This script evaluates NLI predictions against correct inferences and produces 4 accuracy scores described below, and can be used to check that outputs produced for the leaderboard are well formed.
## Example
```sh
% python3 evaluator/evaluator.py --question_answers data/train_uniform.jsonl --pre... | ContextualSP/lemon/propara_evaluator/aristo-leaderboard/tracie/evaluator/README.md/0 | {
"file_path": "ContextualSP/lemon/propara_evaluator/aristo-leaderboard/tracie/evaluator/README.md",
"repo_id": "ContextualSP",
"token_count": 455
} | 239 |
if [ -d "./bookcorpus_conclusion" ]
then
rm -r ./bookcorpus_conclusion
fi
mkdir ./bookcorpus_conclusion
python conclusion_corpus_construction.py --start 0 --end 500 &
python conclusion_corpus_construction.py --start 500 --end 1000 &
python conclusion_corpus_construction.py --start 1000 --end 1500 &
python conclus... | ContextualSP/logigan/corpus_construction/mlm_corpus/construct_conclusion.sh/0 | {
"file_path": "ContextualSP/logigan/corpus_construction/mlm_corpus/construct_conclusion.sh",
"repo_id": "ContextualSP",
"token_count": 817
} | 240 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification, AutoConfig
import torch
import torch.nn as nn
from copy import deepcopy
from collections import Counter
from datasets import Dataset, load_dataset
import numpy as np
from transformers import Trainer, TrainingArguments
from torch.nn.functional i... | ContextualSP/logigan/pre-training/verifier_multi_es.py/0 | {
"file_path": "ContextualSP/logigan/pre-training/verifier_multi_es.py",
"repo_id": "ContextualSP",
"token_count": 3015
} | 241 |
recursive-include matchzoo/datasets/toy *
| ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/MANIFEST.in/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/MANIFEST.in",
"repo_id": "ContextualSP",
"token_count": 16
} | 242 |
import typing
import matchzoo as mz
from .preparer import Preparer
from matchzoo.engine.base_task import BaseTask
from matchzoo.engine.base_model import BaseModel
from matchzoo.engine.base_callback import BaseCallback
from matchzoo.engine.base_preprocessor import BasePreprocessor
def prepare(
task: BaseTask,
... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/auto/preparer/prepare.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/auto/preparer/prepare.py",
"repo_id": "ContextualSP",
"token_count": 636
} | 243 |
"""A basic class representing a Dataset."""
import typing
import math
from collections import Iterable
import numpy as np
import pandas as pd
from torch.utils import data
import matchzoo as mz
from matchzoo.engine.base_callback import BaseCallback
class Dataset(data.IterableDataset):
"""
Dataset that is bui... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/dataloader/dataset.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/dataloader/dataset.py",
"repo_id": "ContextualSP",
"token_count": 4624
} | 244 |
"""SNLI data loader."""
import typing
from pathlib import Path
import pandas as pd
import matchzoo
from matchzoo.engine.base_task import BaseTask
_url = "https://nlp.stanford.edu/projects/snli/snli_1.0.zip"
def load_data(
stage: str = 'train',
task: typing.Union[str, BaseTask] = 'classification',
targ... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/datasets/snli/load_data.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/datasets/snli/load_data.py",
"repo_id": "ContextualSP",
"token_count": 1427
} | 245 |
"""Hyper parameter search spaces wrapping `hyperopt`."""
import typing
import numbers
import hyperopt
import hyperopt.pyll.base
class HyperoptProxy(object):
"""
Hyperopt proxy class.
See `hyperopt`'s documentation for more details:
https://github.com/hyperopt/hyperopt/wiki/FMin
Reason of these ... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/engine/hyper_spaces.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/engine/hyper_spaces.py",
"repo_id": "ContextualSP",
"token_count": 2925
} | 246 |
from .dense_baseline import DenseBaseline
from .dssm import DSSM
from .cdssm import CDSSM
from .drmm import DRMM
from .drmmtks import DRMMTKS
from .esim import ESIM
from .knrm import KNRM
from .conv_knrm import ConvKNRM
from .bimpm import BiMPM
from .matchlstm import MatchLSTM
from .arci import ArcI
from .arcii import ... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/__init__.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/__init__.py",
"repo_id": "ContextualSP",
"token_count": 261
} | 247 |
"""An implementation of HBMP Model."""
import typing
import copy
import torch
import torch.nn as nn
from matchzoo.engine import hyper_spaces
from matchzoo.engine.param_table import ParamTable
from matchzoo.engine.param import Param
from matchzoo.engine.base_model import BaseModel
class HBMP(BaseModel):
"""
... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/hbmp.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/models/hbmp.py",
"repo_id": "ContextualSP",
"token_count": 2187
} | 248 |
from .unit import Unit
class Lowercase(Unit):
"""Process unit for text lower case."""
def transform(self, input_: list) -> list:
"""
Convert list of tokens to lower case.
:param input_: list of tokens.
:return tokens: lower-cased list of tokens.
"""
return [t... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/lowercase.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/preprocessors/units/lowercase.py",
"repo_id": "ContextualSP",
"token_count": 135
} | 249 |
from .trainer import Trainer
| ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/trainers/__init__.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/matchzoo/trainers/__init__.py",
"repo_id": "ContextualSP",
"token_count": 7
} | 250 |
import shutil
import pandas as pd
import pytest
from matchzoo import DataPack, load_data_pack
@pytest.fixture
def data_pack():
relation = [['qid0', 'did0', 1], ['qid1', 'did1', 0]]
left = [['qid0', [1, 2]], ['qid1', [2, 3]]]
right = [['did0', [2, 3, 4]], ['did1', [3, 4, 5]]]
relation = pd.DataFrame(... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/data_pack/test_datapack.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/data_pack/test_datapack.py",
"repo_id": "ContextualSP",
"token_count": 581
} | 251 |
import torch
import pytest
from pathlib import Path
import shutil
import matchzoo as mz
@pytest.fixture(scope='module')
def task():
return mz.tasks.Ranking(losses=mz.losses.RankCrossEntropyLoss())
@pytest.fixture(scope='module')
def train_raw(task):
return mz.datasets.toy.load_data('train', task)[:10]
@p... | ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/trainer/test_trainer.py/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tests/trainer/test_trainer.py",
"repo_id": "ContextualSP",
"token_count": 1046
} | 252 |
<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/init.ipynb/0 | {
"file_path": "ContextualSP/poset_decoding/traversal_path_prediction/MatchZoo-py/tutorials/ranking/init.ipynb",
"repo_id": "ContextualSP",
"token_count": 347
} | 253 |
#!/usr/bin/env bash
export seed=1
export config_file=train_configs/concat.none.jsonnet
export model_file=checkpoints_cosql/cosql_concat_none_model
export tables_file=dataset_cosql/tables.json
export database_path=dataset_cosql/database
export dataset_path=dataset_cosql
export train_data_path=dataset_cosql/train.json
ex... | ContextualSP/semantic_parsing_in_context/bash_files/linux/train_cosql.bash/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/bash_files/linux/train_cosql.bash",
"repo_id": "ContextualSP",
"token_count": 367
} | 254 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
"""
Mainly borrowed from `allennlp.data.fields.knowledge_graph_filed.py`
############################################################
# NOTICE #
# we maintain this file for not sorting the enti... | ContextualSP/semantic_parsing_in_context/context/knowledge_graph_filed.py/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/context/knowledge_graph_filed.py",
"repo_id": "ContextualSP",
"token_count": 856
} | 255 |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Any, Dict, List, Sequence, Tuple
import torch
from context.copy_production_rule_field import CopyProductionRule
from allennlp.state_machines.states.state import State
from models.states_machine.grammar_state_let import Grammar... | ContextualSP/semantic_parsing_in_context/models/states_machine/grammar_based_state.py/0 | {
"file_path": "ContextualSP/semantic_parsing_in_context/models/states_machine/grammar_based_state.py",
"repo_id": "ContextualSP",
"token_count": 3754
} | 256 |
# 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.
from typing import Dict, List
try:
import marisa_trie
except ModuleNotFoundError:
pass
class Trie(object... | ContextualSP/unified_parser_text_to_sql/genre/trie.py/0 | {
"file_path": "ContextualSP/unified_parser_text_to_sql/genre/trie.py",
"repo_id": "ContextualSP",
"token_count": 2933
} | 257 |
import os
import json
import argparse
import subprocess
from tqdm import tqdm
from step1_schema_linking import read_database_schema
from train import run_command
def running_process(generate_path):
# cmd = f"python -m multiprocessing_bpe_encoder \
# --encoder-json ./models/spider_sl/encoder.json \
... | ContextualSP/unified_parser_text_to_sql/step2_serialization.py/0 | {
"file_path": "ContextualSP/unified_parser_text_to_sql/step2_serialization.py",
"repo_id": "ContextualSP",
"token_count": 3372
} | 258 |
SUPERNET:
MLP_RATIO: 4.0
NUM_HEADS: 10
EMBED_DIM: 640
DEPTH: 16
SEARCH_SPACE:
MLP_RATIO:
- 3.0
- 3.5
- 4.0
NUM_HEADS:
- 8
- 9
- 10
DEPTH:
- 14
- 15
- 16
EMBED_DIM:
- 528
- 576
- 624
RETRAIN:
MLP_RATIO:
- 3.5
- 3.5
- 4.0
- 3.5
- 4.0
... | Cream/AutoFormer/experiments/subnet/AutoFormer-B.yaml/0 | {
"file_path": "Cream/AutoFormer/experiments/subnet/AutoFormer-B.yaml",
"repo_id": "Cream",
"token_count": 398
} | 259 |
import torch
from torch import nn
from torch.nn import Parameter
import torch.nn.functional as F
from .Linear_super import LinearSuper
from .qkv_super import qkv_super
from ..utils import trunc_normal_
def softmax(x, dim, onnx_trace=False):
if onnx_trace:
return F.softmax(x.float(), dim=dim)
else:
... | Cream/AutoFormer/model/module/multihead_super.py/0 | {
"file_path": "Cream/AutoFormer/model/module/multihead_super.py",
"repo_id": "Cream",
"token_count": 3598
} | 260 |
# CyDAS Detection Code Base
### Environments
- Python 3.7
- Pytorch>=1.8.2
- Torchvision == 0.9.2
You can directly run the code ```sh env.sh``` and ```sh compile.sh``` to setup the running environment.
We use 8 GPUs (24GB RTX 3090) to train our detector, you can adjust the batch size in configs by yourselves.
### Da... | Cream/CDARTS/CDARTS_detection/README.md/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/README.md",
"repo_id": "Cream",
"token_count": 458
} | 261 |
import yaml
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
from .base import BaseFileHandler # isort:skip
class YamlHandler(BaseFileHandler):
def load_from_fileobj(self, file, **kwargs):
kwargs.setdefault('Loader', Loader)
... | Cream/CDARTS/CDARTS_detection/mmcv/fileio/handlers/yaml_handler.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/fileio/handlers/yaml_handler.py",
"repo_id": "Cream",
"token_count": 256
} | 262 |
import torch
import torch.distributed as dist
import torch.nn as nn
from torch._utils import (_flatten_dense_tensors, _take_tensors,
_unflatten_dense_tensors)
from .scatter_gather import scatter_kwargs
class MMDistributedDataParallel(nn.Module):
def __init__(self, module, dim=0, broadc... | Cream/CDARTS/CDARTS_detection/mmcv/parallel/distributed.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/parallel/distributed.py",
"repo_id": "Cream",
"token_count": 1000
} | 263 |
import torch
from .hook import Hook
class EmptyCacheHook(Hook):
def __init__(self, before_epoch=False, after_epoch=True, after_iter=False):
self._before_epoch = before_epoch
self._after_epoch = after_epoch
self._after_iter = after_iter
def after_iter(self, runner):
if self._... | Cream/CDARTS/CDARTS_detection/mmcv/runner/hooks/memory.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/runner/hooks/memory.py",
"repo_id": "Cream",
"token_count": 258
} | 264 |
import os.path as osp
from collections import OrderedDict
import cv2
from mmcv.opencv_info import USE_OPENCV2
from mmcv.utils import (check_file_exist, mkdir_or_exist, scandir,
track_progress)
if not USE_OPENCV2:
from cv2 import (CAP_PROP_FRAME_WIDTH, CAP_PROP_FRAME_HEIGHT, CAP_PROP_FPS,
... | Cream/CDARTS/CDARTS_detection/mmcv/video/io.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmcv/video/io.py",
"repo_id": "Cream",
"token_count": 5118
} | 265 |
import torch
class AssignResult(object):
def __init__(self, num_gts, gt_inds, max_overlaps, labels=None):
self.num_gts = num_gts
self.gt_inds = gt_inds
self.max_overlaps = max_overlaps
self.labels = labels
def add_gt_(self, gt_labels):
self_inds = torch.arange(
... | Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/assigners/assign_result.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/bbox/assigners/assign_result.py",
"repo_id": "Cream",
"token_count": 333
} | 266 |
import numpy as np
def bbox_overlaps(bboxes1, bboxes2, mode='iou'):
"""Calculate the ious between each bbox of bboxes1 and bboxes2.
Args:
bboxes1(ndarray): shape (n, 4)
bboxes2(ndarray): shape (k, 4)
mode(str): iou (intersection over union) or iof (intersection
over foregr... | Cream/CDARTS/CDARTS_detection/mmdet/core/evaluation/bbox_overlaps.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/evaluation/bbox_overlaps.py",
"repo_id": "Cream",
"token_count": 826
} | 267 |
from .dist_utils import allreduce_grads, DistOptimizerHook, DistOptimizerArchHook
from .misc import tensor2imgs, unmap, multi_apply
__all__ = [
'allreduce_grads', 'DistOptimizerHook', 'tensor2imgs', 'unmap',
'multi_apply', 'DistOptimizerArchHook'
]
| Cream/CDARTS/CDARTS_detection/mmdet/core/utils/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/core/utils/__init__.py",
"repo_id": "Cream",
"token_count": 103
} | 268 |
import mmcv
from ..registry import PIPELINES
from .compose import Compose
@PIPELINES.register_module
class MultiScaleFlipAug(object):
def __init__(self, transforms, img_scale, flip=False):
self.transforms = Compose(transforms)
self.img_scale = img_scale if isinstance(img_scale, list) else [img_s... | Cream/CDARTS/CDARTS_detection/mmdet/datasets/pipelines/test_aug.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/datasets/pipelines/test_aug.py",
"repo_id": "Cream",
"token_count": 588
} | 269 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import normal_init
from mmdet.core import delta2bbox
from mmdet.ops import nms
from .anchor_head import AnchorHead
from ..registry import HEADS
@HEADS.register_module
class RPNHead(AnchorHead):
def __init__(self, in_channels, **kwa... | Cream/CDARTS/CDARTS_detection/mmdet/models/anchor_heads/rpn_head.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/anchor_heads/rpn_head.py",
"repo_id": "Cream",
"token_count": 2356
} | 270 |
import logging
import torch
import torch.nn as nn
import torch.utils.checkpoint as cp
from torch.nn.modules.batchnorm import _BatchNorm
from mmcv.cnn import constant_init, kaiming_init
# from mmcv.runner import load_checkpoint
from mmdet.ops import DeformConv, ModulatedDeformConv, ContextBlock
from mmdet.models.plug... | Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/resnet.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/backbones/resnet.py",
"repo_id": "Cream",
"token_count": 15964
} | 271 |
import torch
from mmdet.core import bbox2roi, build_assigner, build_sampler
from ..registry import DETECTORS
from .two_stage import TwoStageDetector
@DETECTORS.register_module
class DoubleHeadRCNN(TwoStageDetector):
def __init__(self, reg_roi_scale_factor, cls_roi_scale_factor=None, **kwargs):
super()._... | Cream/CDARTS/CDARTS_detection/mmdet/models/detectors/double_head_rcnn.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/detectors/double_head_rcnn.py",
"repo_id": "Cream",
"token_count": 4788
} | 272 |
import torch
import torch.nn as nn
import torch.nn.functional as F
from .utils import weight_reduce_loss
from ..registry import LOSSES
def cross_entropy(pred, label, weight=None, reduction='mean', avg_factor=None):
# element-wise losses
loss = F.cross_entropy(pred, label, reduction='none')
# apply weigh... | Cream/CDARTS/CDARTS_detection/mmdet/models/losses/cross_entropy_loss.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/losses/cross_entropy_loss.py",
"repo_id": "Cream",
"token_count": 1550
} | 273 |
# --------------------------------------------------------
# Copyright (c) 2019 Jianyuan Guo (guojianyuan1@huawei.com)
# --------------------------------------------------------
import torch
import torch.nn as nn
import torch.nn.functional as F
from .hit_ops import OPS
PRIMITIVES = [
'conv_1x1',
'ir_k3_e6_d3'... | Cream/CDARTS/CDARTS_detection/mmdet/models/necks/auto_neck/hit_neck_search.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/necks/auto_neck/hit_neck_search.py",
"repo_id": "Cream",
"token_count": 882
} | 274 |
from .conv_ws import conv_ws_2d, ConvWS2d
from .conv_module import build_conv_layer, ConvModule
from .norm import build_norm_layer
from .scale import Scale
from .weight_init import (xavier_init, normal_init, uniform_init, kaiming_init,
bias_init_with_prob)
__all__ = [
'conv_ws_2d', 'ConvW... | Cream/CDARTS/CDARTS_detection/mmdet/models/utils/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/models/utils/__init__.py",
"repo_id": "Cream",
"token_count": 204
} | 275 |
// modify from
// https://github.com/chengdazhi/Deformable-Convolution-V2-PyTorch/blob/mmdetection/mmdet/ops/dcn/src/deform_conv_cuda.c
#include <torch/extension.h>
#include <cmath>
#include <vector>
void deformable_im2col(const at::Tensor data_im, const at::Tensor data_offset,
const int chann... | Cream/CDARTS/CDARTS_detection/mmdet/ops/dcn/src/deform_conv_cuda.cpp/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/dcn/src/deform_conv_cuda.cpp",
"repo_id": "Cream",
"token_count": 12775
} | 276 |
import os.path as osp
from setuptools import setup, Extension
import numpy as np
from Cython.Build import cythonize
from Cython.Distutils import build_ext
from torch.utils.cpp_extension import BuildExtension, CUDAExtension
ext_args = dict(
include_dirs=[np.get_include()],
language='c++',
extra_compile_arg... | Cream/CDARTS/CDARTS_detection/mmdet/ops/nms/setup.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/nms/setup.py",
"repo_id": "Cream",
"token_count": 1084
} | 277 |
from .functions.roi_pool import roi_pool
from .modules.roi_pool import RoIPool
__all__ = ['roi_pool', 'RoIPool']
| Cream/CDARTS/CDARTS_detection/mmdet/ops/roi_pool/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/roi_pool/__init__.py",
"repo_id": "Cream",
"token_count": 45
} | 278 |
// modify from
// https://github.com/facebookresearch/maskrcnn-benchmark/blob/master/maskrcnn_benchmark/csrc/cuda/SigmoidFocalLoss_cuda.cu
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
// This file is modified from
// https://github.com/pytorch/pytorch/blob/master/modules/detectron/sigmoid_f... | Cream/CDARTS/CDARTS_detection/mmdet/ops/sigmoid_focal_loss/src/sigmoid_focal_loss_cuda.cu/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/mmdet/ops/sigmoid_focal_loss/src/sigmoid_focal_loss_cuda.cu",
"repo_id": "Cream",
"token_count": 3155
} | 279 |
import argparse
from mmcv import Config
from mmdet.models import build_detector
from mmdet.utils import get_model_complexity_info
def parse_args():
parser = argparse.ArgumentParser(description='Train a detector')
parser.add_argument('config', help='train config file path')
parser.add_argument(
'... | Cream/CDARTS/CDARTS_detection/tools/get_flops.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_detection/tools/get_flops.py",
"repo_id": "Cream",
"token_count": 582
} | 280 |
import torch.utils.data as data
class CombineDBs(data.Dataset):
NUM_CLASSES = 21
def __init__(self, dataloaders, excluded=None):
self.dataloaders = dataloaders
self.excluded = excluded
self.im_ids = []
# Combine object lists
for dl in dataloaders:
for elem ... | Cream/CDARTS/CDARTS_segmentation/dataloaders/datasets/combine_dbs.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/dataloaders/datasets/combine_dbs.py",
"repo_id": "Cream",
"token_count": 1685
} | 281 |
from .default import _C as config
from .default import update_config
seg_config = config
update_seg_config = update_config | Cream/CDARTS/CDARTS_segmentation/segmentation/config/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/config/__init__.py",
"repo_id": "Cream",
"token_count": 34
} | 282 |
from .aspp import ASPP
from .deeplabv3 import DeepLabV3Decoder
from .deeplabv3plus import DeepLabV3PlusDecoder
from .panoptic_deeplab import PanopticDeepLabDecoder
| Cream/CDARTS/CDARTS_segmentation/segmentation/model/decoder/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/model/decoder/__init__.py",
"repo_id": "Cream",
"token_count": 61
} | 283 |
# ------------------------------------------------------------------------------
# Post-processing to get semantic segmentation results.
# Written by Bowen Cheng (bcheng9@illinois.edu)
# ------------------------------------------------------------------------------
import torch
__all__ = ['get_semantic_segmentation']... | Cream/CDARTS/CDARTS_segmentation/segmentation/model/post_processing/semantic_post_processing.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/segmentation/model/post_processing/semantic_post_processing.py",
"repo_id": "Cream",
"token_count": 284
} | 284 |
from .cityscapes import Cityscapes
from .bdd import BDD
from .coco import COCO
from .camvid import CamVid
__all__ = ['Cityscapes', 'BDD', 'CamVid', 'COCO']
| Cream/CDARTS/CDARTS_segmentation/tools/datasets/__init__.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/tools/datasets/__init__.py",
"repo_id": "Cream",
"token_count": 61
} | 285 |
from collections import namedtuple
Genotype = namedtuple('Genotype', 'normal normal_concat reduce reduce_concat')
PRIMITIVES = [
'skip',
'conv',
'conv_downup',
'conv_2x_downup',
'sa',
]
# 'conv_2x', | Cream/CDARTS/CDARTS_segmentation/train/genotypes.py/0 | {
"file_path": "Cream/CDARTS/CDARTS_segmentation/train/genotypes.py",
"repo_id": "Cream",
"token_count": 94
} | 286 |
## Environment Setup
Tesla V100, CUDA10.0, linux 16.04, pytorch>=1.2, python3, [apex](https://github.com/NVIDIA/apex)
### Data Preparation
* [Cifar-10](https://www.cs.toronto.edu/~kriz/cifar.html)
* [Cifar-100](https://www.cs.toronto.edu/~kriz/cifar.html)
* [ImageNet-2012](http://www.image-net.org/)
Create soft link... | Cream/CDARTS/SETUP.md/0 | {
"file_path": "Cream/CDARTS/SETUP.md",
"repo_id": "Cream",
"token_count": 2025
} | 287 |
""" CNN cell for architecture search """
import torch
import torch.nn as nn
from copy import deepcopy
from models.ops import ResNetBasicblock, OPS, NAS_BENCH_201
from utils.genotypes import Structure
# This module is used for NAS-Bench-201, represents a small search space with a complete DAG
class SearchCell(nn.Module... | Cream/CDARTS/benchmark201/models/search_cells.py/0 | {
"file_path": "Cream/CDARTS/benchmark201/models/search_cells.py",
"repo_id": "Cream",
"token_count": 2072
} | 288 |
import torch
import torch.nn as nn
from lib.utils import utils
from lib.models.loss import Loss_interactive
def search(train_loader, valid_loader, model, optimizer, w_optim, alpha_optim, layer_idx, epoch, writer, logger, config):
# interactive retrain and kl
device = torch.device("cuda")
criterion = nn.Cr... | Cream/CDARTS/lib/core/search_function.py/0 | {
"file_path": "Cream/CDARTS/lib/core/search_function.py",
"repo_id": "Cream",
"token_count": 5370
} | 289 |
graphviz
torch==1.2
torchvision==0.2
tensorboard
tensorboardX | Cream/CDARTS/requirements/0 | {
"file_path": "Cream/CDARTS/requirements",
"repo_id": "Cream",
"token_count": 27
} | 290 |
AUTO_RESUME: False
DATA_DIR: './data/imagenet'
MODEL: '600m_retrain'
RESUME_PATH: './experiments/workspace/retrain/resume.pth.tar'
SAVE_PATH: './experiments/workspace/retrain'
SEED: 42
LOG_INTERVAL: 50
RECOVERY_INTERVAL: 0
WORKERS: 4
NUM_GPU: 2
SAVE_IMAGES: False
AMP: False
OUTPUT: 'None'
EVAL_METRICS: 'prec1'
TTA: 0
L... | Cream/Cream/experiments/configs/retrain/retrain.yaml/0 | {
"file_path": "Cream/Cream/experiments/configs/retrain/retrain.yaml",
"repo_id": "Cream",
"token_count": 452
} | 291 |
from copy import deepcopy
from lib.utils.builder_util import modify_block_args
from lib.models.blocks import get_Bottleneck, InvertedResidual
from timm.models.efficientnet_blocks import *
# SuperNet Builder definition.
class SuperNetBuilder:
""" Build Trunk Blocks
"""
def __init__(
self,
... | Cream/Cream/lib/models/builders/build_supernet.py/0 | {
"file_path": "Cream/Cream/lib/models/builders/build_supernet.py",
"repo_id": "Cream",
"token_count": 5205
} | 292 |
# model settings
model = dict(
type='CascadeRCNN',
pretrained=None,
backbone=dict(
type='SwinTransformer',
embed_dim=96,
depths=[2, 2, 6, 2],
num_heads=[3, 6, 12, 24],
window_size=7,
mlp_ratio=4.,
qkv_bias=True,
qk_scale=None,
drop_rate... | Cream/EfficientViT/downstream/configs/_base_/models/cascade_mask_rcnn_swin_fpn.py/0 | {
"file_path": "Cream/EfficientViT/downstream/configs/_base_/models/cascade_mask_rcnn_swin_fpn.py",
"repo_id": "Cream",
"token_count": 4748
} | 293 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.