sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
8f3798ca289798c59101dcef1fc5c3c56b9969b9615c7e1a3a6b10f837f40ca5 | Python | 400 | 15 | import subprocess
subprocess.run(['bash', 'gdownload.sh'])
# importing the zipfile module
from zipfile import ZipFile
# loading the temp.zip and creating a zip object
with ZipFile("project_gene_connectivity_data.zip", 'r') as zObject:
# Extracting all the members of the zip
# into a specific locatio... |
025ca3a0c0bd0f277a8e8b839014e85e6c6a7282075a35ebc46d0fd09e77af3e | Python | 401 | 18 | from pathlib import Path
from setuptools import setup
# Read the contents of README file
source_root = Path(".")
try:
version = (source_root / "VERSION").read_text().rstrip("\n")
except FileNotFoundError:
version = "0.0.dev0"
with open(source_root / "src/data_profiling/version.py", "w") as version_file:
... |
92a0202928edff90a561f3246f28f00159f1810a65a095dfb05d95a176d150b7 | Python | 401 | 14 | from IPython.display import display
from ipywidgets import Output, widgets
from data_profiling.report.presentation.core.sample import Sample
class WidgetSample(Sample):
def render(self) -> widgets.VBox:
out = Output()
with out:
display(self.content["sample"])
name = widgets.H... |
104fea5f26ab59d3e9a619b960cb8215f448a94690bbff4f26a75a70d422eb1e | Python | 402 | 19 | import typer
from .fit_model import fit_model
from .prepare_data import prepare_data
from .refine_tomogram import refine_tomogram
# pretty_exceptions_show_locals=False gives shorter error messages
app = typer.Typer(pretty_exceptions_show_locals=False)
app.command()(prepare_data)
app.command()(fit_model)
app.command()... |
5c7f54008ad413276a491723898b0f38b4d1034677e9227aa43f2b2c0d1eed8c | Python | 402 | 16 | from rpy2.robjects import r
from rpy2.robjects.packages import importr
from rpy2.robjects import pandas2ri
pandas2ri.activate()
def get_mat_path(sc_path, pa_path, output_path):
importr("GSEABase")
importr("AUCell")
importr("SingleCellExperiment")
importr("SNFtool")
print('R package lo... |
c9b4439660dfd75f889a64c1f086ebe0304be8f7948f4fc3876986358e2e8e4d | Python | 402 | 18 | import mdgru.data
import mdgru.runner
import mdgru.helper
import mdgru.eval
try:
import mdgru.model
except ModuleNotFoundError as e:
if e.name == "tensorflow":
print("Tensorflow is not installed")
else:
raise e
try:
import mdgru.model_pytorch
except ModuleNotFoundError as e:
if e.nam... |
fba21a831a39222dc07b862a55f2f1f048912b2b7ddf80bfb8f4e798029a7b7a | Python | 402 | 12 | from ocpmodels.tasks.task import BaseTask
from ocpmodels.common.registry import registry
@registry.register_task("run-relaxations")
class MyRelaxationTask(BaseTask):
def run(self):
assert (
self.trainer.relax_dataset is not None
), "Relax dataset is required for making prediction... |
e916d39a706b74112c12b28c5e27d57082b8529ba01d0ebad04fbe4e14fc58b7 | Python | 403 | 17 | import sys
import pytest
from ci.ray_ci.container import _DOCKER_ECR_REPO, get_docker_image
def test_get_docker_image() -> None:
assert get_docker_image("test-image") == f"{_DOCKER_ECR_REPO}:test-image"
assert (
get_docker_image("test-image", "a1b2c3")
== f"{_DOCKER_ECR_REPO}:a1b2c3-test-ima... |
19966a2c72dd516451ed35109ef265954bf29b99e6495553c8ab5f93cf0554a5 | Python | 404 | 8 | from deepface import DeepFace
DeepFace.stream("dataset", enable_face_analysis=False, anti_spoofing=True) # opencv
# DeepFace.stream("dataset", detector_backend = 'opencv')
# DeepFace.stream("dataset", detector_backend = 'ssd')
# DeepFace.stream("dataset", detector_backend = 'mtcnn')
# DeepFace.stream("dataset", detec... |
b3b48991078cbac1863956e74405385d3f595345f937c8251fff9e315add731e | Python | 404 | 23 | """
Utilities for SCLLM models.
"""
from .output_utils import (
SCLLMOutput,
ModelProgressManager,
loading_model,
model_loaded,
operation_start,
operation_complete,
suppress_verbose_output,
)
__all__ = [
'SCLLMOutput',
'ModelProgressManager',
'loading_model',
'model_loaded... |
322ad6cd92ad872d2e989b762905ca6ddc0b3e082111c9635114d976cdbdea47 | Python | 405 | 24 | # Tags for zero-shot scene classification (short category labels)
TAGS = [
"kitchen",
"living room",
"office",
"meeting room",
"classroom",
"restaurant",
"cafe",
"grocery store",
"gym",
"warehouse",
"parking lot",
"city street",
"park",
"shopping mall",
"beac... |
6f09206bb6a98a0eb1c6ad446e671db053e904127253c25078017b28ce792d32 | Python | 406 | 13 | """Vendored geosketch (Hie et al., Cell Systems 2019).
Original repo: https://github.com/brianhie/geosketch (MIT License).
Vendored verbatim with one modification:
- ``utils.py``: ``fbpca.pca`` and ``sklearn.random_projection.SparseRandomProjection``
imports moved inside ``reduce_dimensionality()`` so the package i... |
d3f2b83b9dc5775ec63d2402e2fb01f6f5e3dd63eb76a20a1a1ae395673941a3 | Python | 406 | 14 | """
Test for issue 249:
https://github.com/Data-Centric-AI-Community/data-profiling/issues/249
"""
import pandas as pd
from data_profiling import ProfileReport
def test_issue249():
df = pd.DataFrame(data=[[1], [2]], index=["foo", 1], columns=["a"])
report = ProfileReport(df, explorative=True, progress_bar=Fa... |
41245d57052c4d41e97aaf6070a53736f1180ef2c6797909ef8e349f781dcd75 | Python | 407 | 22 | from os.path import *
import os
import sys
from cStringIO import StringIO
import tempfile
import shutil
from glob import glob
import subprocess
import shlex
import re
from mock import Mock, MagicMock, patch, mock_open, call
from nose.tools import *
from nose.plugins.attrib import attr
from Bio import SeqIO
import co... |
774ce53be8ea852be95d6e771a27bdeec2643cccdbbaf1db7ac201c14d5fd4c5 | Python | 407 | 12 | from dataclasses import dataclass, field
from typing import Dict, Any, Callable, Optional, Type, List
@dataclass
class Config:
type_hooks: Dict[Type, Callable[[Any], Any]] = field(default_factory=dict)
cast: List[Type] = field(default_factory=list)
forward_references: Optional[Dict[str, Any]] = None
c... |
82315a6ac4fee11aa0cf0b7efe007bce7a962e33ccc3a7aee9ab9e26a348006a | Python | 407 | 15 | import json
with open('files.json') as f:
data = json.load(f)
with open('models.tsv','w') as f:
f.write('cell_type\tmodel link\tmd5\n')
for file in data['files']:
if '.pt' in file['links']['self']:
cell_type = file['links']['self'].split('/')[-1].split('_')[0]
f.write(cell_type+'\t')
f.write(file['... |
351b82d7a8351b3162f4cda4c5cc59264d0a675e9b882fa6e2b18576fc54848e | Python | 408 | 14 | enhance_head = dict(
_scope_='lqit',
type='BasicEnhanceHead',
in_channels=256,
feat_channels=256,
num_convs=5,
loss_enhance=dict(type='L1Loss', loss_weight=0.5),
gt_preprocessor=dict(
type='GTPixelPreprocessor',
mean=[123.675, 116.28, 103.53],
std=[58.395, 57.12, 57.3... |
e4d84ec8c0a2b5becd9e9e1d09c189969027a6b9b8b57727bcf7a11ccb49d2db | Python | 408 | 9 | # NOTE: We provide these as aliases to maintain compatibility with older version
# of Arrow `PyExtensionType` that relies on picked class references that
# reference `ray.air.util.tensor_extensions.arrow.*` classes
from ray.data._internal.tensor_extensions.arrow import (
ArrowTensorType, # noqa: F401
... |
ff98c5d61197b5aaf88d0fd014454c95cc735fdebbeb1891e95a7d7705573c97 | Python | 408 | 12 | from openmm.app import AmberInpcrdFile, AmberPrmtopFile
from .base import EndstateCorrectionBase
class EndstateCorrectionAMBER(EndstateCorrectionBase):
def _get_mm_topology(self) -> AmberPrmtopFile:
prm7 = AmberPrmtopFile(self.top.prm7_file_path)
return prm7
def _get_initial_coordinates(self... |
3c225a7b92419d172e0692d0418147c166a20e574e60b2b48324602e2db7b3d8 | Python | 409 | 18 | from __future__ import absolute_import, print_function
try:
from pathlib import Path
Path().expanduser()
except (ImportError,AttributeError):
from pathlib2 import Path
try:
import tempfile
tempfile.TemporaryDirectory
except (ImportError,AttributeError):
from backports import tempfile
try:
... |
8b62385eeb3b77717b5474d39c5a72a236a169933ed4b9183cfea325d9ddecbb | Python | 410 | 11 | from siapy.entities import SpectralImage
from siapy.entities.images import RasterioLibImage
# Load from GeoTIFF or other raster formats (uses rioxarray/rasterio python library)
image_rio = RasterioLibImage.open(
filepath="path/to/image.tif",
)
image = SpectralImage(image_rio)
# Or you can use the class method to ... |
c356012453b8ef74a2563808a8fb6d5c0727cabec1e42c63a16cfe6da35c6e15 | Python | 410 | 15 | from enum import Enum
class MetricType(Enum):
"""Types of metrics supported by the telemetry system.
Note: SUMMARY metric type is not supported. SUMMARY is a Prometheus metric type
that is not explicitly supported in OpenTelemetry. Use HISTOGRAM instead for
similar use cases (e.g., latency distributi... |
055b15c22b23c1c70d620c365f352d24ab30ca6277c5aed1846f225218c2006a | Python | 411 | 12 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""High-level interface for executing Experiments."""
# Convenience imports for easier access to the classes.
from aihwkit.experiments.experiments.training imp... |
1130939402e01065657fe6026f34aa420a0dfe299e22819572386779b53c47f5 | Python | 411 | 16 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
from importlib.metadata import PackageNotFoundError, version
try:
__version__ = version("fairchem.... |
1a6f38c22f2362ec3f62ece09d687a61d16e799e0ec0bafe52108938b2521aaa | Python | 411 | 19 | #!/usr/bin/env python3
from pathlib import Path
import h5py
from fire import Fire
from tqdm import tqdm
def find_broken_h5s_(feature_dir: str) -> None:
for h5 in tqdm(list(Path(feature_dir).glob("*.h5"))):
try:
with h5py.File(h5):
pass
except OSError:
print... |
1c59da9782d0eea0fbfd4db8383abd17c1bf179b760964c7dd4bc4e2baa4b754 | Python | 411 | 17 | # Generated by Django 4.1.6 on 2023-02-09 17:24
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("infer", "0013_proteinembedding_protein_embedding"),
]
operations = [
migrations.AlterField(
model_name="proteinembedding",
... |
b3071a5e046d05b3149ad6927999c6a854aa9e4a5e142d5a63435148ee13f357 | Python | 411 | 14 | import threading
import unittest
from pfrl.utils import StoppableThread
class TestStoppableThread(unittest.TestCase):
def test_stoppable_thread(self):
stop_event = threading.Event()
thread = StoppableThread(stop_event=stop_event)
self.assertFalse(thread.is_stopped())
thread.stop()... |
ad6e080c8727952e7a1dc70580f4c06f6dbfcfd7f3fef163f507205589535013 | Python | 412 | 10 | # __init__.py
# This is called upon running "import hello_world_package"
# define behavior for "from hello_world_package import *":
#__all__ = ['hello', 'calculate']
# directly import modules when using "import hello_world_package":
#from hello_world_package import hello
#from hello_world_package import calculate
# m... |
cf03e38bb05f70e6d952788f28b97452e21b88687ee9b18aabee3b09ac132eee | Python | 412 | 16 | '''
Created on Apr 20, 2016
@author: jivan
'''
def split_sequence(sequence, subsequence_length):
'''
Returns a list containing subsequences of length *subsequence_length*.
'''
peptide_list = []
num = len(sequence.strip()) - subsequence_length + 1
for i in range(num):
peptide = sequ... |
d2b390c3d61a6b53ae691f0b66008ff8844fba0d40c6b57cc421807e260ec4a8 | Python | 412 | 14 | #!/usr/bin/env python
from setuptools import find_packages, setup
setup(
name="GCDM-SBDD",
version="0.0.2",
description="A geometry-complete diffusion model for structure-based drug design.",
author="Alex Morehead",
author_email="acmwhb@umsystem.edu",
url="https://github.com/BioinfoMachineLear... |
ab72d4538ecd6823aa0cd66d6a82e23959f9d5761afa693e433fa41c3888cde6 | Python | 413 | 14 | import numpy as np
import pytest
from neuropower import cluster
@pytest.mark.xfail(reason="AttributeError: 'DataFrame' object has no attribute 'append'")
def test_cluster_output():
np.random.seed(seed=100)
testSPM = np.random.rand(4, 4, 4)
mask = np.zeros((4, 4, 4)) + 1
tab = cluster.PeakTable(testSP... |
d01f1790b375e7703602752d3587c55a03dc714d781bb3025c68da8557ff2909 | Python | 415 | 17 | # Generated by Django 4.1.6 on 2023-02-06 04:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("infer", "0009_alter_dataset_negatives_path_and_more"),
]
operations = [
migrations.AlterField(
model_name="weights",
... |
f30055b928e09adf69feee3ecc753623987c5607df68f90508fd3e2bb7f71b46 | Python | 415 | 20 | """
Convert key type of dictionary.
"""
def str2int(input_dict):
out_dict = {}
for k in input_dict:
try:
new_k = int(k)
out_dict[new_k] = input_dict[k]
except:
print("Key %s is not a integer." % k)
return out_dict
if __name__ == "__main__":
test1 = ... |
d8c2d9c5bdf37093a6f23f92065b3752a99ffcfd9ae8dcbdd7b7bfd84f141338 | Python | 416 | 14 | from IPython.display import display
from ipywidgets import Output, widgets
from data_profiling.report.presentation.core.duplicate import Duplicate
class WidgetDuplicate(Duplicate):
def render(self) -> widgets.VBox:
out = Output()
with out:
display(self.content["duplicate"])
n... |
18cc3acb8407d4299298c9e9ad07aad7e4bbe30fc866e60209408fd7e2aee70a | Python | 417 | 15 | import click
from ci.ray_ci.automation.docker_tags_lib import check_image_ray_commit
from ci.ray_ci.docker_container import RayType
@click.command()
@click.option("--ray_type", required=True, type=RayType)
@click.option("--expected_commit", required=True, type=str)
def main(ray_type, expected_commit):
check_imag... |
f768552e343e172cc2df9fc7711d378e1aab4861aa07b6019e6d6f9bf38b6aec | Python | 417 | 15 | import pytest
import ray._private.ray_constants as ray_constants
@pytest.fixture
def set_override_dashboard_url(monkeypatch, request):
override_url = getattr(request, "param", "https://external_dashboard_url")
with monkeypatch.context() as m:
if override_url:
m.setenv(
ray... |
3ca4183f2dab006e988b2cf7662c36a47fce78b99d0ac9d746cbd8e817ec308b | Python | 418 | 15 | from bottle import Bottle
from FeatureCloud.app.api.http_ctrl import api_server
from FeatureCloud.app.engine.app import app
from web import api_server as web_api_server
# import is needed to register the states
import states
server = Bottle()
if __name__ == '__main__':
app.register()
server.mount('/api', api... |
e502dc7d3dcf5d8fd156417420976677fd03ca465d257fded54c9549cbcd12b6 | Python | 418 | 16 | from setuptools import setup, find_packages
setup(
name='quantax',
version='0.0.1',
description='Flexible neural quantum states based on QuSpin, JAX, and Equinox',
author='Ao Chen',
author_email='chenao.phys@gmail.com',
packages=find_packages(),
python_requires=">=3.9,<3.10",
install_re... |
5a606b6554ce5894a226b30d64f312820f989cb17c95ee8fbbfc17725c79a2e1 | Python | 419 | 14 | from typing import Any
from data_profiling.report.presentation.core.item_renderer import ItemRenderer
class FrequencyTable(ItemRenderer):
def __init__(self, rows: list, redact: bool, **kwargs):
super().__init__("frequency_table", {"rows": rows, "redact": redact}, **kwargs)
def __repr__(self) -> str:... |
3c2a3e58380eb2b3d559520d4353d3181f22b82669d8a2f4e30c571ec847c57f | Python | 420 | 15 | _base_ = 'faster-rcnn_r50_fpn_2x_ruod.py'
model = dict(
backbone=dict(
type='ResNeXt',
depth=101,
groups=64,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
style='pytorch',
... |
490d8caf4db0d29385af892f8d65f4704a8ecd4f3cde58dcbd17caec8b54a804 | Python | 420 | 15 | _base_ = 'faster-rcnn_r50_fpn_2x_ruod.py'
model = dict(
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
style='pytorch',
... |
a21e3addb67661d07339cc27a7eea1eb3d3f8ae04fc5ac29b509ee6b84d67a5c | Python | 420 | 16 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
from importlib.metadata import PackageNotFoundError, version
try:
__version__ = version("fairchem.... |
bf9a800b05442ae44c90605fd9f69d9a514a9297c8299e97b36488ff60a091f0 | Python | 420 | 22 |
import h5py
import shutil
import os
import time
import numpy
# BlockingIOError
# OSError
path = "../../data/debug/tmp.hdf5"
with h5py.File(path, mode="a") as file:
print(file.keys())
with h5py.File(path, mode="r+") as file2:
print(file2.keys())
if "tmp" in file2:
del file2["tmp... |
493314f6ff07fafea0b898aa4637385a426755afa95b95f2a3bebed7b661bd16 | Python | 421 | 18 | """
Pathway-related API clients for DataCollect.
This module provides API clients for pathway databases including:
- KEGG: Metabolic and signaling pathways
- Reactome: Biological pathways and reactions
- GtoPdb: Guide to Pharmacology database
"""
from .kegg import KEGGClient
from .reactome import ReactomeClient
from ... |
7fd1a15978118e59fdf25f626002e54865b7ec14e64c112775edd4fbeec38b38 | Python | 421 | 13 | import requests
from .__config import base_url
from .__aux_funcs import process_response
def get_server_status():
"""
Get the running status of the server. \n
:returns: A DataFrame containing the status of the server. \n
:rtype: pandas.DataFrame \n
"""
endpoint = "/health"
response = reques... |
a89ab23d843592ae7ae85bc59410b0713ed7220588286c3f26c5b21f809af39c | Python | 421 | 18 | # Generated by Django 4.1.6 on 2023-02-06 03:32
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("infer", "0002_weights_organisms"),
]
operations = [
migrations.AddField(
model_name="organism",
name="ncbi_taxon",
... |
daed148983607d0cc129f619f73fbbb9c2ea411c00bc14c03a07e6fc733eec27 | Python | 421 | 13 | from setuptools import setup
setup(name='toxify',
version='0.1.78',
description='The toxify joke in the world',
url='http://github.com/tijeco/toxify',
author='Flying Circus',
author_email='flyingcircus@example.com',
entry_points = {'console_scripts': ['toxify=toxify.cli:main'],},
... |
dd0130c2c6a12fcef9f3376fd8bd66dfb066be41e27b6f6df6e30091c9311ef9 | Python | 421 | 21 | """Dataclass for AMBER and CHARMM topology"""
from dataclasses import dataclass
from typing import List
@dataclass
class AMBERTopology:
"""This is a dataclass for amber topology."""
rst7_file_path: str
prm7_file_path: str
@dataclass
class CHARMMTopology:
"""This is a dataclass for CHARMM topology."... |
e95c80ef12f43206b950fb94c67c87f1a9099ff21efcf7cfb525b7fcfc8ca69f | Python | 421 | 20 | import pandas as pd
import pytest
from data_profiling import ProfileReport
@pytest.fixture()
def df():
df = pd.DataFrame(
{
("foo", "one"): [1, 2, 3],
("bar", "two"): [4, 5, 6],
}
)
return df
def test_multiindex_columns(df: pd.DataFrame):
profile_report = Pro... |
ce360efc5d768800d64c7b54807e7588274a86f1f00521e5803584f04e33aead | Python | 422 | 18 | from abc import ABC, abstractmethod
from typing import Dict, List, Callable
import tensorflow as tf
from ml4h.TensorMap import TensorMap
Tensor = tf.Tensor
Block = Callable[[Tensor, Dict[TensorMap, List[Tensor]]], Tensor]
class Block(ABC):
@abstractmethod
def __call__(self, x: Tensor, intermediates: Dict[T... |
2142d902f06ea327b647a6acf3ac9a6794400420c32b6325f41f9f856c840d75 | Python | 424 | 21 | """Re-export synthesizer types from `omicverse.llm.dr`.
Allows `from omicverse.llm.domain_research.write.synthesizer import ...`.
"""
from __future__ import annotations
from ...dr.write.synthesizer import ( # noqa: F401
TextSynthesizer,
SimpleSynthesizer,
PromptSynthesizer,
SynthesisInput,
)
__all_... |
c80610bfcb54cbeca0048be8520a982439138d79d439c7f5b1c82e00652ed0e3 | Python | 424 | 11 | from .utils import get_model_config, get_model_config_from_trial, get_model_config_from_study
from .base import BaseModelConfig
from .dynunet import DynUNetConfig
from .segresnetvae import SegResNetVAEConfig
from .swinunetr import SwinUNETRConfig
from .unet import UNetConfig
from .unetr import UNETRConfig
from .vnet i... |
19bf51f2078cc17ffe5a3c25153c7c52f12436f1f5ac0d56aa680eb4b6841caa | Python | 425 | 15 | _base_ = 'faster-rcnn_r50_fpn_1x_urpc-coco.py'
model = dict(
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
style='pytor... |
59c0d21ceb81b2872bcf1a760efbfc36e09b9ee165f59cb562d897412b4a81ea | Python | 425 | 15 | _base_ = 'faster-rcnn_r50_fpn_2x_urpc-coco.py'
model = dict(
backbone=dict(
type='ResNeXt',
depth=101,
groups=64,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
style='pytor... |
8d3637819d445f619cc6bb8ed98ea0c87190f1af21787bae5b358594496ec7f3 | Python | 425 | 15 | _base_ = 'faster-rcnn_r50_fpn_1x_urpc-coco.py'
model = dict(
backbone=dict(
type='ResNeXt',
depth=101,
groups=64,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
style='pytor... |
b369d8b8584c84088da8cf0ba1304b378fc21673f74980c75de7c52b8ad4b26a | Python | 425 | 15 | _base_ = 'faster-rcnn_r50_fpn_2x_urpc-coco.py'
model = dict(
backbone=dict(
type='ResNeXt',
depth=101,
groups=32,
base_width=4,
num_stages=4,
out_indices=(0, 1, 2, 3),
frozen_stages=1,
norm_cfg=dict(type='BN', requires_grad=True),
style='pytor... |
19d2a4a7ad68778147b421341f22ab23a2ad2d8e816d526e1aa09ca03afb9049 | Python | 426 | 10 | from .lark_manager import (MonitorManager, MonitorTracker,
context_monitor_manager, get_error_message,
get_user_name, initialize_monitor_manager,
send_alert_message)
__all__ = [
'send_alert_message', 'get_user_name', 'initialize_monit... |
7dac42cf21de0e90bf0f227775664aaf470ebad233de07ba29b85b5057d7f3e6 | Python | 426 | 18 | # Generated by Django 4.1.6 on 2023-02-09 18:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("infer", "0015_proteinembedding_weights"),
]
operations = [
migrations.AddField(
model_name="weights",
name="trunc_len... |
b0c87c0ace43c778f3f47830147847e7a6e48e458b8baf546db5eac282e3d8bb | Python | 426 | 12 | from data_profiling.report.presentation.core.sample import Sample
from data_profiling.report.presentation.flavours.html import templates
class HTMLSample(Sample):
def render(self) -> str:
sample_html = self.content["sample"].to_html(
classes="sample table table-striped"
)
retur... |
f3340f760f4bcddcc3d51de3336fd04b2367aeddcc9a3281aab8f4020157c981 | Python | 426 | 20 | import pandas as pd
import pytest
from data_profiling import ProfileReport
@pytest.fixture()
def df():
df = pd.DataFrame(
{
"foo": [1, 2, 3],
},
index=pd.Index([1, 2, 3], name="foo"),
)
return df
def test_index_column_name_clash(df: pd.DataFrame):
profile_report ... |
8dfa6fe6240ed5482cb378190230ef3669970c94d3718094065d65c15a372cd0 | Python | 427 | 16 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
from importlib.metadata import PackageNotFoundError, version
try:
__version__ = version("fairchem.... |
ac94c6b8ffa3a7e30fad3f04975b934cea2c222515b3ba86bed1640995421128 | Python | 427 | 20 | # This file is used by CrossLanguageDeploymentTest.java to test cross-language
# invocation.
from ray import serve
def echo_server(v):
return v
@serve.deployment
class Counter(object):
def __init__(self, value):
self.value = int(value)
def increase(self, delta):
self.value += int(delta)... |
e0b22425aaf30f2882ae7f1e33b1364095f0623ff7612fbf388008e82d32717c | Python | 428 | 21 | from .decoder import (
CachedTransformerDecoder,
CachedTransformerDecoderLayer,
select_kv_cache,
)
from .sparse_backBone import GATBase
from .ualign import (
PositionalEncoding,
PretrainModel,
load_model_arch,
)
__all__ = [
'CachedTransformerDecoder',
'CachedTransformerDecoderLayer',
... |
714f2bacd70209d576f082b931c69236113ea008585aa24e1e04280685dcdfb8 | Python | 429 | 17 | from mmdet.datasets import CocoDataset
from lqit.registry import DATASETS
DUO_METAINFO = {
'classes': ('holothurian', 'echinus', 'scallop', 'starfish'),
'palette': [(235, 211, 70), (106, 90, 205), (160, 32, 240), (176, 23, 31)]
}
@DATASETS.register_module()
class DUODataset(CocoDataset):
"""Detecting Un... |
ee4e05ca1dce04c2f7a56cb21c2cba4bf35641985b36f5d14017719b50dc2f8d | Python | 429 | 13 | import requests
from .__config import base_url
from .__aux_funcs import process_response
def get_info():
"""
Get information about the running instance. \n
:returns: A DataFrame containing information about the running instance. \n
:rtype: pandas.DataFrame \n
"""
endpoint = "/info"
response... |
0750319bab12f4d8dd3e91deda4d8d1f070a2a286513b10c5ce081f23ddaaa1d | Python | 430 | 20 | """
=================
SingleExponential
=================
:class:`~sinabs.activation.SingleExponential` surrogate gradient.
"""
import matplotlib.pyplot as plt
import torch
import sinabs.activation as sina
x = torch.linspace(-2, 4, 500)
plt.plot(
x, sina.SingleExponential()(v_mem=x, spike_threshold=1.0), label="... |
0c71957c7d26d55e1853248306bf0a59f52c2a51539eebdfce1a2e30dbdcd549 | Python | 431 | 14 | #test year model
from pytorch_lightning import Trainer
from src.models import year
import torch
import pandas as pd
import numpy as np
def test_YearEnsemble(dm, config):
m = year.learned_ensemble(classes=dm.num_classes, years=4, config=config)
images = [torch.randn(1, 349, 11, 11) for x in range(3)]
images... |
a9693d0bcb92f06d90706b805b0c5df5cb4acb173993a5c1781358a370f61de7 | Python | 431 | 16 | # __setup_start__
from setuptools import setup
setup(
name="qwen3-reward-plugin",
version="0.1.0",
packages=["qwen3_reward_plugin"],
# vLLM discovers and runs this entry point in every process (the engine core
# and each rank worker) via load_general_plugins().
entry_points={
"vllm.gene... |
5b63108beb20b844dde61dd08a31e8cb948b7a9325630f768af1b33f2666ca1c | Python | 432 | 19 | import numpy as np
import pandas as pd
from siapy.features.spectral_indices import compute_spectral_indices
# Create sample spectral data
np.random.seed(42)
data = pd.DataFrame(
{
"R": np.random.random(100),
"G": np.random.random(100),
}
)
indices_df = compute_spectral_indices(
data=data,... |
ed65f768fbbfc5056da7fd2e948f398b47ed117754e5c710a78a3b3978884baf | Python | 433 | 14 | from conans import ConanFile
class ArgsConan(ConanFile):
name = "args"
version = "6.3.0"
url = "https://github.com/Taywee/args"
description = "A simple header-only C++ argument parser library."
license = "MIT"
exports = ["LICENSE"]
exports_sources = "args.hxx"
def package(se... |
bf85ea48c17154ec100b4f43da2d0c4d426ba7abeca2f31dab21cfd4398c5b2c | Python | 434 | 16 | import numpy as np
import pandas as pd
from siapy.entities import Pixels
# Create from pandas DataFrame
pixels1 = Pixels(pd.DataFrame({"x": [10, 20, 30], "y": [40, 50, 60]}))
# Create from numpy array
pixels2 = Pixels.from_iterable(np.array([[10, 40], [20, 50], [30, 60]]))
# Create from list of coordinates
pixels3 ... |
888f0556de6e83d0b3f8c29f0f27ea0a35c83114e7181fc2c1d6107c0860f142 | Python | 436 | 16 | # Run in a subprocess by test_get_serve_instance_details_for_imperative_apps
from ray import serve
from ray.serve.tests.test_config_files import world
def submit_imperative_apps() -> None:
serve.run(world.DagNode, name="app1", route_prefix="/apple")
print("Deployed app1")
serve.run(world.DagNode, name="... |
aa824b491d7b723b66492fe64515f845aea2e394c1e6cab699a9184eb127197f | Python | 436 | 13 | import torch
def generate_square_subsequent_mask(sz, device='cpu'):
mask = (torch.triu(torch.ones((sz, sz))) == 1).transpose(0, 1)
return (mask == 0).to(device)
def generate_tgt_mask(tgt, tokenizer, pad='<PAD>', device='cpu'):
pad_idx = tokenizer.token2idx[pad]
tgt_pad_mask = (tgt == pad_idx).to(dev... |
bace275d36f1230867605fcd49b81d0a40e34c8638c24de3ef2ed8897be540b7 | Python | 436 | 16 | # built-in dependencies
import json
# project dependencies
from deepface import DeepFace
from deepface.commons.logger import Logger
logger = Logger()
def test_version():
with open("../../package_info.json", "r", encoding="utf-8") as f:
package_info = json.load(f)
assert DeepFace.__version__ == pack... |
ccfba28d19788209691ede7f4fba28be6bb58630b46f26256bb20021b8b7ba7e | Python | 436 | 22 | struct = []
score = []
energy = []
f=open(r'score.sc')
scores = f.readlines()
f.close()
c = 0
for k in scores:
c += 1
if c > 2:
if len(k.split()) > 41:
score.append(k.split()[4])
struct.append(k.split()[41])
energy.append(k.split()[1])
f = open('score.txt','w')
f.cl... |
8956fc8b7f5b07147c29a3059db7d0fd8795ee59b5645fa62469074634b82e6b | Python | 437 | 20 | #!/bin/python
#------------------- Description & Notes --------------------#
#------------------- Dependencies ---------------------------#
# Standard imports
# Third-party imports
# Internal imports
from .kmer import *
from .seq import *
#------------------- Constants ------------------------------#
#----------... |
9c3f04ee6794e68f3045468f15038aeaf4a6410072603cb60461823114d045ac | Python | 437 | 18 | import os
from importlib import import_module
from pathlib import Path
# Lazily import sdk to avoid circular dependencies.
def __getattr__(name):
if name == "sdk":
sdk = import_module("ray.autoscaler.sdk")
globals()[name] = sdk
return sdk
raise AttributeError(f"module {__name__!r} has... |
e70c4de38c955e678473460d64d685c627f2eede7d23b5c03dfbb678874551a6 | Python | 437 | 16 | from typing import Any
import pandas as pd
from data_profiling.report.presentation.core.item_renderer import ItemRenderer
class Duplicate(ItemRenderer):
def __init__(self, name: str, duplicate: pd.DataFrame, **kwargs):
super().__init__("duplicate", {"duplicate": duplicate}, name=name, **kwargs)
def... |
e9ec7659d2475302e7e4442f922418fb2a20e9f75042a6516a40d1a2613700d1 | Python | 438 | 15 | import pandas as pd
from data_profiling import ProfileReport
from data_profiling.utils.cache import cache_file
if __name__ == "__main__":
file_name = cache_file(
"titanic.csv",
"https://raw.githubusercontent.com/datasciencedojo/datasets/master/titanic.csv",
)
df = pd.read_csv(file_name)
... |
6b14d348cfc0af533d717b0700f8652d9a69554040522d1c7fab393ef053bf27 | Python | 439 | 15 | from setuptools import find_packages, setup
setup(
name="multicamera_acquisition",
packages=find_packages(),
version="0.1.0",
description="Python packaamera acquisition with Flir and Basler cameras.",
author="dattalab",
license="MIT",
install_requires=["tqdm", "numpy", "pyserial", "pathlib2... |
03d6b6eee81e86e1ed0ea7ba4c5c0f4678058be605483dc841454935cce0c8f9 | Python | 440 | 17 | import elikopy.core
import elikopy.individual_subject_processing
import elikopy.utils
import elikopy.utilsSynb0Disco
import elikopy.registration
try:
import elikopy.mouse
except ImportError as e:
elikopy.mouse = None
print("Mouse module not available: {}".format(e))
try:
import elikopy.modelSynb0Disco... |
37acd43816b63a7f6f2cde1a19079224389456b8e419afd0967132854efdcf31 | Python | 440 | 16 | """
AVA package for segmenting audio
Contains
--------
`ava.segmenting.amplitude_segmentation`
Segment based on amplitude thresholds.
`ava.segmenting.refine_segments`
Get rid of of false positive syllables (noise).
`ava.segmenting.segment`
Segment large batches of audio files.
`ava.segmenting.template_segmentation`... |
a94409436260ae760bf37bd6615dc0b768885862fbedd3cb38c6bf065ac72ee1 | Python | 440 | 21 | """
===================
PeriodicExponential
===================
:class:`~sinabs.activation.PeriodicExponential` surrogate gradient.
"""
import matplotlib.pyplot as plt
import torch
import sinabs.activation as sina
x = torch.linspace(-2, 4, 500)
plt.plot(
x,
sina.PeriodicExponential()(v_mem=x, spike_threshold... |
3fdef9b565b80b19ad7f9ff74f065e4061490fc51ff105ea272e3bc4f7803220 | Python | 441 | 20 | from canonicalize_data_csv import canonicalize_file, build_parser
def main():
parser = build_parser(
'Canonicalize USPTO-50K CSV data',
include_class_mode=False,
default_num_procs=4,
)
args = parser.parse_args()
canonicalize_file(
args.filename,
class_mode='pres... |
c292c63a33257519c9e9f16ddfc741c9e5f9ac241c5e94cd999ffd3b76f33e62 | Python | 441 | 14 | from typing import TYPE_CHECKING
from ray.data._internal.execution.execution_callback import (
ExecutionCallback,
)
if TYPE_CHECKING:
from ray.data._internal.execution.streaming_executor import StreamingExecutor
class ExecutionIdxUpdateCallback(ExecutionCallback):
def after_execution_succeeds(self, exec... |
2ee2f3dfd7e2f6a741062351966b563a4835d2de102f63dcecaac9be882c646c | Python | 443 | 14 | #!/usr/bin/env python
from setuptools import find_packages, setup
setup(
name="Bio-Diffusion",
version="0.0.1",
description="A hub for deep diffusion networks designed to generate novel biological data",
author="Alex Morehead",
author_email="acmwhb@umsystem.edu",
url="https://github.com/Bioinf... |
b2bd80e35abf348b568710db001091d3de79998e48f245325e45bee93f62b7a7 | Python | 443 | 20 | from canonicalize_data_csv import canonicalize_file, build_parser
def main():
parser = build_parser(
'Canonicalize USPTO-FULL CSV data',
include_class_mode=False,
default_num_procs=4,
)
args = parser.parse_args()
canonicalize_file(
args.filename,
class_mode='min... |
60921023e4713a1c93900ced1cff5e70c99dbd31257572172d20e7b07f0127ec | Python | 444 | 20 | """
===========
MultiSpike
===========
:class:`~sinabs.activation.MultiSpike` activation function.
"""
import matplotlib.pyplot as plt
import torch
import sinabs.activation as sina
v_mem = torch.linspace(0, 5.5, 500)
spike_threshold = 1.0
activations = sina.MultiSpike.apply(v_mem, spike_threshold, sina.MultiGaussia... |
b43c71addea09f48d2998533e6b6c1554a17da70a44d72640bbbb6ac18584d75 | Python | 444 | 13 | from setuptools import setup, find_packages
setup(
name='spiking_readout',
version='1.0',
description='Single-layer and time-based SNN used as a Readout to solve classification tasks',
author='Gaspard GOUPY',
author_email='gaspard.goupy@univ-lille.fr',
keywords='SNN supervised local STDP synapt... |
302e1c1df4ad71871e109cb1e053c601bf78299054ab38d53f757afade6744ce | Python | 447 | 12 | # -*- coding: utf-8 -*-
# File : __init__.py
# Author : Jiayuan Mao
# Email : maojiayuan@gmail.com
# Date : 27/01/2018
#
# This file is part of Synchronized-BatchNorm-PyTorch.
# https://github.com/vacancy/Synchronized-BatchNorm-PyTorch
# Distributed under MIT License.
from .batchnorm import SynchronizedBatchNorm1... |
db6ce9b2f068ae65770f6552d72c0c0e7c9c82bdce9f19fe656b8a48853ca67f | Python | 448 | 10 | from .basic_distributions import Distribution
from .bernoulli import Bernoulli
from .univariate_gaussian import UnivariateGaussian
from .bernoulli_gaussian import BernoulliGaussian
from .beta import Beta
from .binomial import Binomial
from .gamma import Gamma
from .multivariate_gaussian import MultivariateGaussian
from... |
0d5c01febc950efc880c19d906dbf8bd6c678198103394d4c3cb16cdf2f53610 | Python | 449 | 20 | from torch import nn
import pfrl
def test_evaluating():
a = nn.Linear(1, 1)
b = nn.Linear(1, 1)
assert a.training
assert b.training
with pfrl.utils.evaluating(a):
assert not a.training
assert b.training
with pfrl.utils.evaluating(b):
assert not a.training
... |
e8a65621a3f61261c9a7879d9bedb34242776830ccb682ee20ac4d44b87517fe | Python | 449 | 19 | from Bio.PDB import PDBParser, PDBIO, Select
import Bio
import os
import sys
#import pybel
class NonHetSelect(Select):
def accept_residue(self, residue):
return 1 if Bio.PDB.Polypeptide.is_aa(residue, standard=True) else 0
def clean_pdb(input_file, output_file):
pdb = PDBParser().get_structure('prot... |
8596ba92bd1e5d31ea8cc50bd76469442a97d56124ae66af994f4b5117d71a89 | Python | 450 | 16 | import numpy as np
class MaximalFiringError(Exception): pass
class MinimalFiringError(Exception): pass
class PopulationRateMonitor(object):
def __init__(self, r_max=1000, r_min=0):
self.r_max = r_max
self.r_min = r_min
def run(self, t, r):
if np.mean(r) >= self.r_max:
rais... |
f4a496c53a2f8396d9905a52534f40068a1d260a8f69c866c13c8f254fc31b54 | Python | 450 | 16 | import ray
# Put the values (1, 2, 3) into Ray's object store.
a, b, c = ray.put(1), ray.put(2), ray.put(3)
@ray.remote
def print_via_capture():
"""This function prints the values of (a, b, c) to stdout."""
print(ray.get([a, b, c]))
# Passing object references via closure-capture. Inside the `print_via_cap... |
1ac78fe24dd091e2b3ee9b6ca94df72efdd52e26854f20812cfbf7494bfad040 | Python | 451 | 17 | import os
import pytest
import ray
TEST_NAMESPACE = "ray_dag_test_namespace"
@pytest.fixture(scope="session")
def shared_ray_instance():
# Remove ray address for test ray cluster in case we have
# lingering RAY_ADDRESS="http://127.0.0.1:8265" from previous local job
# submissions.
if "RAY_ADDRESS" ... |
cf5323f8a7863c00ad9c68a20a33453c7a1e8544bcc12286dc24da066502f4d4 | Python | 451 | 14 | from .models import Item, Sentence
from rest_framework import serializers
class ItemSerializer(serializers.ModelSerializer):
class Meta:
model = Item
fields = ['id', 'review_level', 'crawl_date', 'skip_validations', 'title']
# fields = '__all__'
class SentenceSerializer(serializers.ModelSerializer):
... |
eb598868029f3d6141282114f40d96ed6da8b8fb44952b83bf08f632606b7452 | Python | 451 | 13 | import pandas as pd
from pmlb import fetch_data, nearest_datasets
def test_nearest_dataset_is_itself():
"""Tests whether the nearest dataset is itself"""
for test_dataset in ['lupus', 'analcatdata_aids']:
df = fetch_data(test_dataset, local_cache_dir='../datasets/')
nearest = nearest_datasets... |
894730205cf4a52c026f03f6713bb3ad214221f552a5a9f1f4753e5d1561674f | Python | 454 | 11 | import linecache
import itertools
types = ['noN', 'N']
versions = [1,2,3,4,5]
dbs = ['GRCm39', 'Mmul_10', 'NHGRI_mPanTro3', 'TAIR10']
file_paths = [f'./5_output/spliceai_result_{version}/{db}/spliceai_all_seq.name.{type}.{db}.tsv' for db, version, type in itertools.product(dbs, versions, types)]
for file_path in file... |
f12e1f676add95c916500b01b5993258f53a343737911de3b850db0383b66eca | Python | 454 | 14 | from IPython.display import display
from ipywidgets import Output, widgets
from data_profiling.report.presentation.core.correlation_table import CorrelationTable
class WidgetCorrelationTable(CorrelationTable):
def render(self) -> widgets.VBox:
out = Output()
with out:
display(self.con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.