sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
46193f142da7056511575ae5012e1921e6afd34d8845a1721134700a85f1c4ac | Python | 13,163 | 302 | import argparse
import os
import numpy as np
from tqdm import tqdm
import torch
from fedml_api.model.cv.deeplab_utils import *
from fedml_api.model.cv.batchnorm_utils import patch_replication_callback
from fedml_api.model.cv.deeplabV3 import *
import sys
from fedml_api.data_preprocessing.coco.data_loader import get_da... |
b366803695a82eddff15530fac5ff2587af81bf7ad9c68a833f839d6c01a83b4 | Python | 13,169 | 239 |
import itertools
import matplotlib.pyplot as plt
import numpy as np
from sklearn.cluster import KMeans
from sklearn.metrics import accuracy_score
from sksfa import SFA
from sklearn.model_selection import StratifiedKFold
from sklearn.metrics import accuracy_score
from sklearn import linear_model
def linear_decodabil... |
d7938e819dd590b865b37627ff2fcb83389ed6448a091f705e1875398d08c3fd | Python | 13,177 | 322 | from lifelines import KaplanMeierFitter, CoxPHFitter
from scipy import stats
from icecream import ic
from collections import defaultdict
from statsmodels.stats import multitest
from math import factorial
import pandas as pd
import numpy as np
import lifelines
import itertools
__all__ = ['KaplanMeierPairwise','ChiSquar... |
2528fb26c7d8f78f901055c0e24b61d112b7c46957262d651ade2905a5c77a28 | Python | 13,227 | 400 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
from __future__ import absolute_import
from __future__ import with_statement
from __future__ import division
from __future__ import nested_scopes
from __future__ import generators
from __future__ import unicode_literals
from __future__ import print_function
'''
You may need:
... |
4dab63a5a61c444a54d55f3617d74358ded1e30755645bf3d159d8d034bd7255 | Python | 13,234 | 451 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 3 13:28:49 2021
@author: baris
"""
from pydentate import net_tunedrev, neuron_tools
import numpy as np
import scipy.stats as stats
import pdb
from neuron import h, gui
def granule_simulate(
grid_spikes,
dur_ms=2000,
network_type='ful... |
250537b4effa7ee5b11f175e88aecc079ff531f75699453b89ec8c0a6365a94b | Python | 13,236 | 339 | from sklearn import preprocessing
from sklearn.model_selection import StratifiedKFold, train_test_split
from binn import BINN
import numpy as np
import torch
import pandas as pd
import pytorch_lightning
import networkx as nx
class RecursivePathwayElimination:
"""
RecursivePathwayElimination is a class tha... |
6581efb847f9a234f20ecdee2c0f9cd16fc48cbf8ad21809efb651b9e6bb2a1a | Python | 13,237 | 254 | import argparse
import os.path
def main(args):
import json, time, os, sys, glob
import shutil
import warnings
import numpy as np
import torch
from torch import optim
from torch.utils.data import DataLoader
import queue
import copy
import torch.nn as nn
import torch.nn.functi... |
f832a07d77f12f94a32cbaa9fb661cf4d8ba3e0aae4ec68362547693fc549bd1 | Python | 13,263 | 275 | # Demonstrates a method for computation of resolution and noise in MR images by
# non-linear and non-static methods. Simulates data and then applies simple
# Fourier transform reconstruction, for which resolution and g-factors are then estimated.
import numpy as np
import math
import matplotlib
import matplotlib.pyp... |
8cff753f7adea47b8cc1f4e0606bec1a6100dda0d2f20f35b7b2213b80666f55 | Python | 13,267 | 335 | # -*- coding: utf-8 -*-
"""
Created on Wed Oct 13 10:45:08 2021
@author: fhu14
"""
"""
This is the top level script for calling modules written in the PaperPackage
package. The way this works is running the script adds things into the
PaperPackage directory, and all operations that require other modules
(such as p... |
72a595339afa7157875573a44b850f8ccf85f59d60140118509867feba488208 | Python | 13,272 | 346 | import pyls
import scipy
import mayavi
import numpy as np
import pandas as pd
import seaborn as sns
import fcn_megdynamics
import matplotlib.pyplot as plt
from joblib import Parallel, delayed
from mapalign.align import iterative_alignment
from netneurotools import stats as netneurostats
from scipy.spatial.distance impo... |
05659653f7e1f9844cb7f6283251eb146f63445e2648e080208fd0ba22a2d8c5 | Python | 13,273 | 406 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from torch.nn.modules.batchnorm import _BatchNorm
from mmdet.models.necks import (FPN, YOLOXPAFPN, ChannelMapper, CTResNetNeck,
DilatedEncoder, SSDNeck, YOLOV3Neck)
def test_fpn():
"""Tests fpn."""
s = ... |
1c3eccf76bdf33915dcae6b2d5944b49cad6e01c47eef857146dd064f63a597b | Python | 13,279 | 371 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import tempfile
import warnings
from collections import OrderedDict, defaultdict
import json_tricks as json
import numpy as np
from mmcv import Config, deprecated_api_warning
from xtcocotools.cocoeval import COCOeval
from ....core.post_processing i... |
44fddec5af8f61e07906662d9268f98e6b17ad7a18fe9d2e0331f8d97e325c5e | Python | 13,285 | 227 | # -*- coding: utf-8 -*-
#File Name : StimulationsCodes.py
#Created By : Aurelien Van Langhenhove
## Stimulation codes
## Originally from openvibe-toolkit/ovtk_defines.h
OpenViBE_stimulation = {
'OVTK_StimulationId_ExperimentStart' : 0x00008001,
'OVTK_StimulationId_ExperimentStop' ... |
00f1a9fcec73a371dee401bc9e10d4670b03f2c5a12b9765f7c0611c431619bf | Python | 13,292 | 378 | import os
import re
import yaml
import itertools
import numpy as np
from itertools import chain
def load_chrz():
dir_path = os.path.dirname(os.path.realpath(__file__))
with open(dir_path + '/models/characterization.yml', 'r') as stream:
try:
chrz = yaml.safe_load(stream)
except yaml... |
81919adffc441c7bccd18ade65b14fb005ddf6eb848cd76f2b005136bb9054fc | Python | 13,324 | 211 | import argparse
import gc
# import os
import random
from functools import partial
from typing import Any, Dict, Tuple
import numpy as np
import pandas as pd
import torch
import xgboost as xgb
# import mpi4py
# mpi4py.rc.initialize=False
# mpi4py.rc.finalize=False
from mpi4py import MPI
from propulate import Islands
... |
4ce7cac55456fc9d2dcadaafe38e21d9b4547821721a9fc2f5677ddd0bdc7591 | Python | 13,333 | 385 | #! /usr/bin/env libtbx.python
# -*- coding: utf-8 -*-
# =============================================================================
# Created at:
#
# Authors:
# Katarzyna Mikolajczak
# Grzegorz Chojnowski - gchojnowski@gmail.com
# =============================================================================
## @fi... |
a60adc3027175c56b585962350d6e1c2dcc190feaf23d0af0682e0ea6d9d9dde | Python | 13,346 | 336 | """ ONNX metadata script """
import collections
import json
import os
import re
import onnx.backend.test.case
import onnx.defs
import onnx.onnx_ml_pb2
import onnxruntime
attribute_type_table = [
"undefined",
"float32",
"int64",
"string",
"tensor",
"graph",
"float32[]",
"int64[]",
... |
08faa602d4fa0dcbf98694e7bee6a2da289d2c351514c0b0b61e0fde28376d35 | Python | 13,367 | 349 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
import torch.nn as nn
from mmcv.cnn import (build_conv_layer, build_norm_layer, build_upsample_layer,
constant_init, normal_init)
from mmpose.core.evaluation import pose_pck_accuracy
from mmpose.core.post_processing import flip_back
fro... |
e6c99c9ff433ee575b2bcd279c33d5c2b0a72071293784a3af0e4b991ad64eac | Python | 13,373 | 297 | ############################################
# imports
############################################
import os
import shutil
from pathlib import Path
from typing import Any, get_args
from oligo_designer_toolsuite._constants import _TYPES_REF
from oligo_designer_toolsuite._exceptions import DatabaseError
from oligo_des... |
8b9c412f5ba06e1cd45ff822940e4188d2d68e8884c042fa15d29760a5921895 | Python | 13,398 | 352 | import logging
import torch.utils.data as data
import torch
import numpy as np
import h5py
import os
from .data_utility import init_transform, count_samples, build_pairs
from fedml_api.Dist_FID.fid_score import get_activations
logging.basicConfig()
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def g... |
d21ed2f11eda2937154a48ac1760f4a5e0041d460bcb380daf65e7fb360ef0b5 | Python | 13,399 | 351 | import numpy as np
import pandas as pd
import pickle as pkl
import matplotlib.pyplot as plt
from h5py import File
from sklearn.metrics import mean_absolute_error, mean_squared_error
from sklearn.linear_model import LinearRegression
from util import mpl_default_setting
def flatten(dataset):
# Determine atom types
... |
2f13757ca0cd9cd74bb145aa03d35975a3b6a2055d8c3db1097e6502ac85db5f | Python | 13,405 | 318 | # Copyright (C) 2023-2025 ETH Zurich, Marc Lehner and other DASH contributors.
import traceback
from typing import List
import numpy as np
import pandas as pd
from serenityff.charge.tree.tree_utils import (
get_connected_atom_with_max_attention,
get_connected_neighbor,
get_possible_connected_new_atom,
)
f... |
c4dad064123bf72e537e367496c1386c4f84dcd65ba431353740fa994a3029fa | Python | 13,431 | 299 | def FiPhoEpocAveraging(inputs):
"""
Fiber Photometry Epoch Averaging Example
This example goes through fiber photometry analysis using techniques such as data smoothing, bleach detrending, and z-score analysis. <br>
The epoch averaging was done using `epoc_filter`.
Author Contribu... |
9f7c82a60ade4849e4f1790f3bea41bc1b1f7f178e311a8b8974b5a08d75a7f4 | Python | 13,433 | 383 | import collections
import torch
from pytorch_lightning import LightningModule
from torch import nn as nn
from torch.nn.utils import prune as prune
from binn.network import Network
class BINN(LightningModule):
"""
Implements a Biologically Informed Neural Network (BINN). The BINN
is implemented using the... |
e7c719dc6af1b5f737ebfae6756a6e75ade237530188e3ccec658155b43cb9bf | Python | 13,449 | 450 |
'''
--------------------------------------------------------------
Created: Nadine Eichhorn (28.08.2022)
Institute of Biomedical Engineering
Karlsruhe Institute of Technology
This is a minimal exapmle for the code generateECG
------------------------------------------------------... |
d86c0c1bc85ec69183d0b502946954ccd0d39f377d2cdb420b8364439041d45c | Python | 13,455 | 306 | # Copyright (c) OpenMMLab. All rights reserved.
# Modified from https://github.com/facebookresearch/detectron2/tree/master/projects/PointRend/point_head/point_head.py # noqa
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.ops import point_sample, rel_roi_point_to_rel_img_point
from mmcv.r... |
10177cd007b790d0233835f5ef86f1396724e2d4416a0f4388aef751e3c9be59 | Python | 13,459 | 355 | import sys
import re
import string
import os
import io
import p4.func
import copy
from p4.var import var
from p4.p4exceptions import P4Error
from subprocess import Popen, PIPE
class Sequence(object):
"""A container for a single molecular sequence.
Data attributes
- **sequence** a string, the molecular s... |
99fcb7be51a4150e450e9a92f74c7720e251418004d6241b2baebad3b1a85a45 | Python | 13,465 | 377 | # 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/>
"""Test PyTorch utility functions."""
from __future__ import annotations
import warnings
from copy import deepcopy
import numpy as np
import pytest
imp... |
3d0b07c2aab4a59bb84985ea8e85edf37050faf98b9665ebfd521216cc10e923 | Python | 13,482 | 287 | import pandas as pd
from functions import *
from model_functions import *
from the_model import *
matplotlib.rcParams['axes.prop_cycle'] = matplotlib.cycler(color=["#F4511E", "#FB8C00", "#FFB300", "#FDD835", "#C0CA33", "#7CB342", "#43A047", "#00897B", "#00ACC1","#3949AB"])
#####################################... |
f8eb5a08d20e5288676b4246b699be6ddb8beaca096f21618cef280bc34ca039 | Python | 13,486 | 352 | # 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/>
# This code is based on on the following three papers:
# Lingsch et al. (2024) FUSE: Fast Unified Simulation and Estimation for PDEs
# (https://proceedin... |
601d06e3bd45ca7c0aef5bbffbd5305279f98c1a0d1f7254920d69c64c892af7 | Python | 13,487 | 317 | import pandas as pd
import numpy as np
import logging
import gensim.models
from gensim import utils
from gensim.corpora.wikicorpus import WikiCorpus
class SentencesCorpus:
"""An iterator that yields preprocessed sentences"""
def __init__(self, corpus_filename: str):
"""
Initializes the object... |
c83fc92ecfa73f02e11f00c099a38ac419af324f08343aa9851d01982aec0d88 | Python | 13,489 | 315 | import argparse
import glob
import logging
import os
import sys
import time
import numpy as np
import torch
import torch.backends.cudnn as cudnn
import torch.nn as nn
import torch.nn.functional as F
import torch.utils
import torchvision.datasets as dset
import wandb
from fedml_api.model.cv.darts import utils
from fed... |
c34d08dc6badbdf5c341376c74676b7c05f802b794bf70739546c6f359aef027 | Python | 13,497 | 350 | """test_models.py
This file is part of the test suite for keras2c
Implements tests for full models
"""
#!/usr/bin/env python3
import unittest
from tensorflow.keras.layers import (
Input, Dense, LSTM, Conv1D, Conv2D, Add, Concatenate, Reshape,
Permute, MaxPooling2D, Dropout, Flatten
)
from tensorflow.keras.mod... |
76666900ccac4b053aae94a19dd181f601ce7e713a88159ed31a1752632c612a | Python | 13,504 | 363 | import utils
import json
from umls_api.Authentication import Authentication
import requests
import sys
import urllib2
import urllib
import traceback
import math
import logging
class UMLSAPI(object):
"""
Using UMLS APIs to get semantic associations between concepts
"""
api_url = "https://uts-ws.nlm.nih... |
110c02c68cbcf93e4a558e0caa42633aa4901d3eb7c252f841f38d082b3861c1 | Python | 13,519 | 414 | import sys
import argparse
import numpy as np
import os
import pickle
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
from scipy.spatial.distance import pdist, squareform
from model.Model_amp import *
from model.Model_acp import *
from math import pi
import pandas as pd
def load_amp(dir):
amps = []
labels = []
... |
45ae6b298e013679b509e3621da9a7f60b006ddd6378ad6785f11822f6828c0c | Python | 13,530 | 267 | #!/usr/bin/env python
import unittest
import pandas as pd
from os import path
from picrust2.util import TemporaryDirectory
from picrust2.default import default_regroup_map, default_pathway_map
from picrust2.pathway_pipeline import pathway_pipeline
# Path to test directory.
test_dir_path = path.join(path.dirname(path.... |
be2ff5625012474f27c6a12bdba6fae3147f51e642f97b1f30baa90632270c89 | Python | 13,533 | 311 | """Guards for the torch.compile-only fast paths in nbops and ops.
The eager and compiled branches of `get_nb_mode`, `is_input_padded`,
`mol_sum` and `ops.nse` must agree. Under torch.compile these functions
deliberately avoid `Tensor.item()` (a graph break) and read tensor metadata
instead, so nothing else pins them t... |
47316526967a04e18aab66b7695b462ed75356d39becada2bb9c94d815a15c7a | Python | 13,536 | 306 | # 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 functools import partial
from typing import Optional, Union
from warnings import warn
import torch
from torch import Tensor
from sbi.inference.post... |
8d74fa8e05c2a835e4592dd45660e3373b6edd7e01d2ad5592661dcb0f830203 | Python | 13,547 | 406 | import math
import numpy as np
import torch
from torch import Tensor, nn
import torchvision
from torchvision import models
from torchvision import transforms
import torchmetrics
import utils
import monai
from pytorch3d.renderer import (
FoVPerspectiveCameras, look_at_view_transform, look_at_rotation,
... |
16eb7c083ad7996a9e400e5da3dc1d2c5fa4b9996b156e8217e855a4b9a4056a | Python | 13,557 | 311 | # Copyright (c) OpenMMLab. All rights reserved.
import sys
import warnings
import numpy as np
import torch
from mmdet.core import (bbox2roi, bbox_mapping, merge_aug_bboxes,
merge_aug_masks, multiclass_nms)
if sys.version_info >= (3, 7):
from mmdet.utils.contextmanagers import completed
... |
a304c0cedfe560f4c75b2bbbffae17fa223502ea861c92e2c13761e7594f9cf2 | Python | 13,558 | 321 | # 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, List, Optional, cast
import torch
from nflows.utils import torchutils
from torch import Tensor, nn
from torch.distributions ... |
94c73141e79fa86e4cdb976bf6c768107fc44ebd80f2a8a170f0c40bda0a4c9b | Python | 13,581 | 406 | import torch
import torch.nn as nn
import torch.nn.functional as F
import sep.helpers.utils as utils
from sep.training.base_network import BaseNetwork
def rescale_conv(conv, reference):
"""
Rescale a convolutional module with `reference`.
"""
std = conv.weight.std().detach()
scale = (std / refer... |
d5e4b54ac8a6c0ff11915527f5ecd5934c7daf30ded70cce1b5a0b40b4cc9860 | Python | 13,591 | 333 | # 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
import os.path
from pytest import mark, raises
from os.path import join
import numpy as np
import psutil
... |
18f5e7b2617140a8d903245e18bc691ae33b1fa7fee407ddb79de62bb410bed8 | Python | 13,592 | 349 | import logging
import torch.utils.data as data
import torch
import numpy as np
import h5py
import os
# from skimage.transform import resize
from .data_utility import init_transform, count_samples, build_pairs
from fedml_api.Dist_FID.fid_score import get_activations
logging.basicConfig()
logger = logging.getLogger()... |
d417697b902175019c8aa376d57838107842771504c53e1d503e785723a8ace8 | Python | 13,598 | 332 | import sys
if "../" not in sys.path: sys.path.append("../")
import numpy as np
import pandas as pd
from os import path
from scipy import stats
from tqdm import tqdm
import pickle
import glob
import random
from eye_tracking.eye_tracking import get_direction_moved, get_stim_at_frame
from helpers.parallel_process import... |
e19b08e40495031a8e2b3dea02fd24de19fbf9fc8bde80b9af0b6f531d9c3e08 | Python | 13,598 | 391 | # 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/>
"""Tests for per-model vector-field configs."""
import inspect
from dataclasses import fields as dc_fields
from typing import get_args
import pytest
imp... |
35a3630c7ad176539e21511f079e04ec1b264b0cd954982db0a312e5b1afe4d9 | Python | 13,605 | 356 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
import numpy as np
import torch.nn as nn
from mmcv.cnn import build_conv_layer, build_norm_layer
from ..builder import BACKBONES
from .resnet import ResNet
from .resnext import Bottleneck
@BACKBONES.register_module()
class RegNet(ResNet):
"""RegNet... |
d4760e6376b7b8b02ceb0afca0848ba476498bf2cf10c6263eb0f06482189eb6 | Python | 13,611 | 415 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import tempfile
import pytest
from numpy.testing import assert_almost_equal
from mmpose.datasets import DATASETS
from tests.utils.data_utils import convert_db_to_output
def test_animal_horse10_dataset_compatibility():
dataset = 'AnimalHorse10Dataset'
... |
66d029f4f04971a9a7bae89f621cab0f0b14a44486aeda1b53c8f03ce5160b40 | Python | 13,616 | 364 | import numpy as np
import pandas as pd
import random
from tqdm import tqdm
from typing import List
from functools import partial
from copy import deepcopy
from .. import base as pea2_base
from .population import (
evaluateBinary,
generateParticles,
vanillaReferencesUpdate,
generateVariable... |
7ee3dc11a2af102f294d818c892219dfc8df76b4c79eb10a9b12a282fb72b0a7 | Python | 13,644 | 388 | # Acquired from https://github.com/pytorch/vision/tree/master/references/detection
import copy
import json
import pathlib
from collections import defaultdict
import numpy as np
import pycocotools.mask as mask_util
import torch
import torch._six
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeva... |
bae31f38ae2b89631a85d79bf72f9487ef1d814369689bf88130a735effcd6c7 | Python | 13,645 | 343 | # 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/>
"""Utils for processing tensorboard event data."""
import inspect
import logging
import warnings
from copy import deepcopy
from pathlib import Path
from t... |
47fbc31a775ce4ab84151c6b4249b8edeac2ea198742e15eb29ece1e0fe2708d | Python | 13,646 | 319 | # -*- coding: utf-8 -*-
"""
Conditions
=======
This module contains classes and methods for extracting conditions, as well as directly related functions.
author: Damian Wilary
email: dmw51@cam.ac.uk
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
i... |
f46e8eaaa458ce58d620ba31f40b6300741c16f0bdeed0964579d383f766c9c7 | Python | 13,690 | 421 | import itertools
import os
import re
from itertools import chain
import numpy as np
import yaml
def load_chrz():
dir_path = os.path.dirname(os.path.realpath(__file__))
with open(dir_path + "/models/characterization.yml", "r") as stream:
try:
chrz = yaml.safe_load(stream)
except ya... |
3be0ee6d0ee7f169808c84010af727528e31bcdd57f1503ea10240d92bc8254f | Python | 13,704 | 332 | from typing import Union
from binn.plot import subgraph_sankey, complete_sankey
import networkx as nx
import numpy as np
import pandas as pd
class ImportanceNetwork:
"""
A class for building and analyzing a directed graph representing the importance network of a system.
Parameters:
importance_df ... |
84aad0629835ee6ebe9b2575770b8474d04783ea529a74c737c3884d1f02790a | Python | 13,709 | 307 | # supplement file for classifier's survival plot, will overlay on original image
# Created: 11/2/2021
# Status: in progress
# CUBLAS_WORKSPACE_CONFIG=:4096:8 python survival_plot_xz.py
from collections import defaultdict
from statistics.mlp_output_wrappers import load_mlp, load_demographics, convert_to_pivot, convert_... |
c5f1397850fe2be5c1d168e2f8f36a19c972735e66e40864d2540832f89c3520 | Python | 13,713 | 392 | """Implementations of common classifiers.
The implementations rely mostly on scikit-learn. They use default parameters
that were found to work on most datasets.
"""
# TODO: check consistency in variable naming
# TODO: implement unit tests
from .classifier import Classifier, ClassificationResult, register_cl... |
37d577b17e692178b1081fb4841ee7535a6b4d31222ac7659a047ca32ed7f83e | Python | 13,714 | 433 | from dataclasses import dataclass
from pathlib import Path
class classproperty(property):
def __get__(self, cls, owner):
if self.fget is None:
raise AttributeError("unreadable attribute")
return classmethod(self.fget).__get__(None, owner)()
@dataclass
class GenomadData:
data_dir:... |
00dbd5601e8927951e90cf43e7f1c73f76ba97975ed61fb3e15134ab1daf603e | Python | 13,728 | 318 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import Linear, bias_init_with_prob, constant_init
from mmcv.runner import force_fp32
from mmdet.core import multi_apply
from mmdet.models.utils.transformer import inverse_sigmoi... |
94e73b69276f961f0601c4ec942d2a7298a58de89654ddab74e1005d96a32203 | Python | 13,743 | 373 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
import warnings
from collections import OrderedDict
import mmcv
import numpy as np
from mmcv.utils import print_log
from terminaltables import AsciiTable
from torch.utils.data import Dataset
from mmdet.core import eval_map, eval_recalls
from .build... |
94ace13aebfd47959040eea8bc2bf972b47f47f43376e993228558591bf3c9e8 | Python | 13,759 | 319 | from models.med import BertConfig, BertModel
from transformers import BertTokenizer
import torch
from torch import nn
import torch.nn.functional as F
from models.blip import create_vit, init_tokenizer, load_checkpoint
class BLIP_Retrieval(nn.Module):
def __init__(self,
med_confi... |
36b86eb147f85e7c833092829ab29901fda64d1b2681c5cc171a4fb8d2d00c00 | Python | 13,770 | 388 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import tempfile
import pytest
from numpy.testing import assert_almost_equal
from mmpose.datasets import DATASETS
from tests.utils.data_utils import convert_db_to_output
def test_top_down_OneHand10K_dataset_compatibility():
dataset = 'OneHand10KDataset'... |
086c9e996e413bfb060a2ef55cc3c880cb4d13732bc866fdb6a4352c6a05cf65 | Python | 13,771 | 256 | from GUI_and_data_processing.Data_processing import analyse_Ethovision_data
from tdt import StructType
from copy import deepcopy
import sys
import numpy as np
import os
import pandas as pd
def find_possible_TDT_event_names(inputs):
if inputs['Type'] == 'Other':
# Create a list of system var... |
e25f75df54474e27c3e06d8864372a57c8fab4684db5a1711aa383d6a199a56d | Python | 13,773 | 340 |
import os
os.environ['XLA_PYTHON_CLIENT_PREALLOCATE'] = 'false'
from pprint import pprint
import jax
import jax.numpy as jnp
import jax.tree_util as tree
import numpy as np
from functools import partial
import haiku as hk
import optax
from absl import app, flags, logging
from collections import namedtuple
from tqdm i... |
bf212bbd8b49827ff4f03579bf095a4526475a24c60ddadbe77918a0dd595087 | Python | 13,780 | 285 | import os
import torch
import torchvision
from torch import nn
from models.UNet import setup_unet
from models.perception_loss import vgg16_feat, perceptual_loss
from .base_model import BaseModel
from . import networks
from parse_config import ConfigParser
import parse_config
class DadganModel(BaseModel):
""" Thi... |
61f5c8bf5e8542745df3f9cd02b34c2deb1123e5b6bdd15005958df8bd4803d1 | Python | 13,784 | 345 | import json
import pandas as pd
import math
import numpy as np
import matplotlib.pyplot as plt
import traceback
import utils.functions_ZZ_extraction as fct
from utils.import_data import *
class NoOutputError(Exception):
pass
def bout_type(bout, df_bout):
if df_bout['abs_Max_Bend_Amp'].iloc[bout] < 25:
... |
e868b219c180d157257185fc10346338469a81af282e6bc3afc67728c289261b | Python | 13,785 | 363 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import warnings
import mmcv
import numpy as np
import torch
from mmdet.core.visualization.image import imshow_det_bboxes
from ..builder import DETECTORS, build_backbone, build_head, build_neck
from .base import BaseDetector
INF = 1e8
@DETECTORS.register_m... |
a7826c31a2bff82299f4b9196e5c3422d11673af48af2780440640050a438aa9 | Python | 13,788 | 286 | import argparse
import logging
import os
import random
import socket
import sys
import datetime
import numpy as np
import psutil
import setproctitle
import torch
import wandb
import yaml
# add the FedML root directory to the python path
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../")))
from... |
8ace390279768055f34fc2806f3e9bd6d40051d3d194ab275eb96d7e5e85bb0f | Python | 13,831 | 286 | import argparse
import logging
import os
import random
import socket
import sys
import datetime
import numpy as np
import psutil
import setproctitle
import torch
import wandb
import yaml
# add the FedML root directory to the python path
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../")))
from... |
84ddc9f0a146598d462d5e67df7e1f864e525d0c387ce7aff96bd45a45869cc0 | Python | 13,860 | 285 |
import torch
import numpy as np
import os
from matplotlib import pyplot as plt
import matplotlib
from PIL import Image
import pickle as pkl
from bayes_design.decode import decode_order_dict, decode_algorithm_dict
from bayes_design.evaluate import metric_dict
from bayes_design.model import model_dict, TrRosettaWrapper... |
54a4bdd7a30d60ed9c2ff08f9ed0f3e2279633e75b4b5d3ef53fc885cf06e28b | Python | 13,880 | 381 | ## Acquired from https://github.com/pytorch/vision/tree/master/references/detection
import json
import tempfile
import numpy as np
import copy
import time
import torch
import torch._six
from pycocotools.cocoeval import COCOeval
from pycocotools.coco import COCO
import pycocotools.mask as mask_util
from collections i... |
8725373b12d1474db95e93981c6832590d4d3548d80c2307f51620e510cd4fb8 | Python | 13,889 | 383 | import logging
from typing import Union, Any, Optional, Callable, List
from typing_extensions import Literal
import math
import eagerpy as ep
import numpy as np
from foolbox.attacks import LinearSearchBlendedUniformNoiseAttack
from foolbox.tensorboard import TensorBoard
from ..models import Model
from ..criteria im... |
e43cedafed4aedad9e0dbe14833ba7d83f0b338d296084421c2d626406e7828a | Python | 13,903 | 394 | """
This script will generate several figures that give an overview of how the
library performs at fitting various distributions.
"""
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
import itertools
import powerlaw
# Big font and nice DPI
plt.rcParams["font.size"] = 14
plt.rcParams["figure.d... |
8c6e2d66aa708602fefa44249404b53df1b688c1e8ce3c8eec3a1d7aa65efc05 | Python | 13,910 | 481 | import json
import os
import pathlib
import torch
import torch.nn as nn
import torchvision.transforms as T
from PIL import Image
from torchvision import models
class ScaleBarReaderTest:
# Utility Functions ####
def is_number(self, n):
"""returns true if a string n represents a float"""
try:
... |
e44c80a06cf909055acd2eade7b2ca8810fa80035e6ff6f8129a4cc801179407 | Python | 13,918 | 409 | # 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
from torch import eye, ones, zeros
from torch.distributions import Multi... |
7c772cc32f9c12b0b3f60aeae57fd1465d09c877ff05b3c0561f3d268ca6ce3b | Python | 13,932 | 263 | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 9 18:27:50 2021
@author: fhu14
TODO: How to generate energies from the start? Do a pass through of all
feeds to get initial Eelec guesses?
"""
#%% Imports, definitions
from typing import Dict, List
from DFTBLayer import DFTBList, DFTB_Layer
from .util import paired... |
a4f580b458d8911bfc4513f599c171670402493df7f5e3c711858ab9d1197e69 | Python | 13,935 | 345 | ############################################
# imports
############################################
from typing import Any
from oligo_designer_toolsuite.database import OligoDatabase
from oligo_designer_toolsuite.oligo_efficiency_filter import BaseScorer
from oligo_designer_toolsuite.oligo_property_calculator import ... |
d9f263c9b6d50d4834777e76f0da604d97b8f822f8df906684ed6ba5df681ec7 | Python | 13,938 | 342 | import torch
import tensorflow as tf
import os
os.environ['XLA_PYTHON_CLIENT_PREALLOCATE'] = 'false'
tf.config.set_visible_devices([], device_type='GPU')
from pprint import pprint
import jax.numpy as jnp
import jax.tree_util as tree
import numpy as np
from functools import partial
import haiku as hk
import optax
impor... |
db4491d6744258c402eebafb6ccb94e78d45f491cb1365c89eb5c8c0f01ef9a2 | Python | 13,946 | 387 | # 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 pickle
from os.path import exists, dirname, join
import torch
import light... |
446d549dcbad98c7aa339484aaf93577330ca94e9e1fb414f615c199277467f4 | Python | 13,947 | 382 | from abc import abstractmethod, ABCMeta
from typing import Optional
from torchmdnet.models.utils import act_class_mapping, GatedEquivariantBlock, GatedEquivariantLinearLayer
from torchmdnet.utils import atomic_masses
from torch_scatter import scatter
import torch
from torch import nn
__all__ = ["Scalar", "DipoleMoment... |
25b201a84b4c1c7805b97db2f87c8badc8bebad29c1cc3d8e9630d9c8d8ade44 | Python | 13,951 | 318 | import argparse
import torch
import torchvision
import torchvision.transforms as transforms
import torch.optim as optim
import torch.nn as nn
import model
import dataloader
from math import log10
import time
import datetime
from tensorboardX import SummaryWriter
import numpy as np
from tifffile import imread
import os... |
1456c819c0d8bf7a370f27364588355202ed82b4fd87b22b74c9cd14fc815fbf | Python | 13,958 | 332 | import tensorflow as tf
import os
import time
import utils
import numpy as np
from sklearn.model_selection import KFold
import shutil
BATCH_SIZE = 80
NUM_STEPS = 41
HIDDEN_SIZE = 300
SKIP_STEP = 4
TEMPRATURE = 0.7
LR = 0.00005
LEN_GENERATED = 16
TYPED_ANNS = ['posM', 'negM', 'hisM', 'otherM']
ANN_TOKEN = 'UMLS_CONCEP... |
9266f67be6f819ff5747e3d75e000de545302d522e2b98a81567c072e1cfdeb2 | Python | 13,958 | 350 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from abc import abstractmethod
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule
from mmcv.runner import force_fp32
from mmdet.core import build_bbox_coder, multi_apply
from mmdet.core.anchor.point_generator import MlvlPointGenerator
fro... |
30221e02a8955dfbc9809a10c23c82bf18bdb34598ce96a73db629f6e418394b | Python | 13,971 | 400 |
import collections
import csv
import logging
import multiprocessing.pool
import os
import shutil
import sys
import tempfile
import traceback
import logging.handlers
from typing import Dict
from typing import List
from typing import Set
from typing import Tuple
import tensorflow as tf
FED_GLD_SPLIT_FILE_BUNDLE = 'l... |
2d181a55de52b667bd0cd3ee26c8969c34217c404d993205be1f47e56791f09f | Python | 13,988 | 286 | import torch
import torch.nn as nn
from transformers import GPT2Tokenizer, GPT2Config
from models_gpt2_source import GPT2Model
from torch.optim import Adam
from models_utils_pytorch import build_bool_sequence, build_basic_mask, build_index_integer, build_out_mask
from models_utils_pytorch import build_data_sequence_bat... |
c3a38ff272500e0129283442da09a5d4880a502ac0c4b40b07a13e48da9a0d2a | Python | 13,996 | 365 | import bone
pd = bone.pd
re = bone.re
hu = bone.hu
np = bone.np
def getMSigDB(gs):
url = "https://www.gsea-msigdb.org/gsea/msigdb/download_geneset.jsp?geneSetName=" + gs + "&fileType=txt"
df = pd.read_csv(url, sep="\t")
df.columns.values[0] = 'ID'
l1 = [list(df.ID[1:])]
wt1 = [1]
return wt1, l1... |
a7882e0bc5333124f175636cd607d99d9930db946b7946b1f71759c62d4cb9b6 | Python | 13,997 | 464 | """
This script will create all of the figures for the documentation.
Conventions
-----------
- All files should be saved in png format.
- Make sure to close the figures after they are saved using ``plt.close()``;
this script is not meant to display anything.
- For a typical standalone plot the default size should ... |
adb15db6cf4dba9a60dbf61a12bbfb23aa0990a5e0936274e398b552f109beea | Python | 13,999 | 353 | import torch
import torch.nn as nn
from torch.utils.model_zoo import load_url as load_state_dict_from_url
def get_model_urls():
model_urls = {
'resnet18': 'https://download.pytorch.org/models/resnet18-5c106cde.pth',
'resnet34': 'https://download.pytorch.org/models/resnet34-333f7ec4.pth',
'r... |
45e9efe214993b52216fd711b33a5449d5644d3fa5ae19bcc9eecd5c5271a153 | Python | 14,000 | 325 | import logging
import os
import shutil
import torch
import wandb
from torch import nn, optim
from torch.optim.lr_scheduler import ReduceLROnPlateau
from fedml_api.distributed.fedgkt import utils
class GKTServerTrainer(object):
def __init__(self, client_num, device, server_model, args):
self.client_num =... |
d53c7c46aea58f2ff478f04a75668e0c62d47cf9617696fd39aa344162a2e3ec | Python | 14,011 | 224 | import argparse
import os
import random
from datetime import datetime
from functools import partial
from typing import Tuple
import numpy as np
import pandas as pd
import torch
import xgboost as xgb
from sklearn.model_selection import KFold
from selbstaufsicht.models.xgb import xgb_utils
def main():
parser = ar... |
f3df8c9e32901c8706292baa317a89f458c63995c29191785c578834c61bbc15 | Python | 14,021 | 453 | import pytest
from pathlib import Path
from clipkit.clipkit import execute
from clipkit.files import FileFormat
from clipkit.modes import TrimmingMode
from clipkit.settings import DEFAULT_AA_GAP_CHARS, DEFAULT_NT_GAP_CHARS
here = Path(__file__)
@pytest.mark.integration
class TestOutFormats(object):
def test_clu... |
62a1fb42f863b5af5cd3cae152c1360796fcc6db771a8adc79f879d1584d1260 | Python | 14,064 | 312 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This experiment was created using PsychoPy3 Experiment Builder (v3.0.7),
on Fri Aug 9 18:28:16 2019
If you publish work using this script please cite the PsychoPy publications:
Peirce, JW (2007) PsychoPy - Psychophysics software in Python.
Journa... |
26021a574a04f07f56421f56ab5021112ba307eaac186e331eb6d77955727d99 | Python | 14,069 | 361 | import os
import pickle
import copy
import json
from collections import defaultdict
import numpy as np
import random
import torch
from rdkit import Chem
import networkx as nx
import imp
import h5py
from tqdm import tqdm
import hashlib
import torch as pt
from glob import glob
import pandas as pd
import ase.units as unit... |
094a30b81fc9a61f3a45e153f618b3f057f4174df5451ab043698bec639d34c8 | Python | 14,071 | 363 | import logging
import torch.utils.data as data
import torch
import numpy as np
import h5py
import os
from .data_utility import init_transform, count_samples, build_pairs
logging.basicConfig()
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def get_transforms_G():
transforms_train = ["RandomCrop", "... |
3ab5658382e3ec81407411326e44055b6426780c0240c1a081900a00f380899a | Python | 14,086 | 421 | # -*- coding: utf-8 -*-
# Copyright 2019 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""Utility functions."""
import fnmatch
import logging
import os
import re
import sys
import tarfile
from distutils.version import LooseVersion
import h5py
import numpy as np
import torch
import yaml
from fi... |
7f97fdaa46b3ffe2021bf87188e2de772430f0b84b50c91d1cffba609dbbaf91 | Python | 14,091 | 345 | '''
* Copyright (c) 2022, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
* By Junnan Li
'''
import argparse
import os
import ruamel_yaml as yaml
import numpy as np
imp... |
bca3741a202693afaad5159565fe08fdb831e475ee202c92566b5ac5ba3d3b71 | Python | 14,104 | 453 | # Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
from functools import partial
import mmcv
import numpy as np
import pytest
import torch
from mmcv.cnn import Scale
from mmdet import digit_version
from mmdet.models import build_detector
from mmdet.models.dense_heads import (FCOSHead, FSAFHead, Ret... |
1049027da90ae6634adf6199f60311a16e1f5bddb9ae944aa8a22e42ad25ddb0 | Python | 14,119 | 351 | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
import torch
import torch.nn.functional as F
from ..builder import BBOX_CODERS
from ..transforms import bbox_rescale
from .base_bbox_coder import BaseBBoxCoder
@BBOX_CODERS.register_module()
class BucketingBBoxCoder(BaseBBoxCoder):
""... |
5d408c2d0fc5d15caa6ef26c4c24f572a544173f1a7cc5ea0ae8365d043dede7 | Python | 14,126 | 389 | '''
Author: ----
Date: 2022-06-14 19:48:48
LastEditors: GhMa
LastEditTime: 2022-09-08 16:16:41
'''
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.backends.cudnn as cudnn
import os
import argparse
import importlib
import geotorch
import uuid
import random
from models import *
from crit... |
507f2bcca0d66b30df92c862ed8b268070776fd0d037f79fd7fb9dc9dd67cdf8 | Python | 14,128 | 403 | from typing import Any, TypedDict
class RegionHeaderSpec(TypedDict):
region: str
additional_info: dict[str, Any]
coordinates: dict[str, Any]
EXPECTED_HEADER_VALUES_HUMAN_NCBI: dict[str, RegionHeaderSpec] = {
"gene": {
"region": "AARS1",
"additional_info": {
"source": ["NC... |
3b772a7d90fb07c6920ec052a3b83821460b9a760fea51c67e0d6cd0cafb10b2 | Python | 14,165 | 367 | # Copyright (c) OpenMMLab. All rights reserved.
import warnings
from functools import partial
import numpy as np
from mmpose.core import OneEuroFilter, oks_iou
def _compute_iou(bboxA, bboxB):
"""Compute the Intersection over Union (IoU) between two boxes .
Args:
bboxA (list): The first bbox info (l... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.