sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
2edf0ea2961af77f9107ce5d6281fdc56521f2aaa9394fb9c64850f4565d48be
Python
3,679
112
import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns FI = { "ADNI": "./metadata/data_processed/merged_dataframe_cox_noqc_pruned_final.csv", "NACC": "./metadata/data_processed/merged_dataframe_cox_test_pruned_final.csv" } COLS = { "ADNI": { 'RID': str, ...
7fe3b14683fdbad70066de8f4804229aac067999f67e82b293e2676d21119b55
Python
3,683
96
""" subsample slices and shift the short axis and long axis slices """ import cv2 import numpy as np import random from scipy import ndimage from scipy.ndimage.interpolation import shift class ExpRandomShiftSxlx: """ Subsample the 3D numpy [h, w, d] by slice max number. """ def __init__(self, random_...
ab26ca88c4a6add9dbac98caf6552bd299eaf852d0053dad25da40f692c5a273
Python
3,684
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...
f07cc11b73b57f6961924d6d65d3fd45dad29809cb4fdf6bf0c1f8035a07c0f5
Python
3,684
80
# *********************************************************************************** # * Copyright 2010 - 2016 Paulo A. Herrera. All rights reserved * # * * # * Redistribution and use in source and binary forms, with o...
45f17c23e1aaa77ae75a1a6b39ceb16ddd30e93c1417ef3a04a04d5080cb3cda
Python
3,687
121
"""This module contains simple helper functions """ from __future__ import print_function import os from random import randrange import numpy as np import torch from PIL import Image def tensor2im(input_image, imtype=np.uint8): """"Converts a Tensor array into a numpy image array. Parameters: input...
bad36c5a422ed5c93d4d2a35e6a7661c32598d10e07b0d04c2454a312b3415fe
Python
3,688
113
# ------------------------------------------------------------------------------ # Adapted from https://github.com/HoBeom/OneEuroFilter-Numpy # Original licence: Copyright (c) HoBeom Jeon, under the MIT License. # ------------------------------------------------------------------------------ import warnings from time ...
d5bcf9efe7e15f8958256c5431c3524e942ae8f307751c0b4ca48b532c60fecd
Python
3,689
114
""" 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 = argparse.ArgumentParser(descrip...
e3bb27cc0fcc7cffa2e70ad6ba42671bdc18ec1345d4b8571a4fef253f36e2e9
Python
3,690
139
import numpy as np import pandas as pd import datetime import time from model import Net1 import torch.optim as optim from scipy import io import argparse import os # nn.BatchNorm2d(2,affine=False), import torch from torch import nn from torch.utils.data import Dataset, DataLoader import h5py impor...
091fd0f03c6d2eda1bc25584aa601da2cbab08875b32df3554e579ce680df677
Python
3,691
105
# import psi4 # import sys from rdkit import Chem # from rdkit.Chem import AllChem import numpy as np # import pandas as pd import os import time from datetime import datetime def get_mbis_charge(mol): try: mbis_charges = [float(x) for x in mol.GetProp("MBIS_CHARGES").split("|")] if len(mbis_cha...
f6563d79f4566dae30c91a9c2d96666ed9b10a9bff06594689cf824e9593c4d3
Python
3,692
127
_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...
7673d5585d1cbdfb28ed5011acd200f4b3611047d0fe965131941203aba3a5bf
Python
3,693
110
# Copyright (c) OpenMMLab. All rights reserved. from argparse import ArgumentParser, Namespace from pathlib import Path from tempfile import TemporaryDirectory import mmcv try: from model_archiver.model_packaging import package_model from model_archiver.model_packaging_utils import ModelExportUtils except Imp...
1489fcf9d412e5d58f12fc4f044ea451dfc10de993308d5e6eb73aeb6c2ae6be
Python
3,694
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...
a41ad3d9d68811e1451d2b2b24d5995fd4a190f715d122fd97eebdf623eab081
Python
3,703
99
from typing import List, Union, Tuple from rdkit import Chem import torch import torch.nn as nn from .mpn import MPN from .args import ModelArgs from .features import BatchMolGraph from .nn_utils import get_activation_function, initialize_weights class MoleculeModel(nn.Module): """A :class:`MoleculeModel` is a ...
bfe420ac9a42572f130c4ae91d020fd8e090edb99936dab5815270c6cb1fa95a
Python
3,703
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...
654d24df9e874a47e61910cd7a20f42925ed11906a9e70cb71236c51f8b79fff
Python
3,705
118
from collections import defaultdict, namedtuple Hsp = namedtuple( "Hsp", ["qname", "tname", "pid", "len", "qcoords", "tcoords", "evalue", "qlen", "tlen"], ) def parse_blast(handle): for line in handle: line = line.split() yield Hsp( qname=line[0], tname=line[1], ...
f5b73d070172eb820e771f55f83c7b2c6f00ce7045f1433bd6b3e5adbd84934d
Python
3,705
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...
0938eb0f273008b87cb0d247f37a48af5e9f5ab2de35e55e4ea6662d94589c84
Python
3,708
89
# Copyright (c) 2020-present Joindbre.com # Authors: Patricia Maraver. # # This program is free software: you can redistribute it and/or modify # it under the GNU Affero General Public License version 3 # as published by the Free Software Foundation. # You should have received a copy of the Server Side Public Lic...
242c3b2e235ce488006f46bb434109f65d0e9811d8663de9a019ee7eea680933
Python
3,714
111
# 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/> import contextlib import importlib import inspect import pkgutil import random import sys from types import ModuleType def import_first_function(module_...
7c28d919f9218f2077ac7fcfbf639085e21dd710fc26c2e0f1018d33b4fc6b3d
Python
3,714
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...
b0aac6bdbeb2f2681a497b01bd0616f5486bb477013033c7b9bdc6839d5be0be
Python
3,714
111
# 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 asdict import pytest import torch from torch import Tensor, eye, ones, zeros from torch.distr...
1e6680c975ca7305805ccaa15162c704fa7c18f31be3d5645c23411f4637f76f
Python
3,715
128
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/aflw.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 =...
d087786e675811e7907e469df5528c3a31862f6af2dbe2619db9f04756befceb
Python
3,715
128
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/wflw.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 =...
c45c1a035621429d1b586cd76845e1fbdee039de776511932a40561fee45aa99
Python
3,717
128
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/300w.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 =...
0bf8d2a28b8cae976461af060751aedd1b654a137654ace623fdd87d30df2e9c
Python
3,724
131
_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...
15421423f0d68853db2dc70d16beb250f593a9baca5203f1eced4ce3eb4eca1b
Python
3,724
131
_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...
a4890169314f35bfa36c6241e98bc53e06d49cf3e208beb3836304e88d20d7a1
Python
3,724
126
from typing import Union, Optional, Any import numpy as np from scipy.ndimage.filters import gaussian_filter import eagerpy as ep from ..devutils import atleast_kd from ..models import Model from ..criteria import Criterion from ..distances import Distance from .base import FlexibleDistanceMinimizationAttack from ...
4c0c322f801d41bde42819ebfcc732df0a9349a204d661c804f63a2b157c759f
Python
3,726
79
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 ANVIDataset(th.utils.data.Dataset): def __init__(self, adata, batch_size, shuffle=True, test=0.1, rando...
0b29fda772d816bda9d870c1d15bb21f3ec3fa2e8e0a8fc7418667cab6bbef84
Python
3,727
115
"""Command to run model inference on videos.""" import logging from pathlib import Path _logger = logging.getLogger('DAART.CLI.PREDICT') def register_parser(subparsers): """Register the predict command parser.""" parser = subparsers.add_parser( 'predict', description='Run inference using a ...
ba5a4bbad1bca647100c96afde289dbf25c7cf2a0762d09b4339fd8579a37d89
Python
3,728
99
# Copyright (c) OpenMMLab. All rights reserved. import warnings from mmcv.runner import DistEvalHook as _DistEvalHook from mmcv.runner import EvalHook as _EvalHook MMPOSE_GREATER_KEYS = [ 'acc', 'ap', 'ar', 'pck', 'auc', '3dpck', 'p-3dpck', '3dauc', 'p-3dauc', 'pcp' ] MMPOSE_LESS_KEYS = ['loss', 'epe', 'nme',...
341a63cfbcf1c8f0e4c1c32fd2ba2a9afae111fa27716305d9eabb243ad49a9b
Python
3,730
123
#!/usr/bin/python3 import json import os import subprocess import multiprocessing import sys # Parse json with open("/batchx/input/input.json", "r") as inputFile: inputJson = inputFile.read() parsedJson = json.loads(inputJson) # BX_MEMORY & BX_VCPUS bxMemory = os.environ['BX_MEMORY'] bxVcpus = os.environ['BX_VCPU...
f11877683798a0ca458fd3c5910d7100261850974670a6281a172cea44181aa3
Python
3,733
125
_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=...
3676e6ef1737f73e6ae389037fcc732e6f2cdf0c400297d06c114d45d837012c
Python
3,738
108
# 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) from pytest import mark, raises import torch from torch.autograd import grad from torchmdnet.models.model import create...
88c0edb84922800589978e4a033fcb5627838b9adaf33e335448abe208be93c2
Python
3,739
103
import json import csv import numpy as np from typing_extensions import Literal def read_json(config_file: str) -> dict: """ Reads json file given file name Args: config_file (str): file name Returns: dict: dictionary corresponding to json file """ with open(config_file, "r"...
b2e4b38833d1a9b6cbf608ab0180de3f084e84754178b305325930684f2559d2
Python
3,739
117
# Copyright (c) OpenMMLab. All rights reserved. from collections import defaultdict from contextlib import contextmanager from functools import partial import numpy as np from mmcv import Timer class RunningAverage(): r"""A helper class to calculate running average in a sliding window. Args: window ...
046251ff4ec295b554b92310d39fd591025c597fec2c37ca700ef4c14c4a00ce
Python
3,742
78
''' Script for writing out predictions for splitN Train on the 5-fold, then combine all training data to predict to test set https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestRegressor.html ''' import numpy as np import pandas as pd import csv import scipy import pickle from sklearn.ensem...
2ad031a425f6f02b88db1918333a30937e41b18f435df90e6bcbb6470427221b
Python
3,743
134
from typing import List import numpy as np import pandas as pd from pandas.tseries import offsets from pandas.tseries.frequencies import to_offset class TimeFeature: def __init__(self): pass def __call__(self, index: pd.DatetimeIndex) -> np.ndarray: pass def __repr__(self): retu...
71be584d3438b4c83406677a6841f508dde7335f5202a7d57e0f4fca90f9ed0f
Python
3,744
100
"""CPU tests of allocation safety required before speculative CUDA replay.""" from types import SimpleNamespace import pytest import torch from aimnet.calculators.cuda_graph.cache import CUDAGraphCache, _Entry def test_detached_keepalive_does_not_pin_resized_allocation(): value = torch.nn.Parameter(torch.arang...
44765442438ce254f9a486c043cb7022e730c98028d982046cb601e0ecca12e6
Python
3,748
105
""" Unittesting for tempotron """ import unittest import numpy as np from tempotron.main import Tempotron class TestTempotron(unittest.TestCase): """ Test the functionality of the Tempotron class. """ def setUp(self): # Change synaptic efficacies later!! self.tempotron = Tempotron(0,...
d50ad532f95c5fd97d21971eb7c64df25bbdaae56847157a2a4ee7574c087ddd
Python
3,748
83
import sys sys.path.append('..') import os import argparse import torch from torch import nn import numpy as np from torch.optim import Adam import utils import metrics import config_mixtures as cfg import utils_mixture as mix_utils from main_bayesian import train_model as train_bayesian, validate_model as validate_b...
07cd0af77de99c6e07dd93f404be1e6abb78b6e203359dfe60bba1c8a0b0d5bf
Python
3,752
127
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/zebra.py' ] evaluation = dict(interval=10, metric=['PCK', 'AUC', 'EPE'], save_best='AUC') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='st...
4a87f5411d66b19e6cbba230e4a35e6586635688a4cc56a58dd8c5a9886e3153
Python
3,752
108
from logging import getLogger import numpy as np import torch from torch import nn from base.config import Config from base.evaluation.base_evaluator import BaseEvaluator from base.results.base_result_tracker import BaseResultTracker logger = getLogger(__name__) # Value that marks artifacts in labels (excluded from...
6f562663276d6a98c976a4093d0bc073b61f8fe2a14be0261332c533da1ddea3
Python
3,754
127
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/zebra.py' ] evaluation = dict(interval=10, metric=['PCK', 'AUC', 'EPE'], save_best='AUC') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='st...
dabe9b02e5512517807fe40a7c1baa7951f0d44cb83079de05d0dd38a2a30148
Python
3,754
127
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/zebra.py' ] evaluation = dict(interval=10, metric=['PCK', 'AUC', 'EPE'], save_best='AUC') optimizer = dict( type='Adam', lr=5e-4, ) optimizer_config = dict(grad_clip=None) # learning policy lr_config = dict( policy='st...
5cf132b66709776f4f7aa4c373317d73e922028fa8a51872d779aec286d864c8
Python
3,763
83
import numpy as np from importlib import reload import sys sys.path.insert(2,'support') import functions reload(functions) import functions as f import parameters reload(parameters) import parameters as p direc = sys.argv[0].split('script')[0]+'data/' nsim = int(sys.argv[1]) all_seeds = np.arange(nsim) mean_bias = n...
15925852cb8a111894dd0820647e5a2c10e132726a0395a33cc343954b586172
Python
3,765
100
import re from multiprocessing import Pool from os import listdir from os.path import join, exists import numpy as np import pandas as pd from h5py import File def dftb_parse(opts): res_dir = opts['res_dir'] save_path = opts['save_path'] n_worker = opts.get('n_worker', 1) # Parse in parallel mol...
b5198d981367734508736a135b11d8e917e41ec9f3ca9bd0b18977ee3f20753c
Python
3,765
120
from email.policy import strict import torch import torchvision.models import os.path as osp import copy from ...log_service import print_log from .utils import \ get_total_param, get_total_param_sum, \ get_unit # def load_state_dict(net, model_path): # if isinstance(net, dict): # for ni, neti in ...
07d064d0840651e2f74516b53ad44f19be7fb9d2b065f4b7b40b5b4bd45488af
Python
3,766
114
# -*- coding: utf-8 -*- """Process our data choice""" __author__ = "Sean Benson" __copyright__ = "MIT" from dtor.datasets.dataset_nominal import CTImageDataset from dtor.datasets.dataset_mnist import MNIST3DDataset from torchvision import transforms from torchvision.transforms import transforms import torch import to...
4971a1d5793bf297bb21f7e1e11ad6c1619492d3543e034d7dfde783d6a51bdd
Python
3,767
99
# 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, Union import torch from pyro.distributions import InverseGamma from torch import Tensor from torch.distributions import Beta...
3054712f0fb8d79e077155504c29231325949bf86295f9839904f2a64220bd25
Python
3,768
116
# 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/> import collections import logging from dataclasses import asdict, is_dataclass from typing import TYPE_CHECKING, Dict, List, Optional, Union import numpy...
b98b5a6ad6bef8d9fbe4185ccdcd3471b7a2d4c25430005af1ce524f8701e4c7
Python
3,770
122
import json import os import re from pathlib import Path from typing import List, Tuple, Union import numpy as np def calculate_lumen_score( lumen_abs: float, ) -> float: lumen_score = lumen_abs return lumen_score def calculate_stress_score( stress_abs: float, uts: float = 8.9, ) -> float: ...
0b7d4f4a1ba7c179d2bcdba3fd054c7dd7571a7f20bef504b9e8980fee8e1839
Python
3,772
99
# Imports # import kivy import zipimport import sys import os import configparser from kivy.app import App from kivy.uix.widget import Widget from kivy.uix.button import Button from kivy.uix.image import Image from kivy.uix.label import Label from kivy.uix.floatlayout import FloatLayout from kivy.uix.gridlayout import ...
840a4249c8679206f06a799d6a2cccd6b81bfb7f2c061afbaaab0c8652f12d63
Python
3,772
99
# Imports # import kivy import zipimport import sys import os import configparser from kivy.app import App from kivy.uix.widget import Widget from kivy.uix.button import Button from kivy.uix.image import Image from kivy.uix.label import Label from kivy.uix.floatlayout import FloatLayout from kivy.uix.gridlayout import ...
397848869894ea260a7f8fbbb7b7f88ec799784ff3ca2af637f5e6c73aad3ca6
Python
3,773
91
# Copyright (c) OpenMMLab. All rights reserved. import copy import os.path as osp import mmcv import numpy as np from mmdet.datasets.pipelines import (LoadImageFromFile, LoadImageFromWebcam, LoadMultiChannelImageFromFiles) class TestLoading: @classmethod def setup_clas...
5f6ae381d13a7f2e3e0759b6b6227cace4f6f7cc58e7fdfc00b53b941b194667
Python
3,773
85
import os, torch, numpy as np, pandas as pd, torch.nn as nn, torch.nn.functional as F from transformers import AutoTokenizer, AutoModel, logging from rdkit import Chem import warnings warnings.filterwarnings('ignore') logging.set_verbosity_error() device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') ...
b6baa79716de01d98e89b2bacf35dcc1b0240cfad06fced46ef9d9320fa99e8e
Python
3,773
92
from deprecated.driver_v0 import * if __name__ == '__main__': """ Precision error occurs under certain cases. model.get_targets_from_dataset() was found to give different outputs when in_memory was set to True/False. The difference of the outputs reached (+/-) 2^-36. This can be reproduced by: ...
68ca5a35bae2e37eff1d26f15adc7fff052a4d9f747fefec81d80402ec733532
Python
3,774
106
from copy import copy, deepcopy from transformers import TrainingArguments import os from os.path import join 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 training_splits = [0,1,4,6,7,9] number_r...
ea90f66a84b6e9e7bd10a96699845b6781d1bc0419b99f481380276dca1a499f
Python
3,774
101
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn as nn from mmcv.cnn import ConvModule from mmcv.runner import BaseModule, auto_fp16, force_fp32 from mmdet.models.builder import HEADS from mmdet.models.utils import ResLayer, SimplifiedBasicBlock @HEADS.register_module() class GlobalContextHead(BaseMod...
ffc1a33c981e77ea1b1340af01967bf96228aeef90a8ccc2582ec0749386a6c6
Python
3,777
102
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn.functional as F from mmcv.cnn import ConvModule from mmcv.cnn.bricks import NonLocal2d from mmcv.runner import BaseModule from ..builder import NECKS @NECKS.register_module() class BFP(BaseModule): """BFP (Balanced Feature Pyramids) BFP takes m...
40655633cc32a423e1a8b124c9a38c3cb0ceab45f47b6453cc428631f61bd1f4
Python
3,778
120
from email.policy import strict import torch import torchvision.models import os.path as osp import copy from ...log_service import print_log from .utils import \ get_total_param, get_total_param_sum, \ get_unit # def load_state_dict(net, model_path): # if isinstance(net, dict): # for ni, neti in ...
974eecd6c32a816a682b49faba9df53fd2a1a2bbed12674667588fb2628eab5c
Python
3,778
99
# Imports # import kivy import zipimport import sys import os import configparser from kivy.app import App from kivy.uix.widget import Widget from kivy.uix.button import Button from kivy.uix.image import Image from kivy.uix.label import Label from kivy.uix.floatlayout import FloatLayout from kivy.uix.gridlayout import ...
3c9d343046203eecf055375d5fd375ad78d9132c69d9d1dc4a2e2cf608665f03
Python
3,779
111
import pandas as pd from os.path import dirname, join import numpy as np from transformers import AutoModelForMaskedLM, AutoTokenizer from datasets import load_dataset, Dataset from transformers import DataCollatorForLanguageModeling from transformers import Trainer, TrainingArguments import torch torch.manual_seed(0...
c8fcf13839f93625efd8d5c2a35eee072917480c594630aee66f2c62e3d83050
Python
3,781
82
# fusion.py # Train a model that fuses the output of 3 FCNs together for AD status prediction # classifier baselines: applying the previous cnn (vanilla cnn, with our tuned parameters) for baseline estimation import torch.nn as nn import sys sys.path.insert(1, './plot/') from plot import report_table,roc_plot_perfrom...
c439bde228fa07d98b4ef4c262f4ef675d219350dcdaeb040bf4c9ac44af6eec
Python
3,782
83
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 Dataset(th.utils.data.Dataset): def __init__(self, adata, batch_size, shuffle=True, test=0.1, random_se...
675a8aea9ae137b30d2237e51346c2535085b8f1c18089fa77007adbe5643d00
Python
3,783
134
_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...
13a0650a6eca2673ecd140bc0bf685709c02148e7cc7599b2a2c112ebda30923
Python
3,784
107
from copy import copy, deepcopy from transformers import TrainingArguments import os from os.path import join 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 training_splits = [0,1,4,6,7,9] number_r...
91d0c5b08f7cccf199cdcafbf81639e2d835ca94c471bedaa811a588fcecf2da
Python
3,784
108
# Copyright (c) OpenMMLab. All rights reserved. import numpy as np from numpy.testing import assert_array_almost_equal from mmpose.core import (affine_transform, flip_back, fliplr_joints, fliplr_regression, get_affine_transform, rotate_point, transform_preds) def tes...
a93216c7a8d507023d1bf1bc6da22d459f3561dc559849b254a1c7feea86f67e
Python
3,790
106
import unittest import wave from memory_profiler import memory_usage import webrtcvad class WebRtcVadTests(unittest.TestCase): @staticmethod def _load_wave(file_name): fp = wave.open(file_name, 'rb') try: assert fp.getnchannels() == 1, ( '{0}: sound format is incor...
fab80360c3a3464970c4b8ba9adb5ac7872d3f0b1fe4931e7fe2e60608f41885
Python
3,790
100
import argparse import logging import os import random import sys import numpy as np import torch import wandb sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../"))) from fedml_api.model.linear.lr import LogisticRegression from fedml_api.standalone.decentralized.decentralized_fl_api import FedML_...
5deead261ce01c3f2310abaa6602cb444401177eceb7ced28b60f5e4108b6fc8
Python
3,791
104
#!/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): # ...
e0c40dc23ebb0ceb7bc3d27a4613fe9403a3fb643d0e958a7bc112fdf2920d40
Python
3,791
96
# -*- coding: utf-8 -*- """ This file is part of the cerebellar-task-dependent repository (Xie et al. 2023) Copyright (C) 2023 Marjorie Xie and Ashok Litwin-Kumar See README for more information Script that walks through how to compute generalization error analytically for a given kernel and Gaussian process target f...
5a3f80c4bc176e27c4bdab07dd3ea7d397b82a64331c9061d480e18c85ea33ba
Python
3,795
113
#!/usr/bin/python """ Some functions to read and compute spectral features on SITS """ import sys, os import numpy as np import pandas as pd import math import random import itertools import dill as pickle from tensorflow.keras.utils import to_categorical import csv # ------------------------------------------...
5e8afc45f16fc235f3619691e65bd3a87c2eaa9f8cc64a40fa626dddf6fd63f0
Python
3,795
76
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.lending_club_loan.lending_club_dataset import loan_load_two_party_data from fedml_api.standalone.classical_vertical_fl.vfl_fixture import FederatedLearni...
f03129f71017c2696ad8e0874ad9f9d75695dab0d07a4e196027d3e9fe0f34d0
Python
3,796
98
""" Download the weights in ./checkpoints beforehand for fast inference wget https://storage.googleapis.com/sfr-vision-language-research/BLIP/models/model*_base_caption.pth wget https://storage.googleapis.com/sfr-vision-language-research/BLIP/models/model*_vqa.pth wget https://storage.googleapis.com/sfr-vision-language...
7e02a4a94b8725996222bb1a909d00b94fa308cba87e69270a2c91ccd2f057ff
Python
3,797
116
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the di...
b888fd39e596a42086976baa4b1d497b2163b128fd3c6b3a1005cdac3bea4327
Python
3,797
100
import json import pathlib import unittest import bs4 import responses from bs4 import BeautifulSoup from exsclaim import journal class TestNature(unittest.TestCase): def setUp(self): """Instantiates a test search query and JournalFamily to test""" nature_json = pathlib.Path(__file__).parent / "...
f1a561861fd8c151a2f4b9efe5688f7d3e99251fc560b3b0cbd4f08d16a16604
Python
3,801
86
from lifelines.datasets import load_rossi from lifelines import CoxPHFitter import sys sys.path.insert(0, "/home/mfromano/Research/mri-surv-dev/mri_surv") from simple_mlps.datas import ParcellationDataVentriclesNacc, ParcellationDataVentricles import pandas as pd import numpy as np import functools # ignore warnings # ...
5a039fbc1e1ccfe222227ab2722b6a9254af299172187ea447d4787ae6e298fd
Python
3,805
75
from mpi4py import MPI from .FedOptAggregator import FedOptAggregator from .FedOptClientManager import FedOptClientManager from .FedOptServerManager import FedOptServerManager from .FedOptTrainer import FedOptTrainer from ...standalone.fedopt.my_model_trainer_classification import MyModelTrainer as MyModelTrainerCLS f...
42fc6a6cadd397ccf02615382b894469c0f72f5bcea8d211d3e5c2dc9bf6b8fa
Python
3,809
101
import networkx as nx import numpy as np from .base_topology_manager import BaseTopologyManager class SymmetricTopologyManager(BaseTopologyManager): """ The topology definition is determined by this initialization method. Arguments: n (int): number of nodes in the topology. neighbor_num ...
06846626b591025f0c20c873e5f2ec4765cbcd45fb9476dec46fa82d5a8dfe3e
Python
3,810
71
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_three_party_data from fedml_api.model.finance.vfl_models_standalone import LocalModel, DenseModel from fed...
f4bc0013e04174e969372929bf95a10188b8fd5754231ef30ea18e70a889f5e4
Python
3,810
76
import logging import json import numpy as np import torch import torch.utils.data as data logging.basicConfig() logger = logging.getLogger() logger.setLevel(logging.INFO) DEFAULT_BATCH_SIZE = 16 train_file_path = '../../../data/synthetic_1_1/train/mytrain.json' test_file_path = '../../../data/synthetic_1_1/test/my...
7b27c624b2925a83fbe1cdde2380b91ac3fc89c74980b4cee67d97d3b5acc59f
Python
3,813
86
from gensim.models import Word2Vec import numpy as np import multiprocess as mp # For dynamic loading: name of this method should be the same as name of this python FILE. def deepwalk(ctrl, graph): '''Use DeepWalk as the base embedding method. This is a wrapper method and used by MILE.''' args = DeepWalkSetti...
20538acca9e229f9a966fe70aa91ccd0f1c3a9b1b16128ad65db9d729a98073d
Python
3,816
75
from mpi4py import MPI from .FedAVGAggregator import FedAVGAggregator from .FedAVGTrainer import FedAVGTrainer from .FedAvgClientManager import FedAVGClientManager from .FedAvgServerManager import FedAVGServerManager from ...standalone.fedavg.my_model_trainer_classification import MyModelTrainer as MyModelTrainerCLS ...
bb20b20d5eff5fd32305d1c43d3f411cdb264f230282abc7a691fe56224e393f
Python
3,819
105
import shutil import sys import urllib from functools import partial from urllib.request import urlopen import genomad from genomad import utils from rich.progress import ( BarColumn, DownloadColumn, Progress, TextColumn, TimeRemainingColumn, TransferSpeedColumn, ) class DatabaseDownloader: ...
099f3738feae55a7bc59ccb370a3c06ed1289fc26bfc7e95c33b4e9b6dde9ab3
Python
3,820
119
# -*- 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...
72b04c84a231d8ec91e63c30c0adb7512132932467db31a608fe854c567580ad
Python
3,820
116
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright 2019 Tomoki Hayashi # 2023 Jiatong Shi # Adapted from ESPnet fastspeech duration predictor # Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0) """Duration predictor related modules.""" import torch from parallel_wavegan.layers.layer_norm i...
73af9dd2465e3abaa1adf2673b646de6be5fffa1f7e85b2c276540dc2910fdc8
Python
3,820
108
# %% from pathlib import Path import datetime import shelve import pandas as pd from sklearn.metrics import make_scorer, roc_auc_score from eegml import model as mod from eegml import toolkit as tk config = tk.parse_config("config.yaml") models = mod.parse_models("models.yaml") clinical_data = Path(config["data"]["...
70af340841adea48adc66219f45cfcba985d253c16a419409700fe3e7b989f66
Python
3,822
117
""" Cross-validated Pearson correlation between a JOINT model (SSS + interpretable features) and high-gamma ECoG, across layers. """ #### 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", "/engra...
96c41d7192958289faad4981b265b3c4b3bb6b9535f2d8ae32830d97a72b6983
Python
3,825
109
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_PA...
fa3fef6dac6032f949bc7c8f0b706208a7b5a0f1dc4439394dae629f7a65bcd2
Python
3,825
75
import logging from fedml_api.distributed.fedavg_robust.message_define import MyMessage from fedml_api.distributed.fedavg.utils import transform_tensor_to_list from fedml_core.distributed.communication.message import Message from fedml_core.distributed.server.server_manager import ServerManager class FedAvgRobustSer...
775f54c2f07ccb1409c7d9d2a8b063aa79a71c4f7fca344373be5c1e3c3bdd18
Python
3,826
103
from batchgenerators.utilities.file_and_folder_operations import * import numpy as np import SimpleITK as sitk from statistics import fmean,median from scipy.stats import entropy from evaluator import make_bootstrap import glob import os from tqdm import tqdm import argparse import matplotlib.pyplot as plt def remov...
0820c819f24787a51c71f2119973a89e4a9a2ec810a37707c0444fe26c1ffdb9
Python
3,829
129
# Copyright (c) OpenMMLab. All rights reserved. import torch from torch.nn.modules.batchnorm import _BatchNorm from mmpose.models.backbones import HRNet from mmpose.models.backbones.hrnet import HRModule from mmpose.models.backbones.resnet import BasicBlock, Bottleneck def is_block(modules): """Check if is HRMod...
9ada6f190ccf1aa0b2eef0fd1a3e8ed1bf963b320a0045a3ec1f32aacdc90022
Python
3,829
92
regions = { "Orbital": { "labels": [6], "classifier": r"K:\workstation\code\shared\img_processing\NeuronCounting\classifiers\200316auditory\short1.classifier".replace('\\', '/'), "volume_bar": 20, "volume_avgbar": 100 }, "PrimarySomatosensory": { "labels": [16], ...
4e87f5c930901fd246a2e39b8d27a1763a269f25ff89f6877fda7a8213c2dc98
Python
3,831
81
#!/usr/bin/env python # Compare a list of CNV calls to a list of repetitive and low-complexity regions (RLCRs) # Determine how many bases of each CNV overlap with these unclean regions, what percentage overlap, # and what types of regions overlap # Usage: compare_with_RLCR_definition.py RLCR_definition_filename CNV_f...
e556c42fe413e9a741aa52c466bd9d07e3bf7cc54bcfe9414eaa45202d8daec3
Python
3,832
83
from typing import Tuple import torch from ..utils import rna2index class ShrinkedForcePermutationsDataset(torch.utils.data.Dataset): """ Dataset that supports dataset shrinking and forced jigsaw permutations by MSA duplications. """ def __init__(self, num_data_samples=-1, jigsaw_force_permutations...
837b260f44e6f1bc45cb53c462250eb85f71bf4e6dff1e7a1bff8610d383f3a1
Python
3,836
129
_base_ = [ '../../../../_base_/default_runtime.py', '../../../../_base_/datasets/coco_wholebody_face.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 pol...
e4855ad27924dd005c3fdb3b5fb5abc8dd9a9a814ee11b40713a8b952c644eca
Python
3,836
93
from collections import OrderedDict from logging import Logger from typing import List from tqdm import tqdm from .data_data import MoleculeDatapoint, MoleculeDataset, make_mols def filter_invalid_smiles(data: MoleculeDataset) -> MoleculeDataset: """ Filters out invalid SMILES. :param data: A :class:`~...
58362f80c5ae07180bd6670196037e84e5d3faf71f23d885fd81dea59acc32da
Python
3,839
111
import logging import queue import time from typing import List from ..base_com_manager import BaseCommunicationManager from ..message import Message from .mpi_receive_thread import MPIReceiveThread from .mpi_send_thread import MPISendThread from ..observer import Observer class MpiCommunicationManager(BaseCommunica...
aea870d1d9af6c876e4cb4841c41bab1f18c845e226bdf96f8e47d1639031587
Python
3,840
86
from fedml_api.distributed.split_nn.message_define import MyMessage from fedml_core.distributed.client.client_manager import ClientManager from fedml_core.distributed.communication.message import Message import logging class SplitNNClientManager(ClientManager): def __init__(self, arg_dict, trainer, backend="MPI...
c74c729326cd0c995d6d840155166e6d8e7ffefd10b10ac847da4cf4c08a9700
Python
3,840
60
# ----------------------------------------------------------------------- # # Copyright (c) 2023, UChicago Argonne, LLC. All rights reserved. # # # # Software Name: Fast Autonomous Scanning Toolkit (FAST) # # By: Argonne Na...
f301ad0356e3e1b963857fae844c054eb18329eb6667815ee0981f1058d5c237
Python
3,846
97
import math import re import subprocess import tempfile from concurrent.futures import ThreadPoolExecutor from pathlib import Path from genomad import sequence, utils class Aragorn: def __init__( self, input_file: Path, aragorn_output: Path, score_threshold: float = 1.05 ) -> None: self.input...