sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
72ee5e4c2a038e84700196ba839b0ab6ec1ba8259cd3fe8eee368a049e7d5918 | Python | 7,157 | 199 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source... |
f94bd24e5965eb96d0193e3ca916ed363036de2472562fdd158585bc0b75f48b | Python | 7,166 | 196 | import argparse
import os
import time
import random
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import numpy as np
from utils import Logger, mkdir_p, AverageMeter
from dataloader_segments import Dataset_training, Dataset_testing
from torc... |
f8ecd9f700686f3c5366b31335e74a24acca0820a47ab5d0b4ec8dba0c797ff3 | Python | 7,173 | 182 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/deepfashion2.py'
]
evaluation = dict(interval=10, metric='PCK', save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
... |
19f5b2be1dcdfdac21b16d073936e0c65c134c4394b503dfb635f31331696f3e | Python | 7,174 | 198 | # Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)
import pytest
from pytest import mark
import torch
import lightning as pl
from torchmdnet import models
from torchmdnet... |
16623bda3bca89cc9c6e8c7b45d29e39315ef29bd40e93e79102de930239753d | Python | 7,177 | 177 | import copy
import logging
import torch
import wandb
from torch import nn
from fedml_api.standalone.turboaggregate.TA_client import TA_Client
class TurboAggregateTrainer(object):
def __init__(self, dataset, model, device, args):
self.device = device
self.args = args
[train_data_num, tes... |
d6fff8e8461bcdc938b5b77257556e5d0dc833c883d8b702c8cf3398ddfd4aec | Python | 7,179 | 182 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/deepfashion2.py'
]
evaluation = dict(interval=10, metric='PCK', save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
... |
c58a6775428e86ecb7cad36e9bf1e0e24ad0903a2e82b564c373f6d87577e040 | Python | 7,180 | 183 | from torch.utils.data import Dataset, DataLoader
import pandas as pd
import numpy as np
import os
import torch
from torch.nn.utils.rnn import pad_sequence, pack_padded_sequence as pack_sequence, pad_packed_sequence as unpack_sequence
import pytorch_lightning as pl
from torchvision import transforms
from pl_bolts.tra... |
2169d94ef8a291ee487d6cbe665acf5d25b7340fc680b12cac45d96436964b5e | Python | 7,182 | 182 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/deepfashion2.py'
]
evaluation = dict(interval=10, metric='PCK', save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
... |
bb7271ac383a1d44e05fb878eea18c7d0d4934b021c9029556a7164678595390 | Python | 7,182 | 215 | # Copyright (c) OpenMMLab. All rights reserved.
# Code is modified from `Third-party pytorch implementation of i3d
# <https://github.com/hassony2/kinetics_i3d_pytorch>`.
import torch
import torch.nn as nn
from ..builder import BACKBONES
from .base_backbone import BaseBackbone
class Conv3dBlock(nn.Module):
"""Ba... |
5ab85b4df995de1fd0e9e8015399f754fa2efb269686d003bd6fee9527b56f4a | Python | 7,184 | 124 | import argparse
import argparse_types
import models_utils
import models.geography_weighted_model
import models.keras
import models.keras.linear_model
import models.keras.neural_network
import models.keras.geography_weighted_model_linear
import models.keras.geography_weighted_model_neural_network
import models.sklearn
i... |
0daf8928a5f8954188a94373074f516991c5255e59a37897cbf08ca85f4d29d3 | Python | 7,185 | 124 | import argparse
import argparse_types
import models_utils
import models.geography_weighted_model
import models.keras
import models.keras.linear_model
import models.keras.neural_network
import models.keras.geography_weighted_model_linear
import models.keras.geography_weighted_model_neural_network
import models.sklearn
i... |
2cd5f250277090dc9f0f634f853a821735b2c5ff8d5cf534e6cf81e56a03e4e3 | Python | 7,190 | 244 | import os
import sys
import numpy as np
from cell import *
from neuron import h
from commonutils import *
import pdb
import struct
import sys
h.Random().Random123_globalindex(1234)
h.load_file('stdgui.hoc')
pc = h.ParallelContext()
# set number of threads
pc.nthread(1, 0)
def save_and_update_weights(network_list,... |
8f0646d709376dfd7cae4dbc5d26896715c91b48c31747fc07383d7091dd4f2e | Python | 7,194 | 173 | import os
import pathlib
import tempfile
import unittest
from qiime2.sdk.usage import UsageAction
from ..replay import replay_provenance
from .test_parse import DATA_DIR
from .._usage_drivers import (
MissingPluginError, ReplayCLIUsage, _get_action_if_plugin_present,
)
class MiscHelperFunctionTests(unittest.Tes... |
2687b84c680d70b968afbb2e4a406f0cfdaebc572512a40c5d9d74d631360a16 | Python | 7,195 | 193 | from logging import getLogger
import numpy as np
import torch
from base.config import Config
from base.data.base_dataset import BaseDataset
logger = getLogger(__name__)
class UsleepEvalDataset(BaseDataset):
"""
Evaluation dataset returning complete recordings for USleep.
Unlike the training dataset wh... |
399ed7851006b2ec6b9daa32d07bfa6a5981eccd219a28935fc98c539e86817f | Python | 7,196 | 182 | import h5py
import psutil
import numpy as np
from pytest import mark
from os.path import join
from torchmdnet.datasets.mdcath import MDCATH
from torch_geometric.loader import DataLoader
from tqdm import tqdm
def test_mdcath(tmpdir):
num_atoms_list = np.linspace(50, 1000, 50)
source_file = h5py.File(join(tmpdi... |
dba7a5eaa19e1f00d111f0aa3a4c4e0c345cbbed211c29decc6f849e927686a8 | Python | 7,197 | 163 | # ----------------------------------------------------------------------- #
# Copyright (c) 2023, UChicago Argonne, LLC. All rights reserved. #
# #
# Software Name: Fast Autonomous Scanning Toolkit (FAST) #
# By: Argonne Na... |
7854d7b7baff268089aa62b973ea190afa866463a52fb13ec37f587298a71d57 | Python | 7,198 | 201 | # --------------------------------------------------------
# Fast/er R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Bharath Hariharan
# --------------------------------------------------------
import xml.etree.ElementTree as ET
import os
#import cPickle
import _pickle as cPickle... |
c8e0b41184d3b39925105e91216a401391bc57ca004992fe0b5eff56e7bbba67 | Python | 7,203 | 172 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from utils.utils_behavior_dataset import *
import utils.functions_ZZ_extraction as fct
df_summary = pd.read_csv('/network/lustre/iss01/wyart/analyses/mathilde.lapoix/SCAPE/summaryData.csv')
index = 18
fishlabel = df_summary... |
ca24076ac9beb89d0563a171ba2616ce3e723fb4f81e50d23f86d45920c5d0f4 | Python | 7,209 | 203 | # Copyright (c) OpenMMLab. All rights reserved.
import random
import warnings
import numpy as np
import torch
import torch.distributed as dist
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import (DistSamplerSeedHook, EpochBasedRunner,
Fp16OptimizerHook, ... |
b8d0c4edcc8cd6773f94953f5be76f3680e8d02fa78b4d477b5cce45afd00ba4 | Python | 7,211 | 186 | """Utility functions for daart package."""
import logging
import os
from daart.data import compute_sequence_pad, DataGenerator
from daart.transforms import ZScore
# to ignore imports for sphix-autoapidoc
__all__ = ['build_data_generator', 'collect_callbacks']
def build_data_generator(hparams: dict) -> DataGenerat... |
037ab509cf6310d225df45da98bd794bd708146c4dd1d11376cb81649a8985c6 | Python | 7,212 | 203 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
import warnings
from collections import OrderedDict
import numpy as np
from mmcv import Config, deprecated_api_warning
from mmpose.datasets.builder import DATASETS
from ..base import Kpt2dSviewRgbImgTopDownDataset
@DATASETS.regist... |
6722736caee1efaec2222ba59706326e505cbc55d6c77708509e2d904535d8f1 | Python | 7,216 | 184 | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch
from mmdet.core import bbox_overlaps
@mmcv.jit(derivate=True, coderize=True)
def isr_p(cls_score,
bbox_pred,
bbox_targets,
rois,
sampling_results,
loss_cls,
bbox_coder,
k=2,
... |
0b97c677d2a3935c3f2f64667ab14610292f1261c94fdecfe554f120f8653e06 | Python | 7,220 | 196 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
import warnings
from collections import OrderedDict
import numpy as np
from mmcv import Config, deprecated_api_warning
from mmpose.datasets.builder import DATASETS
from ..base import Kpt2dSviewRgbImgTopDownDataset
@DATASETS.regist... |
ef955e2a9c9df96da716aa04badccd3e94cf7c3a9278b89c3431498eb9d65cb3 | Python | 7,222 | 177 | """
Class + functions for making parameter trajectories for flystim stims.
Generally access this class using make_as_trajectory and return_for_time_t
"""
from scipy.interpolate import interp1d
import numpy as np
def make_as_trajectory(parameter):
"""Return parameter as Trajectory object if it is a dictionary."""... |
26e842c7deff821dc43e1f59ceed45d793981849fb6ee72d0403fb0b961051ed | Python | 7,226 | 216 | # =========================================================
# from 'mmdetection/configs/_base_/default_runtime.py'
# =========================================================
checkpoint_config = dict(interval=1)
# yapf:disable
log_config = dict(
interval=50,
hooks=[
dict(type='TextLoggerHook'),
... |
4aa37bb7c2938418a2270a3010f1372bbdcbeac67211dcb9f8630f50f66444e7 | Python | 7,226 | 161 | """General-purpose test script for image-to-image translation.
Once you have trained your model with train.py, you can use this script to test the model.
It will load a saved model from --checkpoints_dir and save the results to --results_dir.
It first creates model and dataset given the option. It will hard-code some... |
cf9c43a00202723111e0b3c9d06f8671116b60e07c894bf99e92be4247178c32 | Python | 7,226 | 192 | import argparse
import math
import os
import pandas as pd
import numpy as np
import torch
from torch import nn
from torch.utils.data import DataLoader
from cleft_dataset import CleftDataset, CleftDataModule, TrainTransform, EvalTransform
from cleft_nets import CleftClassification
from cleft_logger import CleftImage... |
2ff7b4aa8d99ecb546746a3b9e4fe3d1eac18a7f5aceba1e4300e9c2125bbe94 | Python | 7,227 | 183 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/deepfashion2.py'
]
evaluation = dict(interval=10, metric='PCK', save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
... |
b093d700baf38222ea103c7f7b64171d9a30fecc17cead1c2203780226d47a78 | Python | 7,227 | 183 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/deepfashion2.py'
]
evaluation = dict(interval=10, metric='PCK', save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
... |
58c99b10fdd4077bdecc46be098b712fdaaf876f689206d2c59007afd7d2cda9 | Python | 7,230 | 183 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/deepfashion2.py'
]
evaluation = dict(interval=10, metric='PCK', save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
... |
b77e10fbc757a0ff57f92ec50967ed66c92e51ca5212dee03b0042ef06fa8496 | Python | 7,230 | 183 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/deepfashion2.py'
]
evaluation = dict(interval=10, metric='PCK', save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
... |
40647d2afd917384afac0bd2d9784a857bca1ce91b203b1cbad4e82d2135f1f5 | Python | 7,231 | 165 | """General-purpose test script for image-to-image translation.
Once you have trained your model with train.py, you can use this script to test the model.
It will load a saved model from --checkpoints_dir and save the results to --results_dir.
It first creates model and dataset given the option. It will hard-code some... |
b45c4f7c5feb824d6378d07e3f785a711d23e34e106b59e1127965d708d1a174 | Python | 7,233 | 183 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/deepfashion2.py'
]
evaluation = dict(interval=10, metric='PCK', save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
... |
2df825c26bc4bd8068eec4828a5f200f6a634c628551e4932af0eb4d3d5b1d04 | Python | 7,234 | 194 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
import warnings
from collections import OrderedDict
import numpy as np
from mmcv import Config, deprecated_api_warning
from mmpose.datasets.builder import DATASETS
from ..base import Kpt2dSviewRgbImgTopDownDataset
@DATASETS.regist... |
3da64aa4841497c1d6823fca2e33e9dbe84c78d56dd357e07cc0131b9aacd801 | Python | 7,236 | 183 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/deepfashion2.py'
]
evaluation = dict(interval=10, metric='PCK', save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
... |
b732bdb66728765e16ae5a8af9e01df401f92ce23808d3505464bf94f02a1aa5 | Python | 7,238 | 237 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon May 8 00:17:28 2023
@author: Alex
"""
from sbi import analysis as analysis
from sbi import utils as utils
from sbi.utils.get_nn_models import posterior_nn
from sbi.inference import SNPE, prepare_for_sbi, simulate_for_sbi
import torch
import numpy as np... |
7939c3c6607de689c317afc65706170b9538b41f37f1fbba45ca8842e49da2cf | Python | 7,249 | 221 | import os
import os.path as osp
import numpy as np
import numpy.random as npr
import torch
import torch.distributed as dist
import torchvision.transforms as tvtrans
import PIL.Image
PIL.Image.MAX_IMAGE_PIXELS = None
import math
import json
import copy
import pickle
from multiprocessing import shared_memory
import time
... |
bafef9c1661812b0364dcb9e0d680b33874cb32bee85791e565c613c24b399d8 | Python | 7,252 | 169 | from GUI_and_data_processing.Create_GUI import *
from GUI_and_data_processing.Data_processing import *
from Root_Morales_lab_codes.FibPhoEpocAveraging import *
from Analysis_types.Whole_recording import *
from Analysis_types.Peri_events import *
from Root_Morales_lab_codes.FibPhoEpocAveraging_between_events import... |
e75ca0f069316c024c5914eec47bb62bf594a9bee714b83fd59cd68f04aa920d | Python | 7,252 | 226 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Callable, Optional, TypeVar, Union
from torch import Tens... |
7b03231effe0343ae7e774e9b811f9de47f8d2f522533f2ce4edeb98bda263de | Python | 7,253 | 158 | import jax
import jax.numpy as jnp
import numpy as np
from functools import partial
import haiku as hk
import utils
from transformer_hk import SelfAttnTransformer, CrossAttnTransformer
from einshape import jax_einshape as einshape
import dataclasses
import jax.tree_util as tree
def build_index_fn(demo_max_num, demo_nu... |
438dbaa803b4061bbc4dc2cd58df0f89b3b9f0386884fcc4d02cafc14ee116cd | Python | 7,256 | 213 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
import warnings
from collections import OrderedDict
import numpy as np
from mmcv import Config, deprecated_api_warning
from ...builder import DATASETS
from ..base import Kpt2dSviewRgbImgTopDownDataset
@DATASETS.register_module()
c... |
ab090bab8a3838b3537b6efff69a4f1440d4e88bde4fe2395f5aa0afeb63807c | Python | 7,259 | 248 | import string
from p4.tree import Tree
from p4.node import Node
class Aho(object):
def isTripletCompatibleWithSet(self, set, triplet):
list = []
list.append(triplet)
for t in set:
list.append(t)
return self.isListCompatible(list)
def isSetCompatible(self, set):
... |
7798aa546ac3688301bf284c72bab0a9b51f6b32de07f5ac4921726c4efdeb0f | Python | 7,261 | 157 | import csv
import strobelib
import numpy as np
import os
import re
import string
# defaults
DURATION_FILTER_MODE = False
MIN_DURATION = 0
CUMULATIVE_SIPS_MODE = False
DURATION_SIPS_MODE = False
BINNED_SIPS_MODE = False
TIME_BIN = 1
TIME_CUM_BIN_SIPS = 1
TOTAL_NUM_SIPS = False
PREF_INDEX = False
IMPOSS... |
0b085235ac27f06457db49b41a93177c54b55d67cae84ea31705180b30d2bd28 | Python | 7,262 | 191 | import logging
import os
import datetime
import numpy as np
# import theano
from keras import backend as K
from keras.callbacks import ModelCheckpoint
from sklearn.base import BaseEstimator
from sklearn.metrics import accuracy_score
from model.model_utils import get_layers
# theano.config.openmp = False
class Mode... |
ae20e3891ff3e7c64a0e44087434a0bd67a82674ba305eea955871ffa8831527 | Python | 7,291 | 139 | #!usr/bin/env python
#coding:utf-8
"""
@author: Haidong Zhang
@contact: haidong_zhang14@yahoo.com
@time: 2021/1/9 15:28
@project: MalariaDetection
@description:
"""
from keras.layers import * #For adding convolutional layer
from keras.layers import Dense, ZeroPadding2D, BatchNormalization, Activation ... |
f0edb800ac81ef389b6f11ab46640909ff1e2748a6951a72f13b134d40c658b8 | Python | 7,291 | 181 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
from typing import Any, Literal, Optional, Union
import torch
from torch import Tensor
from torch.distributions import Distribution
from torch.utils.tens... |
1d1a826274a6c833f0e5cff7a0661896aaa7c96f2e265b994b817955ccbf5a54 | Python | 7,292 | 201 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import copy
import os
import os.path as osp
import time
import warnings
import mmcv
import torch
import torch.distributed as dist
from mmcv import Config, DictAction
from mmcv.runner import get_dist_info, init_dist, set_random_seed
from mmcv.utils import ... |
160b5843df22bf8d2c112b0ea40d587a70ee1f71ecc746a292b70b903fd9fdb3 | Python | 7,301 | 176 | import matplotlib.pyplot as plt
import numpy as np
import grid_model
import matplotlib.gridspec as gridspec
import matplotlib as mpl
import shelve
import os
from neural_coding import _code_maker, load_spikes, rate_n_phase
dir_name = os.path.dirname(__file__) # Name of script dir
results_dir = os.path.join(dir_name, '... |
35c096bf2c67cc5c51294848fa6110d5bdabbd0036ec851e4e006f8701716185 | Python | 7,304 | 163 | import copy
import logging
import random
import time
import numpy as np
import torch
import wandb
from .utils import transform_list_to_tensor
class FedAVGAggregator(object):
def __init__(self, train_global, test_global, all_train_data_num,
train_data_local_dict, test_data_local_dict, train_dat... |
66f7e8263db8e62128005ccb24a33e3e9990ec30e4aeb914fdc1e811f46182d0 | Python | 7,311 | 238 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/shelf.py'
]
checkpoint_config = dict(interval=1)
evaluation = dict(
interval=1, metric='pcp', save_best='pcp', recall_threshold=500)
optimizer = dict(
type='Adam',
lr=0.0001,
)
optimizer_config = dict(grad_clip=None)
... |
fa33131d3246d6e60a489ce09521dfbcd14922dedcb7ccd4d0feecfbf1f2f5cd | Python | 7,311 | 238 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/shelf.py'
]
checkpoint_config = dict(interval=1)
evaluation = dict(
interval=1, metric='pcp', save_best='pcp', recall_threshold=500)
optimizer = dict(
type='Adam',
lr=0.0001,
)
optimizer_config = dict(grad_clip=None)
... |
9d172a90d399a47aa40712f55eb3cbd3778fe0c1e4e224d1b0858652cbd576ff | Python | 7,316 | 182 | import logging
import os
import click
import omegaconf
import torch
from omegaconf import OmegaConf
from aimnet.train import utils
_default_model = os.path.join(os.path.dirname(__file__), "..", "models", "aimnet2.yaml")
_default_config = os.path.join(os.path.dirname(__file__), "default_train.yaml")
@click.command(... |
3cc2814d6230bb758a40fecd47778d11e8fbc515f9b9323658ec10fa1adb266c | Python | 7,323 | 189 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import logging
import torch.nn as nn
from mmcv.cnn import ConvModule, constant_init, kaiming_init
from torch.nn.modules.batchnorm import _BatchNorm
from ..builder import BACKBONES
from .base_backbone import BaseBackbone
from .utils import InvertedResidual, l... |
9dc6e7505dff14cc783dd096a2155eb1d3799d4252b40d531daf9feec72ae01e | Python | 7,326 | 211 | # -*- coding: utf-8 -*-
"""
Created on Thu Oct 13 13:01:21 2022
@author: Daniel
"""
from phase_to_rate.neural_coding import load_spikes, rate_n_phase
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import os
import sys
import matplotlib as mpl
from mpl_toolkits import mpl... |
bc1cf6dc5bddcd2a8411e8efed7ac8dee42a7ceb04ea45de728fa7daa155982b | Python | 7,330 | 192 | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 16 15:00:46 2020
@author: Anandita
"""
''' This file generates data with uniform tuning curve centers and random stimulus values in a given period
in one dimension with periodic boundary conditions and then performs pca on this data.
The linear dimensio... |
5ba90de6626b8715dbe5c405addda212a2c509644f01a1cb656696c42c0b2856 | Python | 7,332 | 174 |
import logging
import os
import pickle
import tqdm
import torch.utils.data as data
from . import utils
from .dataset import StackOverflowDataset
logging.basicConfig()
logger = logging.getLogger()
logger.setLevel(logging.INFO)
client_ids_train = None
client_ids_test = None
DEFAULT_TRAIN_CLIENTS_NUM = 342477
DEFAULT... |
47336bbfea79cce1c20fb1401de338d732b69965e403c4308af86f064a2b3ba0 | Python | 7,342 | 148 | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 9 16:22:49 2021
@author: fhu14
Contains methods for loading feeds in for training
"""
#%% Imports, definitions
import os
from .h5handler import total_feed_combinator, compare_feeds
import pickle
from typing import Dict
#%% Code behind
def load_single_fold(s, top_level... |
da8244b780b21fd1ca06bb2e528fe34660930d0bcbba76ef6de7eaa072b54acd | Python | 7,345 | 167 | import logging
from pprint import pprint
import torch
from pybrid import utils, datasets, optim
from pybrid.models.hybrid import HybridModel
def main(cfg):
cfg = utils.setup_experiment(cfg)
datasets.download_mnist()
train_dataset = datasets.MNIST(
train=True,
scale=cfg.data.label_scale,
... |
ac25e7a87ba71b07844c63d987c878630b7fe088494c09af0f33d23bceafae16 | Python | 7,346 | 189 | import copy
import io
import subprocess
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from typing import Any, Dict, Generator, List
import numpy as np
import pytest
from sklearn.datasets import make_blobs, make_regression
from sklearn.metrics import accuracy_score
from .utils import find_... |
8ace54e86c312eb3987a00f4a86b33384ffe3ef9b1d0e68c367a3d7bbaac9a0a | Python | 7,349 | 208 | """ Keras metadata script """
import json
import os
import pydoc
import re
import warnings
warnings.filterwarnings("ignore",
category=FutureWarning,
module="keras.src.export.tf2onnx_lib")
os.environ["KERAS_BACKEND"] = "jax"
def _parse_docstring(docstring):
headers = []
lines = docstring.splitlines()... |
4924b0ba239b3b7723b657541ded08ebf0d063970174531c66ac8d3023ad9976 | Python | 7,352 | 221 | import os.path as osp
from collections import OrderedDict
import tempfile
import numpy as np
from mmpose.apis import (inference_top_down_pose_model, init_pose_model,
vis_pose_result, process_mmdet_results)
from mmpose.core.evaluation.top_down_eval import (keypoint_nme,
... |
ff172fd24065ec5748366071dc27603a98ccdb225f7d6baa2c7609e08e7c371a | Python | 7,356 | 240 | # ref: https://github.com/SivyerLab/pyCrafter4500
import platform
import time
import hid
from math import floor
def clamp(x, min, max):
if x < min:
return min
elif x > max:
return max
else:
return x
def make_dlpc350_objects():
"""
Returns a list of DLPC350 objects corres... |
2e279c1843273bd2c3e5d138a820e90a9a32ff02280d97c61fe5bf0b997eb414 | Python | 7,357 | 164 | import pathlib
import numpy as np
import pandas as pd
import matplotlib
import matplotlib.pyplot as plt
import seaborn as sns
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras import backend
from functions import *
from the_model import *
#fu... |
eb375bff59e406bda7e620f31653bed324011e8a07609e54a3f283b815b419c0 | Python | 7,357 | 274 | from typing import Union, Any, cast
from abc import ABC
from abc import abstractmethod
import eagerpy as ep
from ..devutils import flatten
from ..devutils import atleast_kd
from ..distances import l2, linf, Distance
from .base import FixedEpsilonAttack
from .base import Criterion
from .base import Model
from .base i... |
756f9c1e2a8b2f62e8ede93cf3f1c7369b663b04d0084b6bc765a031f6f8efd8 | Python | 7,374 | 176 | import matplotlib.pyplot as plt
import numpy as np
import grid_model
import matplotlib.gridspec as gridspec
import matplotlib as mpl
import shelve
import os
from neural_coding import _code_maker, load_spikes, rate_n_phase
dir_name = os.path.dirname(__file__) # Name of script dir
results_dir = os.path.join(dir_name, '... |
835d3e8a77cca55f698a6ddd3ac8838b18b1e50f08c376b0607ff1f1ccc68333 | Python | 7,377 | 202 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
import warnings
from collections import OrderedDict
import numpy as np
from mmcv import Config, deprecated_api_warning
from mmpose.datasets.builder import DATASETS
from ..base import Kpt2dSviewRgbImgTopDownDataset
@DATASETS.regist... |
33ddb4828d49050f99253c54172a7a125733a07fbbcb5be8de3744d9f4beab2e | Python | 7,382 | 183 | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import torch
import torch.nn as nn
from mmcv.cnn import Conv2d, Linear, MaxPool2d
from mmcv.runner import BaseModule, force_fp32
from torch.nn.modules.utils import _pair
from mmdet.models.builder import HEADS, build_loss
@HEADS.register_module()
clas... |
11b92b00aa347cc2de83724de58c9b663758a9cf178aade301f43408fd296ad4 | Python | 7,383 | 208 | # Copyright 2013 Graham McVicker and Bryce van de Geijn
#
# 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 la... |
592572a57c19dc9c4b1ba5893c5603852619cb516e8a3b4a99016dd37ac717a6 | Python | 7,395 | 216 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
import warnings
from collections import OrderedDict
import numpy as np
from mmcv import Config, deprecated_api_warning
from ...builder import DATASETS
from ..base import Kpt2dSviewRgbImgTopDownDataset
@DATASETS.register_module()
c... |
8e0892387e5e66f2aa4633a2f1e4f6f470e74013204b313dee5704a354503f1d | Python | 7,403 | 247 | #!/usr/bin/env python3
# Copyright 2021 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""Test code for HiFi-GAN modules."""
import logging
import os
import numpy as np
import pytest
import torch
import yaml
from test_parallel_wavegan import make_mutli_reso_stft_loss_args
import parallel_waveg... |
6610c422b369a56e07d7bfa7fb4e86789567fdfebbf9f08a0f808d2a7ac4a9b7 | Python | 7,410 | 195 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 25 14:47:37 2021
@author: baris
"""
import seaborn as sns, numpy as np
import matplotlib.pyplot as plt
import glob
import pandas as pd
from scipy.stats import pearsonr, spearmanr
import os
#75-74.5-74-73.5
#73-72.5-72-71.5
#71-70-65-60
def all_s... |
e9548b1ae163ae4c2a3eeda90a28967ef629e9336474b90e967b50b2e8c21527 | Python | 7,420 | 233 | import matplotlib
matplotlib.use('agg')
import h5py
import numpy as np
import os
import matplotlib.pyplot as plt
from PIL import Image
def normalize_data(realdata, syndata):
new_syndata = []
for i in range(3):
realdata_ch = realdata[i]
syndata_ch = syndata[i]
mean_ref = realdata_ch.mea... |
916f5d920e5e4f7c27d5d61c401a850524da78572450c205269122e61ce8d3da | Python | 7,429 | 206 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
"""Builders for density estimators over mixed continuous and discrete data.
The conditioning variable ``y`` is z-scored and embedded here, then concatena... |
fe35f515fb93640a38f7c5b9d47ca149a5991abf82fb36260e5baa50f487b29f | Python | 7,435 | 223 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""Setup features for voice conversion."""
import argparse
import logging
import os
import numpy as np
import yaml
from tqdm import tqdm
from parallel_wavegan.datasets import AudioDat... |
68afd83f7aaa5f495bdd214d96b751f275d5ef554d9c1912326ffcc90e17822b | Python | 7,441 | 241 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/campus.py'
]
checkpoint_config = dict(interval=1)
evaluation = dict(
interval=1, metric='pcp', save_best='pcp', recall_threshold=500)
optimizer = dict(
type='Adam',
lr=0.0001,
)
optimizer_config = dict(grad_clip=None)
... |
a62450674af598323d85588edf2df544d0132370dd4781ee4e5a5b54c338c789 | Python | 7,442 | 242 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/campus.py'
]
checkpoint_config = dict(interval=1)
evaluation = dict(
interval=1, metric='pcp', save_best='pcp', recall_threshold=500)
optimizer = dict(
type='Adam',
lr=0.0001,
)
optimizer_config = dict(grad_clip=None)
... |
63abe855c1c749899333436f4bec927fc1ce1fce4de050227afec9f38cc60173 | Python | 7,444 | 172 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 7 19:02:56 2021
@author: fhu14
"""
#%% Imports, definitions
from MasterConstants import Model, RawData
from typing import List, Dict
import numpy as np
Array = np.ndarray
import torch
Tensor = torch.Tensor
#%% Code behind
class Input_layer_hubbard:
def __init_... |
ae0134708403a69c031467369d757f6b70bbce36e8fd366e449f4ab9fdc1067e | Python | 7,444 | 193 | #!/usr/bin/env python
from os import path
import sys
import pandas as pd
from math import ceil
from joblib import Parallel, delayed
from picrust2.util import system_call_check, TemporaryDirectory
def castor_hsp_workflow(tree_path,
trait_table_path,
hsp_method,
... |
9c1286f88a92ea94a3ebb1b694a3916129bbf8e330f88b30822d7940fd3a3168 | Python | 7,451 | 234 | import numpy as np
import pandas as pd
import os.path as path
import os
from simple_mlps.model_ibs.ibs import retrieve_brier_scores, make_struc_array
from sksurv.metrics import concordance_index_censored
import scipy.stats as statspkg
import statsmodels.api as sm
import itertools
DATA_DIR = "/data2/MRI_PET_DATA/predic... |
55c652ba707e1c55dc5e646222febbf34745a9807ff34e6bacb8107233b0095f | Python | 7,453 | 219 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
"""Scale-equivariance regression tests for composed FMPE/NPSE standardization.
Without composition, parameters at scale 1e-5 show inflated posterior widt... |
f15e0702521eb0c6b0da8825cf1c61fc49957dbd455a18cb4977d7e988b7b896 | Python | 7,454 | 248 | """
The 3D resnet portion is the same as the old resnet_nlst76.py
Adapted from Chen et al. Med3D
YL
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
__all__ = [
'ResNet', 'resnet10', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
're... |
196d52be4b2ecd390ae8a214ea0dc331a261a734e5ca4b297f299a553368a0a7 | Python | 7,458 | 189 | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch.nn as nn
import torch.nn.functional as F
from ..builder import LOSSES
from .utils import weighted_loss
@mmcv.jit(derivate=True, coderize=True)
@weighted_loss
def quality_focal_loss(pred, target, beta=2.0):
r"""Quality Focal Loss (QFL) is fr... |
6da2f349bdee69554c5bdffb92819a21e3e33628d5bd1cd0b1593394a4537bdb | Python | 7,464 | 193 | import os
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
from .lending_club_feature_group import all_feature_list, qualification_feat, \
loan_feat, debt_feat, repayment_feat, multi_acc_feat, mal_behavior_feat
target_map = {'Good Loan': 0, 'Bad Loan': 1}
grade_map = {'A':... |
11f36f959faa4c1add4eede4edfe35933fdb6db45011b5498452af369db824c6 | Python | 7,471 | 205 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
import warnings
from collections import OrderedDict
import numpy as np
from mmcv import Config, deprecated_api_warning
from mmpose.datasets.builder import DATASETS
from ..base import Kpt2dSviewRgbImgTopDownDataset
@DATASETS.regist... |
3b4ce4cf4616c66b35ca9c6890f1056ae865e2d4e7a2685f6e7e4c370a5563d3 | Python | 7,472 | 183 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import warnings
import numpy as np
import torch
from mmdet.core import bbox2result
from mmdet.models import BaseDetector
class DeployBaseDetector(BaseDetector):
"""DeployBaseDetector."""
def __init__(self, class_names, device_id):
... |
b153ff7524f3193c7b3708a61549a64a960b7e9dd7560570d8c7a5c8c33fc0ac | Python | 7,483 | 224 | # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source... |
f61a07ef72e24ad6bb08d148c5a43ae69ac5e8491bbb90612304c8c2593e7a9c | Python | 7,486 | 226 | # Copyright (c) OpenMMLab. All rights reserved.
import os
import warnings
from argparse import ArgumentParser
import cv2
import mmcv as mmcv
from mmpose.apis import (collect_multi_frames, inference_top_down_pose_model,
init_pose_model, vis_pose_tracking_result)
from mmpose.core import Smoothe... |
4e32a39fc5489fbadc438a8ca501f559648bba7f48e432e868106f8fb7301ce1 | Python | 7,494 | 222 | # Copyright (c) OpenMMLab. All rights reserved.
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from ..builder import BACKBONES
from ..utils import ResLayer
from .resnet import BasicBlock
class HourglassModule(BaseModule):
"""Hourglass Modu... |
f84d8edeba0163f168ce945b6ca84e50b5d0554db3c7c974b2e6658b74a75126 | Python | 7,495 | 215 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
import warnings
from collections import OrderedDict
import numpy as np
from mmcv import Config, deprecated_api_warning
from ...builder import DATASETS
from ..base import Kpt2dSviewRgbImgTopDownDataset
@DATASETS.register_module()
c... |
c9c68ddf2346fdc0d54081d748bd8182e159092b1ed73468fff060df8fa2d4c5 | Python | 7,497 | 142 | import argparse
import os
import torch
from pytorch_lightning import Trainer
from pytorch_lightning.loggers import TensorBoardLogger
from torch import nn
from torch.utils.data import DataLoader
from selbstaufsicht import datasets, models
from selbstaufsicht.datasets import rna_ts_label
from selbstaufsicht.models.self... |
9c4a33adf34a2ccdd54141d2556d998c1f4edf8d6f30a30975034ae507a2f149 | Python | 7,499 | 192 | import torchvision
from torchvision.models.detection.faster_rcnn import FastRCNNPredictor
from .dataset import ScaleBarDataset
from .engine import train_one_epoch, evaluate
from PIL import Image, ImageDraw
from . import utils
import torch
from torch import optim
import torchvision.transforms as T
import skimage as io
i... |
a4507a1a5bfd9ab16980199e88204cc1be865b96181060f1ea311a8c7bdd2b67 | Python | 7,499 | 236 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
from __future__ import annotations
import pytest
import torch
import torch.distributions as dist
from sbi.diagnostics.misspecification import (
calc... |
6fbb3df03addb5fbdb6a8befbcb1f312239c32f133565aac103f4046b45d7578 | Python | 7,502 | 208 | # Copyright (c) 2023 IBM Research. All Rights Reserved.
#
# Code accompanying a manuscript entitled:
# "On the visual analytic intelligence of neural networks"
import os
import math
from random import randint, uniform
import numpy as np
from geometry import Line, Point
def create_dirs(dirs):
for dir in dirs:
... |
8dac12099894614256e3298935854608e8c40829dfe0dce408b900011e92ac22 | Python | 7,510 | 242 | import torch
from torch import nn
from torch.nn import functional as F
from torch.autograd import Variable
import torch.utils.data
import torch.utils.data.distributed
F_conv = torch.nn.functional.conv2d
class AdaFM_fc(nn.Module):
def __init__(self, in_channel):
super().__init__()
self.gamma = nn.... |
c98ed38ac67813bb0a2c88d1c7310a313a6d657cbc3498f4f4e18af62d1f9bc1 | Python | 7,517 | 151 | """Plot the decodability of the pure inputs in various baseline models.
The used baselines are
1. linear decoding,
2. k-means clustering,
3. Slow Feature Analysis,
4. A predictive coding network trained on the static input images
Example:
$ python train.py --data smallnorb_extended.npy --labels... |
36c7c1d4e4bf5057b599f9f1e95e07155007a7b1d93aa486d3d6c0669c9bece0 | Python | 7,519 | 190 | import pickle
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import matplotlib.gridspec as gridspec
from absl import app, flags, logging
import sys
sys.path.append('../')
from jax.config import config
import tensorflow as tf
import os
os.environ['XLA_PYTHON_CLIENT_PREALLOCATE']... |
1b76e56b9ba85c0d439f12473b48e235764e7c228aac7e6ad35df84424e2ad98 | Python | 7,520 | 207 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
import warnings
from collections import OrderedDict
import numpy as np
from mmcv import Config, deprecated_api_warning
from mmpose.datasets.builder import DATASETS
from ..base import Kpt2dSviewRgbImgTopDownDataset
@DATASETS.regist... |
3d17fd925a3c82af8967298128fc6929375eb3f625394995675b4822288990dd | Python | 7,538 | 185 | import numpy as np
import jax.numpy as jnp
import jax
from einshape import jax_einshape as einshape
import pickle
from functools import partial
import os
os.environ['XLA_PYTHON_CLIENT_PREALLOCATE'] = 'false'
import sys
sys.path.append('../')
sys.path.append('../data_preparation/')
sys.path.append('../data_preparation... |
5802932e6803af21688fd4def3cefdbb83be78f002c73a26dace96c1e4c35e7a | Python | 7,538 | 195 | import logging
import torch.utils.data as data
import numpy as np
import h5py
import os
# import scipy.ndimage as ndimage
from .data_utility import init_transform, count_samples, build_pairs, build_pairs_complete
logging.basicConfig()
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def get_transforms()... |
570225803ef286e91dde63475017e45866231529736d5f66e643d70f8d100ed1 | Python | 7,542 | 195 | import logging
import torch.utils.data as data
import numpy as np
import h5py
import os
# import scipy.ndimage as ndimage
from .data_utility import init_transform, count_samples, build_pairs, build_pairs_complete
logging.basicConfig()
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def get_transforms()... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.