sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
68773bdee1edd9f22c59671af0162bb141c0336f887c16b0b507d679d8d1d6d2 | Python | 10,543 | 284 | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule
from mmcv.runner import BaseModule
from torch.nn.modules.batchnorm import _BatchNorm
from ..builder import BACKBONES
from ..utils import CSPLayer
class Focus(n... |
f06d9a96fe0aff8e0e5583c1e28a11522b74e5fc2c030eb4b5d91e56b6723aae | Python | 10,543 | 360 | """"""
import os
import pandas as pd
import matplotlib.pyplot as plt
from scipy.stats import chi2_contingency
from statistics.race_ethnicity.race_ethn_metadata import OUTPUT_FNAME
from statistics.demographic_statistics import _DemographicStatistics
from statistics.race_ethnicity.race_ethn_metadata import *
plt.sty... |
180aac7f1cf7d9c184392d40bc395f33b5aa5bb517f7ffa3bcd48596bf91676d | Python | 10,544 | 168 | import os
import time
import json
from pathlib import Path
import pandas as pd
import numpy as np
import calendar
import datetime
from A_config import a10_config
from B_preprocess import b100_load
from D_modelling import d100_modeller, d110_benchmark_models
from F_post_processsing import F110_process_opeForecast_outpu... |
3e7838f5ba6e08088730b9256943f6895c6b498ca47a36a05ac0d37e30993fdd | Python | 10,545 | 337 | #!/usr/bin/env python3
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the ho... |
463be5d0108b27840b616059e8483cd43590dd9d6bad48a07e26b08302dce164 | Python | 10,555 | 289 | import os
import sys
import time
import logging
import collections
import csv
import numpy as np
import torch
import torch.utils.data as data
import torchvision.transforms as transforms
from .datasets import Landmarks
logging.basicConfig()
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def _read_csv(pa... |
87a5cdeb7cf9dbb47d1daf7850f3d25a0000baae7aec8034442611bfc726027b | Python | 10,558 | 346 | # 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 __future__ import annotations
from typing import Callable, Dict, Optional
import pytest
import torch
from torch import eye, ones, zeros
from torch.... |
73396b8873f3be184b6b89ef12a1437e708e8eac0be7bdfa6c333b5f5046325a | Python | 10,577 | 233 | import logging
import torch.utils.data as data
import numpy as np
from torchvision import transforms
import fedml_api.data_preprocessing.pascal_voc.transforms as custom_transforms
from fedml_api.data_preprocessing.pascal_voc.datasets import PascalVocDataset
from fedml_core.non_iid_partition.noniid_partition import re... |
499bc2c214346555826fa7df9de3cbaed16690ab21abd09c99f6d3611fa51814 | Python | 10,579 | 322 | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as cp
from mmcv.cnn import build_conv_layer, build_norm_layer
from mmcv.runner import BaseModule
from ..builder import BACKBONES
from ..utils import ResLayer
fro... |
edd2461ccc393212765bd224de7ef1fc4b63df50b0f3da26895835f9a1db61e3 | Python | 10,580 | 284 | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
from mmcv.cnn import (build_norm_layer, constant_init, normal_init,
trunc_normal_init)
from mmcv.runner import _load_checkpoint, load_state_dict
from ...utils import get_root_logger
from ..builder impo... |
de43cbd9c53d4fea9d15acdd1328b93410614418e9e66fea4d90a97c275d6823 | Python | 10,584 | 262 | # 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/>
import warnings
from typing import Callable, Literal, Optional, Union
import torch
from torch import Tensor
from torch.distributions import Distribution
... |
7a6e996e042aaf909911e60d2ccc2a2d3645cb2f3dd4f4203c8b219adfa6fa47 | Python | 10,591 | 349 |
import argparse
import gzip
import numpy as np
import numpy.random
import sys
import string
import tables
class Haplotypes(object):
def __init__(self, pos_array, ref_allele_array, alt_allele_array,
hap1_array, hap2_array):
self.pos = pos_array
self.ref_allele = ref_allele_arra... |
5daff38485e6cdd97e885b70529f94d4c260f2061d9eb5d4234ffaa89cebc5f1 | Python | 10,601 | 275 | import warnings
from typing import ClassVar
import numpy as np
import torch
try:
from ase.calculators.calculator import Calculator, PropertyNotImplementedError, all_changes # type: ignore
except ImportError as exc:
_ASE_IMPORT_ERROR: ImportError | None = exc
class Calculator: # type: ignore[no-redef]
... |
9906aca1b06da495f3eb46eb36ab5a35292f8aac11797152763bd59e2b7fe9a8 | Python | 10,606 | 215 | import argparse
# from collections import OrderedDict
# from datetime import datetime
# from functools import partial
# import json
# import random
import os
from typing import Dict
# import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import torch
import xgboost as xgb
from ... |
62af4c999f00b3aec53aa71ead45249d1c04b93e93128f5fdbe98c88df35f30c | Python | 10,611 | 294 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import warnings
from abc import ABCMeta, abstractmethod
import json_tricks as json
import numpy as np
from torch.utils.data import Dataset
from xtcocotools.coco import COCO
from mmpose.core.evaluation.top_down_eval import (keypoint_auc, keypoint_epe,
... |
3c2eb78bbfefd874412a71d98d8cc3fc72d0fd6731ad0ea1c5994fb6cb9d506a | Python | 10,623 | 240 | """Optional dense AEV/ConvSV layout optimizations shared by eager and graph execution.
Only tensor layout and kernel execution change. The model's charge iterations,
output modules and force construction remain in their canonical implementations.
Pure-Torch layout operations retain autograd support; the optional Trito... |
091201e76ff1ebb87e7712782b0fac91f95dc164ae63bcbe30953a86a34fd8c7 | Python | 10,625 | 253 | """Shared model computation and neighbor ownership, without CUDA capture."""
import copy
import pytest
import torch
from torch import nn
from aimnet.calculators import AIMNet2Calculator
from aimnet.calculators.cuda_graph.cache import CUDAGraphCache
from aimnet.calculators.cuda_graph.contracts import ModelContract
fr... |
a2aa7e23f8f41ee3621719e7f47d8f9850e2ed1e381332edfb3e62caffb25c0a | Python | 10,628 | 209 |
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
... |
a585e304a290a99bbafd23850f38c170856d903fe30dab0b784ae68537259621 | Python | 10,634 | 276 | import psi4
import resp
import sys
from rdkit import Chem
from rdkit.Chem import AllChem
import numpy as np
import pandas as pd
import os
import time
from datetime import datetime
import glob
import copy
psi4.set_memory("32000 MB")
psi4.set_num_threads(2)
main_folder = "/cluster/work/igc/mlehner/test182_psi4_qmugs500/... |
6592c6cc2479adea4982d6412e905b989ece833766f60caf7c774e4d9e16675c | Python | 10,636 | 261 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.runner import force_fp32
from mmdet.core import bbox_overlaps, multi_apply, reduce_mean
from ..builder import HEADS, build_loss
from .gfl_head import GFLHead
@HEADS.register_module()
class LDHead(GFLHead):
"""Localization distillation Head. (... |
b506c3d1c9a1c0976391bb9fc5bb31b66f0d903167df9f2d033a7a84954d81d3 | Python | 10,638 | 341 | from typing import Optional, Callable, Tuple, Dict, Any, List, NamedTuple
import functools
import pytest
import eagerpy as ep
import foolbox
import foolbox as fbn
ModelAndData = Tuple[fbn.Model, ep.Tensor, ep.Tensor]
CallableModelAndDataAndDescription = NamedTuple(
"CallableModelAndDataAndDescription",
[
... |
0b916c9006539f2411664e978f64712370c04ad4ddd2042c539e96dd016cad1d | Python | 10,646 | 325 | 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_AA_GAP_CHARS, DEFAULT_NT_GAP_CHARS
here = Path(__file__)
@pytest.mark.integration
class TestKPISmartGapsMode(object):
def te... |
819422c04d3b1b0537a8c3ef22cabbf690da5c985f0cea033963eb0217a2c86e | Python | 10,647 | 216 | import torch
from torch import nn
from .perception_loss import vgg16_feat, perceptual_loss
from .base_model import BaseModel
from . import networks
# from parse_config import ConfigParser
# import parse_config
import numpy as np
class DadganMCModel(BaseModel):
""" This class implements the pix2pix model, for lea... |
3103eb4c775de8e922721a443043a1dfc93d88b1d36fd54acd166341e2242f2a | Python | 10,659 | 320 | # 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/>
"""Fast contract tests for composed vector-field standardization."""
import pickle
import pytest
import torch
from torch.distributions import Independen... |
b209beae5acb0616a12611443405dd5c6c1bc3996e6a41e5f526f3b375d85eef | Python | 10,659 | 347 | # Copyright (C) 2022-2025 ETH Zurich, Niels Maeder and other DASH contributors.
from typing import List, Sequence
import numpy as np
import pytest
from rdkit import Chem
from serenityff.charge.gnn.utils import MolGraphConvFeaturizer
from serenityff.charge.gnn.utils.custom_data import (
CustomData,
CustomGrap... |
3766b4e3bed4a2637503b57969ffe6d114d634d3982463e168f25e8b05fb968a | Python | 10,675 | 316 | # @author semese
import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix, roc_curve, auc
from scikitplot.metrics import plot_confusion_matrix
from sklearn.preprocessing import label_binarize
sns.set(font_scale=1.25)
sns.set_palette('mu... |
eb663c30c8d616e3eca88e6b1a6b26020b0a8453a1de552d5ada6e739e199591 | Python | 10,684 | 229 | import argparse
import logging
import os
import sys
import numpy as np
import torch
import wandb
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../")))
from fedml_api.data_preprocessing.fed_cifar100.data_loader import load_partition_data_federated_cifar100
from fedml_api.data_preprocessing.shake... |
b60739f60fdffed5b7c94f386b7187cdd22ce32e65d789aa919c5a6dc4262c5a | Python | 10,686 | 325 | 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_AA_GAP_CHARS, DEFAULT_NT_GAP_CHARS
here = Path(__file__)
@pytest.mark.integration
class TestKPICSmartGapsMode(object):
def t... |
f36c44e9f3d4be2aa6725a64a4d2734c0a2181779bd6321b257ca90ce13b5cad | Python | 10,690 | 389 | import collections
import math
import numpy as np
from scipy.signal import periodogram
from scipy.spatial.distance import pdist
from mne.time_frequency import psd_array_multitaper
from scipy.integrate import simps
# Helper functions
def skip_nones(fun):
def _(*args, **kwargs):
for a, v in zip(fun.__code__... |
b0e02932bfdd4a3515aae8cf881c50aebc3f0af895b6797f76ee0aa06b355f75 | Python | 10,691 | 339 | """
Methods to compute statistical quantities of distributions.
"""
import numpy as np
from numpy import nan
def nested_loglikelihood_ratio(loglikelihoods1, loglikelihoods2, **kwargs):
"""
Calculates a loglikelihood ratio and the p-value for testing which of two
probability distributions is more likely to ... |
9c8377d7a04afde6cf51da99e1d1692a9671c10a8f591d8106c3695fc7d4d152 | Python | 10,697 | 289 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from tqdm.notebook import tqdm
import pickle
import glob
import os
from os import path
import re
import seaborn as sns
from mpl_toolkits.axes_grid1.inset_locator import inset_axes
from saccade_config import *
LABEL_NONE = "No response"
LABEL_ENHA... |
913af5bc45dc29b81975789883be846db152f4206f8d773a6066a33c8872a5f4 | Python | 10,701 | 358 | import multipagetiff as mtif
import numpy as np
import pandas as pd
from tifffile import imwrite
from tqdm import tqdm
import os
import psutil
from multiprocessing import cpu_count
import logging
log = logging.getLogger(__name__)
def get_ordered_tiffs(dataPath):
"""
From folder with tiff files arranged as on... |
6426e5ae086bedbfda0eadc3f2be0cfe0623037a343dbe42e25201d17da79484 | Python | 10,714 | 241 | # 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/>
import warnings
from typing import Any, ClassVar, Dict, Literal, Optional, Tuple, Union
from torch.distributions import Distribution
from torch.utils.ten... |
424be5be4950dd36ff422b6eb7254423b1d8b71a9c4bec62c4e71f6424e305aa | Python | 10,724 | 310 | # 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/>
# NOTE: the entire file was drafted by GPT-5 in GH Copilot, then editied by janfb.
from typing import Tuple
import pytest
import torch
from torch import... |
f77cbe7a4e8f0154bb507733c77499661c90260d2ecc8e19cd8e5f4523b48a5a | Python | 10,724 | 288 | # 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 __future__ import annotations
from typing import Tuple
import pytest
import torch
from sbi.neural_nets import (
FlowMatchingConfig,
SubVPS... |
0f99de18d9c9321f0099f4e67b580abd4fac87485acca305251ce5c63da3da7e | Python | 10,739 | 263 | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
from torch.nn.modules.utils import _pair
from .builder import PRIOR_GENERATORS
@PRIOR_GENERATORS.register_module()
class PointGenerator:
def _meshgrid(self, x, y, row_major=True):
xx = x.repeat(len(y))
yy = y.view(-1... |
ff7a3db52196c3dc76caf9e5ace4dabd6f72f1fbfc53e86e2e4fddbb89e0a425 | Python | 10,745 | 285 | # 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 __future__ import annotations
import pickle
from dataclasses import asdict
import pytest
import torch
from torch import Tensor, eye, ones, zeros
fr... |
75af4b63d5de89ac5d14af48e9c39a53f51d2c450a6b13d81559dad1e9e891b4 | Python | 10,750 | 248 | import pandas as pd
import os
import numpy as np
from datetime import datetime
import scipy.io as spio
def get_max(weird_string):
#if a measure is described in a string as a 5 range A% - B%, get maximum
new_vals = [int(''.join([x for x in el if x not in [' ','%']])) for el in weird_string.split('-')]
retur... |
c78ea31b9281091c9f9eecb1cd4ea46ad726b85562cee70b2bd1a7fb9fcc13bb | Python | 10,779 | 270 | import jax
import jax.numpy as jnp
import numpy as np
import matplotlib.pyplot as plt
import utils
import tensorflow as tf
import os
def plot_pred(equation, prompt, mask, query, ground_truth, pred, to_tfboard = True):
'''
plot the figure
@param
equation: string
prompt: 2D array, [len(prompt), prompt_dim... |
3318b5db114eaf58a910a4ff6180e5b57e2415915fb709d7e4b935b1bbf25a9b | Python | 10,780 | 271 | # -*- coding: utf-8 -*-
"""
Created on Tue Jan 4 19:56:21 2022
@author: Anandita
"""
''' Generate data from sigmoidal tuning curves with varying slopes along each dimension.
The sigmoids along each dimension has the same set of sloped so that the
data matrix can be expressed as the tensor product of ... |
0f3093ec3aae9e1c2391f6b27311ecbde9af07de148e6e198ee1c70c2eb44b72 | Python | 10,784 | 302 | from os import listdir
from os.path import isfile, join, split
import Queue
import threading
import json
import codecs
import requests
import multiprocessing
import logging
# list files in a folder and put them in to a queue for multi-threading processing
def multi_thread_process_files(dir_path, file_extension, num_t... |
93ed6f7d7e563814874777c7d807b2f1a22665bd93e3575184b1e17941e78d62 | Python | 10,788 | 248 | from phase_to_rate.neural_coding import load_spikes_DMK, rate_n_phase, load_spikes
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import matplotlib as mpl
import sys
from copy import deepcopy
# parameters
phase_bin = 360
time_bin = 250
dur_ms = 2000
cycle_ms = 100
phase_b... |
0d538d549c0cee40988d0b07e7a9d3702a18cecc11790125e6b900d820c9ee33 | Python | 10,791 | 294 | # 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 typing import Tuple
import torch
from torch import Tensor, nn
from zuko.flows.core import Flow
from sbi.neural_nets.estimators.base import (
Co... |
07727235a3f3adb550623b97d55ef27521c9ecadc083f4219456ed36e417eada | Python | 10,801 | 323 | #!/usr/bin/env python3
print("Importing libraries...")
####
####
"""
V5: DEPTH MAP ; pytorch3d 0.7.0
"""
####
####
import os
import glob
import argparse
import torch
from tqdm import tqdm
import numpy as np
import random
import math
# datastructures
from pytorch3d.structures import Meshes
# rendering components... |
3e49a1ee440cf37d3445e43c86fbfeba00be91c953035bb51de151066cd037b5 | Python | 10,806 | 316 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import numpy as np
import torch
from mmdet.utils.util_mixins import NiceRepr
class GeneralData(NiceRepr):
"""A general data structure of OpenMMlab.
A data structure that stores the meta information,
the annotations of the images or the model p... |
98c801ec366a0ab61220b87809dc994955325ce0e794355b1004723341b04cb4 | Python | 10,809 | 358 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
import logging
import numpy as np
import pytest
import torch
from parallel_wavegan.losses import (
DiscriminatorAdversarialLoss,
GeneratorAdversarialLoss,
MultiResolutionST... |
0a8cf7ad51bb33429c48ebae055809db99b5b5d93cb96194d8523c37d5c9fc3a | Python | 10,822 | 310 | # Copyright (c) OpenMMLab. All rights reserved.
import copy as cp
import os.path as osp
import tempfile
import warnings
from collections import OrderedDict
import json_tricks as json
import numpy as np
from mmcv import Config, deprecated_api_warning
from mmpose.datasets.builder import DATASETS
from ..base import Kpt2... |
dfde61ab5282d6c265dd17d0d3fe852c47aaab3c2a843fd4b70f766acaf8382d | Python | 10,835 | 250 | import docanalysis as da
import xml.etree.ElementTree as ET
import datetime
import utils
import sqldbutils as dbutils
import json
from os.path import join, isfile
from os import listdir
import logging
import sys
import ann_post_rules
import re
class AnnConverter(object):
@staticmethod
def load_ann(ann_json, ... |
aab4ca276fd62264081e478a316663b9c0f415d7e3d2d45fa510f4c5ba85a3c8 | Python | 10,840 | 216 | import copy
import logging
import torch
import numpy as np
import wandb
from fedml_api.standalone.fednova.client import Client
class FedNovaTrainer(object):
def __init__(self, dataset, model, device, args):
self.device = device
self.args = args
[train_data_num, test_data_num, train_data_... |
540f3c34b88f452f12b81aa91728049c02a5e85cab645250cc889b7a9850c36c | Python | 10,856 | 197 | import os
import cv2
import json
import yaml
import glob
import torch
import shutil
import pathlib
import time
import numpy as np
import torch.nn.functional as F
import torch.nn as nn
from skimage import io
from scipy.special import softmax
from torch.autograd import Variable
from PIL import Image, ImageDraw, ImageFo... |
c6a40a41289e0a90618e7d592826f8d990e6a2e4849c77cd4c8423a61cdf84f3 | Python | 10,863 | 268 | from deprecated.generator_v0 import Generator
from fold import *
from deprecated.model_v1 import *
from deprecated.solver_v1 import Solver
from sklearn.linear_model import LinearRegression
from consts import CUTOFFS
from util import count_n_heavy_atoms
def train_repulsive_model(dset, opts):
r"""API for dftbtorch
... |
0531c70a9efa14025867d39584418ab3002bfe74514ddddcbd4a575f8e9a541f | Python | 10,866 | 260 | import os
import numpy as np
import pandas as pd
from sklearn.preprocessing.data import StandardScaler
def get_top_k_labels(data_dir, top_k=5):
data_path = "Groundtruth/AllLabels"
label_counts = {}
for filename in os.listdir(os.path.join(data_dir, data_path)):
file = os.path.join(data_dir, data_p... |
5b41add1669e0e86c4db92080c4d0554caacb57f9eb644de386bfd6dba8360b2 | Python | 10,887 | 309 | from abc import ABC, abstractmethod
from sklearn.metrics import classification_report
from sklearn.ensemble import VotingClassifier
from mlxtend.feature_selection import SequentialFeatureSelector as SFS
import numpy as np
class ClassifierError(Exception):
pass
class Classifier(ABC):
"""
Abstr... |
3a7146ab77e28ff4e7fb89841bd719d71f69c9e607999c7ac74a64ee41a03812 | Python | 10,889 | 285 | from sklearn.metrics import confusion_matrix
from sklearn.utils.extmath import density
import numpy as np
from features_processing import feature_extraction
# from features_processing.feature_scaler import FeatureScaler
from utils.evaluate import evalualte
from os.path import join, exists
from model.model_factory impor... |
b6cb9ebd517d25d91f5901c78f56d91f15bd8210a6472e6af0bf706d7a38110c | Python | 10,889 | 381 | # -*- coding: utf-8 -*-
"""
This file is part of the cerebellar-task-dependent repository (Xie et al. 2023)
Copyright (C) 2023 Marjorie Xie and Ashok Litwin-Kumar
See README for more information
Library of functions for working in the spherical harmonic basis.
The key functions to call are
1. eigenvalue_spectrum() w... |
b416619183b988e1289356e294d50a096f7aa8938a54aab6c6dee76dc8a9a0aa | Python | 10,899 | 307 | # 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 pytest
from pytest import mark
import torch
from torchmdnet import models
from torchmdnet.models.model import cr... |
e01e58dbeb3d955618a8b5106ad5f6171d01fe202431f4738a98ac303dee1122 | Python | 10,926 | 402 | import sys
import re
def find_all(a_str, sub):
start = 0
while True:
start = a_str.find(sub, start)
if start == -1: return
yield start
start += len(sub) # use start += 1 to find overlapping matches
def parse_vcf(vcf_file_name, vcf_lines, vcf_headers, add_sname=True):
header... |
83587f6af5525e632e07d1c77f53a303f950b6aeb94076d19ee70a4ab0a84e8e | Python | 10,933 | 243 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 14 17:11:14 2022
@author: baris
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import pickle
from scipy.stats import pearsonr, spearmanr
import copy
from scipy import stats
# ====================... |
6d9b23ff1f13886210ec513ac8f47f2b1f785d9201072d3ffca1e5906c9d0365 | Python | 10,935 | 227 | # -*- coding: utf-8 -*-
"""
Created on Fri Jul 30 18:11:57 2021
@author: fhu14
Driver file that goes through the entire precompute stage to precompute
datasets of the form needed for passing through the model
This driver works with ANI-like datasets which organizes the data in a
hierarchical dictionary interface
Th... |
7ad46e6a32aa9bbc44d71c723ad5ae8ca8cfcf73e7a996dfb16aa128cd1b4f66 | Python | 10,940 | 275 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source... |
118f1f96297af174d665fb75a62ce6f93c8451a8681458fff5a4240f444d27ea | Python | 10,946 | 238 | '''
* Copyright (c) 2022, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
* By Junnan Li
'''
import warnings
warnings.filterwarnings("ignore")
from models.vit import V... |
cc0ad673905ddb06364d7b9c5be0b8d8010e355b5032c155e81abd07f83cf824 | Python | 10,953 | 257 | import os
import cv2
import numpy as np
import scipy.io as scio
from csutil import util
from csutil.imgfeature import ImageFeature
from csutil.coarsealign import AlignViaPro
if __name__ == '__main__':
scale_factorreg = 4
constant_scalfac = 4
display_height = 1080
display_weight = 1080 # 2160
ro... |
e1909389acb95fac2c41d7460e721dad131102b0ece7d69cc6a9a553a4409264 | Python | 10,966 | 314 | # 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 __future__ import annotations
from typing import Any, Callable, Dict, Optional, Tuple, Union
import pytest
import torch
from torch import Tensor
fr... |
c8a127f1349ce0c2ac9cca7605a38ffe719d9dcf4cc464b197de5680e3eb7fb2 | Python | 10,979 | 293 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
from dataclasses import dataclass
from itertools import zip_longest
from typing import Dict, List, Optional, Union
from ...utils import get_config_path
from ..node import Node
from ..registry import NODES
try:
from mmdet.apis import inference_detector, i... |
478ef9c6cf690e05a1b5fbfacb8d3e095be460077d3a40c55e46ecf750de2b8b | Python | 10,980 | 384 | import hashlib
import io
import json
import os
import re
import shutil
import sys
from contextlib import contextmanager
from datetime import datetime, timezone
from enum import Enum, auto
from importlib import metadata
from pathlib import Path
from typing import Iterator, List
if sys.version_info >= (3, 14):
from ... |
e71a15216fb4553494c16e5350faff278a843e437a11d755c9a605d5f6a00b1e | Python | 10,987 | 296 | # Copyright (c) OpenMMLab. All rights reserved.
import os
import os.path as osp
import warnings
from argparse import ArgumentParser
import mmcv
import numpy as np
from xtcocotools.coco import COCO
from mmpose.apis import (inference_pose_lifter_model,
inference_top_down_pose_model, vis_3d_pose... |
0cb6f0a6d2726cd5fc27e1adca06a4498656868a056eb08fb81b29c7e91959c0 | Python | 10,993 | 325 | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 1 13:33:57 2022
@author: oliver braganza
"""
import numpy as np
import matplotlib as mpl
import pickle
from load_spikes_olli2 import load_data
from brian2 import *
mpl.rcParams['pdf.fonttype'] = 42
mpl.rcParams['ps.fonttype'] = 42
#def run_brian(index_dict,spike_time_d... |
91917942fff30c792cc84fd62573f88deb6af59bca86b6ec3a68a5b1ae138272 | Python | 11,010 | 274 | """Optional dense ConvSV projection, output packing and masking.
The optimized path reads the contraction's strided layout directly and uses
IEEE float32 dots. It is restricted to frozen projection weights; ordinary
PyTorch handles trainable weights, other devices/dtypes, autocast and large
bases. Higher-order backwar... |
a83b554c06f01b3ef0de0bf835a67b5a98fe23b63c81a7bc56c418db9d9373d7 | Python | 11,011 | 247 | #################################################################
## SMART_FPinder ###
## Extremely experimental version ###
## Developed by Hyunwoo Kim, Chen Zhang, and Raphael Reher ###
## William H. Gerwich and Garrison W. Cottrell ... |
06bc9cfc08df48af6b4b917294bec43a7107c9522bf7d2860184b37780d09fbb | Python | 11,022 | 248 | # 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/>
"""Monte-Carlo Approximate Bayesian Computation (Rejection ABC)."""
from typing import Any, Callable, Dict, Optional, Tuple, Union
import torch
from num... |
9e811514ae92b356f3ed577351920dcb00df46cfb048b1765707aae2ec54394a | Python | 11,025 | 254 | # 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/>
import warnings
from typing import Any, ClassVar, Dict, Literal, Optional, Union
from torch.distributions import Distribution
from torch.utils.tensorboar... |
ee7f10c94320c96d0eb450cffbf6298dd46f9a5fa1360b6af5af437999e9d943 | Python | 11,026 | 310 | """test_convolution_layers.py
This file is part of the test suite for keras2c
Implements tests for convolution layers
"""
#!/usr/bin/env python3
import unittest
import tensorflow.keras as keras
from keras2c import keras2c_main
import subprocess
import time
import os
from test_core_layers import build_and_run
import t... |
a4b2f78d9607c75e16af9d7793dbdccfc6f956b4a6bb76670983940702dcfd40 | Python | 11,051 | 234 | """
Functions needed by the shiva.py script to run the pipeline
"""
from shivai.workflows.main_workflow import generate_main_wf, generate_main_wf_grab_preproc, generate_main_wf_rerun_postproc
from shivai.utils.misc import _export_workflow_compat
from shivai.utils.girder_utils import _resolve_girder_credentials
from sh... |
11b96ab249ff3eddba1d57db31fc72dfa57139c8afcb8e47a9970956fbb774f9 | Python | 11,058 | 216 | """SAMPLING ONLY."""
import torch
import numpy as np
from tqdm import tqdm
from functools import partial
from .diffusion_utils import make_ddim_sampling_parameters, make_ddim_timesteps, noise_like
class DDIMSampler(object):
def __init__(self, model, schedule="linear", **kwargs):
super().__init__()
... |
41797315deff8034123f60afd8b74d4a86b2e2d20e916d7ad78b1b1c5dda5a3a | Python | 11,061 | 305 | # Courtesy of https://github.com/ldeecke/gmm-torch
import torch
import numpy as np
from math import pi
class GaussianMixture(torch.nn.Module):
"""
Fits a mixture of k=1,..,K Gaussians to the input data. Input tensors are expected to be flat with dimensions (n: number of samples, d: number of features).
... |
734016f555abbe021ef56cef604d986a3f16acbfb8cae73631bfc9d10122993b | Python | 11,092 | 403 | import glob
from pathlib import Path
import mne
import numpy as np
import torch
from scipy.signal import resample_poly
from sklearn.preprocessing import RobustScaler
from usleep_no_hydra import USleep
def load_edf(input_file: str, channels_to_include, resample_rate):
"""
Load and preprocess an EDF file for ... |
7cffd503c6c5017238165c7f0910df19532f5ee96a9aae0bdff205925af511b5 | Python | 11,092 | 307 | # @author semese
from src.utils.data_loader import MobilityDataModule
from src.models.pred_model import WHODASPredictor
from src.utils.optimisation import ClassifierTrainer, RegressorTrainer
from src.utils.constants import demogr_cols
import torch
from sklearn.model_selection import StratifiedGroupKFold
import pickle... |
e4bab4cc087a38f2a19f4f08533dd5ce608f899b03c3b38eb7a439d16ffe731e | Python | 11,093 | 312 | from io import SEEK_CUR
from struct import calcsize, unpack
from typing import BinaryIO, Tuple, overload, Literal, Optional, Union
import numpy as np
import numpy.typing as npt
INT_STRUCTS = Literal['b', 'B', 'h', 'H', 'i', 'I', 'l', 'L', 'n', 'N', 'P']
FLOAT_STRUCTS = Literal['e', 'f', 'd']
class DapsysBinaryReade... |
76b185c2a82b999508fe037000979e66c0ac24a2d6fd8906bc9195f7ace6fa5c | Python | 11,096 | 355 | import scipy
import numpy as np
import scipy.interpolate as interp
import scipy.ndimage.filters as filt
import matplotlib.pyplot as plt
def flag_outliers(signal,
thresh_stdv=4,
buffer=10,
visualize=False):
""" Flag outliers based on median abs deviation.
... |
932a8c712ff8748f30c80f208daa5a40d47695a04f93a1bdeb56b5fa84a25d82 | Python | 11,100 | 275 | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
from mmcv.cnn import ConvModule, build_upsample_layer, xavier_init
from mmcv.ops.carafe import CARAFEPack
from mmcv.runner import BaseModule, ModuleList
from ..builder import NECKS
@NECKS.register_module()
class FPN_CARAFE(BaseModule):
"""FPN_... |
95efdde91c03ef6b79f0c71042c5b0b18292ff28640f0b6808071d13fdfc1bba | Python | 11,104 | 278 | """
Evaluation dataset for AnySleep model with flexible channel selection.
This module provides evaluation datasets for attention-based models that can
handle variable numbers of input channels. It supports various evaluation
scenarios:
- All available channels
- Specific channel sets
- Limited number of EEG/EOG chann... |
31ff6a1085e19ffd4323a9b3a44ee80c1193d6d4f0ee8889dd7d7c15236d6896 | Python | 11,108 | 250 | import os
import traceback
import pandas as pd
from tqdm import tqdm
from allensdk.core.brain_observatory_cache import BrainObservatoryCache
LIMS_DF = "/Users/chase/Desktop/MindScope/Documents/20200324_vis_cod_list.xls"
IS_WINDOWS = False
def to_mac_file(filename: str):
return filename.replace("\\", "/").replac... |
fafc983c3940e1c8eeddf04a0da1d84b050cb369ce9f6f12bc5c4c3edb29b607 | Python | 11,108 | 304 | # Copyright 2019 MaterialEyes
# (see accompanying license files for details).
"""Definition of the ExsclaimTool classes.
This module defines the central objects in the EXSCLAIM!
package. All the model classes are independent of each
other, but they expose the same interface, so they are
interchangeable.
"""
import jso... |
e957a048cd00acd278858d1e824aae2cf27cf541bdcf3e232d0e51892cbc041b | Python | 11,109 | 281 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os.path as osp
import warnings
import numpy as np
import torch
from numpy.testing import assert_array_almost_equal
from xtcocotools.coco import COCO
from mmpose.datasets.pipelines import (Collect, LoadImageFromFile,
... |
724b0399185815e05c15f039a0945e48e97e9ebd01ec71d1d9c5556b5ae7d98e | Python | 11,111 | 305 | from typing import List, Optional, NamedTuple
import pytest
import eagerpy as ep
import foolbox as fbn
import foolbox.attacks as fa
from foolbox.gradient_estimators import es_gradient_estimator
from conftest import ModeAndDataAndDescription
L2 = fbn.types.L2
Linf = fbn.types.Linf
FGSM_GE = es_gradient_estimator(
... |
8fcd9a975dd5458ff441080ef3f5aa0c647adee8b7ed7e485871bae8ddeb5568 | Python | 11,118 | 327 | from typing import List
import multipagetiff as mtif
import numpy as np
from matplotlib import pyplot as plt
import cc3d
from matplotlib.colors import LinearSegmentedColormap
from scipy import ndimage
from tqdm import tqdm
import logging
log = logging.getLogger(__name__)
def zmaxproj(stack):
return stack[:].max(... |
14892ffef22ca02198768f1d00767dffd81cd522640d8f937cad01d49cc45b42 | Python | 11,123 | 224 | from h5py import File
import numpy as np
from os import walk
from os.path import join
if __name__ == "__main__":
raw_dir = '/home/francishe/Documents/DFTBrepulsive/Datasets/raw/cutdown'
raw_2 = '/home/francishe/Documents/DFTBrepulsive/Datasets/raw/Molecule_Au2_cut_down.hdf5'
combined_path = '/home/franci... |
48490523b9e0cf25f5462827cf1d2fb239064dafa9169d5ebcac2840d3a2520a | Python | 11,126 | 331 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import os.path as osp
from glob import glob
import json_tricks as json
import mmcv
import numpy as np
from mmpose.apis import (collect_multi_frames, inference_bottom_up_pose_model,
inference_gesture_model,
in... |
76da2ab105208568d96fbee8a17537c5a92f9ee4b8c513ecf69019b2d4812fc2 | Python | 11,129 | 298 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.checkpoint as cp
from mmcv.cnn import build_conv_layer, build_norm_layer
from mmcv.runner import BaseModule
from torch.nn.modules.utils import _pair
from mmdet.models.backbones.resnet i... |
5609c8c1cbd6c8a0f317f26e3e141050bc68f71efee1575e41e5871f04d259ce | Python | 11,139 | 298 | from concurrent.futures.thread import ThreadPoolExecutor
from logging import getLogger
import numpy as np
from sklearn.metrics import confusion_matrix
from base.results.base_result_tracker import BaseResultTracker
from base.utils import calc_mode
logger = getLogger(__name__)
class SleepStageResultTracker(BaseResul... |
7abf45032b9914f4a70be940c0fb29b80adfe4a0a0156d08e416e89e4344df08 | Python | 11,140 | 290 | from __future__ import annotations
import copy
from collections.abc import MutableMapping
from random import Random
from typing import ItemsView, Iterator, List, Union
import h5py
import numpy as np
class Fold(MutableMapping):
def __init__(self, *args, **kwargs) -> None:
r"""Ordered-dictionary-like inte... |
b12a6910295e3378670e5ce892fdde2c2527b5dabc1fc48f18ec11d109543d6f | Python | 11,143 | 209 |
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
... |
e434bd513b691c88d348e370d3e1d04a13f4792ff06b2c22b6c44c3339b5b95c | Python | 11,157 | 271 | from collections.abc import Mapping, Sequence
from typing import Any
import torch
from torch import Tensor, nn
from aimnet import nbops, ops
from aimnet.models.base import AIMNet2Base
from aimnet.modules import AEVSV, MLP, ConvSV, Embedding
from aimnet.modules.aev import _can_group_dense_convolutions
class AIMNet2(... |
b2665e292b759a1bdb2fed59f049500763f4a4b02807918a13c4dc706ed3a9c5 | Python | 11,162 | 295 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import (build_conv_layer, build_norm_layer, build_upsample_layer,
constant_init, normal_init)
from mmpose.models.builder import HEADS, build_loss
from mmpose.models.utils.ops import resize
@HEADS.re... |
f535c9333bb8da91556575cbed5e04bbaeec0b619aca0ed13960b719af2917e7 | Python | 11,163 | 344 | # 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 __future__ import annotations
import math
import warnings
import numpy as np
import pytest
import torch
from scipy.optimize import linear_sum_assig... |
e5e5fe573da8f6fb4d961816e0e19bced78f13e7a35c5342497dfd013b5e95c9 | Python | 11,189 | 271 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn.functional as F
from mmdet.core import bbox_overlaps
from ..builder import HEADS
from .retina_head import RetinaHead
EPS = 1e-12
@HEADS.register_module()
class FreeAnchorRetinaHead(RetinaHead):
"""FreeAnchor RetinaHead used in https://... |
69c155b41b51c146b7314ae6213715f0285ab6479ffc4846250e247e73ba2b69 | Python | 11,196 | 312 | # Copyright (c) OpenMMLab. All rights reserved.
import os
import os.path as osp
import tempfile
import warnings
from collections import OrderedDict, defaultdict
import json_tricks as json
import numpy as np
from mmcv import Config, deprecated_api_warning
from ....core.post_processing import oks_nms, soft_oks_nms
from... |
1d794a57749415306e7ecfaf39a0d4f9782bab0eff1507acf9718cceb1d0145d | Python | 11,202 | 258 | #Module for running xTB-enabled DFTB+ on ANI-1 organic molecules
#%% Imports, definitions
from DFTBPlus import run_xTB_dftbp
import pickle, os, shutil
import time
import json
import argparse
from DFTBPlus import compute_results_torch, calc_format_target_reports
from typing import List, Dict
from MasterConstants import... |
6da674ff620fece2bafaf5125feb0b5b292c152ec9b358a74da0b3b3e8a60174 | Python | 11,203 | 290 | # -*- coding: utf-8 -*-
"""
Created on Mon Dec 28 13:40:17 2020
@author: Frank
Module for writing skf files, which are basically text files that adhere
to a specific format as described in the slater-koster file format document
Right now, the writer only handles simple format since we are not doing
angular momenta u... |
53203a3e32669a5675286951cba57bad2ec7099cd531b8a1c9004a363af33874 | Python | 11,210 | 276 | ############################################
# imports
############################################
import os
import subprocess
from collections import Counter
from Bio import SeqIO
from ._checkers_and_helpers import cast_to_list, safe_append_filename
from ._sequence_parser import FastaParser
######################... |
5a7535ccf3f190d56cccb17586eedf69137d15f5525cb85c39f8c3d7092ab247 | Python | 11,217 | 390 | import numpy as np
from sklearn.base import clone, is_classifier
from ...tests._utils import fit_predict, fit_predict_proba, tune_grid_search
from ...tests._utils_boot import boot_manual, draw_weights
from ...utils._propensity_score import _normalize_ipw
def fit_iivm(
y,
x,
d,
z,
learner_g,
l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.