sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5cdddc6fa4baeb357b2b294d1e39560644517c0714f0d4ec3e68e6166ae23853
Python
4,511
121
from copy import copy, deepcopy from transformers import TrainingArguments import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN_Over_BERT from config_path import LOG_PAT...
3ecf0c6204faf498c1e9b26f90688df5d97979b48c332d04ba2d54f47052dc27
Python
4,513
121
from copy import copy, deepcopy from transformers import TrainingArguments import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN_Over_BERT from config_path import LOG_PAT...
a0e94064bb58747593f721e2081a74d3d029b95dbc970490dd7c395dc8cc67d0
Python
4,525
175
# Copyright (C) 2022-2025 ETH Zurich, Niels Maeder and other DASH contributors. import os import pytest from numpy import allclose, array_equal from openff.toolkit.topology import Molecule from openff.toolkit.typing.engines.smirnoff import ( ElectrostaticsHandler, ForceField, LibraryChargeHandler, vdW...
d0779928bf712cfb5a78e4a10697387b69aa812bfa44644f1d28d79ff99f2e49
Python
4,526
156
import tensorflow as tf import tensorflow_datasets as tfds from tensorflow.keras.models import load_model from gradient_accumulator import GradientAccumulateModel from gradient_accumulator.layers import AccumBatchNormalization import random as python_random import numpy as np import os def normalize_img(image, label)...
d48056ebc271b7ebed8e652341ad66b2b1144877192b12c63c1428f1fb42455f
Python
4,532
123
# -*- coding: utf-8 -*- """ Created on Mon Oct 18 21:50:08 2021 @author: fhu14 """ import json, os from typing import Dict def assert_unique_keys(d: Dict) -> bool: r"""Checks that for a settings file, all the dictionary keys are unique under each section (no duplicates). Arguments: d (D...
dbd50113bdf77d9bce76bf55186a0b4ef5a616ce6178b5dd10988fc11917c1ee
Python
4,534
107
import torch from torch import nn try: from fedml_core.trainer.model_trainer import ModelTrainer except ImportError: from FedML.fedml_core.trainer.model_trainer import ModelTrainer class MyModelTrainer(ModelTrainer): def get_model_params(self): return self.model.cpu().state_dict() def set_mo...
f1de7da6625200866343cf8487c37100f53e8866f49e6869ca43a33cc1646f91
Python
4,539
116
# Copyright (c) OpenMMLab. All rights reserved. from abc import ABCMeta, abstractmethod from mmcv.runner import BaseModule class BaseMaskHead(BaseModule, metaclass=ABCMeta): """Base class for mask heads used in One-Stage Instance Segmentation.""" def __init__(self, init_cfg): super(BaseMaskHead, sel...
8a6017910fdbeea7eb3a2c73211d460dfa85c987958bead99428513281ce9957
Python
4,545
172
import errno import os from neuron import h def mkdir_p(path): try: os.makedirs(path) except OSError as exc: # Python >2.5 if exc.errno == errno.EEXIST and os.path.isdir(path): pass else: raise def voltageout(foldername, recordlist): for vec in recordlist...
592d18c0f2982d746aae39cbcc6311018fe2b79bfcd70a647f373e0ac617abe9
Python
4,547
151
#!usr/bin/env python #coding:utf-8 """ @author: Haidong Zhang @contact: haidong_zhang14@yahoo.com @time: 2020/12/10 16:02 @project: MalariaDetection @description: """ from keras.layers import * #For adding convolutional layer from keras.layers import Dense, ZeroPadding2D, BatchNormalization, Activati...
5316c32c5b33d37ded51e9f72bca4649c2d86a51220cfa1eaff90caaa204379e
Python
4,552
134
import os import shutil import glob # import collections # import random import pickle # import logging from skimage.transform import resize # from collections import OrderedDict import numpy as np import torch def transform_list_to_tensor(model_params_list): for net in model_params_list.keys(): for k i...
026d1c8a0ee9bc63dc02436a47965dcd7422be9bc1c1e3445fefe12d7b335d5f
Python
4,553
145
import numpy as np import argparse import importlib import os from datetime import datetime import json import glob import sys from sklearn.metrics import confusion_matrix from sklearn.metrics import roc_curve, auc from sklearn.metrics import classification_report import pandas as pd import matplotlib as mpl mpl.use...
63a9f61043c716740578af64b3de1492288aa4eebec53057c4d6993e8ca384c8
Python
4,554
138
import subprocess def run(cmd, max_minutes = 6000): import time sys.stderr.write("Running cmd: %s\n"%cmd) p = subprocess.Popen(cmd , shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subproc...
10e791d859cfa2ce33a2b8e7e3cb406e905175e813c740692fd119ed569e2ebd
Python
4,556
117
import os import shutil import sys from pathlib import Path import matplotlib.pyplot as plt import numpy import numpy as np from keract import get_activations from tensorflow.keras import Input from tensorflow.keras.callbacks import Callback from tensorflow.keras.layers import Dense, Dropout, LSTM from tensorflow.kera...
bdd4ddc3dc18332c1ffab6306f9d6d818b6fb9194b97381981d188d6af58ef16
Python
4,561
155
import argparse import logging import os import time from pathlib import Path from typing import List, Union import numpy as np import pandas as pd from tools.utils import calculate_design_score os.makedirs('logs', exist_ok=True) logging.basicConfig( format='%(asctime)s - %(levelname)s - %(message)s', datefm...
d51eb310a783dd383dcc1609bd5b21269a349d8ff33007c3797ae9ca4f4d4c87
Python
4,566
118
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn from mmcv.cnn import ConvModule, bias_init_with_prob, normal_init from ..builder import HEADS from .anchor_head import AnchorHead @HEADS.register_module() class RetinaSepBNHead(AnchorHead): """"RetinaHead with separate BN. In RetinaHead, ...
bc9949c477af91bf2ee1e3dc85b7e6a0afdb2238410c23a08b79d0596042495c
Python
4,570
122
from copy import copy, deepcopy from transformers import TrainingArguments import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN_Over_BERT from config_path import LOG_PAT...
c80376a01e1a903b295737b83ad6fdee16826df184e8453c04d3e6516d161d58
Python
4,570
136
from .MUSIC_block import MUSIC import numpy as np from scipy.linalg import svdvals from scipy import linalg class TOPS(MUSIC): """ Class to apply Test of Orthogonality of Projected Subspaces [TOPS]_ for Direction of Arrival (DoA) estimation. .. note:: Run locate_source() to apply the TOPS algorithm. ...
1f16eabae5e8de6964bc7c3ce76215f1daafcdb52daeb1987d7d38abf1cbe6f6
Python
4,574
130
import torch.nn as nn import torch.nn.functional as F class ConvLayer(nn.Module): def __init__(self, c_in): super(ConvLayer, self).__init__() self.downConv = nn.Conv1d(in_channels=c_in, out_channels=c_in, kernel_size=3, ...
2e5717dc3af5f65a41af8201bd1302118e56839aa2d141c2de6b65eccc7b4aee
Python
4,577
104
import os import os.path as osp import sys import time import argparse import pandas as pd from tqdm import tqdm import torch from graphrepr.explain.gnnexplainer import GNNExplainer from graphrepr.explain.utils import get_configs, get_data_and_parts, get_all_subfolders, make_directory from graphrepr.explain.torchutil...
0a3dd93f118a400712f7f02d26c184056e9647585edf072bdf12e40a86177754
Python
4,590
95
random_seed = 234 from utils.rnd import set_random_seeds set_random_seeds(random_seed = random_seed) from pipeline.crossvalidation_pipeline import CrossvalidationPipeline from pipeline.one_split import OneSplitPipeline from utils.logs import set_logging import logging import datetime import imp import os import sys ...
49968a90eb88c69cfed0a89a6d0cf5276c22aac297ecfcc842971fbf4690b197
Python
4,590
116
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org # Distributed under the MIT License. # (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT) from torchmdnet.priors.base import BasePrior from typing import Optional, Dict import torch from torch import nn, Tenso...
60f9188ad679dce7a4419442cb3384b2554ad7b30bfa3780bc53ca97ea0c5cc2
Python
4,590
139
import numpy as np import cv2 import torch import timm from torchvision import transforms from PIL import Image class FeatureExtractor: def __init__(self, device=None): print("Loading feature extractor (prov-gigapath)...") # --- Device --- if device is None: self.device = tor...
19d3fac6802f9e9318a93cbee1166c7171545012658ec04a3f0d0a46ba0218c8
Python
4,591
143
import math import torch from torch import nn from torchvision import transforms from pl_bolts.transforms.dataset_normalizations import ( imagenet_normalization ) import monai from monai.transforms import ( EnsureChannelFirst, Compose, RandFlip, RandRotate, SpatialPad, RandSpatia...
1cb0af197dea150702731033f6b43c1d51e50b2a148a6a4cdf4ed9fb8545970c
Python
4,591
114
import torch import torch.nn as nn import torch.nn.functional as F from torchmdnet.models.energy_correction.functional import softplus_inverse class ZBLRepulsionEnergy(nn.Module): """ Short-range repulsive potential with learnable parameters inspired by the Ziegler-Biersack-Littmark (ZBL) potential descri...
a02dfb850022d14303f52a5bea65f87f7ff8bd3ad4766d06aa42eb128af1b255
Python
4,591
91
# ----------------------------------------------------------------------- # # Copyright (c) 2023, UChicago Argonne, LLC. All rights reserved. # # # # Software Name: Fast Autonomous Scanning Toolkit (FAST) # # By: Argonne Na...
a4bbd21109429fd0e0dcb9768495abc3d72ca55eeeba1eab449a1bf8a0db9d34
Python
4,594
121
import pandas as pd import numpy as np from sklearn import linear_model import os import sys dir, filename = os.path.split(os.path.abspath(__file__)) HOME = os.path.split(dir)[0] def _is_upper(string): return string == string.upper() def count_cancer(name, df=None): if type(df) == pd.DataFrame: tmp = ...
b5871c5499deab68a8918393ad5a8367bd6913ae1cfeb910b6a38463db3140b3
Python
4,594
107
import logging import os from .data_utility import count_samples from fedml_api.data_preprocessing.exp2_path import my_transforms from .base_data_loader import BaseDataLoader from .Nuclei_seg_dataset import NucleiSegTrainDataset, NucleiSegTestDataset logging.basicConfig() logger = logging.getLogger() logger.setLeve...
fad58481e07c1e92bdc68cbc7c466bf1aeb265bcb28d98943f8a436a866a89ed
Python
4,594
133
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 25 13:55:29 2021 @author: baris """ from neural_coding import load_spikes, rate_n_phase import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns # ==============================================================...
1f05252d94593d295b46c094886ce8ce2b79262a8d92c0c54420064ed86181a9
Python
4,595
156
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/mpii.py' ] evaluation = dict(interval=10, metric='PCKh', save_best='PCKh') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup...
6a662a0bbf3cf2bab8dbf92c26f4b042c2d7792164a1542ad6227ecd1616ceb4
Python
4,595
156
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/mpii.py' ] evaluation = dict(interval=10, metric='PCKh', save_best='PCKh') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup...
4ac56fd1f1d5e52a75972cba4cf49389fe4d1a1ed3116ee85896add968100f26
Python
4,597
137
# __author__ = haitham elmarakeby from file_browser import get_models from os.path import join, exists from config_path import TEST_RESULTS_PATH, PLOTS_PATH from os import listdir import pandas as pd import numpy as np from utils.evaluate import evalualte # f1 maximization def expect_f1(y_prob, thres): idxs = np...
5f6462f1a2cb5c8cad8d769c72f02a760fcf90bdd40ced4da46703aa1e0affce
Python
4,597
120
# -*- coding: utf-8 -*- """ Created on Tue Jun 28 14:20:24 2022 @author: fhu14 """ #%% Imports, definitions import pickle import os from typing import List from functools import reduce #%% Code behind def infer_skf_elements(direc: str) -> List[str]: r"""Finds out the elements of an skf set Arguments...
aacdde666e81bb773b99283a4bd473ce36885d7880a376d40df3b18ed5f34dff
Python
4,600
139
""" Cross-validated Pearson correlation between a JOINT model (SSS + INDIVIDUAL interpretable features) and high-gamma ECoG, across layers. """ #### ChatGPT was used to assist writing code. The authors reviewed, edited, and take full responsibility for the content. import os PODCAST_ROOT = os.environ.get("PODCAST_RO...
cb634b4fb46a03b3df6c87c23237d830ab125fb6b06e3c3bacde7a0e9469be0e
Python
4,600
130
import json import pandas as pd import numpy as np import datetime from pingouin import partial_corr from typing import Union, Dict, Iterable, Tuple, List from scipy import interpolate from statsmodels.stats.multitest import multipletests __all__ = ['load_json', 'upper_and_lower_quartiles', 'deabbreviate_parcellation'...
e59d34113f8c4de5e31325535fbf15ff2cd53cce070ba4e0ecae68b492d325fc
Python
4,600
150
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from torch.nn.modules.batchnorm import _BatchNorm from mmpose.models.backbones.tcformer import TCFormer from mmpose.models.necks.tcformer_mta_neck import MTA def test_mta(): in_channels = [8, 16, 32, 64] out_channels = 8 # end_le...
86efc6f6cfa1563faa3e8e0633c63805a5ea666833c644137fdd709fb48bcf28
Python
4,603
129
# Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org # Distributed under the MIT License. # (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT) import numpy as np import os import torch as pt from torch_geometric.data import Data, download_url from torchmdnet.dat...
8e04c1a9cb1666073d23c425be519afd6bff470f02046f7fe431efc394f46210
Python
4,603
126
# Copyright (c) OpenMMLab. All rights reserved. from itertools import groupby from typing import Dict, List, Optional, Union import cv2 import numpy as np from ...utils import get_eye_keypoint_ids from ..base_visualizer_node import BaseVisualizerNode from ..registry import NODES @NODES.register_module() class Bigey...
547785b4ca28e29760d41ec87cb3f63290c95602707f09e1bdc70b9fbd0aa533
Python
4,604
130
from copy import copy, deepcopy from transformers import TrainingArguments, EarlyStoppingCallback, IntervalStrategy import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN_...
69278b125f427bbc4e89fa618cf8d8c663895f3ff4f5457638d279fc0014e7a9
Python
4,605
121
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import torch from mmdet.models.dense_heads import GFLHead, LDHead def test_ld_head_loss(): """Tests vfnet head loss when truth is empty and non-empty.""" s = 256 img_metas = [{ 'img_shape': (s, s, 3), 'scale_factor': 1, '...
08e12fb845e33020d064d7ccbbcab107b313854a44317fc83c1d6e807b333bdc
Python
4,609
91
import os import sys # os.system("module purge") cmd = "../../install/x86_64/bin/nrnivmodl ../../src/all_mechanisms" if not os.path.isdir("./x86_64"): os.system(cmd) # generate binary dataset file for DeepDendrite # @param1: original dataset file (*.npz) # @param2: fold to save binary dataset file # stim_img_trai...
36b1719abc22c17a3ff3b975b7ba3159c864f605de61555a3034d4a093e7adc4
Python
4,616
116
""" Does the unique neural variance of the semantic QA features survive a lexical predictability control? (Reviewer 1, comment 1.3) The manuscript isolates semantics against a non-semantic control set of {speech presence, mel-spectrogram, GBFB, phonetic, syntactic}. The reviewer observes that this omits word frequency...
33049508778e14f093e0b362bdfc1e27632c10f2fec6ace90c624a662f4042d3
Python
4,620
156
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/mpii.py' ] evaluation = dict(interval=10, metric='PCKh', save_best='PCKh') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup...
5189dab8a123d393e3f75f9a7e91e18359cb33c04b8ae8c0901177c65f32f044
Python
4,620
156
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/mpii.py' ] evaluation = dict(interval=10, metric='PCKh', save_best='PCKh') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup...
e7aa36470d479066b7fec4cf57fd659ff48e275474a9cc6ed21fa558ed033f34
Python
4,620
143
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np import pytest import torch from mmpose.models.necks import PoseWarperNeck def test_posewarper_neck(): """Test PoseWarperNeck.""" with pytest.raises(AssertionError): # test value of trans_conv_kernel _ = PoseWarperNeck( ...
083937650cb437fcc7937e504e76a29467409800fb90aa40e4db5b0db153776a
Python
4,625
118
# Copyright (c) OpenMMLab. All rights reserved. import torch from .camera_base import CAMERAS, SingleCameraBase @CAMERAS.register_module() class SimpleCameraTorch(SingleCameraBase): """Camera model to calculate coordinate transformation with given intrinsic/extrinsic camera parameters. Notes: Th...
2251a730f7fac060a089580686f5d6e2a6b3c25aaf4a2f07d10f81e067e4a5e6
Python
4,625
165
# Copyright 2021 Tomoki Hayashi # MIT License (https://opensource.org/licenses/MIT) """Mel-spectrogram loss modules.""" from distutils.version import LooseVersion import librosa import torch import torch.nn.functional as F is_pytorch_17plus = LooseVersion(torch.__version__) >= LooseVersion("1.7") class MelSpectr...
151823099abc7b1bd3586a6f0ab8fcf57f4d75d24f26fa203160d5bc416ba645
Python
4,627
149
_base_ = ['../../../../_base_/default_runtime.py'] use_adversarial_train = True optimizer = dict( generator=dict(type='Adam', lr=2.5e-4), discriminator=dict(type='Adam', lr=1e-4)) optimizer_config = None lr_config = dict(policy='Fixed', by_epoch=False) total_epochs = 100 img_res = 224 # model settings mode...
22661a04bf60dce1547202d8a9baf659506038e604a11c8296c5ee5dc9c3f926
Python
4,629
116
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn from mmcv.runner import BaseModule from mmdet.models.builder import HEADS from ...core import bbox_cxcywh_to_xyxy @HEADS.register_module() class EmbeddingRPNHead(BaseModule): """RPNHead in the `Sparse R-CNN <https://arxiv.org/abs/...
fdf2da690a6826c3d81e1b1db0347c2e1265cbebaa9aa8e4c17e6b72430435df
Python
4,631
108
import torch from torch import nn try: from fedml_core.trainer.model_trainer import ModelTrainer except ImportError: from FedML.fedml_core.trainer.model_trainer import ModelTrainer class MyModelTrainer(ModelTrainer): def get_model_params(self): return self.model.cpu().state_dict() def set_mo...
4a9edbde11bcb7c618236735fe8dace220eef0d2c1d01120ec9cd94f1c4628bf
Python
4,632
136
import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.colors as mcolors import numpy as np """ For info, these are the probability counts by categories we use for styling cls dry normal wet 0.4 169,180 50,329 163,768 0.5 99,752 6,733 106,723 0.6 22,184 366 35,627 0.7 4,743 24 13,077 0.8 900 3...
7662b234998896e4a206763dbc45dea3f4ea581fba0b940ff95b3347f9391dc4
Python
4,632
134
import argparse import typing import numpy as np import pandas as pd from osgeo import gdal_array import argparse_def # noinspection PyUnresolvedReferences import matplotlib_setup import models.abstract import sentinel_data_utils import reference_data_utils from osgeo_setup import * def parse_args() -> argparse.Nam...
10eef764abcb47fc0888507be3949951968d87f13e3e4849dbc072761b0108ac
Python
4,634
122
# Author: Fabi Prezja <faprezja@fairn.fi> # Copyright (C) 2023 Fabi Prezja # License: MIT License (see LICENSE.txt for details) import numpy as np import seaborn as sns import matplotlib.pyplot as plt from sklearn.metrics import confusion_matrix def plot_confusion_matrix(model, generator, generator_name, target_type)...
c991ce3bf460aa9f19d5d2b7f58a497909e5ce269af1ca88e5d9f11344b005b2
Python
4,635
146
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import torch import torch.nn as nn from ..builder import LOSSES from .utils import weighted_loss @mmcv.jit(derivate=True, coderize=True) @weighted_loss def smooth_l1_loss(pred, target, beta=1.0): """Smooth L1 loss. Args: pred (torch.Tensor)...
74de9900cc2706b2366b71fe95b13cfc9d51ef2a48b3393f5b13758f2c2c2fac
Python
4,639
120
from copy import copy, deepcopy from transformers import TrainingArguments import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN_Over_BERT # training_splits = [0,1,4,6,7...
ef80f5fd179c631d9d35ce47bee5f9b17477d83d36cb5691fe4c56faf9e89dcb
Python
4,639
158
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='l...
9b27cdf095430f609f5bbc300994cde07faf53d9f838981c74f5845e4ae67fa5
Python
4,641
129
import os import gc import ot import pickle import anndata import scanpy as sc import pandas as pd import numpy as np from scipy import sparse from scipy.stats import spearmanr, pearsonr from scipy.spatial import distance_matrix import scipy.sparse as sp import matplotlib.pyplot as plt import matplotlib as mpl from mat...
42f7551ee31ad7664ea2fc130fd4f1e75767791ebcd6e63d26c88bd64cccfbe6
Python
4,645
125
# -*- coding: UTF-8 -* import os import time import tensorflow as tf from coarsen import create_coarse_graph from utils import normalized, graph_to_adj from numpy import * from sklearn.decomposition import PCA from sklearn.cluster import MiniBatchKMeans import json import pickle def print_coarsen_info(ctrl, g): c...
2cffcc43395604b5617c2752fbc05dd5ee6cac91c3d42ae74d72b47b665ba2e0
Python
4,646
134
import logging from keras import Input from keras.engine import Model from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.layers import Embedding from keras.layers import Conv1D, GlobalMaxPooling1D from keras.regularizers import l1, l2 from model.model_utils import apply_m...
e4c7ca36d9d367159cccfded79bc45fc6e157db7493d6e8429b3336ac947c955
Python
4,646
158
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='l...
1606b477c5be0404fda237dbed42182e41cdec8342b8996e745113bd8d76f6cb
Python
4,648
149
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/interhand2d.py' ] checkpoint_config = dict(interval=5) evaluation = dict(interval=5, metric=['PCK', 'AUC', 'EPE'], save_best='AUC') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learni...
1e663d7eeb3c23a0e1098b96f8d77043a576ac4e7df937226bf49f9b71b27af6
Python
4,648
158
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='l...
31e80a0ac7d622442a64e430a9c488a2e644c5347889d8b41f88027fa24d0ec0
Python
4,655
147
import glob import os.path as osp import re import shutil from argparse import ArgumentParser from functools import wraps from multiprocessing.dummy import Pool def bundle_args(func): @wraps(func) def wrapped(args): return func(*args) return wrapped @bundle_args def update_ceph_config(filename...
93d001f294c43ed0154ddbe4c31d8c9bb8d6366e022303a4ae476bb7255bc54f
Python
4,655
95
#!/usr/bin/env python import unittest import pandas as pd from os import path import os from picrust2.util import make_output_dir, TemporaryDirectory from picrust2.default import (default_ref_dir_bac, default_ref_dir_arc, default_tables_bac, default_tables_arc) from picrust2.place_seqs im...
37b72f1080f04dc3bf61842c887c65ab75b5f93059dc5f98ba1fd7ac7b5ab037
Python
4,656
151
import pytest from pathlib import Path from clipkit.clipkit import execute from clipkit.files import FileFormat from clipkit.modes import TrimmingMode from clipkit.settings import DEFAULT_NT_GAP_CHARS here = Path(__file__) @pytest.mark.integration class TestOutLog(object): def test_simple(self): """ ...
ab048c5fc55b20e6cff953fdae9a59c501c9e89fba3cb483bdb418dd7967674b
Python
4,656
150
# This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed # under the Apache License Version 2.0, see <https://www.apache.org/licenses/> from contextlib import nullcontext from math import sqrt from typing import Tuple import torch from torch import Tensor from sbi.sbi_types import Propos...
a460906db16f3c52df7f994b4be00f75538f84aabfb3f051e6c1e921b7e76de2
Python
4,658
141
""" Variance partition for: 1) Phonetic vs Speech 2) Phonetic vs (Speech + SSS), per SSS layer """ #### ChatGPT was used to assist writing code. The authors reviewed, edited, and take full responsibility for the content. import os PODCAST_ROOT = os.environ.get("PODCAST_ROOT", "/engram/naplab/users/rs4613/Podcast"...
cbc328b801f75f3e6a2c298c4944575cf8c992e394800671bf42964cd53ef972
Python
4,658
141
# Copyright (c) OpenMMLab. All rights reserved. import tempfile import torch from mmcv import Config from mmpose.datasets import DATASETS, build_dataloader from mmpose.datasets.dataset_info import DatasetInfo from mmpose.models import builder def test_voxelpose_forward(): dataset = 'Body3DMviewDirectPanopticDat...
73e5757ff518e759a3e0d127ef330df9e50d5b5f9c3974a6702299346708c097
Python
4,659
124
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Nov 2 08:39:39 2021 @author: baris """ import matplotlib.pyplot as plt import numpy as np import grid_model as grid from neo.core import AnalogSignal import quantities as pq from elephant import spike_train_generation as stg from scipy import ndimage ...
aad1b49ac0fc4c7ed2412f240797cbb744726e846a208b4c010bd66ddbcc49fd
Python
4,661
154
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco_wholebody_hand.py' ] evaluation = dict(interval=10, metric=['PCK', 'AUC', 'EPE'], save_best='AUC') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( ...
3c04013f9981634d5ef114f0693fd3ed6444875c6909e4e02e6e1aaba9d11e38
Python
4,667
142
#!/usr/bin/env python # Copyright [1999-2017] EMBL-European Bioinformatics Institute # # 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 copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unle...
90d28dc6103df914eae3af8b6b30804202fba873fbd34c3a347df013bfd78e52
Python
4,673
133
# -*- coding: utf-8 -*- """ Created on Mon Oct 31 23:01:40 2022 @author: Alfred """ import pandas as pd from functions import * from model_functions import * from the_model import * matplotlib.rcParams['axes.prop_cycle'] = matplotlib.cycler(color=["#F4511E", "#FB8C00", "#FFB300", "#FDD835", "#C0CA33", "#7C...
e0ec770461e282716b022ada7d5c0a1124e3c9e8c2dfe2172f3a2af6f6aed3b7
Python
4,673
200
import re # parse vcf file lines class vcf: # varian type UNKNOWN=0 SNV=1 DEL=2 INS=3 MULTI=4 # vcf file columns CHROM=0 POS=1 ID=2 REF=3 ALT=4 QUAL=5 FILTER=6 INFO=7 FORMAT=8 @staticmethod def get_chrom (E): return E[vcf.CHROM] @staticmethod def get_pos (E): return E[vcf.POS] @staticmethod ...
9906fd5bd2c9935de2edd92cd147eaefa0349138325a1de7cfa041cdcb1dfb2e
Python
4,676
90
"""Public optimized dense E/F consistency across a molecular separation scan.""" import pytest import torch from aimnet.calculators import AIMNet2Calculator pytestmark = [pytest.mark.gpu, pytest.mark.weights] def _water_dimers(distance: float): # Coordinates are angstroms. Both rows contain two actual water mo...
cebe69bf036ede642e5a3ce6bc9bb47ba082b70ee1bf1e1d04c2162a1dbdbbb7
Python
4,677
144
# -*-coding:utf-8-*- import logging import time import uuid from typing import List import paho.mqtt.client as mqtt from ..base_com_manager import BaseCommunicationManager from ..message import Message from ..observer import Observer class MqttCommManager(BaseCommunicationManager): def __init__(self, host, port...
bce2ba98750f6d071fc0074df91d2708825eaafc8814695fbf4467df7e7405d2
Python
4,678
108
import numpy as np import scipy.special as sp from importlib import reload import sys sys.path.insert(2,'support') import functions reload(functions) import functions as f import parameters reload(parameters) import parameters as p direc = sys.argv[0].split('script')[0]+'data/' plasticity_type = sys.argv[1] n_simulati...
5552a014bf86bfefd8b23b29ddffa8e213bcdb7279fa0172ee9d209083501c07
Python
4,680
112
import os from typing import List, Any import numpy as np import codecs import json from glob import glob import cv2 import shutil from sklearn.model_selection import train_test_split # 1.标签路径 labelme_path = "LabelmeData_test/" # 原始labelme标注数据路径 saved_path = "tmp/VOCdevkit/VOC2007/" # 保存路径 isUseTest=False...
b7a3e3acce5e619e0337439b9c4487bdd2e01f06b19ebf000fa74b15c00d9578
Python
4,687
130
import numpy as np class MUSIC(object): def __init__(self, freq_bins, mod_vecotr): self.num_freq = freq_bins.shape[0] self.freq_bins = freq_bins self.mode_vec = mod_vecotr assert self.mode_vec.shape[0] == self.num_freq self.n_points = mod_vecotr.shape[-1] self.nu...
936521fbbc5fac8d53e04ee9998c261bdbb5492c49bd1aa982bb84b7d6559de6
Python
4,693
131
import torch from sklearn.base import BaseEstimator import numpy as np from sklearn.metrics import accuracy_score from sklearn.utils.extmath import softmax from torch import optim, nn from torch.utils.data import DataLoader import time import logging # from barbar import Bar class TextDataset(torch.utils.data.Datase...
d4b9392bc7a75936e607e91560a893192e7eececc9ae93262e9c1a63892972ec
Python
4,693
93
import logging import os import sys from .message_define import MyMessage from .utils import transform_tensor_to_list sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../"))) sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../../FedML"))) try: from fedml_core.distributed.com...
876626c8eda422f62a8490599ce2f7a93df3d548c282038732a94acea9cc0973
Python
4,696
149
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/interhand2d.py' ] checkpoint_config = dict(interval=5) evaluation = dict(interval=5, metric=['PCK', 'AUC', 'EPE'], save_best='AUC') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learni...
9051a0ba21cb49e24ffb9b733cfc0e536cffbc3dc6b9d7e724003986c75166fa
Python
4,696
151
""" The main training script for training on synthetic data """ import time import numpy as np import torch import torch.nn as nn import torch.optim as optim from .network import normalize_input, unnormalize_input from asteroid.metrics import get_metrics def compute_metrics(orig: torch.Tensor, e...
a2ee556e90ba3e6217ae84daac2ef7f6e48759de0340dc8b3bd17b720dbad4d6
Python
4,696
128
import argparse import json import numpy as np import os import torch from sep.helpers.eval_utils import si_sdr from scipy import stats import matplotlib.pyplot as plt import seaborn as sns import sep.helpers.utils as utils import scipy.stats as st import glob def draw_cdf(arr, fig_id = 0): plt.figure(fig_id)...
d62a491bcca9f354aff5018097675bba53e96f380460623de1856924e719b760
Python
4,700
132
import pathlib import shutil import psycopg2 from psycopg2 import sql from configparser import ConfigParser def initialize_database(configuration_file): parser = ConfigParser() parser.read(configuration_file) # connect to default postgres database, create exsclaim user conn = psycopg2.connect(**parser[...
16c828bace5f455772c460299b7fc7ce8f32d30805affc0213ebf478e8c96a67
Python
4,701
114
"""Resolve graph opt-in and its runtime requirements without importing the optional execution backend.""" import importlib.metadata import os import re import sys import torch # Minimum versions for CUDA-graph capture. nvalchemi-toolkit-ops 0.5.0 orders its Warp neighbor kernels on # PyTorch's current stream and res...
54c4e36866bfdfd86da6ffe0ac9f5bb2acd2ecdc61677f8d5a00cd15d88a8dff
Python
4,702
93
# ----------------------------------------------------------------------- # # Copyright (c) 2023, UChicago Argonne, LLC. All rights reserved. # # # # Software Name: Fast Autonomous Scanning Toolkit (FAST) # # By: Argonne Na...
ca9eeb526cabe1e42ed24e912cb8ba2b02888bb6330a663cb4bbaf2210790cd7
Python
4,705
128
# Copyright (c) OpenMMLab. All rights reserved. import warnings import torch.nn as nn from mmcv.cnn import VGG from mmcv.runner import BaseModule from ..builder import BACKBONES from ..necks import ssd_neck @BACKBONES.register_module() class SSDVGG(VGG, BaseModule): """VGG Backbone network for single-shot-detec...
63f7d3bcfcbbc84dddfd5bd5020d427c4570d9094754e130c59a6d7d1460a6ec
Python
4,706
167
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-3, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='l...
425643659e21463c58981f54bea30bf920cc414c4bd3af582c64f301d62947e7
Python
4,707
167
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=5e-3, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='...
9d8a88bd06019da63d18b846402c8575ce670837c9f7b281d266bf7bb44fd822
Python
4,708
149
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/interhand2d.py' ] checkpoint_config = dict(interval=5) evaluation = dict(interval=5, metric=['PCK', 'AUC', 'EPE'], save_best='AUC') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learni...
ba47802f9b30fd35ad5457aa5a74645cedcccdfb133c42278100a9e0cfb282e3
Python
4,708
114
# Imports # import kivy import zipimport import sys import os import configparser from kivy.app import App from kivy.uix.widget import Widget from kivy.uix.button import Button from kivy.uix.image import Image from kivy.uix.label import Label from kivy.uix.floatlayout import FloatLayout from kivy.uix.gridlayout import ...
b65967d5f82e560c7214fc9925ca38220ad17c8abdc0837a0da4c8a2eb165bb5
Python
4,711
126
import os import json from torch.utils.data import Dataset from torchvision.datasets.utils import download_url from PIL import Image from data.utils import pre_caption class coco_karpathy_train(Dataset): def __init__(self, transform, image_root, ann_root, max_words=30, prompt=''): ''' im...
c65940eb72148c3fa663c0441b309aafc4c1bd7eefb80d521f972deb1ae7b73b
Python
4,711
167
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco.py' ] evaluation = dict(interval=10, metric='mAP', save_best='AP') optimizer = dict( type='Adam', lr=2e-2, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='step', warmup='l...
efd49495792238d4e26a6032451c3452955fc8260a89e6a88de68741ac8ee50e
Python
4,715
108
# supplement file for classifier's survival plot, will overlay on original image # Created: 11/2/2021 # Status: in progress # CUBLAS_WORKSPACE_CONFIG=:4096:8 python survival_plot.py import numpy as np import pandas as pd import os from collections import defaultdict # from typing import Union, Dict, Tuple, List # from...
a03b9beaf4b42a298c3afc73dd598e0682b296dbbdf9cc863278dea6c9e86c13
Python
4,716
111
import tkinter as tk from tkinter import messagebox from tkinter import filedialog class GUI1: def __init__(self): super().__init__() self.root = tk.Tk() self.wait = self.root.wait_visibility() self.title = self.root.title("Inputs") self.geometry = self.root.geom...
538028940325ee3e42e10ba29199bc803700b6a2aa80b674d6f88ccb3aaa6115
Python
4,722
121
from copy import copy, deepcopy from transformers import TrainingArguments import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN_Over_BERT # training_splits = [0,1,4,6,7...
7448ee1113ced888f396471e95a1ef6e127a7cabfd434d31468b79913ce3cdbd
Python
4,723
118
import torch import torch.utils.data as data from PIL import Image import h5py import numpy as np def get_train_imgs_list(h5_filepath): img_list = [] with h5py.File(h5_filepath, 'r') as h5_file: img_filenames = list(h5_file['images'].keys()) label_filenames = list(h5_file['labels_ternary'].ke...
cdbfee7504e8d39ca86f0ffad6af50a1b2be89bb057c44106c4fd9d19928e785
Python
4,726
93
import logging import os import sys from .message_define import MyMessage from .utils import transform_tensor_to_list sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../"))) sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../../FedML"))) try: from fedml_core.distributed.com...
80cb40124489aa215ed932e91e5172a56543fb9f77cf8db83f75e0471f7e5db3
Python
4,728
120
# Copyright (c) OpenMMLab. All rights reserved. import torch from mmdet.core import bbox2result from ..builder import DETECTORS, build_head from .single_stage import SingleStageDetector @DETECTORS.register_module() class YOLACT(SingleStageDetector): """Implementation of `YOLACT <https://arxiv.org/abs/1904.02689>...
33f50c0ba6e5e5c33ea4ff088dfcdceee5b3b654defa48cc98ed829dd5c3f8fb
Python
4,731
120
from copy import copy, deepcopy from transformers import TrainingArguments import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN_Over_BERT training_splits = [0,1,4,6,7,9...
d6154c22205030034a3e9dfa8295ab976487ea82640230a6c5f6ba7f0e2e1f27
Python
4,731
120
from copy import copy, deepcopy from transformers import TrainingArguments import os from os.path import join, splitext from model.torch_models.bert_cnn import CNN_Over_BERT from model.torch_models.bert_linear import Linear_Over_BERT from model.torch_models.bert_rnn import RNN_Over_BERT training_splits = [0,1,4,6,7,9...