sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e7b5902dc0e296d13aff30e2de51116c7ca1d1830c146112260a1e870aeaf8c6 | Python | 17,819 | 458 | import re
import warnings
from typing import Dict, Union
import numpy as np
import pytest
import gym
from gym import spaces
from gym.utils.passive_env_checker import (
check_action_space,
check_obs,
check_observation_space,
env_render_passive_checker,
env_reset_passive_checker,
env_step_passiv... |
5ffb351b290d8f863402369640ce935c55939f315edac9d0e00009cd1d7cf8ba | Python | 17,826 | 396 | import math
import threading
import time
import gc # garbage collection
from Utilities.common_packages import np
from Configurations import config as cfg
from numba import float32, uint64, uint32, int64, cuda
from Utilities.ufunc import compile, randn, randu, randp
from Configurations.fd1t_cfg_3d import mod, modMax, m... |
1afd359061c05575f6d881e54e822af96762c3de03e119904a6c9ba2afe6159a | Python | 17,835 | 458 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import os
import cv2
import numpy as np
import slowfast.utils.checkpoint as cu
import slowfast.utils.logging as logging
import torch
import tqdm
from slowfast.datasets.ava_helper import parse_bboxes_file
from slowfast.datas... |
d5ba47b4df46603a76a6063c7c2cfc880a07cae9d4c09aa616a8460bf2bc83f0 | Python | 17,838 | 443 | import numpy as np
import os
import tifffile as tiff
from skimage import io
import random
import math
import torch
from torch.utils.data import Dataset
from skimage import io
def random_transform(input):
p_trans = random.randrange(8) # (64, 128, 128)
if p_trans == 0: # no transformation
input = inpu... |
50296c280b559e7314c8763dcff9fc4d1936e19ce25f351b3f28791c222bfcba | Python | 17,840 | 477 | """Round-39 bounded C-holder parity branches -- pinned regression suite (V9a-V9f + MRO).
NumPy>=2 RNG draw methods are profile-silent Cython, so an off-model draw is witnessed
only by the before/after reachability digest. Round 39 executed SEVEN frame-rooted
false-VERIFIEDs sharing one shape -- a generator reachable O... |
00ec022303d66d4c050008cd0b8b6d7cc0c4836872b246e180fbc0ccd290b419 | Python | 17,849 | 595 | ## Module statistics.py
##
## Copyright (c) 2013 Steven D'Aprano <steve+python@pearwood.info>.
##
## 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/L... |
b30b34ab0d18559c93fdf8cf96ed8b86d4000f821f03a263204e54b9d251ba6f | Python | 17,856 | 448 | import copy
import json
import numpy as np
import pytest
from keras.src import dtype_policies
from keras.src import layers
from keras.src import models
from keras.src import saving
from keras.src import testing
from keras.src.dtype_policies.dtype_policy import dtype_policy
from keras.src.dtype_policies.dtype_policy i... |
ce7f91599e85c5b216235ef8c74bccb327f4ec3bb50a83898641cd16de223be8 | Python | 17,860 | 418 | import numpy as np
import os
import pickle
from tqdm import tqdm
from typing import Sequence, List, Dict, Any, Tuple
from rdkit import Chem
from rdkit.Chem.rdchem import Mol
from rdkit.ML.Scoring.Scoring import CalcEnrichment, CalcBEDROC
from scipy.stats import spearmanr
from .evaluator import Evaluator
from .conf_en... |
3abac3ab063b8ecf90224343b87e992275340ac2506c37925f706a2afa591dd1 | Python | 17,877 | 507 | # encoding: utf-8
"""Methods to compute representational dissimilarity matrices (RDMs).
Authors
-------
Marijn van Vliet <marijn.vanvliet@aalto.fi>
"""
from warnings import warn
import numpy as np
from joblib import Parallel, delayed
from scipy.spatial import distance
from .folds import _match_order, create_folds
f... |
cbff36295afda2f71ef6001268998ccc3ed435712808218332ea8ba05b10737a | Python | 17,877 | 410 | #!/usr/bin/env python3
"""
File: plot_picalo_with_multiple_start_pos.py
Created: 2021/05/18
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... |
fe4dba3b5cc67c66ee56c7358510374208197728c6370336764280a118b49964 | Python | 17,881 | 496 | from __future__ import annotations
from dataclasses import replace
import json
from pathlib import Path
from typing import Any, Callable
from larvaworld.lib import reg, util
from larvaworld.lib.reg.generators import EnvConf
from larvaworld.portal.models_architecture.environment_builder_common import (
BORDER_SEGM... |
61e2e24e5bb28c189cb39b1e1c3651f590b85c7fb30b4c9e14dca43e6f001ba6 | Python | 17,887 | 511 | # --------------------------------------------------------
# --------------------------------------------------------
# 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/facebookre... |
5b92a31d0350ef2c3371cc2612b198385df88b9a279a2a7a243da4f984b0818d | Python | 17,888 | 407 | """Lock public documentation names, paths, links, and dated tier claims to code."""
from __future__ import annotations
import importlib
import re
from pathlib import Path
import pytest
import torchlens as tl
# DECLARED-surface constant (cited by the reachable-surface gate in
# tests/oracles/test_oracle_w0_surface.... |
2bd963a07e3da0429c2ecba568c6f94b66959a4d268cd824b1417f96ce1588ab | Python | 17,912 | 426 | """
The data structure of Molecules.
This implementation is adapted from
https://github.com/chemprop/chemprop/blob/master/chemprop/features/featurization.py
"""
from argparse import Namespace
from typing import List, Tuple, Union
import numpy as np
import torch
from rdkit import Chem
# list of elements are were are c... |
0b1b02ae2cb3c98f66970ea10fa8dfdd300a9df395966a5238cd6052529b4ca7 | Python | 17,914 | 562 | """Brute-force recurrent-site oracle for parameter-free loop boundaries.
The expected partitions below are enumerated from source-level call sites and
loop iterations, independently of TorchLens grouping metadata. The oracle
checks every pair of captured calls: two calls share a layer if and only if
their hand-enumer... |
82830bc39da0eafb77d3b94187d339dc7bdb0a28f8068be3dddaea08c452f0b5 | Python | 17,929 | 376 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""Scale-only calibration for monocular depth models.
The log-depth head predicts relative scene structure (shape); absolute scale is a separate
two-parameter log-affine ``d' = exp(a·log d + b)`` stored in the head's ``cal_a``/``cal_b``
buffers. This ... |
be80283531a6dc4dc20facf25420a64974650f3ecc6ae2d8105ec5d1da5c9b4b | Python | 17,933 | 470 | # MIT License
# Copyright (c) 2018 Adrian Wolny (https://github.com/wolny/pytorch-3dunet)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation t... |
df2612f516621713ac643b765ba8f1018f463eb6fb456c9ad009cfb3c10d5b68 | Python | 17,939 | 429 | """Attestation that the byte-identity oracles are ENFORCEABLE, not skippable.
The b10 audit found the oracle families could go green without ever
enforcing anything: off-canonical environments recorded-and-skipped forever
(ephemeral CI checkouts re-recorded every run), update flags produced
vacuous compare-to-self pas... |
7a1ae10d776edce12c3e8e26b0554d91dad7d150062b7c53775eeb48c998a58b | Python | 17,941 | 493 | """S6 bundle member-relation table + episode fold tests (L2 build).
Covers the S6 rules R1-R7, the R5 mutator guards, the section-2.3 episode
fold arms through both the Bundle surface and the ledger-module fold, and
the S3-gated ``member_relations`` persistence paths.
"""
from __future__ import annotations
import js... |
a1158f24789a1d9ababea6ad55ef868de42b71c5f3850d3de32256da8f28c13e | Python | 17,943 | 416 | """Advanced (opt-in) filtering: regex dict values and Overpass-style bracket strings.
Covers the filter compiler (parsing + predicate semantics) directly, then the end-to-end
behaviour through the in-memory and out-of-core readers on bundled data. The opt-in forms add
regex value matching (issue #116) and Overpass-sty... |
85ad8d0b6fd94e38afd7ce31ff88d7fbb656e8af6e4506f3805449f6e0cbba76 | Python | 17,955 | 538 | import os
import numpy as np
import pandas as pd
import json
import PIL.Image
import cv2
import scipy.spatial
import scipy.optimize
import networkx as nx
import itertools
import datetime
from pathlib import Path
from argschema import ArgSchemaParser
from nway.schemas import PairwiseMatchingSchema, PairwiseOutputSchema... |
801295d1a520f2dd43fd29f64ec6acf2c8b8bd56150b6f35da83970f24ea31b8 | Python | 17,957 | 479 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import pandas as pd
import os
import time
import sys
import pwd
import pdb
import csv
import deepchem
import dcCustom
from dcCustom.molnet.preset_hyper... |
ea512188f55c588d31817c7da91e886b74f7557b002d6a187bd02bde8a9dcef7 | Python | 17,958 | 386 | # 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... |
8f293f18429691d47b88015f91fee90f671f30e662c41c67e9faa381a9e255ce | Python | 17,961 | 518 | """
get_tp_fp_fn, SoftDiceLoss, and DC_and_CE/TopK_loss are from https://github.com/MIC-DKFZ/nnUNet/blob/master/nnunet/training/loss_functions
"""
import numpy as np
import torch
from torch import einsum, nn
from torch.autograd import Variable
from losses.cross_entropy_nd import CrossEntropyND, TopKLoss, WeightedCros... |
2fd1d51ae635752da626d6e6c83ba0c406abd801289bbc3b81271dbd7edb436c | Python | 17,965 | 502 | from typing import Optional, Union
import numpy as np
import ot
import pandas as pd
import torch
# from scipy.sparse import coo_array
from torch import sparse_coo_tensor as SparseTensor
from .utils import _data, _identity, _linalg, _unsqueeze
def calc_distance(
X_A: Union[np.ndarray, torch.Tensor],
X_B: Un... |
42b6bdbf011bb55fd25b6cc7d5b51feead19ef9de2a95fb334d1cadc74677275 | Python | 17,972 | 473 | # GNNSubNet.py
# Authors: Bastian Pfeifer <https://github.com/pievos101>, Marcus D. Bloice <https://github.com/mdbloice>
from urllib.parse import _NetlocResultMixinStr
import numpy as np
import random
#from scipy.sparse.extract import find
from scipy.sparse import find
import torch
import torch.nn as nn
import torch.nn... |
88d8469d0bef603189271207d62cb3c658048e213f5e638061d7f12664a85cab | Python | 17,973 | 494 | """
Test to verify that intel-rapl-mmio and other providers are properly scanned
and permission errors are gracefully handled.
"""
import logging
import os
import stat
import sys
import pytest
from codecarbon.core.cpu import IntelRAPL, is_rapl_available
from codecarbon.core.units import Time
# RAPL is read from Lin... |
57e1e4d24633612e002d698b3030731e70b7ba7bda5d807e82d5c465d565f8cf | Python | 17,983 | 401 | from __future__ import print_function, division, absolute_import
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
pretrained_settings = {
'pnasnet5large': {
'imagenet': {
'url': 'http://data.lip6.fr/cadene/pretrainedmodels/pnasne... |
e711ab5bba0d5f2bfbe5b0d6433e14a59caf6c1094fb7aa11c87022e23864f1e | Python | 17,985 | 534 | """Graphical monitor of Celery events using curses."""
import curses
import sys
import threading
from datetime import datetime, timezone
from itertools import count
from math import ceil
from textwrap import wrap
from time import time
from celery import VERSION_BANNER, states
from celery.app import app_or_default
fro... |
07e4febc3496a9e43ac81a4cdbaa9427c11f9e6c820ef389becb71f4061486a5 | Python | 17,988 | 660 | """Golden tests for torch replay-validation decisions."""
from __future__ import annotations
import json
from pathlib import Path
from typing import Any
import torch
from torch import nn
import torchlens as tl
from torchlens.options import CaptureOptions
from torchlens.validation.status import ValidationReplayStatu... |
02add4f077682e281c6182568fbc17bd610bbd0f6dcac2636b726c298ae3692c | Python | 17,990 | 517 | """Oracle tests for the three r22 attribution wrong-math fixes.
- W2A3-01: repeated references to one input tensor must run the user's actual
function (identity topology preserved) and report the shared tensor's FULL
gradient at every occurrence slot.
- W2A3-02: a module fired N times must contribute through EVERY... |
14a62277493987eae7e4b211afb240b976d376c6b2afc300ffcd70f2649cb429 | Python | 17,999 | 474 | """Parameter substitution ("as if" the parameter were changed) — replay-only.
Pins the decided param-operand contract (2026-08-17): ``fork.do(
tl.params(...), edit)`` substitutes the VALUE each consuming op sees at its
derived occurrence address on the replay engine, through the shipped
tier-(ii) edge-substitution sto... |
fe16446b86bae50b3623ca8f638d92d44853a6b971aa0e9797ea61a706f27d5f | Python | 18,001 | 356 | #!/usr/bin/env python3
"""run_manual_reorder_tool.py
Utility that assists in converting wafer orderings and excludes to / from
a format that is easier to manually edit.
Copyright (C) 2018-2026 Max Planck Institute for Neurobiology of Behavior
This program is free software: you can redistribute it and/or modify it ... |
018f1fd1ea94b1e7ebdb8ee5b30fc3c26f0d6e7f0299db578e458cb0183e0e0e | Python | 18,023 | 431 |
"""Functions for building the features for the AlphaFold multimer model."""
import collections
import contextlib
import copy
import dataclasses
import json
import os
import tempfile
from typing import Mapping, MutableMapping, Sequence
from absl import logging
from helixfold.common import protein
from helixfold.common... |
ee90a13bd191681bcdb6fbc2bc61c9c3653d7307277893cf31285a4e5ee249a6 | Python | 18,023 | 429 | try:
from typing import Literal
except ImportError:
from typing_extensions import Literal
from typing import List, Optional, Union
import numpy as np
from anndata import AnnData
from pyvista import PolyData
from .three_dims_plots import three_d_multi_plot
def _load_tdr_model():
"""Load tdr model utilit... |
886080fcc72a9c9e46e34290ae69d1adc9f36ab0c88e42ee4a33859fdc2c8c8e | Python | 18,032 | 545 | #!/usr/bin/env python
# encoding: utf-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import os, sys, re
import logging
import argparse
import collections
import numpy
import time
import TNode
import TGraph
logger = logging.getLogger(__name__)
class No... |
5c1d3d908ea9c3d79700694140ed04470d39bb42b4e5398237db33843104cc67 | Python | 18,040 | 458 | import math
import torch
import torch.nn as nn
import torch.distributions as D
import numpy as np
import json
class gaussian:
"""
This is a simple Gaussian prior used for initializing mixture model means
"""
def __init__(self, dim, mean, stddev):
self.dim = dim
self.mean = mean
... |
8815c859b2eefeba375bdae9cc61c6d9421ec9bde0c30fb2719c2fd3f4088db6 | Python | 18,040 | 359 | """DO NOT EDIT.
This file was autogenerated. Do not edit it by hand,
since your modifications would be overwritten.
"""
from keras.ops import image as image
from keras.ops import linalg as linalg
from keras.ops import nn as nn
from keras.ops import numpy as numpy
from keras.src.ops.core import associative_scan as ass... |
58332305cad1137269703c6317208147f61bd927edf6bf2fa70facf843da2445 | Python | 18,041 | 549 | '''DNN features class
This file is a part of BdPy.
'''
from __future__ import print_function
__all__ = ['Features', 'DecodedFeatures', 'save_feature']
from typing import Any, Optional, Union, List, Dict
from functools import partial
import os
import glob
import sqlite3
import pickle
import warnings
from multipr... |
3588e6093eceab581e4b902e162fad98f57c424b2908e100747e970cf1fb02f5 | Python | 18,057 | 459 | """L6 stage 3: edge substitution — storage-fork honesty, tripwires, save boundary.
Pins: replay-engine-only scoping (typed refusals), edge-provenance gating,
the three-tier storage decision (tier-(ii) store + stamps; tier-(iii)
capture-surface parity), convenience-field coherence (producer truth vs
consumer view), nod... |
f9ddb5313fe127d5fba0c8f5f54e305837d9cea9c38c64100d9dff59a68f39d6 | Python | 18,058 | 485 | """
From Niklas Wilming et al. Nature Communications 2020
https://github.com/DonnerLab/2020_Large-scale-Dynamics-of-Perceptual-Decision-Information-across-Human-Cortex
"""
from __future__ import division
from __future__ import print_function
import logging
import os
from itertools import product
import numpy as np
i... |
1da292e43d560dfda41a0ed1b40ff6aac8b5d7e590efc14d0a8d6faa3b6be02c | Python | 18,059 | 520 | import sys
sys.path.extend(["../TDNODE", "src"])
import torch
import torch.nn as nn
from sklearn.metrics import mean_squared_error, r2_score
import os
from datetime import datetime
import pytz
import pandas as pd
from prodict import Prodict
from yaml import safe_load, YAMLError
import json
from typing import Tuple
impo... |
58a5f1bcf31da03950ed1964409690c0f588d2e1f56a866005d75f7cd97198cc | Python | 18,066 | 585 | """Regression tests for Phase 14 bug fixes."""
from __future__ import annotations
import hashlib
import json
from pathlib import Path
from types import SimpleNamespace
import pytest
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchlens as tl
from torchlens.capture.arg_positions import ... |
62d0095438e4aea9e6ef571860cf476187bd1f4a912da2ac8edf8ad308046fa8 | Python | 18,066 | 446 | """
Quick script for comparing dimensionality (as computed in dimensionality_all_models.py) vs scores across layers, across all models
TODO: should be nicely integrated
"""
from pathlib import Path
import numpy as np
import pandas as pd
import matplotlib.pylab as plt
import argparse
import os
import pickle
from plot_... |
f5bbbad98c7fff30e3d2abad707f6cfef4e619fce3de017b0d14e7a990c87547 | Python | 18,075 | 409 | # pylint: disable=unused-argument, arguments-differ, unused-variable
"""Fast-SCNN, implemented in Gluon. Code adapted from lxtGH/Fast_Seg"""
__all__ = ['FastSCNN', 'get_fastscnn', 'get_fastscnn_citys']
from mxnet.context import cpu
from mxnet.gluon.block import HybridBlock
from mxnet.gluon import nn
class FastSCNN(H... |
63d220387c26b27edb024cc364f3f4bc068981f16f7188a7939fa3a3e6c65b99 | Python | 18,078 | 500 | import warnings
from keras.src import backend
from keras.src import layers
from keras.src.api_export import keras_export
from keras.src.applications import imagenet_utils
from keras.src.models import Functional
from keras.src.ops import operation_utils
from keras.src.utils import file_utils
BASE_WEIGHT_PATH = (
"... |
3bfbe9b5a6b628070da6df00f688bf03f9c4083563a5c666306709698af51068 | Python | 18,079 | 468 | """
BASIL GUI for Oxford ASL - Base classes for pages in the tab notebook
Copyright (C) 2020 University of Oxford
"""
import os
import numpy as np
import wx
import wx.grid
import wx.adv
from . import OptionComponent
class TabPage(wx.Panel, OptionComponent):
"""
Shared methods used by the various tab pages ... |
9d27e902b7ce0668ec55e8616b15e52b3efc7b10e50cb58c8a71aa0c8f1b022a | Python | 18,090 | 562 | """
Unit tests for sim/conditions.py - Experiment completion condition checkers.
Tests cover:
- get_exp_condition() function
- ExpCondition base class
- PrefTrainCondition (preference training)
- CatchMeCondition (chase game)
- KeepFlagCondition (flag possession)
- CaptureFlagCondition (flag capture)
Target: Increase... |
eae205387f355c22b90d0cd40f229de3042a17c94dff9606dca79f619c1a4a55 | Python | 18,090 | 430 | """Tests for connectivity matrix calculation."""
import os
import sys
from pathlib import Path
import nibabel as nb
import numpy as np
import pandas as pd
from nilearn.maskers import NiftiLabelsMasker
from xcp_d import config
from xcp_d.interfaces.ants import ApplyTransforms
from xcp_d.tests.tests import mock_config... |
78b8a8b21fc4220bc1da2a9a1171d025b3cf8ce2e64eac7bc4c66212f6bdd6c9 | Python | 18,099 | 394 | import logging
from uuid import uuid4
from pydantic import (
UUID4,
ValidationError,
)
from sqlalchemy import select
from galaxy.config import GalaxyAppConfiguration
from galaxy.config.url_headers import UrlHeadersConfigFactory
from galaxy.exceptions import (
InsufficientPermissionsException,
ItemAlre... |
42770491366abf2ab2a3172deb66ff26568f3af625e3df07dbdfc3a4c55474e4 | Python | 18,100 | 344 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from __future__ import division
from __future__ import print_function
import torch
import torch.nn.functional as F
import torch.optim as optim
from torch.utils.data import DataLoader
from sktime.perform... |
d77529ffbc18a79c0d46c9afb2414f3a1c50efa1be757f180f4ff11f5c8ef21d | Python | 18,101 | 384 |
import torch.nn as nn
import torch.nn.functional as F
import torch
from torch import optim
from torch.autograd import Variable
from torch.utils.tensorboard import SummaryWriter
import cv2
from skimage import segmentation
import numpy as np
import openslide
import matplotlib.pyplot as plt
import os
import ... |
461284db0915eeb0a88a9db61423cba6b44ecaa3a0ba38de5f2c441e3080dfcf | Python | 18,110 | 383 | from __future__ import generators
import logging
import glob, os, functools
import sys
import SimpleITK as sitk
from scipy.signal import medfilt
import numpy as np
from numpy import median
import scipy
import nibabel as nib
import skimage
import matplotlib.pyplot as plt
import scipy.misc
from scipy import ndimage
from... |
ca8eda37cea1390717a3a3eb4702dac291dcac223e52b1cd3426b44dea3642d3 | Python | 18,112 | 426 | import os
import sys
import time
import numpy as np
import argparse
import json
from tqdm import tqdm
from rdkit import Chem
from rdkit.Chem import Mol
from rdkit.ML.Scoring.Scoring import CalcEnrichment, CalcBEDROC
from multiprocessing import Pool
from .gold_docker import GOLDDocker
from bioconfpred.conf_ensemble imp... |
7d83ac30e13dacf61bbf3cbacd5aceeb177e829f9551925e31224997ea2f846c | Python | 18,114 | 404 | """Identify cells from RNA signal. Functions in this file are used to
generate a cell mask, NOT to identify individual cells.
Original author @HailinPan, refactored by @Lioscro.
"""
from functools import partial
from typing import Dict, Optional, Tuple, Union
import cv2
import numpy as np
from anndata import AnnData
... |
899544aa7facc3156bab82da660ec13bb9f774ea9c135cf83f80e1601c3fb74f | Python | 18,114 | 404 | import mne
import os
'''
Get HCP MMP Parcellation for a set of subjects
This script was adapted from Niklas Wilming et al. Nature Communications 2020
https://github.com/DonnerLab/2020_Large-scale-Dynamics-of-Perceptual-Decision-Information-across-Human-Cortex
'''
def get_hcp(subjects_dir):
mne.datasets.fetch_h... |
10ae1ac4a728cb5ea1c02d18529a5564e8c71f297b3ebb490b3207110b3dc932 | Python | 18,118 | 505 | import pandas as pd
import torch
from tqdm import tqdm
import numpy as np
from sklearn.metrics import confusion_matrix
from collections import Counter
from utils.json_loader import load_json_into_pandas_dataframe
def calc_proportion_class_training(vocab, type_data):
if type_data == "BENZ":
data_path = "da... |
9505c7086e838c847cacf4f5159ae1b33e070eaf13cf4cfed918b34d688a4966 | Python | 18,128 | 533 | # 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... |
9cccf916fb5d05d1b02e2a0e8a7ced4d5cf261005afa65802ce6dd3038c34a4b | Python | 18,134 | 541 | """Regression goldens for exact structural and pointwise receptive-field rules."""
from __future__ import annotations
from collections.abc import Iterator
import pytest
import torch
import torch.nn.functional as functional
from support.rf_isolation import preserved_rf_registry
from torch import nn
import torchlens ... |
04b65719efc8562341b5f939e2a0cf0025dd8f437eb69bd8779cee5f5c29e17a | Python | 18,135 | 515 | import csv
import json
import logging
import os
from dataclasses import dataclass, field
from typing import Any, Dict, Optional, Sequence, Tuple, Union
import numpy as np
import sklearn.metrics as metrics
import torch
import transformers
from embed_sequence import embed_sequences
from peft import get_peft_model, LoraC... |
025979e4f916882ba5852eda9a3954f509d2741e36dd27781a8ba9dfbe20f1dd | Python | 18,141 | 472 | """site_key_v1 substrate tests: encoder byte parity, minting properties P1-P4,
hostile-name serialization round trips, degraded-path parity, structural-fact
pins, and the operation-witness selector.
The serialized form is pinned byte-for-byte against the L1 design memo's
reference encoder (``sitekey_ref.py``); the exa... |
7cc7af2614b19cbf3c7b62e6fd5a6382aa03888d2fb714e8a62353bafca026bb | Python | 18,148 | 935 | # -*- coding: utf-8 -*-
gold1990map = {0:9,1:15,2:3,3:6,4:13,5:17,6:19}
gold = {}
#1989: article 9(de)/10(fr)
gold[9] = [ ([0], [0, 1]),
([1], [2]),
([2], [3]),
([3], [4]),
([4], [5, 6, 7]),
([5], [8]),
([6, 7], [9, 10]),
([8], [11]),
([9], [12]),
([10], [13, 14]),
([11], [15... |
2797ee1bd572d8eb5cc15c948c531ee5ab583caf51830298f09c627e182d9b39 | Python | 18,153 | 606 | # -*- coding: utf-8 -*-
import time
import datetime
from pyoperant import hwio, utils, ComponentError
import logging
logger = logging.getLogger()
class BaseComponent(object):
"""Base class for physcal component"""
def __init__(self, name=None, *args, **kwargs):
self.name = name
pass
## Hoppe... |
f14b19eb26722946860c9b6361aba07c253453e38895da8d1e147e8ed098580e | Python | 18,154 | 461 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Masked Autoregressive layer for Density Estimation (MADE) module for PyTorch.
"""
# ==========================... |
0be54b0f9c2973e7e4e4d4a0d082ca4d02d5d70c637be880bc9f9fddbffa5dc4 | Python | 18,157 | 312 | #!/usr/bin/env python3
"""
File: visualise_results_metabrain.py
Created: 2021/05/06
Last Changed: 2022/03/25
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 t... |
5ff9a7b4a5952a3bd3edda138752f1bbc168b434f23877df5c36d714f02a5c29 | Python | 18,157 | 474 | """C07X amendment, payload B: bundle relation grammar v2 + loader doctrine.
Covers foldB s4.4 items 1, 2, 6, 7, 8, 9, 10, 11 riding the open tlspec-v9
window (TLSPEC_VERSION stays 9):
- required/optional param split with the undeclared-key refusal untouched;
- ``successor_of`` optional evidence envelope ({schema, ite... |
6def88069af5ce14bd8ba1a328034983391b1f70a122675663b4be8f4af604af | Python | 18,167 | 502 | """setuptools.command.bdist_egg
Build .egg distributions"""
from distutils.errors import DistutilsSetupError
from distutils.dir_util import remove_tree, mkpath
from distutils import log
from types import CodeType
import sys
import os
import re
import textwrap
import marshal
from setuptools.extern import six
from pk... |
87e3a5339b0d9a387b809e59db346d7fbb8a636803e56f46311baeaef6de5df7 | Python | 18,174 | 540 | import os
import psutil
from pkg_resources import resource_stream
import json
import pandas as pd
import string
import numpy as np
import warnings
import requests
import datetime
from eco2ai.tools.tools_cpu import all_available_cpu
from eco2ai.tools.tools_gpu import all_available_gpu
class FileDoesNotExistsError(Exce... |
24c089a95aaa74cb13c99e0a786fe0adf9d01aba998c75a41c433cad3af29d96 | Python | 18,178 | 496 | # encoding: utf-8
"""Methods to compute representational similarity analysis (RSA).
Authors
-------
Marijn van Vliet <marijn.vanvliet@aalto.fi>
Egor Eremin <egor.eremin@aalto.fi>
"""
import numpy as np
from joblib import Parallel, delayed
from scipy import stats
from .folds import _match_order, create_folds
from .rd... |
b1ca1884116f8f12887f2e80d30e869b5e94bd5730122a4ce632235718531a21 | Python | 18,178 | 437 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
def get_padding(kernel_size):
if isinstance(kernel_size, (list, tuple, np.ndarray)):
return [(k - 1) // 2 for k in kernel_size]
else:
return (kernel_size - 1) // 2
def get_stride(kernel_size):
if isinst... |
d806f0376aff46d6aa4c09ae7b00baf48da19974c525bea2fa75b353a346a39a | Python | 18,178 | 586 | import numpy as np
np.random.seed(13)
from tqdm.auto import tqdm
from typing import List, Union, Optional, Iterable
import pandas as pd
from itertools import product
from typing import List
tqdm.pandas()
from scipy.stats import pearsonr, spearmanr
import matplotlib.pyplot as plt
from eugene.evaluate import median_calc,... |
c7184445caaefbdd30f533408c6b369318465ae743ea6c889a8c4ff5f1daef23 | Python | 18,179 | 483 | import warnings
from itertools import accumulate, chain, repeat
from typing import (
Callable,
Dict,
Hashable,
Iterable,
List,
Literal,
Optional,
Sequence,
Set,
Tuple,
Union,
cast,
overload,
)
import numpy as np
import torch
import xarray as xr
from numpy.typing impo... |
813d0f45fe82bb2e1c5121a2a17eb41c48bdab6669cef717f1dd9a04f27585f8 | Python | 18,182 | 462 | """ PyTorch implementation of DualPathNetworks
Ported to PyTorch by [Ross Wightman](https://github.com/rwightman/pytorch-dpn-pretrained)
Based on original MXNet implementation https://github.com/cypw/DPNs with
many ideas from another PyTorch implementation https://github.com/oyam/pytorch-DPNs.
This implementation is ... |
80649111f604ad470fbff5c966d19f220fded9caaa54c5f091623e01259732d8 | Python | 18,186 | 446 | """RG causal-LM scenarios on real DistilGPT2 (testing memo 5.2; F36 E2).
RG02 kwargs/Cache transport, RG03 facet floors + attention-implementation
diff, RG04 logit lens, RG05 residual patching vs a hand-coded one-hook
patch, RG07 replay through a Cache-carrying graph vs a frozen-complement
manual run, RG08 episode-cap... |
bb7f68500c40c047437556d67651bef39eda0c639f35d22fef2a6e046fceaf72 | Python | 18,193 | 447 | import numpy as np
import os
import tifffile as tiff
from skimage import io
import random
import math
import torch
from torch.utils.data import Dataset
from skimage import io
def random_transform(input):
p_trans = random.randrange(8) # (64, 128, 128)
if p_trans == 0: # no transformation
input = inpu... |
6867193bceb38a334d3c98e5a174a946a44079bdbb2673fe9c90e72d5985b135 | Python | 18,197 | 488 | #!/usr/bin/env python3
"""
File: pic_replication_combined.py
Created: 2023/07/18
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 tre... |
64bae0a620e2aa8036aeeccc7d2fd03d3bc2da12072f5e9681cea522d55f542e | Python | 18,203 | 538 | """Start/stop/manage workers."""
import errno
import os
import shlex
import signal
import sys
from collections import OrderedDict, UserList, defaultdict
from functools import partial
from subprocess import Popen
from time import sleep
from kombu.utils.encoding import from_utf8
from kombu.utils.objects import cached_pr... |
f3dbb62442bd6869c4ebcee95effad67e6199107fe222e3303e5452192734e0f | Python | 18,208 | 558 | """
Copyright (c) 2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE BLUE BRAIN PROJE... |
42f8e554a5ee213ba591ed60b0debd8a933e8bfe437dfee0ee75f446117d50db | Python | 18,210 | 346 | """Метрики, которые проверяют гипотезу, а не просто рисуют графики."""
import copy
import numpy as np
from .config import ACTION_NAMES, A_FORWARD, A_EAT, N_ACTIONS
def mi_from_hist(h):
"""Взаимная информация с поправкой на смещение.
Оценка MI по гистограмме систематически завышена при малом числе сэмплов,
... |
5300265ad3ed585e4baf326a49a80acc3faa5723309765c4553d499bc50a5d23 | Python | 18,211 | 475 | """Tests for the xcp_d.utils.bids module."""
import os
import pytest
from bids.layout import BIDSLayout, Query
from niworkflows.utils.testing import generate_bids_skeleton
import xcp_d.utils.bids as xbids
from xcp_d.data import load as load_data
def test_collect_data_ds001419(datasets):
"""Test the collect_dat... |
d6a03e15887d0bfcdc1dbc6a0ff8267297083bea7666aff8b3de927e1c460500 | Python | 18,212 | 383 | import os,sys
# install environment goods
#os.system("pip -q install dgl -f https://data.dgl.ai/wheels/cu113/repo.html")
os.system('pip install dgl==1.0.2+cu116 -f https://data.dgl.ai/wheels/cu116/repo.html')
#os.system('pip install gradio')
os.environ["DGLBACKEND"] = "pytorch"
#os.system(f'pip install -r ./PROTEIN_GE... |
83da1ef511d753c1f3459b430771e6937715372076a0b9cc6304a0660e664236 | Python | 18,215 | 491 | # Copyright 2025 Google.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, soft... |
1261ff7e82d4238da19652246bb84159ffd920ec945e1d0cb1c6d6a10566a7ef | Python | 18,219 | 480 | import copy
import itertools
import json # note: ujson fails this test due to float equality
import pickle
import tempfile
from typing import List, Union
import numpy as np
import pytest
from gym.spaces import Box, Discrete, MultiBinary, MultiDiscrete, Space, Text
from gym.utils import seeding
from gym.utils.env_che... |
63dfc59677f6b21466994e3887f6b823df6e566c4d4e0479cae109d7947e99e8 | Python | 18,226 | 469 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Test objects and function in tfep.nn.transformers.spline.
"""
# ==============================================... |
e6da002c672a119148f1043e92013ebaa200ff589dc151ddc76d693c87f33d87 | Python | 18,231 | 493 | ##########################################################################
## ##
## Copyright (c) 2019 Philipp Lösel. All rights reserved. ##
## ##
## This file is par... |
5dbd5a8a4fe94d841073cb8f578ae8c51e1bdf62391cd6c04aa8ed1f96331f2d | Python | 18,234 | 533 | """ siamrpn_tracker
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 math
from collections import namedtuple
import numpy as np
import mxnet as mx
from mxnet im... |
d55228453b83f58d698ba9399c290a51f7456e2edc7b0266439c3cfba39b3ae6 | Python | 18,234 | 480 | #!/usr/bin/env python3
"""
LEMON (MPI Leipzig Mind-Brain-Body) EEG — CAR + 5D Reprocessing
===============================================================
Dataset: MPI LEMON (FCP-INDI S3 mirror), 228 healthy adults, eyes-closed +
eyes-open resting state, BrainVision format, 2500 Hz, 62-channel ActiCap.
16 min recordin... |
182262abe2f94af575d5a955cf49b18da3489fef43a0791137069feeca121be7 | Python | 18,238 | 475 |
"""Pairing logic for multimer data pipeline."""
import collections
import functools
import string
from typing import Any, Dict, Iterable, List, Sequence, Union
from helixfold.common import residue_constants
from helixfold.data import pipeline
from helixfold.data.pipeline_hybrid import AF2_PADDING_DIM, AF2_PADDING_FE... |
ef77d2c4e5471ca6dfde678bfc5c26250a478d537a134ce6f322b0868bfdfb44 | Python | 18,240 | 501 | """Extraction v2 typed-refusal provocations (lane F18; extract memo D18).
Every new ``extraction_*`` refusal code lands with a provoking assertion or
the repo's error-contract coverage gate goes red. This file holds the
CHEAP, capture-free provocations: closed-vocabulary knobs, unit-level
geometry refusals, and the in... |
e9ef046dc198d127fd79893348e78310b31ed1d7b997e193797ec6083b21362a | Python | 18,241 | 487 | """Tests for Layer: aggregate per-layer metadata."""
import pytest
import torch
from torch import nn
import torchlens as tl
from torchlens.data_classes.layer import Layer
from torchlens.data_classes.op import Op
from torchlens.data_classes.trace import Trace
from torchlens.options import CaptureOptions
# -----------... |
84c6cb27b476d2125907e3823fcac9821c8b5e352fef7c3c5c3df90701efb399 | Python | 18,253 | 528 | from __future__ import annotations
import math
from functools import partial
from typing import Callable, List, Optional
import torch
import torch.nn as nn
from torch.nn import Linear, Module, Parameter
# vision_transformer requires torchvision >= 0.12
from torchvision.models import vision_transformer
from torchvisi... |
75d65d3b4b02c176dbe8570b07ed1baa8a332565be0b76021050f9f4f0b779fa | Python | 18,254 | 499 | """Graph-structural producers + TraceSlice: acceptance and honesty gates.
Covers the graph-lane obligations: ``neighborhood`` / ``between`` return
composable ``Selection`` queries whose member sets are verified against
hand-computed hop sets and path regions on a branchy model, family
semantics (element masks never sh... |
42d8e8fcae9fb4a7f7fc9c2681fc8963a6b5248311683a127a5904775c0bb9db | Python | 18,258 | 442 | """
Automated Codim-2 Search and Period-Doubling Cascades
=====================================================
`PyCoBi` ships two convenience helpers for the bookkeeping-heavy parts of a
bifurcation analysis:
* :func:`codim2_search` — given a list of codim-1 starting points (folds,
Hopfs, period-doublings) on an e... |
53a9809dccf7601a6278b7f65e563e3327137eb8222a06e2eb46cccdcfd76815 | Python | 18,259 | 493 | ## Import packages
import numpy as np
import pandas as pd
from rdkit import Chem
import torch
from torch_geometric.data import Dataset, Data
from torch.utils.data import TensorDataset
from torch.nn.functional import one_hot
import os
from ase import io
from scipy.stats import rankdata
from torch_geometric.utils import ... |
8e1432de673a87b7b17644a0a23f7e8f36390418ba2c782c51fcf7cff5d45516 | Python | 18,260 | 456 | """
Helper functions for het.py; primarily counting help.
"""
import numpy as np
import numba
from numba import types
from numba.typed import List
from numba import njit, jit
@njit
def edge_core(
cell_data: np.ndarray,
cell_type_index: int,
neighbourhood_bcs: List,
neighbourhood_indices: List,
sp... |
304b37c1dfabf6796c24c99d9ba9fe4b685c068c24a5569fb5924dd082faa7ec | Python | 18,261 | 469 | """AWQ (Activation-aware Weight Quantization) algorithm implementation.
AWQ protects salient weights by finding optimal per-channel scales based on
activation magnitudes, then applies those scales before quantization.
Reference: https://arxiv.org/abs/2306.00978
"""
from keras.src import ops
from keras.src.quantizers... |
e21952d044159438765eb27848b0fe4c75f83faee8645181a09a1eccb1d5cab7 | Python | 18,261 | 540 | from __future__ import annotations
import contextvars
import typing as t
from functools import update_wrapper
from types import TracebackType
from werkzeug.exceptions import HTTPException
from werkzeug.routing import MapAdapter
from . import typing as ft
from .globals import _cv_app
from .helpers import _CollectErro... |
a63d33288ae0d3c9692a78a28942f89c35b97f69c81d803716f262e815e03caf | Python | 18,270 | 318 | #!/usr/bin/env python3
"""
File: visualise_results_bios.py
Created: 2021/11/09
Last Changed: 2022/03/25
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 s... |
40e111290044ec5611557ca60b3f2980ad8e359c93bc73e13f83a24ffb07a91e | Python | 18,271 | 383 | """Tigramite causal discovery for time series."""
# Author: Jakob Runge <jakob@jakob-runge.com>
#
# License: GNU General Public License v3.0
from __future__ import print_function
from scipy import stats
import numpy as np
import sys
import warnings
from tigramite.independence_tests.independence_tests_base import Con... |
62a940c0ddff5889c65a73789204474752c442d33a8b6c5cd31a20e834d5ab87 | Python | 18,276 | 537 | """Template-aware configuration models for file sources."""
import logging
from datetime import (
datetime,
timezone,
)
from typing import (
Annotated,
Any,
Generic,
Literal,
TYPE_CHECKING,
TypeVar,
)
from pydantic import (
BaseModel,
BeforeValidator,
ConfigDict,
Field,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.