sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
710e87563931136356e6efacf283d3f87053a06737043908b805e8ea3080595b
Python
9,767
256
""" Author: Derek van Tilborg -- TU/e -- 23-05-2022 Functions to run a ChemBerta transformer for bioactivity prediction. We used pre-trained weights of ChemBerta trained on 10 million SMILES strings from PubChem. - RobertaRegressionHead: regression head that is slapped on the frozen pre-trained model - Tra...
826bd25ad4ff48909eda4d93ba565bea1fba3a07c94747dd8cef67ad8156daeb
Python
9,770
233
"""W051-IO: write/read symmetry for ``metadata.pkl`` (AUD-CODE 2.20 / 3.11g). ``tl.save`` must never write metadata bytes that a default ``tl.load`` cannot read back. Before this lane an arbitrary user object under ``Trace.annotations`` saved silently and made the WHOLE artifact unloadable with a misleading "corrupt p...
9e04698e35a461b60f360c9c1ba4ec2974a241baae7c94607bc67d4aa11204a4
Python
9,770
234
from keras.src.api_export import keras_export from keras.src.quantizers.quantization_config import QuantizationConfig @keras_export("keras.quantizers.GPTQConfig") class GPTQConfig(QuantizationConfig): """Configuration class for the GPTQ (Accurate Post-Training Quantization) algorithm. GPTQ is a post-trai...
d3525efc4eba5f3633f4a6b4a3fb171e1a5b6e1e513d82a7e54d1052ff392fad
Python
9,771
238
"""Implementation of a space that represents graph information where nodes and edges can be represented with euclidean space.""" from typing import NamedTuple, Optional, Sequence, Tuple, Union import numpy as np from gym.logger import warn from gym.spaces.box import Box from gym.spaces.discrete import Discrete from g...
baa908a51664c2c03566c1581c278971a3e6548d80a79bc8655b0bad0b3607b6
Python
9,773
297
"""Round-25 runnable producer capability regressions.""" from __future__ import annotations from collections.abc import Callable from dataclasses import replace from pathlib import Path from typing import Any import pytest import torch from torch import nn import torchlens as tl from torchlens._io.runnable import b...
76631149a1b1ba7137c0f4f2366e90075c726f7cb8d58308644ad3d78d7839c4
Python
9,775
221
# 均匀采样效果较差 import json import numpy as np import os, sys import random from collections import Counter from sklearn import preprocessing from sklearn.metrics import f1_score from sklearn.metrics import confusion_matrix import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils import torch.nn.functional ...
ae73d0dea269a1e2976a9f55fe1d5bc03f5147aef5c60f46e71a72311f23402f
Python
9,780
273
#!/usr/bin/env python3 """ 5D Eval — Diagnostic F 7D classifier battery. Merges 5D + extras (IAF, DFA, KOP_beta, LZc) across cohorts, then runs: T_AD: AD vs HC (5D baseline vs 7D with +IAF +DFA) T_FTD: FTD vs HC T1: Cortical (AD+FTD) vs Subcortical (PD) — PD cohorts will be 5D-only since w...
bbe4b81b27abf3924285f68e74761d4f3c9a7f93b0ba59dffca7263a5ba49dc9
Python
9,783
253
"""Echo narration on real architectures (snoop memo section 5; R0 realism). Toy-only validation is disqualifying: these rows exercise a config-built GPT-2 (real architecture, zero network), the real torchvision resnet18 with its pretrained weights, and the real distilgpt2 checkpoint. Crash rows use REAL failure shapes...
1ea6c0dcba3f308e5b17ce18a8e91a9af11e7bf1b69785ac812fc0a9a819b131
Python
9,785
227
#!/usr/bin/env python3 #-*-coding:utf-8-*- # 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/lic...
f7e67c6b450bf8d5b79e01b984f58fdb387c81e978cd6feff94ba8d76b51f624
Python
9,785
346
"""Round-24 runnable regressions for ``__idiv__`` and buffer ``.data`` host writes.""" from __future__ import annotations from collections.abc import Callable from functools import partial from pathlib import Path from typing import Any import pytest import torch from torch import nn import torchlens as tl from tor...
4c642e426a0f2f206e96fb982b3f43cd7f24cf4c0db9c62bd832757c7a84ebfe
Python
9,786
316
# %% import torch import torch.nn as nn import torch.nn.functional as F import numpy as np from models.make_model import MakeVideoModule, early_fusion, late_fusion, single_frame from pytorch_lightning import LightningModule from utils.metrics import * from sklearn.metrics import confusion_matrix, ConfusionMatrixDi...
df79acafb234ae051ec95916d256988bda6501eeb7f6005839991a0b0d16f50b
Python
9,788
221
#!/usr/bin/env python3 """ Dx Z+ — verification of the brainlat-out tool with perm null + bootstrap. Pool: ds004504 + ds006036 + figshare 5450293 (AD cohorts) + ds003775 + LEMON ≥60 (HC-only cohorts). n = 365 (96 AD + 269 HC). Same canonical pipeline as Dx X (HC-cov whitening, λ = 0.001, Quad_LDA), 500 perm + 500 boo...
9031c8fce8a2175de22f1726d61f4216b4ebdfd6164d0befc7e43d113c01d628
Python
9,789
299
"""Queryable per-op nonfinite record: ``Trace.nonfinite_ops`` and friends. Covers the two evidence bases (post-hoc saved-payload scan vs capture-time ``track_nonfinite`` recording), the coverage disclosure that keeps a scoped clean answer honest, the deferred-flag drain, the zero-cost-when-off contract, and the struct...
e24fba9ed5c7682017045853142b51b3900dc09956b96be27dccc9f14064a833
Python
9,791
227
import numpy as np import pandas as pd from library.comput_utils import acc_metrics class PSPkernel: def __init__(self, tau, tau_s): """Alpha function for post-syanptic potential. Args: tau (float): Decay time constant of the alpha function kernel. tau_s (float): Rising t...
831380ae25944368108703c8034740e16b1f6971b395e3b6ae36052c173e08bc
Python
9,796
292
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in November 2019 @author: Quentin Lutz <qlutz@enst.fr> """ import pickle import shutil import tarfile from os import environ, makedirs, remove, listdir from os.path import abspath, commonprefix, exists, expanduser, isfile, join from pathlib import Path from ty...
5311824af590cd8ef89fec6025a734129c27d17af9f934ffa400c43c12d69da1
Python
9,801
222
#!/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, AI vs learning speed analysis. It differs from the main Experiment 4, cue validity 0.75 configuration file in just one aspect - it is set to train more (N=100) mode...
bd2855c00f934ada591d396f48d8eb026c6d11ad8d5889544d4b1ff1fe093cd3
Python
9,802
374
# Copyright 2023 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 agree...
c8be8b1cb2ec8e794aa1949090123eae67b50bee30e8c2bdedddfa60a9249411
Python
9,803
329
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Header(_BaseTraceHierarchyType): _parent_path_str = "table" _path_str = "...
d13059ff0d4f1cb632aef87546c6dda332e19e99ac1e18f72626d31cc48a887a
Python
9,803
308
# pylint: disable=missing-function-docstring, line-too-long, consider-using-with """ Utility functions, misc """ import os import sys import time import functools import logging from contextlib import contextmanager from functools import wraps import numpy as np import torch.nn as nn import torch def read_labelmap(l...
ae570582092f6affff1deb24ed256ec763650d2fb1220cea987a4b014b717a01
Python
9,805
202
""" Some key layers used for constructing a Capsule Network. These layers can used to construct CapsNet on other dataset, not just on MNIST. *NOTE*: some functions can be implemented in multiple ways, I keep all of them. You can try them for yourself just by uncommenting them and commenting their counterparts. Author...
b6a4b0db3018cf70ad1a1082e075c621575a2a5724afd670a46113133e5b43ba
Python
9,805
279
"""Parse buildings from one PBF with one tool and print {"seconds", "features"} as JSON. `benchmarks_scaling.ipynb` runs this as a separate subprocess per (tool, area) so each parse is isolated: the parent process samples the whole process tree's peak memory with psutil and enforces a timeout, and a crash or out-of-me...
596c04fc00a00b1557a2435c5db9c83b0831a6291bf2d81298c20d3e77d31bb0
Python
9,806
210
''' TNS class : Grower object that contains the grower functionality. ''' import copy import logging import numpy as np from morphio.mut import Morphology # pylint: disable=import-error from tns.generate.soma import SomaGrower from tns.morphmath import sample from tns.generate.tree import TreeGrower from tns.generat...
0ba238db66229bb128d7c5d2dc955cf3dd6fd4f446d020c17d9e92e0033acb08
Python
9,814
304
"""S2 capture-spine golden projections across public capture surfaces.""" from __future__ import annotations from collections.abc import Callable from dataclasses import dataclass from typing import Any import pytest import torch from torch import nn import torchlens as tl from torchlens.fastlog import RecordContex...
83d292a46d14e01abced0d3fb8e68da9157be2ab850dba2ccc23e8b0737dbd3e
Python
9,815
269
"""Two-term compute record + FMA convention (A5/A6). Lane A07 (2026-08-27). Spec: the summary design memo 3.2 + build item 9; costreport item 3 (MACs stop being flops//2 everywhere). True MACs = sum(fma_macs); a ReLU has ZERO MACs; a biased Linear(8,16) has 256 (never the 272 that flops//2 fabricates); count_fma_as_tw...
22814b350b206e6642570f6421bcce6db473b9985b6e0bd23ae208b9e650eb6b
Python
9,818
238
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the "Software"), # to deal in the Software without restriction, including without limitation # the rights to...
1a56774e0a25de1d9cecadba98dd2f035dac2f3780b905bd6968b74046b84abe
Python
9,820
327
from collections import Counter from functools import lru_cache, reduce import itertools import attr from cached_property import cached_property from matplotlib import pyplot as plt import numpy as np import pandas as pd from permacache import permacache, stable_hash import torch import tqdm.auto as tqdm from sklearn....
72ccbd506b220de4fa14663f47c819c4f2c703a50f8f34276e25a0f922041467
Python
9,823
274
################################################################################################################################################################# ####################### Creating inputs for Multi-resBind ###################################################################################################...
5d4138d344fe7c1538b93695510854cf58e9413a5c6b9a4714abdffe9880e9b1
Python
9,825
323
"""Phase 4b intervention replay-template and output-path tests.""" from __future__ import annotations from collections import namedtuple from dataclasses import dataclass from typing import Any import pytest import torch import torchlens as tl from torchlens.backends.torch.ops import ( _replace_output_tensors_b...
ec23373eddda0e681afb74c7e5d1f8cc099665f80506840e86991b7cb5380abf
Python
9,826
282
""" http://incompleteideas.net/MountainCar/MountainCar1.cp permalink: https://perma.cc/6Z2N-PFWC """ import math from typing import Optional import numpy as np import gym from gym import spaces from gym.envs.classic_control import utils from gym.error import DependencyNotInstalled class MountainCarEnv(gym.Env): ...
0a9d6b89a2eada3211531dd4924e91a165f625a644ace8761698e22c891b7555
Python
9,827
226
import numpy as np from numpy import array import random from gym import spaces from gym.utils import seeding class TunlEnv(object): def __init__(self, delay, seed=1): """Trial-unique, delayed nonmatch-to-location (TUNL) task (Talpos et al., 2010) In each trial/episode, there are 5 stages: ...
2cdb88c59ff1a6f6b002c6237a4825ae745360cb3fc688b2c81176016c799e8f
Python
9,833
237
import tvm from tvm.contrib import graph_runtime from typing import List import cv2 import numpy as np try: import torch except ImportError: torch = None class PoseEstimationInferenceModel(): def __init__( self, model_prefix, gpu_id, image_width=1280, ...
59b6dacd80da3acade90ed2b3b75776b300bca198c9c3b510d004bdd0d4d8a15
Python
9,833
223
# 均匀采样效果较差 import json import numpy as np import os, sys import random from collections import Counter from sklearn import preprocessing from sklearn.metrics import f1_score from sklearn.metrics import confusion_matrix import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils import torch.nn.functional ...
d14d6f576fb14b902db9561c561de615e343ce657ae2d067cd3b4ba0ef95e809
Python
9,833
208
""" FitzHugh-Nagumo with the Analytical Jacobian ============================================ The `FitzHugh-Nagumo (FHN) model <http://www.scholarpedia.org/article/FitzHugh-Nagumo_model>`_ is a textbook 2D reduction of the Hodgkin-Huxley equations. The system has a single cubic non-linearity and is a clean target for ...
d3ee6c0b158470d33d688aa3f884445531790a7b7350adb5f825edab8ece0e76
Python
9,833
230
import argparse import torch import torch.backends.cudnn as cudnn from torchvision import models from data_aug.contrastive_learning_dataset import ContrastiveLearningDataset from models.resnet_simclr import ResNetSimCLR from simclr import SimCLR import torchvision import sys import numpy as np import os import yaml imp...
5031d21f727794522461bfe851da7d00713a03ba6cf4b87bf8b459f9bd0d97c2
Python
9,835
240
import os.path as os_path import importlib.resources import traceback import nanite from PyQt6 import uic, QtCore, QtWidgets from PyQt6.QtCore import QStandardPaths from ..extensions import ExtensionManager, SUPPORTED_FORMATS class ExtensionErrorWrapper: def __init__(self, ehash): self.ehash = ehash ...
6475007041eb9ed2c08a9900443a8fd0ddb4f61f8c6108c8a6e3463acf7a3b73
Python
9,838
271
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # ------------------------------------------------------------------------------ from __future__ import absolute_import from __future__ import d...
824c40716c26e52a2896fc4bfc66ccfb835f5ff404e966e60336ce10082c6e3b
Python
9,838
223
# 均匀采样效果较差 import json import numpy as np import os, sys import random from collections import Counter from sklearn import preprocessing from sklearn.metrics import f1_score from sklearn.metrics import confusion_matrix import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils import torch.nn.functional ...
df011ea8fdf50c913a82820260cc91cddd75524dbc3af239d2557d5f08efc5c1
Python
9,841
245
""" .. _tut-source-level: Tutorial part 2: RSA on source-level MEG data --------------------------------------------- In this tutorial, we will perform source-level RSA analysis on MEG data. If you haven't done so, I recommend first completing :ref:`tut-sensor-level`. While sensor-level RSA is useful to get a first...
0389c0f7d59441c8942dfd71b21c11fbe27e08ab97e98194990d450857151f93
Python
9,843
227
import os, qt, ctk, slicer, sys current_dir = os.path.dirname(os.path.abspath(__file__)) root_dir = os.path.abspath(os.path.join(current_dir, '..', '..', '..')) sys.path.append(root_dir) from biomedisa_extension.SegmentEditorBiomedisaPrediction.Logic.BiomedisaPredictionParameter import BiomedisaPredictionParameter fr...
cc28bfca8fd790fed54c90adf088410cb461ce7c4055b8a5f21977c59c6ec24e
Python
9,843
277
# coding=utf-8 # Copyright 2022 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...
1de6d16eb598c9546a10572b22d0d426d89436c07f555423bb8d49a07631b87e
Python
9,844
250
import numpy as np from skimage.metrics import structural_similarity from functools import partial from typing import List, Union, Callable, Tuple import nway.image_processing_utils as impu import nway.transforms as tf class MetaRegistration(): """Attempts multiple types of registration and chooses the best o...
a85a6616a5d6c1011e6632a879efed190560465d0f0fae52891d8598869bf1ae
Python
9,845
235
#!/usr/bin/env python3 """ Dx AM — multi-channel ablation / reduced-montage sensitivity (figshare). Question for clinical deployment: does the tool work with reduced electrode montages — clinical-screening 10-channel, consumer-grade 4-channel, etc.? Method: Reuse Dx AL's per-epoch raw-input capture for figshare. Fo...
acf5e4f919fe61f446d53589b14dec46d8b173005f323efe11c0f7a7d73d30a2
Python
9,845
260
import ast from os import PathLike from typing import Sequence import numpy as np import pandas as pd from chemprop.data import MolAtomBondDatapoint from chemprop.featurizers.molecule import MoleculeFeaturizerRegistry from chemprop.utils import create_and_call_object, make_mol, parallel_execute def build_MAB_data_f...
12317c828b4d339ca279d31caf289bcbdf93507b0acda9b4ec53ac87d1e802d7
Python
9,846
298
import abc import logging import os import re from collections.abc import Callable from galaxy.datatypes.binary import Binary from galaxy.datatypes.data import ( get_file_peek, Text, ) from galaxy.datatypes.metadata import MetadataElement from galaxy.datatypes.protocols import DatasetProtocol from galaxy.datat...
110ebadc4905a29cebb8dadbfed832fce9bed65bcda0828b01af3f0e4f480aa3
Python
9,849
203
'''Alignment of two sets of cells (align_cells; see its docstring). The cells are rasterized into density images at a fine pixel size with a kernel of a fixed physical width, and LDDMM is run coarse to fine on mean-pooled copies of these images: each level starts from the affine transform and velocity field of the pre...
86bb3fb70ea3603610b8330134fb11efb1c6824d7233c847a022f6c03f23e593
Python
9,849
280
"""Tests for the xcp_d.interfaces.nilearn module.""" import os import nibabel as nb import numpy as np import pandas as pd from xcp_d.interfaces import nilearn def test_nilearn_merge(ds001419_data, tmp_path_factory): """Test xcp_d.interfaces.nilearn.Merge.""" tmpdir = tmp_path_factory.mktemp('test_nilearn_...
754dfe1e0790f2740e14ef3247ae50e043cfa92e0d98031ba3cafa16e43c5d58
Python
9,850
287
import logging import galaxy.exceptions from galaxy import ( model, security, ) from galaxy.managers import users log = logging.getLogger(__name__) class RBACPermissionFailedException(galaxy.exceptions.InsufficientPermissionsException): pass class RBACPermission: """ Base class for wrangling/c...
5122302cd7890670834a36e7c2946c98e17d908cacc4b83f52d81b20ff877c3d
Python
9,853
252
# -*- coding: utf-8 -*- # Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl> # All rights reserved. """ Module defines single :class 'SmartTagsManager'. Author: Mateusz Kruszyński <mateusz.kruszynski@gmail.com> """ import queue from typing import Optional from functools import cmp_to_ke...
3d92af8378ba72ec13932f895c071dcba0bd22d6180d0202aa4c97160c2c2db0
Python
9,855
247
# tests/unit/util/test_util_shapely_aux.py """ Unit tests for larvaworld.lib.util.shapely_aux module. Tests shapely geometry utility functions with synthetic Point objects. All tests use deterministic geometric data for reproducibility. """ import pytest from shapely import geometry from larvaworld.lib.util.shapely_...
0ea98685c98c8423ed63c318b4350b98896e200449c4c49c839607403d9f9d99
Python
9,857
238
""" check_leakage.py — quantify evaluation leakage on label-free data. Generates synthetic EEG in which the labels carry NO information about the signal, then runs the classification pipeline under controlled and uncontrolled protocols. Any accuracy above 0.50 is manufactured by the protocol. Two leakage sources are ...
af2af3a4ee1045d24084330c2ccab61fd4934ba521ed80e1e72fde614e834b51
Python
9,860
242
from __future__ import annotations """IO handler for eFEL""" """ Copyright (c) 2015, EPFL/Blue Brain Project This file is part of eFEL <https://github.com/BlueBrain/eFEL> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3.0 as...
bbd1abdc40b58ebb840c737fb5ce60f5693de7aba0a90abfb5f9e5a41ad2b459
Python
9,861
194
# -*- 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...
f86a224f77ee1fef5d58a2b415b0a055d3b6db4fbcaf1569c14d2ae92125d7f8
Python
9,861
184
# -*- coding: utf-8 -*- import os import yaml import argparse import numpy as np from utils import check_folder, read_yaml, save_yaml, write, get_subject_name, get_output_name, aggregate_cv, create_maps, fetch_masker, fetch_data, get_nscans from utils import get_splitter_information, get_compression_information, get_d...
4ca988699c04b08e99c654b0d377b99f8a817b145c4ef33fe65072987d1d2a90
Python
9,864
275
import numpy as np import pandas as pd from sklearn import preprocessing import torch from sklearn.metrics import confusion_matrix import operator import sklearn.metrics import json from scDGD.classes import GaussianMixture import seaborn as sns import matplotlib.pyplot as plt import umap def order_matrix_by_max_per_...
dc66b68ee4e846f98a59ae36c7055ac3d272bd79a0f3602d746953f7cb3aa9d3
Python
9,864
277
''' 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 rbns_data = 'metadata_rbns.csv' #...
bd267fbbf7beb150e7d9e95c394717eee2364ca684f1df71eb6d752eca4d76ad
Python
9,866
314
"""Round-47 hon1_1 immunizer -- generators held on a container SUBCLASS's own attribute. r45 hon1_1 descends model-held containers by PROTOCOL (every ``Mapping`` keys+values, every non-leaf ``Collection`` elements). But a container SUBCLASS can hold a generator as its OWN ``__dict__`` / ``__slots__`` attribute (``self...
3bb9792a242eff65ae317904abf03271f1cfdd2c4d23c04ae06ca011eba4617f
Python
9,867
267
"""Embedd Mayavi in Eelbrain for testing: src = datasets.get_mne_sample(src='ico', sub=[0])['src'] brain = plot.brain.brain(src.source, mask=False,hemi='lh',views='lat') """ from logging import getLogger from mayavi.core.ui.api import SceneEditor, MlabSceneModel import numpy as np from traits.api import HasTraits, I...
f9bb6e2edd5df7f20b3e618aa8d492c74243657b572d09253208fa7af074de31
Python
9,869
258
"""SM100 backward with a 64-row KV tile per CTA (FLASH_ATTENTION_BWD_TILE_N=64) against the default 128-row tile and against FP64 eager. The 64-row tile puts the accumulators in the M=64 TMEM layout and stages P / dS in SMEM (see NOTE [M=64 accumulator layout] in flash_bwd_sm100.py); it is the layout the hd256 backwar...
534e29e19f61a29793df05f80fdf62f20692782af72fb2dfb1ffd973f5b18686
Python
9,870
288
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Some code is from https://github.com/princeton-vl/pose-ae-train/blob/454d4ba113bbb9775d4dc259ef5e6c07c2ceed54/utils/group.py # Written by Bin Xiao (leoxiaobin@gmail.com) # Modif...
c0f71db246f9bada85d670d098f79b2d06306f8e4ae1ba913b1cbf08d205fa85
Python
9,870
238
import pickle import torch import torch.nn.functional as F from trainingUtils import NBLoss,_convert_mean_disp_to_counts_logits #,MultipleOptimizer, MultipleScheduler, compute_kernel, compute_mmd from models import Encoder,Decoder,GaussianDecoder,VAE,CellStateEncoder,\ CellStateDecoder, CellStateVAE,...
53a781e46a2c72f067e85e8d5694bab45efcb7c08595ce4f6bca90ea4b93478c
Python
9,874
288
""".. _lightly-detectron-tutorial-6: .. role:: bash(code) :language: bash Tutorial 6: Pre-train a Detectron2 Backbone with Lightly ========================================================== In this tutorial we show how you can do self-supervised pre-training of a `Detectron2 <https://github.com/facebookresearch/d...
f7b0bc93467ff611af99ae8b7b2a0b5804080c95cfcdf517f6078b059d9cb231
Python
9,875
265
# Copyright (c) 2017-present, Facebook, Inc. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # """ This file contains the definition of encoders used in https://arxiv.org/pdf/1705.02364.pdf """ import numpy as np import t...
bdea20708711a44caf6fbdf30f03415bd5887ca3ea856c24e5aec21a12f37b14
Python
9,876
234
import matplotlib.pyplot as plt import numpy as np import pandas as pd import scipy.sparse as sp import seaborn as sns import sklearn.neighbors import torch def Transfer_pytorch_Data(adata): from torch_geometric.data import Data G_df = adata.uns["Spatial_Net"].copy() cells = np.array(adata.o...
cd270b5a5c67240100b0acefb79e1e352989fec9d8bb949971b39765dba55aa3
Python
9,877
190
import paddle import paddle.nn as nn import paddle.nn.functional as F import pgl from layers import * class GeomMPNN_2D(nn.Layer): def __init__(self, node_in_dim, edge_in_dim, rbf_dim, hidden_dim, max_dist, \ num_conv, num_pool, dropout, dropout_pool, activation=F.relu): super(GeomMP...
4357d391e2b3d7994eaa97a642e9a97c545b8c941d296b8e225a52e876770802
Python
9,879
257
"""Observe item 15: track_device_memory CPU-side core (fake-provider legs). Never-reset counters, signed deltas, high-water ADVANCE semantics, the None+status grammar replacing every fabricated zero, and the attempted-call OOM row. GPU cells (real allocator, OOM attribution, pass-observation parity on device) run on t...
5ee33bf4d38580bd0048672a3b5e4d86928f57c19818ba6b4b2272142cd90edd
Python
9,881
245
# Copyright (c) 2023, Tri Dao. import time import torch import pytest from transformers import AutoConfig, AutoTokenizer, AutoModelForCausalLM from flash_attn.models.gpt import GPTLMHeadModel from flash_attn.models.btlm import btlm_config_to_gpt2_config, remap_state_dict_hf_btlm from flash_attn.utils.pretrained impo...
bc1d9445e9e9aaa0083ea26596fdf5a1440f5c8206c62fc88015fc41367fbc1f
Python
9,882
340
"""OpenPI π0 and π0.5 compact vision-language-action models. Paper: Black et al. 2024, "π0: A Vision-Language-Action Flow Model for General Robot Control"; OpenPI also exposes π0-FAST, an autoregressive VLA using FAST action tokenization. """ from __future__ import annotations import torch import torch.nn as nn FLO...
75955e099acf00a763e77f10738c5875a485533adde12cad50d05415213683f8
Python
9,883
338
#!/usr/bin/python #-*-coding:utf-8-*- # 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 wi...
7677188b8f9e137f23db51b5119fa764cd96463a1af1da5cdb7fe59415b2a4c7
Python
9,884
242
"""Lane A11 neuro fails-open fixes (neuro MEMO item 4 defect slice, D4-D7). Pins: - The *_evolution default sweep processes only stimulus-indexed sites: buffer overwrites and leading-axis mismatches are SKIPPED with one summarized disclosure (previously a stock resnet18 sweep fabricated 78 buffer pseudo-RDMs in...
14429f8587d6bdd12bccf6f4e82841f4870040c0b4b548eab12cd6c8c195e959
Python
9,885
229
"""Custom BatchNorm implementation""" # pylint: disable=unused-argument,bad-continuation import logging import torch import torch.distributed as dist from torch import nn from torch.autograd.function import Function from torch.nn import functional as F from torch.nn import BatchNorm2d from ..utils.comm import get_worl...
14e4870501bda47083c0e70a3fbb35431f3b66836f149ccc911ff87f9741fc4c
Python
9,885
283
"""Projective descriptor goldens for the target-anchored reverse solve.""" from __future__ import annotations from collections.abc import 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 from torchle...
dac6097908a36ab391c52d38e407b92b5b2585a9bfe39cae50a9f22ba6bf0dc5
Python
9,891
324
# 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...
1d95a513655d14b8688840814821d8b12f5e1944540d142a7819a5ad8d257723
Python
9,892
216
import json import numpy as np import os, sys from collections import Counter from sklearn import preprocessing from sklearn.metrics import f1_score from sklearn.metrics import confusion_matrix import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils import torch.nn.functional as F from torch.utils.dat...
85f0bcd7041a8d1b8e79b2e093510b9d3852d8e656eab2909ae11969046f979f
Python
9,892
249
from argparse import ArgumentParser import torch from unires.struct import settings from unires.run import preproc def _preproc(pth, atlas_rigid, common_output, denoising, device, dir_out, fov, label_file, label_channel_index, label_repeat_index, linear, plot_conv, prefix, print_info, reg_sc...
45028b2f0704138e3014e909d5b32bab71d76ed6ce83d344213105604e25f267
Python
9,893
254
""" Plot Model Components ===================== Plotting power spectrum model parameters and components. """ ################################################################################################### # Import the SpectralGroupModel object from specparam import SpectralGroupModel # Import utilities to manag...
3ef90066bd090c0f96e9c1ce3890f848fe2eb8eade837c62aa1fb01fd3dc7521
Python
9,894
211
import torch from .base_model import BaseModel from . import networks class BiCycleGANModel(BaseModel): @staticmethod def modify_commandline_options(parser, is_train=True): return parser def __init__(self, opt): if opt.isTrain: assert opt.batch_size % 2 == 0 # load two images...
695edc10e920cceaab6a3f5f0a3b2dbe5502264cf218ff9f6a8a14ec2dfe28d3
Python
9,895
236
""" Manipulating Objects ==================== Examples with combining, sub-selecting, dropping, and averaging power spectrum models. """ ################################################################################################### # # As you fit power spectrum models, you may end up with multiple model objects,...
d79394f65c10ff28ce07b3e505f15edb970b9c806d55466cea22d0cc3ece8c8e
Python
9,899
263
# -*- coding: UTF-8 -*- import numpy as np import math import random import operator import csv from array import array from sklearn.feature_selection import VarianceThreshold from sklearn.feature_selection import SelectKBest from scipy.stats import pearsonr from sklearn.feature_selection import SelectKBest from sklear...
1f4bb3a9423b2de098cbd22fe2b19022331529ea3a83bd389d9d3d96244ff0ca
Python
9,901
247
#!/usr/bin/env python3 """ build_trained_model.py — Fit and serialize the canonical trained model. Produces ``trained_model/trained_model.json`` containing every parameter needed to apply the trained classifier to a new cohort *without retraining*. ``deploy_classifier.py`` consumes this artifact. The trained model h...
9b815b05fbc9516fe05dc719585f0e5b102c6e1b0470a6b57d734d0a9ff2e0c0
Python
9,901
277
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in April 2020 @author: Thomas Bonald <bonald@enst.fr> """ from typing import Iterable, Optional import numpy as np from sknetwork.hierarchy.postprocess import cut_straight from sknetwork.visualization.colors import STANDARD_COLORS def get_index(dendrogram, ...
c33c2ed15638f374ece9b99f144c5d0dbf30b2e726ed01865c6f9e17e70ee10e
Python
9,902
264
# -*- coding: UTF-8 -*- import numpy as np import math import random import operator import csv from array import array from sklearn.feature_selection import VarianceThreshold from sklearn.feature_selection import SelectKBest from scipy.stats import pearsonr from sklearn.feature_selection import SelectKBest from sklear...
6d219d008c477c5a44fa04fb619859f78bad820155534c4a486d652820330a82
Python
9,906
295
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Test MAF layer in tfep.nn.flows.maf. """ # ===================================================================...
f0ecd6e4cf6a97f0f0a6135a3eabdf213cfb8daaf7fbc1d652ebc78d9784c17e
Python
9,906
263
# -*- coding: UTF-8 -*- import numpy as np import math import random import operator import csv from array import array from sklearn.feature_selection import VarianceThreshold from sklearn.feature_selection import SelectKBest from scipy.stats import pearsonr from sklearn.feature_selection import SelectKBest from sklear...
80aa3206db05cadc9c47b0d18f4696096a9e3966cd74442cbaba826c0e2dc5e0
Python
9,907
239
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jul 6 18:03:02 2021 @author: Audrey Mazancieux This script performes several group level "event-related" analyses using LC time serie that have been extracted from ROI delineated in native space and then translated in this space. Prior to this step,...
5f5b2d1f6616175a614482ddea8cc0617b5fd834221f6a352133f156238a187d
Python
9,909
181
#!/usr/bin/env python3 import os,sys import matplotlib matplotlib.use('Agg') from pylab import * from collections import defaultdict from lefse.lefse import * import argparse colors = ['r','g','b','m','c','y','k','w'] def read_params(args): parser = argparse.ArgumentParser(description='Plot results') parser...
8536ed50f3c5704a2efe2809be7f3ef96d4a336f06a004dd50bdc111820b9ebb
Python
9,913
300
# coding=utf-8 # Copyright 2023 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...
de1a2e06e98ced3ea39693543ac0c56a9882838204362fddf2ac53f62af13514
Python
9,916
255
#!/usr/bin/env python """Tests for `stlearn` package.""" import unittest import numpy as np from numba.typed import List import stlearn as st import stlearn.tl.cci.het as het import stlearn.tl.cci.het_helpers as het_hs from tests.utils import read_test_data # Per line - which cells to annotate CELL_TYPE_ANNOTATION...
2668d15fe7cbf369fa4009b1782b0e67db58e35eb2f4d50e05eb9e573641d46b
Python
9,917
276
"""Tests for seqpro.rag.to_padded (flat-buffer ragged densify-and-pad).""" from __future__ import annotations import awkward as ak import numpy as np import pytest from seqpro.rag import Ragged, lengths_to_offsets from seqpro.rag import zip as rag_zip from seqpro.rag._core import Ragged as CoreRagged from seqpro.rag...
a50c9af601d582e082c5d61313343d4f89d0089e44d2ffaf878435e9058f93de
Python
9,918
272
""" Tunnel Utilities API Provides utilities for tunnel configuration and URL management. """ import os from typing import Any from .base import BaseAPI, error_decorator class TunnelUtils(BaseAPI): """Tunnel utilities for managing tunnel configuration and URLs.""" def __init__(self, server_instance): ...
8e786db4e00bafaf45fe5cc1820f87c16ad979f323f743c266ce63ff0712a800
Python
9,919
318
"""Digest primitives, built once, used everywhere (extract memo item 1). Two primitives with PINNED algorithm ids + versions (they are manifest fields any third party can recompute from): * :func:`merkle_digest` — the threaded Merkle CRYPTO digest (extract D6): per-entry leaf digests hashed in a thread pool, folded...
ca164ad81c86ab3c109c3d76c81901ab4c58fe47163f420d2c63d30b589f0406
Python
9,919
251
from model import esrt_common import torch import torch.nn as nn import torch.nn.functional as F from thop import profile from util.non import NONLocalBlock2D from util.tools import extract_image_patches,\ reduce_mean, reduce_sum, same_padding, reverse_patches from util.transformer import drop_path, DropPath, Pat...
7cb4243b5492a8d7d8eac7e7881ab9898f39a2438599bb9f03f8cb5e79f2a07e
Python
9,921
254
"""Tests for the CouchbaseBackend.""" import json from datetime import timedelta from unittest.mock import MagicMock, Mock, patch, sentinel import pytest from celery import states from celery.app import backends from celery.backends import couchbase as module from celery.backends.couchbase import CouchbaseBackend fro...
aaa0a3aa270c44be01a0767bea904e6132d931bce9de4ba5e6f94db949ef1b2a
Python
9,925
270
"""EPISODE export tests (memo D11-D14, B7) on a real tiny episode capture. The step-membership join runs through the persisted module-call ops list with the stack cross-check asserted equal; drivers window-assign exactly once; boundary proxies mint reserved-prefix step-stable ids; the budget binds per-step graphs with...
cf03018dbee9509628c2ebaa49837baab61eadac6dd21547128d409429f65e30
Python
9,925
252
""" Generic, data-model-agnostic canvas object placement helpers. Extracted from the click/select/hit-test/table loop originally built for `environment_builder_app.py`'s environment-object placement (food sources, borders), so it can be reused for other click-to-place canvas interactions (e.g. Single Experiment's larv...
09eccc36d896f48eb1f51cc97449a82074fc79cea6ad5038d826700274174e05
Python
9,926
258
# 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...
40912ce755106df8948fb7fce729299e2e53930f0e9dd72d62c6d20475465600
Python
9,927
322
from typing import Dict import argparse from pathlib import Path import numpy as np import numpy.typing as npt import pandas as pd import torch from torch_geometric.loader import DataLoader import torch_geometric.transforms as T from coeffnet.predata.interpolator import GenerateParametersInterpolator from coeffne...
a3f5db946a30d86402e566789bf0af9525dd1c8975692680a0328bf12b633531
Python
9,929
282
import logging from tqdm import tqdm import numpy as np import random import dgl from dgl.nn.pytorch.glob import SumPooling, AvgPooling, MaxPooling from dgl.dataloading import GraphDataLoader import torch from torch.utils.data.sampler import SubsetRandomSampler from sklearn.model_selection import StratifiedKFold, Gr...
805d449ac749f87a50f3a3114385710f0f926ff45521275000b74d9e80721e5c
Python
9,930
218
# Adapted from https://github.com/mlcommons/training_results_v1.1/blob/main/NVIDIA/benchmarks/bert/implementations/pytorch/padding.py import torch import torch.nn.functional as F from einops import rearrange, repeat class IndexFirstAxis(torch.autograd.Function): @staticmethod def forward(ctx, input, indices)...
10172e203bf394ef647d0b99a322cb95a28759a4126c363ceee41caea092451c
Python
9,931
259
""" Common code across figures. """ import os import numpy as np import matplotlib import matplotlib.pyplot as plt from jaratoolbox import extraplots from jaratoolbox import extrastats import studyutils import scipy import pandas as pd import seaborn as sns matplotlib.rcParams['font.family'] = 'Helvetica' matplotlib...
163f56e1b3dc52690e37106ce479e7dbae56e84ed6e3c339a4a90c160cbd54a9
Python
9,931
189
''' Uses the predicted scene graphs to generate a surgery report. ''' import json from pathlib import Path from typing import List, Optional from helpers.inm_helpers.configurations import TAKE_SPLIT def augment_scene_graphs_with_roles(rels, key, role_predictions): key = key.rsplit('_', 1)[0] if key in role_p...