sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8e9972f09a5818a0430dba08b9c745b7aee20776758af796cd0d5a059f1f56fe | Python | 12,826 | 244 | import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader
import os
import sys
import argparse
import math
import time
from model import BIML, describe_model
from eval import evaluate_ll
import datasets as dat
from train_lib import seed_all, timeSince
DEVICE = torch.device('... |
036a31277f447f084fbc8b207694686432356c4d9341daf703ba93d3973a721f | Python | 12,828 | 338 | import torch
import numpy as np
from ovseg.data.utils import crop_and_pad_image
from ovseg.utils.torch_np_utils import maybe_add_channel_dim
from ovseg.utils.io import read_nii
import os
import nibabel as nib
from time import sleep
try:
from tqdm import tqdm
except ModuleNotFoundError:
print('No tqdm found, usi... |
7e953a2f33ad51cc7662a833872b103ee60267fffcb2148fd02ad5863e0129cb | Python | 12,829 | 366 | #!/usr/bin/env python
import csv
import logging
import math
import os
import subprocess
import urllib
from pathlib import Path
import pandas as pd
from sox import Transformer
import swifter
from deepspeech_training.util.importers import get_importers_parser, get_validate_label
__version__ = "0.1.0"
_logger = loggin... |
2de7f29cbc181510cccc5e7f6e67885310a3df5462cdf1a37aac6bbc54901709 | Python | 12,830 | 319 | import json
from collections import defaultdict
from pathlib import Path
from dataclasses import dataclass, field
import basis_set_exchange as bse
import matplotlib.pyplot as plt
import numpy as np
import numpy.typing as npt
import torch
from ase import units as ase_units
from ase.data import atomic_numbers
from e3nn ... |
f73b3d5fc2941253908279567c7d2c7c6f0553492dcc8563ea80b98e61b01244 | Python | 12,832 | 328 | """F06 B6: guided backprop + deconvolution (attrib memo D11-D13).
Strict exact-ReLU coverage at OP level (module, functional, in-place, method,
reused firings), rule semantics against hand-rolled expectations, the
functional-in-place toy regression (the D13 unit row), zero-match teaching
refusal, forward-fidelity trip... |
310d126017249770c880b9b27a27547a6fe53de12229bad1524e19666fd91b0b | Python | 12,834 | 302 | # SOURCE: vendored from https://github.com/ndming/NSRT @ main
#
# NSRT community implementation of "Neural Supersampling for Real-time
# Rendering" (Xiao et al., SIGGRAPH 2020) -- no official author release
# exists; ndming/NSRT is a from-the-paper PyTorch reimplementation with an
# active repo (train.py/model/*.py). V... |
2ec680467eb829e6e7fad122a5989cc55f18e64a44a5487c7e78ab4b535a5b3a | Python | 12,835 | 335 | import warnings
from keras.src import constraints
from keras.src import initializers
from keras.src import ops
from keras.src import regularizers
from keras.src.api_export import keras_export
from keras.src.backend import KerasTensor
from keras.src.layers.layer import Layer
from keras.src.quantizers.geometry import Lo... |
06aa2367730fe1bcea8d5184e59c27a3648d123ed38e68dbb9bb4f6c6174c188 | Python | 12,846 | 411 | from __future__ import annotations
import importlib.metadata
import os
import sys
import types
import warnings
from collections.abc import Callable
from collections.abc import Iterator
from pathlib import Path
from typing import cast
import pytest
from loguru import logger
from PySide6 import QtCore
from labelme.__m... |
6b3ae26d71b1e7b20d4cebe821f2d673f414144df1e44f9affdde3c22b059ce9 | Python | 12,847 | 388 | """tinygrad object-module backend tests."""
from __future__ import annotations
from pathlib import Path
from typing import Any
import numpy as np
import pytest
import torchlens as tl
from torchlens.backends import BackendUnsupportedError
from torchlens.intervention.errors import MultiMatchWarning
from torchlens.val... |
4d7b6b2275194ec250c05f275f5e7a1442bfa2c998b211311e90a75fbddb85d9 | Python | 12,851 | 301 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import matplotlib.pyplot as plt
import os
from skimage.transform import resize
from src.utils.visualize_copy import display_instances
import imageio.v3 as iio
########### Convert keypoints to heat maps
def gaussian_kernel(size, sigma... |
bcd2f2ba9634dbf200412c1ffa8dd62e787cc2dca8d628ab0c4d6dba22437529 | Python | 12,855 | 405 | #!/usr/bin/env python3
"""
Comprehensive test runner for the Ethoscope project.
This script provides a unified interface for running tests across both
device and node packages with various options and configurations.
"""
import argparse
import subprocess
import sys
import time
from pathlib import Path
from typing imp... |
02da57d06bb3a77851d643f8424555920abfa9412655f8fbb093e0f7214446be | Python | 12,857 | 333 | """r35 stage-3 regressions: exact-semantics relaxations under the fail-closed
invariants -- corr2_2 (byte-exact alias coherence), corr2_3 (initializer
totality), corr2_4 (seeded-RNG isolation), hon1_4 (repr-independent structseq
fields), plus the mechanical float-``torch.equal`` grep lock.
"""
from __future__ import a... |
9c0ebe952158ee14bf2dc35f06d920d77a6f6fdfd7131fa28596ec57f6ac289f | Python | 12,861 | 327 | """Vizfix wave-1 regression tests (lane C05).
Covers the treescope P0b `_nonfinite.py` inference-mode fix (a capture run
under ``torch.inference_mode()`` must never crash the repr/report surfaces,
with the coverage gap disclosed), plus the vizmech wave-1 render-seam
fixes: honest ``torch.cat`` argument labels (D14), t... |
b5bd9c6fb5006910c79e795a67ed94ff2781742fc91da3fb59a5343ae9dd2151 | Python | 12,865 | 365 | #!/usr/bin/env python3
import pandas as pd
samplename = input('Enter your sample name : ')
filename3 = "./talon_result_95/" + samplename + ".talon.classification_isoform.combined_count.tsv"
o_1 = open(filename3, "w", encoding = "utf-8")
#-----------------------------------------------------------------------------fun... |
e350ada6fd44ad094a14da84fbe3e179907bd029487b4b5f4fa4850822f93e62 | Python | 12,866 | 351 | import numpy as np
from numpy.testing import assert_array_equal
import pytest
from pyriemann.geometry.ajd import jade
from pyriemann.spatialfilters import Xdawn, CSP, SPoC, BilinearFilter, AJDC
pytestmark = pytest.mark.numpy_only
spfilts = [Xdawn, CSP, SPoC, BilinearFilter, AJDC]
@pytest.mark.parametrize("spfilt... |
0aab7c9f6bb37383d5cd0abe35d383de7b81ab25b0d1294e8112f37452a4b6ee | Python | 12,868 | 382 | """This module handles the conversion of data structures
between R objects handled by rpy2 and pandas objects."""
import rpy2.robjects.conversion as conversion
import rpy2.rinterface as rinterface
from rpy2.rinterface_lib import na_values
from rpy2.rinterface import IntSexpVector
from rpy2.rinterface import ListSexpVe... |
4f5a51f0fc48ea75d92b3c685be17187b29e8aaa590737acc15a8c083f4bf57b | Python | 12,868 | 364 | # 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... |
2a362beb4474d68a8d5f1212f32f8190739185173babe36d5a050a1d6365ccdc | Python | 12,875 | 362 | """Tangent space functions."""
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
from .geometry.mean import gmean
from .geometry.tangentspace import tangent_space, untangent_space
from .utils._check import check_metri... |
cb9ea79ae3ada5237133bb0365c512817288b0811ac9fbafad4f1b015a20fe7c | Python | 12,878 | 330 | # Copyright (c) 2023, Tri Dao.
from typing import Tuple, Optional, Union
import torch
import torch.nn.functional as F
import triton
import triton.language as tl
# `all_gather_into_tensor` and `reduce_scatter_tensor` are new placeholders for
# `_all_gather_base` and `_reduce_scatter_base`. They require the most rece... |
515cc1343eae0df0eb5c6a18b65be4dfeb874f1f87367e72c7eebc59a263adae | Python | 12,879 | 257 | #结论:当模型进行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... |
f7113a862d9faadc9022087b032d772a0d8f177b8e7f74114b7861b014385f8a | Python | 12,885 | 319 | # Contains parameters that are used in Display Applications
import mimetypes
from collections.abc import Callable
from dataclasses import dataclass
from typing import (
TYPE_CHECKING,
)
from urllib.parse import quote_plus
from galaxy.datatypes.data import Data
from galaxy.model import DatasetInstance
from galaxy.s... |
2e7534d1cae7ec6c9bd96c4a6459a1ad7b778f418ca2116c1bcfc333b9c0a69e | Python | 12,886 | 358 | # -*- coding: utf-8 -*-
"""
Unit tests for Hopper and PeckPort components.
These tests use a FakeInterface to avoid any hardware dependency so they
can be run on a development machine without a Raspberry Pi.
"""
import datetime
import sys
import os
import unittest
from unittest.mock import patch, Mock, MagicMock
sys... |
3db5a2d6aa1d99e7d5653bd11ff717c1ac5faa1df4df1a9bdfed6f59d4223cc0 | Python | 12,886 | 298 | import threading
from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional
from codecarbon.core.units import Energy, Power, Time
from codecarbon.external.logger import logger
@dataclass
class GPUDevice:
"""
Represents a GPU device with associated energy and power metrics.
Att... |
6ad6f47f4520da7b4d37b4c286e4d50c98d87fded97f122195c02633045aebba | Python | 12,886 | 354 | import pytest
import tensorflow as tf
from math import ceil
from psychrnn.backend.rnn import RNN
from psychrnn.backend.initializations import GaussianSpectralRadius
from psychrnn.tasks.perceptual_discrimination import PerceptualDiscrimination
from pytest_mock import mocker
import sys
if sys.version_info[0] == 2:
... |
842783a4e2915f7c3c8d49e0e269b392c0e30f23cbc77421ec36a738e7e322fe | Python | 12,888 | 511 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
"""Statistics functions that work on numpy arrays."""
from dataclasses import dataclass
import re
from typing import Union #, Literal
import numpy as np
import scipy.stats
from scipy.linalg import inv
from .._data_obj import Model, Parametrization, asfactor, a... |
db62d549e163d77af689e5c6ae72dfb641c92523efb2d130a5599cde3cd1efc4 | Python | 12,889 | 309 | """Helper utils for export HybridBlock to symbols."""
from __future__ import absolute_import
import copy
import mxnet as mx
from mxnet.base import MXNetError
from mxnet.gluon import HybridBlock
from mxnet.gluon import nn
class _DefaultPreprocess(HybridBlock):
"""Default preprocess block used by GluonCV.
The ... |
0357ebd8946b1a8e4e440db2eae5e30574687c9c555b62df2bcfa84a1bd1ceeb | Python | 12,890 | 290 | """Functions for building the input features (reference ccd features) for the HelixFold model."""
import collections
import os
import time
from typing import Any, KeysView, Mapping, MutableMapping, Optional, Sequence, Union, List
from absl import logging
from helixfold.common import residue_constants
from helixfold.d... |
e38c891919f49bf84ccc4c49b5583d9550069d980ab3d74784f0b1cf5eb3aa83 | Python | 12,892 | 325 | """Lane F22 neuro.rdms two-mode contract (neuro MEMO 4.2/D8/D9, rows T5/T15).
Pins:
- SOURCE MODE computes through the canonical repgeom arithmetic, defaults
to ``metric="correlation"``, records ``measure_source="computed"`` and
the ``measure_convention`` formula (D9), and hands rsatoolbox a stack
whose condens... |
1b4cd0b2d1e1bffae6457022ae45643869f2f29fc31b776dd4997580f975a6e9 | Python | 12,894 | 357 | """Sparse captures must stay printable, and their reports must stay honest.
``save=<predicate>`` is the mode the performance guide recommends for large models,
and it was the one mode in which ``print(trace)`` raised: the non-finite scan behind
the summary read ``.out`` on ops that retained no payload, and ``Op.__geta... |
a87143da332e06818b24fd20326066e1af1f10d3bf92b6412e442826395753ef | Python | 12,894 | 258 | import json
import numpy as np
import os, sys
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import torch.nn.functional as F
from torch.utils.dat... |
cc0b64ae1a0148e08a258e1adff014935edaf8042dc13c47b5234fda5c39549f | Python | 12,897 | 304 | import importlib
import logging
from collections.abc import Callable
from inspect import getfullargspec
from types import ModuleType
from typing import (
TYPE_CHECKING,
)
import galaxy.jobs.rules
from galaxy.jobs import stock_rules
from galaxy.jobs.dynamic_tool_destination import map_tool_to_destination
from galax... |
f3509382caa3063365fc73a0089d65439befd4d20cdd1069728546a6a4f83753 | Python | 12,897 | 321 | import os
import sys
import itertools
import imp
from distutils.command.build_ext import build_ext as _du_build_ext
from distutils.file_util import copy_file
from distutils.ccompiler import new_compiler
from distutils.sysconfig import customize_compiler, get_config_var
from distutils.errors import DistutilsError
from d... |
d88f5be8eee4daf8b49f0cdbe298d6c14cc7a24cfe7931a99549cc8c08f582f2 | Python | 12,898 | 342 | """Async streaming disk-write tests: ordering, backpressure, failure, finalization.
Failure and finalization are proven by FAULT INJECTION (writes actually break
mid-capture), never by code inspection: a dropped write nobody notices is the
exact silent-loss class this feature must not introduce.
"""
from __future__ i... |
7da319288cbd5fbf4c1972ee854311c294ebf6e81eef5358390e08c667f8c982 | Python | 12,901 | 388 | # pyton version >= 3.10
import os
import sys
import math
import pickle
import random
from typing import Tuple, Union, Dict, List
import numpy as np
import itertools
from dataclasses import dataclass, field
import matplotlib
from matplotlib.figure import Figure
import matplotlib.pyplot as plt
from matplotlib.colors impo... |
a269e0fdd564382d0fb454121e237f9f91132d979cbeab10b42a234bca2f8afb | Python | 12,901 | 317 | # Author: Proloy Das <pdas6@mgh.harvard.edu>
# License: MIT
"""
Usage: run the script without any arguments (downloaded at default location)::
$ python download_alice.py
Or with a valid pathname argument (downloaded at pathname)::
$ python download_alice.py /home/xyz/alice_data
Disclaimer: The following fun... |
192d0ff0b08bfe28bb15b94bd0ea371c5fdfeb186e166dd1de7a915bd6d83847 | Python | 12,905 | 358 | # This script demonstrates how to read power consumption using Intel RAPL (Running Average Power Limit) on Linux.
# It also list available power domains available on the system, like package (entire CPU), cores, uncore (RAM, cache), and platform
# The script can be used to monitor power consumption over time for a spec... |
c865d802840eeb166b6f284b6a3f28c927918aaa0a3b5bed6749ab10ba3819f0 | Python | 12,905 | 264 | #结论:当模型进行ensemble的时候性能会明显提升。
import json
import numpy as np
import os, sys
import random
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import to... |
88dd6abd21280037a6c6697f2bef5a6ab3424492f3a1e6d8144b3bb96a21538f | Python | 12,909 | 340 | import json
from transformers import (
T5Tokenizer,
T5ForConditionalGeneration,
StoppingCriteriaList,
MaxLengthCriteria,
)
import transformers
from transformers import AutoConfig, AutoModel, AutoTokenizer, AutoModelForCausalLM
import re
from transformers import LlamaForCausalLM, LlamaTokenizer
from typi... |
9d8434527420c391adf17d49161fed3ad84297a1b2accb15032e7fb3a3965ef4 | Python | 12,909 | 377 | import numpy as np
import pandas as pd
from scipy.spatial.distance import euclidean, canberra
from sklearn.preprocessing import MinMaxScaler
from numba import njit, prange
from numba.typed import List
from .base import get_lrs_scores
def nonzero_quantile(expr, q, interpolation):
"""Calculating the non-zero quan... |
64faf4c27a5fb8432c2bc36b911502fe8cef2dd58a05d5ce04e1445eff8f3492 | Python | 12,910 | 374 | import numpy as np
import torch
from torch import nn
from pl_bolts.models.vision.pixel_cnn import PixelCNN
def nt_xent_loss(out_1, out_2, temperature):
"""Loss used in SimCLR."""
out = torch.cat([out_1, out_2], dim=0)
n_samples = len(out)
# Full similarity matrix
cov = torch.mm(out, out.t().cont... |
814e48d0c8bfccdc5d179e4feeae69591b7abd114ff12b4b856a2807be494477 | Python | 12,913 | 345 | from typing import List, Optional, Tuple, Union
import numpy as np
import ot
import torch
from anndata import AnnData
from sklearn.decomposition import NMF
from spateo.logging import logger_manager as lm
from .deprecated_utils import (
align_preprocess,
calc_exp_dissimilarity,
check_exp,
check_spatia... |
bd696dfbaebf27b9c8747389c184e3e7c1124b938cf0815ce04d7b3da03beffb | Python | 12,914 | 355 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created in April 2019
@author: Nathan de Lara <nathan.delara@polytechnique.org>
"""
import warnings
from typing import Union, Optional
import numpy as np
from scipy import sparse
def has_nonnegative_entries(input_matrix: Union[sparse.csr_matrix, np.ndarray]) -> bool... |
f54a6a848f4bdeda6843f92db2240c88fceae9f50d5a6120508d0900bcc45094 | Python | 12,914 | 484 | """
Parameter-computing functions.
Contains functions that compute/derive higher-order parameters from the existing ones in the dataset.
"""
from __future__ import annotations
from typing import Any, Callable
import copy
import numpy as np
from .. import util, funcs
from ..util import nam
__all__: list[str] = [
... |
4a8fd3d00784f9da3ee627b72d9f71403a0128e1d5279ddf8cc8a18206ad608e | Python | 12,919 | 363 | from __future__ import annotations
from copy import deepcopy
from larvaworld.lib import reg, util
from larvaworld.lib.sim.validation import (
validate_experiment_environment_compatibility,
)
def _base_parameters() -> dict:
return {
"env_params": {
"arena": {"geometry": "rectangular", "di... |
dd4ce912fa5b81b0fbef044029a2630fa5b6dd311a3f0eae478e7882c81b0895 | Python | 12,920 | 406 | # Copyright 2019 Novartis Institutes for BioMedical Research Inc. Licensed
# under the Apache License, Version 2.0 (the "License"); you may not use
# this file except in compliance with the License. You may obtain a copy
# of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless
# required by applicable law... |
9a47aa7172732e245b489b328722b7fca5fb2d409297c9253b7e8087fbb97021 | Python | 12,923 | 345 | from __future__ import annotations
import argparse
from pathlib import Path
import numpy as np
import pandas as pd
from sklearn.impute import KNNImputer
from sklearn.model_selection import train_test_split
from autotransop import (
AdversaryConfig,
AutoTransOP,
AutoTransOPConfig,
AutoTransOPTrainer,
... |
bdcbcf9bf4128865baca70ebac07220299fe5fa5608ada6d68ff2111420c5a06 | Python | 12,925 | 303 | """
Prepare the workflow paths to be used by downstream
machine learning algorithm. The paths are divided
into the test and training sets
"""
import collections
import random
import numpy as np
import predict_tool_usage
from sklearn.model_selection import train_test_split
class PrepareData:
def __init__(self, ... |
42de2127e296580ad8e8c72df9f1782e261fbdde352929cbbf46fb1cbc3e4746 | Python | 12,926 | 340 | # --------------------------------------------------------
# Based on BEiT, timm, DINO and DeiT code bases
# https://github.com/microsoft/unilm/tree/master/beit
# https://github.com/rwightman/pytorch-image-models/tree/master/timm
# https://github.com/facebookresearch/deit
# https://github.com/facebookresearch/dino
# --... |
b6c5813220b0051f9bafd293e4f7557003ad20a65d7a6b69d3ff185ce39991de | Python | 12,926 | 321 | from __future__ import annotations
import copy
import logging
from typing import Any, Optional
import numpy as np
import pandas as pd
from numpy.linalg import LinAlgError
from bream4.device_interfaces.devices.base_device import BaseDeviceInterface
from bream4.toolkit.procedure_components.data_extraction.collect_cont... |
6f886d70985bf104036c54e861e1450f43b115e9dd8aa18af29b3c956d9b4f15 | Python | 12,927 | 313 | """
Custom Parameter Conversions
============================
This example covers defining and using custom parameter post-fitting conversions.
"""
from specparam import SpectralModel
# Import utility to load example data
from specparam.demo import load_example_data
# Import the default set of parameter conversions... |
5b8bfbd384d5c286d656eb721e6bfebfba12c799ef6826f191ef964f087184f4 | Python | 12,929 | 387 | """Plot templates for the module.
Notes
-----
These are template plot structures for plots and/or reports.
They are not expected to be used directly by the user.
"""
from itertools import repeat, cycle
import numpy as np
from specparam.modutils.dependencies import safe_import, check_dependency
from specparam.utils.... |
9a797a5646b245bf0407ab0f0b952f85ea1b35e4cb9c28f68122b49da34447e7 | Python | 12,931 | 294 | from __future__ import annotations
import copy
import logging
from typing import Any, Optional
import bream4.toolkit.procedure_components.command.keystore as keystore
import numpy as np
import pandas as pd
from bream4.device_interfaces import device_wrapper
from bream4.device_interfaces.devices.base_device import Bas... |
5c987dfb5b1a81b5956cc47467503cff8e7f7c956a71b677f23763a627d77ea2 | Python | 12,935 | 344 | import argparse
import copy
import json
import pandas as pd
import numpy as np
import sys
from pathlib import Path
from sksurv.metrics import integrated_brier_score,\
concordance_index_censored
from sksurv.util import Surv
from survival_plus_x.models.cox_lightning import compute_stratification_logrank_pvalue
d... |
43d1420ac9215dae44e2b2200824a9e51567e8bb1d12e5e34dbe3398b28c0780 | Python | 12,937 | 355 | # --------------------------------------------------------
# Based on BEiT, timm, DINO and DeiT code bases
# https://github.com/microsoft/unilm/tree/master/beit
# https://github.com/rwightman/pytorch-image-models/tree/master/timm
# https://github.com/facebookresearch/deit
# https://github.com/facebookresearch/dino
# --... |
12183033ff1afcbbb8aac8934c80af99388f734fd0f60a01e00744061f80f7f8 | Python | 12,940 | 307 | import sys
import os
import argparse
sys.path.append("../src")
from collections import defaultdict
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from seqtools import SequenceTools
import seaborn as sns
from matplotlib import rcParams, gridspec
from matplotlib.lines import Line2D
from mpl_toolki... |
d92182a13e7dfc7bae0d2ee86d352515a001bc4a01f35765252e7754142859fd | Python | 12,941 | 355 | import csv
import datetime
import json
import os
import time
import urllib.parse
import urllib.request
from collections.abc import Callable
from threading import RLock
from typing import TYPE_CHECKING, Any, Optional
from ethoscope_node.scanner.base_scanner import BaseDevice, DeviceScanner, ScanException
if TYPE_CHECK... |
a0990b814083adb49a74986daee0c467d131ad8fb955bf29466ebf092780ed62 | Python | 12,942 | 310 | import torch
from copy import deepcopy
from bioseq2seq.utils.misc import tile
class DecodeStrategy(object):
"""Base class for generation strategies.
Args:
pad (int): Magic integer in output vocab.
bos (int): Magic integer in output vocab.
eos (int): Magic integer in output vocab.
... |
be196ae69c2a7d8849cb6a753d0333ffef5607d7bb63b9af2f63a2f0ca2f8e7c | Python | 12,942 | 352 | """The nine generator-input censuses (oracles D9, build item 3).
Every census is a MACHINE-DERIVED denominator: a walk of the live tree (or a
schema table validated against the live tree) whose output is diffed against
a committed baseline by the gates. Nine roots feed the registry generator;
each root is itself gated... |
baf317df8a9f48fda26c6837d97459e67e6ccdeb62668486ea292504b8a4a14a | Python | 12,946 | 314 | """The layer lint: eager-upward imports never increase (C01 items 1 + 12).
Module-granular AST audit under the memo's tiering (torchlens/_architecture.py
is the declared layer map; a module-level ``__tl_layer__`` overrides its
package row). Eager upward imports are the inversion class; deferred
(function-body) and typ... |
6874d76198cb1cda19c1f69fc9d721321e8263ce04f0ff95d8611d6e65e0680a | Python | 12,949 | 460 | from __future__ import annotations
import pytest
import env # noqa: F401
m = pytest.importorskip("pybind11_tests.virtual_functions")
from pybind11_tests import ConstructorStats # noqa: E402
def test_override(capture, msg):
class ExtendedExampleVirt(m.ExampleVirt):
def __init__(self, state):
... |
c0f3af3e761d0bff833126f87136b2f002ad70a169377ac7efdda28dc250f72e | Python | 12,953 | 338 | """End-to-end integration gates for receptive-field analysis."""
from __future__ import annotations
import subprocess
import sys
from collections.abc import Iterator
from fractions import Fraction
from typing import Any
import pytest
import torch
from support.rf_isolation import preserved_rf_registry
from torch impo... |
45c163872ab4d2d9a790fa99ed2f2a65547ae78b7b6fbe35fe10eb3fdfc82496 | Python | 12,966 | 376 | from typing import Literal, cast, overload
import numpy as np
from numpy.typing import NDArray
from ._numba import (
gufunc_ohe,
gufunc_ohe_char_idx,
gufunc_pad_both,
gufunc_pad_left,
gufunc_tokenize,
lut_gather,
)
from ._utils import SeqType, StrSeqType, array_slice, cast_seqs, check_axes
fro... |
fd5ec066179e714e12a4d11990e7d67dc35f5288e774ac582800708586d05ef2 | Python | 12,966 | 367 | import sys
from threading import Event, Thread
from time import monotonic
from unittest.mock import Mock, patch
import pytest
from celery.concurrency.base import BasePool
from celery.utils.objects import Bunch
from celery.worker import autoscale, state
class MockPool(BasePool):
shrink_raises_exception = False
... |
ff2a67bd349d9db1fee75185f54a7289480545c0e1d486b84c0a639a8cf2f4d5 | Python | 12,980 | 336 | import os
from pathlib import Path
import xarray as xr
import pandas as pd
import seqdata as sd
from ._utils import get_download_path, try_download_urls
HERE = Path(__file__).parent
pkg_resources = None
def get_dataset_info():
"""
Return a pandas DataFrame with info about EUGENe's built in datasets.
Re... |
2bc904a87bcc4408449edd9406cdd30bda5f339a6c62bf89038dcd49a0134236 | Python | 12,981 | 356 | from __future__ import annotations
import hashlib
import threading
import weakref
from pathlib import Path
import osam
import pytest
from PySide6 import QtCore
from PySide6 import QtGui
from PySide6 import QtWidgets
from pytestqt.qtbot import QtBot
from labelme import _automation
from labelme._automation import _osa... |
2f57d66bdebb7aebbcc6b25c369549cbf4e09e7088813a6c4dd4a0ef9b7f230e | Python | 12,981 | 294 | # SPDX-License-Identifier: LGPL-2.1-or-later
#!/usr/bin/env python
from __future__ import print_function, division, absolute_import
import unittest
from pyEcoHAB import tube_dominance as tubed
from pyEcoHAB.utils import general as uf
from pyEcoHAB import SetupConfig, Loader, Timeline
from pyEcoHAB import data_path, sam... |
df6ec05e4a80f6639adf656154ffb51f1a7f52783d27a472a5759054092e7212 | Python | 12,985 | 305 | #!/usr/bin/env python3
"""
Dx AC — stress test sweep on the Dx AA canonical tool.
(A) HC-vs-HC scrambling. Take only HC subjects across cohorts;
randomly assign half as "AD" and half as "HC"; run full Dx AA
pipeline. AUC should center on 0.50 if the pipeline is honest.
(B) Train-on-one-cohort, test-on-each-ot... |
380d4a73490a40422ba099bc799a294574a7be3fd1752947f1102d0c24279856 | Python | 12,987 | 380 | """Test gpu accelerated tree functions."""
import numpy as np
import pandas as pd
import pytest
import shap
import sklearn
from shap.explainers._tree import SingleTree, TreeEnsemble
from shap.utils import assert_import
try:
assert_import("cext_gpu")
except ImportError:
pytestmark = pytest.mark.skip("cuda modu... |
3eb9f843b9ecb16b147e69c1c23c1b51b71d1ea490ee5789e5eeae4d5702ccc3 | Python | 12,987 | 386 | import datetime
import json
import logging
import os
import re
import time
class DateRangeError(Exception):
pass
class DailyScheduleError(Exception):
pass
class Scheduler:
def __init__(self, in_str):
"""
Class to express time constrains.
It parses a formated string to define a ... |
bcdcb01b1e21819949abfe4e7c33eabf7379d0525776c2268f92209a95407c3a | Python | 12,990 | 379 | from itertools import groupby
from collections import defaultdict
import numpy as np
from typing import List, Tuple
from esm import pretrained
import torch
from tqdm.auto import tqdm
from model import LSTMCNNCRF, CRF
from esm import ProteinBertModel
import os
def parse_fasta(fastafile: str):
'''
Parses fasta f... |
149b2ad258ee451605faae42c4e39cc6b9d422f011a5b1761f06a9a6ad4f1e2b | Python | 12,993 | 388 | # --- 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 Polar(_BaseLayoutHierarchyType):
_parent_path_str = "layout"
_path_str ... |
dcb2307adfe66f38a62e2ddb6c1682241e0cb6e1fff5a1e68b59c4761621d79b | Python | 12,993 | 372 | # 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... |
273ded3a5f2b540e4f380da14bde19e53ea2a24a67d7d317e6a79f4fd4cadc1b | Python | 12,994 | 349 | """Coupling evidence machinery (lane F42): digests, fire counts, segments.
Pre-flip unit coverage of the settlement writers and derived reads: the
intervention digest is deterministic over ordered fire facts, per-step fire
counts distinguish measured zero from no-opportunity, segments split at
measured break joins and... |
77c510a61c35d3d4e9c1405c5ed5f2417a7bbb02da0354a5b8febac330dee3ec | Python | 12,995 | 395 | # Eelbrain documentation build configuration file, created by
# sphinx-quickstart on Tue Mar 29 23:16:11 2011.
#
# 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 configuration values hav... |
ce718f1edee9524417905f6bb9a1ba09cb608b92dafc20e0fffd01334c610045 | Python | 12,996 | 316 | """The calibration-based quantization modes, GPTQ and AWQ.
GPTQ and AWQ allocate the same family of variables, run the same
dequantize-and-contract forward pass, and speak the same three-part policy
grammar. They differ in the code bit-width (which fixes how the kernel is
packed), in the dtype policy class, in the cal... |
927a367680fe717694a9bfa01f5186c977ff58712557ce6bb3384fba660bbd21 | Python | 13,004 | 372 | import os
from pycocotools.coco import COCO
import numpy as np
import matplotlib.pyplot as plt
import cv2
from lib import cv2_topology_handler
from lib import constants
DESCRIPTION = "Data set for segmenting insects"
DEFAULT_LICENSE = {
"id": 1,
"name": "Attribution-NonCommercial-ShareAlike License",
"url"... |
2631c34e62b27cf8e710de34ca5fad4f22c6d3e1ce41fc61054397011de49b58 | Python | 13,005 | 337 | import copy
import json
import pandas as pd
import sys
import torch
import pytorch_lightning as pl
import numpy as np
from pathlib import Path
from torch.utils.data import DataLoader
from argparse import ArgumentParser
from survival_plus_x.data.dataset import GensheimerDatasetInMemory
from survival_plus_x.data.trans... |
d16f996eb1e431df25d18fa30c2c9b1d8a1fc916c4186c37e36e412f9e105c05 | Python | 13,007 | 390 | import re
from contextlib import nullcontext as does_not_raise
import numpy as np
import pandas as pd
import pytest
from scipy import signal
import pynapple as nap
############################################################
# Test for power_spectral_density
##########################################################... |
66be5224b637239627050e9afdf9699a4f41162af3755921b288c09f2e954d7e | Python | 13,008 | 292 | """Packaging + crash-class-docs gates (workstream A12).
Four defect families this lane closed, each pinned here so it cannot silently
reopen:
* extras composition -- ``[all]``/``[all-stretch]`` resolve by exclusion
(lit-nlp named out), no empty extras, the tf/tensorflow rollup alias, and
the transformers band-coh... |
56bb30ae7070f9924e76844a34c4ef8e0f5ac656907a66826a6604879e02721b | Python | 13,013 | 357 | # Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
import bisect
import os
import shutil
import tempfile
from typing import Any, Callable, Dict, List, Optional, Union
import torchvision.datasets as datasets
from PIL import Image
from torchvision import transforms
from torchvision.datasets.visi... |
24b8ce74c633b600aa7f77456f14c42180ce9adff9f7fe7a2e18a0892ddbf4ee | Python | 13,017 | 349 | import numpy as np
from utils import Recorder
from mitosfns import spike_quanta, run_sim
from steady_state import get_steady_state
from lifcell import LIFCell
from gates import ros_inf
import figure_properties as fp
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
from matplotlib.collections imp... |
f776f22be987e38b07a7ea60156cee54ea2cf1834732e1cbbad33a07ee39d327 | Python | 13,019 | 353 | """
Unit tests for base stimulator classes.
Tests BaseStimulator, DefaultStimulator, and related functionality including:
- Stimulator initialization and binding
- Scheduler integration
- Hardware interaction
- Template overrides for ROI mappings
- State tracking and reporting
"""
import time
import unittest
from uni... |
997706c15d3171d4bc5a00d87bace21c422353d0d80b6616d8990445c03312c4 | Python | 13,024 | 380 | import math
from enum import IntEnum, unique
from typing import Any, List, Tuple, Union
import numpy as np
import torch
_RawBoxType = Union[List[float], Tuple[float, ...], torch.Tensor, np.ndarray]
@unique
class BoxMode(IntEnum):
"""
Enum of different ways to represent a box.
"""
XYXY_ABS = 0
""... |
e5e3e01856a233c6180c6845278be803bcc785865a4bd27b883c34aafe708d7f | Python | 13,029 | 283 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import division
from __future__ import print_function
import os, itertools, random, argparse, time, datetime
import numpy as np
import random
from sklearn.metrics import mean_squared_error,... |
056bcfdec4e07a92aec4404a76a756bc3c4b448f4836ee2996aa604271ebc52a | Python | 13,034 | 332 | """Save-side portability preflight for ``metadata.pkl`` (AUD-CODE 2.20 / 3.11g).
Write/read symmetry law: TorchLens never writes metadata bytes that its own
DEFAULT loader cannot read back. ``tl.load`` unpickles ``metadata.pkl``
through the default-deny allowlist (``_safe_unpickle``), so an arbitrary
user object sitti... |
b52c123d9a4d437c49b35df1ad4ea9103e200695d6b64d42952166431eb00241 | Python | 13,035 | 370 | import abc
import logging
import re
import yaml
from pydantic import (
BaseModel,
field_validator,
)
from galaxy.config import GalaxyAppConfiguration
from galaxy.exceptions import ConfigDoesNotAllowException
log = logging.getLogger(__name__)
class UrlHeadersConfigurationException(Exception):
"""Raised ... |
6ed1512160f5ce7f2dcc82ab05d4c646e070cd8f97b612ecb2ff4c97043b7dab | Python | 13,048 | 421 | import numpy as np
from numpy.testing import assert_array_equal
import pytest
from pytest import approx
from scipy.stats import combine_pvalues
from pyriemann.artifact_detection import Potato, PotatoField
pytestmark = pytest.mark.numpy_only
clusts = [Potato, PotatoField]
@pytest.mark.parametrize("kind", ["spd", ... |
b59ac1e6c48de38be2abd4509673617405ea6f4b83bf1b5b52f710d015135689 | Python | 13,048 | 266 | from os.path import join
import numpy as np
import matplotlib.pyplot as plt
import os
from library.comput_utils import pair_diff
from library.script_wrappers import find_nidx_along_traj
from library.utils import load_pickle
from library.visualization import plot_phase_precession, plot_popras
from library.shared_vars im... |
13bbd1bdb59876e123ac6f6d6a37a19707f30c6284825aea5f42a497ef736c84 | Python | 13,052 | 260 | #结论:当模型进行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... |
5c287ea8397d44776cff016a1229e47d6f47277dc00d2f7ee692ae0c8cc6aea7 | Python | 13,054 | 319 | #!/usr/bin/env python3
"""
File: plot_tss.py
Created: 2022/07/07
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.
"""
# Standa... |
6f00443036e36a5dbc19c8f7fb0d8af5abe3b959435555c0b331ce99f4e9b39b | Python | 13,063 | 388 | """
This code git pull origin maincreates the model described in MoDL: Model-Based Deep Learning Architecture for Inverse Problems for OPT data, modifying the implementation for PyTorch in order to use Torch Radon
@author: obanmarcos
"""
try:
import torch
import torch.nn as nn
import torch.nn.functional a... |
32c7f7c351888dd7f658a7f862725bd9abff2f309add9efff55fd69ddf334496 | Python | 13,064 | 278 | import subprocess
import os
import shutil
import numbers
import pandas as pd
import numpy as np
from oct2py import octave
from .utils import nml2swc, hoc2swc, mergetraces, eswc2swc, mesh2swc, vtk2swc
from .standard import chksingle, swccorrect
from .swcco import extract_contours
# ------------------------------------... |
6724c816b0cd7fc70b3a1f5cb3786871b8b40807b9a6a84d2fde48d272429582 | Python | 13,068 | 314 | '''
Analyse and visualise metrics produced by DBSCAN and Voronoi Clustering
Tristan Wallis, Sophie Hou
'''
last_changed = 20210601
import PySimpleGUI as sg
sg.theme('DARKGREY11')
popup = sg.Window("Initialising...",[[sg.T("DBSCAN Wrangler initialising\nLots of modules...",font=("Arial bold",18))]],finalize=Tru... |
d68fd37439fe2fc54913cfa0ac2ce339626c3b142a0d8c4382c6779b9544291a | Python | 13,068 | 328 | # 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... |
1269300a6ce1f061b9a5261a8a0ceb61c1816903f41b842d9959ca72ebd15824 | Python | 13,071 | 250 | import random
import os
from agents.model_2d import *
from envs.int_discrim_2d import *
import numpy as np
import torch
import matplotlib.pyplot as plt
from datetime import datetime
import argparse
from tqdm import tqdm
import re
import sys
sys.path.insert(1,'/home/mila/l/lindongy/deeprl-timecells')
from analysis impo... |
04fbd8003e60932d2e3061659ba0f79d164d636b1d0edd5c24b208d9464bd04c | Python | 13,074 | 281 | # pylint: disable=abstract-method
"""Feature extraction blocks.
Feature or Multi-Feature extraction is a key component in object detection.
Class predictor/Box predictor are usually applied on feature layer(s).
A good feature extraction mechanism is critical to performance.
"""
from __future__ import absolute_import
i... |
205c77c8bedabb5329d90e94abb3334da6703c1d7311be6f6036fb7c7ab1a682 | Python | 13,078 | 401 | # -*- coding: utf-8 -*-
""".. _lightly-moco-tutorial-2:
Tutorial 2: Train MoCo on CIFAR-10
==============================================
In this tutorial, we will train a model based on the MoCo Paper
`Momentum Contrast for Unsupervised Visual Representation Learning <https://arxiv.org/abs/1911.05722>`_.
When train... |
431e1b310ee13368fda817b2771a71f6b9f11002d27753e2fd21e3003da62812 | Python | 13,081 | 318 | from nitorch.core.kernels import smooth
from nitorch.spatial import (affine_grid, grid_pull, grid_push,
voxel_size, im_gradient, im_divergence)
import torch
from torch.nn import functional as F
from .struct import _proj_op
def _apply_scaling(dat, scl, dim):
""" Apply even/odd slice sc... |
71ebd80ebeb3fe27456b98ac9f2f6c71920ed61cd3bb306a3ac5af31fec3afd2 | Python | 13,084 | 362 | import unittest
from http import HTTPStatus
from unittest.mock import MagicMock, Mock, patch, call
from freezegun import freeze_time
from cellxgene_gateway.backend_cache import BackendCache, is_port_in_use
from cellxgene_gateway.cache_entry import CacheEntry, CacheEntryStatus
from cellxgene_gateway.cache_key import Ca... |
899fd0f6f5f75033aa8c0b4b1ef669ebf7a98daa422baa896d4813db15b82b05 | Python | 13,086 | 311 | """
03: Fitting Algorithm
=====================
A step-by-step overview of the algorithm for parameterizing neural power spectra.
"""
###################################################################################################
# Algorithmic Description
# -----------------------
#
# In this tutorial we will ste... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.