sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
90f60c785d3f6d86c7c6ead63af0a6f90b841997acdae10d4d1b191f3972005c | Python | 6,253 | 164 | import torch
import torch.nn as nn
import torch.nn.functional as F
class DoubleConv(nn.Module):
"""
A module for performing double convolution, consisting of two sequential convolutional layers
each followed by Batch Normalization and ReLU activation.
Args:
in_channels (int): Number of input ... |
e66ddc5245178a1fd3e78ff74e0d40e394647c4ec0a2075ebfefc02b3c29a75f | Python | 6,253 | 144 | import copy
import torch
import torch.nn as nn
from model.vq import VQLayer
from torch.nn.utils.rnn import pad_packed_sequence, pack_padded_sequence
class APC(nn.Module):
'''
APC/VQAPC modified from
https://github.com/iamyuanchung/VQ-APC/blob/283d338/vqapc_model.py
'''
def __init__(sel... |
b18fbd41061a407ffee6b4c545bbd70fd32cc04f24aa32d12f2ca5f3ae34c5f4 | Python | 6,254 | 226 | # 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... |
608b3cc8501baa41ec30f4ed93333bad6b5caa27fafbd30da13e05b1bda0670f | Python | 6,255 | 176 | """IO functions for calculating the bounding box.
"""
import math
from typing import List, Optional, Tuple, Union
import numpy as np
from scipy.spatial import Delaunay
from shapely.geometry import (
LineString,
MultiLineString,
MultiPoint,
MultiPolygon,
Point,
Polygon,
multipolygon,
)
from... |
d3435f7b10635bbf823e148dbfead308b18e1635e4cbae0049bc52d009d47df9 | Python | 6,256 | 152 | # Given a list of MsCAVIAR files for a locus, LD prunes SNPs above a threshold
import argparse, sys
def ld_prune_parseargs(): # handle user arguments
parser = argparse.ArgumentParser(description="Given a list of MsCAVIAR " +
" LD files for a locus, LD prunes SNPs above a threshold.")
parser.add_argument('--inf... |
ff9303ae0538aa519dc66617df905aa6db0f8fb587cbfad71d43e300b50ec16a | Python | 6,256 | 178 | # Generated by Django 3.2.6 on 2022-10-04 13:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('biomedisa_app', '0093_profile_platform'),
]
operations = [
migrations.AddField(
model_name='specimen',
name='adm1',
... |
624bdbb2f9cb33e6716332070eb0159246d599ebbf9bc830447e76b1b1729f58 | Python | 6,257 | 179 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (leoxiaobin@gmail.com)
# Modified by Bowen Cheng (bcheng9@illinois.edu)
# ------------------------------------------------------------------------------
fro... |
094b3942c48c34da8abb1b29fec9002db894f0d3dfbd97563647795200660a98 | Python | 6,258 | 169 | """Test of data set functionalities"""
import numpy as np
import pytest
import lmfit
from nanite.model import model_hertz_paraboloidal
import nanite.model.residuals as nres
import pyjibe.head
from helpers import MockModelModule, make_directory_with_data
def test_simple(qtbot):
"""Open the main window and close... |
808fc1c7f8ebad635b10adf722d89629fb9ee7f364ee2006e04579c575a688c2 | Python | 6,258 | 185 | """Cell masking using Moran's I metric.
Adapted from code written by @HailinPan.
"""
from typing import Optional, Tuple
import cv2
import numpy as np
from anndata import AnnData
from scipy import signal, stats
from skimage.filters import sobel, threshold_otsu
from skimage.segmentation import watershed
from ..configu... |
fa1eba3a17da840c915e3f3c7a37f4797e6fbc970749659bcd06e6a956b31972 | Python | 6,258 | 182 |
from collections import namedtuple, Counter
import numpy as np
import torch
import torch.nn.functional as F
import dgl
from dgl.data import (
load_data,
TUDataset,
CoraGraphDataset,
CiteseerGraphDataset,
PubmedGraphDataset
)
from ogb.nodeproppred import DglNodePropPredDataset
from dgl.data.pp... |
3a6dc9e3d5b44d9268bf956ac8d23139d18958a51aa40b9fda019552a0983f2c | Python | 6,259 | 186 | import functools
import logging
from typing import Union
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
from galaxy.schema.citations import (
BibtexCitationResponse,
CitationErrorResponse,
)
from galaxy.structured_app import BasicSharedApp
from galaxy.tool_util_models... |
81213bd42f849a4108104800d72dfc20e15f064b3346afc5873adfcf18d5ff08 | Python | 6,259 | 205 | # Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or mo... |
079c69b0176a642c3f767c69f387c475d89f90bdbef49ab5ae30d6cfc7f6f8cb | Python | 6,260 | 168 | """Repo-privacy gate: no private working-notes path may ever be tracked.
torchlens is a PUBLIC repository. Internal planning notes live in gitignored
territory (``.research/``, ``.project-context/`` minus the two curated docs,
and repo-root sprint ledgers). The primary defense is the ``no-internal-notes``
pre-commit h... |
14f86b971d544bf2b93d80125307cd7e9b44ad3d0475400fcb5db9da232f6c85 | Python | 6,260 | 102 | # -------------------------------------------------------------------------------------
# Code from https://github.com/pyControl/code/blob/master/tools/rsync.py
# -------------------------------------------------------------------------------------
import numpy as np
import pylab as plt
from sklearn.mixture import Gau... |
9afdf21d07207ab44d313c3deb91e86831781e0caf9e28a9937fe9171569c2bf | Python | 6,261 | 183 | import json
from typing import TYPE_CHECKING, Dict, List, Optional
import networkx as nx
import numpy as np
from nfp.frameworks import tf
from nfp.preprocessing import features
from nfp.preprocessing.mol_preprocessor import MolPreprocessor, SmilesPreprocessor
if TYPE_CHECKING: # only for type checking
import rdk... |
c06c9328ae498aa633bceaa7a041521efbb54fb61190fd8e687f4aabda331964 | Python | 6,263 | 143 | import sys
import os
import argparse
sys.path.append("../src")
import argparse
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
from collections import defaultdict
# Plot aesthetics.
plt.style.use('seaborn-deep')
plt.rcParams['figure.dpi'] = 200
plt.rcParams['savefig.dpi'] ... |
340fc8d5a9ebb334d9cb03442c3392f32118118aa1767cd021a5c39ab202e795 | Python | 6,264 | 207 | """
File: statistics.py
Created: 2021/04/14
Last Changed: 2022/07/25
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory of this source tree.
"""
# Standard imports.... |
547c4753b5e89b0db90189c3b651c5c93cf4a23eaf00fd59121bf4e183ab5235 | Python | 6,264 | 147 | """
module to write abf files.
Can be imported independently from the UI, but requires the recording module
SimplyFire - Customizable analysis of electrophysiology data
Copyright (C) 2022 Megumi Mori
This program comes with ABSOLUTELY NO WARRANTY
This program is free software: you can redistribute it and/or modify
it... |
d8a562f61e4a7f302d729f31cd233375ea70202c0d4f34bcfc38be93f4fe26b1 | Python | 6,264 | 169 | #!/usr/bin/env python
"""
This module provides functions for extracting image features from spatial transcriptomics data.
Main Functions:
- image_feature: Class for extracting CNN-based image features from spot images
- image_crop: Function to crop spot images from the whole tissue image
Author: ChangXu
Crea... |
de6d55534b8e32056537155e6b80f3caaf833342eb54cc06674678e95b586d3a | Python | 6,264 | 206 | # coding: utf-8
'''Tests for ml'''
import os
import unittest
import shutil
import pickle
import tempfile
import numpy as np
from bdpy.dataform import load_array
from bdpy.ml import ModelTraining, ModelTest
from sklearn.linear_model import LinearRegression
from fastl2lir import FastL2LiR
def _make_id(key: str) ->... |
8b58ad45eaf49bdcbbb794f683e9e78f8588dbf5bc325efe4d86659e40bfcdd2 | Python | 6,265 | 159 | import tensorflow as tf
from cvnn import layers
from pdb import set_trace
import tensorflow_datasets as tfds
# https://medium.com/analytics-vidhya/training-u-net-from-scratch-using-tensorflow2-0-fad541e2eaf1
BATCH_SIZE = 64
BUFFER_SIZE = 1000
INPUT_SIZE = (572, 572)
MASK_SIZE = (388, 388)
def _downsample_tf(inputs, ... |
aede4eb5a04f5a5080c3ca4e99df3068143ad53322653e6c1a1fa129af251ee9 | Python | 6,265 | 229 | import os
import pathlib
import pytest
import subprocess
import sys
import zipfile
import opencc.cli
_TEXT_ZIP_CONFIG = """{
"name": "Python CLI Resource Zip Test",
"segmentation": {
"type": "mmseg",
"dict": {
"type": "text",
"file": "STPhrases.txt"
}
},
"conversion_chain": [
{
... |
f146b6ea41f24b210b4998ddc14210cba9e04436ee966331c190edda717b15ac | Python | 6,265 | 162 | """Buffer threading for SINGLE-pass producers (AUD-CODE 2.8).
The replay overlay is keyed by the pass-qualified replay key (``copy_1_4:1``)
while a single-pass buffer record spells its writing parent BARE
(``copy_1_4``); the overlay miss fell into the "producer outside the cone"
branch, so a written buffer kept its ca... |
ede03ec088599911f7276a51d860d57bc3494973b76089808d2252a867172ac1 | Python | 6,266 | 220 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseFrameHierarchyType as _BaseFrameHierarchyType
import copy as _copy
class Frame(_BaseFrameHierarchyType):
_parent_path_str = ""
_path_str = "frame"... |
0e5491fcc042298cd49ef6e58b78c0609f5e610f04f37f9d28e34b8cc15d3ecf | Python | 6,267 | 174 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import pycuda.gpuarray as gpuarray
from pycuda.compiler import SourceModule
def _build_kernel():
code = """
__global__ void Funktion(short *verts1, char *arr1, char *arr2, int xsh1, int ysh1, int zsh1, int xsh2, int ysh2, int zsh2, float *centroid1, flo... |
2eba7b5fca7ddefbabfb621f7fbb33219cac356d11c6929e1cf7cccb30061614 | Python | 6,267 | 190 | import matplotlib.pyplot as plt
from os.path import join as oj
import seaborn as sns
import string
import pandas as pd
from transformers import BertModel, DistilBertModel
from transformers import pipeline
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import datasets
import numpy as np
impor... |
6da51098c535a7d7583ff46c8be95cb2b613107712c4da9c414c5054b16a7d3c | Python | 6,267 | 160 | # -*- coding: utf-8 -*-
"""
Created on Tue Apr 8 19:14:29 2025
@author: Rico's Account
"""
import numpy as np
from matplotlib import pyplot as plt
from functions import integral, inverse
def spike_train(time, pulse_width, t1 = 5, t2 = 100, A1 = 0.95, A2 = 0.05, plot = False):
if np.isscalar(time... |
bd779e46ff57b297766e3ea13d6862180b430885d9e5c72a91cc043e5e236d8d | Python | 6,269 | 177 | """F26: framework callbacks + the exporter unification drift pin."""
from __future__ import annotations
import pytest
import torch
import torchlens as tl
import torchlens.trackers as trk
class TestDerivedCadence:
"""Memo 3.8: callbacks derive cadence from the framework's own signals."""
def test_logging_s... |
4aaad2cfc9e59822c42440427d4548d4c129e2889d4f41088cb8f5904912330a | Python | 6,270 | 202 | """
Similar to pandas.Index, `TsIndex` holds the timestamps associated with the data of a time series.
This class deals with conversion between different time units for all pynapple objects as well
as making sure that timestamps are property sorted before initializing any objects.
- `us`: microseconds
- `ms`:... |
66741934ae35326e3b4fcd17058e3a631f0e6a65e9cd7ba292728ffc8c9e909c | Python | 6,272 | 167 | """
Sensor API Module
Handles sensor management including discovery, configuration, and data visualization.
"""
import json
import os
from .base import BaseAPI, error_decorator
class SensorAPI(BaseAPI):
"""API endpoints for sensor management and data."""
def register_routes(self):
"""Register sens... |
a8eea0a3484d6809131ba18ecda76a8cb37c99b69d7d05b08ab1f9abf2848163 | Python | 6,272 | 174 | """
===============================================================================
Mean of SPD matrices with NaN values
===============================================================================
Estimate the mean of SPD matrices corrupted by NaN values [1]_.
"""
# Authors: Quentin Barthélemy, Sylvain Chevallier ... |
2d8cdf59b2e1186b73a2566a09e4a71e74fb0a578bd96924a62bea54712cc2bf | Python | 6,273 | 186 | """Code for channel selection."""
import numpy as np
from sklearn.base import BaseEstimator, TransformerMixin
from .utils.distance import distance
from .classification import MDM
class ElectrodeSelection(BaseEstimator, TransformerMixin):
"""Channel selection based on a Riemannian geometry criterion.
For ea... |
9220f5c77209b4cfff6d994a554e1e76188f2987094261e70881d5e1c09d0e7a | Python | 6,273 | 164 | # Copyright 2019 DeepMind Technologies Limited. 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 ... |
a8fe3de52c6766ec98923ecd504494f93f1ca1cd105b95106e114caa0d1b9703 | Python | 6,276 | 188 | import os
import json
import gzip
import re
import numpy as np
from datetime import datetime
def get_extra_infos_for_mmcif(args, length=5) -> dict:
current_file_dir = os.path.dirname(os.path.abspath(__file__))
commit_file_path = os.path.join(current_file_dir, '../commit_id')
md5_file_path = os.path.join(c... |
bee8e142e36b86397af179aa3a90bb1c795684818ae73f77c42f3db3ee34aefe | Python | 6,278 | 208 | # --- 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 Textfont(_BaseTraceHierarchyType):
_parent_path_str = "scattermap"
_path_... |
cfd4ef10f56518c0cc176d9f1b08e42204e967c2674079c52ab8b3e4a17393c1 | Python | 6,278 | 218 | import os
from pathlib import Path
import numpy as np
from tqdm.auto import tqdm
import RNAutils
from typing import List
def human_format(num):
num = float("{:.3g}".format(num))
magnitude = 0
while abs(num) >= 1000:
magnitude += 1
num /= 1000.0
return "{}{}".format("{:f}".format(num).r... |
1d60358652b716d736cbc4efc97a6c1d737e784c5be98419ed291ac0ead8e27c | Python | 6,279 | 202 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (leoxiaobin@gmail.com)
# Modified by Bowen Cheng (bcheng9@illinois.edu)
# ------------------------------------------------------------------------------
fro... |
82a3ce49b651541b66ca63cc143594319cec1b95d4a3d1fe2b9ecd2b75bcf58b | Python | 6,279 | 209 | from pathlib import Path
from typing import Union
import torch
class EugeneConfig:
"""
Config manager for eugene.
Examples
--------
To set the seed
>>> eugene.settings.seed = 13
To set the default batch size for all functions
>>> eugene.settings.batch_size = 1024
To set the progr... |
c3e0cdd0ba7f0bf4e24513feb8fbd7a4d5e84e43279424833db63fbeb958d494 | Python | 6,283 | 172 | """Beat command-line program.
This module is the 'program-version' of :mod:`celery.beat`.
It does everything necessary to run that module
as an actual application, like installing signal handlers
and so on.
"""
from __future__ import annotations
import numbers
import socket
import sys
from datetime import datetime
f... |
bfd17c72a1823eea54cabf4fc5286554dd0196d34cbbb527481e96e7d9e483fc | Python | 6,284 | 132 | import argparse
import torch
import torch.backends.cudnn as cudnn
from torchvision import models
from data_aug.contrastive_learning_dataset import ContrastiveLearningDataset
from models.resnet_simclr import ResNetSimCLR
from simclr import SimCLR
import torchvision
import torch.multiprocessing
torch.multiprocessing.se... |
f592648f82457823adaa70f079ba69d0185ef981616ae8054113e700329bf71b | Python | 6,285 | 194 | """
Coupling between the crawling and turning rhythms.
Crawling suppresses turning within each stride cycle. These modules define how
strong that suppression is and how it varies with stride phase, from a constant
attenuation to an explicitly phase-dependent one.
"""
from __future__ import annotations
from typing imp... |
2c2d8cc3a8fac764ef140618edc2eb2013fdc1aa96758e255b378054fbdbba49 | Python | 6,286 | 166 | from __future__ import annotations
from pathlib import Path
from typing import Optional, Sequence, Tuple
import numpy as np
import pandas as pd
import torch
from scipy.stats import mannwhitneyu
from .metrics import masked_pearson_r, pearson_r, to_numpy_prediction
def reconstruct_array(model, x, domain: str, mask=N... |
9a1f1d0cb128d3131302471eee865847525b736e236219f2a30ec0ac720406ef | Python | 6,286 | 213 | """Convert mask/bitmask to RLE."""
import argparse
import os
from functools import partial
from multiprocessing import Pool
from typing import Callable, Dict, List, Tuple
import numpy as np
from PIL import Image
from scalabel.common.parallel import NPROC
from scalabel.common.typing import NDArrayU8
from scalabel.labe... |
f8111b0419a7711c8abe69c1f59404fa54775f2d515331ca05c452d65434541c | Python | 6,287 | 186 | import itertools
from typing import Any, Dict, List, Tuple, Union
import torch
class Instances:
"""
This class represents a list of instances in an image.
It stores the attributes of instances (e.g., boxes, masks, labels, scores) as "fields".
All fields must have the same ``__len__`` which is the numb... |
63cce4e3d2eb56d2161803353dce568edfc7f9922058b1eb83a8fa3b1029c0e7 | Python | 6,288 | 132 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
import math
from typing import Any
import cv2
from ultralytics.solutions.solutions import BaseSolution, SolutionAnnotator, SolutionResults
from ultralytics.utils.plotting import colors
class DistanceCalculation(BaseSolution):
"""A class to cal... |
7416b6106b0167f6562a4e7ebe73b47a03b77ec8b70e6c9e880d9bfc29cf2f4e | Python | 6,289 | 168 | #!/usr/bin/env python3
"""
File: harmonzize_genotype.py
Created: 2021/11/13
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the root directory of this source tree.
""... |
7b4baa2acab8e1cc69b9a4682f1d4a2a80d9c76e20dc527d38867c6d82686b13 | Python | 6,289 | 215 | """Phase 9 tests for the single intervention Bundle type."""
from __future__ import annotations
import pytest
import torch
from example_models import TinyReluAdd as _ReluModel
from torch import nn
import torchlens as tl
from torchlens._trace_state import TraceState
from torchlens.intervention.errors import (
Bas... |
f44561f3abd8d0d65d9614fec2cb95fb3abf30057aaaa5784b50249f7c2452ec | Python | 6,289 | 168 | from __future__ import absolute_import
import logging
import os
from email.parser import FeedParser # type: ignore
from pip._vendor import pkg_resources
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.cli.base_command import Command
from pip._internal.cli.status_codes import ERROR, SUCC... |
a5698cf8e2d1e873b24b803e508da4a128b07285eb18686ee4e22c8693357c38 | Python | 6,290 | 165 | from tqdm import tqdm
from os.path import join
from datasets import load_from_disk
from copy import deepcopy
from sklearn.model_selection import StratifiedKFold
from sklearn.linear_model import LogisticRegressionCV
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
import numpy as np
import pi... |
bd0a00922964d31f5591bbe6754e3d5ec5c18352049d2e22f8d47737d4520e61 | Python | 6,291 | 144 | # 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... |
8cccb98873a618b6578893089a12fb3f033a0ba854e9f97ed83c26d027c567c6 | Python | 6,292 | 175 | import os
import glob
import random
import pickle
from data import common
import numpy as np
import imageio
import torch
import torch.utils.data as data
class SRData(data.Dataset):
def __init__(self, args, name='', train=True, benchmark=False):
self.args = args
self.name = name
self.train... |
37e16c59fe800c0950950c8dd1fef5bfdb8322306f2b5e63a5eab4c8ec5e8f9a | Python | 6,294 | 197 | # coding=utf-8
# Copyright 2024 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... |
0507940c4111df394ad0ee32bfa0c17f3e932b77fd5e82d7c8396707499955fd | Python | 6,295 | 225 | from __future__ import absolute_import
import contextlib
import logging
import logging.handlers
import os
from pip._internal.utils.compat import WINDOWS
from pip._internal.utils.misc import ensure_dir
try:
import threading
except ImportError:
import dummy_threading as threading # type: ignore
try:
fro... |
0b2f67a745119838d8d1c9e688240eba9170b5085f88881594bd0e8fea88dc0d | Python | 6,295 | 157 | # AUTOGENERATED! DO NOT EDIT! File to edit: nbs/organisms_data.ipynb (unless otherwise specified).
__all__ = ['all_organisms', 'import_fasta', 'import_uniprot_annotation']
# Cell
all_organisms = {
'Human': {'fasta_name': 'human.fasta',
'uniprot_name': 'preprocessed_uniprot_human.csv'
... |
db042879be486935034ee7a8af5dbc52abb32f02248b94d321f40bc64edff328 | Python | 6,295 | 178 | """Schemas for telemetry data submitted to the CarbonServer API."""
from datetime import datetime
from enum import Enum
from typing import List, Optional
from pydantic import BaseModel, ConfigDict, Field, model_validator
class TelemetryLevel(str, Enum):
disabled = "disabled"
minimal = "minimal"
extensiv... |
82637d2ce534df5d227b282026648fd03ae07439236c6e11d359682c919d13e8 | Python | 6,297 | 173 | """B1-04 (SF-39): validate-then-save must not hard-refuse.
``validate_forward_pass`` / ``validate_saved_outs`` are public methods on a
user-held Trace, and validation ENTRY unconditionally writes the failure side
channel: ``reset_validation_failure`` sets ``_last_validation_failure = None``
on every run (``validation/... |
878f71425017adba107c2de4c539c7bfdffbcbce5af24e9129803b21d9c130e4 | Python | 6,297 | 150 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
"""
MLflow Logging for Ultralytics YOLO.
This module enables MLflow logging for Ultralytics YOLO. It logs metrics, parameters, and model artifacts.
A tracking URI may be specified with MLFLOW_TRACKING_URI (defaults to MLflow's local store in the worki... |
5f3490e6abac202bc10ade023d08798917521de2f1a25c0a5a66e641460ecc2a | Python | 6,298 | 144 | # 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... |
c28ea072c1c56c8813ea7ea490a5bd634da46d54132fe876570261b44fdb0896 | Python | 6,299 | 199 | import numpy as np
from gym import utils
from gym.envs.mujoco import MuJocoPyEnv
from gym.spaces import Box
DEFAULT_CAMERA_CONFIG = {
"trackbodyid": 1,
"distance": 4.0,
"lookat": np.array((0.0, 0.0, 2.0)),
"elevation": -20.0,
}
def mass_center(model, sim):
mass = np.expand_dims(model.body_mass, ... |
cdb7b851b53fe74cdd5b46d49f86fe5bb73dc6244c713804a3a06dd02637ecc8 | Python | 6,299 | 166 | from __future__ import print_function, unicode_literals, absolute_import, division
from six.moves import range, zip, map, reduce, filter
# import warnings
import numpy as np
import pytest
from csbdeep.data import NoNormalizer, PercentileNormalizer, NoResizer, PadAndCropResizer
from csbdeep.utils import normalize_minms... |
dc648a292a73ae995c5cbe2c24dae258a3dc5ac63bd8d0629433abdfcb6fd354 | Python | 6,301 | 208 | """Agent module containing classes for Agent logic Based on the implementations found here:
https://github.com/Shmuma/ptan/blob/master/ptan/agent.py.
"""
from abc import ABC
from typing import List
import numpy as np
import torch
from torch import Tensor, nn
from torch.nn import functional as F
class Agent(ABC):
... |
11e2ce8736ecfc350492e9b8d033e0a6502ff37043ea96842403be81642e532b | Python | 6,304 | 172 | import math
from functools import partial
import pytest
import torch
import torch.nn.functional as F
from einops import rearrange
from flash_attn.ops.fused_dense import FusedDense, FusedMLP
@pytest.mark.parametrize("dtype", [torch.float16, torch.bfloat16])
@pytest.mark.parametrize("return_residual", [False, True])
@... |
51c7bbae35099bb7ab7d75f0d1941ca5ebb0d83feaceac9d1e0389800009af44 | Python | 6,306 | 184 | from os.path import join, dirname, abspath
import plotly.express as px
from math import sqrt
import pandas as pd
import glob
import json
import sys
import re
class ValidateData():
"""Classfor the image fusion method validation using structure points in the fixed images."""
REFERENCE_POINTS = {
'pat... |
bebea6ae7ec961936d2a53e8b4238c159e0b33051a87a8bc0c60169c0bcb0c76 | Python | 6,306 | 154 | from typing import List
import numpy as np
import tqdm
from angorapy.tasks.envs.dexterity.consts import FINGERTIP_SITE_NAMES
from angorapy.tasks.envs.dexterity.utils import get_fingertip_distance
# HELPER FUNCTIONS
def calculate_force_penalty(data) -> float:
"""Calculate a penalty for applying force. Sum of sq... |
f789693fcbd0305f70383d8c0601416fa6bc8a6ab3f8d6e509d77fd6d8d6f752 | Python | 6,306 | 153 | import numpy as np
import time
from typing import List, Tuple
from rdkit import Chem
from rdkit.Chem import Mol
from rdkit.Chem.rdMolDescriptors import (GetMorganFingerprintAsBitVect)
from rdkit.DataStructs.cDataStructs import (TanimotoSimilarity,
BulkTanimotoSimilarity)
cl... |
ba336b2e7034e18fc4992ae23b49d2eaa924c3f0643dfa1b07f85dc080cfbe93 | Python | 6,307 | 194 | """Locations where we look for configs, install stuff, etc"""
from __future__ import absolute_import
import os
import os.path
import platform
import site
import sys
import sysconfig
from distutils import sysconfig as distutils_sysconfig
from distutils.command.install import SCHEME_KEYS # type: ignore
from pip._inter... |
2b235ee64043b9cb61623f24884571b8bfb6fd519208accb5b45c98d39e3447a | Python | 6,309 | 169 | """F12 pins: the six-state nonfinite status pattern channel (N6).
The finite -> +Inf -> -Inf -> NaN corpus toy exercises the state
derivation; the two-mode degrade (zero coverage = one legend line, partial
coverage = per-node not_checked motifs) is the memo's debug-row contract.
NOT-CHECKED-as-FINITE is a zero-toleran... |
97a4da5838797622abdb1bd89516e73d93aa15dcc5e0819b5af25b3b75d6f5e1 | Python | 6,309 | 152 | from locale import normalize
import os
from turtle import down
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # Code suppressing TF warnings and messages.
os.environ['CUDA_VISIBLE_DEVICES'] = '-1'
import sys
import argparse
import numpy as np
import cv2
import matplotlib.pyplot as plt
import scikit_posthocs as sp
from data i... |
8b7b7ca19ba415d9761b00557e75c076ab0bc6eaec5f2733d051affb1c2a2667 | Python | 6,310 | 179 | # -*- coding: utf-8 -*-
"""
Contains means to read, generate and handle data.
Created on Tue Oct 3 08:20:52 2017
Copyright (c) 2017, Tommy Löfstedt. All rights reserved.
@author: Tommy Löfstedt
@email: tommy.lofstedt@umu.se
@license: BSD 3-clause.
"""
import os
import re
import abc
import six
import datetime
imp... |
d2c8f396b8a8aa99121876a08a70124850441f53b02a87bdb3cc97c4999666b6 | Python | 6,315 | 181 | import numpy as np
from scipy.ndimage import gaussian_filter
from scipy.stats import mode
from .libcudawrapper import deskewGPU as deskew
from .util import imread
def threshold_li(image):
"""Return threshold value based on adaptation of Li's Minimum Cross Entropy method.
From skimage.filters.threshold_li
... |
34781d5e13af844408e41467438b5554936d9029f3b959c8be49979ce8efc4e5 | Python | 6,316 | 159 | # -*- coding: utf-8 -*-
import torch
from torch import nn
class MultiLayerPerceptron(nn.Module):
"""Multi-Layer Perceptron with residual links."""
def __init__(self, input_dim, hidden_dim) -> None:
super().__init__()
self.fc1 = nn.Conv2d(in_channels=input_dim, out_channels=hidden... |
74c4b4a935c05e5dd9ad9519f7b2fde3047dcd81c3c59c90abdfa7a60fdcef99 | Python | 6,317 | 135 | import numpy as np
from brian2.only import *
import deepdish as dd
from digest import conds
import isi_indexing as ii
from readout import load_results
out_fname = 'stats.h5'
def get_bspikes(res, episode):
b = np.zeros(np.asarray(res['raw_dynamics']['v'].shape)[[0,2,3]], bool)
for itrial, (i, spike_t) in enu... |
b53dc0490d6ec61467a63a58984fe3b676d27973121f2e1740c540dd5245954a | Python | 6,317 | 262 | import os
import tensorflow.compat.v1 as tf
tf.compat.v1.disable_eager_execution()
tf.disable_v2_behavior()
import horovod.tensorflow as hvd
import numpy as np
import time
import matplotlib.pyplot as plt
import os
import argparse
import time
import datetime
now = datetime.datetime.now()
parser = argparse.ArgumentPa... |
e0913f26e05d4b8cb397020401b74db9e212ece8fcabfab744166c8e87ad5738 | Python | 6,317 | 181 | import matplotlib.pyplot as plt
import numpy as np
import xarray as xr
from os import PathLike
from scipy.stats import pearsonr, spearmanr
from sklearn.metrics import mean_squared_error, r2_score
from typing import Optional, Sequence, Union
from .. import settings
from ._utils import _create_matplotlib_axes, _save_fig... |
92c482d0d8cb7c7c109d8011d8ee32aa190cbcb6e549ab153d0cb4053bd0f973 | Python | 6,319 | 159 | import datetime
import json
import os
import numpy as np
import warnings
from tensorflow.keras.optimizers import Adam
from tensorflow.keras.callbacks import TensorBoard, LearningRateScheduler, ModelCheckpoint, LearningRateScheduler, EarlyStopping, ReduceLROnPlateau
from tensorflow.keras.callbacks import ModelCheckpoin... |
adff8bc7a1a6fb4b6fe1536602fac1146aee9ab38c5dfacbae56b59c1d89c8b8 | Python | 6,319 | 138 | """
Keras implementation of CapsNet in Hinton's paper Dynamic Routing Between Capsules.
The current version maybe only works for TensorFlow backend. Actually it will be straightforward to re-write to TF code.
Adopting to other backends should be easy, but I have not tested this.
Usage:
python capsulenet-multi-g... |
775ab293ac62d77d49359a5567c734867d7eb7939fcb0cb022ce73f0ad17bec8 | Python | 6,322 | 185 | from array_api_compat import array_namespace as get_namespace, device
import numpy as np
from numpy.testing import assert_raises
import pytest
from conftest import assert_array_equal, assert_array_almost_equal
from pyriemann.geometry.base import logm
from pyriemann.geometry.kernel import (
kernel,
kernel_eucli... |
e0d566dce913df71b1514c98608e69ae7cad766b7fbebc2df15616a727a269a6 | Python | 6,322 | 190 | """Wrapper that stacks frames."""
from collections import deque
from typing import Union
import numpy as np
import gym
from gym.error import DependencyNotInstalled
from gym.spaces import Box
class LazyFrames:
"""Ensures common frames are only stored once to optimize memory use.
To further reduce the memory... |
4bc5e07a5b17f9fadccf41d953c4f66e2573c2195fd9b148a0894dba5a841d93 | Python | 6,323 | 201 | #
# bmicro documentation build configuration file, created by
# sphinx-quickstart on Tue Sep 26 17:55:31 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All configuration values h... |
16f9663d3f47610a1158627842c9227066e1bf8369c5166a97a1e8d3ccbc25ab | Python | 6,324 | 159 | import pandas as pd
import os
from sklearn import preprocessing
from torch.utils.data import Dataset as TorchDataset
import torch
import numpy as np
import librosa
from datasets.helpers.audiodatasets import PreprocessDataset, get_roll_func, get_gain_augment_func
dataset_dir = None
assert dataset_dir is not None, "Spe... |
7836e3b146aac3b0c94bff00edfcadeb5f458bae9fe683aeae08a7a0f50c320f | Python | 6,326 | 137 | import os
import random
import numpy as np
import tensorflow as tf
from tensorflow.keras.layers import Dropout, Embedding, Input, Dense, GRU
from tensorflow.keras.models import Model, Sequential
from tensorflow.keras.layers import Conv2D, MaxPooling2D, Flatten, Lambda
from tensorflow.keras.models import Model
import ... |
e6e1e1863944c349d82ae03127f972e617b2812ec89db71e0f4c8e972db6e460 | Python | 6,326 | 156 | """C3D, implemented in Gluon. https://arxiv.org/abs/1412.0767"""
# pylint: disable=arguments-differ,unused-argument
__all__ = ['C3D', 'c3d_kinetics400']
from mxnet import init
from mxnet.context import cpu
from mxnet.gluon.block import HybridBlock
from mxnet.gluon import nn
class C3D(HybridBlock):
r"""
The C... |
4f0e61579da8ad51814d6100b7857caf1a68d9ec8451057e553c26c7adcfad46 | Python | 6,327 | 162 | from utils import construct_vocabulary
from data_structs import Vocabulary,MolData
from torch.utils.data import DataLoader
from tqdm import tqdm
from model import DMPN
import argparse
import torch
from utils import valid_smiles,side_no_sca_change,canonicalize_smiles_from_file
import pandas as pd
import time
from time i... |
8e7c25cf5d1852dd7ef0de64f7bb3756f956a69f5cc94845d11ae6f5fc901992 | Python | 6,327 | 166 | # Copyright 2022 Deepfold Team
#
# 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 agreed to in writin... |
e28ecdb4f8456b4a29b0f3fb705a3ecdd1604420e6d6ad21e4d42da1f38bf81a | Python | 6,327 | 194 | #!/usr/bin/python
import sys
import os;
import glob
import pandas as pd
import numpy as np
import scipy.stats as stats
import time
import statsmodels.sandbox.stats.multicomp as multicomp
import re
from joblib import Parallel, delayed
import multiprocessing
import ConfigParser
n_cores = multiprocessing.cpu_count()
st... |
6d07354fe7da107d7a8a82252e9f6bd0080baa421c33b0494f572cc82475f918 | Python | 6,328 | 166 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from __future__ import annotations
import os
import shutil
import sys
import tempfile
from pathlib import Path
from typing import TYPE_CHECKING
from . import USER_CONFIG_DIR
from .patches import torch_save
from .torch_utils import TORCH_1_9
if TYPE... |
ab28b5cace4ee03275d068a9c455523eec77b442451ec570773b49298bb071dc | Python | 6,328 | 151 | import argparse
import glob
import os
from mp_dip.obci_readmanager.signal_processing.tags import tags_file_writer as tags_writer
import mne
from tqdm import tqdm
tag_convert_dict = {'Sleep stage 1': "1",
'Sleep stage 2': "2",
'Sleep stage 3': "3",
'Sleep s... |
a6a2a512894e4f4470d32ca986c244698ba96ea69725b96430fa5f6db72f2824 | Python | 6,329 | 180 | # Copyright 2017 The TensorFlow 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 applica... |
1e25f625ea3301e926d5c504378075fba83d28a75ff75331b6b975c48413b5d8 | Python | 6,330 | 171 | """FIX-H regression rows for ``torchlens.viz.render_heatmap`` (tviz memo D8).
The shipped renderer had two independent honesty defects (OPUS M2-M5):
bilinear interpolation on discrete cells, and a label-omission marker
computed BEFORE overlap selection (measured: 8 tokens drawing 4 labels with
no marker). These rows p... |
40e9fdd06eaafdd8b1363d57a9b437a0d1e9a3a2f6aff17f6cd086a5f8417c1e | Python | 6,330 | 164 | """Attachment sidecar writer guards (lane F14, netron memo D-15).
Netron's vendor parser drops malformed rows SILENTLY (measured in view.js
6465-6560: names truncate at the first newline before matching, duplicate
names last-write-wins within one target, model/graph rows require
``target: ""`` or vanish, unknown targe... |
47cefa7d2a267aa5d00e74ee615ee456039c7a2a20b73d63be5dd15a2d440b3e | Python | 6,330 | 170 | """Test of data set functionalities"""
import numpy as np
import pytest
from PyQt6.QtCore import Qt
import lmfit
from nanite.model import model_hertz_paraboloidal
import nanite.model.residuals as nres
import pyjibe.head
from helpers import MockModelModule, make_directory_with_data
def test_simple(qtbot):
"""Op... |
59169c4460a089ce3c7f5c1ef48dfb105ff31f299fcf88347c5e5590c6cb1d64 | Python | 6,331 | 173 | # A simple CLI runner for slurm that can be used when running Galaxy from a
# non-submit host and using a Slurm cluster.
from logging import getLogger
from . import (
BaseJobExec,
job_states,
)
from ... import runner_states
log = getLogger(__name__)
argmap = {"time": "-t", "ncpus": "-c", "partition": "-p"}
... |
a6b6565664fe2956b162dd1f1c7f655f8548259e8e85f46a83f749c5010334e5 | Python | 6,331 | 148 | import argparse
import torch
import librosa
import numpy as np
from torch import autocast
from contextlib import nullcontext
from models.mn.model import get_model as get_mobilenet, get_ensemble_model
from models.preprocess import AugmentMelSTFT
from helpers.utils import NAME_TO_WIDTH, labels
class EATagger:
"""
... |
c26f283b594ca671b8d997e68abd7013c5a0ccc02acb40a0df75ba31652d552d | Python | 6,331 | 168 | from unittest import mock
from uuid import UUID
from api.mocks import DUMMY_USER, FakeAuthContext
from carbonserver.api.infra.repositories.repository_projects import SqlAlchemyRepository
from carbonserver.api.schemas import Project, ProjectCreate
from carbonserver.api.services.project_service import ProjectService
P... |
71945856ae90073fdcb3cf31ad3a8c2bc01b05179ad503722fac93693a043474 | Python | 6,332 | 200 | """Phase 8 MLX hardening tests for deferred values and event topology."""
from __future__ import annotations
import json
from types import SimpleNamespace
from typing import Any
import pytest
import torchlens as tl
from torchlens.backends import BackendUnsupportedError
from torchlens.capture.projections import _rec... |
538e434565a371659198e098ce5a916e742e9e6a3e24651aa8d8c4a1d1d1fcb1 | Python | 6,333 | 172 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from numpy.testing import assert_array_equal
import numpy as np
import pytest
import scipy.stats
from eelbrain import datasets, test
from eelbrain.fmtxt import asfmtext
from eelbrain._stats import test as _test
def test_correlations():
"Test test.correlati... |
aee6c7374ce59c09a8b772755ebefb1a413e3f5d6ef21f3c22cde9382a557742 | Python | 6,333 | 187 | from keras.src import backend
from keras.src.api_export import keras_export
from keras.src.optimizers import optimizer
@keras_export(["keras.optimizers.Nadam"])
class Nadam(optimizer.Optimizer):
"""Optimizer that implements the Nadam algorithm.
Much like Adam is essentially RMSprop with momentum, Nadam is Ad... |
0fdc466c275d06e83e3c69e192911205ef3a1015d32534e2b822a0879786bc3a | Python | 6,334 | 191 | import copy
import io
from contextlib import redirect_stdout
import numpy as np
import pycocotools.mask as mask_util
import torch
from modelTraining.utils import *
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
class CocoEvaluator:
def __init__(self, coco_gt, iou_types):
asse... |
8641a64778d99b90e1e86979dfd570404d6304656d71b82484abdf81089147b5 | Python | 6,334 | 190 | #!/usr/bin/env python
#
# Copyright 2008, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list... |
e565ec4d829936ccd6f5203e23a8260b807dbcf2cb88e7c0069ee0462afadb47 | Python | 6,334 | 205 | #!/usr/bin/env python
from pathlib import Path
import numpy as np
import pandas as pd
from util import gen_util, logger_util, plot_util
gen_util.extend_sys_path(Path("").resolve(), parents=1)
from analysis import session
logger = logger_util.get_module_logger(name=__name__)
DFT_DATASET_PATH = Path("..", "..", "d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.