sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5cf9caee512d427d088139ee9c924065ec298029ac24318f8c6d0c7d34a26f91
Python
9,240
173
"""The episode declaration dataclass for ``tl.trace(..., episode=...)``. Split from :mod:`torchlens.options` along the episode option-family seam (R43 file-size ratchet); the public spelling stays ``tl.options.EpisodeSpec`` (re-exported there). Semantics are pinned by the ratified S2/S6/S7 contracts; the doc of record...
ebe3e895f932580c6e28032732b7e0d43ac7273d6e6be4238e9b7d6095a2862d
Python
9,240
260
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created in March 2020 @author: Quentin Lutz <qlutz@enst.fr> @author: Thomas Bonald <tbonald@enst.fr> """ from typing import Optional, Union import numpy as np from scipy import sparse from sknetwork.clustering.louvain import Louvain from sknetwork.hierarchy.base impo...
8e617c5a15875d664db47ae1df3bd40f06b3de87839352e10da0f028e3e7c62d
Python
9,241
244
# -*- coding: utf-8 -*- # Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl> # All rights reserved. """Mixin for readmanager to create MNE.Raw objects.""" import json import time from datetime import datetime, timezone from typing import Union from copy import copy, deepcopy import numpy i...
808381c4ff0e6268533e24a34a4344d59a9fbb150fed66bb6d868649c0cddd6a
Python
9,242
317
""" Base classes shared by the behavioural effector modules. Defines the effector interface, its stepwise and oscillatory specializations, and the adapter that lets an effector be driven by a Nengo network. """ from __future__ import annotations from typing import Any import numpy as np import param from ...param i...
0e0d607d96aa9da850ceb9b148459f3e055a618397fee440955fd6e9b39e03b3
Python
9,246
214
import numpy as np import torch from models.Estimator import Estimator from models.Transformer import Transformer class Distiller: """ A class to use for distillation. """ def __init__(self, estimator=Estimator, model=Transformer, model_parameters=None, fit_parameters=None, device='...
37a6e0675c9975ec4c00f284f124f763f790353c55b0cd18f280a01b64e4a3b4
Python
9,247
253
from collections import defaultdict import torchhd from torch.utils.data import DataLoader, Dataset from transformers import AutoTokenizer, AutoModelForCausalLM from tqdm import tqdm import torch from torch.autograd import grad from dict_hash import sha256 from os.path import join import transformers import joblib impo...
3df8d7721e0eaa4c564fcaeb690639e5f1b3c7b8b205b077ebe15160dbcc5586
Python
9,247
299
import torch from torch.utils.data import Dataset, DataLoader, RandomSampler, SequentialSampler import torch.optim as optim from models.attention_model import Attention_MB from learning.logger import EarlyStopping, Accuracy_Logger import os import numpy as np class MIL_Dataset(Dataset): """ Dataset for DataLoad...
4afbe691ff9f4e22b0f0a37a88fd4e3d9b76532611a55790c5b544472e99cbbc
Python
9,247
203
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations from pathlib import Path from typing import Any import torch from torch.nn import functional as F from ultralytics.data import YOLOConcatDataset, build_dataloader, build_yolo_dataset from ultralytics.data.augment ...
04ea1714b919461e4c4a137f25197f4957032c7fa1e8a753f977199eb28a4e4f
Python
9,248
321
import json import pickle import numpy as np import pandas as pd from modular_splicing.utils.construct import construct from shelved.full_gtex_dataset.pipeline import ( produce_datasets_from_datafile, ) from modular_splicing.data_pipeline.create_datafile import produce_datafiles from modular_splicing.gtex_data.a...
735b9cf4a0aa390f7b79413e5548ab3163929449d776f5d2006813c29ef7a994
Python
9,248
242
#!/usr/bin/env python3 # encoding: utf-8 from __future__ import (absolute_import, division, print_function, unicode_literals) import os, sys, re import logging import argparse import collections import numpy import time logging.basicConfig(stream=sys.stderr, level=logging.INFO) logger = loggi...
a87eb85c085b653219b96c9826d506c565618450c367675f04999074088180c4
Python
9,248
173
# Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com) # PLUS import os import sys import argparse import torch import plus.config as config from plus.data.alphabets import Protein import plus.data.fluorescence as fluorescence import plus.data.dataset as dataset import plus.model.plus_rnn as plus_rn...
03907c04472f154704f6f511891ff41edb36c2a69f240dae2000ae3abee27d1c
Python
9,250
234
################################################################################################################################################################# ####################### Training MulitRBP ####################################################################################################################...
b4c3240b5669f14d5b06327d5568169cc978217b0a771ac788c7f2cfb1f838c4
Python
9,250
223
# FIXME: check the rpc-interface.js version and warn if incompatible # support python 2.7+ and 3 from __future__ import unicode_literals from IPython.display import display, Javascript, clear_output from json import dumps as json_encode, loads as json_decode # the base64 library produces clean output without newlines ...
e2c9f0125b26a4912a24336007383045924cddd969d284f8eb86318cf189146d
Python
9,251
191
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function from collections import Counter from functools import partial import numpy as np import tensorflow as tf from tensorflow.python.ops import gen_audio_ops as contrib_audio from .config import Config from .text import text_to_char...
7d4d6426d53ee4102c5f74420323031253675e2962e1c268609321a4b39d8ec3
Python
9,252
205
""" History agent for understanding and answering questions about Galaxy histories. Provides tools to explore histories, datasets, jobs, and tool usage. Can answer general questions about history contents, interpret results, generate methods sections, and summarize analyses. """ import logging from pathlib import Pat...
c96040cc1f954fa55959c6ea557e853f0b9713aa1650a9af99636b6b005691ea
Python
9,252
301
"""MLX object-module hierarchy tests.""" from __future__ import annotations from pathlib import Path import numpy as np import pytest pytestmark = pytest.mark.backend_mlx mlx = pytest.importorskip("mlx") import mlx.core as mx # noqa: E402 import mlx.nn as nn # noqa: E402 import torchlens as tl # noqa: E402 fro...
e3bf4146d7c5f1350f2e9d4d48fb28d479079ea174cd618ae7127b297e7b8b23
Python
9,252
158
""" Network Initialization ====================== `RectiPy` models are generally initialized via the :code:`rectipy.Network` class. The method `Network.from_yaml` serves as the main user interface for network model initialization. It allows the user to define the dynamic equations and default parameters of the units o...
f5b87e8a0529daa5576d525b00daabb71ca227fd2a1d33a4ef1d63ef400ca291
Python
9,252
158
""" Network Initialization ====================== `RectiPy` models are generally initialized via the :code:`rectipy.Network` class. The method `Network.from_yaml` serves as the main user interface for network model initialization. It allows the user to define the dynamic equations and default parameters of the units o...
94588d80adce2b02d207765031a2dfac1f5aa34172515b12ca4461803eb1e73c
Python
9,256
245
""" Convert online server json to hf3 input/json """ import logging import dataclasses from typing import Optional, List import copy import itertools from helixfold.common import residue_constants from infer_scripts.rdkit_utils import SMILESParseError, ConformerGenerationError from infer_scripts.rdkit_utils import...
c363e494d0b64de9a327c2ab739ad70a828eea6dc6298a3b9010757a635f33b8
Python
9,256
216
from __future__ import absolute_import, division from tqdm.auto import tqdm import torch import torch.nn.functional as F from trainingUtils import MultipleOptimizer, MultipleScheduler, compute_kernel, compute_mmd from models import Decoder, SimpleEncoder,LocalDiscriminator,PriorDiscriminator,Classifier,SpeciesCovariate...
c10e149be634163f414384adac23d1cee00dfaf4ccbef9487f454e8a0833f560
Python
9,257
251
from keras.src import backend from keras.src.api_export import keras_export from keras.src.optimizers import optimizer @keras_export(["keras.optimizers.Adafactor"]) class Adafactor(optimizer.Optimizer): """Optimizer that implements the Adafactor algorithm. Adafactor is commonly used in NLP tasks, and has the...
23687e6b060f133a123c0317802849b23bf33febecc0467c7a7e50e9a64d4295
Python
9,259
229
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: pramod - Modify lines 19-27 to point to the locations of the input files and cell type. - Modify lines 120, 123, 126, 129, 134, 140, 143,146, 147 to point to the dir where the output files are to be written. """ import pandas as pd import networkx as n...
453be7819ff018bee4c400cb098a74178cb4cc0802e050f29e124168e5525022
Python
9,261
186
import pandas as pd import random holidaysfile = 'src/random_holidays_EPobjects_list.csv' def add_ddy_objects(command1 ,command2 ,idf1,ddy_data): """ #Add Sizing:DesignDay object from .ddy file to IDF command1 is a boolean to add the ddy objects or not if command1 is True and command...
6881ef0390fb5dac6cb46c444e07f6b4511ff553b0f68c0c76078998c471266a
Python
9,261
299
import json import os from textwrap import dedent import pytest from caper.caper_workflow_opts import CaperWorkflowOpts from caper.cromwell_backend import BACKEND_AWS, BACKEND_GCP def test_create_file(tmp_path): """Test without docker/singularity.""" gcp_zones = ['us-west-1', 'us-west-2'] slurm_partitio...
a70ba7ccc65066bbadbbfbc3f764898cd8ff45a45f84e03271e0f036db2de132
Python
9,261
286
# -*- coding: utf-8 -*- # # Asteroid Impact documentation build configuration file, created by # sphinx-quickstart on Wed Oct 14 19:17:31 2015. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated fil...
5598e5b3dac85ec2d1b006233130dfb25bb115ea2bee53287e15cff6e7e92729
Python
9,262
273
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf import pandas as pd import argparse import os import sys import pwd import pdb import grp INPUT_PATH = "SimBoost/data/davis_cv_nmlzd.csv" LOG_DIR = "logs/" uid = pwd...
2dcb26265b6398a6f9fdefb2d9c9b199d0e78df3b1c7ddbe0150d9b0f0609bb5
Python
9,263
231
#!/usr/bin/env python # -*- coding: utf-8 -*- # # h264_to_mp4.py # # Copyright 2020 Giorgio Gilestro <giorgio@gilest.ro> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 o...
2151c4e68462e817c9358372485d6d554f7141a92949874a68e472c0fb7cc39b
Python
9,265
223
"""Regression tests for final Trace field ownership.""" from __future__ import annotations import torch from torch import nn import torchlens as tl from torchlens.constants import MODEL_LOG_FIELD_ORDER def test_trace_field_set_subset_of_user_facing() -> None: """Assert final Trace objects carry no capture-only...
7a4acbe19022cc34b971bf4e75eea29c43c438c9db4184ff6653ee4c5a52cf89
Python
9,265
277
"""Functions and utilities for transforming power spectra.""" import numpy as np from specparam.sim.params import update_sim_ap_params ################################################################################################### ##################################################################################...
5bd2cf6b67b3d8f3f00287eb87aa0a53f309a7e1ada413d4fb26f439555db4dc
Python
9,267
246
# -*- coding: utf-8 -*- from enum import Enum import numpy as np class DetectionType(Enum): EDGES = 1 WHITENESS = 2 class CircleDetector: """Contains functions which returns circles found at given positions in a given pixel array. """ # pylint: disable=bad-whitespace __directions = [ ...
0b9d75752b8b2b2c210215c57790fc2718d2122aebba3f06652a48a98f4c8756
Python
9,270
192
# Copyright (c) ByteDance, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. from pprint import pformat from typing import List import sys import torch import torch.nn as nn from timm.data import IM...
7472e42f85094ba71c040f8633c776049530daac065de024abe19f1745776d9e
Python
9,270
233
""" Train on CIFAR-10 with Mixup ============================ """ from __future__ import division import matplotlib matplotlib.use('Agg') import argparse, time, logging, random, math import numpy as np import mxnet as mx from mxnet import gluon, nd from mxnet import autograd as ag from mxnet.gluon import nn from ...
9adddd5ddf2486963ffe1d62e64ae752fb8689e1643c7df97fa05264be53b7a2
Python
9,271
296
"""Evaluation helper functions.""" import argparse import json import os from typing import List, Optional, Tuple from scalabel.common.parallel import NPROC from scalabel.eval.boundary import evaluate_boundary from scalabel.eval.detect import evaluate_det from scalabel.eval.ins_seg import evaluate_ins_seg as sc_eval_...
d4a0fec7b68ebfe09eba29afc1f5ea71e623e8bac9c09f85f9234e5aa914a9a6
Python
9,272
174
# Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com) # PLUS import os import sys import argparse import torch import plus.config as config from plus.data.alphabets import Protein import plus.data.secstr as secstr import plus.data.dataset as dataset import plus.model.plus_rnn as plus_rnn import plu...
6f5c8930acf98a7cda146a5c584f5150131c616c6de22f23eb64c886a80749e9
Python
9,276
260
'''DNN Feature decoding - decoders test (prediction) script''' from __future__ import print_function import glob from itertools import product import os from time import time import argparse import bdpy from bdpy.dataform import Features, load_array, save_array from bdpy.distcomp import DistComp from bdpy.ml import...
685905eb2d10da2aa34e58667cc5c7502dc2c2924211fa65891951655421d75f
Python
9,277
239
import argparse import os import numpy as np import math import h5py import scipy import torchvision.transforms as transforms from torchvision.utils import save_image from torch.utils.data import DataLoader from torchvision import datasets from torch.autograd import Variable import torch.nn as n...
7670cc675b11b0979035165a1ff246654f2468f900c0a3adec3a01f19f10c572
Python
9,278
200
#!/usr/bin/env python # -*- coding: utf-8 -*- """ figio.py — 图的落盘出口:一次调用同时写出位图 PNG 与矢量 PDF ------------------------------------------------------------------ 为什么需要:GeroScience 规定「**Figures should be submitted separately** … only **PDF and TIFF** files will be allowed for publication」。本仓库此前只写 PNG(170–180 dpi),按满栏 174 mm...
db3ca480e1801bd73e13b910cb0b3cb875bc6fe3d3ceac075e88a04cd0272578
Python
9,278
263
"""Segment boxes may only group siblings that are adjacent in execution order. The collapse reference promises that a dashed segment box asserts adjacency: its members are one consecutive run of siblings joined member to member. A segment that groups non-adjacent siblings (``b1, b2, b3`` around ``t1, t2``) or hides a ...
8bfc2e1a61fbc07938ae12facd8bc57d82618af9b5268c379711153fcbdeaa85
Python
9,280
235
""" Validation tests for essay_conf.py configurations. Tests essay configuration validation and error handling. Focuses on branch coverage for validation logic. Target: essay_conf.py: 11% → 65% (+200+ lines) """ import pytest from unittest.mock import patch from larvaworld.lib.reg.stored_confs import essay_conf @p...
213e932f3c0f71ea1c792bb727c4b128622770aa2613cc2138e3eb491fd8d894
Python
9,281
218
# 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...
2434b1adcd1ed099b7bcbe02afae1f0dd45de50b83acb0d06411ca97ca441a9d
Python
9,282
231
"""Model-input METADATA-PREDICATE witness contract for sparse runnable execution (r27-H2). These tests lock the honesty rule that a sparse runnable ``run`` may never report ``VERIFIED``/``ATTESTED`` after silently replaying the recorded taken path for a runtime input that differs on a metadata predicate the captured f...
6832f55777ad6f45be4483e4416eefba84c9ac8e25c27de93a57555faeffed0e
Python
9,284
249
"""Regression tests for the cert6 (round-6) intervention hardening fixes. Each test pins a specific silent-corruption / silent-empty-result bug found by the cert5 inspector that previously lacked coverage: * BLOCKER-1 -- differentiable-replay shallow fork aliased nested annotation dicts, so mutating the fork silent...
f07a4683fe10e574310702a2e5b5fc268ef4b63d78b3652d3a9e0be58b2280ea
Python
9,288
199
import pandas as pd from tqdm import tqdm import torch from omegaconf import OmegaConf import os import sys script_dir = os.path.dirname(os.path.realpath(__file__)) sys.path.append(os.path.dirname(script_dir)) from datasets import MegaScaleDataset, ddgBenchDataset, FireProtDataset, Mutation from protein_mpnn_utils imp...
ffd03ef7db1f82557effc542f8f4ebfc721ac74f0a33328fdd4d1345c21f038d
Python
9,288
178
#This program is distributed WITHOUT ANY WARRANTY; without even the implied #warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # # #This file contains a Python version of Carl Rasmussen's Matlab-function #minimize.m # #minimize.m is copyright (C) 1999 - 2006, Carl Edward Rasmussen. #Python adaptation ...
105a5c068bdb454aec506e40fcb94e51d187b09f62db09b99fc1f3d4780f841e
Python
9,289
226
from typing import Optional, Tuple, Union import torch import torch.nn as nn import torch.nn.functional as F from torch import Tensor from torch.nn import Parameter from torch_geometric.nn.conv import MessagePassing from torch_geometric.nn.dense.linear import Linear from torch_geometric.typing import Adj, NoneType, Op...
dbdab09459f33312a9feed5ff09317dc2e783e058619fe91e90bb91d42808610
Python
9,289
226
import os import time import math import argparse import random import numpy as np import paddle import paddle.nn.functional as F from dataloader import DualDataLoader as Dataloader from dataset import Molecule2DView, Molecule3DView from model import GeomMPNN from utils import split_dataset, rmse from sklearn.metrics ...
538a596f5257b669bb1078aa75283b4073dbcd049ec2cda53d3e86d6df26b4c2
Python
9,292
286
# Dependencies import numpy as np import yaml import nest import sys # Accept and assign variables scriptpath = sys.argv[1] # Path to Scripts scriptpath += "/" Experiment = sys.argv[2] # Experiment defining file # Load Parameters and unpack yaml_files = ["network.yaml", "simulation.yaml", Experiment] for file in y...
08b64bb2da62ff5e8f9004ab4f3d6561cac3115f1ade07baf60d9e6f4e535f1e
Python
9,294
295
# SOURCE: vendored from kuielab/mdx-net @ main # https://github.com/kuielab/mdx-net/blob/main/src/models/mdxnet.py # https://github.com/kuielab/mdx-net/blob/main/src/models/modules.py # # The original AbstractMDXNet/ConvTDFNet classes subclass pytorch_lightning.LightningModule # purely for training-loop plumbing (train...
584ecdb203ff1dbd9f4606a3bf1251913bd87fe8b5f3586fbeba68906d1c6ece
Python
9,294
231
from . import InvertibleModule import torch import torch.nn as nn import numpy as np def _fast_h(v, stride=2): """ Fast product of a series of Householder matrices. This implementation is oriented to the one introducesd in: https://invertibleworkshop.github.io/accepted_papers/pdfs/10.pdf This makes us...
a0388f94f16c46511e2b3cda70a110f330e4b4c48834bad4ebbe08de0f7008ab
Python
9,294
242
import os import XML_Parse as parse import Euclidean_Distance as ed import pandas as pd import numpy as np import plotly.graph_objects as go import matplotlib.pyplot as plt ####################################################################################################################### # Data Management and Or...
0211196c8c5a578fe62c33e58e22d28bf107655339d577b60148982da020f36c
Python
9,295
268
###################################################################################### # cell2location tutorial code (to use as template) # adapted from: # https://cell2location.readthedocs.io/en/latest/notebooks/cell2location_tutorial.html ###############################################################################...
0392b4cf6a238d8294ae4622bc50771208101360c2941a633a3cda83b0da9bb9
Python
9,298
243
""" Maze generation for the 2D robot simulation. Builds a randomized maze out of wall segments, used as an obstacle course for the robot agents. """ from __future__ import annotations from typing import Any, List import random from shapely.geometry import LineString __all__: list[str] = [ "Cell", "Maze", ] ...
63c4fd1f74b09d3a709db658c465b59dd4c61ece2ea9339100b8db94d195cce8
Python
9,298
265
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import argparse import xlsxwriter from models import GraphConv, AE, LP from utils import * from sklearn.metrics import roc_curve, auc, roc_auc_score, precision_score, recall_score, f1_score, accuracy_score parser = argparse.Argument...
15335b846aefd860785063898a74d8057573bdf4b9eeffd6ec8bacb26bbf0ff9
Python
9,299
219
# pylint: disable=line-too-long """ Utility functions for video action recognition task """ import os import logging import time import numpy as np import torch from ..utils import AverageMeter, accuracy logger = logging.getLogger(__name__) def train_classification(base_iter, model, ...
e5bec01075e4e6112bc732db7f4f7bedf320e5f129e9c92505ed0cf3ce16f7d8
Python
9,300
318
"""Celery error types. Error Hierarchy =============== - :exc:`Exception` - :exc:`celery.exceptions.CeleryError` - :exc:`~celery.exceptions.ImproperlyConfigured` - :exc:`~celery.exceptions.SecurityError` - :exc:`~celery.exceptions.TaskPredicate` - :exc:`~celery.exceptions.Ignor...
34e9f19d4f8d0fd95ae66d252048f838936ca357f716f114bd7a36a9a6253364
Python
9,301
268
import torch import numpy as np import pytorch_lightning as pl from collections import defaultdict from torch import nn from torch.nn import functional as F from torch_geometric.utils import to_dense_batch from dimenet import DimeNetPlusPlus from reporting import get_metrics def swish(x): return x * x.sigmoid()...
2a986ab3c7f2329ba92b012743a808f1d6b2ab3aeb296e555f2c8f7525b40df7
Python
9,302
267
""" Code here relates to text parsing and creation of HTML and markdown files to display the ABF header in a neat and organized way. """ import tempfile import webbrowser import time import glob import os import datetime import numpy as np np.set_printoptions(precision=4, suppress=True, threshold=5) import pyabf.wave...
e841e1602266e2b1b56c859b9e48fef935f8ede406934a7993789abcf37128f5
Python
9,302
186
# MIT License # Copyright (c) 2018 Adrian Wolny (https://github.com/wolny/pytorch-3dunet) # 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 t...
4204a19db127d3c62fbeebb74fc8d6a4e7ad164c9c56b804994aec1604bc0de3
Python
9,304
240
""" metadata *.txt is CSV with double quotes: "Symbol";"Value";"Unit"; """ import os.path import json ISO_only=True fasteners_only=True popup_processed=False # will be set in the first download download_folder="/home/qxia/Downloads/" # Permission denied nb_file_per_subcategory = 2 # need to be backup each time, r...
825eb41ee5a5c67fbd17261fa9438192b9189fce4db328723e3a18d0a247e55c
Python
9,304
273
import torch as ch import shutil import dill import os from subprocess import Popen, PIPE import pandas as pd from PIL import Image from . import constants from robustness.audio_functions import audio_transforms def has_attr(obj, k): """Checks both that obj.k exists and is not equal to None""" try: re...
057416717ebdc37ddd079480d725d199b39355840a514d59502b88606f4bc2c0
Python
9,307
289
# --- 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 Line(_BaseTraceHierarchyType): _parent_path_str = "scatter" _path_str = "...
4720c486fb7c523087453ce0aa9dac37e163532d153ceb72fd50609fe9ba45f1
Python
9,309
292
#!/usr/bin/env python3 """ Test script for validating the new backup format functionality. This script tests the updated backup system with the new nested databases structure. """ import json import os import sys import tempfile from pathlib import Path # Add the src directory to Python path sys.path.insert(0, os.pa...
bccb40827005887f41175bc7b23557da1e203fe915a5488fb3d47bd5ac39376f
Python
9,310
494
""" Color scales and sequences from the colorbrewer 2 project Learn more at http://colorbrewer2.org colorbrewer is made available under an Apache license: http://colorbrewer2.org/export/LICENSE.txt """ from ._swatches import _swatches def swatches(template=None): return _swatches(__name__, globals(), template)...
6773fdb5e1855db36d5c420e1fc48c85f15367cecd4c69089cba5af23eafab07
Python
9,311
259
#!/usr/bin/env python3 import argparse import csv import os import re import subprocess import unicodedata import zipfile from glob import glob from multiprocessing import Pool import progressbar import sox from deepspeech_training.util.downloader import SIMPLE_BAR, maybe_download from deepspeech_training.util.import...
c4b409b81ad8adc70d16b1d51b812899de6602ddebc0e6cceac7143e0aafd620
Python
9,311
223
import pytest import torch from pytest_mock import MockerFixture from lightly.utils import dependency if not dependency.timm_vit_available(): # We do not use pytest.importorskip on module level because it makes mypy unhappy. pytest.skip("TIMM vision transformer is not available", allow_module_level=True) fro...
21c2b95516a39263379c936299bad9b759d1c5ac7dd9134ba3765c24ed492978
Python
9,314
219
import sys from sys import argv from pybedtools import BedTool if len(argv) != 9: sys.exit("Usage: python NN_model_prep.py parse-train.tsv cluster-train.tsv gtruth_400-train.bed exclude_region-train.bed " "parse-test.tsv cluster-test.tsv gtruth_400-test.bed exclude_region-test.bed") # Obt...
93063beafc945160f48e7551c709bef2f2c4593bc27b643011260dcbc978281f
Python
9,315
232
"""Functions to refine staining and RNA alignments. """ import math from typing import List, Optional, Union import cv2 import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from anndata import AnnData from kornia.geometry.transform import thin_plate_spline as tps from tqdm import tqdm ...
c1e9f1866d60672b9f8e4e15622f1d8b0dd67627077675f250cfadc2112a1eb5
Python
9,316
204
# 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...
a38d82f67bba832a4ca31de772cb03fc0d4b06008be9133a3e6c384ede395977
Python
9,317
213
"""6. Reproducing SoTA on Pascal VOC Dataset ========================================= This is a semantic segmentation tutorial for reproducing state-of-the-art results on Pascal VOC dataset using Gluon CV toolkit. Start Training Now ~~~~~~~~~~~~~~~~~~ .. hint:: Feel free to skip the tutorial because the traini...
ba651229e5741b857aac477b625b923210f7d05bb79eb0b0f39730dd50eec371
Python
9,318
211
import pandas as pd import os import json from display import figure_counter def data_counter(overview_df, session, bids, bids_root, results, verbose=False): """ Counts available data and makes a heatmap representation of the availability :param overview_df: [Pandas DataFrame] Overview dataframe of all s...
138db9ca606f0fab3d0e86d21e854453dab63fc20720b915c20452c9478d17a3
Python
9,319
300
""" Keymap/shortcuts for interactive pygame visualization of simulations. """ from __future__ import annotations from typing import Any, Dict import json import string from ... import CONF_DIR from ...lib import util __all__: list[str] = [ "ControlRegistry", "build_pygame_keys", "default_controls", ...
2fce663fda0cd0013365c38de5a1f8c52f57a3161a8c889c8939cb59be4df969
Python
9,319
212
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license from __future__ import annotations import os from pathlib import Path import numpy as np from PIL import Image from ultralytics.data.utils import IMG_FORMATS from ultralytics.utils import LOGGER, TORCH_VERSION from ultralytics.utils.checks import c...
51c7ad5a1f4100607b1b712f9156d5e0e0fea124db882fa29c6bf3067d9d2d5b
Python
9,319
257
#!/usr/bin/env python3 """ File: plot_vertex_distribution.py Created: 2021/04/08 Last Changed: 2021/07/07 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...
bb072d1204de54889bf515a08afd13851f018c7ac8b3f7de16887e358cc439b8
Python
9,319
229
"""r32-abc Fix A pins: saved-tensors pack/unpack hooks must not corrupt capture. Round-34 Finding A (MED, pre-existing at e7f036fe): a torch op executed inside a ``torch.autograd.graph.saved_tensors_hooks`` PACK hook fires DURING the producing user op's dispatch, before that op is logged. Two graph corruptions followe...
dd8eb58770b406858623bd36d60f2724c6166bd1275b30cad7ab6849cac3c7b8
Python
9,319
282
import logging import signal import time from subprocess import PIPE, Popen from threading import Thread logger = logging.getLogger(__name__) interrupted = False terminated = False def sigterm_handler(signo, frame): global terminated logger.info('Received SIGTERM.') terminated = True def sigint_handler...
163e17cd9c6072de3d747ad1e4d2ca00019c04482e6289e0f8073f3b2e16a42d
Python
9,320
175
# Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com) # PLUS import os import sys import argparse import torch import plus.config as config from plus.data.alphabets import Protein import plus.data.transmembrane as transmembrane import plus.data.dataset as dataset import plus.model.plus_rnn as plus_...
654bffa79e54b21d464903d529a7fbbf2b7a2a3c8e55d879c7703cbca0a7dcd3
Python
9,320
305
# 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...
6fb2f948f42f09b8ae2350ed8e412d18221a5b535c8f316c0ca4349cd43a8347
Python
9,322
189
""" Creates a null distribution for a model created with a build_network.py file from robust audio. Works for both image and audio clips, using the dataset and augmentations that are specified in the build_network.py file. """ import torch from robustness.tools.distance_measures import * from matplotlib import py...
c170b5baabdaaa615311abd96f882dfe70ccc57080dfb45dee32851d95160bd0
Python
9,322
275
#!/usr/bin/env python3 """ File: plot_ieqtl_barplot2.py Created: 2022/07/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. ""...
f3d446284d857c47ab7e78780d84467b99bc97a566bdd0f614ead45a2add3671
Python
9,323
238
"""F26: sink protocol, JSONL artifact, TB duck-writer path, transfer oracle.""" from __future__ import annotations import json import pytest import torch import torchlens.trackers as trk from torchlens.trackers._errors import SinkDeliveryError, SinkProtocolError, TrackersError class _DuckWriter: """A dependen...
1709512dd9a2abe8564e14ea0df8f0b25e8ee73ad70fad6e66d4a0dde8a8bbaa
Python
9,324
189
#!/usr/bin/env python # Dan Blankenberg import sys import bx.intervals.io def force_bed_field_count(fields, region_count: int, force_num_columns: int): if force_num_columns >= 4 and len(fields) < 4: fields.append(f"region_{region_count}") if force_num_columns >= 5 and len(fields) < 5: fields...
84173c74f6122e147f068f802af343fbfbeb75fc3da1fcbd3240d83c6ac97b30
Python
9,324
271
#!/usr/bin/env python __author__ = "Bjoern Gruening" __version__ = "0.1" __date__ = "" __license__ = "GLP3+" """ Housten we have a problem. NCBI does not accept sequences with gaps in it. Scaffold on the other hands can have large amounts of N-runs in it. These script, remove all N-runs and creates an add...
a851805eed7af0fc4527c57660bfeb83759602990a8ef557ddbfec0cade12d21
Python
9,324
304
""" Turner modules generating lateral bending. Provides the turner interface and its alternative implementations, from a constant or sinusoidal torque to a neural oscillator whose intrinsic dynamics produce the alternating head casts. """ from __future__ import annotations from typing import Any import random impor...
c0790e24ad06549ae194b3d7da13cc14bdeedba669ee1072acfaf6c3e79bfbaa
Python
9,324
244
import math from typing import Optional, Tuple, Union import numpy as np import pyvista as pv from pyvista import MultiBlock, PolyData, UnstructuredGrid try: from typing import Literal except ImportError: from typing_extensions import Literal from ...logging import logger_manager as lm from ..models import c...
dba7ed101e3dba0569f49511c0e962d5b2379d70fc861450b621790eec008769
Python
9,325
262
"""Tests that the `env_checker` runs as expects and all errors are possible.""" import re import warnings from typing import Tuple, Union import numpy as np import pytest import gym from gym import spaces from gym.core import ObsType from gym.utils.env_checker import ( check_env, check_reset_options, chec...
877d6e25b62fb765d40e94e90c5ea06d2a6066931060e214f8394cdc871f97b1
Python
9,326
223
import pandas as pd from sklearn.metrics import auc, precision_recall_fscore_support,confusion_matrix,matthews_corrcoef, accuracy_score,roc_auc_score,average_precision_score,precision_recall_curve import sys import seaborn as sns import matplotlib.pyplot as plt from utils import parse_config,build_output_dir,setup_font...
10f26f07ce93956cb119cf0d44e7dd6b6e554233b72b9126b0e85264aee3fe65
Python
9,329
162
# -*- coding: utf-8 -*- """ Created on Tue Feb 21 01:42:19 2023 @author: Caterina Brighi """ #%% Import functions import matplotlib.pyplot as plt import matplotlib as mpl import SimpleITK as sitk import numpy as np import pandas as pd import datetime import os import glob import gzip import shutil...
dff0f9460fc3cc84beb5e019ca9ff4f1ee689374e795237f11aad00236d04171
Python
9,330
239
import argparse import os import numpy as np import math import h5py import scipy import torchvision.transforms as transforms from torchvision.utils import save_image from torch.utils.data import DataLoader from torchvision import datasets from torch.autograd import Variable import torch.nn as n...
3ffd39fa130af487e921509bf5f6ec41bf2175fd6487f09f193329636b724eb0
Python
9,332
233
import numpy as np import pandas as pd import re import math import subprocess import os import shutil # ------------------------------------------------------ # -- 3d distance def distance3d(a, b): d = math.sqrt(math.pow(a[0] - b[0], 2) + math.pow(a[1] - b[1], 2) + math.pow(a[2] - b[2], 2) * 1.0) return d ...
984bad997de13f2e5b594c364471b09df810fe10f9685f2b4193062df950a3a9
Python
9,332
173
import numpy as np from gym import utils from gym.envs.mujoco import MujocoEnv from gym.spaces import Box class InvertedDoublePendulumEnv(MujocoEnv, utils.EzPickle): """ ### Description This environment originates from control theory and builds on the cartpole environment based on the work done by B...
b774a8fcda3a49e8b58dc921c136564351143045f112cd061095dbeddb414afa
Python
9,333
293
# SOURCE: vendored from https://github.com/saikatchatt/danse-jrnl @ main # Vendored files: src/danse.py (DANSE class, dropping training-only methods not part # of the nn.Module forward graph -- push_model/save_model/train_danse/ # compute_predictions/compute_logprob_batch) and src/rnn.py (RNN_model class). The # ...
56261eb8267c8bd11698821ffe206bbf926835d46be66d1ad10db89af8e0a426
Python
9,334
242
"""Gradient receptive-field oracle tests.""" from __future__ import annotations from collections.abc import Iterator import pytest import torch from support.rf_isolation import preserved_rf_registry from torch import nn import torchlens as tl from torchlens.receptive_field import _rules from torchlens.receptive_fie...
8a7021378f1a097bab85c1bba6d0681dd0c75e4f5dff8e016954a9299ce0878d
Python
9,334
243
# -*- coding: utf-8 -*- # Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl> # All rights reserved. """ Module provides single :class 'ReadManager' responsible for reading OpenBCI file format. Author: Mateusz Kruszyński <mateusz.kruszynski@gmail.com> """ import copy import os.path from...
fce64f0200d9f09c510b0fb7639a08997150957f1565dd05ca705617ed7b123c
Python
9,334
291
# %% Plot spm glm results import numpy as np from nilearn import plotting import nibabel as nib import matplotlib.pyplot as plt import sys sys.path.insert(0, '..') from functions.data_helpers import get_computer # Ensure MNI152NLin2009cAsym template is available # can be downloaded from https://www.templateflow.org/...
bb9c9f8a34bd9982ca2dd811928974d16f06864f84b22688a77fdf3f63dc9b95
Python
9,335
212
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 29 18:04:08 2021 This is the configuration file for Experiment 1, the AI vs learning speed analysis. It different from the main Experiment 1 configuration file in 2 aspects: it is set to train more (N=100) models, and it uses a different convergence...
082c72dabccdc24c58cf011a1bdc5c5d462e0ca7368f54231075cfa1a20d566e
Python
9,338
280
"""Phase 5a tests for consolidated validation.""" from __future__ import annotations from typing import Any from unittest import mock import pytest import torch import torchlens as tl import torchlens.validation.consolidated as consolidated_validation from torchlens.validation.consolidated import InterventionValida...
3da5752b3f7206db916f559fdf379983c8964be3472d0e96f4dcfd6f93c549e2
Python
9,338
264
# -*- coding: utf-8 -*- import argparse import os import sys import time import brainpy as bp import brainpy.math as bm import brainpy_datasets as bd import jax import jax.numpy as jnp from jax import lax bm.set_environment(mode=bm.training_mode, dt=1.) class ConvLIF(bp.DynamicalSystem): def __init__(self, n_tim...
af7fa068dc1998564ca160bfd91728723c7c1201d6444ed75ec388de2f7daf4e
Python
9,338
265
import os import torch import sys import numpy as np class Trainer: r"""Class to train a model. This contains an internal training loop which takes care of validation and can be extended with custom functionality using hooks. Args: model_path (str): path to the model directory. model (...
09f695e6d1fcdd864c4d13bd1a603a3c8b654c11509f9d7b378da724f272f4ff
Python
9,339
295
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._bar import Bar from ._barpolar import Barpolar from ._box import Box from ._candlestick import Candlestick from ._carpet import Carpet from ._choropleth import Choropleth from ._choroplethmap import Choroplethmap from ...
5cd434492aeb924bcfca8cb093428108d5f196f63bfff11d87fc5842dafb263b
Python
9,341
221
import time import math from matplotlib.pyplot import title import numpy as np import torch import os import torch.nn as nn import torch.utils.data import torch.utils.data as Data import torch.optim as optim import torch.optim.lr_scheduler as lr_scheduler import tqdm from sklearn.manifold import TSNE from torch.nn.mo...