sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
fa5d760c7a46ce030db897cce66f1f1dc23b132edba6e12c72652c63458fbe7e
Python
3,588
90
import sys from robustness.datasets import jsinV3 from robustness.model_utils import make_and_restore_model from model_analysis_folders.all_model_info import JSIN_PATH, MODEL_BASE_PATH import os # Make a custom build script for audio_rep_training_cochleagram_1/l2_p1_robust_training def build_net(include_rep_in_model=...
07c97559859545b0bf1e28d3768765bd4d94c5880436eb01c9b8409d1aa65f9a
Python
3,589
108
""" Entry point for the larvaworld command-line interface. Dispatches to either the ``rerun`` subcommand, which replays a simulation from a stored ``run_manifest.json``, or to the standard :class:`SimModeParser` flow that configures and launches one of the supported simulation modes. """ from __future__ import annota...
23dc5d6c9009070a7df50b70fdfd0079f7e40414c14a9dd7f57fe8982abcac9e
Python
3,589
113
"""Optional smoke coverage for the technical-preview MLX backend.""" from __future__ import annotations import pytest pytestmark = pytest.mark.backend_mlx mlx = pytest.importorskip("mlx") import mlx.core as mx # noqa: E402 import mlx.nn as nn # noqa: E402 import torchlens as tl # noqa: E402 from torchlens.backe...
d63d8555b1a36633973f473066befa84c5f4243b7705ea708185b8300c16a33a
Python
3,589
108
import torch from pytorch_lightning import LightningModule from torch import nn class Block(nn.Module): def __init__(self, embed_dim, heads): super().__init__() self.ln_1 = nn.LayerNorm(embed_dim) self.ln_2 = nn.LayerNorm(embed_dim) self.attn = nn.MultiheadAttention(embed_dim, head...
07ad3e9566104b4c916f4694d18ac9cc56818790f5b1a25f708e7e846c690845
Python
3,590
111
# This example requires the following dependencies to be installed: # pip install lightly # Note: This example requires torchvision >= 0.17 for tv_tensors support. # To run with unsupervised segmentation masks instead of a grid: # pip install lightly scikit-image # Note: The model and training settings do not follow t...
19a7578635d764e5a51b0222fef0f39e8c7a45e297b0dcc62ac5827ca34372eb
Python
3,590
90
import sys from robustness.datasets import jsinV3 from robustness.model_utils import make_and_restore_model from model_analysis_folders.all_model_info import JSIN_PATH, MODEL_BASE_PATH import os # Make a custom build script for audio_rep_training_cochleagram_1/l2_p1_robust_training def build_net(include_rep_in_model=...
e070839617b846d57e13984d6773f6f2cfaf6697be6d8b2db5dc43552e406222
Python
3,590
95
from collections import defaultdict import numpy as np def _strongly_connected_components(list_of_nodes, node_successors): """ Generate nodes in strongly connected components of graph. Source: https://networkx.org/documentation/stable/reference/algorithms/component.html Uses Tarjan's algorithm [1] ...
463ea449f06e7d83fb18b08be66676f7653f7c5337bef95ed7bca74926ba5bb8
Python
3,593
92
# SOURCE: vendored from aaberdam/AdaLISTA @ master (models.py) # # Ada-LISTA ("Ada-LISTA: Learned Solvers Adaptive to Varying Models", Aberdam, Golts & # Elad, ICLR 2021). The `Adaptive_ISTA` class below is copied verbatim from the official # repo's models.py (only the `scipy.linalg.eigvalsh` import path and stray unus...
6b0a218b5720784c7f61b163ca5601206ce26c9c12756f58ce04ff7aa315cb0a
Python
3,593
92
#!/usr/bin/env python """Per-package coverage floors for the nightly smoke-tier coverage gate. r7 R72 (sol b9 MED): the only coverage gate was a single 55% aggregate, so a meaningful capture/postprocess/validation coverage loss could ship while the total stayed above the bar. These floors bind the verdict-critical pac...
def4d044e737a7ec8d43c637a8c6590b5a0c2c3f5f9f98d1a0a50ecdcc101a02
Python
3,593
115
import argparse import ast import json import sys import warnings import mlxtend.classifier import mlxtend.regressor from galaxy_ml import __version__ as galaxy_ml_version from galaxy_ml.model_persist import dump_model_to_h5, load_model_from_h5 from galaxy_ml.utils import get_cv, get_estimator from packaging.version i...
e0719032f1fa109484569dd82212b5081d2d45e16bd4133b39bfec96e8773b6e
Python
3,593
106
"""F10 lovely items 10-11: glance + seam adapters + echo purity. One record, many densities: the cell formatter and the HTML fixture read the SAME frozen record the line renders (a number may never exist only in HTML); the echo observer never contaminates the capture it observes. """ from __future__ import annotation...
009f671f68c73103b60de273841f0ea3ebfdd055926834779c1a9f555cb58102
Python
3,594
41
from .base_options import BaseOptions class TrainOptions(BaseOptions): """This class includes training options. It also includes shared options defined in BaseOptions. """ def initialize(self, parser): parser = BaseOptions.initialize(self, parser) # visdom and HTML visualization para...
fecfb3364ef69881bd13bd45431f5833c530ec705af7af8735bb9bf1ea1f706a
Python
3,594
121
#!/usr/bin/env python import argparse import inspect import sys from rdkit import Chem from rdkit.Chem import Descriptors def get_supplier(infile, format="smiles"): """ Returns a generator over a SMILES or InChI file. Every element is of RDKit molecule and has its original string as _Name property. ...
5c0723320ec26a41f3b455fb6cf22e58f140dcc504a857f27705f740a68e76ac
Python
3,595
89
import os import json import torch import datetime import multiprocessing from itertools import repeat from model.grud_model import GRUD from data.dataset_inference import RegionInferenceDataset from torch.utils.data import DataLoader from utils.argument_parser import get_argument from utils.imputation import inference...
9698b3b0333e02c6bc9de28d7f0f76d15a9ba95a10091ccb23f6527ec2e6454a
Python
3,595
105
""" Helpers backing the dataset analysis app. Resolves which plots apply to a selection of datasets and renders them, keeping the plotting logic out of the UI layer. """ from __future__ import annotations import os from functools import lru_cache from hashlib import sha256 from typing import Any, Callable from larv...
449275ad1f1da8a6b81351a04ac789cf51621419bcc7804e5461b185b49b63a9
Python
3,596
95
import setuptools from DePTH import __version__ with open("DESCRIPTION", "r", encoding = "utf-8") as fh: long_description = fh.read() seeds_list = [] with open("DePTH/data/ensemble_seeds_20.txt") as fp: Lines = fp.readlines() for line in Lines: line_split = line.split("\t") seed_1 = l...
cc19862a893345fa3b8e22d824802e5d6762302179eeb3d953c09b2ce7ad31cd
Python
3,596
99
import os import torch import numpy as np from PIL import Image import torch.nn.functional as F def normalize(x): return x.mul_(2).add_(-1) def same_padding(images, ksizes, strides, rates): assert len(images.size()) == 4 batch_size, channel, rows, cols = images.size() out_rows = (rows + strides[0] - ...
56db508972c4c3bd865600b85a5b8c96436186b58765bd9a601ededf58f8b446
Python
3,598
99
#!/usr/bin/env python # Retrieves data from external data source applications and stores in a dataset file. # Data source application parameters are temporarily stored in the dataset file. import os import socket import sys import galaxy.model # noqa F401 # need to import model before sniff to resolve a circular imp...
1f05a9903ba96a7bc58b8c2033c8543c505101bd4559fef9275a165e0c22ad0d
Python
3,599
112
from modular_splicing.models.modules.sparsity.drop_motifs_in import ( DropMotifsIn, ) from modular_splicing.models.modules.sparsity.discretize_motifs_in import ( DiscretizeMotifsIn, ) from modular_splicing.utils.io import load_model from .entire_model_types import entire_model_types from modular_splicing.util...
6d7e8576c5aa069d580f557f5b35468225cbcf514fa73a4655d99610e7b9bd3f
Python
3,599
77
import torch def get_freq_single_point(data : torch.Tensor, weights : torch.Tensor, pseudo_count : float) -> torch.Tensor: """Computes the single point frequences of the input MSA. Args: data (torch.Tensor): Input one-hot encoded matrix (M, L, q). weights (torch.Tensor): Weights to assign to ...
951bc5cff2e8b3f8bac8ef454a91b95cef5e95d0b33f5f9f4a3ff9cb714fc5c4
Python
3,599
96
import torch import torch.nn as nn import torchaudio from torchaudio.compliance import kaldi from config.default_hparas import WINDOW_TYPE class CMVN(torch.jit.ScriptModule): ''' Utterence-wised zero mean unit variance from https://github.com/Alexander-H-Liu/End-to-end-ASR-Pytorch/blob/master/src/...
5e5b8dcfbb4edd7a2fae0eec3bc2c87830ae604a6723739bcfca896db38fa5b3
Python
3,600
104
from ._RL_agent import * from numba import njit @njit def mb_forget_diffa_session_value(choices, second_steps, outcomes, n_trials, transition_type, params): # Unpack parameters. alpha_pos, alpha_neg, weight_mb, forget = params[:4] if transition_type == 1: trans_prob = [0.8, 0.2] else: trans_prob = [0...
f70e947bb00ef6f5bdd621c55bc27d9a4cd071facfc80720ffb8cf3c0c2970a3
Python
3,600
93
import sys from robustness.datasets import jsinV3 from robustness.model_utils import make_and_restore_model from model_analysis_folders.all_model_info import JSIN_PATH, MODEL_BASE_PATH import os # Make a custom build script for audio_rep_training_cochleagram_1/l2_p1_robust_training def build_net(include_rep_in_model=...
f89a4c4002b8dea92c46085408165454d8f14ecb32029219443de51b6151b17f
Python
3,600
127
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Connector(_BaseTraceHierarchyType): _parent_path_str = "waterfall" _path_...
c9582c39549d40977e87622b37240ea0eedc56b3c0384b41cc17916ba26b36f8
Python
3,601
123
import os import random as python_random import numpy as np import tensorflow as tf import tensorflow_datasets as tfds from tensorflow.keras.models import load_model from gradient_accumulator import GradientAccumulateModel from gradient_accumulator import GradientAccumulateOptimizer from .utils import get_opt from ....
bb1281b457504b7116f9cb4cdcefa0c0d56b6ca76ac2c70bbadfe18143ada93b
Python
3,602
54
import argparse import os import json from src.utils.Config import Config from src.train import train if __name__ == '__main__': parser = argparse.ArgumentParser() # Arguments for running any datasets parser.add_argument('-d', "--data_dir", default=None, help="Data directory containing train/val/test j...
612707d75c3a818ec5ca69e13d10df3795815ba6b44c946dd3c780aae8bcf5e9
Python
3,603
97
class PlotlyError(Exception): pass class PlotlyEmptyDataError(PlotlyError): pass class PlotlyGraphObjectError(PlotlyError): def __init__(self, message="", path=(), notes=()): """ General graph object error for validation failures. :param (str|unicode) message: The error message....
faf5002a694d5e294ba493128017c7148c3e394a753aa31b0068df3ba76f9cbd
Python
3,603
110
"""Tests for specparam.plts.utils.""" import os from specparam.modutils.dependencies import safe_import from specparam.tests.tutils import plot_test from specparam.tests.tsettings import TEST_PLOTS_PATH from specparam.plts.utils import * mpl = safe_import('matplotlib') plt = safe_import('.pyplot', 'matplotlib') #...
2aa90052f467a410cfd6f88c859579956ff253c4f8ef329497659f7fc70fccb2
Python
3,604
92
import sys from robustness.datasets import jsinV3 from robustness.model_utils import make_and_restore_model from model_analysis_folders.all_model_info import JSIN_PATH, MODEL_BASE_PATH import os # Make a custom build script for audio_rep_training_cochleagram_1/l2_p1_robust_training def build_net(include_rep_in_model=...
a2d6df1d93cf6c2a9fbc262f133f5ee8237292fc1afe317251d94c160094f160
Python
3,604
113
#!/usr/bin/env python3 # LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this sof...
ad1b604375bb6acebbf0fead98b629559369f198a71093e9a92a39deb909ad03
Python
3,604
101
from pathlib import Path from typing import Callable, Union, List, Optional import pytorch_lightning as pl from torch.utils.data import DataLoader from DeepDenoise.src.dataset import CESTDataset def get_dataset( dir: Union[str, Path], mode: str, distribution: Optional[List[float]] = None, noise_std:...
c8578e8b63dbc2d89f8c37b3c78f8e3b7fdb9701bd709190cdb3c03935c6116a
Python
3,604
81
# FAITHFUL PORT of aritraghsh09/GaMorNet @ master (original framework: Keras/TF) # File: gamornet/keras_module.py (gamornet_build_model_keras, LocalResponseNormalization) # # GaMorNet (Ghosh et al. 2020, ApJ) -- an AlexNet-style CNN for automated galaxy # morphology classification (disk / indeterminate / spheroid) from...
05edd060d01807f3d9ebd5ca8ea3eee48a975cb7b034e8241c0177ad65c98f58
Python
3,605
99
import argparse import glob import json import math import multiprocessing import os import re import sys from importlib import import_module from multiprocessing import Lock, Pool import matplotlib.pyplot as plt import numpy as np import torch import torch.utils.data as data import tqdm from run_utils.utils import c...
9a7befc236658b11b5adaebff6c4f45cdbb075aa79736fa1e7a8961cb0fd6166
Python
3,605
101
import math import pytest import torch from torch import Tensor from lightly.loss import pmsn_loss from lightly.loss.pmsn_loss import PMSNCustomLoss, PMSNLoss class TestPMSNLoss: def test_regularization_loss(self) -> None: criterion = PMSNLoss() mean_anchor_probs = torch.Tensor([0.1, 0.3, 0.6]) ...
c55040d62f0da61cbac974acf0bc7b784601072a2c459117ac6156232bc227d7
Python
3,605
106
""" Generate validation data from the transformed and reference point inside a .csv file """ from os.path import join, dirname, abspath import plotly.express as px import pandas as pd from math import sqrt import json import csv import sys def main(argv): """Get the euclidean distance between the points of the re...
5bcb5b38929cc8109fde6593a6c8f4460a49451c21ec34b9a1e63f840ccd6bd4
Python
3,606
99
from typing import List import torch import torch.nn.functional as F from torch import Tensor from torch.nn import Module class FroSSLLoss(Module): """Implementation of the FroSSL loss [0]. FroSSL is a self-supervised objective that combines a variance/redundancy regularization term with an invariance t...
a8bbb839d91a62dc758c2eca242dc74233c8068574f6516fdff7d92e39687be5
Python
3,606
122
from collections.abc import Callable from typing import Any, Literal import numpy as np from numpy.typing import NDArray from .._modifiers import jitter, k_shuffle, reverse_complement from .._numba import gufunc_tokenize from ..alphabets import DNA class Sequential: def __init__(self, *transforms: Callable[...,...
16ce578155714ec6b6487368ee7196378eb048edeae3518528564b82297bfe3a
Python
3,607
113
import torch import torch.nn as nn from modular_splicing.models.lssi import AsymmetricConv from modular_splicing.models.modules.lssi_in_model import ( LSSI_MODEL_THRESH, load_individual_lssi_model, ) from modular_splicing.utils.construct import construct class MultipleSplicepointModels(nn.Module): """ ...
1f11336d8707b3a3e61d01dfd9639a99edfdb61569eb7297e729b06009a866be
Python
3,607
76
import os from data.base_dataset import BaseDataset, get_transform from data.image_folder import make_dataset from PIL import Image import random class UnalignedDataset(BaseDataset): """ This dataset class can load unaligned/unpaired datasets. It requires two directories to host training images from doma...
95fbf62be64b9e64b23d772fe50e0114a9e00894e7843fc585d140a5dcaa1d57
Python
3,607
92
import sys from robustness.datasets import jsinV3 from robustness.model_utils import make_and_restore_model from model_analysis_folders.all_model_info import JSIN_PATH, MODEL_BASE_PATH import os # Make a custom build script for audio_rep_training_cochleagram_1/l2_p1_robust_training def build_net(include_rep_in_model=...
07c089d6e4dd29d66940e9294b540ab2db3abf4e805301030ef12ab333570677
Python
3,608
92
import sys from robustness.datasets import jsinV3 from robustness.model_utils import make_and_restore_model from model_analysis_folders.all_model_info import JSIN_PATH, MODEL_BASE_PATH import os # Make a custom build script for audio_rep_training_cochleagram_1/l2_p1_robust_training def build_net(include_rep_in_model=...
151cdce5670a23572433095ffeef48f4821b9225a613ddccf5794ee4441f704d
Python
3,609
94
# miscellaneous tools import os import shlex import subprocess import sys from tqdm import tqdm import HTSeq import pysam PATH = './' def trim_filter_read(input_fastq_read1, input_fastq_read2, trimmed_read2_output, tagged_read1_output, **kwargs): """ trims the read to UMI_BC1_BC2_BC3, and fi...
1aa1a8d76d5b060962d9f7356ef13a852ae2432d8a1042fdac747bfbe48e633d
Python
3,609
92
import sys from robustness.datasets import jsinV3 from robustness.model_utils import make_and_restore_model from model_analysis_folders.all_model_info import JSIN_PATH, MODEL_BASE_PATH import os # Make a custom build script for audio_rep_training_cochleagram_1/l2_p1_robust_training def build_net(include_rep_in_model=...
7d7a07455c070987d1215bb00f3f5f4878f493eb96e6ab95d0f60cd84916fd69
Python
3,609
92
import sys from robustness.datasets import jsinV3 from robustness.model_utils import make_and_restore_model from model_analysis_folders.all_model_info import JSIN_PATH, MODEL_BASE_PATH import os # Make a custom build script for audio_rep_training_cochleagram_1/l2_p1_robust_training def build_net(include_rep_in_model=...
9bd196b7fd5e5aeb6893b8cc659058305d5f5f4d41a04b7e1572dfafe58bb590
Python
3,609
101
'''Code implementing the two-step task environment.''' # © Thomas Akam, 2023, released under the GPLv3 licence. import numpy as np def withprob(p): return np.random.rand() < p # State and action IDs initiate = 0 sec_step_A = 1 sec_step_B = 2 #Action IDs choose_A = 3 choose_B = 4 #State IDs choice = 3 reward_A ...
a7a4e4f131c0d3e2ba8a8c10deaee84eb17ec4f1d5f76fea4b85dac4644f7cde
Python
3,609
102
import numpy as np def compute_weights(labels, classes, count, verbose=False): if verbose: print("-------------") sum_weights = 0 for c in range(len(classes)): if classes[c] / count > 0: sum_weights += count / classes[c] sum_weight_norm = 0 weights = list() for c in range(...
28506f055baf3d45da74ad7a7b6c4d135acec0b4952aceaac3b2688987682b20
Python
3,610
90
import os import sys import json import click import shutil from io import BytesIO import numpy as np from zipfile import ZipFile from glob import glob @click.command() @click.option('-s', '--stylegan-path', default='stylegan2-ada-pytorch', show_default=True, help="Location of the SyleGAN repository.") ...
4a78c6e1ee771b2fc9842dfee0c665dcf350a49b1f4e475dca3b8fe70ec0bf88
Python
3,610
118
from pathlib import Path from typing import Dict from pytorch_lightning import Trainer from pytorch_lightning.callbacks import DeviceStatsMonitor, LearningRateMonitor from pytorch_lightning.loggers import TensorBoardLogger from torch.nn import Module from torch.utils.data import DataLoader from lightly.data import Li...
9c68637f8eb388e0eb0591c28d3df425c3ab147bf88c9312c675632c875cfe5d
Python
3,610
63
"""Canonical composite authority for the redesigned data layer (Phase 1a/1b, 2026-06-16). THE single implementation of the framework composites. `assemble_composites` holds the arithmetic (lifted verbatim from `phi.py`'s composite block) so there is exactly ONE place it lives — no mirrored second copy kept bit-identic...
d25c788955fff89ae1d0929b6fefc3e3c8628710b54327f3705bbed34377c8fe
Python
3,610
106
import math import cv2 import matplotlib.cm as cm import numpy as np from scipy import ndimage from scipy.ndimage import measurements from scipy.ndimage.filters import gaussian_filter from scipy.ndimage.interpolation import affine_transform, map_coordinates from skimage import morphology as morph from misc.utils import...
90923a0df7e945b5c62e46607835d87d8d6ead88e544981a0c1d27eebddb318e
Python
3,612
92
import sys from robustness.datasets import jsinV3 from robustness.model_utils import make_and_restore_model from model_analysis_folders.all_model_info import JSIN_PATH, MODEL_BASE_PATH import os # Make a custom build script for audio_rep_training_cochleagram_1/l2_p1_robust_training def build_net(include_rep_in_model=...
d6c29c7933b2da193742c53ff04d8477115dee926cdcee0bc48050f685be7b74
Python
3,612
113
import os from random import sample import cv2 import matplotlib import numpy as np import tensorflow as tf from matplotlib import pyplot as plt from skimage import io from skimage.transform import resize from sklearn.decomposition import PCA, TruncatedSVD from sklearn.manifold import TSNE from model imp...
23dccd4cbc974295f8499c73d4a4b216f04335654837e47c6cae6e9561892560
Python
3,613
115
"""Test cases for to_bitmasks.py.""" import os import shutil import unittest from typing import Callable, List import numpy as np from PIL import Image from scalabel.common.typing import NDArrayU8 from scalabel.label.io import load from scalabel.label.typing import Config, Frame, Label from bdd100k.common.utils impor...
0811975fad60e36010b90cb3892f24b51b8ad9bc34553aa53974d0aa68d1bba3
Python
3,614
92
import sys from robustness.datasets import jsinV3 from robustness.model_utils import make_and_restore_model from model_analysis_folders.all_model_info import JSIN_PATH, MODEL_BASE_PATH import os # Make a custom build script for audio_rep_training_cochleagram_1/l2_p1_robust_training def build_net(include_rep_in_model=...
5c45300328ee9821cefac53264acca343ae100ccc7e73441fee63587ecee599e
Python
3,615
130
#!/usr/bin/env python # Greg Von Kuster import sys # from rpy import * import rpy2.robjects as robjects from rpy2.robjects.packages import importr r = robjects.r grdevices = importr("grDevices") assert sys.version_info[:2] >= (2, 4) def stop_err(msg): sys.stderr.write(msg) sys.exit() def main(): #...
5067718c34460adc5c7ff86a7b4728f956cc816444ceb66f7a570c486899b4c8
Python
3,616
107
# Copyright 2021 DeepMind Technologies Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
851c6ee1d6ac6599b874e87135ad669d4dbfdac00df23eb4a7593484aeac186a
Python
3,616
92
# -*- coding: utf-8 -*- """ Created on Mon Apr 13 19:43:47 2020 @author: JUN MA """ import numpy as np import nibabel as nb import os from collections import OrderedDict import pandas as pd from SurfaceDice import compute_surface_distances, compute_surface_dice_at_tolerance, compute_dice_coefficient join...
8bf6f07dd02f529ea1b687772bc276a02c5fcf37b1f13f9ae6f9d8edfa4f26a5
Python
3,616
61
# Copyright 2019 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://w...
2ed07de7e6969699ca0c0f2bdaa5aaa5cae0ccb2297d3eace80a78733ba0bb4b
Python
3,617
115
import sys import string import json import itertools as it from operator import itemgetter import collections from argparse import ArgumentParser def main(): args = get_args() traces = collections.defaultdict(list) chroms = collections.OrderedDict() chroms["total"] = True for f in args.input: ...
913913402a813af8cdc4dd680d627336cdd896e6f6fba55272b60760b301c02e
Python
3,617
37
from .base_options import BaseOptions class TrainOptions(BaseOptions): def initialize(self, parser): BaseOptions.initialize(self, parser) parser.add_argument('--display_freq', type=int, default=400, help='frequency of showing training results on screen') parser.add_argument('--display_ncol...
59c122d56a06c913eea8bc4663f318bc37ce425bce199b839101721bbfdd14f8
Python
3,618
43
from .base_options import BaseOptions class TrainOptions(BaseOptions): """This class includes training options. It also includes shared options defined in BaseOptions. """ def initialize(self, parser): parser = BaseOptions.initialize(self, parser) # visdom and HTML visualization para...
4b57b54f05cbdb52d45365d6827e134dfad8005a257a8f03a59e80fd9be0dd8e
Python
3,620
101
import os import logging import pandas as pd import torch import nibabel as nib import numpy as np def create_logger(folder): """Create a logger to save logs.""" compt = 0 while os.path.exists(os.path.join(folder,f"logs_{compt}.txt")): compt+=1 logname = os.path.join(folder,f"logs_{compt}.tx...
61bbb92c6d3fb7e1e52ff381a4d7d7805e4677c33e85c2175bc68a794499738b
Python
3,620
120
#!/bin/usr/env python from adpred import ADpred import sys import numpy as np HELP = ''' using adpred version {} list of arguments ----------------- -h | --help -id | --uniprot-id -s | --sequence -l | --local-psipred <path_to_"run_psipred"> -...
8036071242ab74fdd2ed85daae40baf8d832313995cc98a7995cbd331632dd4d
Python
3,620
104
""" =============================================================================== Display ERP =============================================================================== Different ways to display a multichannel event-related potential (ERP). """ # Authors: Quentin Barthélemy # # License: BSD (3-clause) import ...
a4a9312daf7c773d9035fcf0c4e3cb7b044b575227cab8f56fb1312516b79907
Python
3,620
127
import argparse import numpy as np from rdkit import Chem from rdkit.Chem import rdShapeHelpers def get_mol_from_file(fname, ftype): if ftype in ["mol", "sdf"]: mol = Chem.MolFromMolFile(options.ligand_path, strictParsing=False, sanitize=False) elif ftype == "pdb": mol = Chem.MolFromPDBFile(o...
e1ab0f7b6db64d6261f2670be7739be98ed744e3e0aafdb79c247e1141c9a01a
Python
3,620
113
"""Deprecation utilities.""" import warnings from vine.utils import wraps from celery.exceptions import CDeprecationWarning, CPendingDeprecationWarning __all__ = ('Callable', 'Property', 'warn') PENDING_DEPRECATION_FMT = """ {description} is scheduled for deprecation in \ version {deprecation} and removal ...
87149af4fbf1eef0743e5eea5d3e021c8bf165973733ce8727032a4e7405690e
Python
3,621
115
"""Regression tests for Torch backend per-output field handling (M7).""" from __future__ import annotations import copy import pytest import torch import torchlens as tl class _SingleOutputModel(torch.nn.Module): """Model with one ordinary tensor output from a wrapped torch call.""" def forward(self, x: ...
ad7681518927ccf85f201bdf9ca8665d38538f4bbd60f5401bb0da4df1c22a9a
Python
3,621
96
#!/usr/bin/env python3 import os import sys import re import json import ast import argparse parser = argparse.ArgumentParser(description="Get final table for assembly pipeline", formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument("-s", "--stats", nargs="+", ...
411678b0363b87d8b54c9de4c32d5dda5b7d16f4e4aeff8ce48da7dfad844e3e
Python
3,622
104
import unittest import requests_mock from pydantic import ValidationError from codecarbon.core.telemetry_client import TelemetryClient from codecarbon.core.telemetry_schemas import TelemetryCreate class TestTelemetryClient(unittest.TestCase): def test_init_sets_up_client_without_calling_api(self): with ...
be420e601a043676828eb96482e1da16106517f0d250dc50d590da5cf78fd237
Python
3,623
1
import numpy as np import pandas as pd import time import random # [1] data load # df1 = pd.read_csv('./data/GSE75688_GEO_processed_Breast_Cancer_raw_TPM_matrix_gene_filtering_log_nontumor198tumor317_deg.csv', index_col=0) # dimension = (genes x cells) df2 = pd.read_csv('./data/GSE75688_GEO_processed_Breast_Cancer_raw...
37649a8a50e56d55684aace5e93b4c6c977ebbb6b6c5f9f43baebbf8f3b40a9c
Python
3,624
136
import sys import numpy as np import random from random import randint import scipy as sc import scipy.stats from scipy.stats import pareto def GetPauseLength(muPause, pattern='alternate', pausedLast='false'): if (muPause < 1): return 0 if (pattern == 'alternate'): if (pausedLast is True): ...
7449d8080f6352d41c7b063bc34ebeccce37877a05d5031ffd3a711ce83226c6
Python
3,625
118
from pathlib import Path from typing import Dict from pytorch_lightning import Trainer from pytorch_lightning.callbacks import DeviceStatsMonitor, LearningRateMonitor from pytorch_lightning.loggers import TensorBoardLogger from torch.nn import Module from torch.utils.data import DataLoader from lightly.data import Li...
93a414944d12b9511ea4c962ea126ed4761ac01b9a8be88b162413e7840d81e8
Python
3,625
113
# -*- coding: UTF-8 -*- import numpy as np from sklearn.ensemble import RandomForestClassifier import math import random import operator import csv from sklearn.metrics import f1_score ''' @author:hm @time:2022.01.03 ''' class RF(object): def __init__(self): pass def loadDataset(self,filename, split,...
0c66cdaa825038f3aba2c161297e44ac4207d47514262a5c8b3ad8772d530030
Python
3,626
99
"""Download files with progress bar.""" import os import re import hashlib import requests from tqdm import tqdm def check_sha1(filename, sha1_hash): """Check whether the sha1 hash of the file content matches the expected hash. Parameters ---------- filename : str Path to the file. sha1_has...
0fc0a1f61015c8a4065ef428d418d85bf4d7ede492c999df293ba6393ab3e71a
Python
3,626
110
# LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this software except in complian...
226cd7ca5c25a5a74b700de53391c821660b712514a75a686cdefce6539e0bdd
Python
3,627
96
import re import pathlib import attr from pyasjp.api import ASJP from clldutils.misc import slug from pycldf.sources import Source import pylexibank from pyasjp.models import MEANINGS_ALL @attr.s class Doculect(pylexibank.Language): classification_wals = attr.ib(default=None) classification_ethnologue = att...
6aabcfe69d1b0881c4d217fe0fd3cb5da4970b4ecfd04b56bf1d85fd5d181e9e
Python
3,627
106
# coding=utf-8 # Copyright 2023 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicab...
da75f8796f86377b7fa9683b52ac979c96ebf39b62af41b386ba2bd7396fdda3
Python
3,627
87
from tensorflow.keras.layers import Conv1D, BatchNormalization, Activation, Dense, Input, Cropping1D, add, Flatten from tensorflow.keras.models import Model from Configurations.fd1t_cfg import sim from Configurations import config as cfg from Configurations import CNN from Utilities.common_packages import np, tf def ...
18bd73fe360e87ade2b235911678edb8c6986e1731a2ac6c099b9f73094f38e6
Python
3,628
87
"""Pre-flight detection of model wrappers TorchLens cannot instrument. Some third-party wrappers redirect attribute ASSIGNMENT on the model object to their wrapped components. TorchLens prepares a model for capture by assigning instrumented forwards onto its modules; when the wrapper forwards those assignments elsewhe...
b6c6bddeac72780ad4552f128dd4250ca97d07a165ecf4591808d9ab6a4c5b7e
Python
3,628
109
# LICENSE # # _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._ # # BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License"); # # - you may not use this software except in compl...
6621376e8afa85c37170cc040dda9c0b5ac15eca4e705dffcaec6f002185d272
Python
3,629
115
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Axis(_BaseTraceHierarchyType): _parent_path_str = "splom.dimension" _path...
139c04ff45bb5f6db1be65516ac4819aceb611ad535ef27585b73317a8faa5a8
Python
3,630
121
"""torch.compile rejection tests for train-mode capture APIs.""" from __future__ import annotations import warnings from collections.abc import Callable import pytest import torch import torchlens as tl from torchlens._capture_state_helpers import reset_compiled_model_unwrap_warning_state from .conftest import Two...
19bee9cc2c987e4c3c4a1cb0c923da9cf6222a93e976f310cf2aa506ab005d0c
Python
3,631
117
#!/usr/bin/env python3 import numpy as np import pandas as pd import logging import sys import os import logging import utility import click # get logging logging.basicConfig( level=logging.INFO, format='%(asctime)s [%(levelname)s] %(module)s: %(message)s', datefmt='%Y-%m-%d %H:%M', ) @click.command() @cl...
c31b6b548e38407f268239f70a78f069907a5a535a812d8c341057707aa4b1df
Python
3,631
105
""" =============================================================================== Display ERP =============================================================================== Different ways to display a multichannel event-related potential (ERP). """ # Authors: Quentin Barthélemy # # License: BSD (3-clause) from ma...
2673be8dfad19238d6ebacf8eac82f4b0b1355709cf22c8fe4d21fa70dcc4026
Python
3,632
124
import os import logging import joblib import yaml import lifelines from sklearn.base import BaseEstimator from sklearn.feature_selection import SelectKBest from sklearn.pipeline import Pipeline import pandas as pd try: import torch import torchtuples as tt from pycox.models import CoxPH except: print("...
b4a609fe8058f869370088d359de80df787a54d3db4e4dadfc493e6eb9f161ca
Python
3,632
105
import os import mne import pandas from mne.datasets import fetch_fsaverage from mp_dip.research.show_example_dipole import show_example from mp_dip.utils.interpolate_head_features import get_positions, \ INTERP_SIZE from mp_dip.utils.multivariate_atom_analysis import example_to_dipole, \ get_kernels import n...
99815c06ca2c078eb38762270278f5003e9e79883187d47e25edc0dded328a35
Python
3,633
108
from collections.abc import Sequence from typing import Literal import scanpy from anndata import AnnData from leidenalg.VertexPartition import MutableVertexPartition from numpy.random.mtrand import RandomState from scipy.sparse import spmatrix def leiden( adata: AnnData, resolution: float | None = None, ...
0fb16ffe1964b12bd80735825f00e3e9b087f11a534eb553e0e9d4efa6c63149
Python
3,634
114
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Line(_BaseTraceHierarchyType): _parent_path_str = "waterfall.totals.marker" ...
2f05bdbe610d06f073c79118abf6ba55ed2d76e9943dc0e0254bcbb77345c4cd
Python
3,634
95
import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' from tensorflow.python.keras.layers import embeddings import sys print(sys.path) import random import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from drug_interactions.features.get_features import get_features from drug_interactions.reader....
4b016d087726682c40cd90c2d1c65a6f8ccd2984791ae4146e570160b449762c
Python
3,634
107
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
b0724f4b136385309251ac08ac87e90e1ac3a6b85dd7d81cec27ef8d46194381
Python
3,634
102
# -*- coding: utf-8 -*- # @Author : Yue Liu # @Email : yueliu19990731@163.com # @Time : 2021/11/25 11:11 import os import sys import torch import logging import numpy as np def load_graph_data(root_path=".", dataset_name="dblp", show_details=False): """ load graph data :param root_path: the root pa...
ef71d8f9f50e8b83a2c1a7f7689fccd3b67996d3184cf7e9392bafee8f701e8b
Python
3,634
107
from .bulletin import Bulletin from bs4 import BeautifulSoup import json class Punjab(Bulletin): def __init__(self, basedir): statename = 'PB' super().__init__(basedir, statename) self.base_html = 'http://covaprod.punjab.gov.in/covid-response.html?language=e' self.root_url = 'htt...
f7433f2633951acda9e13868b555b51fe33726fd462503c839efb071fdc4d4de
Python
3,634
113
# -*- coding: utf-8 -*- """ @File : cluster_lasso.py @Time : 2022/06/29 10:43:55 @Author : LuluZuo XueWang @Version : 1.0 @Desc : spatial cluster lasso """ from typing import Optional import pandas as pd import plotly.graph_objs as go import plotly.offline as py from ipywidgets import VBox class...
53c0c0d284ce7b68d619c486fdb0503f6214927d8631c8e4d83b59cc8377e002
Python
3,635
131
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Title(_BaseTraceHierarchyType): _parent_path_str = "funnelarea" _path_str...
72d2e501e32c62a2254033fcf260bb93131cd2b1c86603e8978ad7ca049d06c0
Python
3,635
82
import argparse import torch from helpers.flop_count import count_macs, count_macs_transformer from helpers.peak_memory import peak_memory_mnv3, peak_memory_cnn from models.mn.model import get_model from helpers.utils import NAME_TO_WIDTH from models.preprocess import AugmentMelSTFT def calc_complexity(args): # ...
7d669f1e1d987fea128bfc6c403afa9ce758f869317ed3ca65c486cf0e2b74e6
Python
3,637
114
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Line(_BaseTraceHierarchyType): _parent_path_str = "sankey.node" _path_str...
83044a025eb7d9e04876d026aea51646624963c7dd7562a77f225bb6276727c7
Python
3,637
114
# --- THIS FILE IS AUTO-GENERATED --- # Modifications will be overwitten the next time code generation run. from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType import copy as _copy class Line(_BaseTraceHierarchyType): _parent_path_str = "sankey.link" _path_str...
a5d38971a799d26a6d1b571e2cc65e9fef0e77402fcb9666a9c729dcb795bdcb
Python
3,637
89
# %% [markdown] # # Image-labels metadata # # To ease the interpretation of label images and make them identifiable as label images, # it is helpful to add the [`image-label` metadata](https://ngff.openmicroscopy.org/specifications/0.5/index.html#labels-metadata) to the written label image data. # The {py:class}`ome_za...
cea71e8ef40f66aa8245face16d5bd1f752d79f18e1f8235b0ea95a1ea803432
Python
3,637
91
""" Target generator for Simple Baselines for Human Pose Estimation and Tracking (https://arxiv.org/abs/1804.06208) --------------------------------------------- Copyright (c) Microsoft Licensed under the MIT License. Written by Bin Xiao (Bin.Xiao@microsoft.com) --------------------------------------------- """ import...
d0b0af30fa366feb67d1992e4146eb146f001661fb4457b167dec63db5f45ecf
Python
3,637
122
import numpy as np import pytest from pytest import approx from pyriemann.utils.geodesic import ( geodesic, geodesic_euclid, geodesic_logeuclid, geodesic_riemann, ) from pyriemann.utils.mean import ( mean_euclid, mean_logeuclid, mean_riemann, ) def get_geod_func(): geod_func = [geodes...