sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
beb05cee1612f1b4e4e6fa8d16e4a56ee8221ba3b055af4c0ed02ab384ad7a60
Python
8,163
232
""" Multi-Head Attention module """ import math import torch import torch.nn as nn from bioseq2seq.utils.misc import generate_relative_positions_matrix,\ relative_matmul # from bioseq2seq.utils.misc import aeq class MultiHeadedAttention(nn.Module): """Multi-Head Attention module from "...
4e64d4744d032c8bfac41395210f84c8dace84977caafc2d26cb985e2804cae1
Python
8,165
277
"""Pytorch communication tools""" import functools import logging import pickle import numpy as np import torch import torch.distributed as dist def get_world_size(): """Get DDP world size""" if not dist.is_available(): return 1 if not dist.is_initialized(): return 1 return dist.get_wor...
cc98a07fa79229bf941b0c38ab8e5e1c110dbc87b67852398940851d77fd6226
Python
8,167
209
""" This script takes plink LD lists and simulates summary statistics for multiple populations with sample size imbalance. Requires 2 populations, can take up to 4. """ import argparse from contextlib import ExitStack import numpy as np import scipy.stats as stats import os class Main(): def __init__(self): se...
5abb31b7fd0621f56538af6e7ed2d2042db6fb5e7729d31de918be501b570cf0
Python
8,170
220
""" Behavioural phenotypes (rover / sitter) derived from the generic Drosophila DEB model. The generic model is the species-specific AmP parameter set for *Drosophila melanogaster* -- ``models/amp/Drosophila_melanogaster.json``, taken verbatim from the Add-my-Pet database. It stands for the average representative indi...
5da44151b2a3dcef3494fc576440ed346e4d550850787193fcbf57c1101c3ac7
Python
8,173
130
"""General-purpose training script for image-to-image translation. This script works for various models (with option '--model': e.g., pix2pix, cyclegan, colorization) and different datasets (with option '--dataset_mode': e.g., aligned, unaligned, single, colorization). You need to specify the dataset ('--dataroot'), e...
a541e4e532fe6f5dfb2c58a971a886a33f072495a461aba0ab4b6f91b7641b3f
Python
8,173
209
"""F12 pins: live skin palettes (N4), ramps, the N17 neutral fill, and the CVD accessibility gates. FORK-2 discipline: the machinery is LIVE but every shipped skin keeps pixel-identical palettes (the render-identity golden pins them); the Okabe-Ito set ships as data with its accessibility evidence attached, and the le...
ef30bc929a61248e693f943d4ca9288c18e7a9b084f5597d7b7c3159eb449cb1
Python
8,174
215
"""4. Dive Deep into Training I3D mdoels on Kinetcis400 ======================================================= This is a video action recognition tutorial using Gluon CV toolkit, a step-by-step example. The readers should have basic knowledge of deep learning and should be familiar with Gluon API. New users may first...
01551ab6d88809fa8cf8ebdb8d455725ad7dc81e28a9adefd56b86123206a423
Python
8,176
220
"""A Sphinx extension for linking to your project's issue tracker. Copyright 2014 Steven Loria 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 th...
17e7a8cc8948dde4e4782d3f454ed52b3846030c883df1f699027e2ff535d9a4
Python
8,177
130
"""General-purpose training script for image-to-image translation. This script works for various models (with option '--model': e.g., pix2pix, cyclegan, colorization) and different datasets (with option '--dataset_mode': e.g., aligned, unaligned, single, colorization). You need to specify the dataset ('--dataroot'), e...
1650cd02606240449264b3960bcc9e1a739ea214efa8f4971e03de6c5efb7a17
Python
8,181
174
# Third party libraries imports import matplotlib.pyplot as plt import numpy as np from numpy.lib.arraysetops import isin import torch from torch.functional import split import torch.nn as nn import torch.fft import torch.nn.functional as F import pathlib, glob, re import logging import FrEIA.framework as Ff import FrE...
14e63555b10c8abf3999de0f43618db822bcf38d852b1afe8ecf41f2e2bfe6cc
Python
8,182
227
import torch from tqdm.auto import tqdm from .._settings import settings import xarray as xr import numpy as np from tqdm.auto import tqdm from seqexplainer.gia._perturb import tile_pattern_seq from seqexplainer.gia._complex_perturb import embed_deepstarr_distance_cooperativity from seqexplainer.gia._gia import deepsta...
310967192eae3f5f5eacad8908d3b2418a18caaba4dcf003aeaaeb8a7aaa2ed0
Python
8,184
221
from distutils.util import convert_path from distutils import log from distutils.errors import DistutilsError, DistutilsOptionError import os import glob import io from setuptools.extern import six import pkg_resources from setuptools.command.easy_install import easy_install from setuptools import namespaces import s...
7e2028910a8cd788e63657959eeef4ca893bddee6796da2f196f9d2eddbc0e2b
Python
8,184
184
""" Tests for independence_tests.py. """ from __future__ import print_function import numpy as np import pytest from scipy import stats from tigramite.independence_tests.parcorr import ParCorr from tigramite.independence_tests.robust_parcorr import RobustParCorr from tigramite.independence_tests.pairwise_CI import Pai...
b0ae9a56f063f22b8df60d62e42727e80b62605da2d5be0e250f1005495a1f5b
Python
8,184
223
"""Functions for generating boilerplate code.""" from xcp_d.utils.confounds import _modify_motion_filter from xcp_d.utils.doc import fill_doc from xcp_d.utils.utils import list_to_str @fill_doc def describe_motion_parameters( *, motion_filter_type, motion_filter_order, band_stop_min, band_stop_ma...
f5b8ecb6209181c4c781f1ff045272bab41716ae69ac0d5264f0341ed0125767
Python
8,185
207
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: Pramod Bharadwaj Chandrashekar @email: pchandrashe3@wisc.edu """ import torch import pandas as pd import numpy as np import argparse from captum.attr import IntegratedGradients, LayerConductance, NeuronConductance from torch.utils.data import TensorDataset, Da...
2937ba2aa829d2ede2d34efd2bd5ab11c481a8d391348ddde9a366cde3984bf1
Python
8,186
217
from typing import Dict, List, Optional, Tuple, Union from PIL.Image import Image from torch import Tensor from lightly.transforms.gaussian_blur import GaussianBlur from lightly.transforms.multi_view_transform import MultiViewTransform from lightly.transforms.rotation import random_rotation_transform from lightly.tra...
f39b86071d1d41c0c0161d3ca9db81675fa4b79850374d14bb50f8e72a32c46d
Python
8,186
200
# adapted from https://github.com/facebookresearch/detectron2/blob/master/detectron2/data/samplers/distributed_sampler.py import itertools import math from collections import defaultdict from typing import Optional import torch from torch.utils.data.sampler import Sampler from ....utils import comm class TrainingSam...
25d3b076cf600ad3a7bb015621c0bff62df8ddb44a322f28d1e3243cb46bedce
Python
8,187
162
"""Shared closed-grammar sanitizer for attacker-controlled portable device strings. A ``.tlspec`` manifest is *data*, not authority: a hostile artifact may carry any bytes in the plaintext ``manifest.json`` ``logical_device`` / ``device_at_save`` fields. Round 54 ``sec_2`` (HIGH) showed the tinygrad payload codec pass...
1ec159cdf88b35d43887e9ebac82f989cd6abb1e9a560a37bad1d924db574d61
Python
8,188
210
#!/usr/bin/env python3 import argparse import datetime import json import re import sys from pathlib import Path from typing import Any, Dict, List def get_opencc_version() -> str: try: script_dir = Path(__file__).resolve().parent repo_root = script_dir.parent package_json_path = repo_root...
78adfeee605ca07f6141057b1034d99c8ca28efe2f58e25b4004d3767b0a28d7
Python
8,193
246
import torch.utils.data as data from torch.utils.data import Dataset from torchvision import transforms from PIL import Image import os import os.path import sys def has_file_allowed_extension(filename, extensions): """Checks if a file is an allowed extension. Args: filename (string): path to a fil...
9811d2027006fa395b8d6e1653979271d0a18e8a50dbb269b8b11632f5a7f896
Python
8,195
198
"""F11 ceiling-replacement gates (collapse memo item 8 / D5). Admission is U-gated and estimator-tiered; over-budget requests degrade to the deterministic fallback planner, never an uncollapsed wall; the watchdog abandons only TO the fallback and is disclosed as an estimator bug. """ from __future__ import annotation...
814b3517318683c25354c1577ac340b5e68a88dbc7877843fd8fbaa0eb47abe1
Python
8,197
189
# ------------------------------------------------------------------------------ # Based on: # apex # Copyright (c) NVIDIA # Licence under The BSD 3-Clause "New" or "Revised" License # https://github.com/NVIDIA/apex # All rights reserved. # # Redistribution and use in source and binary forms, with or without modificati...
f852052be71098726b0f3ee0afbe6aaf1654fc49c014fbbc6d51da9d55b4f7b1
Python
8,198
264
import io import gc # garbage collector import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.patches import Patch import numpy as np import PIL def get_cmap(colors=None, classes=None, epsilon: float = 1e-2, framing_color: str = 'white', plot: bool = False): """ Creates a colormap from gi...
84cf7f1eced72184ecd16ae47610decd9409fe0bd961b6ccdd597b760778f8bc
Python
8,201
228
"""Scripts for visualization""" from collections import Counter import io from PIL import Image import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from scripts.utils.constants import CSV_ORG_OVERVIEW from scripts.utils.io_utils import get_masks, get_orig_imgs from scripts.u...
887475df427accedecd4385d4158367807c052183c5f0834748ac83ba2172a71
Python
8,201
197
""" Based on the fMRI scripts used in Kell et al. 2018 with minor changes. """ import h5py import numpy as np import pickle import sklearn from sklearn import * import scipy import os def compute_median_across_predictions(combine_predictions): """ Computes a summary median metric from a set of predictions ...
d0cb1611a0431bdb06d2b74075523b2ac7cc8a3e1f60914087a0dc1651c48927
Python
8,201
248
#!/usr/bin/env python """ sess_download_util.py This module contains functions for downloading the dataset from the Dandi archive. Dandiset 000037 is the Credit Assignment Project dandiset. It comprises data for 50 sessions. The asset (session file) sizes are in the following ranges: - Basic data (with everything ...
4ed4bf264e679a2bfe8c0ac721638e07e83d41054b6447de09b3e4e382308401
Python
8,202
230
# SOURCE: vendored from xbpeng/MimicKit @ main # https://raw.githubusercontent.com/xbpeng/MimicKit/main/mimickit/learning/ppo_model.py # https://raw.githubusercontent.com/xbpeng/MimicKit/main/mimickit/learning/nets/fc_2layers_1024units.py # https://raw.githubusercontent.com/xbpeng/MimicKit/main/mimickit/learning/distri...
d2122c8eb3bda3a644b87d300ed62747fbe0d606d2eff66880e41b5d4df51056
Python
8,203
242
import os import re import shutil import statistics import subprocess import sys import time from functools import lru_cache from typing import Dict from codecarbon.core.util import detect_cpu_model from codecarbon.external.logger import logger @lru_cache(maxsize=1) def is_powermetrics_available() -> bool: try: ...
2622879cc7e23aabbe26de47e85060ff71ddaca5552aa75e0850d0b949291d67
Python
8,205
190
from __future__ import generators import logging import glob, os, functools import sys import SimpleITK as sitk from scipy.signal import medfilt import numpy as np from numpy import median import scipy import nibabel as nib import skimage import matplotlib.pyplot as plt import scipy.misc from scipy import ndimage from...
b3d868c37538b35bfa636e1a36c1ee720103f504f984e3d5f7ad5258c7ed2ead
Python
8,205
244
# Allen Institute Software License - This software license is the 2-clause BSD # license plus a third clause that prohibits redistribution for commercial # purposes without further permission. # # Copyright 2019. Allen Institute. All rights reserved. # # Redistribution and use in source and binary forms, with or withou...
c5b66767228abad15a9dfee9732897a86a234167f8ff4fab3e53c6dadf862a94
Python
8,206
218
#!/usr/bin/env python # ============================================================================= # MODULE DOCSTRING # ============================================================================= """ Test objects and functions in tfep.nn.conditioners.masked. """ # =============================================...
2adfc8ab14e95959017259681b4febadefc2281c5c8694e49b2f3dda8a32b1b1
Python
8,207
183
""" Simulating Neural Power Spectra =============================== Creating simulated power spectra. """ ################################################################################################### # Import functions for creating simulated power spectra from specparam.sim import sim_power_spectrum, sim_group...
76cf5a0b13fb02515f4c887d8d9e1def7977513e27e1326cb8bf9b9acf0d1d7b
Python
8,207
188
""" This module is largely responsible for impainting the distance map, a.k.a. removing possible undefined values inside the image. """ import scipy.sparse import numpy class NanInpainter(): """ This module is a Python-port of the inpaint_nans in MATLAB from John d'Errico: https://www.mathworks.com/ma...
4387e37049cd388e8e762c797783408bb8278869cd1ad72cc8d3619cf7363641
Python
8,208
239
# Register stacks/collections of images import itertools as itt from functools import partial import numpy as np from imfun import core from imfun import fseq try: from pathos.pools import ProcessPool _with_pathos_ = True except ImportError: print("""Can't load `pathos` package, parallel maps won't work....
75220f3808fe78134cd219fc4857eeaf1f8eb53b482584636c77403458f5eab4
Python
8,208
198
# Sentence model specification - CUB image feature version import json import os import numpy as np import torch import torch.distributions as dist import torch.nn as nn import torch.nn.functional as F import torch.utils.data from torch.utils.data import DataLoader from src.datasets import CUBSentences from src.utils...
ab0a2aed58a8a97e576b379b4cd8ccba48fa6ae86cd0688301484cc56d345fcf
Python
8,208
215
# LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this software except in complian...
7522bbb0768d7d9076a5a1cba80de46cfe4f24e73f4272a26e2329ccdff26d8b
Python
8,209
199
# Sentence model specification - real CUB image version import os import json import numpy as np import torch import torch.distributions as dist import torch.nn as nn import torch.nn.functional as F import torch.utils.data from torch.utils.data import DataLoader from src.datasets import CUBSentences from src.utils im...
e5ed4196f9bc1ad90d9f72e80ce6d137d4c72514555609a9e0e16dd1e8750093
Python
8,209
273
"""Utilities for safely pickling exceptions.""" import datetime import numbers import sys from base64 import b64decode as base64decode from base64 import b64encode as base64encode from functools import partial from inspect import getmro from itertools import takewhile from kombu.utils.encoding import bytes_to_str, saf...
1ba5316a3d038275373dbec0587458c71eec342730b308f862d9769734f79483
Python
8,213
180
""" In the main, you need to configure experiment name, decay times, decay distributions and model folder by hand. This script generates the folder structure for the entire analyzer skripts and compute the spike rates by calling spikerate_kfold_multi(). """ import os from copy import deepcopy import numpy as np import...
6893cdc546ebd4d948e6945ff5c263a53c088b42fc0fea58cf767329a27c002c
Python
8,213
223
import math from collections import OrderedDict from torch import nn import torch.utils.model_zoo as model_zoo from .custom_modules import SequentialWithArgs, FakeReLU HASH = '1d3f7974' class Flatten(nn.Module): """ Helper module for flattening input tensor to 1-D for the use in Linear modules """ ...
82a26c3503845f487e531a56b34f1a43bb8ddafa80f8456fff8cc039dfa7e3d2
Python
8,217
229
import os os.environ['DTORROOT'] = '/DATA/forLishan/randomddd' #os.environ["CUDA_VISIBLE_DEVICES"] = "0" from dtor.utilities.utils_stats import stats_from_results,roc_and_auc from sklearn.metrics import roc_curve, auc import numpy as np import argparse import torch from dtor.utilities.utils import set_plt_config from d...
b758eed7e8a8e0a59ea2ded744f2ede4de37c1db7d2d42115dd84ec13dfc03fd
Python
8,218
235
#!/usr/bin/env python import argparse from collections import namedtuple import os import socket import sys from time import sleep import threading import SocketServer import external_image import nibabel as nb import numpy as np from sklearn.externals import joblib SocketServer.TCPServer.allow_reuse_address = Tru...
557132c296b8bb49b176d9d82b45213368a5d0655a06a4e857fe1f6324fed0e6
Python
8,219
229
from unittest.mock import MagicMock, Mock, sentinel from urllib.parse import urlparse import pytest from kombu.utils.encoding import str_to_bytes from celery import states, uuid from celery.app import backends from celery.backends import couchdb as module from celery.backends.couchdb import CouchBackend from celery.e...
05b540f80c1938e4fccde317e9575edcb4e2d1ee5f8932a2eba9c5563cbef74d
Python
8,220
230
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.14.5 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- # # Deconvol...
f45f559eefd222f7c35fafa8b771d3289b49bb72c97f433647255cbc4af0f6ea
Python
8,222
214
# Copyright 2019 Novartis Institutes for BioMedical Research 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...
d9bd133732a6fe15be3fa5317f98be67176ca49d16a13d3ceea67dee5cb689ae
Python
8,224
204
"""Class to collect all TMD related info used in TNS""" import copy from collections import OrderedDict import numpy as np from tns.basic import round_num from tns.utils import TNSError class Barcode: """Class to generate the barcode structure which is essential for the TMD based growth algorithms....
17f45c61c230b1b674b2691c2addef5158ee7a82b3a8a811ad96a78ccc75ce23
Python
8,226
211
# FAITHFUL REIMPLEMENTATION from Krishnamoorthi, "Quantizing deep convolutional # networks for efficient inference: A whitepaper" (arXiv:1806.08342, 2018); # Jacob et al., "Quantization and Training of Neural Networks for Efficient # Integer-Arithmetic-Only Inference" (CVPR 2018); and Howard et al., "Searching # for Mo...
59eea9bd9a395a4fc211216a9ff3860aac680edea08d707d529dcda1839d5515
Python
8,226
169
""" Perform cross-validation of regression between brain response and feature vectors under different setups. """ import sys sys.path.append('..') from config import fname, subjects from doit import get_var DOIT_CONFIG = dict(verbosity=2, sort='definition') tr = get_var("tr", -1) cum = get_var("cum", -1) tc = get_var...
608a99b4d762796447bf39f779334191b1dac5bd6104221273a9de031ae0e603
Python
8,227
226
#!/usr/bin/env python3 # pylint: disable=invalid-name import csv import os import subprocess import tarfile import unicodedata from glob import glob from multiprocessing import Pool import progressbar from deepspeech_training.util.downloader import SIMPLE_BAR, maybe_download from deepspeech_training.util.importers im...
a6e1d9f9f8d9691b57cf744fb2af23ece3a6079aad7084a258045353dd69f7f4
Python
8,227
264
import numpy as np import seaborn as sns from .. import settings from os import PathLike import matplotlib.pyplot as plt from sklearn.metrics import ( confusion_matrix, roc_curve, auc, precision_recall_curve, average_precision_score, ) from typing import Union, Sequence from sklearn.preprocessing im...
f1b7800105b1634e0a07c44908ef1beb437f69a5df7162917c697809d8076b10
Python
8,227
244
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 24 17:11:46 2022 @author: Audrey Mazancieux This script performes group-level "event-related" analyses. Prior steps are: - extraction of time series from the LC in native space using the extract_timeSerie_singleSubj script - extracti...
316d64d21ad441310d49aca8eaf4293fd50e3a8513879096edcc6134275be4dc
Python
8,228
193
"""F29: the two gallery transcripts, byte-reproducible (the lane's row gate). Transcript 1 (flagship, MCP-shaped): gpt2 clean vs middle-block-ablated -- the agent recovers the KNOWN intervention boundary and the direction of downstream change from two real artifacts without executing code, parsing prose, or receiving ...
0656ff25b900f97d3d2d33f849e15228f5937545f2174948b91a90732fe4b025
Python
8,230
225
import numpy as np import torch import torch.nn as nn from torch.autograd import grad, Variable import pandas as pd from sklearn.preprocessing import StandardScaler def data_preprocessing(data_name, data_dir, device): df = pd.read_csv(data_dir+data_name+".csv") time_column = df.columns[0] data_column...
cd3f12cd9225565306fbb9dc507c0d1983b82fed316bed5bd2e95bb65f03e248
Python
8,230
239
"""Regression coverage for raw and transformed transform storage.""" from pathlib import Path from typing import Any import pytest import torch from torch import nn import torchlens as tl from torchlens.options import CaptureOptions, SaveOptions, StreamingOptions class _TinyModel(nn.Module): """Small model wit...
2d192535c7419899af27052832e2cc274946ccf3553d515fc2d4ebd496c5ac51
Python
8,232
224
#!/usr/bin/env python3 """ File: filter_vcf_files.py Created: 2024/01/19 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. """ ...
b6f62939f8c1f018ad870a62785d94debd50b752bc384c2398cd7012a8b2d9bd
Python
8,232
195
__author__ = 'quentin' from .tracking_unit import TrackingUnit import logging import traceback import json from ethoscope.utils.description import DescribedObject class Monitor(DescribedObject): _description = {"overview": """ A monitor orchestrates the different software modules and implements the...
c632dc37ddf3ca8f328e8f234b065e3164a4f8062e818c8a04bc125a59a3eef9
Python
8,234
263
# -*- coding: utf-8 -*- # # face-rhythm documentation build configuration file. # # For the full list of configuration options, see # https://www.sphinx-doc.org/en/master/usage/configuration.html from __future__ import annotations import os import re import sys import types from datetime import datetime from pathlib ...
460736addb04bfae0aeee0a982359478fa1c15a1b2889a8a0979790eea8a2967
Python
8,235
158
"""C.4: инфраструктура теста порядка развития (решающий критерий этапа 3). Интернализация по Выготскому требует, чтобы у агента момент, когда его метки начинают влиять на ДРУГИХ, наступал РАНЬШЕ момента, когда его собственные метки начинают влиять на НЕГО САМОГО (STAGE3_DESIGN §3). Меряем две кривые как функцию возра...
16ee90678c482581ed288858f79a8746519a61a173fd84a74559ded5495eaf00
Python
8,239
235
"""C02 safety tranche: bounded reprs, honest units, coherent index bases. Lane C02 (2026-08-27), M(lovely) item 1 -- the measured bug sites: the Recording auto-repr that OOMed an 8 GiB box at four saved sites (bug 1), the doubled duration unit (bug 2), auto-reprs on run products (bug 9), Bundle's quoted-'None' baselin...
1afa64f44636d3229a31388a81067cc85104a6876a560558b5f7a4a2273562db
Python
8,239
301
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. from __future__ import absolute_import, division, print_function import operator import os import platform import sys from setuptools.exte...
2065679c43e870537bc2a0ecc1799039d0139172f6b0f08c50d4367d6b569f23
Python
8,239
258
#!/usr/bin/python3 import os import numpy as np from biomedisa.features.biomedisa_helper import unique from biomedisa.matching import assign_labels, remove_small_particles2 from platformdirs import user_data_dir from pathlib import Path from tqdm import tqdm import requests import time biomedisa_dir = Path(user_data_d...
367ddf7168d0fed788ba4e55ac455973cb2fe727a48ce5c5ba4f6947122dee96
Python
8,241
220
"""Tier T4: headless-browser semantic smoke over the served artifact (D-09). The ONLY layer that catches the silent-hang class (the function-cycle crash shows an error dialog, renders nothing, and logs NOTHING to the console) and the panel-content class (the ``module`` name collision was invisible until a real click o...
9631f289fffa1a4550e5c28b47c5b4fae12835cea768716de01f6a5882950e0e
Python
8,242
176
import os, sys import numpy as np from tifffile import imread from biomedisa.features.biomedisa_helper import * import numba @numba.jit(nopython=True) def assign_labels(ref, result, labels_matrix): zsh, ysh, xsh = ref.shape for z in range(zsh): for y in range(ysh): for x in range(xsh): ...
9835fc33fc520e46b70598f00af798014c65416c8cee660090db79bc6202e935
Python
8,242
259
# -*- coding: utf-8 -*- """ Created on Tue Jan 25 16:34:41 2022 @author: Andrea Bassi @ Polimi """ from qtpy.QtWidgets import QLabel, QFormLayout, QSpinBox, QDoubleSpinBox, QCheckBox, QComboBox from qtpy.QtCore import Qt from enum import Enum, EnumMeta class Settings: """ Auxiliary class to create an numeric...
1133cff1db5f95f6ffc0bf43b02ec718be6f43ffbfe3efebbc10b8e9e9d8807e
Python
8,243
218
import argparse import numpy as np import torch import torch.nn as nn import torch.utils.data from src.getdata import getdata_from_csv, get_cold_data_from_csv from src.utils import DrugTargetDataset, collate, AminoAcid, ci from src.models.DAT import DAT3 import random parser = argparse.ArgumentParser() parser.add_argu...
694ebd048baed925a569593dbd1ac6d4547a8030cdff34985cdfe20e6e8ffb7b
Python
8,243
205
''' Sweep of hyperparams * Bajar el número de iteraciones y layers author: obanmarcos ''' import os import os, sys from config import * sys.path.append(where_am_i()) import lightning as pl import argparse import pickle import numpy as np import matplotlib.pyplot as plt from utilities import dataloading_utilities as...
e8707a777854d3a46a2d98612ca6055711d5c522d86fa23f9e9f3f8788abd378
Python
8,243
241
import math import os import shutil import sys import time import numpy as np import torch import torch.distributions as dist import torch.nn.functional as F from src.datasets import CUBImageFt # Classes class Constants(object): eta = 1e-6 log2 = math.log(2) log2pi = math.log(2 * math.pi) logceilc = ...
eff390558f30824d663cf413dcb8848aede1489464f084d86571ae0846bfc838
Python
8,244
242
""" Model (implemented in Pytorch Lightning) demonstrating how to use augmentations during training. Modified evoaug """ import torch from pytorch_lightning import LightningModule import numpy as np class RobustModel(LightningModule): """PyTorch Lightning module to specify how augmentation should be applied to a...
1714b484322d3930772dc47b09d421548f8b9e8b6bf61656ece68fc592360bb5
Python
8,248
231
#!/usr/bin/env python3 import csv import os import subprocess import tarfile import unicodedata from glob import glob from multiprocessing import Pool import progressbar from deepspeech_training.util.downloader import SIMPLE_BAR, maybe_download from deepspeech_training.util.importers import ( get_counter, get...
509411a85e3029236225642a9972847ca4d1747858fa1e4dbaa72f936d99107f
Python
8,249
270
import numpy as np import matplotlib.pyplot as plt from matplotlib_venn import venn3 from modular_splicing.utils.plots.plot_psam import clean, render_psam from .difference_classifier import bag_to_set, venn3_intersect_bag_sizes def display_difference( results, matches_test, amount, *, motif_name...
784a1e6be5fa07c5662490cb4855b2cc738e3ae216d41ccfbe601292b7206c52
Python
8,250
204
import time import pytest import torch from transformers import AutoTokenizer, GPTBigCodeConfig from transformers.models.gpt_bigcode.modeling_gpt_bigcode import GPTBigCodeForCausalLM from flash_attn.models.bigcode import bigcode_config_to_gpt2_config, inv_remap_state_dict_hf_bigcode from flash_attn.models.gpt import ...
824f14693cb57d638c0aab6858f0d3330a1e98511d41a5d904ffa3c9506bccf4
Python
8,250
215
import os os.environ['KMP_DUPLICATE_LIB_OK'] = 'True' import numpy as np import torch import torch.nn as nn import scipy.io as sio import h5py from time import time import torchkbnufft as tkbn from torch.utils.data import TensorDataset, DataLoader from functions.utils import trajGR, normabs, MCNUFFT import...
c1eff4355bb8db9b5ed4d2fedbcded3833971356ccf4978018391e168099ace3
Python
8,252
215
import os import pickle import tarfile from typing import Callable, Optional, Sequence, Tuple import torch from torch import Tensor from pl_bolts.datasets import LightDataset from pl_bolts.utils import _PIL_AVAILABLE from pl_bolts.utils.warnings import warn_missing_pkg if _PIL_AVAILABLE: from PIL import Image el...
caed0e4e37326b9bb5b404e4184b2eb1729b5804e43f80743b9a3a3c7be96203
Python
8,252
206
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jul 30 15:25:51 2025 @author: rico """ import pandas as pd import os from pathlib import Path from matplotlib import pyplot as plt import numpy as np from scipy.optimize import curve_fit import numpy as np import matplotlib.pyplot as plt from sklearn.m...
88674b5c442f1acaa481484504392032c65dc10413d8a425faec20919203c54a
Python
8,253
220
"""Layer site accessors: ``site_key`` (typed ambiguity, I-S3'), ``site_peers`` (live index, typed legacy refusal), and ``shape_summary`` (derived across-pass data string with its pinned character class). """ from __future__ import annotations import pytest import torch import torch.nn as nn import torchlens as tl fr...
3d2833cec32429c4c4cf9726130fb1d77c8a830793b5f3c7f7ed896ef70ff388
Python
8,254
236
import numpy as np import pandas as pd from sklearn import metrics import scanpy as sc import ot from sklearn.decomposition import PCA def mclust_R(adata, num_cluster, modelNames='EEE', used_obsm='emb_pca', random_seed=2020): """\ Clustering using the mclust algorithm. The parameters are the sa...
47a739d97b3a9769fb913788af02942c60b0d740fa57608361e2480895fbe184
Python
8,254
223
import warnings from keras.src import backend from keras.src.api_export import keras_export from keras.src.backend.common import standardize_dtype from keras.src.backend.common import standardize_shape from keras.src.layers.layer import Layer from keras.src.ops.node import Node @keras_export("keras.layers.InputLayer...
863a921ea82704c9a9d88b616ad4374ece1b652aee44db7344e6cbc37276844a
Python
8,258
304
"""Predefined configurations for different (groups of) envs.""" def make_config(batch_size=128, c_entropy=0.01, c_value=1, clip=0.2, cpu=False, debug=False, discount=0.99, env='CartPole-v1', epochs=3, eval=False, export_file=None, grad_norm=0.5, horizon=2024, iterations=100, lam=0.97, ...
800a8e3c50e51959d1a1a60312cd35b7fe4c066e3cb5ebd7b7d7c0956f2180dd
Python
8,261
205
''' Sweep of hyperparams * Bajar el número de iteraciones y layers author: obanmarcos ''' import os import os, sys from config import * sys.path.append(where_am_i()) import pytorch_lightning as pl import argparse import pickle import numpy as np import matplotlib.pyplot as plt from utilities import dataloading_util...
2d54aacdd1f6cf2cb8e9434ad14ac4ac5a287956580007156441bc8a713fd381
Python
8,262
142
import argparse import os from util import util import torch import models import data class BaseOptions(): """This class defines options used during both training and test time. It also implements several helper functions such as parsing, printing, and saving the options. It also gathers additional opti...
5b3c7a7abbb0704d5daa7f0c966b65aca0b3cf42f2bc297d74d6d46283135c8a
Python
8,262
196
""" Functions for index and blast alignment. Copyright (C) 2021 Tham Cheng Yong This file is part of NanoVar. NanoVar is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your...
24118ec1e6a7614cceb6ab3b9fc8d83c0542320c700ee3aaace4b2293bed1af2
Python
8,263
197
""" Centralized path configuration for the AD confirmatory tool testsuite. Two filesystem roots are required to run this codebase: AWARENESS_DATASETS — directory containing raw EEG cohort data (ds004504/, ds006036/, Brain_Lat/, figshare_5450293/, ds003775/, LEM...
87232c1d319f0981e8be9f6f1c58c7827226e3b78b1c9b446b9eafd5c43dccd5
Python
8,263
162
"""Utils for auto SSD estimator""" import os import mxnet as mx from mxnet import gluon from mxnet import autograd from ....data.batchify import Tuple, Stack, Pad from ....data.transforms.presets.ssd import SSDDefaultTrainTransform from ....data.transforms.presets.ssd import SSDDefaultValTransform from ....data.tran...
e395695620b6e2c13e1c0a125b95d88fd9dfd1a6f047c3788387a5fb4d882186
Python
8,263
227
""" Motion estimation module for MOT """ # pylint: disable=unused-argument,arguments-differ,missing-class-docstring import time import logging from abc import ABC, abstractmethod import numpy as np class MotionEstimator(ABC): @abstractmethod def initialize(self, first_frame, first_frame_motion_pred_data): ...
17c7a5ff507a47d585ffce9b5e698f8ef87003273339b9eb2dcfd793331fd977
Python
8,265
167
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from pathlib import Path from ultralytics.utils import LOGGER, QNN_HTP_TARGETS, WINDOWS from ultralytics.utils.checks import check_requirements def qnn_library_paths() -> tuple[str | None, str]: """Resolve th...
2e35b34851df7392f7116fcf3785a0ce55ea60cac8b9ed2e25e7e65a58289101
Python
8,268
210
import argparse import math import os import random import numpy as np from numpy import fft import matplotlib.pyplot as plt from scipy.ndimage import zoom import torch def image(img_path1, img_path2, obj_size): """ :param img_path1: amplitude :param img_path2: phase :param obj_size...
5b56195cc278f8cfd768523835d58e965f33a0687c5ac614cfb7a101d8d79f42
Python
8,268
212
import os import pandas as pd import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as ticker def import_expdata(path): """ Import expression data from CSV files in the specified directory. Parameters path Path to the expression data directory. Returns ...
e5aff74d24f09d7b411e81c6816fc52a3122aafda24778e2799c7d0befd29262
Python
8,268
278
"""Regenerate the checked-in smart-collapse reference gallery. Run from the repository root: PYTHONPATH=$PWD python scripts/render_collapse_reference.py The default destination is ``docs/images/collapse``. The script also copies the finished gallery to ``/tmp/collapse_renders`` for visual review. """ from __fu...
ad56dcb8d680f89105a195dec71fbaa58fc80cfc75e6d74e5dfa7e71f80ba958
Python
8,269
215
"""F02 selection-batch ``do()`` v1 (edits memo D33; row B6 analog). One atomic ACT-only transaction: all-or-nothing attachment, ONE envelope with the batch disclosure and kind-specific staged-store slots, per-pair ACT audit rows, donor-group sharing by plan object identity (D8), cross-kind capability refusal, and the ...
db73e78dee5f3d6c6ac69550d7aef37ba101bc1cce5369501a02e41c5a6e2761
Python
8,269
269
""" =============================================================================== Classifier comparison =============================================================================== A comparison of several classifiers on low-dimensional synthetic datasets, adapted to SPD matrices from [1]_. The point of this examp...
fed6effeeeb9816fabedeeff078a91a4f4a94e0e1292516dba30916a693620c6
Python
8,271
239
import os from importlib import import_module import torch import torch.nn as nn import torch.nn.parallel as P import torch.utils.model_zoo class Model(nn.Module): def __init__(self, args, ckp): super(Model, self).__init__() print('Making model...') self.scale = args.scale self.id...
a1138331b9cc021cbc69b69cc3c5989ec7591c4574c64694b13b400ee4aacc91
Python
8,273
215
#!/usr/bin/env python3 # -*- coding: utf-8 -*- ########################################################################### # Copyright (c) 2020 Qingfeng Xia <qingfeng.xia@ukaea.uk> # # # # This file is part of the FreeCAD CAx dev...
e03615ed9de42caae6ee5a87b0789044213c3fec6b9b64004f9b1be93c0bc96e
Python
8,273
216
"""6. Dive Deep into Training SlowFast mdoels on Kinetcis400 ============================================================ This is a video action recognition tutorial using Gluon CV toolkit, a step-by-step example. The readers should have basic knowledge of deep learning and should be familiar with Gluon API. New users...
96019905ef16457d355fa84eececeb41ce99b294f2ff23c04e76db8126a571f2
Python
8,274
223
"""Tests for Trace-level profile and audit convenience reports.""" from __future__ import annotations import torch from torch import nn import torchlens as tl class ProfileModel(nn.Module): """Small nested model with two parameterized child modules.""" def __init__(self) -> None: """Initialize the...
9a9080e19ba304b220edf22c7266f014f3d14f9b65ae46a123414533523beac8
Python
8,275
158
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright © 2010 University of Zürich # Author: Rico Sennrich <sennrich@cl.uzh.ch> # For licensing information, see LICENSE from __future__ import division, print_function import sys import os import getopt def usage(): bold = "\033[1m" reset = "\033[0;0m" ital...
63938269920e854df6d7e49f58c043382003ae2f44b749f68bb61a4ffc2ffa1e
Python
8,276
189
""" Frequency-by-Frequency Errors ============================= Check the error of power spectrum models across frequencies. """ ################################################################################################### # sphinx_gallery_thumbnail_number = 2 # Import numpy for some utility functions import ...
fc659fb99c49c914bbca8e995ca3cd58de40ced5c5b93815c3e8f91c45ec6bb9
Python
8,281
317
import json import pathlib import numpy as np import pytest from impose import data from impose.structure import StructureComposite, StructureLayer from impose.geometry import shapes data_path = pathlib.Path(__file__).parent / "data" def test_append_duplicate_label(): sl1 = StructureLayer( label="test ...
c7e15c80242dde830ed419e1a388fb6b8b996fa22abfb3a7f755ec6a51cb38ae
Python
8,283
235
import torch import torch.nn.functional as F import numpy as np import os from ovseg.utils.io import load_pkl from ovseg.networks.resUNet import UNetResEncoder from ovseg.prediction.SlidingWindowPrediction import SlidingWindowPrediction FLIP_AND_ROTATE_IMAGE = True def ClaraWrapperOvarian(data_tpl, ...
a556b433b000694dc17320a016c7064ebabd39e78d50f1c6f69b466233b4c3a5
Python
8,288
236
from typing import Literal from warnings import warn import numpy as np from anndata import AnnData from mudata import MuData from scanpy._utils import view_to_actual from scipy.sparse import csr_array, csr_matrix, dia_array, issparse, spmatrix # Computational methods for preprocessing def tfidf( data: AnnData ...
5a9f0cd6ab5ff5e1e2f854c3111e242c76e4ca0012d430f7cd4b8a46c081bfc3
Python
8,289
206
"""Behavioral tests for repgeom input-validation and refusal semantics.""" from __future__ import annotations import numpy as np import pytest import torch import torchlens as tl def _distances(n: int = 8) -> np.ndarray: """Return a valid Euclidean distance matrix over ``n`` distinct points.""" rng = np.r...