sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
2e5e0dd790d0d01c73f82933c97b39aaffee5c8108fe170a1aefd2eb120c4197 | Python | 5,978 | 142 | """Marker identity + internal separation (torchnative W0.2/W0.3, TN-D11/D13/D14).
The honest-Nsight launch copy depends on two XS repairs the panel measured as
missing: NVTX range names must carry CALL identity (twenty ``conv2d`` calls
were twenty indistinguishable ranges, TN-D13), and TorchLens's OWN
bookkeeping call... |
4d12905aed88858f70fec3d4d88fa6892b3f6a80b1886dcfa071adce767744fb | Python | 5,978 | 150 | """Regression tests for embedded-quote/backslash escaping in the rank-engine DOT emitter.
``_dot_id()``/``_dot_quote()`` in
``torchlens/visualization/_rank_layout_internal/layout.py`` wrap raw values in
``"..."`` for DOT text but, before this fix, never escaped an embedded
literal ``"`` (or ``\\``) character. A module... |
6913b7abf08bc517343408a24696bca5e22b1bbcb116aea834769668af28f4aa | Python | 5,978 | 197 | '''Example for comparing a neuron to a population
using their morphometrics'''
import neurom as nm
import numpy as np
import pylab as plt
# Set a list of features to be extracted
feat_list = ['number_of_neurites',
'number_of_sections_per_neurite',
'number_of_terminations',
'nu... |
f0ae687319e76b16b2ccf6f0b0102ad8a7fccb3a2500673e8ad16c846cdf4f35 | Python | 5,978 | 208 | import json
import shutil
import subprocess
import os
import re
import tarfile
import tempfile
from permacache import permacache
import tqdm.auto as tqdm
import pandas as pd
common = [
"geneSymbol",
"chr",
"strand",
"PValue",
"FDR",
"IncLevelDifference",
"IJC_SAMPLE_1",
"IJC_SAMPLE_2",... |
b996c48fb4721a909db325986ac2f8ebdd162a55f803b5a2c45247d2434bf6ea | Python | 5,979 | 146 | """Non-polluting receptive-field probe suppression tripwires."""
from __future__ import annotations
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.data_classes.field_policy import portable_state_spec_from_policy
from torchlens.data_classes.trace import Trace
from torchlens.rece... |
2bff685a5af10bf3a146b3ee9c1f898c17fec7710dee1d3db47bfe3a4bf9ee33 | Python | 5,980 | 167 | """Regression tests for module root/non-root role swaps (cert10).
A module that is ever prepared as a NON-root submodule permanently kept a
toggle-gated ``forward`` decoration and a root-relative dotted address keyed to
that role. Tracing the SAME module later as its OWN top-level root then crashed
with ``KeyError`` i... |
7e0f04c1264fd242660ca7085d2ff9d95d1dfdd218a4535a8f0b5fa359763d3b | Python | 5,981 | 161 | #!/usr/bin/env python
# Retrieves data from external data source applications and stores in a dataset file.
# Data source application parameters are temporarily stored in the dataset file.
import os
import socket
import sys
import urllib
from json import dumps, loads
import galaxy.model # noqa F401 # need to import ... |
5f0c0fae752a20a010f6c3247b2cf0827bc35196d1daff10048bf530e326b7ff | Python | 5,982 | 199 | #!/usr/bin/env python
'''
Parallelize functions with simple arguments via torque
From Niklas Wilming et al. Nature Communications 2020
https://github.com/DonnerLab/2020_Large-scale-Dynamics-of-Perceptual-Decision-Information-across-Human-Cortex
'''
import errno
import os
import subprocess
import tempfile
def submit(... |
131a1e952a56d551e77a0002327b59175f5947bba97976d2f00cff5f0abc85c5 | Python | 5,983 | 193 | from copy import deepcopy
from textwrap import dedent
from caper.dict_tool import merge_dict
from caper.hocon_string import HOCONString
INCLUDE_CROMWELL = 'include required(classpath("application"))'
def get_test_hocon_str():
hocon_str = dedent(
"""\
include required(classpath("application"))
... |
9e33658e9326994c6f4f4191307c4bfa244711e7bf435441ad8744495dab063d | Python | 5,983 | 128 | # -*- coding: utf-8 -*-
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
fontsize = 16
plt.style.use('seaborn-colorblind')
plt.rcParams.update({'font.size': fontsize,
'font.family': 'sans-serif',
'font.sans-serif': ['Arial'],
... |
bd84d5b8e78feea1f7abc9bf10b4a3ece1d5fc96219ec8a7c820a2e9c41c0212 | Python | 5,984 | 176 | """Echo typed refusals: every door teaches at the point of failure.
Each refusal here is CONTRACTED (S-17): stable ``fields["code"]``, non-empty
``fields["remedy"]``, a contract-doc row -- and the negative composition
cells from snoop memo section 6 (cache, chunked, hooks-mount,
narrator-as-save-predicate, halt-only f... |
065e08f06ce2670c9f3852a251bcb152546086d9fa008be23911723e1fda9926 | Python | 5,986 | 152 | """Capture must stay green while a foreign ``TorchFunctionMode`` is active.
Stage-0 safety-net fix: TorchLens used to DECORATE
``torch.nn.functional.handle_torch_function`` (it sits in torch's
``get_ignored_functions()`` list, which the decoration inventory re-adds).
``handle_torch_function`` is ``__torch_function__``... |
b63e8b6d248e8478f5e0a6e67b158cc2f7070366c521ce0c6c9c66a14638b4eb | Python | 5,986 | 159 | """ Model Registry
Hacked together by / Copyright 2020 Ross Wightman
"""
import sys
import re
import fnmatch
from collections import defaultdict
from copy import deepcopy
__all__ = ['list_models', 'is_model', 'model_entrypoint', 'list_modules', 'is_model_in_modules',
'is_pretrained_cfg_key', 'has_pretraine... |
1093b52f39155db56313c010a457c2cc6c5a1ad3720177f6d2beb460eff87837 | Python | 5,987 | 224 | import napari
import numpy as np
import pytest
from scipy.ndimage import rotate
from stardist.models import StarDist2D, StarDist3D
from stardist_napari._dock_widget import Output, TimelapseLabels
def test_fluo_2d(call_plugin, nuclei_2d):
kwargs = dict(
image=nuclei_2d,
axes="YX",
model=St... |
14b541694cc40740bceddbb2e129e4aa6f35974d0dad3a1378b53ac22ecae7ce | Python | 5,987 | 199 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Autorangeoptions(_BaseLayoutHierarchyType):
_parent_path_str = "layout.scen... |
756c40ef3eec0494e81c4670939c834f76317f54bda6740708197c595e3e63b1 | Python | 5,987 | 199 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Autorangeoptions(_BaseLayoutHierarchyType):
_parent_path_str = "layout.scen... |
9297ca1cd372c5dc5f93fd11edb0e0b28ce4156910512fd007940138f808f6bd | Python | 5,987 | 199 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Autorangeoptions(_BaseLayoutHierarchyType):
_parent_path_str = "layout.scen... |
414164e0bc25de1932dbf2aa437f82e42eec668f3e072446d1e8d88bdbd6f780 | Python | 5,990 | 171 | import os
import matplotlib.pyplot as plt
import torch
from hydra import initialize, compose
from monai.visualize import GradCAM
from torch.nn.functional import softmax
from tqdm import tqdm
from data.dataset_3d import TestDataset3D
from initial_setting import get_instance
def run(data, model, device, target_layer,... |
7ac64acf9e234b1a1ba62220420c7d385007b1c65faf155ce809bf5848aa5f93 | Python | 5,990 | 150 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
def extract_abundances(fp, nb_charact_to_extract):
abundances = {}
more_abund_charact = []
abund_sum = 0
with open(fp, "r") as abundance_f:
for line in abundance_f.readlines()[1:]:
split_line = line[:-1].split("\t")
... |
5f3ae09de040f8314115f13aa5d2e99fb4cbe4f004b3ed4d24d208f00ad8a5f2 | Python | 5,991 | 250 | """Peer-tool capture implementations for TorchLens performance benchmarks."""
from __future__ import annotations
import importlib.util
from collections.abc import Iterator
from contextlib import contextmanager
from typing import Any
import torch
from torch import nn
class PeerSkip(RuntimeError):
"""Structured ... |
157e500a62af8823aaf51205b03abe69dd0e91637bd73c30d5a064cb4e2e00f0 | Python | 5,993 | 164 | """Tests for the temporal ordering of imported tracks and for trajectory centering.
Both cover defects that stayed silent in the data : a non-stable sort that reordered the
samples inside each track, and a centering offset that used a half-range instead of a
midpoint. Neither raises, so they are pinned here by their n... |
85747f784d5a6da04f0d118d0814a4ade32bd99f38c52a59b353c3b48d7c339b | Python | 5,993 | 191 | #!/usr/bin/env python
# from galaxy import eggs
import sys
import rpy2.rlike.container as rlc
import rpy2.robjects as robjects
# from rpy import *
r = robjects.r
# export PYTHONPATH=~/galaxy/lib/
# running command python partialR_square.py reg_inp.tab 4 1,2,3 partialR_result.tabular
def stop_err(msg):
sys.... |
d8e127252d5fe7fae30cde919567ea52430533a0b4a3f382087c3e48e30b6c28 | Python | 5,994 | 218 | from matplotlib import pyplot as plt
from PIL import Image
import pandas as pd
import matplotlib
import numpy as np
import networkx as nx
import math
import random
from stlearn._compat import Literal
from typing import Optional, Union
from anndata import AnnData
import warnings
import io
from copy import deepcopy
from ... |
83086c79d4790a55aacf4ee12ced4aea939aa86eeca70eff6a23e54e5df77cf6 | Python | 5,999 | 189 | # 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... |
eae73fe317949fbdc60ccecce99f8d77e329df162b6fe98123693ae0e6a3c4b7 | Python | 5,999 | 167 | """Per-backend ``fp32_precision`` policies (torch >= 2.9) vs the ambient record.
torch 2.9 added per-backend ``torch.backends.*.fp32_precision`` knobs. The legacy
getters the v2 ambient record reads (``cudnn.allow_tf32``,
``cuda.matmul.allow_tf32``, ``get_float32_matmul_precision()``) RAISE when the
per-backend state ... |
63e48fe35ae6fbc91924dcf1e81ee3651107732d014f6f20c38f5e2e43983663 | Python | 6,001 | 152 | #!/usr/bin/env python3
# import required modules
from keras import layers
from keras import models
from keras import optimizers
from keras import callbacks
import numpy as np
from argparse import ArgumentParser
def parse_cmd_args():
"""
"""
parser = ArgumentParser()
parser.add_argument('-d', '--direc... |
2314d5d666f344c3b55d9e44319a3354727c75ac7ac73266f64a088da9d629fa | Python | 6,002 | 100 | """
Neural Network implementation for image segmentation
Copyright (c) 2022 Giansalvo Gusinu <profgusinu@gmail.com>
Copyright (c) 2020 Yann LE GUILLY
Code adapted from colab and article found here
https://yann-leguilly.gitlab.io/post/2019-12-14-tensorflow-tfdata-segmentation/
https://github.co... |
5823f8ecb14bc0b5dfaf86ff4695d4e017270d411d54c79a0fd9c73fa77a5b35 | Python | 6,003 | 165 | import os
import time
import numpy as np
import pandas as pd
import pickle as pkl
import nibabel as nib
from os.path import join as pjoin
from scipy.cluster.hierarchy import linkage, fcluster
from community import best_partition, modularity
from magicbox.io.io import CiftiReader, save2cifti, GiftiReader, save2nifti
fro... |
c41db0148156f654be70da99e66f63531dafafa39c45bed37cf9b86cf423b0f3 | Python | 6,006 | 147 | import torch
from tqdm import tqdm
import collections
from schnetpack.nn.cutoff import HardCutoff
from moinn.nn.neighbors import PairwiseDistances, AdjMatrix
def get_hard_assignments(s):
# get most likely cluster for each atom
max_idx = s.argmax(dim=-1).flatten()
# list of spl indices and atom indices
... |
e4cc47f0a7d4d0e970f38d006344e64ba70110ae6b8f2a283a6ea5a14e773e6f | Python | 6,007 | 125 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
6a34166bcb4e80c96a38186e8dffa78512cce018622c72f893848e2bbf562adb | Python | 6,010 | 166 | import itertools
from types import SimpleNamespace
import numpy as np
from permacache import permacache, drop_if_equal
import tqdm.auto as tqdm
from modular_splicing.dataset.h5_dataset import H5Dataset
@permacache("eclip/count_eclip_by_intron_or_exon_2")
def count_eclip_by_intron_or_exon(
path, eclip_params, am... |
bf45fb0b276afb6e1ab5b654ba88220ca3408f542381962e781987528cf528e2 | Python | 6,011 | 227 | import tqdm.auto as tqdm
from permacache import permacache, stable_hash
import numpy as np
def modified_codon(codon_idxs, rna, updates, start_location, end_location):
original = rna[codon_idxs]
modified = np.repeat(original.copy()[None], updates.shape[0], 0)
mask_to_modify = in_range(codon_idxs, start_lo... |
14f13737ce3d886da60288091f04d8a3de94c0eff33c0098a99d6f27b22bdb99 | Python | 6,012 | 143 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test classes and functions in tfep.nn.conditioners.made.
"""
# ===============================================... |
2287520a07fa0c08269260ff2b46009f5b51484fdcf728e3f31a751ab6f31323 | Python | 6,012 | 158 |
import logging
from typing import List
from tqdm import tqdm
from transformers import pipeline
import datasets
import numpy as np
from collections import Counter
def generate_ngrams_list(
sentence: str,
ngrams: int,
tokenizer_ngrams=None,
all_ngrams=False,
parsing: str = '',
nlp_chunks=None,... |
251433742f8449e3b3a605fd15309980501f59893bd8d7b206a7a51ae721249c | Python | 6,012 | 182 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 22 21:43:08 2022
@author: fcheng
"""
import numpy as np
import pandas as pd
from itertools import product
def makeDataFrame_diff_orientation_1stStage(df, illusion_type, plotdict):
x = []
pct_illus = []
pct_inducer = []
pct_a... |
8f9b5c76999e291274d4bb6ca2d52fa2206b4212983a7647d2edc89000248a27 | Python | 6,012 | 199 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Autorangeoptions(_BaseLayoutHierarchyType):
_parent_path_str = "layout.pola... |
21969964b4bfbd120cee3a7812139b295d41e384b384a71a584b238e80e6066e | Python | 6,013 | 142 | '''
This module is used to process the data to make it the standardized csv file,
ready for loading into the GNN module. Specifically, this module takes the
csv files from the GSS and converts them to reactive sites.
'''
import numpy as np
import pandas as pd
import os
from rdkit import Chem
import logging
from excel_... |
7597a24c13eda49c6df91b0edaa87d9ee203cba3d0b8bb821f9f77a4c12254aa | Python | 6,013 | 160 | import os
import sys
import logging
from dataclasses import dataclass, field
from typing import Any, List, Dict
from subprocess import Popen, PIPE, STDOUT, check_output
import pyprojroot
proj_dir = str(pyprojroot.here())
py_dir = f"{proj_dir}/package/python"
sys.path.insert(0, py_dir)
from mylog import StreamToLogger,... |
03160ddb1e64e80149db0bace683971602b8170ba4453223622968178bbfa7bb | Python | 6,014 | 200 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# nmodl documentation build configuration file, created by
# sphinx-quickstart on Fri Mar 8 15:07:46 2019.
#
# 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
# auto... |
758df071b431ecdf55dbb47b144609526837c1276e34b4dd364428b31b9dd709 | Python | 6,014 | 110 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
d41a24745cd11fe8b62879a450f5926227405c9e649aa57718d98c27f8011035 | Python | 6,015 | 163 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Hoverlabel(_BaseLayoutHierarchyType):
_parent_path_str = "layout.annotation... |
3842119514dbbe437901a9781b9af32e790e0aa1ce7e8724cafcd5d8ffb045d0 | Python | 6,016 | 114 | from Configurations import config as cfg
import math
###############################################################################
# SIMULATION MODEL PARAMETERS, i.e. the diffusion
# number of simulation model parameters
idxModTypes = len(cfg.EnumModelParams)
# NOTE: We divide EmissionRate by StepsPerFrame, i.e. 1... |
5f6443a1078aa8ff91149ec97d64d68e2e7144917061f097249cfd9dcd7dac96 | Python | 6,016 | 152 | """
This module is used to set up arguments and defaults. For information on how to
use it, see Step 2 of the :doc:`../example_usage/training_lib_part_1`
walkthrough.
"""
from . import attacker, datasets
from .tools import helpers
BY_DATASET = 'varies by dataset'
REQ = 'REQUIRED'
TRAINING_DEFAULTS = {
datasets.I... |
6267117d89ec442ecb656ec8338f8607c10baa20a91a8946b7f6b2013ac4190e | Python | 6,016 | 186 | """
Stored configurations for lab data formats and reference datasets.
Defines the tracker formats larvaworld can import from, and registers the
reference datasets that models are sampled from and evaluated against.
"""
from __future__ import annotations
import json
import os
from typing import Any
from .... import... |
29257d404ea986eac3912b70953aacbbd8c8daf71618625c944fdd9e37a2990f | Python | 6,017 | 163 | from acdc_nn import acdc_nn
from acdc_nn import util
import ddgun
import click
from warnings import warn
import functools
class Substitution(click.ParamType):
'''Click parameter class for substitutions'''
name = 'amino acid substitution'
def convert(self, value, param, ctx):
if isinstance(value, ddgun.Substituti... |
3250c4334da43490f9e78f66ab168f124d75ba5475957669a371676b2b8136e8 | Python | 6,017 | 183 | import torch
from torch.nn import Linear, Sequential, BatchNorm1d, ReLU, Dropout
from torch_geometric.nn import GCNConv, GINConv, GATConv, global_mean_pool, global_add_pool, BatchNorm, MessagePassing
import torch.nn.functional as F
from torch_geometric.utils import add_self_loops, degree
class GCN(torch.nn.Module):
... |
bdec9d764a04916ed12dac8c8916f727e0550b70b4f243831175352934b35f0f | Python | 6,017 | 174 | """Generate the bash completion script for vsearch.
Writes to stdout. Invoked from completion/Makefile.am:
cd scripts && python3 gen_bash.py > ../completions/vsearch
"""
from __future__ import annotations
import sys
from collections import defaultdict
import spec as spec_mod
HEADER = """\
# vsearch completion... |
bf42ca63023b84036b302828e054ff9901a032be8149f647eed687d75e7820c9 | Python | 6,017 | 140 | # plot performance of both GPU and CPU based cross-correlations
# using emalign test data
import tifffile
import dill
import os
import re
import sys
import multiprocessing as mp
import numpy as np
import perfplot
import logging
from xcorr import BatchXCorr
logger = logging.getLogger(__name__)
logger.setLevel(loggin... |
9c79918bdd004e9001c1413d08bd9dfaa637f286e917fa8c5e33f139d26a4280 | Python | 6,018 | 147 | from conftest import get_metrics
import numpy as np
from sklearn.neighbors import NearestCentroid
from pyriemann.datasets import make_gaussian_blobs
from pyriemann.embedding import (SpectralEmbedding,
LocallyLinearEmbedding,
barycenter_weights,
... |
9a8daa63a59f75767f222d461d00cc7fd3ed3940f7ea2cb709763fcb530a769b | Python | 6,019 | 169 | import numpy as np
import pytest
from gym.utils.env_checker import data_equivalence
from gym.utils.step_api_compatibility import (
convert_to_done_step_api,
convert_to_terminated_truncated_step_api,
)
@pytest.mark.parametrize(
"is_vector_env, done_returns, expected_terminated, expected_truncated",
(
... |
9cd9c7b1723097b4e2ddceb27ff4c8756b21833a0055e6fd51ed88f93d25be39 | Python | 6,019 | 165 | import os
import platform
import sys
from unittest.mock import Mock, patch
import pytest
from celery.utils.imports import (NotAPackage, cwd_in_path, find_module, gen_task_name, load_extension_class_names,
load_extension_classes, module_file, qualname, reload_from_cwd)
def test_find... |
ffef6bc89d21697afd536af4def32a576365bc8361fa9638d84f97f78cfe11f9 | Python | 6,019 | 148 | """M1 keystone lockstep tests: one declared schema, byte-proven views.
The FIELD_ORDER literals in ``constants.py`` remain the hand-written declared
schema; ``FIELD_POLICY`` tables and the generated ``StorageBinding`` tables
must agree with them exactly, in both directions, for all 11 record classes
(docs/reference/tr... |
c16130a8692283a82027465ae9d48e20c601531b0b84e0619ecd944239bcd507 | Python | 6,021 | 157 | """
Extract workflow paths from the tabular file containing
input and output tools
"""
import random
import utils
class ExtractWorkflowConnections:
def __init__(self):
""" Init method. """
def process_raw_files(self, wf_path, tool_popu_path, config):
"""
Remove pipe from workflows a... |
1d69d8b48c21ab9002beda6f24ee734cd8f26679b650e9743fddbbb86e0fba91 | Python | 6,022 | 207 | """create_tables stateless script
Revision ID: 5abae4eb2079
Revises: None
Create Date: 2021-05-18 22:21:49.659708
"""
import os
import uuid
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.engine.reflection import Inspector
ADMIN_ORG_ID = "f52fe339-164d... |
ef223444f7960a9a78af49a4c1fd6be718312eed7a724b682588083b943a2ee6 | Python | 6,023 | 185 | import os
os.environ['PATH'] = '../caffe/build/tools:'+os.environ['PATH']
import sys
sys.path = ['../caffe/python'] + sys.path
import dec
import numpy as np
import caffe
import scipy.io
import dec
def main(db, params):
n_layer = params['n_layer'][0]
drop = params['drop'][0]
encoder_layers = [ ('data', ('d... |
9cb1f8908e7358f619ea651e284793262cd73928fb958fe15b05f636ad7cc08a | Python | 6,025 | 160 | import wget
from src.cfg import *
def load_barrel_files(data_path, islayer = False):
if islayer == True:
barrel_annot, barr_hdr = nrrd.read(f'{data_path}/barrels_annotation_10_extended_layers.nrrd')
id2barrlabel = pk.load(open(f'{data_path}/id2barrlabel_extended.pkl','rb'))
else:
bar... |
58ba8825741cc01d88b7ec64241078ea36decd714c49cbe0b99ecec32b5a0b66 | Python | 6,027 | 149 | #!/usr/bin/env python
"""
sync_mic_cal.py -- Pull this box's UMIK-1 calibration file from the
fleet's calibration-file registry on magpi.ucsd.edu, and record which
physical mic is installed here in this box's own panel_config.json.
Which UMIK-1 serial is installed in which box cannot be auto-detected --
the UMIK-1's U... |
afffa0a6d344ee5205f76233ebc2f5c561afa42ddbfd023a7ee0241f8b0cccbf | Python | 6,027 | 161 | """PointCLIP V2: Prompting CLIP and GPT for Powerful 3D Open-world Learning.
Zhu, Ma, Li, Liu, Tang & You (PKU / UCL), ICCV 2023, arXiv:2211.11682.
Source: https://github.com/yangyangyang127/PointCLIP_V2
PointCLIP V2 performs zero/few-shot 3D classification by:
1. Projecting a point cloud onto multiple 2D DEPTH MAP... |
d4afcd2df7d77910f30c627287fe424b8928032c72c5aa7adbec29ab1c06641b | Python | 6,027 | 166 | # Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com)
# Some parts of the code were referenced from or inspired by below
# - Dong-Hyun Lee's code (https://github.com/dhlee347/pytorchic-bert)
""" Transformer model classes """
import math
import numpy as np
import torch
import torch.nn as nn
import t... |
7ea58e09d7be16914fdeea9b967b849c9da30b13aba495e03b38aaea8201a107 | Python | 6,028 | 172 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl>
# All rights reserved.
"""Module defines single :class 'TagsFileWriter' providing proxy for OpenBCI tags file."""
import xml.dom.minidom
from .. import types_utils
TAG_STYLES = {
'gray': {
'fill_color'... |
cc53b3a782f8b8ecaf807f4edff03b847d144eabb541359a8353f79c4defc8f2 | Python | 6,031 | 167 | import logging
from typing import Optional
from authlib.integrations.starlette_client import OAuthError
from dependency_injector.wiring import Provide, inject
from fastapi import APIRouter, Depends, Request, Response
from fastapi.responses import RedirectResponse
from carbonserver.api.services.auth_providers.oidc_aut... |
57828361368024f6a2ca229fe10fac5345d4533d9858a9366ddd1ab90bf3e37c | Python | 6,032 | 205 | """Utility functions for xcp_d command-line interfaces."""
import argparse
import logging
import warnings
from argparse import Action
from pathlib import Path
warnings.filterwarnings('ignore')
logging.addLevelName(25, 'IMPORTANT') # Add a new level between INFO and WARNING
logging.addLevelName(15, 'VERBOSE') # Add... |
b8e826970b5227c808c87c08d604c838c70d3a2e7c736941ef89a3a08d8282e9 | Python | 6,032 | 140 | """
This module create TransformerClassifPerProt
"""
# pylint: disable=W0223
import torch.nn as nn
from torch.nn.modules.normalization import LayerNorm
import torch
import time
class TransformerClassifPerProtECHierarchy(nn.Module):
"""
This class define a Transformer model that classify an entire protein to O... |
bb6a850b12cedbe02bb312b92091daff1bf0bb2df6203516ce456d2bc7b2ed29 | Python | 6,032 | 181 | # --- 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 = "contour"
_path_str = "... |
1ba28f41a81f2aad43467ee1411277387ce71492d91e3fcf8a275913fcdc2e08 | Python | 6,033 | 191 | # Copyright (c) 2023, Tri Dao.
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.distributed import ProcessGroup
try:
from flash_attn.ops.activations import swiglu
except ImportError:
swiglu = None
try:
from flash_attn.ops.fused_dense import ColumnParallelLinear, RowParallelL... |
60910a08031aa15b0aa442d38d00e86536b499f3f80b3c03d6c26d9dd8abc4ac | Python | 6,033 | 156 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test objects and function in tfep.nn.transformers.affine.
"""
# ==============================================... |
980df01afd5ae3385bad44a514d5559938158e25dcd6c1533a2e79798a6048fa | Python | 6,033 | 143 | # Copyright (c) 2023, Tri Dao.
import math
import re
from collections import OrderedDict
import torch
import torch.nn.functional as F
from einops import rearrange
from transformers import FalconConfig, GPT2Config
def remap_state_dict_hf_falcon(state_dict, config):
def key_mapping_layers(key):
return re.... |
cc5337cd992277817e1a318c539c473019c5a35f61067897a6bd8e2f24e9381a | Python | 6,035 | 99 | """Model class template
This module provides a template for users to implement custom models.
You can specify '--model template' to use this model.
The class name should be consistent with both the filename and its model option.
The filename should be <model>_dataset.py
The class name should be <Model>Dataset.py
It im... |
e11bcb74e2a988886a89c6f60e075512e723ecb300ff7333048c3c5d66dc1aa9 | Python | 6,035 | 135 | #!/usr/bin/env python3
"""Автономный прогон протокола B2 (ЧЕРНОВИК 13 октября 2026, прогонов не было).
Те же шесть условий на одних seed'ах (sim/protocol_b2.py, WORLD_B2: нейтральный
маркерный ген, запись погибших, параметры мира по решениям §0 черновика),
100 000 тиков, единый предок на seed. Копится в runs/b2/protoc... |
e1222f6601567545778ca3f78d3f7dfdaac8178f691c8c22bcd2f89f99fb1376 | Python | 6,035 | 134 | """ SiamRPN test
Code adapted from https://github.com/STVIR/pysot"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import argparse
import os
import numpy as np
import mxnet as mx
from gluoncv.model_zoo.siamrpn.siamrpn... |
f9ee002f10fc90789ebcfe58b4aab2bf5223ff2c2a6603c209360182f4af8bfc | Python | 6,037 | 158 | """
Tests for the Add-my-Pet results-page importer.
The importer converts a locally downloaded AmP HTML results page into the JSON
payload that ``DEBPars.from_amp_json`` consumes. These tests use a synthetic page
so they are hermetic; an optional test runs against the real page when it happens
to be available.
"""
fr... |
920a5214d2cacb327a7a93bb592fb510406af8a81f843e788ad32b6501838642 | Python | 6,038 | 148 | from typing import List, Dict, Tuple
import numpy as np
import tensorflow as tf
from tqdm import tqdm
from drug_interactions.utils.utils import send_message
Data = Tuple[np.ndarray, np.ndarray, List[Tuple[int, int]], Dict[int, List[int]]]
TrainData = Tuple[List[Tuple[int, int]], List[int]]
tf.random.set_seed(0)
np.... |
5b70ec72dc5d92030fa24d0e68dab7883ca0dd3ce7cbbf159120c62525a8d9f7 | Python | 6,039 | 215 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (leoxiaobin@gmail.com)
# Modified by Bowen Cheng (bcheng9@illinois.edu)
# ------------------------------------------------------------------------------
fro... |
a1a350e7db8f6c73f3f873d87098db936ca90da5845d051ad93ab961ec8afb1f | Python | 6,040 | 159 | from optical_unit import AngSpecProp, Lens, PhaseMask, Incoherent_Int2Complex
from utils import padding, tile_kernels, split_kernels
import shutil
import time
import numpy as np
import os
import torch
import math
from torch import nn
import matplotlib.pyplot as plt
class FourierConv(nn.Module):
def __init__(self, ... |
beca9845f6d8dad1b0aaa87f4bed2884be1e5782ecd8d5925296c3ee72ba7ec2 | Python | 6,042 | 173 | import torch
from PIL import Image
from torchvision import transforms
import pandas as pd
from sklearn.model_selection import StratifiedKFold
import numpy as np
import torch.nn as nn
from random import shuffle
from sklearn.metrics import confusion_matrix
import copy
# CUDA for PyTorch
use_cuda = torch.cuda.is_availa... |
506f78fd1c997867df8fb1e355f58d7b271d165d24af077115e3d36f7828f093 | Python | 6,044 | 144 | """model_prep hardening (fw2 b4-P slice): SF-45 namespace walk + B1-13a disclosures.
SF-45: ``torch.distributed.reduce_op`` is a deprecation singleton whose
``__getattribute__`` emits a ``FutureWarning`` on ANY attribute access,
including the ``__class__`` read every ``isinstance()`` performs. The session
cleanup walk... |
c6fbc5181793fc7fecef5fc2da52a83b8cec76b57c1eb46145c7db48f6d56733 | Python | 6,045 | 169 | """r35 stage-4 (corr2_5 + hon1_5, Option A): non-persistent buffer declared state.
The required ``runnable_nonpersistent_buffer_v1`` family carries capture-time
values of used non-persistent buffers (declared state, contract sections 5/11).
Attestation eligibility partitions by persistence: persistent slots compare
ag... |
e7399ddc0d8c4b3b996146b1079d94b7a09bc26883f12bbb6418ecdf1296066d | Python | 6,045 | 129 | #!/usr/bin/env python3
"""
join_cohort_metadata.py — attach demographic METADATA to v3 primitive caches.
(1c follow-on, 2026-06-18.)
The v3 primitives-only re-extraction carried subject_id + group but dropped the rest of
the demographic block (age / sex / MMSE) that earlier caches had. That metadata is NOT a
feature: ... |
fde7493939889f21071687e5b04dd48864460a521a0b0762cb29e74971570199 | Python | 6,045 | 159 | """
Extract workflow paths from the tabular file containing
input and output tools
"""
import random
import utils
from scripts.utils import format_tool_id
class ExtractWorkflowConnections:
def __init__(self):
""" Init method. """
def process_raw_files(self, wf_path, tool_popu_path, config):
... |
343bd0722a4ae49a92cc477330a7be40163872271c543ec27163621b9ea77712 | Python | 6,046 | 160 | import unittest
from numpy import max, abs, ones, zeros, copy, sum, sqrt, hstack
from cantera import Solution, one_atm, gas_constant
import numpy as np
from spitfire import ChemicalMechanismSpec
from os.path import join, abspath
from subprocess import getoutput
test_mech_directory = abspath(join('tests', 'test_mechani... |
92d8d3d9c94769a84fc9d940e2e583257252a807d9d7a1376a7095146c39a369 | Python | 6,047 | 121 | #结论:当模型进行ensemble的时候性能会明显提升。
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.functio... |
045ef5982ec8cfc2e292bd41dbf8db17a29a17e00c1821208757b19d939eb42a | Python | 6,048 | 212 | #!/usr/bin/env python3
#
# LLSpy documentation build configuration file, created by
# sphinx-quickstart on Tue Oct 3 07:29:21 2017.
#
# 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 file.
#
# All ... |
3c5d494c8f40d3673e650614725ba4cc0d7b67ad29219696c7e71e297f9e4533 | Python | 6,050 | 190 | import matplotlib.pyplot as plt
import yaml
plt.ioff()
plt.switch_backend('agg')
########################################################################################################################
def create_feature_maps(init_channel_number, number_of_fmaps):
return [init_channel_number * 2 ** k for k in ran... |
d4adf97b140d3c0cc51e57d6e1e165b664d975dd8c8ee3c9ab26cf10af33225c | Python | 6,053 | 155 | """Lane F22 canonical-home riders (neuro MEMO D18, items 12-14).
Pins:
- The Gaussian/RBF RDM metric matches thingsvision's published convention
EXACTLY (reference implementation transcribed below, credited): squared
euclidean distances, bandwidth = mean(D) over the full matrix, kernel
``exp(-D / (2 * mean(D)))... |
5bbea73d12e290c1fadf01d13664245791d479cb843c8d899e6dffe4f5c5658f | Python | 6,055 | 199 | # %%
'''
Contains several functions for performing fix-ica training, applying such training
to unseen data and organising the hand classifications.
Usage:
Training a classifier (edit lists):
python -c "from fix_helpers import *; train_fix()"
Apply classifier to single subject:
python -c "from fix_helpers impor... |
aeb5f8dc9cd478e0d6921c014e05adbd512bd58049885eb10237899e311d2d2d | Python | 6,055 | 176 | import re
import numpy as np
from rdkit import Chem
from rdkit.Chem import rdchem
from rdkit import RDLogger
RDLogger.DisableLog('rdApp.info')
from tqdm import tqdm
class CNNFeature():
def __init__(self, **kwargs):
self.atom_size = kwargs["atom_size"]
self.atom_info = kwargs["atom_info"]
... |
459e65521cf47ce50e1c25091eb8156d3de296351861200581f597c79b34de98 | Python | 6,056 | 203 | """The ``celery graph`` command."""
import sys
from operator import itemgetter
import click
from celery.bin.base import CeleryCommand, handle_preload_options, handle_remote_command_error
from celery.utils.graph import DependencyGraph, GraphFormatter
@click.group()
@click.pass_context
@handle_preload_options
def gra... |
bec83e849afefcb991386a9ca3c674dbd0804c2de474c261bff396da18e3cc71 | Python | 6,056 | 178 | # This example requires the following dependencies to be installed:
# pip install lightly[timm]
# Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
# LeWM is a latent worl... |
0b110d1f5d80b1f3ef1b3b28d3fa612521b17f305d1842f3673e7626b041655a | Python | 6,057 | 197 | import os
from typing import Any, Callable, Dict, List, Optional, Tuple
import torch
from pytorch_lightning import LightningDataModule
from torch import Tensor
from torch.utils.data import DataLoader, Dataset
from pl_bolts.utils import _TORCHVISION_AVAILABLE
from pl_bolts.utils.warnings import warn_missing_pkg
if _T... |
c13aa3badd2274a5fbb6ae1674f9e588b48505fa3f5bd576acad112c2e0e5790 | Python | 6,057 | 215 | """Distance related functions."""
import numpy as np
from spiketools.utils.checks import check_array_orientation
from spiketools.utils.data import make_orientation
###################################################################################################
#####################################################... |
d45f83d8cde406cad0ff646bd7a271bf15144c9c9b46b5cba76383ea9e4f96c6 | Python | 6,057 | 183 | import argparse
from configparser import DuplicateOptionError
from textwrap import dedent
import pytest
from caper.arg_tool import read_from_conf, update_parsers_defaults_with_conf
CONF_CONTENTS = dedent(
"""\
param-wo-default="please_remove_double_quote"
param-w-type-wo-default='4.0'
param-w-type-wo... |
9c3b98f263043ff4b6737c274da6fc3bde62fdccf47a4205465f2aa4f8900d6b | Python | 6,058 | 163 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Hoverlabel(_BaseLayoutHierarchyType):
_parent_path_str = "layout.scene.anno... |
d79ec9021e93ee03cb095fd097ef0415221c0922a5f89787b80756ebc663a292 | Python | 6,060 | 123 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import os
from functools import partial
from pathlib import Path
import numpy as np
import torch
from ultralytics.utils import ARM64, LINUX, LOGGER, WINDOWS
from ultralytics.utils.checks import check_requirements
... |
3eb69580eda5fd861ed60cd412366dec1c900f2f9f743df08553b85704939ae1 | Python | 6,061 | 171 | """tvscope B6: the two-rung site inventory + the round-trip invariant.
The invariant (red before this lane on the audience's first question):
every emitted selector selects the advertised site with the returned dict
keyed by the REQUESTED string, or resolution raises a typed, useful
ambiguity whose remedy shows a WORK... |
b2f9afec979ee161d8c642996b6d30975fa1ad5ccacbef0b2e1814854017fbe8 | Python | 6,062 | 168 | # 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... |
dfc24a20ff8d6d142468a4d881bde6c7a340363d0217f603233056c156aedb7a | Python | 6,062 | 168 | # Copyright (c) 2021 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... |
79913a4c1be7f1b3c775f9ba065aa3948447ad249d6643530ecce41c8d3f62c6 | Python | 6,063 | 158 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test objects and function in tfep.nn.transformers.sos.
"""
# =================================================... |
27c6a2097ea52027dc9dc487647f70d10c9b144e546e75c9b85e47cc7bb51efa | Python | 6,064 | 137 | # cub multi-modal model specification
from numpy import sqrt, prod
import matplotlib.pyplot as plt
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 torchnet.dataset import TensorDataset, ResampleDataset
from to... |
80beaa42d35ff18ca9ee3c470e542bfa8c26941a62e2d8c03b7d94367e377242 | Python | 6,064 | 169 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 23 15:51:57 2021
@author: Audrey Mazancieux
This script performes group-level analyses of pupil size during the local
global task. Data must have been epoched by stimulus type using the
LG_pupi_singleSubj script.
"""
# Import useful libraries
... |
f2c87c8efd51f36bad358ad1ea4b937a0427bd8481554953cf5c34dd6fbe402b | Python | 6,064 | 171 | """
Graph content classes.
"""
import logging
from galaxy.datatypes.dataproviders.column import ColumnarDataProvider
from galaxy.datatypes.dataproviders.dataset import DatasetDataProvider
from galaxy.datatypes.dataproviders.hierarchy import XMLDataProvider
from galaxy.datatypes.protocols import DatasetProtocol
from g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.