sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
01d136f0d9a02adb1e73be012bc1053f87749c4e3568f3aa780a40d7ad536f05 | Python | 7,286 | 188 | """R62 buffer extension: gate + disclose the captured pre-forward buffer-value channel.
When a forward overwrites a registered buffer, capture records the pre-forward
value in ``Trace._buffer_initial_values`` and EVERY save level -- audit included,
which drops all outs/grads/args/rng -- shipped those tensors verbatim ... |
f4dd30e186db363740e925b9ad0c83dcc72bdf6ffb50fc53c9108b4bf52018be | Python | 7,286 | 185 | """grind-p3 T5.2: the capture-cache entry commits ATOMICALLY (payload + tag as one).
The pair format (``<key>.pkl`` payload committed by ``os.replace``, then a
SEPARATE ``.hmac`` sidecar written after it) had a torn-generation window: a
crash -- or a concurrent reader -- between the two writes observed a payload
again... |
d4ff1c8b6a6c60af2760f6433cf235448f7423380f1b92572a4736323426fa08 | Python | 7,287 | 184 | # Copyright (c) 2023, Tri Dao.
import time
import pytest
import torch
from flash_attn.models.gpt import GPTLMHeadModel
from flash_attn.models.gptj import gptj_config_to_gpt2_config, remap_state_dict_hf_gptj
from flash_attn.utils.generation import update_graph_cache
from flash_attn.utils.pretrained import state_dict_f... |
dcb0708e2961a5ccdbbd8355d50d71853e77c43f8e45d3d136f90ba3605dbcc9 | Python | 7,287 | 169 | import itertools
import numpy as np
from numpy.lib.recfunctions import structured_to_unstructured
from scipy.integrate import simpson
import matplotlib.pyplot as plt
import tensorflow as tf
import keras
def generateWindows(a, bins):
aPadded = np.pad(a, bins, mode="wrap")
aWindows = np.empty((len(a), 2*bins+1)... |
dc1687114a9fbc8c001dec5b1564aab9101a7745cf8bd88876dfc96e64046495 | Python | 7,290 | 179 | import sys,re,os
import subprocess
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from utils import getLongestORF, getFirstORF, parse_config,setup_fonts
def parse_needle_results(entry,save_di... |
fe817eddf238c0709ae7a6edf249e7828e090dd486ac6fad88d94ac2c4a8354f | Python | 7,290 | 174 | import contextlib
import os
import random
import numpy as np
from sklearn.model_selection import KFold, StratifiedKFold
import torch
from torch.utils.data.dataloader import DataLoader
# from torchsummary import summary
from hn_cnn.cnn import MODELS
from hn_cnn.constants import *
from hn_cnn.data_augmentation import ... |
1edff1a0edf0e5605bfe0ad74eca6c0ec191a5987151e1f811e6a3122cd3d283 | Python | 7,291 | 210 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""Base callbacks for Ultralytics training, validation, prediction, and export processes."""
from collections import defaultdict
from copy import deepcopy
from importlib import import_module
# Trainer callbacks ---------------------------------------... |
635ae4034db6a7b9d3c50c1a1648d6a9ccd71a114637486bd3a261e12479208d | Python | 7,291 | 214 | """
spaln Composite Dataset
"""
import logging
import os.path
from collections.abc import Callable
from galaxy.datatypes.data import Data
from galaxy.datatypes.metadata import MetadataElement
from galaxy.datatypes.protocols import (
DatasetHasHidProtocol,
DatasetProtocol,
HasExtraFilesAndMetadata,
)
from ... |
ca8c1d047569caebea0e4946f4e7bda073197e282d5f0b49b196271f17e2bf00 | Python | 7,292 | 164 | import numpy as np
import pandas as pd
import pytest
from skmob.privacy import attacks
from skmob.core.trajectorydataframe import TrajDataFrame
from skmob.utils import constants
from skmob.utils.utils import frequency_vector, probability_vector, date_time_precision
latitude = constants.LATITUDE
longitude = constants.... |
b49a9cd8d370a46e4e66eccda30d343de4645657eeec501921d3fdcd6eb4bc54 | Python | 7,294 | 174 | import contextlib
import os
import random
import numpy as np
from sklearn.model_selection import KFold, StratifiedKFold
import torch
from torch.utils.data.dataloader import DataLoader
# from torchsummary import summary
from hn_cnn.cnn import MODELS
from hn_cnn.constants import *
from hn_cnn.data_augmentation import ... |
d84e77a484eec6905ba67026ce043f001d83e2a5e6c350cf4cbb33032de011af | Python | 7,295 | 163 | import os
from os.path import exists
import numpy as np
import pandas as pd
import seaborn as sb
import matplotlib.pyplot as plt
# Helper function that extract the Jaccard indices from all images, cluster sizes, and methods for the given organ
def ExtractJaccard(respath, clustersizes, methods, organ):
... |
37fae4093569446091a874c816a6a7326d02eacc09d4abb6f45f79d27e0816f3 | Python | 7,297 | 328 | from array_api_compat import (
array_namespace as get_namespace,
is_torch_namespace,
)
import numpy as np
def _allclose(A, B):
"""Array-API equivalent of ``numpy.allclose``."""
xp = get_namespace(A, B)
return bool(xp.all(xp.isclose(A, B)))
def _get_eigenvals(X):
"""Real part of eigenvalues f... |
b183baf195081188255a4029e741761c152ce45fb9abcbf6c52971c94767efd6 | Python | 7,298 | 206 | import numpy as np
import torch
from ovseg.utils.torch_np_utils import check_type, stack
try:
from scipy.ndimage import morphology
from skimage.measure import label
except ImportError:
print('Caught Import Error while importing some function from scipy or skimage. '
'Please use a newer version of ... |
afe72b71edb6c7ae284448a48499573620314080b7d04ab491838c4da144c3c4 | Python | 7,299 | 233 | # --- 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 Cluster(_BaseTraceHierarchyType):
_parent_path_str = "scattermap"
_path_s... |
d68bbfddaa7da98c46d9489296439fab8db8f2bf21b36d499983671f13d81772 | Python | 7,299 | 215 | import io
import os
import av
from torch.utils.data import Dataset as TorchDataset, WeightedRandomSampler
import torch
import numpy as np
import h5py
from datasets.helpers.audiodatasets import PreprocessDataset, get_roll_func
# specify FSD50K location in 'dataset_dir'
# 3 files have to be located there:
# - FSD50K.ev... |
85481973c5fa59d825031e3ad11252d7abf781a1fc21b1031d70b783bc78b81b | Python | 7,300 | 192 | 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/"
FEATURE_D... |
711edb0cc9d02b12744b29af7aaa63ac1ff6ab16097f4e82d00cd6ffad45756c | Python | 7,301 | 147 | #!/usr/bin/env python3
"""Протокол A2, часть 2 (ЧЕРНОВИК 13 октября 2026, прогонов не было): шок-проба.
Основание: ИДЕИ_2026-10-13.md §2.2. В измерительном окне раз в shock_every тиков
у случайной доли агентов отнимается энергия напрямую, минуя еду; такая же группа
неударенных того же тика служит парным контролем. Мет... |
142ec2d978669684623ff336dcc401703644c79b4a5654c99335d3e49d0298bf | Python | 7,302 | 227 | """
**For most use cases, this can just be considered an internal class and
ignored.**
This module contains the abstract class AttackerStep as well as a few subclasses.
AttackerStep is a generic way to implement optimizers specifically for use with
:class:`robustness.attacker.AttackerModel`. In general, except for w... |
93b3c742ed5b2aa81590782d2717a8fd99a699adbb8cf79370332d870e454d8c | Python | 7,303 | 266 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"A few basic operations needed throughout Eelbrain"
from collections import defaultdict
from dataclasses import dataclass, fields
import functools
import logging
import re
from warnings import warn
from .notebooks import tqdm
LOG_LEVELS = {'DEBUG': logging.DEB... |
2a2717257e52db6811979a302549bb18f884d71c4c0697d4e253c8672515102d | Python | 7,307 | 188 | """run_infer.py
Usage:
run_infer.py [options] [--help] <command> [<args>...]
run_infer.py --version
run_infer.py (-h | --help)
Options:
-h --help Show this string.
--version Show version.
--gpu=<id> GPU list. [default: 0]
--nr_types=<n> ... |
30248ff1fb4dfa93548e2b73ec65e8fca21b7a4b1a3f888748398d02ecff1f44 | Python | 7,307 | 180 | """grind-r8 cluster 4.0.6: the R60/R29 scaling-ladder defenses.
Regression coverage for the capture/postprocess/viz resource-exhaustion
fixes: the op-count capture disclosure, the widened ancestor bitset
compaction, the descendant-mask batch ceiling, the cohort pair-probe
ceiling, the param-free fixpoint work budget, ... |
cc908de4c507bd747c89c1f67f19148d23389e17a9f0de1b1e616c3f07933aaf | Python | 7,308 | 242 | """Tests using Scikit-Learn's bundled estimator_checks."""
import unittest
from contextlib import contextmanager
import numpy as np
import pytest
import sklearn
from packaging.version import parse as parse_version
from sklearn.utils.estimator_checks import parametrize_with_checks
from keras.src import backend
from k... |
9c0d0250e1cf010f9aabe2466f0a0cc74f1cbf155731219e948c127e0961ffa7 | Python | 7,309 | 146 | import matplotlib.pyplot as plt
import numpy as np
import torch
from PIL import Image, ImageDraw
from matplotlib.backends.backend_agg import FigureCanvasAgg
def fig_to_numpy(fig: plt.Figure, normalize=True):
fig.tight_layout(pad=0)
# Draw figure on canvas
canvas = FigureCanvasAgg(fig)
canvas.draw()
... |
28cc3625757db4e08fa134a15c4d3bbea37bc6ad35e60d247fd40e54a7d43197 | Python | 7,310 | 220 | from keras.src import backend
from keras.src import initializers
from keras.src import losses
from keras.src import ops
from keras.src.api_export import keras_export
from keras.src.backend.common import get_keras_mask
from keras.src.metrics.metric import Metric
from keras.src.saving import serialization_lib
def reduc... |
349f48b88599a57a7a03bcd8f4a5d984791987667e3568cd8543468c96f20e46 | Python | 7,311 | 231 | #!/usr/bin/env python
# encoding: utf-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import os, sys, re
import logging
import TGraph
import TNode
import Node_alignment
import Topological_sort
from Compact_graph_whole import Compact_graph_whole
from Com... |
a17886a6533f71428bc04e02596c3df11cc2b9f02ef2d061302f7b19e805726b | Python | 7,311 | 206 | # -*- coding: utf-8 -*-
"""upload_docs
Implements a Distutils 'upload_docs' subcommand (upload documentation to
PyPI's pythonhosted.org).
"""
from base64 import standard_b64encode
from distutils import log
from distutils.errors import DistutilsOptionError
import os
import socket
import zipfile
import tempfile
import ... |
33fa36b9b1e16089dab11c991ab88b47c907a313209ec2c72be8e8782da0c92b | Python | 7,312 | 177 | """
Exporting Model Results
=======================
This example covers utilities for extracting and exporting model fit results.
Note that the functionality to export to pandas DataFrames was added in version 1.1,
and requires the optional dependency `pandas` to be installed.
"""
###################################... |
bc668f05d7b5c30e142b69ac070afb642f7a7a1089ae5dd8f8ffe2bb877856e2 | Python | 7,313 | 198 | # Copyright 2022 Deepfold Team
#
# 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 writin... |
0eaffb0d60d9ea696d9d9854a1bf4209882ca3a915f0f999ac71ea87cf82c456 | Python | 7,314 | 185 | from __future__ import annotations
import copy
import logging
import time
from collections import defaultdict
from collections.abc import Iterator
from itertools import chain, repeat
from typing import Optional
from bream4.device_interfaces.devices.base_device import BaseDeviceInterface
from bream4.toolkit.procedure_... |
ab85a1a1b28928882bb02a9b26cbd9aba6b84a91c4f35f8bd58eb69364ed96e7 | Python | 7,314 | 237 | """CPU process-time yardstick for guarded static feature-extraction loops."""
from __future__ import annotations
import argparse
import copy
import os
import tempfile
import time
from collections.abc import Callable, Mapping, Sequence
from dataclasses import dataclass
from pathlib import Path
from typing import Any
... |
5029424e4c7aabedd0e5af4a484264d1b6e2d1036ae703656c4b7ea5469943cc | Python | 7,315 | 227 | from __future__ import annotations
from typing import Dict, Iterable, Callable, TYPE_CHECKING
from itertools import chain
from bdpy.task import BaseTask
from bdpy.task.callback import BaseCallback, unused, _validate_callback
if TYPE_CHECKING:
import torch
from ..modules import BaseEncoder, BaseGenerator, B... |
cb8ad0b1549351aba2f12c8d61c3231cc09742b66f42c38bbb3e090915a9fd22 | Python | 7,315 | 167 | """efel Settings class"""
"""
Copyright (c) 2015, EPFL/Blue Brain Project
This file is part of eFEL <https://github.com/BlueBrain/eFEL>
This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License version 3.0 as published
by the Free Software Fo... |
89ed711661847c7c6344f4ee524257a2d2e7776730e2852333d75d16f93a9f2b | Python | 7,316 | 265 | import mne
import mne_bids
import numpy as np
import pandas as pd
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.model_selection import KFold, cross_val_predict
from sklearn.pipeline import make_pipeline
from sklearn.preprocessing import StandardScaler, scale
from tqdm import trange
f... |
58558026be4c4cb5aa5ef98ba5115ff319b075094493fe4136d0d1c99a6a2376 | Python | 7,318 | 176 | import contextlib
import os
import random
import numpy as np
from sklearn.model_selection import KFold, StratifiedKFold
import torch
from torch.utils.data.dataloader import DataLoader
# from torchsummary import summary
from hn_cnn.cnn import MODELS
from hn_cnn.constants import *
from hn_cnn.data_augmentation import ... |
b5beb481c3489ca3bbf1bdfff8e660882cdebe9ff2f6695cdc3e4433ebc2ff97 | Python | 7,319 | 193 | import argparse
import numpy as np
import torch
import glob
# compute rollout between attention layers
def compute_rollout_attention(all_layer_matrices, start_layer=0):
# adding residual consideration- code adapted from https://github.com/samiraabnar/attention_flow
num_tokens = all_layer_matrices[0].sh... |
1af9871b72b21a53620ae09864ac117cf328550e98451e232bd2a7278054f74c | Python | 7,320 | 199 | from __future__ import print_function, division, absolute_import
import math
from six.moves.urllib.request import urlretrieve
import torch
from PIL import Image
from tqdm import tqdm
def load_imagenet_classes(path_synsets='data/imagenet_synsets.txt',
path_classes='data/imagenet_classes.txt')... |
28da06b56d5e1032ed0206550155e1590c189b908a067c595ac5b838ee09dc85 | Python | 7,321 | 192 | from typing import Tuple
import numpy as np
import scipy.stats as st
import torch
from torch import Tensor
from torchmetrics import IoU, Metric
from torchmetrics.utilities.distributed import reduce
from utils.surface_distance.metrics import compute_robust_hausdorff, compute_surface_distances
def confidence_interval... |
2d394ce8fff3ec29a17511b5f8a8e9e0685269cff9fc1f28b4f365b177d69ad2 | Python | 7,321 | 189 | """Episode join envelope persistence (lane F40c): save/load x arms.
The ``episode_step_join_v1`` envelope rides the C07X-reserved header slot
(no grammar bump); loads validate the envelope FAIL-CLOSED against the rows
(geometry violations quarantine ``episode_ledger_incoherent``), claims keep
refusing after a round tr... |
e65a311eb810ff330459cb30469a1529c2ee928067ca6a140de8f1a356e0200a | Python | 7,323 | 187 | import keras
from keras import backend as K
from keras.callbacks import Callback
from keras.engine.topology import Layer
import tensorflow as tf
# ### Callbacks ###
class BetaWarmup(Callback):
def __init__(self, beta, max_beta, warmup_period):
self.beta = beta
self.max_beta = max_beta
sel... |
8fe8d158908147fcfcceadd4570ccef26dcefb168fb9be29926218ebd97f0570 | Python | 7,324 | 175 | import numpy as np
class Graph():
""" The Graph to model the skeletons extracted by the openpose
Args:
strategy (string): must be one of the follow candidates
- uniform: Uniform Labeling
- distance: Distance Partitioning
- spatial: Spatial Configuration
For more informa... |
7fd520135e56917fc9dc6a4e515bb38b57191e88a3466b309adcd642ac97386c | Python | 7,326 | 224 | """Code for channel selection."""
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
from .classification import MDM
from .geometry.distance import distance
class ElectrodeSelection(TransformerMixin, BaseEstimator):
"""Channel selection based on a Riemannian geometry criterion.
For ... |
4c5c7c47604aaabb4e5847160ed88a320225e2d26f2fffe0d4e156afda9f605b | Python | 7,330 | 246 | import torch
import os
from matplotlib import pyplot as plt
import cv2
import numpy as np
from config import *
import time
from pytorch_grad_cam import GradCAM
cmap = plt.get_cmap("plasma")
test_list = ["GE", "mindray", "test_cropped"]
def crop(frame, roi=None):
"""Crops foreground ultrasound image.
Args:
... |
1130afd26f5cd82b9b1f48c7883bd8c7b644623d998d5f065b4fa289b79af6fc | Python | 7,331 | 193 | """Intervention honesty: ``patch_from`` donor resolution is PASS-QUALIFIED
(edits memo row 4, decision D2 -- the sprint's worst silent wrongness).
The historical hook resolved the donor via the bare layer label, which the
lookup table binds to the LAST pass: on recurrent/weight-reused models a
patch addressed at pass ... |
993cf70fde1ae182a9d68efd6c6e68230aff9ea8b47263c876c582c22847332b | Python | 7,331 | 242 | from decimal import Decimal
import matplotlib.pyplot as plt
from anndata import AnnData
def de_transition_plot(
adata: AnnData,
top_genes: int = 10,
font_size: int = 6,
name: str | None = None,
dpi: int = 150,
output: str | None = None,
) -> AnnData | None:
"""\
Differential expressio... |
9c356796ade54ce98246d97e4f71cd08aea16ceff7dfa12b9f59bde14c2877b7 | Python | 7,331 | 214 | # Take cDNA reads, and produce splicing statistics per barcode
# Read 1: NNNNN[N][N]TTTAAACGGGCCCTATNNNNNNNNNNNNNNNNNNNNTCTAGAGCGAG[CT]
# Number of Ns (UMI) is random 5-7; barcode is 20N
# Read 2:
# Diversity: [NN] (0-2Ns)
# End of exon 1: AAGTTGGTGGTGAGGCCCTGGGCAG
# Exon 2: GTTNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN... |
2673933e34b512f92d64263326dc8887d6087b4c426b4701d03c5aade48d5c06 | Python | 7,332 | 174 | import contextlib
import os
import random
import numpy as np
from sklearn.model_selection import KFold, StratifiedKFold
import torch
from torch.utils.data.dataloader import DataLoader
# from torchsummary import summary
from hn_cnn.cnn import MODELS
from hn_cnn.constants import *
from hn_cnn.data_augmentation import ... |
2ad3aa24b2bded60f02e9df41682eaa220ff5f7de6bc15bf9376540ce9b10c5e | Python | 7,333 | 176 | #!/usr/bin/env python
"""Train and test in a hold-one-out fashion on data sets for which a
manual created state annotation exists.
"""
import numpy as np
import matplotlib.pyplot as plt
from sklearn.metrics import confusion_matrix as get_confusion_matrix
from somnotate._automated_state_annotation import StateAnnota... |
2dec58baaf2e5ac37a9540c47a126071e7d174befebb97d14b1bfda45fbc3c2a | Python | 7,335 | 200 | import numpy as np
from absl.testing import parameterized
from keras.src import backend
from keras.src import testing
from keras.src.backend import KerasTensor
from keras.src.utils import numerical_utils
NUM_CLASSES = 5
class TestNumericalUtils(testing.TestCase):
@parameterized.parameters(
[
... |
3ed7a044a96c911267e855b7359d9f159f06321f75fbe678a6656923d5e0989e | Python | 7,336 | 212 | from __future__ import annotations
import typing as t
from jinja2 import BaseLoader
from jinja2 import Environment as BaseEnvironment
from jinja2 import Template
from jinja2 import TemplateNotFound
from .ctx import AppContext
from .globals import app_ctx
from .helpers import stream_with_context
from .signals import ... |
bb7fd1e69b2391c25ea2c77b3e048c9f4f22a142162a87478592705f0e76f7e4 | Python | 7,336 | 223 | """Compute the RBP features."""
import re
import subprocess as sp
import sys
import uuid
from os import devnull, listdir, mkdir
from os.path import isfile, join
from shutil import rmtree
import fasta_utils
import numpy as np
import pandas as pd
import pfam_utils
__author__ = "Gianluca Corrado"
__copyright__ = "Copyr... |
c3b81c8acdec1054aac6cd91ce8f94d381c578a245ab76d160927f384ad8168f | Python | 7,336 | 186 | from copy import deepcopy
import numpy as np
import tensorflow as tf
import tensorflow.keras as keras
import tensorflow_addons as tfa
from tf_spiking import DenseLIF, DenseLIFNoSpike, IntensityToPoissonSpiking
from tf_spiking.helper import TrainingHistory
import pandas as pd
def operation_mode_scatter_line_f... |
a77db513106d641dfb197abd696d1a6fa3487b8350bf5f2fbc3e2df0ce5b93c5 | Python | 7,338 | 202 | import time
from pathlib import Path
from h5py import File
import torch
from tqdm import tqdm
from torch.utils.data import Dataset, DataLoader
from itertools import cycle
from rbm.binary.functions import init_chains, init_parameters
from rbm.binary.pcd import fit_batch
from rbm.binary.functions import init_chains, ini... |
b0f0059b307f7938ed39f9accd7f2c94d8985b5735d4346e80786a0923abd9af | Python | 7,338 | 210 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from tgcn import ConvTemporalGraphical
from graph_part import Graph
class Model(nn.Module):
r"""Spatial temporal graph convolutional networks.
Args:
in_channels (int): Number of channels in the inpu... |
b25460f2543e4b4bc0c3fb0c1ed293699c52eced4918d6bc19b370481da6ce43 | Python | 7,338 | 194 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from pathlib import Path
from ultralytics.utils import LOGGER, TESTS_RUNNING, checks
try:
assert not TESTS_RUNNING # do not log pytest
import dvclive
assert checks.check_version("dvclive", "2.11.0", verbose=True)
import os
imp... |
2f21bc06e021c58f435b76f6606efbf4c6168c8f7b5d4339b39ba7797d151551 | Python | 7,339 | 198 | """Test all features on an example trace"""
"""
Copyright (c) 2015, Blue Brain Project/EPFL
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above co... |
dea4229a32cfff5b53f992846f42650a642157a3bf43e217b6d9168bfcfc9715 | Python | 7,341 | 242 | import matplotlib.pyplot as plt
from decimal import Decimal
from typing import Optional, Union
from anndata import AnnData
def DE_transition_plot(
adata: AnnData,
top_genes: int = 10,
font_size: int = 6,
name: str = None,
dpi: int = 150,
output: str = None,
) -> Optional[AnnData]:
"""\
... |
89148814d654b4c042bd11d8677122f7edf68dd326540c4ef98d21e61479542c | Python | 7,342 | 237 | """Simple example to read data from read until and send responses to server"""
import argparse
import functools
import logging
from multiprocessing.pool import ThreadPool
from pathlib import Path
import time
import typing
import grpc
import numpy
import read_until
def get_parser() -> argparse.ArgumentParser:
"... |
c737c3570f6e94e6c34d64d34ca25b8dab8862df76840af0e9966b025bcecb04 | Python | 7,342 | 226 | from typing import Any
import numpy as np
import pandas as pd
import copy
from mirp._images.generic_image import GenericImage
from mirp._imagefilters.utilities import FilterSet2D, FilterSet3D
from mirp._images.transformed_image import TransformedImage
from mirp.settings.generic import SettingsClass
from mirp._imagefi... |
206dcfd2b57b9801129be0e443ea49bd602e25ed65b6b3d21882830822087637 | Python | 7,343 | 189 | from __future__ import annotations
from typing import Dict, Iterable, Mapping, Optional, Sequence
import torch
from .config import (
AdversaryConfig,
AutoTransOPConfig,
DomainConfig,
HeadConfig,
)
from .data import DomainBatch
from .modules import (
ClassifierHead,
Decoder,
DomainEffect,
... |
f8a02ca04e62a2f6291bd8cc5ce53d28001165af2bc2492dc891f5f7bbe88d72 | Python | 7,343 | 191 | # Asteroid Impact (c) Media Neuroscience Lab, Rene Weber
# Authored by Nick Winters
#
# Asteroid Impact is licensed under a
# Creative Commons Attribution-ShareAlike 4.0 International License.
#
# You should have received a copy of the license along with this
# work. If not, see <http://creativecommons.org/licenses/b... |
255448a3c492a683a2bddd25428f13db4e871e86d7c8e727f3aaced2cb5f00bb | Python | 7,344 | 137 | """
Keys and certificates for tests (KEY1 is a private key of CERT1, etc.)
Generated with `extra/security/get-cert.sh`
"""
KEYPASSWORD = b"samplepassword"
KEY1 = """-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQC9Twh0V5q/R1Q8N+Y+CNM4lj9AXeZL0gYowoK1ht2ZLCDU9vN5
dhV0x3sqaXLjQNeCGd6b2vTbFGdF2E45//IWz6/BdPFWaPm0rtYbcxZ... |
592544dcea3a66546e2b04525fc76712d3ceea736a828dd2c6a7ec180e1f33f4 | Python | 7,351 | 202 | """Summary performance benchmark (F08; summary memo item 16 / 3.12).
Measures the four phases SEPARATELY -- capture (wrapped forward), the
postprocess pipeline, render, and cleanup -- against a plain uninstrumented
forward (min-of-N), and regenerates the published benchmarks page
(``docs/benchmarks/summary_performance... |
647c9731bd27724e0987c4f9bb473d63bc2ed391a7d8a5864a26b00871795060 | Python | 7,351 | 186 | """
Author: Derek van Tilborg -- TU/e -- 27-05-2022
Functions for Bayesian hyperparameter optimization with cross-validation
- BayesianOptimization: Class that does all the heavy lifting for Bayesian optimization
- optimize()
- plot_progress()
- history_to_csv()
- save_... |
82b730d89ee771e4800f2aa84c2df363ec75cb2c9fdc9f2b776d59904939471f | Python | 7,351 | 215 | """
Code for training deep CNNs.
Takes the model name of the model to train
and runs for the desired number of epochs.
Measures training and validation accuracy and
stores this data to be graphed later.
Implements adaptive learning rate.
"""
import torch
import torchvision
import torch.nn as nn
import torch.opti... |
fc908ddb91cfe75dceb13f7cba0e89f71736235d575190fa51c779c857d3e2d6 | Python | 7,354 | 198 | # 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... |
cd17bf8c9360815df13b7791be5cce0b3ef1a63a3d5eb789af1de12d32628cca | Python | 7,356 | 198 | import pytest
import torch
import torch.nn.functional as F
from lightly.loss.ibot_loss import IBOTPlusPlusPatchLoss
class TestIBOTPlusPlusPatchLoss:
def test_forward_rank3(self) -> None:
torch.manual_seed(0)
criterion = IBOTPlusPlusPatchLoss(output_dim=8)
teacher_out = torch.randn(4, 196,... |
7a553da39063aa597d5861dd04bd3e7577155a7a1f9f1d117365abcad9723028 | Python | 7,359 | 179 | # 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... |
b106cd50789dca697f714e275c9648bba161c1e8e12be3adfa294c7f62573419 | Python | 7,359 | 188 | """
optimizer RADAM
"""
import math
from enum import Enum
import torch
from torch.optim.optimizer import Optimizer
class RAdam(Optimizer):
"""RADam optimizer
"""
def __init__(self,
params,
lr=1e-3,
betas=(0.9, 0.999),
eps=1e-8,
... |
d31c075412cbbd8f6202f631934ec3b5290f079586a72d56ab37ead09cdc53fa | Python | 7,359 | 164 | import pytest
from pytest_celery import RESULT_TIMEOUT, CeleryTestSetup, RedisTestBroker
from celery import Celery
from celery.canvas import chain, group
from t.smoke.tasks import long_running_task, noop
WORKER_PREFETCH_MULTIPLIER = 2
WORKER_CONCURRENCY = 5
MAX_PREFETCH = WORKER_PREFETCH_MULTIPLIER * WORKER_CONCURREN... |
02b73949b89a709735de3e17a68650b1f03e85b95816e5abb07b0a7fa0dd7b91 | Python | 7,361 | 200 | from unittest import mock
from uuid import UUID
import pytest
from api.mocks import FakeAuthContext
from fastapi import HTTPException
from carbonserver.api.infra.repositories.repository_projects_tokens import (
SqlAlchemyRepository,
)
from carbonserver.api.schemas import (
AccessLevel,
OrganizationUser,
... |
97aab9b5f932f914a6d4701b74c507d78289e243cf38869f70c1fd3ea7db7902 | Python | 7,362 | 194 | import pysam
import pytest
from TestUtils import make_data_files, CBCF_DATADIR
def setUpModule():
make_data_files(CBCF_DATADIR)
@pytest.fixture
def vcf_header():
vcf_header = pysam.VariantHeader()
vcf_header.add_samples("sample1", "sample2")
vcf_header.contigs.add("1")
return vcf_header
# segf... |
f29d013e4a6afbfad7a844d5a41027c3a9fac13a9e4c1c40a4d07dbfc11ee063 | Python | 7,362 | 212 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from tgcn import ConvTemporalGraphical
from graph import Graph
class Model(nn.Module):
r"""Spatial temporal graph convolutional networks.
Args:
in_channels (int): Number of channels in the input dat... |
af2a84ba8bc62e251f16e0c56ac58f8db13a803ceb127d9f66b81780f334c134 | Python | 7,363 | 184 | import logging
import lifelines
import pandas as pd
import scipy.stats as st
import numpy as np
import pymc as pm
from pmsurv.exc import PyMCModelsError
from pmsurv.models.base import BayesianModel
import pmsurv.utils
logger = logging.getLogger(__name__)
class ExponentialModel(BayesianModel):
def __init__(self, ... |
14dbd7ef734efbb844f5722e91ffaf3b8e15a772757242c53eb4be870ad00716 | Python | 7,365 | 191 | """Lane F22 neuro namespace mechanics (neuro MEMO D14-D16, test row T13).
Pins:
- ``hasattr`` ANSWERS (never raises) for every table row and for absent
names, with or without the extra installed.
- Dunder/underscore probes raise plain ``AttributeError``, never a
dependency error (IPython canaries must fail fast).... |
c8aa814364e3f2b870a7e33ceaedcd6301a8f8b9347508e95fb25d2712a29768 | Python | 7,365 | 162 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import platform
from pathlib import Path
import numpy as np
import torch
from ultralytics.utils import LOGGER
from .base import BaseBackend
class TensorFlowBackend(BaseBackend):
"""Google TensorFlow inferen... |
e53eef1402e094ccac5a54ba8ca4783358b1c92ef8bf04e817d8b3d88270285e | Python | 7,365 | 198 | # coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
ca40ba8da53c6eb1bd4eb2baa01798ef1a6eca1fa54ecad8091db563e269ee57 | Python | 7,366 | 192 | """F03 item 12: the commissioned workflow gallery, end to end (heavy tier).
The flagship head-ablation experiment on a config-built GPT-2 (the real HF
``from_dict`` parsing path, zero network): arm a file-backed ledger with
hypothesis and metric declared BEFORE the first material step -> baseline
capture (intervention... |
cbc835f9d578c40fd4d31ccc32f812e5ad0912619a4de10f0f34a40a8a4d4d97 | Python | 7,366 | 214 | """B0 vendor contract harness for the Model Explorer export family (F15).
Three of the four data-loss bugs the modelexplorer panel found are invisible
to a dataclass parse and visible only to Model Explorer's REAL graph
processor, so this file pins the contract at three levels: byte-pinned
vendor assets, a strict pars... |
43bb07eb55d46a402abab8c50984eb39d4cf8f19a11ad79cd0291919614a9101 | Python | 7,367 | 268 | # Copyright (c) 2023, Tri Dao.
"""Useful functions for writing test code."""
import torch
import torch.utils.benchmark as benchmark
def benchmark_forward(
fn, *inputs, repeats=10, desc="", verbose=True, amp=False, amp_dtype=torch.float16, **kwinputs
):
"""Use Pytorch Benchmark on the forward pass of an arbit... |
5904ff569c308135e363355627e77d2c7aa868c0088e32de468e7273d06724ce | Python | 7,368 | 212 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from tgcn import ConvTemporalGraphical
from graph_part import Graph
class Model(nn.Module):
r"""Spatial temporal graph convolutional networks.
Args:
in_channels (int): Number of channels in the inpu... |
5920eb9923622927afcdab8e925a8f20bbfe40be838a08eb6843aadffac7d86d | Python | 7,368 | 178 | """site_key portability exit gates G1-G5 (S3 discipline): all persistence
runs UNDER the test-only activation switch -- never an active tlspec-v7
write. These gates re-run as acceptance at the wave-3 coordinated bump.
"""
from __future__ import annotations
import pytest
import torch
import torch.nn as nn
import torc... |
243b73755845c8c210aacdde75b7177579e60dff8eed15699999a7d99142bc8d | Python | 7,369 | 268 | # Copyright (c) 2023, Tri Dao.
""" Useful functions for writing test code. """
import torch
import torch.utils.benchmark as benchmark
def benchmark_forward(
fn, *inputs, repeats=10, desc="", verbose=True, amp=False, amp_dtype=torch.float16, **kwinputs
):
"""Use Pytorch Benchmark on the forward pass of an arb... |
05ad01bcadb5dd5053f3cb7663f12ffa42817d9218f79c28591b052be62c5f97 | Python | 7,373 | 188 | import os
import numpy as np
import pandas as pd
from tqdm import tqdm
from rdkit.Chem.rdMolAlign import GetBestRMS
from typing import List, Tuple
from rdkit.Chem import Mol
from multiprocessing import Pool
from bioconfpred.conf_ensemble import ConfEnsembleLibrary
from bioconfpred.data.utils import MolConverter
from b... |
bbb832d1ade70b700984fe6ada43fa5994bde1d8c01e7f9b4e0671ad978b7027 | Python | 7,375 | 214 | """
Gene Expression Cartography
M Nitzan*, N Karaiskos*, N Friedman†, N Rajewsky†
Nature (2019)
code adapted from: https://github.com/rajewsky-lab/novosparc
"""
from typing import List, Optional, Tuple, Union
import anndata
import numpy as np
import pandas as pd
from scipy.cluster import hierarchy
from scipy.stats i... |
cbc28f30afc596460e12c213762be58fc00fc4a45b9e37be670c4509ab565b9c | Python | 7,375 | 183 | import torch
import numpy as np
import math
from operator import itemgetter
from BatmanNet.data.molgraph import ELEM_LIST
def split_data(data, sizes=(0.8, 0.1, 0.1)):
"""
Split data with given train/validation/test ratio.
:param data:
:param split_type:
:param sizes:
:param seed:
:param l... |
b59706d19a1323cf23b3fdd62b94988eb19597fc8b709ee309d478c61da104ed | Python | 7,377 | 166 | """
Generates a poster-quality simulation evidence figure.
Output: outputs/figures/simulation_grid.png
"""
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import os
os.makedirs("outputs/figures", exist_ok=True)
np.random.seed(42)
# --- Simulate realistic trial data ---
N_TRI... |
3f5fcfc1748929da86ef4f968f67f15d8853db345d88d663cc563a332c285ff3 | Python | 7,379 | 224 | import argparse
import json
import warnings
import numpy as np
import pandas as pd
from galaxy_ml.model_persist import load_model_from_h5
from galaxy_ml.utils import clean_params, get_module, read_columns, try_get_attr
from scipy.io import mmread
N_JOBS = int(__import__("os").environ.get("GALAXY_SLOTS", 1))
def mai... |
f68bd65b012458ac6f80c3280bfba0800323108f24041e304d57f501a34ccde2 | Python | 7,380 | 179 | # 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... |
0f18f68c1243ba1795dd78bf747e4d605e147f49eb288c6ec575d9b0440d88d2 | Python | 7,381 | 201 | import os
import tempfile
import unittest
from unittest.mock import MagicMock, patch
from typer.testing import CliRunner
from codecarbon import __app_name__, __version__
from codecarbon.cli.main import codecarbon
# MOCK API CLIENT
@patch("codecarbon.core.api_client.ApiClient")
class TestApp(unittest.TestCase):
... |
c8714a2323f2fa7a23ad34e3aa80ac78ec18761a55c7729ace99568af2448125 | Python | 7,381 | 187 | """Darknet as YOLO backbone network."""
# pylint: disable=arguments-differ
from __future__ import absolute_import
import os
import mxnet as mx
from mxnet import gluon
from mxnet.gluon import nn
from mxnet.gluon.nn import BatchNorm
__all__ = ['DarknetV3', 'get_darknet', 'darknet53']
def _conv2d(channel, kernel, paddi... |
c92379dccb1605305afd38f3fbaab1b62822a6fb3c06c3964959076380497021 | Python | 7,381 | 214 | #!/usr/bin/env python
import argparse
import logging
import math
import os
import re
import shutil
import subprocess
import sys
import tempfile
import zipfile
from glob import glob
def stop_err(logger, msg):
logger.critical(msg)
sys.exit(1)
def log_subprocess_output(logger, pipe):
for line in iter(pipe... |
7b9d7ddcbe2208a310b238d55ac3554885dea89eb49a7d7f02e139f501dab7cf | Python | 7,382 | 207 | #!/usr/bin/env python
"""
Extract sequences from a GFF3 file.
This works for examlpe with the GlimmerHMM GFF3 output format:
#gff-version 3
#sequence-region Glarea 1 38755942
Glarea GlimmerHMM mRNA 1017 1644 . - . ID=Glarea.path1.gene1;Name=Glarea.path1.gene1
Glarea GlimmerHMM CDS 1017 1126 . - 2 ID=Glarea.cds1.1;Pa... |
17c5f8547059a2bf36d37daf455a48fd9511b5fd07afb18691a6ae08996ddef8 | Python | 7,383 | 197 | from typing import Optional
import pytest
import torch
from pytest_mock import MockerFixture
from torch.nn import Parameter
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 ... |
0691c718ad739e43cbc3a8f3fcd2391150853f42ea2d56716209cc513e23d044 | Python | 7,385 | 149 | import os
import re
import numpy as np
import matplotlib.pyplot as plt
import sys
sys.path.insert(1,'/home/mila/l/lindongy/deeprl-timecells')
from analysis import utils_linclab_plot
utils_linclab_plot.linclab_plt_defaults(font="Arial", fontdir="analysis/fonts")
import argparse
# Load lesion results
# argparse and pri... |
27011439ed23d71310718da31f4d91e95c0a071df7d8c26e06d531f9244f6e5a | Python | 7,385 | 212 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from tgcn import ConvTemporalGraphical
from graph_part_remove_joint_leg import Graph
class Model(nn.Module):
r"""Spatial temporal graph convolutional networks.
Args:
in_channels (int): Number of cha... |
7ad4ea97200e68094e57a803f9477b39f1270659ac63c3bfeda7bc8f26622681 | Python | 7,385 | 225 | """Embedded workers for integration tests."""
import logging
import os
import threading
from contextlib import contextmanager
from typing import Any, Iterable, Optional, Union
import celery.worker.consumer # noqa
from celery import Celery, worker
from celery.result import _set_task_join_will_block, allow_join_result
... |
89c5b5c8e3a9ffc633c5eb3bd6d4f118b925a7c9cf7edc4284f7ceac36b560d4 | Python | 7,385 | 212 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from tgcn import ConvTemporalGraphical
from graph_part_remove_joint_arm import Graph
class Model(nn.Module):
r"""Spatial temporal graph convolutional networks.
Args:
in_channels (int): Number of cha... |
44dd3c498ce652ca9727c398a219a6b77bdc45e7292bcd97e9d8ee97ce3925af | Python | 7,386 | 212 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from tgcn import ConvTemporalGraphical
from graph_part_remove_joint_hand import Graph
class Model(nn.Module):
r"""Spatial temporal graph convolutional networks.
Args:
in_channels (int): Number of ch... |
60545d09bcd69089a8ca46e164287cf33b5486f26a065cbd4d381f0bb0dd2c91 | Python | 7,386 | 178 | """Lazy completion unit acceptance (F17 B12): SOL's four clauses + the flip signal.
Quickstart memo 4.4: the completion unit ships as ONE unit, and the flip
signal is mechanical -- ``check_metadata_invariants(trace)`` passes on the
real lazy-head fixture (the shipped ``trainable + frozen == total`` invariant
that used... |
c503e896d9071f0e263e9e4aeba33ab52c2c9d069b87d225e44c6f6358d4897f | Python | 7,386 | 212 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from tgcn import ConvTemporalGraphical
from graph_part_remove_joint_head import Graph
class Model(nn.Module):
r"""Spatial temporal graph convolutional networks.
Args:
in_channels (int): Number of ch... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.