sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
20ad68a3cc23324c9fa02f8516254d447a4a3f172fe9650e6f751183c61ef27c
Python
1,256
33
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 from ray.data._internal.issue_detection.issue_detector_manager import ( IssueDetectorManager, ...
ecff52db5bb9287ad4c23e45d5a46a62e9c93f0230139dccfc1fbac6a704d91a
Python
1,256
28
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
87f53980fedcd23213f347d7cdf75b11bb024c9baa378be7ec43125c15ec3032
Python
1,257
47
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ """ import argparse import pysam def main(): parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('batch_vcf') parser.add_argument('cohort_vcf') parser.add...
f040dd6bc75f220e6b09c140ffde6c03c2ea90b0d355732d3401b9b18c8b51e0
Python
1,257
35
import jieba import torch import DataSet import re from Config import fix_length, label_list def x_tokenize(x): str = re.sub('[^\u4e00-\u9fa5]', "", x) return jieba.lcut(str) def getModel(name): model = torch.load('done_model/'+name+'_model.pkl') return model model = getModel('Transformer') device = ...
8ee0c2c06db820d882bce2c7ec1a05124def1d87581ddc95294ed1eba5f75a70
Python
1,258
40
# -*- coding: utf-8 -*- """ This is the implementation of the model corresponding to the pre-print `Iso-orientation bias of layer 2/3 connections: the unifying mechanism of spontaneous, visually and optogenetically driven V1 dynamics` Rózsa, T., Cagnol, R., Antolík, J. (2024). https://www.biorxiv.org/ TODO: Update """ ...
bffc9d58e5197abea8fedf621798c055029e65e67708d8adad51ad9c0f3fb320
Python
1,258
40
# -*- coding: utf-8 -*- """ This is the implementation of the model corresponding to the pre-print `Iso-orientation bias of layer 2/3 connections: the unifying mechanism of spontaneous, visually and optogenetically driven V1 dynamics` Rózsa, T., Cagnol, R., Antolík, J. (2024). https://www.biorxiv.org/ TODO: Update """ ...
27298f18d4dd2640bbd6da053eec325e9582157bc051a8f642276f61b26b7693
Python
1,259
39
# --8<-- [start:long] import pandas as pd from rich import print from siapy.entities import Pixels, Signatures from siapy.entities.signatures import Signals # Option 1: Step-by-step initialization # Initialize Pixels object from a DataFrame pixels_df = pd.DataFrame({"x": [10, 30], "y": [20, 40]}) pixels = Pixels(pixe...
3927308a9d00350aa957e8a6e5348e24ce2241e0f118bf39883d724a778cb07a
Python
1,259
40
# -*- coding: utf-8 -*- """ This is the implementation of the model corresponding to the pre-print `Iso-orientation bias of layer 2/3 connections: the unifying mechanism of spontaneous, visually and optogenetically driven V1 dynamics` Rózsa, T., Cagnol, R., Antolík, J. (2024). https://www.biorxiv.org/ TODO: Update """ ...
39ddfefbf07015d851c9674f9a789502094e128f5c0185021ad207475936965d
Python
1,259
31
""" 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. Constants for Triton kernel operations. """ from __future__ import annotations # Block size for channel vectorization in Triton kernels. # Mu...
3ace735ab1399d3f7f4e6e8ae1f9ec3f749891862917e37d1cdded873be2e401
Python
1,259
40
class MovingAverage: window_size = None current_value = None observations = None observation_count = None use_window = None def __init__(self, window_size=None, use_window=True): self.window_size = window_size self.current_value = 0 self.observation_count = 0 s...
eac411b3f7dcc0ece38fb23f410d40563ba1115eaba56f05f5af7641220062e2
Python
1,259
50
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ Wrap bgzip output """ import sys import subprocess class BgzipFile: def __init__(self, filename, bgzip=True): self.filename = filename self.bgzip = bgzip def __enter__(self): # Open output file if self.is_stdout: ...
ae62c73accc348653a6493ea4a8b159765c013784abbddf101979fc3d6d25b70
Python
1,260
54
import numpy as np def plot_morphology_xy(morphology, ax): nodes = morphology.nodes() x = [node['x'] for node in nodes] y = [node['y'] for node in nodes] ax.scatter(x, y, s=0.1, color="k") ax.set_aspect('equal') def plot_morphology_zy(morphology, ax): nodes = morphology.nodes() y = [n...
e2f580de6cc3376940460a3ecd59ef6beb347b69392be39b4524daa9b4431b85
Python
1,260
41
import sys import pytest from ray._common.tls_utils import generate_self_signed_tls_certs def test_generate_self_signed_tls_certs_returns_tuple(): cert_contents, key_contents = generate_self_signed_tls_certs() assert isinstance(cert_contents, str) assert isinstance(key_contents, str) def test_generate...
501d765545560c6f84cbaab5dc356758b406695cb2729fbb910c5d0b6eef6a9e
Python
1,261
40
#!/usr/bin/env python # This is an executable script that runs an example of every single CliLogger # function for demonstration purposes. Primarily useful for tuning color and # other formatting. from ray.autoscaler._private.cli_logger import cf, cli_logger cli_logger.configure(log_style="auto", verbosity=999) cli...
898a8340d083f56e8c456a73255cc3b80ebd4b99ea804ea968f81947ed518ab3
Python
1,261
42
from typing import Any, Callable, Optional from ray.air.execution._internal.tracked_actor import TrackedActor class TrackedActorTask: """Actor task tracked by a Ray event manager. This container class is used to define callbacks to be invoked when the task resolves, errors, or times out. Note: ...
f7613eec72749d5b79587b222ed6338c0f80b8a7c8639fb0c12346a842c42d1d
Python
1,261
53
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ Drop records with zero non-reference alleles in AF-annotated VCF """ import argparse import sys import pysam from svtk.utils import is_biallelic NULL_GTs = [(0, 0), (None, None), (0, ), (None, ), (None, 2)] def prune_allrefs(vcf, fout): for record in vcf.fet...
086a7bb6d3fd80a9c698aae448699fb8aab5ef6797562b8ca9e5a051e9e85e12
Python
1,262
40
import matplotlib.pyplot as plt import quantax as qtx from quantax.symmetry import TotalSz, SpinInverse, C4v lattice = qtx.sites.Square(10) N = lattice.nsites H = qtx.operator.Heisenberg(J=[1, 0.5], n_neighbor=[1, 2], msr=True) net = qtx.nn.ResSum(16, 16, 3, use_sinh=True) state = qtx.state.Variational( net, ...
3d5b831bc12c81ed9b21893ecc0bd4508764026660de0a3d41da8326297af5d9
Python
1,262
21
#!/usr/local/bin/ipython -i from mozaik.experiments import * from mozaik.sheets.population_selector import RCRandomPercentage from parameters import ParameterSet def create_experiments(model): return [ #Lets kick the network up into activation Poiss...
5b44716a619411b360a511b347608e26ce64ada032e86986a7bfa411b36876f1
Python
1,262
36
import os import pandas as pd import numpy as np import tensorflow as tf from utils import oneHot from tensorflow.keras.layers import * if __name__ == '__main__': num_shuffles = 10 predictions_ala = [] predictions_no_ala = [] WTaa = 'SINSVHT' aaList = 'ACDEFGHIKLMNPQRSTVWY' seq = input(f"Plea...
f1b8fa7ec75046c23b92350b7442dab65b6f30c8ec057a35d977a97f4eb4b7c0
Python
1,262
39
""" 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 typing import TYPE_CHECKING, Any if TYPE_CHECKING: from fairchem.core.components.reducer impo...
f4df5121eae3d237bb44672efe107c4fdca5893eca2aa504e61a539dcd44cf03
Python
1,262
43
import struct import numpy import warnings from tqdm.autonotebook import tqdm def packIntAsLong(value): """Packs a python 4 byte integer to an arduino long Parameters ---------- value : int A 4 byte integer Returns ------- packed : bytes A 4 byte long """ return str...
4df7027b889d79af2830b957bbe316534a5324a54679bf031b82eaefa8bc4feb
Python
1,263
52
import os import pytest from ._docs_examples import ( PROJECT_ROOT, InstallSandboxCache, build_python_namespace, execute_bash_sample, execute_python_sample, iter_doc_sources, runnable_samples, seed_docs_sandbox, ) DOC_SOURCES = tuple( path for path in iter_doc_sources() if runnabl...
814b3d3c3bfead6f48288022208c763a3e2df7d15272896dddac7943c1f29d46
Python
1,263
32
import argparse import os # Implementation note: # This code implements the same python code in the GetSampleBatchPEMap task without alterations. def main(batch_sample_lists, batch_name_list, batch_pe_files, prefix): _batch_pe_files = [] with open(batch_pe_files, 'r') as pe: for line in pe: ...
27ce0c376b5ba293d383fe8d8651264658445100ae23e97f8a7d5afba2a5c525
Python
1,264
49
# %% import numpy as np import pickle import pandas as pd # from numba import njit # sessions = ["G", "H", "F"] sessions = ["H"] # round 2 path = "fit_result5/result_0001.pkl" with open(path, "rb") as f: solutions = pickle.load(f) params = solutions["H"][0][0].keys() # %% load all solution and make dataframe ...
813128186b41188289432f48eedb9c328cf99728fe7a046e6dc6126815692b7b
Python
1,265
35
import torch.nn as nn from argparse import Namespace, ArgumentParser from .base import BaseModelConfig from optuna import Trial from monai.networks.nets import DynUNet class DynUNetConfig(BaseModelConfig): model_name = "dynunet" def setup_search_space(self, trial: Trial, args: Namespace) -> Namespace: ...
929333ae7f2a66a344726fe7e9dd58c37e7b9aa68d1a09742de0647b03ebecbf
Python
1,265
25
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
65f923d282d9bbc4c0a728211e60a088b6c99b28abeb9b43e3bf899837d23b94
Python
1,266
41
from typing import Tuple import pandas as pd from data_profiling.config import Settings from data_profiling.model.summary_algorithms import describe_supported, series_hashable @describe_supported.register @series_hashable def pandas_describe_supported( config: Settings, series: pd.Series, series_description: di...
878c8c99bff81a0b4ef32f1fa9277429410aec9017580ee0b9c3ccec9f39717a
Python
1,268
40
from enum import Enum, auto from dataclasses import dataclass, field import torch from e3nn.o3 import ReducedTensorProducts @dataclass class ModelParameters: atom_types: list irreps_in: str = field(init=False) # irreps_in is generated later... irreps_out: str = field(default="1x0e+1x1e+1x2e", init=Fals...
d64facbd796462aac9c349b0d72708731a86982e1c26a2858700849ad3b6ac07
Python
1,269
33
"""rapppid_org URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/4.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-b...
4040bb81bf53efb6e3e5a32aaab2ae786bc3c5d3eb49aa61fcf6451abbb89f7a
Python
1,270
52
""" test voltage reset to v_reset for LIF neuron """ import os import matplotlib.pyplot as plt import numpy as np from spinnaker2 import hardware, snn def test_lif_neuron_reset_to_zero(do_plot=False): params = { "threshold": 1.0, "alpha_decay": 1.0, "i_offset": 0.12, "v_reset": 0....
cbc366676758cda78c52ce59cb8cf94d2212f70dc1eefa9d1c2828daf7664628
Python
1,270
29
import platform import socket import logging from typing import Dict # Defaults home_base_dir = "/home/smadan" project_dir = "/git/mirna-disease-association-detector-submission" LOCAL_MLFLOW_TRACKING_URI = "http://localhost:5000" MLFLOW_TRACKING_URI = LOCAL_MLFLOW_TRACKING_URI LOGGING_LEVEL = logging.INFO EXTERNAL_LOG...
bde3a26a047468eb067e2e15ec48cb7f554536f2289ecdf0c5c2ca38d73224bc
Python
1,271
44
""" Utility functions for tedana decomposition """ import logging import numpy as np from scipy import stats LGR = logging.getLogger("GENERAL") RepLGR = logging.getLogger("REPORT") def eimask(dd, ees=None): """ Returns mask for data between [0.001, 5] * 98th percentile of dd Parameters ---------- ...
5297b9d8fb8f271bae2e8bfb812e66231e08e76dd5363629377e6d3334656e50
Python
1,272
45
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. #...
6562ce6c34617a9c435a4868faadd108700c3eb9e55d288eaa4963f5db83e37d
Python
1,272
31
from .surface_report import write_surface_report from .threemica_report import (available_threemica_surface_maps, write_brainspace_threemica_report, write_threemica_report) __all__ = ['build_plotter', 'plot_surf', 'make_contour_actor'...
f5a49f02dcb07c11988def81d0ae3748ff13597cfdc842cef8570bdc64ba5628
Python
1,272
30
from mozaik.tools.distribution_parametrization import ParameterWithUnitsAndPeriod, MozaikExtendedParameterSet from mozaik.sheets.direct_stimulator import Depolarization from collections import OrderedDict def add_per_stimulus_current_injection(exp,stimulation_configuration,stimulation_sheet,stimulation_current): ...
f2ba869b99a6c141e05bfb1a9fbbceae0bf191a9e2219b4b6ace6b5e1661bd94
Python
1,273
32
import pandas as pd from matplotlib import pyplot as plt import json import numpy as np from mpl_toolkits.mplot3d import Axes3D, proj3d def rewardtoDocking(r: float)->float: return 10*r/(r-1) dataDir = "6lu7/log336h_6lu7/data10/" df = pd.read_csv(dataDir+'/present/scores.csv') arr = df.values # points ...
90b77839b4906d16cc4da0dc233fd50ebc4ccdae4fd06c48f333bf9e183b0919
Python
1,274
39
import h5py import numpy as np import argparse import sys, os sys.path.insert(0, os.getcwd()) from warnings import warn import json import pandas as pd def main(): parser = argparse.ArgumentParser(description='Create HDF5 files.') parser.add_argument('-f', type=str, help='path to dataset config file') arg...
c97e105db61909a20261dc22984b2206dad0c8f3e0f01360e95c5e29edb42908
Python
1,275
27
import os import nibabel as nib import matplotlib.pyplot as plt root = '/path/to/results/phantom' pars = ['D','f','vd'] plot_range = {'D':[0.5,1.2],'f':[0,5],'vd':[1.5,2.0]} scale = {'D':1e3,'f':100,'vd':1} plot_methods = {'gt':'Ground truth','nlls':'NLLS','seg':'Segmented fitting','bayesu':'Bayesian: Uniform','bayess...
a684ededdb3918b8354142351d7e17a602bdd0532b4e3a0479340642f0b1b99d
Python
1,276
53
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ """ import argparse import pandas as pd def explode(df, idx_cols, list_col): """ Explode a column of lists into one row per list element """ df = df.set_index(idx_cols) df[list_col] = df[list_col].str.split(',') df = df[list_col].apply(pd...
af1aa3718e6d5d4af8d809490453dc78aeaaa328be68a21a1624567043b710e6
Python
1,276
40
from data_profiling.config import Settings from data_profiling.report.formatters import fmt, fmt_bytesize, fmt_percent from data_profiling.report.presentation.core import HTML, Container, Table, VariableInfo def render_generic(config: Settings, summary: dict) -> dict: info = VariableInfo( anchor_id=summar...
e225fb3d764b7d9b4d2280b261d512f7e7c629a4033a5b33cc57dfed9979607d
Python
1,276
52
# -*- coding: utf-8 -*- # (C) Copyright 2026 IBM. All Rights Reserved. # # Licensed under the MIT license. See LICENSE file in the project root for details. # pylint: disable=invalid-name """Krylov with analog preconditioner""" import numpy as np import matplotlib.pyplot as plt from torch import device as torch_dev...
023582ad3ffc657cc64f36b45620c0a7775f640fccd57c511a86fda5e02b8a5a
Python
1,277
47
from __future__ import annotations import logging from pokeformer.preproc.fpocket import run_fpocket from pokeformer.utils.pdb_utils import get_pdb_path logger = logging.getLogger(__name__) def _detect_pocket_impl( pdb_path, params, save_result_path=None, remove_alt_h=False, ): if params.backen...
102759543f56486bf6560b8c4fdc7f9281daeb2dafd6b68a0f5b1240d25aa19b
Python
1,278
37
from setuptools import setup, find_packages with open("README.md", 'r') as fh: long_description = fh.read() ''' https://packaging.python.org/guides/distributing-packages-using-setuptools/ ''' ''' https://setuptools.readthedocs.io/en/latest/ ''' setup( name='nas-bench-graph', version='1.0', author='THU...
b0322b089f6365dbe6d79f20fffb541d51795ac623d7000af9a3614c8f315973
Python
1,278
55
# %% import numpy as np import pickle import pandas as pd # from numba import njit sessions = ["G"] path = "fit_result6/result_0001.pkl" with open(path, "rb") as f: solutions = pickle.load(f) params = solutions["G"][0][0].keys() len(solutions["G"][0][0]) # %% load all solution and make dataframe # fractions...
db9a08dc9657e747ca8b08fa7aa66381dc044fb7a3bbbb852108382e2b0a5bd1
Python
1,278
38
"""Pytest configuration for the doctests in the ``stl`` package. The examples in the docstrings read files such as ``tests/stl_binary/HalfDonut.stl`` and write files such as ``example.stl`` with relative paths, the way a user would from their own project directory. Run from the checkout they would leave the written fi...
173c61d7fee01287c160f7da1fbe428a748ae56c9d5d4f2b9f85b8e58f2f69d2
Python
1,279
48
import importlib # Dynamically import all modules inside the Spark folder SPARK_MODULES = [ "correlations_spark", "dataframe_spark", "describe_boolean_spark", "describe_categorical_spark", "describe_counts_spark", "describe_date_spark", "describe_generic_spark", "describe_numeric_spark"...
554e02aec6cd00986350d06479a49f5df496fc815cab77b680a94ad88944d359
Python
1,279
29
import os import matplotlib.pyplot as plt import nibabel as nib import numpy as np root = '/tmp' sub = 'phantom' fig,axess = plt.subplots(2,3,figsize=(3*5,2*5)) for a, axes in enumerate(axess): for ax,parname, unit, scale, plotmax in zip(axes,['D','f','vd'],['µm2/ms','%','mm/s'],[1e3,1e2,1],[3e-3,0.6,5]): ...
060197e3efc0528bd1a6437f5a25ea164bb6a2073b57e9c71009c9987b7227ae
Python
1,280
38
# Copyright 2023 Google LLC # 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
16154df62b38526fa18ea9c044628ebb2e6ba8e05857186abde1ec65accb7ab3
Python
1,280
36
from typing import Any, Callable, Dict, Optional import pyarrow from ray.data.block import BlockAccessor from ray.data.datasource.file_based_datasource import _resolve_kwargs from ray.data.datasource.file_datasink import BlockBasedFileDatasink class JSONDatasink(BlockBasedFileDatasink): def __init__( se...
58677c4727e333e680f362b86fb4783100595f11070073764eccea9998a2bb7a
Python
1,280
58
""" This script creates the negative of the input image. Usage: python inverse_images_hc-leipzig-7t-mp2rage.py -i <input_image> -o <output_image> Author: Katerina Krejci """ import os import argparse import numpy as np from argparse import RawTextHelpFormatter from spinalcordtoolbox.image import Image, zeros_l...
dad2d12274d24dea32c65f4fa9955ed742157e28655a89a27ad63579c40ffd62
Python
1,280
31
import sys import os sys.path.insert(0, "/srv/home/zgaleday/torch_pgn") import os.path as osp from scripts.generate_final_correlations import generate_final_correlations base_dir = '/srv/home/zgaleday/models/torch_pgn/figure_2' model_dirs = ['pdbbind_general_rand_fp_hyper/', 'refined_final_pgn/', ...
e868dc196975f39474edeb96049d7a9d6913226b47ef7833f235a3c08b6cf96f
Python
1,280
37
from pathlib import Path import pandas as pd from data_profiling import ProfileReport from data_profiling.utils.cache import cache_zipped_file """ The "Auto" correlation is an interpretable pairwise column metric of the following mapping: - Variable_type-Variable_type : Method, **Range** - Categorical-Categorical ...
46dcea6d2e921a1950f3eda9061c176495505b6bd2bb3bace6a5ea692e83cc42
Python
1,281
37
# Copyright 2022 Google LLC # 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
9320d2dae5dc798eecd58df600b8efe2816f184ab5d268a8eba7d817f97939e5
Python
1,281
38
import torch import soft_rank_pytorch from metrics import _rank_data def spearman_loss(pred, true, regularization_strength, regularization): assert pred.device == true.device assert pred.shape == true.shape assert pred.shape[0] == 1 assert pred.ndim == 2 device = pred.device soft...
9c86e32e94ba72adff2601fd54b930b1470a801b66b22f9bf293e35fe7ad9480
Python
1,281
52
import sys import numpy as np import matplotlib.pyplot as plt from utils import load_pickle, save_image, read_lines, load_image # from visual import cmap_turbo_truncated def plot_super( x, outfile, underground=None, truncate=None): x = x.copy() mask = np.isfinite(x) if truncate is not None: ...
fb1d26dd8c9c440b67736c45d6951f0d238b5be0e03c73be9ba73ec4be91564a
Python
1,281
46
'''verify that my boundaries match tan's computation''' import os import pickle import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from utils import ID2CHAPTER, split_video_id, padded_corr from utils import EventLabel, TrainValidSplit, DataLoader, HumanBondaries sns.set(style...
0af2a7739e3debbc1a6c4de14439dbd4b282c4831c3d8559c4d565d20b75c136
Python
1,284
32
from src import main from src.models import multi_stage from src.models.Hang2020 import spectral_network from src.data import read_config from sklearn.manifold import TSNE import matplotlib.pyplot as plt from matplotlib import cm import numpy as np config = read_config("config.yml") config["crop_dir"] = "/Users/benwei...
a82209161fc7381fcce78fd35e7ed6586f24ef9804cb39b64f373e32bb538ffa
Python
1,284
28
#################################################################################################### # Copyright (c) 2016 - 2024, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis> # # This program is fre...
948c2a6f6d74409113c4ca997a78e7714f8d21524380d969bc109eb2ab004033
Python
1,285
56
import os def results_file(directory, site, batch, modelname, filename): """ Define the output results file """ batch = str(batch) if os.path.isdir(directory): pass else: os.mkdir(directory) batchdir = os.path.join(directory, batch) if os.path.isdir(batchdir): ...
e0f7008b08a810041a65432c32f6ec1de881fac29c599559a332175dbc87ab0c
Python
1,285
39
# THIS FILE HAS BEEN AUTOGENERATED. To update: # 1. modify the `_deps` dict in setup.py # 2. run `make deps_table_update`` deps = { "Pillow": "Pillow", "accelerate": "accelerate>=0.11.0", "compel": "compel==0.1.8", "black": "black~=23.1", "datasets": "datasets", "filelock": "filelock", "flax...
95d0a9272b4f8a450e01a40c1adaa78436fc6e22134805422d2fe86ed7df3f06
Python
1,287
39
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master...
ed471f2da25fceeab2ac8055228a772aec8c555d71b8604d492e6489dd5f962d
Python
1,287
43
import os import gzip import requests import numpy as np def load_data(kind='train'): base_url = 'http://yann.lecun.com/exdb/mnist/' labels_filename = '%s-labels-idx1-ubyte.gz' % kind images_filename = '%s-images-idx3-ubyte.gz' % kind # Download labels file labels_url = base_url + labels_filename...
9bf61c2569417a05e43310a90d078a95ffca9ff041246cfee043c442670b0f3f
Python
1,289
40
# built-in dependencies from typing import Any, List, Union, cast # 3rd party dependencies from numpy.typing import NDArray # project dependencies from deepface.commons.onnx_utils import run_session from deepface.models.FacialRecognition import FacialRecognition from deepface.commons.logger import Logger logger = Lo...
b3fef66f453a70d099b430fa2959f0fc9d3415325e67784f96c3c4c5c70123cd
Python
1,289
69
#from utility import * # check utility.py for functions documentation #from component import * #A = np.arange(10) #print('input list = ',A) import ex import sys import numpy as np class Component(object): def initialize(self): ex.log("From python: initialize ") ex.log(sys.path[0]) ...
cabaffb79deb7446a2ba0da3f405c18ab9dddacf43949070c9e3df6f865e698e
Python
1,289
43
from __future__ import annotations import torch.nn as nn from fairchem.core.models.escaip.utils.nn_utils import Activation, get_linear def get_feedforward( hidden_dim: int, activation: Activation | None, hidden_layer_multiplier: int, bias: bool = False, dropout: float = 0.0, input_dim: int |...
22fa713117e3d61e1a8846cd8569010ad54e60fd3aba2e55fd27970634a159a3
Python
1,291
47
#! /usr/bin/env python import argparse import os import subprocess import sys from glob import glob import shutil import re parser = argparse.ArgumentParser() parser.add_argument("filename") parser.add_argument("--results_folder", "-r", default="./") parser.add_argument("--nreads", "-n", default=20000000) args = pars...
b79617cc8b39c9d29afceef592be9877f9cdabd54c1552d838fdd678bdef7cd9
Python
1,291
46
import cv2 # noqa: F401 — preload libtiff before HIPT/torchvision shadows it (omicverse vendored patch) import argparse from utils import load_tsv, write_lines, read_lines def get_args(): parser = argparse.ArgumentParser() parser.add_argument('inpfile', type=str, help='e.g. demo/cnts.tsv') parser.add_arg...
3a4f58879ba0cd687061572482340d8cd6995a8414aeee96cbb6d89f6d4f03a5
Python
1,292
32
# Copyright 2023 The HuggingFace Inc. team. 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 appl...
822144f29080897ee63eeaf7efa085123e47c8676fa7ee1e0cb3c21184df5f98
Python
1,292
34
import sys import os sys.path.insert(0, "/srv/home/zgaleday/torch_pgn") from torch_pgn.train.run_training import run_training from torch_pgn.train.hyperopt import hyperopt from torch_pgn.args import TrainArgs, HyperoptArgs args = HyperoptArgs() args.from_dict({'raw_data_path': '/srv/home/zgaleday/IG_data/pdbbind_refi...
d648ae5f1b48be335c342b85ceb8279d402ab2c66f194f41addba5273b092bf8
Python
1,292
48
""" This file serves as a documentation example for disaggregated tokenization. """ import ray from ray.data.llm import vLLMEngineProcessorConfig, build_processor # __disaggregated_tokenization_start__ config = vLLMEngineProcessorConfig( model_source="unsloth/Llama-3.1-8B-Instruct", engine_kwargs={"max_model...
f76e6d60cad689e7e3695b529634f8c8c45771d5255daf4b5eb4d5a6278a88f1
Python
1,292
48
{ 'dataset_loader_train': { '__factory__': 'model.DatasetLoader', 'path': 'aclImdb/train/', }, 'dataset_loader_test': { '__factory__': 'model.DatasetLoader', 'path': 'aclImdb/test/', }, 'model': { '__factory__': 'model.create_pipeline', 'use_cuda': T...
3bcdde605beb4dbced776d703e17cffcf821369841d985b96c318f30705256f4
Python
1,293
38
"""NumPy batches use the same analysis path at every batch size.""" import numpy as np import pytest from deepface.modules import demography, modeling class FixedAgeModel: def predict(self, img): assert img.shape == (1, 224, 224, 3) return 32 @pytest.mark.parametrize("batch_size", [0, 1, 2]) d...
3c3869f297672582737c207df8207487fabf9bbbb57b1bd70e4afc44ea471571
Python
1,293
38
from typing import Optional import torch from rising.ops import torch_one_hot __all__ = ["one_hot_batch"] def one_hot_batch( target: torch.Tensor, num_classes: Optional[int] = None, dtype: Optional[torch.dtype] = None ) -> torch.Tensor: """ Compute one hot for input tensor (assumed to a be batch and th...
972d05e3efc39d83e87d6d331ab02f63894d15a4214992fed4862e871348e3c4
Python
1,295
32
""" Tests for :func:`mozaik.meta_workflow.experanto_export.resolve_datastore`, which finds the datastore a given ``(trial, chunk)`` was simulated into by globbing a stable name prefix inside the results directory. What is easy to get wrong there -- and did go wrong -- is that the results directory is a literal path be...
012a199626a82420af80369f99ed4dc28f03545667e3f0851d4aa0c2d82dce56
Python
1,296
38
from typing import Any, Optional, Tuple from ray.util.annotations import DeveloperAPI @DeveloperAPI class NodeLaunchException(Exception): """A structured exception that can be thrown by a node provider during a `create_node` call to pass additional information for observability. """ def __init__( ...
7858ba03f1a49b3ba5a7ba14354dd737fcafbbd04f02ae8a3aa94e8b4d07dd88
Python
1,296
47
import unittest from unittest.mock import Mock import optuna import pfrl class TestOptunaPrunerHook(unittest.TestCase): def test_dont_prune(self): trial = Mock() trial.should_prune.return_value = False optuna_pruner_hook = pfrl.experiments.OptunaPrunerHook(trial=trial) env = Moc...
8a772b760b8c714a2279e824c4c05b12090ede9545e0463870c05d683e0db4c3
Python
1,296
43
from abc import ABCMeta, abstractmethod from typing import List from mmengine.model import BaseModule from lqit.edit.structures import BatchPixelData from lqit.registry import MODELS from lqit.utils import ConfigType, OptConfigType, OptMultiConfig class BaseGenerator(BaseModule, metaclass=ABCMeta): """Base clas...
d0b5294ebbf4d4544ba52f4b76d5387ef6f31f82d72cd3fb69b8f9aa88df7615
Python
1,296
37
import numpy as np from pfrl import explorer class AdditiveGaussian(explorer.Explorer): """Additive Gaussian noise to actions. Each action must be numpy.ndarray. Args: scale (float or array_like of floats): Scale parameter. low (float, array_like of floats, or None): Lower bound of acti...
feeb5329f7c1ee82c3f09d152a1244136941b13b5dff064d892a17c9929f7456
Python
1,296
38
# Copyright 2026 Google LLC. # # 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 writing, ...
235da83dc22e535a32e8f97745f09803848e3b9b619186436a217c3698b87897
Python
1,298
43
from ipywidgets import Box, widgets from data_profiling.report.presentation.core import Collapse class WidgetCollapse(Collapse): def render(self) -> widgets.VBox: if self.content["button"].anchor_id == "toggle-correlation-description": collapse = "correlation" else: collap...
109e7f5e4870c7e2ff1d3e260b26c116dccc3404f1eecd0c04fcd21be7ae5085
Python
1,299
48
import os import subprocess import json from spinnaker2.helpers import global_word_address APPNAME = "../../../s2-sim2lab-app/host/experiment/app/experiment" PE = (1,1,0) memfile = "../../../s2-sim2lab-app/chip/app-pe/s2app/arm_sanity/binaries/s2app_arm.mem" exp_spec = { 'active_pes' : [PE], 'mem_fi...
6b951153f2dea47c28759a5f83c3cb00955b23ecf01b2e0a43eb617c8ca4117d
Python
1,299
39
# built-in dependencies from typing import Optional, Dict, Any # project dependencies from deepface.commons.logger import Logger logger = Logger() # pylint: disable=too-few-public-methods class AuthService: def __init__(self, auth_token: Optional[str] = None) -> None: self.auth_token = auth_token ...
d028fda8267becfe96abff6b25a90d4e59c81721fb2a769df368bd10875e6a70
Python
1,299
43
from typing import Optional import numpy as np import torch def torch_one_hot(target: torch.Tensor, num_classes: Optional[int] = None) -> torch.Tensor: """ Compute one hot encoding of input tensor Args: target: tensor to be converted num_classes: number of classes. If :attr:`num_classes`...
201b25f4c35d9f0ba445348e63158b021967e908879e6aef55ea2266f758a299
Python
1,300
40
# Copyright (c) DP Technology. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from unicore.data import BaseWrapperDataset def collate_tokens_coords( values, pad_idx, left_pad=False, pad_to_length=None, pad_to_multiple=1,...
ee2c93d759d009a8766e81d2f0c7d541fc217bd39f20c4a102c023041a5ec4ab
Python
1,300
31
# This class works import numpy as np import pandas as pd import numpyro.distributions as dist import numpyro import jax.numpy as jnp class tobit_dist(numpyro.distributions.Distribution): arg_constraints = {} def __init__(self, mean, sigma): #import pdb; pdb.set_trace() self.loc = mean ...
20b1edf3480ec4ce2a673cbe918150ef0933e834af9e99fa013b5710b97bd54d
Python
1,301
49
import numpy as np def generate_bigclam(F, B=None, D=None, p_no_comm=0, seed=None): """Produce the graph according to the BigCLAM model. Parameters ---------- F : np.ndarray, shape [N, K] Nonnegative community affiliation matrix. B : np.ndarray, shape [K, K] Compatiblity matrix. ...
3389d537b72c773711940814f36be63060fa885d747d4a0e3d7c7720b35316c9
Python
1,301
37
from pathlib import Path from openmm import unit from openmm.app import CharmmCrdFile, CharmmParameterSet, CharmmPsfFile, PDBFile from .base import EndstateCorrectionBase from ..system import read_box class EndstateCorrectionCHARMM(EndstateCorrectionBase): def _get_mm_topology(self) -> CharmmPsfFile: ps...
a4614dc35502f2a8e5d1a8cd8f2bc527e22bc0e12812199e04f63929f7c827a1
Python
1,301
41
"""aihwkit example 19: Analog summary on LeNet. Extracts analog information in the form of a printed table. The information can also be accessed via the returned AnalogInfo object. """ # pylint: disable=invalid-name # Imports from PyTorch. from torch import nn # Imports from aihwkit. from aihwkit.nn.conversion impo...
ebef4e1a6455569e5f98646b365702633ac0fcf31cdda7e1b1e45b5c026c69f4
Python
1,301
21
"""OFFLINE converter: run only in the trusted historical sklearn environment.""" import hashlib,sys from pathlib import Path import joblib,numpy as np p=Path(sys.argv[1]) expected='792cce50db528a20c9769842a0efac26aa9a77e5e04ba76819ee500a78d29566' if hashlib.sha256(p.read_bytes()).hexdigest() != expected: raise Valu...
9cfa737538e41c1636d233f26c8f21916fd2ca8f7bac7f1bb7ff4a50ab67754c
Python
1,302
50
import os import pickle import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from utils import padded_corr from utils import EventLabel, TrainValidSplit, HumanBondaries sns.set(style='white', palette='colorblind', context='talk') tvs = TrainValidSplit() evlab = EventLabel() hb ...
45988d1efab348c6442ffd8e477218deaa4d2e681c37d2e21bf1482d6ebba1e8
Python
1,303
49
import pytest import torch.nn as nn from sinabs.backend.dynapcnn import DynapcnnNetwork from sinabs.backend.dynapcnn.mapping import edmonds, make_flow_graph, recover_mapping from sinabs.from_torch import from_model ann = nn.Sequential( nn.Conv2d(1, 20, 5, 1, bias=False), nn.ReLU(), nn.AvgPool2d(2, 2), ...
aab8ccb04a5f76ec71297ec77fcff93f4affb038e4ec01fe059de6523af0dc18
Python
1,303
44
#!/usr/bin/env python # coding: utf-8 import torch import torch.nn as nn def init_weights(m, mean=0, std=0.1, bias=0): if isinstance(m, nn.Linear): nn.init.normal_(m.weight, mean, std) nn.init.constant_(m.bias, bias) if isinstance(m, nn.LSTM): for name, param in m.named_parameters(): ...
cd3f2801e60701f612a8e111cc5fa8dde11512137018ed688df78487153c5a84
Python
1,303
59
from math import pow from math import floor from os import makedirs from os import get_terminal_size from os.path import join from os.path import exists from os.path import normpath from os import sep def conditional_makedir(path): try: import pathlib p = pathlib.Path(path) p.parent.mkdir...
1f780d12196f182efec622cac48b0ad3f9fde0a3fb5ed68bb492b64b846918b2
Python
1,306
53
""" 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 import os import numpy as np import pytest from ase.io import read from fairchem.core.datasets import...
2ff0e2ddaa060d8535c38707e2f0c914ed8d59bf230a96f19ddecb56217cd82a
Python
1,306
69
#from utility import * # check utility.py for functions documentation #from component import * #A = np.arange(10) #print('input list = ',A) import ex import sys import numpy as np class Component(object): def initialize(self): ex.log("From python: initialize ") pass def sta...
68d97df82d16f7b147b269c390250d751498e59e31a410b1af7327901ba8d5d2
Python
1,306
40
# Modified from https://github.com/dbolya/tide # This work is licensed under MIT license. # Defines qualifiers like "Extra small box" def _area(x): return x['bbox'][2] * x['bbox'][3] def _ar(x): return x['bbox'][2] / x['bbox'][3] class Qualifier: """Creates a qualifier with the given name. test_fun...
c475d699e6068016809da52c7c94cd4301a690743cdc41eea677d95eb6d8238f
Python
1,306
57
#!/usr/bin/env python # -*- coding: utf-8 -*- # """ """ import argparse import pysam import pandas as pd def main(): parser = argparse.ArgumentParser( description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('vcf') parser.add_argument('scores') ...
c76b2e9ff807e5cc2a5b55e0e83bde4dd6df3b7fac9553555d3f2fe4b7bfad94
Python
1,307
39
# Copyright 2022 Google LLC # 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 # https://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, sof...
9b5e2cf4c767ffcb8b7adbf9a9f47cf3f05b97b6696efb369342cf0f27dbbb66
Python
1,308
49
#!/usr/bin/env python3 import os from pathlib import Path from snakebids import bidsapp, plugins try: # Works when run as a package from hippunfold.plugins import ( atlas as atlas_plugin, download as download_plugin, ) from hippunfold.workflow.lib import utils except ImportError: # Works...
b17bf984e9586fe437d39ae36e4a1ad0b1a8f08bdea7517557c46b8f2583b330
Python
1,308
40
import nltk import re # def tokenize_sentences(document): # document = document.replace(r"\n", r" ") # document = document.replace(r"\t", r" ") # document = re.sub(r"\s\s+", r" ", document) # document = re.sub(r"\.” ([A-Z])", r".”. \1", document) # sentences = nltk.sent_tokenize(document) # cl...