sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
80e91e10ab7b29058a45890fe36daa345408628a32f48d729dd8d65633bbacfd | Python | 9,015 | 287 | # Copyright (c) 2020 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 appli... |
1753748f3955f8d23adc7a6191774cf0926379a3d53c2fe231f49f656e0d6cc1 | Python | 9,016 | 286 | from __future__ import annotations
from collections.abc import Iterator, Mapping
from typing import Iterable, List, Literal, TypeVar, Union, overload
import more_itertools as itx
from snakebids.types import ZipList, ZipListLike
from snakebids.utils.containers import ContainerBag, MultiSelectDict, RegexContainer
T_c... |
b2db504558b7c3ce3d20314c4dc246f98aec6b13e9388d5223685c100bb124bc | Python | 9,017 | 270 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
from dataclasses import dataclass, field
import numpy as np
from omegaconf import II, MISSING, OmegaConf
from fairs... |
f16eee3968d6afa6cfe155d5790104abdc7cea1d632b3fdd799a42d91f882e50 | Python | 9,018 | 175 | # %%
import os
import numpy as np
import time
import h5py
import sys
from scipy.io import savemat, loadmat
import multiprocessing as mp
sys.path.insert(1, '../..') # the path containing "suns" folder
os.environ['KERAS_BACKEND'] = 'tensorflow'
# os.environ['CUDA_VISIBLE_DEVICES'] = '0' # Set which GPU to use. '-1' use... |
eadebc8eac6be0c35c38542e459f2a3f25c88ec0c0fd57484cac63f6f75d736a | Python | 9,022 | 248 | import geomstats.backend as gs
from geomstats.geometry.matrices import Matrices
from geomstats.geometry.spd_matrices import SPDMatrices
from geomstats.geometry.special_orthogonal import SpecialOrthogonal
from geomstats.geometry.symmetric_matrices import SymmetricMatrices
from geomstats.test.data import TestData
rand =... |
51c52b9158cd4246f613b682dbd4de66df2f5fb504e75ca7f39241d48b1aa7cc | Python | 9,023 | 155 | """v3.2a assay forecasts and v3.2b independent-study forecasts.
Fitting is offline in processing/. Continuous motif evidence comes from the
unchanged producer pipeline or an explicitly supplied fixed reference input.
"""
import math
import numpy as np
import polars as pl
from . import confidence
from .evidence impor... |
4a52f1fb8cc60d587a7ba608b616bdc1e7ae4d4999fb0dd3b46d3da0c0e80170 | Python | 9,025 | 285 | import click
import procspec
import json
from corgie import scheduling, argparsers, helpers
from corgie.log import logger as corgie_logger
from corgie.layers import get_layer_types, DEFAULT_LAYER_TYPE, str_to_layer_type
from corgie.boundingcube import get_bcube_from_coords
from corgie.argparsers import (
LAYER_HE... |
e818eef5941fdb56273cb7d370873e0afdbb6c85e854ea588b9da4ff023744fc | Python | 9,026 | 314 | #!/usr/bin/env python
# Copyright (C) 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""CLI module."""
import os
import re
import sys
import time
import warnings
from importlib import import_module
from pathlib import Path
from sys import argv, path
from click import (
Group,
argument,
... |
6d3b8d8ed0621971825f22702a116319acd5616486ea739841f170c087a593cb | Python | 9,031 | 257 | """
ModelAngelo hmm_search command.
Once you have already run model_angelo build_no_seq, this command
can help you search against a FASTA file that you provide.
You will need:
1) A ModelAngelo build_no_seq output directory, provide with --input-dir/--i/-i
2) A fasta sequence file to search, provide with --fasta-path/-... |
eb06ad665ec483200f106358f53440a0644db25dc5e16a772056fda7488cad08 | Python | 9,032 | 270 | # Copyright (C) 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from openfl.experimental.workflow.interface import FLSpec, Aggregator, Collaborator
from openfl.experimental.workflow.runtime import LocalRuntime
from openfl.experimental.workflow.placement import aggregator, collaborator
import sys
imp... |
5ed0136b1cc37a8de7061975d4be89d5bc9e9d688103f41a36930d41aa180c80 | Python | 9,035 | 242 | import threading
import random
from typing import Callable, Dict, List, Optional, TypeVar
import grpc
from overrides import overrides
from chromadb.api.types import GetResult, Metadata, QueryResult
from chromadb.config import System
from chromadb.execution.executor.abstract import Executor
from chromadb.execution.expre... |
d8f92ea7cfc64895bdd5e4db68caaee3add718315bcdf77b8541f8ab41ed6fa8 | Python | 9,035 | 210 | """Build the ``MACELES`` long-range-electrostatics anchor by instantiation.
Like the plain-``MACE`` anchor and unlike the trained one, this checkpoint is
initialised under a fixed seed and saved, not fitted. Training it would add a
dependency on the optimiser and on eight epochs of arithmetic without
exercising one ex... |
9c0f76e6db9a901302703be2f525a101c3757b84ba9798956838df36706986e6 | Python | 9,038 | 297 | """
Utilities for computing physically relevant properties of molecules
Source: https://github.com/ACE-KAIST/PIGNet/blob/main/dataset.py
"""
import random
from typing import Any, Dict, List
import numpy as np
from rdkit import Chem, RDLogger
from rdkit.Chem import Atom, Mol
from rdkit.Chem.rdMolDescriptors import Cal... |
54ac5e0d838be00548be1ea78de5027b791c7a20867adcd397e1fc76c9c19de4 | Python | 9,042 | 257 | import os
import sys
import glob
import h5py
import copy
from tqdm import tqdm
import time
import multiprocessing as mp
from functools import partial
import pickle
import torch
import warnings
from Bio.PDB.PDBParser import PDBParser
from Bio import BiopythonWarning
from .ResidueGraph import ResidueGraph
from .Graph im... |
8229e125e561e1a16291300320e545038dfa6860fbb9e30278149a3d1d522ed4 | Python | 9,042 | 236 | #!/usr/bin/env python3
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
from ppafm.ocl.AFMulator import AFMulator
from mlspm.graph import MoleculeGraph
from mlspm.utils import read_xyzs
# # Set matplotlib font rendering to use LaTex
# plt.rcParams.update({
# "text.usetex": True,
# ... |
4332712d9fff998c139d7f51d9a893c3edff6def79698d2c4306fc42a52a47bf | Python | 9,046 | 259 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import json
from typing import Dict
import numpy as np
import torch
from torch import nn
import torch.nn.functional as F
from... |
9848755dc38e652645c1c219b7c57d2088d735c067a4ed037622debdb7b52fba | Python | 9,050 | 267 | # -*- coding: utf-8 -*-
"""
Functions to facilitate task-based validation.
Created on Oct 25 2023
@author: Mohammad Torabi
"""
import matplotlib.pyplot as plt
import numpy as np
from nilearn import glm
from scipy import signal
from .dfc_utils import TR_intersection, rank_norm, visualize_conn_mat
###################... |
6a218e19e67f1cc3559bd072dfe67aa7d1356ddd10db94f307f11b53f0a62b31 | Python | 9,054 | 286 | """
Functions for running tasks at various schedules.
Author: Tal Eisenberg, 2021
"""
from datetime import datetime, time, timedelta
import threading
import logging
import functools
from collections.abc import Sequence
_log = logging.getLogger("Main")
_cancel_fns = {}
def schedule_func(thread_fn):
"""
Retu... |
b778228b58d85cee0af219433ab9bd3b2032ff62aed79a48dd6ec370a2d77dab | Python | 9,054 | 286 | """
Functions for running tasks at various schedules.
Author: Tal Eisenberg, 2021
"""
from datetime import datetime, time, timedelta
import threading
import logging
import functools
from collections.abc import Sequence
_log = logging.getLogger("Main")
_cancel_fns = {}
def schedule_func(thread_fn):
"""
Retu... |
a7b41a766ff21f9e792d45b0cf58f5d59b62aabe8f410238c2c89f7f4d87b3f4 | Python | 9,056 | 216 | """
This is the data preprocessing that should return
the .pt with the data to run the model
TO BE EXECUTED FROM MAIN FOLDER (relative paths)
This code is for generating the especial datasets
this is, datasets but leaving out positive data in both datasets
"""
import os
import pandas as pd
from scipy.sparse imp... |
d0054df0fd232648f0febe1da29e60536785949e122f693c48bb70208225de62 | Python | 9,062 | 193 | """The report a chunk pull request gets, which is about the corpus and not about the file.
Every assertion here is that a number is relative: a score that only exists because another chunk
reports the same clonotype, a value that is "new" only because no other chunk carries it. A report
computed from the file alone co... |
58ec6c35360b2800c3d7c1b645b0f61a8c7ad38523f283f64cfa72e0cc07a2c3 | Python | 9,071 | 275 | """
Writing image data to video files and images.
Author: Tal Eisenberg, 2021
"""
from pathlib import Path
import time
from datetime import datetime
from video_stream import ImageObserver, ImageSource
import imageio
import pickle
import queue
import threading
import json
from image_utils import convert_to_8bit
def g... |
6711d3c0200a7f34a6b58dad7bc7635c0c7975aba54665159827ac695f7a7610 | Python | 9,072 | 241 | """
This script run some motion correction (interpolation) on drifting recording and then run kilosort2.5.
This done using the ground truth motion vector or the estimated motion vector.
This also done for comparison on a non-drifting recording with same units and spiketrains.
"""
from configuration import *
import sc... |
820ff2455ce51db348f5ede4efd0b608c38af7501c3d37887310a78aa630869a | Python | 9,073 | 258 | # Copyright (C) 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import sys
import numpy as np
from openfl.experimental.workflow.interface import FLSpec, Aggregator, Collaborator
from openfl.experimental.workflow.runtime import LocalRuntime
from openfl.experimental.workflow.placement import aggregator... |
917b5cfa361a96dff9474c2af20f63095b9f052e4b532e9794dd41e45d49db79 | Python | 9,076 | 224 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Un... |
c0dc049096acdacb38193a95bc8c4883c80e74e9a1d63af92b343b11f7539be7 | Python | 9,076 | 282 | import argparse
import gcsfs
import nobrainer
import numpy as np
import os
import os.path as op
import pandas as pd
import tensorflow as tf
def label_y(x, y):
return x, tf.cast(y >= 0.5, dtype=tf.int32)
def main(
gcs_bucket,
job_name,
n_channels=3,
dataset_name="b0-tensorfa-dwiqc",
dataset_s... |
965e77792a2ccf3949f1087e11622f59f798271f81bffc87e05a0d5a4ce36337 | Python | 9,077 | 258 | """
ModelAngelo refine command.
If you already have a built model that you would like to refine using ModelAngelo
or if you have built poly-alanine chains that you would like HMM profiles for,
you can use this command.
You will need:
1) A PDB/mmCIF file with a built model, provide with --input-structure/--i/-i
2) A cr... |
7c1e9d01afa518153337a46fd9badf2aa970d00d162ad828c4a5380bafa4d85e | Python | 9,078 | 319 |
from PyQt5.QtWidgets import QVBoxLayout, QHBoxLayout, QGroupBox, QLabel, QCheckBox, QTabWidget, QWidget
from PyQt5.QtWidgets import QDoubleSpinBox, QSpinBox
from sleepy.gui.builder.customwidgets import CustomQSpinBox, CustomQCheckBox, CustomQDoubleSpinBox, Custom0To1DoubleSpinBox, CustomQColorPicker
from functools... |
51f1cc7ea254e07ef3fc3e0e53c5978455740ebf591fc509515510a85df2368c | Python | 9,081 | 259 | import numpy as np
import pytest
from pydfc import TIME_SERIES
def test_create_time_series():
# create a random data with 100 regions and 1000 time points
data = np.random.rand(100, 1000)
# create a random locs with 100 regions and 3 coordinates
locs = np.random.rand(100, 3)
# create a random nod... |
7d612cf75fd1d4adcd4daa32a3a458001cb74abc90d6d8c723dfbf001f9bb817 | Python | 9,083 | 323 | """
Implementation of dFC methods.
the parent dFC method class
Created on Jun 29 2023
@author: Mohammad Torabi
"""
from copy import deepcopy
import numpy as np
from ..dfc_utils import SW_downsample, visualize_FCS
################################# BaseDFCMethod class ####################################
"""
todo:
... |
1d0b375b77a020039076ea108e4d5902defe9d7c8a3c35d748861612f94f81b7 | Python | 9,090 | 222 | import os.path as osp
from itertools import repeat
import os, shutil, torch
import numpy as np
from torch_geometric.data import InMemoryDataset, download_url, extract_zip
from torch_geometric.io import read_tu_data
class TUDatasetExt(InMemoryDataset):
r"""An extended TUDataset from `Pytorch Geometric
<https... |
cea83cb66ed291e2819f19b984daa2cfed0778f954d977364194f0519b05e9ba | Python | 9,090 | 241 | from PymoNNto.Exploration.Network_UI.TabBase import *
from PymoNNto.Exploration.StorageManager.StorageManager import *
from PymoNNto.Exploration.Evolution.PlotQTObjects import *
def pol2cart(theta, rho):
x = rho * np.cos(theta)
y = rho * np.sin(theta)
return x, y
def cart2pol(x, y):
theta = np.arctan2... |
421b779ddbbb4b1ffc6a8d674fb7cd0321e4a9caca224689b14dec7e74f7d920 | Python | 9,092 | 202 | """The QC advisory counts, recorded and gated. `chunks/` is the data, so these are its quality signal.
`vdjdb qc` prints its per-rule counts and, until now, wrote them nowhere: an advisory that jumped from
209 rows to 2,000 on a chunk merge passed every gate and appeared only in a log line nobody diffs.
`--strict` fai... |
74c8557ffa8f163e4164f7f2262eb5cb9c7ee293b17502e9d5cc9e56b38c12c5 | Python | 9,094 | 250 | # 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
#
# Un... |
7653dfb66f5171a51c2fec59adacf55bd383275319091a3934b9445a9a1c554c | Python | 9,094 | 226 | # Copyright 2020-2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Experimental Envoy module."""
import logging
import sys
import time
import uuid
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from typing import Optional, Union
from openfl.experimental.workflow.federated im... |
ec6f17096ca3577dc3b1d9e00320f9174a8fda84d0562fe30455537bd8711340 | Python | 9,097 | 239 | import pytest
import numpy as np
import torch
import ase.build
from ase.calculators.singlepoint import SinglePointCalculator
from ase.stress import full_3x3_to_voigt_6_stress, voigt_6_to_full_3x3_stress
from nequip.data import AtomicDataDict, from_ase, to_ase
class TestASEDataParsing:
"""Test ASE data parsing fu... |
652dc1707de277be8f19d40c5b15dd3570a303663929008c25371e505e4d562e | Python | 9,102 | 350 | """Metrics to evaluate analysis outcomes.
"""
import numpy as np
__all__ = [
'mk_fnr', 'mk_absBetweenAssocRelError', 'mk_betweenAssocRelError',
'mk_betweenAssocRelError_cv', 'mk_meanBetweenAssocRelError',
'mk_betweenCorrRelError', 'mk_absBetweenCorrRelError',
'mk_weightError', 'mk_scoreError',
'm... |
f66aa72e73a4c12bdb83fc1c5226a027a0a4d38b5739f4e042be57fa4b1526af | Python | 9,103 | 172 | """The motif-metric gate: does it actually catch a regression, in both directions?
A gate that cannot fail is worse than no gate, because it reads as a passing check. Every test here
builds a metric frame by hand and asserts the gate's verdict on it, so none of them needs a build.
The committed baseline itself is che... |
956df23f43381153709adf260f4a4cb47b754b58c32f85f7049df975ad1537df | Python | 9,107 | 264 | import torch
import torch.nn as nn
import torchvision
import torchvision.transforms as transforms
import torchvision.datasets as dsets
import torch.nn.functional as F
import numpy as np
from torch.autograd import Variable
from torch.optim.lr_scheduler import LinearLR,StepLR,MultiStepLR
import math
#import keras
from to... |
2b75f9cc874cfaa7f3154e29f8b5880e213f4225dc6bc86c583286a13e2bb43c | Python | 9,124 | 282 | """Shared input validation for the inference module.
One home for the argument checks the permutation, bootstrap, and matrix tests
share, so every entry point raises the same `ValueError` for the same mistake.
The `tail` vocabulary is wider than inference, so it lives one level up in
`nltools.algorithms.validation`.
... |
1e4ce6d5ccb2c45a9c03f053c93cc379e5518dca3a1d6d899bde42a4eabb9682 | Python | 9,125 | 262 | # Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... |
747f4c0359cd2d5b84408f554288f73c7881f379461db3e6285f5998377a3b39 | Python | 9,129 | 169 | import math
import numpy as np
import time
from scipy import special
import h5py
from tuncat.run_TUnCaT import run_TUnCaT
import os
from scipy.io import loadmat
def generate_masks(network_input:np.array, file_mask:str, list_thred_ratio:list, dir_save:str, Exp_ID:str):
'''Generate temporal masks showing active neu... |
73d07c23b095d378791f2a68c9a7c1eb8caf079cfcb8e622e63d648276f90979 | Python | 9,130 | 299 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import torch
from typing import Optional
from fairseq.modules import (
LayerNorm,
MultiheadAttention,
ESPNETMultiHeadedAttention,... |
ce720d152c98ecfaff1f22fe47d1421a14bdc936baf0ec1727d3e28606742bf0 | Python | 9,131 | 175 | # %%
import os
import numpy as np
import time
import h5py
import sys
from scipy import sparse
from scipy.io import savemat, loadmat
import multiprocessing as mp
sys.path.insert(1, '../..') # the path containing "suns" folder
os.environ['KERAS_BACKEND'] = 'tensorflow'
# os.environ['CUDA_VISIBLE_DEVICES'] = '0' # Set w... |
6fa542156cd0f9412faf11590fd1978b386c55c383b624545258d27fe267bbfc | Python | 9,133 | 223 | '''
Demonstration of simultaneous analog input and output
pynidaqmx.mixed.AOandAI_sharedClock.py
Description:
This example demonstrates how to continuously run data acquisition (AI)
and signal generation (AO) at the same time and have the tasks synchronized
with one another. Note that a single DAQmx task c... |
1e2a8a24e55c3286a19c3484aac5b4ff2a6b5337feeb5eec120275d4f68e05e0 | Python | 9,138 | 328 | # code in this file is adpated from
# https://github.com/ildoonet/pytorch-randaugment/blob/master/RandAugment/augmentations.py
# https://github.com/google-research/fixmatch/blob/master/third_party/auto_augment/augmentations.py
# https://github.com/google-research/fixmatch/blob/master/libml/ctaugment.py
import logging
i... |
f7b4a9b4ed95b84740f1cd4448b5700afc07b10afb3ad8b56cd19cab14b2e6fc | Python | 9,144 | 232 | # Copyright (C) 2020-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
"""Collaborator tests module."""
from unittest import mock
import numpy
import pytest
from openfl.component.collaborator import Collaborator
from openfl.protocols import base_pb2
from openfl.utilities.types import TensorKey
@pytest.f... |
ca1178278ee28410d1dfbc50652ca8b1a8f50cb9fa9b44e8136efcf878f4747e | Python | 9,145 | 207 | from PymoNNto.Exploration.Network_UI.TabBase import *
class reconstruction_tab(TabBase):
def __init__(self, title='Reconstruction', recon_groups_tag='recon'):
super().__init__(title)
self.recon_groups_tag = recon_groups_tag
def add_recorder_variables(self, neuron_group, Network_UI):
... |
9e8533b6554fbff3eca04d9baa662e0dc8978248258a025b7c8d7ffd2ea056ab | Python | 9,146 | 141 | from qtpy.QtGui import QColor, QColorConstants, QPalette
ColorRole = QPalette.ColorRole
ColorGroup = QPalette.ColorGroup
Disabled = QPalette.ColorGroup.Disabled
Red = QColorConstants.Red
Black = QColorConstants.Black
White = QColorConstants.White
Blue = QColorConstants.Blue
dark = QPalette()
dark.setColor(ColorGroup... |
3542ee67606774146bcd66355faaf33eeb036d9e3f67e8674299d2abab623c91 | Python | 9,150 | 301 | import numpy as np
import pytest
import torch
import torch.nn.functional
from e3nn import o3
from mace.data import AtomicData, Configuration
from mace.modules import (
AtomicEnergiesBlock,
BesselBasis,
PolynomialCutoff,
SymmetricContraction,
WeightedEnergyForcesLoss,
WeightedHuberEnergyForcesSt... |
1dd4d353a1b2ab0122602b036471e4900e35e70ff4776b1d8c7ee6d842eb276c | Python | 9,153 | 252 | """Collinearity diagnostics for DesignMatrix: column correlations, VIF, and cleanup."""
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
from .utils import _copy_with, _get_data_columns, _is_generated_intercept
if TYPE_CHECKING:
from nltools.data import Adjacency
from ... |
c0a1ef5f7ff3b52806c19bd70625297c0b0349dea34495ca926e1c762c6aee1b | Python | 9,158 | 182 | """The VDJdb confidence score, as polars expressions.
Ported from ``py_src/ScoreFactory.py``, which built its score map with ``iterrows()`` over ~192k
rows and then evaluated it again per row with ``master_table.T.apply``. Every rule below is a
column-level expression instead, and the per-signature maximum is one wind... |
b47dafaf41a69d48c5d3a9d6f2a34aafbcb2ac92c8e19a6256434ba23df5092c | Python | 9,166 | 260 | import os
import sys
import glob
import h5py
import copy
from tqdm import tqdm
import time
import multiprocessing as mp
from functools import partial
import pickle
import torch
import warnings
from Bio.PDB.PDBParser import PDBParser
from Bio import BiopythonWarning
from .ResidueGraph import ResidueGraph
from .Graph im... |
5cf4617f76a1932ce9e9a9d1a0ea4450f7ac562cea4d6dbcf6d61553da8e824d | Python | 9,171 | 180 |
import time
import os
import torch
from torch.optim import Adam
from torch_geometric.data import DataLoader
import numpy as np
from torch.autograd import grad
from torch.utils.tensorboard import SummaryWriter
from torch.optim.lr_scheduler import StepLR
from tqdm import tqdm
class run():
r"""
The base script f... |
2b3c06b11a824c97ad4d12e3cefe6217b8f3eb668ebf85ce0a109bd218b4b1e2 | Python | 9,176 | 257 | import multiprocessing
import torch
import math
from torch.cuda.amp import GradScaler
from torch.distributed.elastic.multiprocessing import errors
from utils import logger
from options.opts import get_training_arguments
from utils.common_utils import device_setup, create_directories
from utils.ddp_utils import is_mast... |
4283e60c182172fe2879957b50fdd132da6da8d8ecc493b04f00ac87dbf95c1a | Python | 9,182 | 213 | import argparse
from math import ceil
from typing import Optional, Sequence
import pytorch_lightning as pl
import torch
from pytorch_lightning.callbacks import LearningRateMonitor, ModelCheckpoint
from torch.utils.data import ConcatDataset, DataLoader
import config
from data.dataset import Brats184, Brats313, Brats2... |
3077cf99380ca1511666978a5decc2123606deb49f7c62e8ea8f68e1680d4167 | Python | 9,193 | 247 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 13 14:26:13 2019
@ Modified by Hoseok Choi
author: Gao Huang, Zhuang Liu, Kilian Q. Weinberger, Laurens van der Maaten
Densely Connected Convolutional Networks
arXiv:1608.06993
(See https://github.com/flyyufelix/DenseNet-Kera... |
bf14cf65d285745b40604a95ddeddec51f9e2904102210b4ac23cb54b62d2469 | Python | 9,193 | 273 | import cc3d
import fastremap
import scipy
import torch
import torchfields
import numpy as np
def get_prewarp_mask(bundle, keys_to_apply, inv=False):
if inv == True:
raise ValueError("inv is not supported!")
prewarp_result = torch.ones(
(1, bundle["src"].shape[-2], bundle["src"].shape[-1]),
... |
581a812be5a342fd202c016713a0d3df71676a9f47b16ca8a6bcf033105fad4e | Python | 9,197 | 178 | #*----------------------------------------------------------------------------*
#* Copyright (C) 2024 ETH Zurich, Switzerland *
#* SPDX-License-Identifier: Apache-2.0 *
#* *
... |
6877a2eb011718b827a932e200c1a22e6964ad8fd74adc3a7b2ebee79219bdf8 | Python | 9,197 | 255 | import logging
import math
import numpy as np
from PIL import Image
from torchvision import datasets
from torchvision import transforms
from torchvision.transforms import InterpolationMode
from augmentation import RandAugmentCIFAR
# from augment import TrivialAugmentWide
logger = logging.getLogger(__name__)
cifar10... |
3b9ef8153f7392c9e5046a4da5ad02687c103d3c9e93946a7de10997fec8563f | Python | 9,200 | 196 | r"""
Edge Definitions
==============
In this tutorial, we will go through the different options you have to define edge templates, i.e. formulations of the
dynamics of signal propagation along the edges in a network.
As an example, we will use a model of :math:`N = 2` interconnected leaky integrator units, the evoluti... |
f84fd5853536e80fd08e2fac16b62cf06486fdf542f52f7249de1e3236498c4b | Python | 9,200 | 246 | from collections import OrderedDict
import torch.nn as nn
import torch.nn.functional as F
from model_angelo.models.bottleneck import Bottleneck
from model_angelo.models.common_modules import MultiScaleConv, Normalize
class InvertedRetinaFPN(nn.Module):
def __init__(
self,
block,
num_block... |
13d1b3f9c99645b15934be9b8f0fe89cd5de9a9dd97759420c0ba72c64583e61 | Python | 9,201 | 286 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import contextlib
from dataclasses import dataclass, field
from typing import Optional
from omegaconf import MISSING... |
46bd5e0cfbcd48e39dd6beabf843d4e8502ed80ceed84e8e581825d3ef514bd0 | Python | 9,203 | 243 | """
Bar visual feedback class
Kyuhwa Lee, 2015
Swiss Federal Institute of Technology (EPFL)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any ... |
644c301716bcbbf852b6ef2bb7f52e96614cd39faa41b8dd8dfd19e45c4f43b6 | Python | 9,204 | 247 | # Copyright 2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import hashlib
import logging
import os
import socket
import subprocess
import sys
import time
from pathlib import Path
import numpy as np
from openfl.federated.task.runner import TaskRunner
from openfl.utilities.path_check import is_directory_... |
3a738e66428cd1652e0cae3689024f6ca35d93cfdf63039f7b3cfd47a0148200 | Python | 9,215 | 253 | from itertools import product
from typing import Optional, Tuple, Dict
import torch
from sklearn.linear_model import LogisticRegression
def assign_labels(
spikes: torch.Tensor,
labels: torch.Tensor,
n_labels: int,
rates: Optional[torch.Tensor] = None,
alpha: float = 1.0,
) -> Tuple[torch.Tensor, ... |
573c5dfbccd050e8da0aaaa5c3f250cd96503334813d233f8840b5865715c44e | Python | 9,219 | 284 | # coding=utf-8
"""
Vocabulary helper class
"""
import re
import numpy as np
class Vocabulary:
"""Stores the tokens and their conversion to one-hot vectors."""
def __init__(self, tokens=None, starting_id=0):
"""
Instantiates a Vocabulary instance.
:param tokens: A list of tokens (st... |
0140f5a3d9302f468a32da70af9e839371f2693abf9a22e27b5a55ead203c7fa | Python | 9,222 | 226 | """`avg_num_neighbors` is a buffer, including on models pickled before it was.
It became a registered buffer with a declared `torch.Tensor` type so that
TorchScript could see it. `_load_from_state_dict` covers checkpoints loaded as
state dicts; these tests cover the other way MACE ships a model, which is a
`torch.load... |
676f4dd4724b1147957f45c816ced104530913d3da87c52e47c78c57a742e7c9 | Python | 9,222 | 286 | import os
import sys
sys.path.append("..")
import time
import numpy as np
import librosa
import scipy.io.wavfile as wav
import torch
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
from torch.utils.data import DataLoader
import torchvision
from torch.optim.lr_scheduler import StepLR,MultiStepLR... |
c4e4783744b7cf0abe4d9d8e353db72de7a1f9dfe30179ac24bbf1dc2553f5c6 | Python | 9,223 | 198 | import os
import collections
import yaml
from common.metadata_util import process_metadata
# Edit these.
PROJECT_FOLDER = '/path/to/sample-free-uncertainty-label-smoothing/'
DATA_FOLDER = '/path/to/safe_dataset/'
# No need to edit these.
TFRECORDS_FOLDER = DATA_FOLDER + "/tfrecords_safe_msmt"
OUTPUT_FOLDER = PROJ... |
1d42240a8bfba1cf7b9dfdade5a9e49b68e6e31b5e02cda7c6bbbdf2df405a60 | Python | 9,232 | 249 | #!/usr/bin/env python3
# limitations under the License.
"""
The 3D NEST transformer based segmentation model
MASI Lab, Vanderbilty University
Authors: Xin Yu, Yinchi Zhou, Yucheng Tang, Bennett Landman
The NEST code is partly from
Nested Hierarchical Transformer: Towards Accurate, Data-Efficient and
Interpretable... |
637f303eead6ffab2c1134d0056d2141ecf6a4d0e9f80a33666dba868ddfa542 | Python | 9,233 | 267 | # 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 appli... |
9cb9bbe487f5f1490e0f998f6c46402bb6039d8f9420484491acca3b949a20ce | Python | 9,233 | 277 | # Author: Guoqing Bao
# School of Computer Science, The University of Sydney
# Date: 2019-12-12
# GitHub Project Link: https://github.com/guoqingbao/Pathofusion
# Please cite our work if you found it is useful for your research or clinical practice
#%%
# from IPython import get_ipython
#%%
import os
# os.environ["CUD... |
946b26dd7972373c58942c58a26fe0bcae0dcd442e702b4593cbbdcedba498db | Python | 9,242 | 261 | """Tools to generate a Snakemake-based BIDS app."""
import argparse
import logging
import sys
from pathlib import Path
from typing import Any, Dict, List, Optional
import attr
import boutiques.creator as bc
import snakemake
from snakemake.io import load_configfile
from snakebids.cli import (
SnakebidsArgs,
a... |
2e89e9edb85301a73711f15731903adfd990776bedc8c1f8c5338f12d0de50f6 | Python | 9,246 | 255 | import logging
import os
from result_caching import store_dict
from sklearn.decomposition import PCA
from sklearn.linear_model import LinearRegression
import pandas as pd
import numpy as np
from tqdm import tqdm
from model_tools.activations.core import flatten
from model_tools.utils import fullname
from custom_model_to... |
49dc72d47f31f937c07a7c98db0a9d3bc6ae0a79169594b21578424d5061957c | Python | 9,252 | 289 | """Visualize a DesignMatrix as a heatmap, overlaid time courses, or a correlation matrix.
`DesignMatrix.plot` dispatches over `method` to `_plot_matrix`,
`_plot_timeseries`, and `_plot_corr`, mirroring `BrainData.plot`.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
import numpy as np
if T... |
54c1dd75fe9ab06d0582a7a4d82fa5fb3e440deec8889b76c5fbfd6810faddb2 | Python | 9,258 | 224 | import torch
from torch import nn
from .st_net import ST_Dis
from .df_utils import one_hot_add, one_hot_minus
from .rgcn import RGCN
class DisGraphAF(nn.Module):
def __init__(self, mask_node, mask_edge, index_select_edge, num_flow_layer=12, graph_size=38,
num_node_type=9, num_edge_type=4, use_bn=T... |
f373d8ce6bb63e9310ed158f1fab405ca8f07d277c1cff053d376c31ba1d1da9 | Python | 9,259 | 242 | import logging
from collections.abc import Callable
from colorsys import hsv_to_rgb
from itertools import pairwise
from pathlib import Path
import cv2
import numpy as np
from qtpy.QtCore import Qt
from qtpy.QtGui import QColor, QImage, QPainter
from qtpy.sip import voidptr
from idtrackerai import Session
from idtrack... |
41c6403a28994695933e42e375802902e7ef17b330d8ade4915f8e9d73c2dbbb | Python | 9,264 | 240 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
#
# This work is licensed under the Creative Commons Attribution-NonCommercial
# 4.0 International License. To view a copy of this license, visit
# http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to
# Creative Commons, PO Box 1866, Mountain ... |
28d9edc6dc7bd4a8cb70a3f47d306d99f9d27c30e27d5f10de667afc9fd04091 | Python | 9,265 | 220 | from __future__ import print_function
import tensorflow as tf
import numpy as np
import pandas as pd
from pandas import DataFrame as df
import os
import sys
from tensorflow.contrib.layers.python.layers import batch_norm as batch_norm
from sklearn.model_selection import train_test_split
# SET ENV
os.environ["CUDA_VISI... |
77d4a1fc3317a37d556b8da925564ee5d3ae2c1f3a0686f55405a39617b03168 | Python | 9,269 | 253 | import json
import logging
import pickle
from collections.abc import Iterable, Iterator
from itertools import pairwise
from pathlib import Path
from typing import Any
import numpy as np
from . import Blob, Fragment, GlobalFragment, conf
from .utils import deprecated, resolve_path
class GlobalFragmentsEncoder(json.J... |
ff86d1e9697cb28bdeaa575b16280b5bdfd89c6ac9ce69bf1ded75693aa0fd45 | Python | 9,274 | 265 | # 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 appli... |
8845dbff23f70ab1ec575657799025df720bde98a3d6526761239f4a1a6ee338 | Python | 9,277 | 176 | # %%
import os
import numpy as np
import time
import h5py
import sys
from scipy import sparse
from scipy.io import savemat, loadmat
import multiprocessing as mp
sys.path.insert(1, '../..') # the path containing "suns" folder
os.environ['KERAS_BACKEND'] = 'tensorflow'
# os.environ['CUDA_VISIBLE_DEVICES'] = '0' # Set w... |
8a884365f4cc1d0aff968d99e4e735484808b0d145bac454994215d0a746aa4f | Python | 9,278 | 275 | from typing import TYPE_CHECKING, Callable, Optional, TypeVar, Union
from chromadb.errors import (
BackoffError,
ConditionalWriteConflictError,
StaleReadError,
)
from chromadb.api.types import (
ConditionalCommitResult,
Document,
Embedding,
GetResult,
ID,
Image,
Include,
Met... |
4d4c7fae05fa8f13910df1d9e8c9e5b37c416e9aeb3b23cc6a53bef4ed49e3fd | Python | 9,296 | 315 | import numpy as np
from PymoNNto.NetworkCore.Network import *
from PymoNNto.NetworkCore.Behavior import *
from PymoNNto.NetworkCore.Neuron_Group import *
from PymoNNto.NetworkCore.Synapse_Group import *
from PymoNNto.NetworkCore.Analysis_Module import *
from PymoNNto.Exploration.HelperFunctions import *
from PymoNNto.... |
9040d7bd525c9eb0c6ccc63cf4e9c58e9384b27f72cecdf83f677ac01509036f | Python | 9,297 | 153 | import sys
from brian2 import *
from model.globals import *
from model.HH_equations import *
def create_group(parameters, name):
""" Universal function that creates a group of neurons according to input parameters
TODO: Need to add distance-based connectivity on the synapses i.e. in the _connect_ statement, {p... |
2c84611518c2b2823744b10a771ee207a69069da4b59ded744a6eba073e12c4c | Python | 9,311 | 212 | """
Detect trigger times (i.e., state transition / local wavefronts onsets)
by finding local minima preceding a prominent peak in the channel signals.
"""
import neo
import numpy as np
import quantities as pq
from scipy.signal import find_peaks
import argparse
from utils.io_utils import load_neo, write_neo, save_plot... |
b4eadc03a11cf5a69b11392cee071f7e38a0778a470ac4dc874524feaf5a0091 | Python | 9,321 | 204 | from layers import *
import tensorflow.compat.v1 as tf
#import tensorflow as tf
flags = tf.app.flags
FLAGS = flags.FLAGS
class Model(object):
"""
Model base class
"""
def __init__(self, **kwargs):
allowed_kwargs = {'name', 'logging'}
for kwarg in kwargs.keys():
assert ... |
d73763f38e53f62f09a381dc29da1257c11706a0182298fc2edd68fb02cc1eaa | Python | 9,322 | 240 | import numpy as np
import matplotlib.pyplot as plt
import copy
from scipy.io import loadmat
from sklearn.decomposition import PCA
from matplotlib.gridspec import GridSpec
from matplotlib.collections import LineCollection
from matplotlib import colors as mcolors
import matplotlib.patheffects as pe
def preprocess(dat... |
608509c43024690f8e97c6c05aea00be58730ad21133be492049caa2992ca801 | Python | 9,328 | 217 | from __future__ import annotations
import logging
import os.path
from result_caching import store_dict
from sklearn.metrics import top_k_accuracy_score, label_ranking_average_precision_score, log_loss
from sklearn.metrics.pairwise import pairwise_distances
from sklearn.preprocessing import label_binarize
from sklearn.l... |
20ee97f697cd5165da85f195f2ca8d5cc3952f3dc49a5abd419204366df1d9fe | Python | 9,329 | 260 | from typing import Dict, Optional, Tuple
from overrides import overrides
from hypothesis.stateful import (
initialize,
invariant,
rule,
run_state_machine_as_test,
)
import uuid
import logging
import os
import pytest
from chromadb.api import AdminAPI, ServerAPI
from chromadb.api.client import AdminClien... |
2bd4d12b0b6aaa10bb9fdb1b44358ad15a5d6a291862b75305bf41a111ce1c01 | Python | 9,333 | 173 | """Documents, a vocabulary and postings, with tf-idf weights.
Three tables. Long postings rather than a sparse-matrix format, because the consumer is polars or
duckdb and the query is a join, and because a format nobody has to decode is the one a downstream tool
will actually read.
Every id is assigned from a total o... |
e99f855a3b5681d29bc787372a877812fca90898fa7ae4390168aae0c379a65e | Python | 9,335 | 312 | import numpy as np
import time
#heating up the CPU
#for i in range(1000):
# temp = np.random.rand(10000, 5000)*np.random.rand(10000, 5000)+np.random.rand(10000, 5000)
t = np.float64
#for i in range(60):
for i in range(1):
measurements = []
steps = 1000
###########################################
... |
6b24521da7cddef4d1ae2660c5b3f8ef4ada5f73d14ce7df9e4c7db14f63ea5a | Python | 9,342 | 256 | ## similar to github.com/Michaelvll/DeepCCA main
import torch
import torch.nn as nn
import numpy as np
from linear_gcca import linear_gcca
from synth_data import create_synthData
from torch.utils.data import BatchSampler, SequentialSampler, RandomSampler
from models import DeepGCCA
# from utils import load_data, svm_cl... |
a3bf2cae5a0e82c40527275773c0cd25d9eca3978d969d3aefd3d84b781b4a1b | Python | 9,344 | 273 | import inspect
from typing import TYPE_CHECKING, Awaitable, Callable, Optional, TypeVar, Union, cast
from chromadb.api.types import (
ConditionalCommitResult,
Document,
Embedding,
GetResult,
ID,
Image,
Include,
Metadata,
OneOrMany,
PyEmbedding,
URI,
Where,
WhereDocum... |
c8a16e9b8949458f143efc55ddd198e4a0d346822d8567a0ea633b34e787f7ff | Python | 9,344 | 186 | """The token families, one function each, and the k-mer expansion they share.
A token is a prefixed string, so a consumer filters by family with a string comparison and needs no
second table. The prefixes are declared once in :data:`FAMILIES` and every function takes its prefix
from there, so a family cannot be spelle... |
163bb5f5a7dd95f75e539d674bd88c64fe1f4dd8381ccccee562babfbf92d721 | Python | 9,359 | 256 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import time
from collections import OrderedDict
from typing import Dict, List, Optional
import numpy as np
from fairseq.data i... |
034ca0acd18321b74ba09a1cfd26c9760a3e7919c0ff0521599e7b1983d8b39d | Python | 9,364 | 276 | # Copyright 2020-2025 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
import argparse
from defusedxml.ElementTree import parse as defused_parse
from lxml import etree
import os
import re
from pathlib import Path
import tests.end_to_end.utils.defaults as defaults
import tests.end_to_end.utils.exceptions as ex
... |
0849db212328d45e369eb3189c86dc919091a9a4fac640958eaadc2423e5c4c8 | Python | 9,367 | 223 | """The committed LAMMPS-export golden: how it is built, and how it is replayed.
The plain-TorchScript export format is itself slated for replacement, but the
*numbers* the exported artefact produces are what the replacement is measured
against, so they are frozen here.
The rule this module exists to satisfy
=========... |
b8cb7fc3b32d649c01d253f0f75419e2a3e035c4fd4ec4f4e1253e0d39ae1257 | Python | 9,370 | 244 | # 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 appli... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.