sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
5dee2410085e5d16f582d87e23ecef64a8f87cd373af429d3eb0f9725b088444 | Python | 3,531 | 117 | import pickle
from os.path import join
from pathlib import Path
import pyro
import torch
from pyro import distributions as pdist
with open(
join(
Path(__file__).parent,
"files/features_selection_D2_highestOverlap_seed10_dim10.npz",
),
"rb",
) as fh:
design_matrix = torch.as_tensor(pick... |
353fc7f2be71fa4d0a4af56e8de6d0879a8a97db8d0f795e8f5c9e8ac4952cde | Python | 3,532 | 119 | # Copyright (c) OpenMMLab. All rights reserved.
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup -----------------------... |
e34ba14e2f248b0e5dec839400460b0730dc89c3a875d9b6e7c057a614b32196 | Python | 3,533 | 93 | import numpy as np
import matplotlib.pyplot as plt
from scipy.stats import vonmises
import scipy.special as sp
from scipy.stats import circmean as cm
from scipy.stats import circvar as cv
def calculate_preferred_and_selectivity(rate,stimuli):
R = np.sum(rate*np.exp(2j*stimuli))/np.sum(rate)
preferred_stimulus ... |
d8bc91d7f242528f8274ba617cb1510fcbeb44f0f0745765fe0436bdab8d186a | Python | 3,534 | 117 | # libs to help us track memory via sampling
import numpy as np
import tracemalloc
from time import sleep
import matplotlib.pyplot as plt
# sampling time in seconds
SAMPLING_TIME = 0.001
class MemoryMonitor:
def __init__(self, close=True):
# start tracemalloc and sets
# measurement atribut... |
bbf3be31e7d5544d43d2d6cf56ab96933c174187c54b4231ce89e4f2dc75f846 | Python | 3,536 | 94 | # Copyright (c) OpenMMLab. All rights reserved.
# This script consists of several convert functions which
# can modify the weights of model in original repo to be
# pre-trained weights.
from collections import OrderedDict
import torch
def pvt_convert(ckpt):
new_ckpt = OrderedDict()
# Process the concat bet... |
a9c3b33b1c57dc334c7f32f95a05b7571e732e7ca073acc51910a615bd4a829f | Python | 3,544 | 77 | #!/usr/bin/env python3
import os
import numpy as np
from python.calc.psf import save2hdf5
def main(args):
out_file = os.path.basename(args.out_file)
out_path = os.path.dirname(args.out_file)
# determine input data type
if os.path.isfile(os.path.join(args.in_file, 'Index.ref.xml')):
if args.... |
5faea502b554967f016e8e9f924e09bdcf05cb54a873b8ca21496ee5035f81dc | Python | 3,545 | 93 | import numpy as np
import collections
word_dict = None
word_list = None
_pad = '<pad>'
_bos = '<bos>'
_eos = '<eos>'
'''
This code follows the steps of preprocessing in tff shakespeare dataset:
https://github.com/google-research/federated/blob/master/utils/datasets/shakespeare_dataset.py
'''
SEQUENCE_LENGTH = 80 #... |
35e913525045f19e347db12b8aa79320150b038257fc639836f55cd2320888c9 | Python | 3,546 | 124 | # Copyright (c) OpenMMLab. All rights reserved.
_base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/nvgesture.py'
]
checkpoint_config = dict(interval=5)
evaluation = dict(interval=5, metric='AP', save_best='AP_rgb')
optimizer = dict(
type='SGD',
lr=1e-1,
momentum=0.9,
... |
699d39be90b8a8f73f760db5479f7fb78327ac3baf68f69dc428302f7f633b45 | Python | 3,547 | 112 | # -*- coding: utf-8 -*-
"""
Created on Mon Jan 17 10:09:58 2022
@author: daniel
"""
import shelve
import os
from tempotron.main import Tempotron
import numpy as np
import matplotlib.pyplot as plt
import sqlite3
import sys
import multiprocessing
import argparse
import uuid
"""Parse Command Line inputs"""
pr = argpars... |
c1f3ceaf04753362076f6b61d0f2000d7f8b82f306905f0ee8cbc55cf8aff3bf | Python | 3,548 | 78 | import torch
from torch import nn, Tensor
def sur_loss(preds, obss, hits, bins=Tensor([[0, 24, 48, 108]])):
bin_centers = (bins[0, 1:] + bins[0, :-1])/2
survived_bins_censored = torch.ge(torch.mul(obss.view(-1, 1),1-hits.view(
-1,1)), bin_centers)
survived_bins_hits = torch.ge(torch.mul(obss.vi... |
b14654bef6a83ed5aaccadc67069f9227f985492a11f48f16f454e28bf41f1f9 | Python | 3,551 | 100 | # Copyright (c) OpenMMLab. All rights reserved.
from mmcv.cnn import ConvModule, Linear
from mmcv.runner import ModuleList, auto_fp16
from mmdet.models.builder import HEADS
from .fcn_mask_head import FCNMaskHead
@HEADS.register_module()
class CoarseMaskHead(FCNMaskHead):
"""Coarse mask head used in PointRend.
... |
6bb747110e698e512c9a092c5ee50415b8001a0cb35e01de00c6d76a67eff422 | Python | 3,552 | 105 | import logging
import numpy as np
from PIL import Image
from torchvision.datasets import DatasetFolder
logging.basicConfig()
logger = logging.getLogger()
logger.setLevel(logging.INFO)
IMG_EXTENSIONS = ('.jpg', '.jpeg', '.png', '.ppm', '.bmp', '.pgm', '.tif', '.tiff', '.webp')
def accimage_loader(path):
import ... |
4518187404fa78c526af25e8392fe87c39f821c4d6bb317df1fbd535b7359a4e | Python | 3,553 | 106 | # 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 torch
from torch import Tensor
from typing import Tuple
from torchmdnet.extensions.warp_ops.neighbors import wa... |
d16502f7911f8adba0348f092afd246c66fa774d713a65e06a1a16fad02afbc4 | Python | 3,556 | 59 | import numpy as np
def get(model, search, param_grid, selected_features_names): #,nPeggedLeft, nPeggedRight, nIterationOuterLoop):
if model == 'LassoCV':
hyperParams = 'alpha' + ':' + str(search.alpha_)
hyperParamsGrid = 'Automatic'
coefFit = ';'.join(
[i + ':' + str(round(j, 3)... |
64fc8cddea0118b192badb45384ee24560be399a61a84419fd51a422dffdc446 | Python | 3,559 | 91 | import argparse
import typing
import argparse_types
from models.abstract import ModelClassMetaData
from models.keras import KerasModel, KerasModelMeta
# Import bez importu :)
if False:
import tensorflow.keras as keras
class NeuralNetworkMeta(KerasModelMeta):
def define_parameters(cls, parser: argparse.Argu... |
c6fb8be84a26f26d5f516a45f621ebf039c5bf96df70f1502b88da18eefdbe88 | Python | 3,562 | 131 | from abc import ABC, abstractmethod
import pytest
import numpy as np
from eeg_ltt.ltt import (
BonferroniCorrection,
CLTMajorityVoteRCP,
CLTPoolingMajorityVoteRCP,
RiskControllingPrediction,
accuracy,
false_alarm_rate,
)
class BaseTestRCP(ABC):
@abstractmethod
def rcp(self) -> RiskC... |
feb652fd8bb84eb0e1433a087bfef6630cb7d8fdc29d727e045dfa95eb95a2d4 | Python | 3,569 | 99 | import numpy as np
from nengo.dists import Choice, Uniform, DistributionParam
from nengo.params import FrozenObject, TupleParam
from nengo.utils.compat import range
class Gabor(FrozenObject):
"""Desribes a random generator for Gabor filters."""
theta = DistributionParam('theta')
freq = DistributionParam... |
acf12fdc474dff0335406d582f4bd9886a810f6ac29f20ccb7708a5d5fdcfbeb | Python | 3,573 | 81 | from __future__ import annotations
from dataclasses import dataclass
from typing import BinaryIO, Iterable, Optional, overload, Literal, Union
from pydapsys.page import DataPage, TextPage, WaveformPage
from pydapsys.read import read_from
from pydapsys.toc.entry import Root, Stream, StreamType
from pydapsys.toc.except... |
7a55d97f2af9318478856d0e621c816529f2475d7c80bc8b7d6578ceaa653fad | Python | 3,574 | 78 | import torch as th
import numpy as np
import scanpy as sc
import scipy as scp
from sklearn.model_selection import train_test_split
from latentvelo.utils import normalize, sparse_mx_to_torch_sparse_tensor
class ATACDataset(th.utils.data.Dataset):
def __init__(self, adata, batch_size, shuffle=True, test=0.1, rand... |
924cf29dbd66e9e80875fef263878aa5cd4e16401b1a3030e5f27fa9fb8d6203 | Python | 3,577 | 119 | """
Simulate pydentate with grid cell inputs on linear trajectories.
This is one of the most computationally intensive steps as it generates
all the raw data that is used for the perceptron, tempotron as well as
CA3 analysis. It allows for reproducibility through a variety of seeding
steps.
"""
import shelve
import c... |
cf73ca55ca158a03499aed97919a15a86ccfd7374293aeb4bdb6329612c56873 | Python | 3,577 | 115 | import textwrap
import time
from .logger import logger
from .stats import TrimmingStats
from typing import TYPE_CHECKING, Optional
if TYPE_CHECKING:
from .files import FileFormat
from .helpers import SeqType
from .modes import AmbiguityHandling, TrimmingMode
from .stop_codons import StopCodonMaskingSt... |
1b091bd643281b443263e2725c46d26e52f60686520d3d01aca2bf2c0f07e16d | Python | 3,578 | 104 |
import logging
from tensorflow.keras import Input
from tensorflow.keras import Model
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation
from tensorflow.keras.layers import Embedding
from tensorflow.keras.layers import Conv1D, GlobalMaxPooling1D, concatenate
fr... |
2ebbfdd3f065f3013c13b2e3ddc87236000fc1201a14049411b56f1f2b895e1c | Python | 3,578 | 83 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
from collections import OrderedDict
import mmcv
import torch
arch_settings = {50: (3, 4, 6, 3), 101: (3, 4, 23, 3)}
def convert_bn(blobs, state_dict, caffe_name, torch_name, converted_names):
# detectron replace bn with affine channel layer
sta... |
9f14eafbd91fd93987a42b5fd63a638788c2fe920e7e39c66b2a2780337af376 | Python | 3,578 | 112 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from mmcv import Config
from xtcocotools.cocoeval import COCOeval
from ...builder import DATASETS
from .topdown_coco_dataset import TopDownCocoDataset
@DATASETS.register_module()
class TopDownAicDataset(TopDownCocoDataset):
"""AicDataset dataset fo... |
59689107fd099e3850593b99994ae51b17b63969c3b69d16613b081fec519315 | Python | 3,580 | 114 | from typing import Union, Optional, Any, List
import numpy as np
import eagerpy as ep
from ..devutils import atleast_kd
from ..models import Model
from ..distances import Distance
from ..criteria import Criterion
from .base import FlexibleDistanceMinimizationAttack
from .base import T
from .base import get_criteri... |
7a1c3f6920155398ddf7dd4de5e0a91251956f8f994605efcf713f4778eb2df8 | Python | 3,580 | 91 | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch
from mmdet.models.dense_heads.autoassign_head import AutoAssignHead
from mmdet.models.dense_heads.paa_head import levels_to_images
def test_autoassign_head_loss():
"""Tests autoassign head loss when truth is empty and non-empty."""
s =... |
619a4db330598dcdec64394c2aa5f66f1a49b135286553b77545934e21048576 | Python | 3,586 | 93 | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import shelve
import pyabf
save_path = '/network/lustre/iss01/wyart/analyses/mathilde.lapoix/MLR/V2a_recruitment_behavior/analysis_9/'
df_summary = pd.read_csv('/network/lustre/iss01/wyart/analyses/2pehaviour/MLR_analyses/dat... |
6ca68e96e48eee4c61f2a6747b1a8581b5b68ca8f43f203f31031de9d5a8058c | Python | 3,586 | 116 | import math
from typing import Callable, Optional
import torch
from sbi.sbi_types import Shape
# Mocking a neural posterior
class BiasedPosterior:
def __init__(self, posterior: Callable, shift: float = 5.0):
"""give me a prior/posterior and I'll shift it by a scalar `shift`. All
calls to `sample... |
611e3e9e7f773f9a3ef89b957f5336b25e1fc3d500b07df3a3aa564d397b2af0 | Python | 3,590 | 122 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
8325735aad1df2877c8298ee766f31c700915ccc43922c37d0758d2943b098c5 | Python | 3,592 | 122 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
c497a088a4d2cb6c358b1ef645db000e7276d9ec1fdf3ab8c8d9ce9121c79f1d | Python | 3,592 | 122 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
90ba4a5872823a8818fbb5b7223cf03ece2caf77d02bf71bc3dda32937f5c2c2 | Python | 3,594 | 98 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmpose.models import build_loss
def test_adaptive_wing_loss():
# test Adaptive WingLoss without target weight
loss_cfg = dict(type='AdaptiveWingLoss')
loss = build_loss(loss_cfg)
fake_pred = torch.zeros((1, 3, 64, 64))
... |
6602cfba5cfd5724d62541c46b98bf050d486df1be42b24fcaff99485ca205eb | Python | 3,597 | 101 | 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... |
6eaadcfda96d099ce2b57cd57972ff36d0844920fe3b874a2d5c1e16a32becf1 | Python | 3,597 | 125 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
41b0b893cc12448e677141eb7f7f02a4a0a49d2197f5f9f150454d259504f25a | Python | 3,604 | 119 | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
from mmpose.models.detectors import MultiTask
def test_multitask_forward():
"""Test multitask forward."""
# build MultiTask detector
model_cfg = dict(
backbone=dict(type='ResNet', depth=50),
hea... |
d5f4dc602a50b473f2cc6c04f02968dd87c702b652106cccaae2b6c5ce11753d | Python | 3,605 | 109 | """
Utilities used for managing data.
"""
import numpy as np
import warnings
def checkunique(data):
"""Quickly checks if a sorted array is all unique elements."""
for i in range(len(data)-1):
if data[i]==data[i+1]:
return False
return True
#def checksort(data):
# """
# Checks if... |
d9789ae6c6169a0ef3d98c8d36fdec1f4e48e9ee62ed211dac8c9a11946baa2b | Python | 3,606 | 95 | import os
import pickle as pkl
from cv_v1 import GridSearchCV, grid_convert
from util import path_check, Timer
# dataset_path = "/home/francishe/Downloads/Datasets/ANI-1ccx_energy_clean.h5"
# gammas_path = "/home/francishe/Downloads/Datasets/gammas_50_5_full_cec.h5"
# cv_root = "/home/francishe/Downloads/ANI_cv"
datas... |
7dfd610a5b24679095e0538415c3e791478a22caf58ef9e50f82f775b685edd5 | Python | 3,607 | 113 | # Implement spatial filter for each pixel
import numpy as np
#import caiman as cm
from mpl_toolkits.axes_grid1 import make_axes_locatable
import matplotlib.pyplot as plt
import scipy as sp
#import noise_estimator
import trefide.extras.util_plot as util_plot
import trefide.extras.denoise as denoise
def covariance_mat... |
1e032881f01f4c104d8708a0aaa43bd014650951e6bf188cf3bff0afc7d6e698 | Python | 3,608 | 119 | import numpy as np
import torch
import torch.nn as nn
from fedml_api.model.finance.vfl_models_standalone import DenseModel
def sigmoid(x):
return 1.0 / (1.0 + np.exp(-x))
class VFLGuestModel(object):
def __init__(self, local_model):
super(VFLGuestModel, self).__init__()
self.localModel = l... |
594a06a77e502a7d30a5a09463d6104d56e4526e67c1383899dfba2b2afe2593 | Python | 3,611 | 88 | import os
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from keract import get_activations
from keras import Input, Model
from tensorflow.keras.callbacks import Callback
from tensorflow.keras.layers import Dense, LSTM
# In this example we need it because we want to extract all the intermediate ... |
bbe15f0f9e0268cda3d103038f8cbe570a1f371c469d4e83bf6eba584fd61395 | Python | 3,611 | 107 | # -*- coding: utf-8 -*-
from pyriemann.classification import MDM
from pyriemann.tangentspace import TangentSpace
from pyriemann.estimation import Covariances
from sklearn.pipeline import make_pipeline
from sklearn.tree import DecisionTreeClassifier
from sklearn.linear_model import LogisticRegression, SGDClassifier
from... |
cb1ac906ee75b7ef9fdbe401cf6b1c4a9f08caa8e1013abb154f671e705957a7 | Python | 3,613 | 125 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
0a1ed006ee7d09241989d04a8055ca17780a7fb0decc9d6f407e12d70c1adcde | Python | 3,614 | 104 | #!/usr/bin/env python
# Adapt from ->
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
# <- Written by Yaping S... |
2919b728599718af9210b710efbd68b1ed7997435bf036b6a1577a920338ae3b | Python | 3,614 | 125 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
12d810dce99dc84a2e00d9816e267a813f7f4d9a34704775dba403002e465e08 | Python | 3,615 | 125 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
2aec418221af207e6ec0ea8e22ff687dd90538107e39068cdf834a9da633362e | Python | 3,615 | 78 | #! /usr/bin/env python
# ***********************************************************************************
# * Copyright 2010 - 2016 Paulo A. Herrera. All rights reserved *
# * *
# * Redistribution and use in source ... |
30cf932e94b02923bef039e36b832f7209bb00a8dfcc554b6d9539e98e88dcda | Python | 3,615 | 125 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
146fa0d866ac1a354a53b038b3750fb284c1040a56c30c91a4223122accc349c | Python | 3,616 | 125 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
35c093e4b950eecb61da2543f4b52a7de2d6bf11c540b6d74586f33d616aa4ca | Python | 3,616 | 125 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
4e6c07288f5c3b353bda59f93e150dd570a97c4b3c8532d837d6ddabeb4658b3 | Python | 3,616 | 125 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
60fae243b40683c72d9f294b245f5e6cfbb3cbe60df47cf34e0aa2aae6b312ba | Python | 3,616 | 77 | import logging
import time
from fedml_api.distributed.fednas.message_define import MyMessage
from fedml_core.distributed.client.client_manager import ClientManager
from fedml_core.distributed.communication.message import Message
class FedNASClientManager(ClientManager):
def __init__(self, args, comm, rank, size,... |
0670d83a161c781750a025d56d11e6cea778d4a2c0dda53fb08137ecd4bae28b | Python | 3,617 | 125 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
5e393560745bc13ea9be83950ce84457bc0d53f65f5329660cf4b90250e176bc | Python | 3,617 | 125 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
0de1875103bbb4bb7e7927dca7e6048dcb9b82a2f07c153ead4dfa90a1828743 | Python | 3,618 | 125 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
1a749531a2fa0eb5aaaed46ff825e419a137d0afb729f568abb4fdf3194f8ee3 | Python | 3,618 | 125 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
1c0a3e414c185562095e1ed02ec06973751fbdad85450ba2e0df89d0db58bdea | Python | 3,618 | 92 | from lifelines.datasets import load_rossi
from sksurv.linear_model import CoxnetSurvivalAnalysis
import sys
sys.path.insert(0, "/home/mfromano/Research/mri-surv-dev/mri_surv")
from simple_mlps.datas import ParcellationDataVentriclesNacc, ParcellationDataVentricles
from simple_mlps.model_ibs.ibs import *
import pandas a... |
2e7a095b3b39ea5f58419eb5557c5587501695868052c64140348f7821cb312d | Python | 3,618 | 125 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
51370b17eab8738b92286f2c885d93ac40802624b5906a4576ffe1f54d96709e | Python | 3,618 | 88 | """CUDA-only Coulomb kernel rejects invalid inputs before any Warp launch.
CUDA-shaped cases use PyTorch FakeTensors: this module runs on CPU-only hosts
without allocating GPU memory or compiling/launching Warp kernels.
"""
import pytest
import torch
from torch._subclasses import fake_tensor
from torch._subclasses.fa... |
d78cb3ccf34d1841f03a544d4e32786d5f939ec267eb36a678f7a2743da8f870 | Python | 3,619 | 113 | # ------------------------------------------------------------------------------
# Adapted from https://github.com/HoBeom/OneEuroFilter-Numpy
# Original licence: Copyright (c) HoBeom Jeon, under the MIT License.
# ------------------------------------------------------------------------------
import math
import numpy ... |
29e246b41301dfd8b2252f9b75e9a1cbf2420690c50e5e9b9bc0fbb68ca48a05 | Python | 3,620 | 87 | import numpy as np
import pandas as pd
import os
import pickle
import logging
import scipy.io
def load_summary_csv(url):
df = pd.read_csv(url.replace('/edit#gid=', '/export?format=csv&gid='))
return df
class ReAnalyze(Exception):
pass
def load_experiment(path, fishlabel):
"""Loads the experiment o... |
aa583b0684f82f7877b06eeb5badbec10f54967d7fc66992162b12d8bfe99484 | Python | 3,621 | 110 | import logging, time
import numpy as np
import torch
try:
from fedml_core.trainer.model_trainer import ModelTrainer
except ImportError:
from FedML.fedml_core.trainer.model_trainer import ModelTrainer
from .utils import EvaluationMetricsKeeper, float_to_uint_img
def convert_to_img(A, B, fake_B):
nc ... |
5c5a19488e6f62ea9b3732699a045c2a1e1b053298b991c36331ee5a24dd939a | Python | 3,623 | 74 | import os
import sys
from sklearn.utils import shuffle
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../")))
from fedml_api.data_preprocessing.NUS_WIDE.nus_wide_dataset import NUS_WIDE_load_two_party_data
from fedml_api.standalone.classical_vertical_fl.vfl_fixture import FederatedLearningFixtur... |
a921ecf7198dae1b2a59ec27a2f3c41f6e49d6c808e9e4ef5ff8f8fd229ac9fc | Python | 3,625 | 132 | """
All size-5 and size-6 subsets of low-level & NLP features,
evaluating cross-validated R2 on high-gamma ECoG.
"""
#### ChatGPT was used to assist writing code. The authors reviewed, edited, and take full responsibility for the content.
import os
PODCAST_ROOT = os.environ.get("PODCAST_ROOT", "/engram/naplab/users/rs... |
6777038a3b48c4c46833f199d7643ecc4e60dd12657cde6e137fff692f3dbd14 | Python | 3,627 | 103 | from copy import copy, deepcopy
from transformers import TrainingArguments
import os
from os.path import join, splitext
from model.torch_models.bert_cnn import CNN_Over_BERT
from model.torch_models.bert_linear import Linear_Over_BERT
from model.torch_models.bert_rnn import RNN_Over_BERT
from config_path import LOG_PAT... |
cf6e4ce361256d02c6e051f79731c87c1e93e2ed96a5f1a22e5d3f85b0b0fc32 | Python | 3,627 | 125 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
f55c4c34d4c7649effd159faff8b7b35f58d81abe826d8f49a439b96dad591d0 | Python | 3,627 | 95 | # 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 Callable
import torch
from torch import Tensor
from tqdm.auto import tqdm
from sbi.samplers.importance.importance_sampling import imp... |
7ea26e41831d5fc44e42861802e7dd98d0db24be5ccf17abb791bb88973229c6 | Python | 3,629 | 57 | # ----------------------------------------------------------------------- #
# Copyright (c) 2023, UChicago Argonne, LLC. All rights reserved. #
# #
# Software Name: Fast Autonomous Scanning Toolkit (FAST) #
# By: Argonne Na... |
6c0c509f74af183ae1fab17303f08b8893835b272c2afe66c0da320619ba6e7a | Python | 3,630 | 114 | # -*- coding: utf-8 -*-
# Copyright 2019 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""Vector quantization modules.
These codes are modified from https://github.com/ritheshkumar95/pytorch-vqvae.
"""
import torch
from torch.autograd import Function
class VectorQuantization(Function):
... |
953b6866dcd877945ef34e2141f139981df8df8ddabf20ff9ff07add64a1687c | Python | 3,631 | 102 | #!/usr/bin/env python3
from flystim.stim_server import launch_stim_server
from flystim.screen import Screen, SubScreen
from flystim.trajectory import Trajectory
from math import pi, radians
import matplotlib.pyplot as plt
from flystim.draw import draw_screens
from time import sleep
def get_subscreen(dir):
# ... |
c563034bafb17d4879e8319f523b3771963d4f56173ac5657830db678d727a35 | Python | 3,632 | 99 | # -*- coding: utf-8 -*-
"""RAdam optimizer.
This code is drived from https://github.com/LiyuanLucasLiu/RAdam.
"""
import math
import torch
from torch.optim.optimizer import Optimizer
class RAdam(Optimizer):
"""Rectified Adam optimizer."""
def __init__(self, params, lr=1e-3, betas=(0.9, 0.999), eps=1e-8, ... |
4e14ab840bdaa2f04f45eb778ed8dbd412ed9913b94ac6c18e73a3e491538635 | Python | 3,633 | 99 | # Copyright (c) OpenMMLab. All rights reserved.
from ..builder import HEADS
from .deconv_head import DeconvHead
@HEADS.register_module()
class AESimpleHead(DeconvHead):
"""Associative embedding simple head.
paper ref: Alejandro Newell et al. "Associative
Embedding: End-to-end Learning for Joint Detection
... |
f6ad9f4564e2518e2eb817af93c0c64139b5b9dcb06e150efbe145a0f4336738 | Python | 3,633 | 70 | #! /usr/bin/env python
# ***********************************************************************************
# * Copyright 2010 - 2017 Paulo A. Herrera. All rights reserved. *
# * *
# * Redistribution and use in so... |
99c2df11035c114493ea36e1dc9481085c1d771537a105e158fac2299177dac0 | Python | 3,634 | 103 | from copy import copy, deepcopy
from transformers import TrainingArguments
import os
from os.path import join, splitext
from model.torch_models.bert_cnn import CNN_Over_BERT
from model.torch_models.bert_linear import Linear_Over_BERT
from model.torch_models.bert_rnn import RNN_Over_BERT
from config_path import LOG_PAT... |
6b63a3280afe1475322bc3949954f411e2a8a83d4b20d6b2a55098e2ffa9b4df | Python | 3,640 | 90 | # -*- coding: utf-8 -*-
#%% Imports, definitions
import math
import numpy as np
import unittest
#%% Code behind
def get_axis_rotation_matrix(axis, theta):
# http://stackoverflow.com/questions/6721544/circular-rotation-around-an-arbitrary-axis
# https://en.wikipedia.org/wiki/Rotation_matrix
ct = math.cos(t... |
6955c93aefab81ab5655e51cf8e71917ad3d472358dbf841be50c22aed894279 | Python | 3,642 | 91 | import logging
import torch
from torch import nn
try:
from fedml_core.trainer.model_trainer import ModelTrainer
except ImportError:
from FedML.fedml_core.trainer.model_trainer import ModelTrainer
class MyModelTrainer(ModelTrainer):
def get_model_params(self):
return self.model.cpu().state_dict()... |
91a4f83842370758393e9838fcbd1e952de518460ae70f79445ff221fdd2a4f0 | Python | 3,642 | 94 | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule, auto_fp16
from mmdet.models.builder import NECKS
@NECKS.register_module()
class CTResNetNeck(BaseModule):
"""The neck used in `CenterNet <https://arxiv.org/abs/19... |
45e41da0524f6b91dec32932a8f6be0c840188d74ed47b5d767556bdbcfa25c0 | Python | 3,643 | 125 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
a0b7e52386d0f50885686c220288f41d89de94a5b836ae9a19b5b44d14fcfd69 | Python | 3,643 | 85 | import os
import types
import pickle
import numpy as np
from sklearn.base import RegressorMixin
from sklearn.metrics import get_scorer as sklearn_get_scorer
from sklearn.metrics import precision_score, recall_score, confusion_matrix, make_scorer
from metstab_shap.config import csv_section
from metstab_shap.config impor... |
8e17e490606bc3526d7856c4d100d983829cdb7a8a238cd3fcc246027539541c | Python | 3,646 | 139 | import copy
import torch
from torchvision.transforms.functional import to_tensor
import rdkit
import rdkit.Chem.Draw
from rdkit import Chem
from rdkit.Chem import rdDepictor as DP
from rdkit.Chem import PeriodicTable as PT
from rdkit.Chem import rdMolAlign as MA
from rdkit.Chem.rdchem import BondType as BT
from rdkit.... |
344165bd0f7d140fd3d6def8961e606b001271ed1b603bda742b129143db5940 | Python | 3,649 | 97 | ###############################################################
##### Touchscreen Windows Launcher #######
##### by: Daniel Palmer, PhD #######
###############################################################
#Imports#
from tkinter import N
from tkinter... |
6231c05a4aa707f2454f292edbb609f23a76d299b1af9830c1ba928f85f74cc7 | Python | 3,652 | 102 | import cvxopt
import numpy as np
from scipy.linalg import block_diag
from .options import Options
from .target import Constraint
cvxopt.solvers.options['show_progress'] = False
class Solver:
def __init__(self, opts: Options):
self.opts = opts
self.solver = self.opts.solver
self.constr = ... |
658a49b8aacce6f5752591d48176dc64076bef66ae398a9f8869d9ef1e8443d8 | Python | 3,653 | 124 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/wflw.py'
]
evaluation = dict(interval=1, metric=['NME'], save_best='NME')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup=... |
c0a1af9603589fcfb77ba1ed3a9cbbe77d7cc3bde6650b173156c535416e79f6 | Python | 3,654 | 79 | """Reusable public nvalchemi neighbor buffers for fixed-layout input adapters.
This module owns topology storage, not model arithmetic. Both eager callers
and CUDA-graph adapters may use it. Buffer capacities and the layout are fixed;
coordinate-dependent neighbors are rebuilt for every call.
"""
from __future__ impo... |
3ac78475dd5cb8dada678d4ffea9545b1f1517b4e78e123a6ea96c24f2b7258b | Python | 3,656 | 66 | # ----------------------------------------------------------------------- #
# Copyright (c) 2023, UChicago Argonne, LLC. All rights reserved. #
# #
# Software Name: Fast Autonomous Scanning Toolkit (FAST) #
# By: Argonne Na... |
260d155165871ca8810c077f87a93b00199943afdde1738a6856f0896255f09a | Python | 3,657 | 124 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/wflw.py'
]
evaluation = dict(interval=1, metric=['NME'], save_best='NME')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup=... |
c045466f610b795be7670c16a8c154b29bda8f52c39751897f767c08f215ca32 | Python | 3,658 | 108 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmpose.core.post_processing.group import HeatmapParser
def test_group():
cfg = {}
cfg['num_joints'] = 17
cfg['detection_threshold'] = 0.1
cfg['tag_threshold'] = 1
cfg['use_detection_val'] = True
cfg['ignore_too_much'] = False
... |
f89dba1c326b782ae7d1894902f408f7b6a0232c8877139ba6249aff6eba3349 | Python | 3,659 | 104 | from torch import nn as nn
class Mlp(nn.Module):
""" MLP as used in Vision Transformer, MLP-Mixer and related networks
"""
def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.):
super().__init__()
out_features = out_features or in_features
... |
3eb51b2fa4c510bfe6c0ff5c9e7a54a373bcb6a2ca6a37af58c2aee3194ff013 | Python | 3,663 | 86 | from statistics.clustered_mlp_output_wrappers import *
from statistics.mlp_output_wrappers import map_neuromorph_abbr_to_lobe
import numpy as np
from tqdm import tqdm
@pa.check_types
def aggregate_statistic_by_region(
dataset: str='ADNI', value_set: str='Gray Matter Vol')\
-> DataFrame[AggregatedOverRe... |
578b37105b2b1f5408fffa6c21bdef4e33769f23e4199bf39cae42f4f028580e | Python | 3,666 | 108 | import sys
import os
import multiprocessing
import time
from datetime import timedelta
import signal
import traceback
import pickle
class ParallelProcess():
def __init__(self, save_dir=None):
if save_dir is not None:
timestamp = time.strftime("%Y-%m-%d_%H-%M-%S")
self.save_dir = f"... |
d55c0e59c62073005857c2f1e7b9bc8648339df96895518f00b85aca7a46b8a1 | Python | 3,668 | 97 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmdet.core import bbox2result, bbox_mapping_back
from ..builder import DETECTORS
from .single_stage import SingleStageDetector
@DETECTORS.register_module()
class CornerNet(SingleStageDetector):
"""CornerNet.
This detector is the implementatio... |
0bde730117ddcd49e85384ffcede3d0a956ccd93c93825ff1f8609102ff18ac8 | Python | 3,669 | 101 | from pandas._config.config import config_prefix
from statistics.clustered_mlp_output_wrappers import \
load_clustered_mris
from statistics.utilities import CONFIG
from statistics.dataframe_validation import DataFrame, ClusteredMriSchema, pa
import pandas as pd
import numpy as np
import nibabel as nib
import sys, os... |
90b9b711d74c1462d31910d9eadd9bb3db6778f0fcab937a442d7d774bebccd5 | Python | 3,670 | 128 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/cofw.py'
]
checkpoint_config = dict(interval=1)
evaluation = dict(interval=1, metric=['NME'], save_best='NME')
optimizer = dict(
type='Adam',
lr=2e-3,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config =... |
19f3c7f1c39b49ce4adffd36e0ffa107c79ea95b0bad5f15e1215e0106ba3d05 | Python | 3,671 | 120 | """
Simulate pydentate with grid cell inputs on linear trajectories.
This is one of the most computationally intensive steps as it generates
all the raw data that is used for the perceptron, tempotron as well as
CA3 analysis. It allows for reproducibility through a variety of seeding
steps.
"""
import shelve
import c... |
d9f00a81d0ceb97b085a591f1a5253d4c9863d7a51a80bbbbd1f82a8d7415a17 | Python | 3,672 | 126 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
0174d789b9dff8a2e463574eca1985ae054a42384c84f2fd5a08c85f9aa93780 | Python | 3,674 | 126 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mpii.py'
]
evaluation = dict(interval=10, metric='PCKh', save_best='PCKh')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup... |
5ec1be82cda6aaadd26ece007dac8d741753d773c65044550dbb921e331bf1cf | Python | 3,674 | 99 | #encoding=utf-8
import os
import time
import glob
import math
import random
import warnings
import numpy as np
import pandas as pd
import torch
from med_dataset import transforms as med_transforms
def build_transform_med(is_train, input_size=96):
transform_train = med_transforms.Compose([
# transforms.P... |
2295e0d4f25ce62cc0cb8798b40683613114c73b55511045eb0f73231802dc20 | Python | 3,675 | 104 | from copy import copy, deepcopy
from transformers import TrainingArguments
import os
from os.path import join, splitext
from model.torch_models.bert_cnn import CNN_Over_BERT
from model.torch_models.bert_linear import Linear_Over_BERT
from model.torch_models.bert_rnn import RNN_Over_BERT
from config_path import LOG_PAT... |
4c3b0f8b07069ac68586beac48f1a6714e24e426c86a19674b4eccf187a42a3b | Python | 3,675 | 91 | #!/usr/bin/env python3
# Author: Francois Aguet
import argparse
import os
import numpy as np
import subprocess
import gzip
import contextlib
from datetime import datetime
import tempfile
@contextlib.contextmanager
def cd(cd_path):
saved_path = os.getcwd()
os.chdir(cd_path)
yield
os.chdir(saved_path)
... |
862c5aeb04907f7f8f8310fefc705a22890758e75b78e1406b03dd2ec15af310 | Python | 3,675 | 128 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/nvgesture.py'
]
checkpoint_config = dict(interval=5)
evaluation = dict(interval=5, metric='AP', save_best='AP_rgb')
optimizer = dict(
type='SGD',
lr=1e-2,
momentum=0.9,
)
optimizer_config = dict(grad_clip=None)
# lear... |
84c47c3a4c832d283fe1cf190d05e813fe91286888a75083202c92b04de67f5c | Python | 3,676 | 104 | from copy import copy, deepcopy
from transformers import TrainingArguments
import os
from os.path import join, splitext
from model.torch_models.bert_cnn import CNN_Over_BERT
from model.torch_models.bert_linear import Linear_Over_BERT
from model.torch_models.bert_rnn import RNN_Over_BERT
from config_path import LOG_PAT... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.