sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
423f82724e3636338b408fbc7e5ed5604986ce7be1826d867775a82bbd95c152
Python
9,931
217
import sys from Reptile.meta import MetaLearner from AttentiveFP.AttentiveLayers import Fingerprint import torch from torch.autograd import Variable import numpy as np from torch.utils.data import DataLoader from utils.data_split import kinaseNshot import pickle import os # os.environ["CUDA_VISIBLE_DEVICES"] = '1' from...
be5e38eca78d5893f0d435eea27795fda3bb8c75c7bc0f3d491f9a992c900a81
Python
9,934
252
#!/usr/bin/env python3 """ Dx BD — Bootstrap CIs on §3.2 4×4 normalization cells ====================================================== Reviewer ask: bootstrap CIs on each cell of the §3.2 normalization-vs-mode table. Four normalization × mode combinations: rank-norm × deployment, rank-norm × strict z-score × depl...
cbf43e5073e1fb434923984dbd9aa8bd093ad1d72df835fdf8b7f5259a768d2a
Python
9,935
252
import numpy as np import pandas as pd import os from .conf_ranker import ConfRanker from rdkit import Chem from rdkit.Chem.rdchem import Mol, EditableMol from typing import Sequence, Tuple, Union from bioconfpred.conf_ensemble import ConfEnsembleLibrary from bioconfpred.data.utils import SimilaritySearch from bioconf...
890ca9b35602bf7855ba2e47be98b9ec8d354dad51c8f9b79a66a8336ce577e5
Python
9,940
297
#!/usr/bin/env python3 """ Script to validate file sources configuration by attempting to create instances of each configured file source. This script loads the currently configured file_sources_config_file YAML file and tries to instantiate each of the specified file sources in order to validate the configuration mod...
0b7bb7436e19fa9d8bc045f6d747a712ac5b2d2d951f2ace8c263ef529c50bcd
Python
9,942
254
# adapted from https://github.com/facebookresearch/detectron2/blob/master/detectron2/structures/keypoints.py from typing import Any, List, Tuple, Union import numpy as np import torch class Keypoints: """ Stores keypoint **annotation** data. GT Instances have a `gt_keypoints` property containing the x,y l...
178cb5aedc8eb59b0ff65d3409287ed50c691fe8d11ec2d13346cb7294385022
Python
9,944
249
"""Observe items 11-13: timeline v2 artifact, deterministic SVG, liveness view. Conservation and honesty pins: closed categories with named-absent facts, output pseudo-rows excluded, tied parameters counted once, the saved band never stacked (gross beside decomposition), module rollup conservation, a byte-exact SVG go...
b1290f315ecf8b87b094d56832002553be3fa4270891f743301625e73187610f
Python
9,945
241
#!/usr/bin/env python3 """ Dx AD — investigate which pipeline component creates the 0.70 noise floor. HC-vs-HC scramble configurations: baseline_rank_white_quad : rank-norm + whitening + Quad_LDA (Dx AA canonical) — 0.70 zscore_white_quad : z-score + whitening + Quad_LDA rank_no_white_quad : rank-no...
9e36544e21a07767ac1781016deaee7ef928624d20d13b2c9b314cf90265ef00
Python
9,946
254
"""Projective per-unit membership-transpose and geometric-adjoint goldens.""" from __future__ import annotations from collections.abc import Callable, Iterator from fractions import Fraction import pytest import torch from support.rf_isolation import preserved_rf_registry from torch import nn import torchlens as tl...
ca9b5a3fd154553e65baabf756961f4e76a0092aae1e0ee1f7dfaa8af25d19dc
Python
9,948
276
"""Capture-door intervention glue for ``tl.trace(intervene=...)``. Split out of ``user_funcs.py`` (C03 fix cycle): the backward sticky-spec builder for backward-only selectors and the capture-door fire-evidence envelope (ledger memo 3.1) are intervention machinery, not trace-entry resolution; ``user_funcs`` imports th...
d1a3bfcc4567301065580a0997878527f507db5b2e65d41112387f24f3425e7d
Python
9,948
230
"""Regression tests for SEC-H1: INST/OBJ opcode allocation-belt bypass. The ``SafeBundleUnpickler`` allocation belt (r49 storage, r63 tensor/ndarray) refuses constructing an attacker-sized ALLOCATION type (a torch storage, a ``torch.Tensor`` subclass or legacy ``torch.<dtype>Tensor``, or a ``numpy.ndarray`` subclass) ...
a0a2204e767f2557a00a14443daf3ad8e8d73198debc39711c4820d690784b1d
Python
9,949
241
"""Round-31 security regression: structural stdlib/builtin deny under trust. The "denied even under trust_custom_callables" contract for attacker-controllable ``.tlspec`` bundles was historically enforced by a hand-maintained DENYLIST of dangerous stdlib/builtin modules (``_DENIED_MODULES`` / ``_DENIED_FOREIGN_MODULES...
c32b2b27813c12fdccce2461c4aa74879cd5c387a29b02fc6eb6f8cd36f7e5f3
Python
9,949
197
# -*- coding: utf-8 -*- """ Created on Mon Sep 26 15:33:40 2022 This distributer contains a special case condition, if user waits more than 1.5 seconds after successfully doing a double or triple blink, the algorithm won't wait for the next event but sends the double blink event. Since 1.5 seconds is enough...
28b1dd5cd7772cf4889fd092855b91d721a18ab36bd783da25ade748ea328eb2
Python
9,950
309
""" Methods for detecting and combining files """ from __future__ import annotations import os import subprocess import numpy as np __all__: list[str] = [ "files_in_dir", "combine_images", "combine_videos", "combine_pdfs", ] def select_filenames(filenames: list[str], suf: str = "", pref: str = "")...
b9c1da0a5e6f63eb6e4b701d79e6fbb110ddb6254abce659220b4a20da4a944a
Python
9,954
246
import os import pandas as pd import logging from utils.json_loader import load_json_into_pandas_dataframe class SequenceIdentityCleanUp: """ This class take a list of path of folder dataset and allow us to generate the same dataset folder without inter contamination. A contamination is when some sequence...
87777fb7f000a0f736f91251a515785ca77fca070fe151c75ff00b2b08cf67bb
Python
9,955
232
import math from typing import Optional, Union import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from anndata import AnnData try: from typing import Literal except ImportError: from typing_extensions import Literal from .utils import save_return_show_fig_utils def...
e48922b29afbfe7e66fbb7fc464f4ea9f999f83bff10f314f2af47ab1ea1b756
Python
9,956
227
# Copyright (c) 2024 PaddleHelix Authors. All Rights Reserved. # # Licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 # International License (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at # # http://creativecommo...
23122b550be4030db56f839da054917c2d044e1131cb56b3130afc30559688fa
Python
9,957
236
"""Pose utils""" import time import logging import datetime import numpy as np import torch from .. import comm from ..utils import AverageMeter from ..model_utils import save_model from ..optimizer import maybe_add_gradient_clipping from ..eval_utils.coco_eval import COCOEvaluator logger = logging.getLogger(__name_...
fed5ea43324937438b8ef27127df5f95ff4cc7f4c6afbcb24f73bfd6c27baf5f
Python
9,959
244
"""Fixwave-2 FW2-POLISH pins for R19-3/4/5/7: module-cluster honesty. The dashed cluster style is a semantic claim ("no input ancestor"). The b6 probes found it lying in two ways: the input-connectivity propagation broke after the outermost module (a tautological loop guard), and clusters whose ops were condensed away...
1b78b1dc796e6e75874832cf62ece80575150ec36ee2caaf0243d07c083fa126
Python
9,960
267
# SPDX-License-Identifier: LGPL-2.1-or-later #!/usr/bin/env python from __future__ import print_function, division, absolute_import import unittest import numpy as np from pyEcoHAB import dominance_in_2_cages as dom from pyEcoHAB import SetupConfig, data_path class TestGetStates(unittest.TestCase): @classmethod ...
fe71376dec4981be03aa0f4e09dc6ca15e267e40ab8b1bb80a65ab88b8f63661
Python
9,960
261
"""Smoke tests for ``--concurrency=auto`` (cgroup-aware concurrency). These tests run real workers in Docker containers with real CFS quotas (``cpu_quota``/``cpu_period`` on the container), so the cgroup files read by ``celery.utils.sysinfo.cpu_budget()`` are written by the kernel — nothing is mocked. They complement ...
5cba4f02c4fa4eaeda1603df6dbc5444028f3ba93bb2991544468ab76e5346cc
Python
9,961
287
"""Streaming, truncating, non-recursive version of :func:`repr`. Differences from regular :func:`repr`: - Sets are represented the Python 3 way: ``{1, 2}`` vs ``set([1, 2])``. - Unicode strings does not have the ``u'`` prefix, even on Python 2. - Empty set formatted as ``set()`` (Python 3), not ``set([])`` (Python 2)...
078b8a9b4c3659a1e1c3046b28991519e8cbf7c288d1d0d20274ce6fe1502842
Python
9,963
265
"""Episode honesty refusals (lane F40a): pre-execution intervene refusal, declared-step cost ceiling, partial_log on settlement refusals, and the discoverability seam (capture_kind / episode step access).""" from __future__ import annotations import pytest import torch import torch.nn as nn import torchlens as tl fr...
91ee9a7f8896ceb6687371ed88f2a709926f0fa1a55fc751c01c291428356b17
Python
9,963
278
"""Base Command class, and related routines""" from __future__ import absolute_import import logging import logging.config import optparse import os import sys from pip._internal.cli import cmdoptions from pip._internal.cli.parser import ( ConfigOptionParser, UpdatingDefaultsHelpFormatter, ) from pip._internal.cl...
3bc90dbfcb5b2d4f8768c39e852b1497e280f96d6d313c36a180dd3f930aa822
Python
9,964
223
""" variability.py — Rolling-window temporal variability of acoustic features. Why this exists ---------------- Phase E analysis against the lab's real, curated starling corpus (5355 labeled bouts, 54 birds -- see project_vocal_recorder memory) found that several features' variability ACROSS a bout (std) was a stronge...
1eb037e98ec8634f313231aa68c11bf49e24ab6d90f8cab1f17ba23bb2c552a0
Python
9,965
249
"""Test of data set functionalities""" import pathlib import shutil import tempfile import nanite.model as nmodel import numpy as np import pytest from PyQt5 import QtCore, QtWidgets import pyjibe.head from helpers import MockModelModule, make_directory_with_data data_path = pathlib.Path(__file__).parent / "data" ...
39272f0058102606ef5ae6fac2b82b1f98285768b1066f6101357d57d6c8bc12
Python
9,968
235
"""Cancellation-aware reconstruction tolerance model (A03; mikit F4/F5). The reconstruction gate used to borrow the REPLAY tolerance table, whose absolute term sits at denormal scale by design; a reconstruction is an independent summation, so at cancellation sites (large addends, small output) the replay-shaped gate r...
d1d9c7616118e120b699b38d5c6bc84e07d09faf7b70cc70685ade0bd0a500de
Python
9,970
251
''' Copyright 2021 Twente Medical Systems international B.V., Oldenzaal The Netherlands 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 requir...
dffc42bad798fd53cd0dc8be7636da7298c583a117b0984fd8e2fcf9332e18b4
Python
9,978
318
"""Tests for TorchLens debug analysis utilities.""" from __future__ import annotations from inspect import signature from typing import Any import torch from torch import nn import torchlens as tl class TinyMlp(nn.Module): """Small MLP used by debug analysis tests.""" def __init__(self) -> None: ...
190af62fe6192caabb2c685d33b918b41bb1d60a37da9f0185647dbdca58ccdb
Python
9,979
299
# Copyright 2025 Google. # # 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 to in writing, soft...
751eda68e4cbe6750bfacfb75225203b4fd0547b123ee3e26737dfd7c25345c5
Python
9,979
339
from abc import ABC, abstractmethod import attr import numpy as np import torch ONLY_TRAIN_MAP = {"acceptor": 1, "donor": 2} class EvaluationCriterion(ABC): @abstractmethod def loss_criterion(self): """ Returns the loss criterion to use. E.g., an instance of `torch.nn.CrossEntropyLos...
85b51c22213f337e20c55fe9894c300a29d2994f2f379365a466a3dd337f00f1
Python
9,979
207
import numpy as np import torch from .base_model import BaseModel from . import networks from .nce import PatchNCELoss import util.util as util class CUTModel(BaseModel): """ This class implements CUT and FastCUT model The code borrows heavily from the PyTorch implementation of CycleGAN https://github.com...
2efb77bea06ed3856ecb510806437f02e5869d42515e052a1f39f7730613a671
Python
9,982
366
import random import logging import traceback import datetime, time import os import re from uuid import uuid4 def pi_version(): """ Detect the version of the Raspberry Pi. https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md We used to use cat /proc/cpuinfo but ...
bd97a6375c66fbb5b81419d86611196a447547241ddd31aa17bc6f1af0847408
Python
9,983
279
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
c803ee9c1bfae386e013264730a146420ef364015f0f5212410fbb64b7337bfa
Python
9,985
279
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
15861bdbad46d35d2289c8c323d3f4ade9e562e7aee15ecf7c5c2cc535d2f396
Python
9,990
256
from __future__ import annotations from typing import cast import torch from torch import Tensor from torch.nn import Module from torch.nn import functional as F from lightly.models.modules.center import Center class IBOTPatchLoss(Module): """Implementation of the iBOT patch loss [0] as used in DINOv2 [1]. ...
180ea18465ec6740c61b96d00943faecd809e0ebe0e88ef1dfe1ea6ccfff9247
Python
9,991
261
# Copyright 2021 DeepMind Technologies Limited # # 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 agr...
76e5470ba9a5c4e74156d5754cd1132f72dd93490616986b771b50c66ed93b27
Python
9,991
316
""" Contract tests for the DEB model's integration surface. These pin the boundary between ``lib/model/deb`` and the rest of larvaworld -- the stored-config keys, the recorded dict, the reporter codenames, the attributes the gut reads back, and the sim-loop stepping protocol. They are deliberately about the *interface...
7bc9cc91c6d1bbbe75136e2578a618600744f13d2d5301181465c6df84527e75
Python
9,993
293
"""Evaluation code for BDD100K lane marking. ************************************ Byte structure for lane marking: +---+---+---+---+---+---+---+---+ | - | - | d | s | b | c | c | c | +---+---+---+---+---+---+---+---+ d: direction s: style b: background c: category More details: bdd100k.label.label.py ***************...
1fe84a743c737520271fcd2099f563db0c4b3efad44facc6ef604e6d0663271f
Python
9,996
211
import numpy as np import pandas as pd import time import pickle import os from PCAfold import preprocess from PCAfold import analysis from PCAfold import __version__ as PCAfold_version print('numpy==' + np.__version__) print('pandas==' + pd.__version__) print('PCAfold==' + PCAfold_version) # Select one dataset: data...
655fdeaec6bc01c68e0db9acdb99a6bcde15549e5eb7a55e6ada633b977aead9
Python
9,997
205
import pandas as pd import numpy as np import sklearn from sklearn.decomposition import PCA import scipy.linalg as linalg import scipy.stats as stats from sklearn.linear_model import Ridge, LinearRegression from sklearn.model_selection import cross_val_score from sklearn.metrics import make_scorer, r2_score import pyal...
6ed27fdbb0525890b348c7841c2fe6c0c6df17d75a5b8948e33a3ed646d90c80
Python
9,997
285
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Nov 2 23:07:28 2020 @author: emilia """ import numpy as np from sklearn.metrics.pairwise import euclidean_distances from scipy.spatial import ConvexHull from scipy.linalg import orthogonal_procrustes def make_vec(point): """ Turn a point into...
0a6bddc8f9e6870f280b7dede703d7bb4184050e921b2022a3d3d93c54f0b99a
Python
10,001
251
# TODO: Add examples, tables and best practice links to command # TODO: Examples of truevalue, falsevalue # TODO: Test param extra_file # Things dropped from schema_template.md (still documented inside schema). # - request_parameter_translation import sys from io import StringIO from lxml import etree from yaml impo...
94300bc8d14fb5153cdb5d0ae8a1c0e0657120a26cb6a04cd11c3848677d7cea
Python
10,002
248
"""Order-isolation infrastructure guards (R76, reopened 2026-08-15). The suite's order-isolation story leans on ``pytest-randomly``: randomized default ordering surfaces order-coupling, and every ``-p no:randomly`` in the drivers/regen paths deliberately opts back into deterministic order. All of that is REAL only whi...
2e342aab161ddc212af0ea75745e81518375c15c57062a4aa2ffc7975901627d
Python
10,003
294
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType import copy as _copy class Hoverlabel(_BaseLayoutHierarchyType): _parent_path_str = "layout" _path...
44b9dd5eb6e950203ebbc6c4ef8f2c66e4acc9fc9d0aa8b40a2bbadac08cf02f
Python
10,003
313
from database import ( fix_ids, ImageModel, CategoryModel, AnnotationModel, DatasetModel, TaskModel, ExportModel ) # import pycocotools.mask as mask import numpy as np import time import json import os from celery import shared_task from ..socket import create_socket from mongoengine impo...
97fb2b598843b365e5e0088cae29be15406d2e28a256cd5933db3662ac5fb66e
Python
10,003
235
import torch.nn as nn import torch try: from torchvision.models.utils import load_state_dict_from_url except: from torch.hub import load_state_dict_from_url from .custom_modules import FakeReLUM, SequentialWithArgs, FakeReLU __all__ = [ 'VGG', 'vgg11', 'vgg11_bn', 'vgg13', 'vgg13_bn', 'vgg16', 'vgg16_bn', ...
b13b2d3836579e95c1b653ee751f1e31ed75cd9137eb2ad2d55ce54effd25273
Python
10,003
371
import seaborn as sns import matplotlib.pyplot as plt from controller_validation.data.preprocessing import crop_values import numpy as np import ptitprince from scipy.stats import ks_2samp from statannotations.stats.StatTest import StatTest from statannotations.Annotator import Annotator import scipy def ridgeplot(da...
f41044acc0a2edc6fe28d7f470a36caf53d1b0acbcb3e64dd869743ca9f354f0
Python
10,003
271
"""Wrap-state-independent ground truth (R75-1, b9-fable round-2 probe). Once torch is wrapped, the phase-0 ground-truth forward, the per-op replay, and backward validation's stock-autograd pass all observed through the SAME installed wrapper closures, so a TorchLens-induced numeric distortion (a planted 0.1% ``tanh`` ...
4ed96e6af603b5614628828cb97ebf9cb307194d7b57a62925aa68ea5e01003d
Python
10,004
309
import argparse from collections import OrderedDict from typing import List, Tuple import numpy as np import torch from pytorch_lightning import LightningModule, Trainer, seed_everything from pytorch_lightning.callbacks import ModelCheckpoint from torch import Tensor, optim from torch.nn.functional import log_softmax,...
8c83368ee3acc7e53914f6c5d7abadacb98c8137b30b46c0a63f75c57cee7705
Python
10,007
151
cat_names = ['SEX', 'TEACHINGSTATUS', 'BEDSIZE', 'VERIFICATIONLEVEL', 'CC_ADHD', 'CC_ALCOHOLISM', 'CC_ANGINAPECTORIS' , 'CC_ANTICOAGULANT', 'CC_BLEEDING', 'CC_CHEMO', 'CC_CIRRHOSIS', 'CC_COPD', 'CC_CVA', 'CC_DEMENTIA' , 'CC_DIABETES', 'CC_CHF', 'CC_HYPERTENSION', 'CC_MI', 'CC_PA...
ea014084246e68996d752f21c6a429fff0dc2364885a1caef211c7618571feb5
Python
10,009
247
"""Helpers for the dense relational PatchKernelAlignmentLoss. These utilities back :class:`~lightly.loss.PatchKernelAlignmentLoss`. The loss compares the pairwise similarity (kernel) structure of student and teacher dense features of shape ``(B, N, D)``. The helpers here cover: - validating dense-feature inputs, - op...
c4f6d5967cface67ec0b0d143d03dd89f147139d6b15671dc376393c33edfc58
Python
10,011
257
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import contextlib import glob import importlib.util import os import shutil import struct import sys import tempfile from contextlib import contextmanager from datetime import datetime from pathlib import Path cla...
c62462b0cf6a653d904194457716e5841df2901b85d298e18138f569d638fd54
Python
10,011
226
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 29 18:04:08 2021 This is the configuration file for Experiment 4, cue validity 1.0. To run the experiment, pass the path to the folder which is to contain the data from all Experiments on lines 197-198. @author: emilia """ import numpy as np import ...
0000c3607eafe3b69d1e920765df66d9ab0f06d349a6758c192dc37954fb1fb6
Python
10,016
282
''' load the RBNS data ''' import csv import re import h5py import urllib import gzip from io import StringIO import requests import numpy as np import time import os from utils_rbns import create_datapoints from constants import get_args from map_protein_name import ( get_map_protein, get_rbns_name_psam_idx_...
e19c05aa425a3c88b673ace2a290e8ee1a395623800433c4513adafb8a5e9c54
Python
10,016
254
"""Round-39 security regression: close the arbitrary-callable-INVOKE class in the ``is_pure_forward_callable`` denylist (finding secE-r38-1). The central runnable-``.tlspec`` purity gate ``is_pure_forward_callable`` denies side-effecting torch/tensor callables resolved from an UNTRUSTED bundle. r26 denied the elementw...
fc96f1370e22229e460915fa8ef0e4951cbe63335791dd475c087d0635be3b4c
Python
10,016
225
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 29 18:04:08 2021 This is the configuration file for Experiment 4, cue validity 0.75. To run the experiment, pass the path to the folder which is to contain the data from all Experiments on lines 196-197. @author: emilia """ import numpy as np import...
734b6d873626629b171f2b7f9015d9386a50a31cfe4db702eab9269974f3e072
Python
10,018
280
#!/usr/bin/env python3 """ File: plot_ieqtl_barplot.py Created: 2022/05/05 Last Changed: Author: M.Vochteloo Copyright (C) 2020 University Medical Center Groningen. A copy of the BSD 3-Clause "New" or "Revised" License can be found in the LICENSE file in the root directory of this source tree. """...
d2a895b6cc4c8a0cdc4b4916a45130dafbe3cb1334b47dbc05d8fa7fd77c3765
Python
10,018
249
from typing import List, Union from rdkit import Chem from rdkit.Chem import SDWriter from rdkit.Chem.rdchem import Mol from rdkit.Chem.rdFMCS import FindMCS from rdkit.Chem.AllChem import AssignBondOrdersFromTemplate from bioconfpred.data.preprocessing import MolStandardizer from bioconfpred.data.pose_reader import Po...
3f08b5d78e47423b37421bd4f49b50bb0633e06329103fac27cee1f1d2ab80f2
Python
10,019
350
from typing import Optional import pytest import torch import torch.nn.functional as F from flash_attn.cute import flash_attn_varlen_func @pytest.mark.parametrize("B", [1, 7, 20]) @pytest.mark.parametrize("H", [1, 4, 6]) @pytest.mark.parametrize("D", [64, 128, 256]) @pytest.mark.parametrize("min_seq_len", [1, 32, 128...
b37b0b268af9a20f2e2eeef6ab08935d0baad84c415ec0861b60c2a7c0310978
Python
10,020
309
import numpy as np import logging from cuteSV.cuteSV_genotype import cal_GL, threshold_ref_count, count_coverage import pickle ''' ******************************************* TO DO LIST ******************************************* 1. Adjust format in BND format; 2. Make TRA calls more sensitivity; 3. Collect DP ...
439bf812e28c3d49c9988d0310728a0a0447bf42f0c7f79db800bd3e8ac5ef2e
Python
10,022
237
"""MS COCO Detection Evaluate Metrics.""" from __future__ import absolute_import import sys try: from StringIO import StringIO except ImportError: from io import StringIO import os from os import path as osp import warnings import numpy as np import mxnet as mx try: from mxnet.metric import EvalMetric exce...
2d33b4159ccab36674301c6471c6831be75012c99b68b2e12a9fb4811e077500
Python
10,023
312
"""AMQP 0.9.1 REPL.""" import pprint import click from amqp import Connection, Message from click_repl import register_repl __all__ = ('amqp',) from celery.bin.base import handle_preload_options def dump_message(message): if message is None: return 'No messages in queue. basic.publish something.' ...
71b2d35edca5afe92adcfbd24c228c18be89f5397bd4e374c4109892ab2e7bb0
Python
10,024
218
#%% Packages import os import torch import copy import utils import warnings import numpy as np import tgan_utils import datetime import matplotlib.pyplot as plt import torch.optim as optim from TGGAN.TGAN import Discriminator, Generator import draw_utils warnings.filterwarnings('ignore') os.environ["CUDA_VISIBLE_DEVI...
3d53fe2e88ddbaf9fc93e851ff47201a3cd0d431f642bd1f85bc7e53dd626535
Python
10,025
312
############################################# # This file contains scripts to perform the # # Random Forest experiments. # # # # Author: Jonas Ditz # ############################################# import argparse import os import pickle fro...
4c32bfe61ef09d46b60c37c3d087f29a7fc2d08a54e33196b9d03de8a245cd98
Python
10,025
322
# coding=utf-8 # Copyright 2024 The Google Research Authors. # # 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 applicab...
1186bc8fde2e9179b4a04deb2cc57500dc5584b2044c6cc1fcc3f0c86c2e00f1
Python
10,027
225
from importlib import resources import pickle import json import dill import pandas as pd import numpy as np import warnings # Class for OrganAge class CreateOrganAgeObject: # init method or constructor def __init__(self, path_version_scale_factors_v4='v4_to_v4.1_scale_dict.json', ...
691f22594e0937bf3ea35c600bbe6ca09c0484b48978797d71bab87faae77a93
Python
10,027
299
import pkg_resources import logging from PyQt6 import QtWidgets, QtCore, uic from matplotlib.patches import Circle as MPLCircle import matplotlib import numpy as np from bmlab.session import Session from bmlab.controllers import ExtractionController from bmicro.BGThread import BGThread from bmicro.gui.mpl import Mp...
50ce2a6f0d8c06edc64c98e99f3fef141806a5c8db2ddd0af33abfbd96f19060
Python
10,028
277
#!/usr/bin/env python3 """ File: correlate_with_residual_effect.py Created: 2022/04/28 Last Changed: Author: M.Vochteloo Copyright (C) 2020 University Medical Center Groningen. A copy of the BSD 3-Clause "New" or "Revised" License can be found in the LICENSE file in the root directory of this sour...
f704254923f1f1d0fe4d88da4742954e29fab0469198e5854edbe976d41ad437
Python
10,028
272
# coding: utf-8 # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License...
de09856d0a8abf6a24721984f4521945c5e28bbe8509b47b9d72f20902af4a03
Python
10,029
254
from keras.src import backend from keras.src import constraints from keras.src import initializers from keras.src import ops from keras.src import regularizers from keras.src.api_export import keras_export from keras.src.layers.input_spec import InputSpec from keras.src.layers.layer import Layer @keras_export("keras....
b2d81e90df7ceeca546dd97d908c87335f5518e04889a9caf8b12776831c5403
Python
10,030
283
"""Entity-property tests for receptive-field views.""" from __future__ import annotations from collections.abc import Iterator from pathlib import Path import pytest import torch from support.rf_isolation import preserved_rf_registry from torch import nn import torchlens as tl from torchlens._io import FieldPolicy ...
cfc37e05bce92b7e625a73a1a3c2082ebc10c6c0827f2a4dc41a73bef172602a
Python
10,030
296
import ast import itertools import random import re import time import warnings from copy import deepcopy import casadi as cas import numpy as np import pandas as pd from casadi import SX, integrator, vertcat from rdkit import Chem, RDLogger, rdBase from rdkit.Chem import AllChem, Descriptors from tqdm import tqdm fr...
ac0a733ed8c4048238582611e8d841b7c7e53f57037a8e30559c75e1eff7b316
Python
10,032
226
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 29 18:04:08 2021 This is the configuration file for Experiment 4, cue validity 0.5. To run the experiment, pass the path to the folder which is to contain the data from all Experiments on lines 196-197. @author: emilia """ import numpy as np import...
b98cedb666d33ae174b68d755c62fd1937fb003e7a104a0b11143f33cb20ab0e
Python
10,038
308
import bottle import updater import logging import traceback import os import socket from optparse import OptionParser from helpers import get_machine_id, assert_node, WrongMachineID from helpers import get_commit_version, generate_new_device_map, updates_api_wrapper, reload_node_daemon, reload_device_daemon app = b...
24838a661bfb73fceedbe9bc08750db60a5a1d6dc59ca23aff6fc2163c635dcb
Python
10,039
187
import numpy as np from gym import utils from gym.envs.mujoco import MujocoEnv from gym.spaces import Box class ReacherEnv(MujocoEnv, utils.EzPickle): """ ### Description "Reacher" is a two-jointed robot arm. The goal is to move the robot's end effector (called *fingertip*) close to a target that is ...
b7f93ad0438c3f99ab1d760971e73015c7ce2be80d47068184ca0a0f711d9a92
Python
10,040
257
from typing import Optional, Tuple, Union import numpy as np import pyvista as pv from pyvista import PolyData try: from typing import Literal except ImportError: from typing_extensions import Literal from ....logging import logger_manager as lm from ..utilities import add_model_labels, merge_models from .ar...
4100662d9f1930ada4e4deedb45f4b6d6d1836046cd8b2c7caeae100f70c5b53
Python
10,041
233
from utilities.solutionTS import Solution from utilities.transformation import * import copy from scipy.special import gamma import numpy as np class HHO: def __init__(self, N, function): self.N = N self.population = [] self.function = function self.rabbit_location = [Non...
5c69c8a18f9ded617adc1f9817005f739cebaef309c5cc8298ab51111bb7d38d
Python
10,041
315
"""Classes & functions for managing parameters for simulating power spectra.""" from copy import deepcopy import numpy as np from specparam.data import SimParams from specparam.modes.modes import check_mode_definition from specparam.utils.checks import check_flat from specparam.modutils.errors import InconsistentDat...
82be1dbe53454313d71324fb5b7a7edd12ce058873d0b57b42e36ad68297810f
Python
10,046
265
import numpy as np # from utils import Recorder, Q_nak # from mitochondria import Mito from mitosfns import spike_quanta, run_sim from steady_state import get_steady_state from gates import get_ros, get_ros_fast, get_ros_slow, ros_inf from gates import ros_tau, ros_tau_fast, ros_tau_slow from gates import get_ros_con...
a68c05da53c939a9d8264ede9b86e635d5f6a116757b7e36e6cb4fa4a8d323da
Python
10,048
259
import os import tempfile import threading import time import unittest from unittest import mock import pandas as pd from codecarbon.core import cpu from codecarbon.emissions_tracker import ( EmissionsTracker, OfflineEmissionsTracker, track_emissions, ) from codecarbon.external import scheduler as schedul...
52ccc0a6ac5aee4422c61ad3de58a0c35c868d5a0218e578763f454d724f297c
Python
10,050
297
"""Download packaged HOBJ datasets into a local ``data`` directory.""" from __future__ import annotations import argparse import shutil import tarfile import zipfile from pathlib import Path from tempfile import TemporaryDirectory from urllib.parse import urlparse import requests from tqdm import tqdm # Public OSF...
d4f89314744e539024b032e3780c0b6d3d6027da78ef23d2f59b63b94d681107
Python
10,050
265
# Asteroid Impact (c) Media Neuroscience Lab, Rene Weber # Authored by Nick Winters # # Asteroid Impact is licensed under a # Creative Commons Attribution-ShareAlike 4.0 International License. # # You should have received a copy of the license along with this # work. If not, see <http://creativecommons.org/licenses/b...
98b415a5748df1522c06b9685c10d214e2275644c03c9027bf3d1e64864586e7
Python
10,051
291
"""Elasticsearch result store backend.""" from datetime import datetime, timezone from kombu.utils.encoding import bytes_to_str from kombu.utils.url import _parse_url from celery import states from celery.exceptions import ImproperlyConfigured from .base import KeyValueStoreBackend try: import elasticsearch exc...
91e988c7fa200cbfd1a0010e5489a329470dea4fd3adb7f6bfd98a542f30428c
Python
10,054
286
from __future__ import division import sys, itertools, optparse, warnings optParser = optparse.OptionParser( usage = "python %prog [options] <flattened_gff_file> <alignment_file> <output_file>", description= "This script counts how many reads in <alignment_file> fall onto each exonic " + "pa...
2a44c846fd87b0fb675808d864d05e44b4cb0000664a96578a7ca6635362fd89
Python
10,055
372
#!/usr/bin/env python """ Various io functions """ import importlib import warnings from pathlib import Path from xml.dom import minidom import numpy as np from .. import core as nap from .cnmfe import CNMF_E, InscopixCNMFE, Minian from .folder import Folder from .interface_npz import NPZFile from .interface_nwb i...
04eadc190d6591fe30664626a4a5d41ae4ce7465ea54ad6fde08f894f89f8c90
Python
10,057
232
from abc import abstractmethod from typing import Type, TypeVar import qt, slicer, json from SegmentEditorEffects import AbstractScriptedSegmentEditorEffect from PyQt5.QtWidgets import QDialog from SegmentEditorCommon.ListSelectionDialog import ListSelectionDialog T = TypeVar('T') class AbstractBiomedisaSegmentEditor...
f2338457e15697363936bbec9d9fb7121f9547e3917c4083ef19e2c499727f88
Python
10,058
299
from importlib import resources import logging from PyQt6 import QtWidgets, QtCore, uic from matplotlib.patches import Circle as MPLCircle import matplotlib import numpy as np from bmlab.session import Session from bmlab.controllers import ExtractionController from bmicro.BGThread import BGThread from bmicro.gui.mp...
736ef290b23fed4020682df2136689621635a5de860e032ab369b0045a957405
Python
10,062
211
import torch.nn as nn import torch.nn.init as init import torch import math class ACBlock(nn.Module): def __init__(self, in_channels, out_channels, kernel_size, stride=1, padding=0, dilation=1, groups=1, padding_mode='zeros', deploy=False, use_affine=True, reduce_gamma=False, gamma_init=None, nor...
c6277d8796f3b6db73a9aa0ae8f06c27d9ce8d8e267fd7d482d2ca5592d44231
Python
10,063
284
#!/usr/bin/env python import codecs import fnmatch import os import random import subprocess import sys import unicodedata import librosa import pandas import soundfile # <= Has an external dependency on libsndfile from deepspeech_training.util.importers import validate_label_eng as validate_label # Prerequisite: H...
22a68909d85436cbe8d3c52b72516c48309b293e16e05c7bad9a1de1330a6f86
Python
10,064
302
from typing import List, Optional, Union try: from typing import Literal except ImportError: from typing_extensions import Literal import numpy as np from scipy.cluster.vq import kmeans2 from sklearn.neighbors import NearestNeighbors from ..dynamo_logger import LoggerManager from .connectivity import k_neare...
bd4996c4f09810a15f5536a18cd6d4a390ce2669dd6a90d4232ad97d2662b1b2
Python
10,064
197
# -*- coding: utf-8 -*- """ Created on Mon Sep 26 15:33:40 2022 This distributer contains a special case condition, if user waits more than 1.5 seconds after successfully doing a double or triple blink, the algorithm won't wait for the next event but sends the double blink event. Since 1.5 seconds is enough...
b5495b1fcb91fee2693a3ce1e99e72d6c6956fc9545b19d8d7fea5e9b44100da
Python
10,065
223
# import numpy as np import torch import torch_geometric as ptgeom from torch import nn from torch.optim import Adam from torch_geometric.data import Data from tqdm import tqdm from ExplanationEvaluation.explainers.BaseExplainer import BaseExplainer from ExplanationEvaluation.utils.graph import index_edge class PGEx...
207875f2845d8e8707fb7aefacd51b6c6d622c16d7ba38f1077f54b664bf8861
Python
10,066
273
from typing import Generator, Any import numpy as np import pandas as pd import copy from mirp._images.generic_image import GenericImage from mirp._images.transformed_image import TransformedImage from mirp.settings.generic import SettingsClass from mirp._imagefilters.generic import GenericFilter class LocalBinaryP...
e72e5b835ea399d8436e5f456456bc63493ab67e9e9a91d794e25f32920f2d05
Python
10,067
286
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Test objects and function in tfep.nn.transformers.moebius. """ # =============================================...
a8cabbd0180206a1eb7207384e1829d266e8ea6c0564abf9dee7ea77edd0ec10
Python
10,069
330
"""Phase 5 postprocess preservation tests for intervention metadata.""" from __future__ import annotations import torch import torchlens as tl from torchlens.errors import MetadataInvariantError from torchlens.fastlog import RecordContext from torchlens.intervention.types import ParentRef, TupleIndex from torchlens....
8b0de092bfea57f55a7832051230f4315988c7d98872bfd192bdd281609542b2
Python
10,070
285
""" This file contains methods which calculate passive membrane properties from voltage-clamp sweeps. These methods are not optimized for speed or accuracy and are only provided for backwards compatibility. pyabf is intended to be used just for reading ABF files, and users are encouraged to write their own python code ...
a71091d94d003ebce187e2a20a5066dbd86a2cc8f20eab4f25a720232c0787cb
Python
10,072
285
""" Copyright (c) 2022 EPFL-BBP, All rights reserved. THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE BLUE BRAIN PROJE...
9eba8c3ed4bf1e366d373ed46df74676270a454d324f5e7e8f26057d539dc82b
Python
10,075
233
from typing import List, Optional, Tuple, Union import numpy as np from anndata import AnnData from scipy.spatial.distance import cdist try: from typing import Literal except ImportError: from typing_extensions import Literal from spateo.logging import logger_manager as lm from spateo.tdr.interpolations impo...
834a9963f79bdee1d2fe88b3263892cb8e384de8606b239b566fdb997fad8bed
Python
10,079
338
# coding=utf-8 # Copyright 2025 The Google Research Authors. # # 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 applicab...
acb4b3b6d9366c71d9d080c10541032178755d39931144568cfbfa2b2867f7fc
Python
10,080
252
"""L6 stage 4a: the FULL ACCEPTANCE GALLERY (design memo sec 3.4). The flagship composition demo of the selection algebra: ablate the INTERSECTION of two units' receptive fields vs their UNION vs a size-matched seeded RANDOM CONTROL, using the exact METAPLAN producer-to-producer spelling (``u.receptive_field.at(p) & u...