sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
fe73ad57272f5308689296a33774010237e0ba73ce1e5f4bce8aef6744cbc6a9
Python
1,931
63
import enum import logging import os from typing import TYPE_CHECKING, Optional from .ranker import DefaultRanker, Ranker if TYPE_CHECKING: from ... import DataContext from .resource_manager import OpResourceAllocator, ResourceManager logger = logging.getLogger(__name__) DEFAULT_USE_OP_RESOURCE_ALLOCATOR_V...
a0aa724dc6c3f9f9c8ded8ad81426b79c6421a39aaa2362d0f0db8548e218210
Python
1,932
67
import os # __enable_start__ import os import uuid import ray.train import ray.train.torch # The detector reads these on the driver when you construct the trainer. os.environ["RAY_TRAIN_ENABLE_NCCL_HANG_DETECTOR"] = "1" # Log a confirmed hang and capture diagnostics without failing the run. # Set to "fail" to raise ...
d9b535b69c0e521efa92cbd803951d292ec903db9fbb3a66f008777412b720e3
Python
1,932
75
#%% import numpy as np import seaborn as sns import pandas as pd import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from matplotlib.pyplot import figure import argparse from tqdm import tqdm import json import os import numpy as np from sklearn.manifold import TSNE import matplotlib.pyplot as plt i...
380db6b2b6ca88d02182ec871b3e05522b7272fe2b899817e7663daa1d8063ee
Python
1,934
38
from tests.objects import test_node from neuron_morphology.morphology import Morphology from neuron_morphology.constants import * from neuron_morphology.validation.morphology_statistics import \ morphology_statistics import unittest from mock import patch class TestMorphologyStatistics(unittest.TestCase): """...
e5b72147af6917d1dd901f1742dea5d8f22b3b9d55c90ff54167e34fee73e690
Python
1,934
67
from __future__ import print_function, unicode_literals, absolute_import, division from six.moves import range, zip, map, reduce, filter from ..utils import _raise, consume import warnings import numpy as np from scipy.stats import laplace class ProbabilisticPrediction(object): """Laplace distribution (independ...
1ecb9dc5f2359c553e3c7c7c4c4b4b187041d86ef381ea3c1cce65085720c3c0
Python
1,935
31
"""Builds the in-browser CandyCrunch (web/) into a folder for GitHub Pages: the page, the wheels it installs (this checkout's candycrunch, glycowork) and the example run. Run by .github/workflows/pages.yml; locally, e.g. python packaging/build_web.py _site --glycowork ../glycowork, then serve _site""" import argparse i...
37262c23eb8f7c7f751815f597d2b334e41c2bf6e390230aed0ad25670eff70a
Python
1,935
61
# dataset settings dataset_type = 'lqit.RTTSCocoDataset' # `lqit` means the scope data_root = 'data/RESIDE/RTTS/' backend_args = None train_pipeline = [ dict(type='LoadImageFromFile', backend_args=backend_args), dict(type='LoadAnnotations', with_bbox=True), dict(type='Resize', scale=(1333, 800), keep_rat...
a2d20048c28466a744133a02c2ebb8765298c3cab2ea64ec64b1c6b4b729e426
Python
1,936
52
import inspect from google.protobuf.json_format import MessageToDict, MessageToJson """ This module provides a compatibility layer for different versions of the protobuf library. """ _protobuf_has_old_arg_name_cached = None def _protobuf_has_old_arg_name(): """Cache the inspect result to avoid doing it for eve...
0d6d76689f4931badc8129572fdacef3486515e70496416b2ce28147427d6bea
Python
1,938
79
import sinabs project = "Sinabs" copyright = "2019-present, SynSense" author = "employees of SynSense" master_doc = "index" extensions = [ "myst_nb", "pbr.sphinxext", "sphinx.ext.autodoc", "sphinx.ext.mathjax", "sphinx.ext.napoleon", "sphinx.ext.autosummary", "sphinx.ext.viewcode", "s...
cd7ad47abb8d71790b93a6b86d8d4f778c2552491967ef7efc9b830aba764899
Python
1,938
60
import argparse import functools as ft import swap_errors.analysis as swan def create_parser(): parser = argparse.ArgumentParser( description="estimate distances between analysis points" ) parser.add_argument( "data_file", type=str, ) parser.add_argument( "-o", ...
25682999713e3a83fcdcc6457572b7e3004f576f87c685b209d19743a660f337
Python
1,939
42
from IsoNet.models.unet.blocks import conv_blocks from tensorflow.keras.layers import MaxPooling2D, UpSampling2D, MaxPooling3D, UpSampling3D, AveragePooling3D from tensorflow.keras.layers import Concatenate def build_unet(filter_base=32,depth=2,convs_per_depth=2, kernel=(3,3), batch_norm=...
b0c47bd99bc9f496bff74d1ffcd3adf131ecfe112aa0856c4ba406f1db11030c
Python
1,939
57
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
02292bf737e6b504a4277a4f26fb158461dee059e33f61d93424b7501971c34b
Python
1,940
87
import pdb import torch import torch.nn as nn from latent_time_stepping.time_stepping_models.transformer import ( EncoderLayer, PositionalEmbedding ) class ParameterEncoder(nn.Module): def __init__( self, embed_dim: int, num_heads: int, embed_hidden_dim: int, num_la...
2a29c8d4dfcddefb73ef7a1656dea174e78d5d00142d2874452f1d0f15e1cb34
Python
1,940
62
from banditopt import algorithms, objectives P_STED = 150.0e-3 P_EX = 2.0e-6 PDT = 10.0e-6 # LASER_EX = {"lambda_" : 488e-9} # LASER_STED = {"lambda_" : 575e-9, "zero_residual" : 0.01} LASER_EX = {"lambda_" : 635e-9} LASER_STED = {"lambda_" : 750e-9, "zero_residual" : 0.005, "anti_stoke": False} DETECTOR = {"noise" ...
78e68a3de8db1e22dd58abb543c8e93c08e0f681e38ac36e997db67875024769
Python
1,940
52
import torch import torch.nn.functional as F from torch.nn import ReLU, Sequential, Linear, BatchNorm1d, Dropout, GRU from torch_geometric.nn import NNConv, Set2Set from torch_pgn.args import TrainArgs class GGNet(torch.nn.Module): """Stock network from QM9 prediction paper gilmer et. al""" def __init__(self...
7de5cbc2b851098d32442388e7951128de035cdaa84c90576222f022ed865032
Python
1,940
63
import collections.abc from typing import Any import numpy as np import torch __all__ = ["numpy_collate", "do_nothing_collate"] default_collate_err_msg_format = ( "default_collate: batch must contain tensors, numpy arrays, numbers, " "dicts or lists; found {}" ) def numpy_collate(batch: Any) -> Any: """ ...
8767dbdac6e231ac3c3f00c44267c9b4f10c659c89ccaebafb7a7f839faea286
Python
1,940
43
# -*- coding: utf-8 -*- from parameters import ParameterSet from mozaik.models import Model from mozaik.connectors.fast import UniformProbabilisticArborization from mozaik import load_component class VogelsAbbott(Model): """ This is implementation of model of self-sustained activity in balanced networks from:...
d450f4d4a822f26d49ce74c30e27b43c04e4a86b81a7046074c6083393398589
Python
1,941
47
import numpy as np import torch from torch.utils.data import Dataset, DataLoader from KS_equation import dynamics class KSDataset(Dataset): def __init__(self, batch, n_steps, L, l, dt, prediction_steps): super().__init__() self.batch = batch self.n_steps = n_steps self.L...
05cff308cdc9bdd51dc4c20b303cfdf1a43edc5d7b0b53cca0b919d1ce2b24ec
Python
1,942
60
# dataset settings dataset_type = 'lqit.URPCCocoDataset' # `lqit` means the scope data_root = 'data/URPC2020/' backend_args = None train_pipeline = [ dict(type='LoadImageFromFile', backend_args=backend_args), dict(type='LoadAnnotations', with_bbox=True), dict(type='Resize', scale=(1333, 800), keep_ratio=...
aec93d835eb9ac74682a478b822353d19839d84ff22422139415fa32858aecf8
Python
1,942
51
import argparse from pathlib import Path import torch import utils from lightning_modules import LigandPocketDDPM if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('checkpoint', type=Path) parser.add_argument('--pdbfile', type=str) parser.add_argument('--resi_list', t...
fe3ff8d30798b5d354f01f3999513ee28020d1eeed53a81cb15ab9c467247be5
Python
1,942
56
"""Base Configuration.""" # Copyright 2021 Google LLC # 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or...
248d0042daf952e8116ddb8a1a35642f7d4b2ad1d2b7261e84de5df28bb2f2df
Python
1,943
104
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ # OC20 # NOTE: this is the setting for slab and adslab from __future__ import annotations VASP_FLAGS = { "ibrion": 2, "nsw": 2000,...
885749c02d083a1427bb74a142ad99e86b9ffb9dca3b26c0fd47fa1b4a56e6f1
Python
1,943
51
from Bio import SeqIO import random import os import sys from pathlib import Path import pandas as pd project_root = '/ccb/cybertron/khchao/splam-analysis-results' def main(): SEQ_LEN = 800 THRESHOLD = 100 ref_junc_f = f'{project_root}/train/results/ALL_RefSeq/REF_junctions/ref_d_a.sort.bed' test_junc_...
f9e9db5f2d7bf9c930d8665255383ebc78f769f391dc5c16703cbaf3631a6cf4
Python
1,943
61
import numpy as np import pandas as pd import pytest from siapy.core.exceptions import InvalidInputError from siapy.features.spectral_indices import ( _convert_str_to_list, compute_spectral_indices, get_spectral_indices, ) def test_convert_str_to_list(): input_data = "R" expected_output = ["R"] ...
2af2861652af98ebf8c671d9abe3d26cad27b02a96b1f349ec4176382c9f85b0
Python
1,944
57
# Copyright 2021 Google LLC # 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
9e8fd523301541b9cdf77b4342710827907ecfa1c4752bd783a9153f44306aec
Python
1,944
57
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
b0fd6db793947e23e8c346513c26176ea705a2c7dcf6ffbb7d89bafeab3f8adf
Python
1,945
58
# Copyright 2021 Google LLC # 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
d6f78ebfb839e7ba1346475fb663ef5ccc71d7444ced0ff975e60a9be83d2f1f
Python
1,945
46
"""edgeofpy main module""" from edgeofpy.avalanche import (detect_avalanches, plot_pdf, plot_cdf, fit_powerlaw, fit_third_exponent, dcc, ...
5e121c64ddfede869e3df76a5b05ac0e0ae1d322db4cc003aa6969f1687a1831
Python
1,946
47
"""The Ray autoscaler uses tags/labels to associate metadata with instances.""" # Tag for the name of the node TAG_RAY_NODE_NAME = "ray-node-name" # Tag for the kind of node (e.g. Head, Worker). For legacy reasons, the tag # value says 'type' instead of 'kind'. TAG_RAY_NODE_KIND = "ray-node-type" NODE_KIND_HEAD = "he...
81abe3a52300b22381e41164c460aa74ff69f234cecbaf8dbd6e271af30dc3f9
Python
1,948
22
# Autogenerated by nbdev d = { 'settings': { 'branch': 'main', 'doc_baseurl': '/scAnnot', 'doc_host': 'https://changebio.github.io', 'git_url': 'https://github.com/changebio/scAnnot', 'lib_path': 'scAnnot'}, 'syms': { 'scAnnot.core': { 'scAnnot.core.ann...
e0e8c86d92067a4083300c4e91d78328a2cb81d33b967d4f36eee04d6dc093ad
Python
1,948
41
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
e96c4b46e2ef9372d2399a839f8a4d01538cf193229f94f0e5dfb1f8a494993a
Python
1,949
62
# -*- coding: utf-8 -*- """ EWH - I did not make this, but this is what is used for the LeicaWaterCam script so that a user can draw the area they want to get the light reflection off the water from. """ from pyqtgraph.Qt import QtCore, QtGui, QtWidgets class paintableqlabel(QtWidgets.QLabel): mod...
1f0e20dc8d54b39e5b1439ba557ba2ce15c97bba142918a00d79e060753315c7
Python
1,950
69
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ """ import os import argparse import gzip def chr_extract(pin, chr): out = '' for i in pin[7].split(';'): if i.split('=')[0] == chr: out = i.split('=')[1] return out def vcf_stat_readin(filename): fin = gzip.open(filename, 'rb...
7e3318cece181dd6865c41b8cf317ebf0fd04eeca2c49139ec9a502bc30b7ffc
Python
1,950
48
import pandas as pd from src.commons.process_dataframe import rename_df_col, insert_new_col_from_two_cols from src.commons.process_number import cal_SEM if __name__ == '__main__': to_excel = False # read data PATH = "../data/ms2_triplets_4_data/" DATA = "preprocessed_triplets_4.xlsx" data = pd.re...
067f68b6b5cb40cac12b91a1f2260c743622e31f8985c47809c6274d04377a09
Python
1,951
66
"""Compute statistical description of datasets.""" import importlib from typing import Any import pandas as pd from tqdm import tqdm from visions import VisionsTypeset from data_profiling.config import Settings from data_profiling.model.pandas.summary_pandas import ( pandas_describe_1d, pandas_get_series_desc...
1d77e1e37ba5e6777119aa6f2448f64caab1a6d84a56e5d2367996caceaaa10e
Python
1,951
43
from model import (ProteinInteractionNet, Trainer, Tester) from uncertaintyAwareDeepLearn import VanillaRFFLayer from utils import ( load_configuration, initialize_logging, set_random_seed, get_computation_device, initialize_scheduler, train_and_validate_model ) def main(): # --- Pre-Traini...
9251ffdf9f2a75c926988a29375b9063b07690f96dcfdfbcd44610e0a4c45d25
Python
1,951
50
#################################################################################################### # Copyright (c) 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is free softw...
207459cf559e877e37e8f2cc0980e4a6005270242730f859b73a3bc642f76751
Python
1,953
60
# dataset settings dataset_type = 'lqit.URPCCocoDataset' # `lqit` means the scope data_root = 'data/URPC2020/' backend_args = None train_pipeline = [ dict(type='LoadImageFromFile', backend_args=backend_args), dict(type='LoadAnnotations', with_bbox=True), dict(type='Resize', scale=(1333, 800), keep_ratio=...
403739f43353be1a209db7121d84d2f7d2b5f81d98d10dcbd77caab381ff92a3
Python
1,953
60
# dataset settings dataset_type = 'lqit.URPCCocoDataset' # `lqit` means the scope data_root = 'data/URPC2020/' backend_args = None train_pipeline = [ dict(type='LoadImageFromFile', backend_args=backend_args), dict(type='LoadAnnotations', with_bbox=True), dict(type='Resize', scale=(1333, 800), keep_ratio=...
ea968ea0fbf1b6eb89d33fb1e04e1fef9ed6e73e25c02cc3c6bdd9f5e1b25cc9
Python
1,953
60
# dataset settings dataset_type = 'lqit.RUODDataset' # `lqit` means the scope data_root = 'data/RUOD/' backend_args = None train_pipeline = [ dict(type='LoadImageFromFile', backend_args=backend_args), dict(type='LoadAnnotations', with_bbox=True), dict(type='Resize', scale=(1333, 800), keep_ratio=True), ...
1ef0bcfe0bf47d1a13c0a2f9e390bb0c0df3f9ac22ad0c46434e7342e36cf72f
Python
1,954
40
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
2a78c9c1c6cfc8e77c853815dffccba6fc2ce1cd00fedebf7b563cd4e8dc4fcc
Python
1,954
77
#!/usr/bin/env python3 """ Example script demonstrating how to use CEBRA for time contrastive learning. """ import sklearn.decomposition import torch import cebra import cebra.datasets if __name__ == "__main__": device = "mps" input_data = cebra.datasets.init("rat-hippocampus-single-achilles") latent_...
9193520c3c2fcd8f55e534941fa27b1af1309fb2db02c2e0e923943ecdde0201
Python
1,954
72
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import csv import os import pysam import sys def read_vid_list(vid_list): ids = [] with open(vid_list) as fin: reader = csv.reader(fin, delimiter='\t') for row in reader: vid = row[-1] if vid not in ids: ...
409f0f7da37addb8f655ffb5a7f85b89b58aa0fbd0b7572f26c8fd67b00d598d
Python
1,956
87
import numpy as np from numba import jit from tqdm import tqdm def sim_latent(N_CELLS, N_DIM): """ Draws a latent space coordinate for each cell randomly from a unit gaussian """ return np.random.normal(size=(N_CELLS, N_DIM)) def sim_umi_counts(N_CELLS, mid, scale): """ Simulates counts...
479da80d0256c014c32fe7ba990096f015940d62f855d4ecf77239795fd765a0
Python
1,956
45
import os import numpy as np from omegaconf import OmegaConf import argparse import time from utils.tool import read_img, save_img def merge(origin_path, decompressed_dir, chunks_dir): origin_data = read_img(origin_path) decompressed_data = np.zeros_like(origin_data) chunk_names = os.listdir(chunks_dir) ...
8dbd6ab5c1750b51ef28776b9688359b0018767453e19998fc6ac65c60af866c
Python
1,957
54
# # Copyright (c) 2021, NVIDIA CORPORATION. # # 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 # # Unless required by applicable law or agreed ...
acd6704ff638d065df217978c16bea71bf92e52b2e4957c637252955ebe8615b
Python
1,957
68
# Randomly select impact cases for combinations and write to files. import numpy as np import random import os def combination(case_num, nn, K, path): with open('injury_degree_both_MPS', 'r') as data: data = data.readlines() thres_len = round(len(data)/K - 1) injury_degree = np...
05401358e38ff764e4dae0077ef44a93ce0f91b106d78cdc183347421481c9a5
Python
1,959
64
import sys import numpy as np # Add package path packagepath = '../kcorePercolation' # Manually specify the path to your script sys.path.append(packagepath) from utils import kcorePercolation as kp # Import custom utility functions def generate_networks(networkpath, L=1000, ks=[5, 10], zetas=[4, 5, 100]): """ ...
8d22e78e10dabe4a1f7ec021a7f7af3eb22b0c9d04cfc3dbe390d81174c4a85e
Python
1,959
61
# Copyright (c) DP Technology. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np from functools import lru_cache from unicore.data import BaseWrapperDataset class RemoveHydrogenDataset(BaseWrapperDataset): def __init__( ...
e916a11ccd0de047d5f149bb694c71301706c40f072b4650b1e8052b7c14226a
Python
1,959
59
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. # pylint: disable=too-many-instance-attributes # pylint: disable=too-many-lines """Runtime parameters for settings at simulation time.""" from dataclasses impo...
689778f3c682a6366f961494d1656df6675682118e2e90c46ba1faaa1e65c4e3
Python
1,961
67
import pandas as pd import pytest from pyspark.sql.types import IntegerType, StringType, StructField, StructType from data_profiling.config import Settings from data_profiling.model.spark.sample_spark import get_sample_spark # FIXME: Move to data @pytest.fixture() def df(spark_session): data_pandas = pd.DataFram...
a76bbeb20901878e885aba4779b80f439deaaa9b7367de83d400fb8682604427
Python
1,962
54
import argparse import numpy as np import pandas as pd def main(): parser = argparse.ArgumentParser() parser.add_argument('input', type=str, help='Input UKB covariate file') parser.add_argument('--indiv', type=str, help='Path to subset of individuals') parser.add_argument('--add_cov', nargs=2, action='...
e5575b27626ed1eee9da576279ea4fb96ac7b8c37d83ec8f49f24092387bce7c
Python
1,962
47
import numpy as np from scipy import sparse from scipy.optimize import linear_sum_assignment import time def GetPerformance_Jaccard_2(GTMasks, Masks, ThreshJ=0.5): '''Calculate the recall, precision, and F1 score of segmented neurons by comparing with ground truth. Inputs: GTMasks (sparse.csr_matrix...
8906234c99f3ce2441a114e53a6692790352fe156955d2fa0d306c4ce94a69db
Python
1,963
72
import os import subprocess import json from spinnaker2.helpers import global_word_address """ Simple example that takes an input value, sends it to a PE, where it is multiplied by a constant depending on the PE-ID. The result is read out after the experiment and compared to the expected value. """ def global_pe_id...
8a8ebd12f7c24c8a6cbd57ef53bef3a8ea24bf63db11126b99e00d9f1e0239f2
Python
1,963
56
from typing import Any, Dict, Optional, Sequence, Tuple import pandas as pd from data_profiling.config import Settings from data_profiling.model.duplicates import get_duplicates @get_duplicates.register(Settings, pd.DataFrame, Sequence) def pandas_get_duplicates( config: Settings, df: pd.DataFrame, supported_co...
b3006d662c2251204493052e51bce40bf43de1c2463ab9b66be7bbc40a20ee96
Python
1,963
60
import abc from enum import Enum from typing import Iterator, Optional, Set from ray.data._internal.datasource_v2.interfaces.file_manifest import FileManifest from ray.data.block import BlockMetadata from ray.util.annotations import DeveloperAPI @DeveloperAPI class MetadataType(Enum): NUM_ROWS = 0 NUM_BYTES ...
d359b29b79685c5d59ebbc26b4b679e0b55934974d786d68ba07e6aff8451134
Python
1,963
46
import torch from ..distances import DotProductSimilarity from ..utils import common_functions as c_f from ..utils import loss_and_miner_utils as lmu from ..losses.base_metric_loss_function import BaseMetricLossFunction from ..losses.mixins import WeightRegularizerMixin class NormalizedSoftmaxLoss(WeightRegularizerM...
f4b3e5f3ff6dc5424b3874dd732ea4b0691599eaf99df546a450ac0ddc7666e3
Python
1,965
60
# dataset settings dataset_type = 'lqit.DUODataset' # `lqit` means the scope data_root = 'data/DUO/' backend_args = None train_pipeline = [ dict(type='LoadImageFromFile', backend_args=backend_args), dict(type='LoadAnnotations', with_bbox=True), dict(type='Resize', scale=(1333, 800), keep_ratio=True), ...
20132250d89fd752091af2c69ab086f6b210ef6346c0ad87682b96637e681d4b
Python
1,969
68
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from __future__ import annotations from typing import TYPE_CHECKING from ase.constraints import FixSymmetry from ase.optimize import FIRE...
51dda9cebfdcd03f0d80adf4f9b49f7d44707445b0ba104bf016ea6ed2d443d4
Python
1,969
65
r""" Batch correction module """ import os from typing import List, Optional import torch from torch import Tensor import numpy as np from sklearn.utils.extmath import randomized_svd from ..utils import get_free_gpu def dual_pca(X:np.ndarray, Y:np.ndarray, dim:Optional[int]=50, singular:Opti...
3e7a9a027a0ae666dc88befd893cc4f181c84f6c8c1868ec08d44d7ae77cf11f
Python
1,970
44
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
b8f01ada2081e90a536bf7cd7944e5ad2b13dc7970169704edc9baf76c5b836b
Python
1,970
75
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
2c6d81220f27cdb96d5fec93fec3851097e0296a4a29352914c3c1fb3ab1f0bc
Python
1,971
60
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # Calls the FXC compiler and generates a depfile from the compiler's standard output # Lines in the standard output matching: # Resolved to [D:\foo\bar.h] # Produce rules in the depfile import re, ...
c0b3f773a776d6cc0cc2d061d266b68bcc031767c2fb20f77d1b8b40e2c0e16e
Python
1,971
75
import os # CI environment is slow, set the timeout to 60 seconds os.environ["RAY_CGRAPH_get_timeout"] = "60" os.environ["RAY_CGRAPH_submit_timeout"] = "60" # __cgraph_cpu_to_gpu_actor_start__ import torch import ray import ray.dag @ray.remote(num_gpus=1) class GPUActor: def process(self, tensor: torch.Tensor):...
15c9dbaee4e43a7743b0fe9a2e4d12457a961f725877632fa4efda6fc67c12bd
Python
1,972
57
import numpy as np import pandas as pd import sklearn.metrics def decide_stertor_pred(row, threshs): """Pick class from logits using NNRank method""" row_classif = row > threshs for i in range(4): if not row_classif[i]: return int(max(i - 1, 0)) return 3 full_df = pd.read_csv("an...
4ef9539fba37ebae72d3da251e820021fda91dd1247a6ab03b3e74e6da989fb3
Python
1,972
46
import tensorflow as tf from projectmetis.python.models.model_def import ModelDef from projectmetis.python.models.keras.optimizers.fed_prox import FedProx class CifarCNN(ModelDef): def __init__(self, metrics=["accuracy"]): super(CifarCNN, self).__init__() self.metrics = metrics def get_mode...
60d9b720a2f31048cb781d9aa44c5e09057660d5160812ed7dd32adabe827d69
Python
1,972
59
# built-in dependencies from typing import Any, List, Tuple, Union # 3rd party dependencies import cv2 import numpy as np from numpy.typing import NDArray # These functions are copied from Minivision's Silent-Face-Anti-Spoofing Repo # licensed under Apache License 2.0 # Ref: github.com/minivision-ai/Silent-Face-Anti-...
921a2655949c22ca1319345710ac8ee8be9c5ae3a62fd9b5e3843d0756632e69
Python
1,972
68
import json import sys import time import boto3 import click from ci.ray_ci.utils import ci_init, logger from ray_release.test_automation.state_machine import TestStateMachine from ray_release.util import get_write_state_machine_aws_bucket AWS_WEEKLY_GREEN_METRIC = "ray_weekly_green_metric" @click.command() @clic...
9a2bda8abcedecc37c461a1cbe540ad93af1462a339f5ddffdd3501a15ead7e9
Python
1,972
61
import pytest from flask import Flask from deepface.api.src.app import create_app from deepface.api.src.modules.core import routes @pytest.mark.parametrize( "content_type", ["application/x-www-form-urlencoded", "multipart/form-data"] ) @pytest.mark.parametrize( "image", ["image.jpg", "https://example.com...
919ad53808b35dc502f78cb109b3b9142cef2e00af62977d154bea1eff485004
Python
1,973
71
import gym import gym.spaces import numpy as np import pytest import pfrl class ActionRecordingEnv(gym.Env): observation_space = gym.spaces.Box(low=-1, high=1, shape=(1,)) action_space = gym.spaces.Discrete(3) def __init__(self): self.past_actions = [] def reset(self): return self....
f6d565da4b20b0355e29e95fe53c18f89ee867020dccbf5db463559531d534f2
Python
1,973
55
import logging from typing import Any, Dict import ray from ray._common.logging_constants import LogKey class CoreContextFilter(logging.Filter): TASK_LEVEL_LOG_KEYS = [ LogKey.TASK_ID.value, LogKey.TASK_NAME.value, LogKey.TASK_FUNCTION_NAME.value, ] @classmethod def get_ray_c...
92cb20a525595ab56955c28394ff27ed07699a9251dc83896ef1f1bdda4262c7
Python
1,974
59
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
9bd3cb733a61b003e70da51b769e9423ae676c6c44d1a2140e86095aefba6f91
Python
1,975
40
from data_processing.data_utils import * from data_processing.embed import * import os # This script will process the raw data and embed using ESM-2. """First, process the raw Bernett data""" def make_bernett_interactions(dataset, target_dir, fasta): negative_file = f"{DIR}{intra}_neg_rr.txt" positive_fil...
a98cfed950ef414197ec63f0039f21a6575f146b0d63522e22d593b30b01b0fa
Python
1,975
72
""" Copyright (c) Meta Platforms, Inc. and affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. Uncompresses downloaded S2EF datasets to be used by the LMDB preprocessing script - preprocess_ef.py """ from __future__ import annotations i...
1fc79a875ed6efda3910f5d9467e83073e4abdb708dc16b834dc25909b44b7b9
Python
1,977
63
import matplotlib.pyplot as plt import seaborn as sns import numpy as np from stats import compute_stats, moving_average sns.set(style='white', palette='colorblind', context='talk') cpal = sns.color_palette() def plot_learning_curve( data, ylabel='MSE', window_size=1, alpha=.3, final_error_winsize=100, color=cpal...
01a93729087f55b513da4ddf0e570b5be3ca72ddbc379b09ca65d0c3aeb93fe5
Python
1,979
58
import logging from contextlib import nullcontext from typing import List, Union import torch import torch.distributed # noqa: F401 from ray.air._internal.device_manager.torch_device_manager import TorchDeviceManager logger = logging.getLogger(__name__) class TPUTorchDeviceManager(TorchDeviceManager): """TPU ...
270e1e501ac5044b48a1b456755cc34484857d800ea00596c7dc5063f0af527a
Python
1,979
61
import tensorflow as tf import numpy as np from IsoNet.preprocessing.simulate import TwoDPsf import mrcfile # def loss_wedge_mae(y_true,y_pred): def wedge_power_gain(y_true,y_pred): alpha = 0.15 y_pred_np = y_pred.numpy() # in the shape of [chanels,side,side,side,n] N = y_pred_np.shape[-1] cube_l...
af792b3903065d058cddb26e76ebbb0bb4a8bda333a1c970d597fa163455a8a5
Python
1,979
44
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
77d239dbdded91213bfbf89a18b7966ab017564a5687d146a51f3387d04cc68e
Python
1,980
75
# Determine the appropriate fitting interval based on the goodness of fit, # the error of the solution and the fitting range. # Requirements: 1. The goodness of fit is greater than 0.99; # 2. On the premise that the fitting range is as large as possible, # the solution error should be as small as possible. import n...
20328084eb158ba71fc130ba7871d80db664d9284b3350bbc6ad80a3b2b10d87
Python
1,981
57
# coding=utf-8 # Copyright 2023 HuggingFace Inc. # # 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 # # Unless required by applicable law or ag...
9104e2d1b51d6fb99d25c5045866008a3fc72ccb1525b29088af5bb844747c97
Python
1,981
67
""" Compatibility shim for the optional ``anndataoom`` dependency. omicverse's Rust-backed out-of-memory AnnData support is provided by the external ``anndataoom`` package (install via ``pip install omicverse[rust]``). If that package is not installed, this module provides no-op fallbacks so omicverse's core functions...
b7e58df649a4a268b73e5f21713df1cd8b9c37bc142b401d6d84f78989640d7a
Python
1,981
64
import logconfig import logging import logging.config def setup_logger( name, config ): ''' Returns a logging.getLogger instance with name and configured with dictConfig using config @param name - Name to give the logger(passed to logging.getLogger @param config - Valid logging.config.dict...
5e4fd313d2b4d3060a22c5eaa6356f04954376cc1b1085b9fca374a5297ad98d
Python
1,982
53
import numpy as np import pandas as pd import seaborn as sns from matplotlib import pyplot as plt if __name__ == "__main__": tags = ['Total Weight', 'Activation', 'Decay', 'STP'] dev_id = 0 reps_per_op = 10000 float16 = pd.DataFrame() float32 = pd.DataFrame() M = 64 while M <= 4096: ...
ca774e964ccf51f5a16892e13c28a3e0551887fd19fc6dceb03b5999a94713ed
Python
1,982
68
"""Testing center of mass calculation for layer-activity""" import numpy as np import nibabel as nb import glob import pandas as pd import seaborn as sns import matplotlib.pyplot as plt subs = ['sub-05', 'sub-06', 'sub-07', 'sub-08', 'sub-09'] subList = [] comList = [] durList = [] modalityList = [] for sub in subs...
83d86b69e2163c066e677566939c077c9be8e8f28bac91715e37467670d168bb
Python
1,983
58
import numpy as np import matplotlib.pyplot as plt from lib5c.util.plotting import plotter @plotter def plot_dd_curves(row, col, before, after, repnames=None, log=True, **kwargs): """ Plots a comparison of distance dependence curves before and after scaling. Parameters ---------- row, col : np.n...
885f9662cde81d0e5f2d6cb18fdda91f40647ef6b16111a7f71b4e2f0b9a6a38
Python
1,983
67
import os from setuptools import find_packages, setup import versioneer try: import builtins except ImportError: import __builtin__ as builtins builtins.__RISING_SETUP__ = True def resolve_requirements(file): requirements = [] with open(file) as f: req = f.read().splitlines() for r...
a5b9d6940ab1a7704659bd516711b02fea3628b5286e761de08546d876aa3fd5
Python
1,985
55
import pathlib path = pathlib.Path.cwd() if path.stem == 'tmb_survival': cwd = path else: cwd = list(path.parents)[::-1][path.parts.index('tmb_survival')] import sys sys.path.append(str(cwd)) import pickle import numpy as np import pysam from sklearn.neighbors import KernelDensity from tqdm import tqdm import ...
bb73e391a3893adf3425e94d71ea9ffb52fc48bd9a8bebda7355f665e7e6bde5
Python
1,985
53
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
2617d2933738f5ec0144dff1f91b5f71addedb8a77598770e23d933c19d17d63
Python
1,986
61
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
2f3b59682475bf19a4a101fe7b2ce568ed4deeff1d8deb563499d3739f28c4a3
Python
1,987
43
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
ea67330082b4c20390486ce10fddba964c535ae499c3daab0a0b7716df59558c
Python
1,987
67
import os import pandas as pd from data_profiling.model.summarizer import ProfilingSummarizer, format_summary from data_profiling.model.typeset import ProfilingTypeSet base_path = os.path.abspath(os.path.dirname(__file__)) def test_summarizer(config): pps = ProfilingSummarizer(typeset=ProfilingTypeS...
cf81cc7899f6e8a4e4c4ab232e1aa7610a50e936003f7bf0d4059e8924b161dd
Python
1,988
59
# Copyright 2026 Google LLC # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
fcc0f332ad0915949a0c1e40295a773be584454dbd8b69d2c612e4b077b6989a
Python
1,988
58
# Copyright 2021 Google LLC # 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
28cc6e187d982fa46d22ce7ff3de21adf708c7edaf24d26aeaca830ed59e0521
Python
1,989
64
# stdlib dependencies from typing import Any, List, Union # 3rd party dependencies from numpy.typing import NDArray # project dependencies from deepface.models.demography.DemographyUtils import RACE_LABELS from deepface.models.demography.onnx.OnnxDemography import OnnxDemography from deepface.commons.onnx_utils impor...
bc4b60c1e57a2531b7712374bc5727a3f814d4ee5c486a75eb6d996fda3af445
Python
1,990
53
# encoding: utf-8 r""" This module contains visualization code not conforming the Plotting framework defined in the mozaik.visualization.plotting module. Most of this code is likely being used as a debugging visualization tools or is generic visualization tools that can in turn be used by plotting algorithms. """ imp...
1d412c72bd07c6433908d7f1843f07c1a977ffdbd2061b41408b38ac25a4af2d
Python
1,991
48
import torch.nn as nn from src.networks.discriminator.utils import DiscriminatorNetworks from src.networks.discriminator.taming import TamingDiscriminator from src.networks.discriminator.baseline import BaselineDiscriminator from src.networks.discriminator.baseline_2d import BaselineDiscriminator2D def get_discrimin...
566f9f4ea43edb2a431daf2497b035956ba3b9a4710dbc4aab63b5bf38b3f9c5
Python
1,991
55
from textwrap import wrap all_aaa_file = "../data/all_aaa.fa" with open(all_aaa_file, 'w') as of: of.write(">AllAs"+"\n") all_aaa_str = "A" * 80 all_aaa_str = all_aaa_str + "\n" for x in range(40): of.write(all_aaa_str) of.write("A" * 24) of.write("\n") all_aaa_file = "../data/repat_4a...
87366a68f66327f74a3ecd0878b9d79d4f74ffc996ab2f408999d0ee8b077545
Python
1,992
58
# Copyright 2021 Google LLC # 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
f422ee98d164d320ab216615707e4532cba846b50ce2cad863b8aaec838f9d9e
Python
1,992
68
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ """ import argparse import pandas as pd import numpy as np import scipy.stats as ss def choose_parent_counts(stats): # If the children don't agree, pick the strongest is_child = (stats['sample'].str.endswith('p1') | stats['sample'].str.end...
3a46627297f5cc93ef8076b8e8ba001bcf6638679db0973d02297612f9f4860a
Python
1,993
66
"""Sub-agent that performs document search and summarisation.""" from __future__ import annotations from dataclasses import dataclass from typing import Any, Iterable, List, Protocol, Sequence class VectorStore(Protocol): """Minimal protocol for vector stores used by :class:`ResearchAgent`.""" def search(s...