sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
1afbe3c5514b3aae089a7eb2a74c8080f03190abcd58678405aca68b43182713 | Python | 7,941 | 198 | """Tier-(b) DTensor param identity + refusal parity.
Two pins. (1) DTensor dual-geometry extraction: every surface that talks
about sharded state declares logical AND local geometry explicitly, so a
refused TP/FSDP2 model is refused with its parameters precisely identified
(the tier-(a) report said only "zero paramete... |
e697f8acacd445ecf3991f1c1c3dc5cb26a28b3abf2d89e1ba33e68cacc3582a | Python | 7,942 | 247 | import dgl
import torch
from dgl import function as fn
from torch import nn
from .decoder import DotDecoder, GMFDecoder, ZINBDecoder
class LightGraphConv(nn.Module):
def __init__(self, drop_out=0.1, gene2gene=False):
"""Light Graph Convolution
Paramters
---------
drop_out : float
... |
fb80c4f6440db0d3a23793cbb47154f6e4c04e517551f1c18ac4388603506f55 | Python | 7,942 | 246 | """Worker-level Bootsteps."""
import atexit
import warnings
from kombu.asynchronous import Hub as _Hub
from kombu.asynchronous import get_event_loop, set_event_loop
from kombu.asynchronous.semaphore import DummyLock, LaxBoundedSemaphore
from kombu.asynchronous.timer import Timer as _Timer
from celery import bootsteps... |
87ec466761c631f1679b3b7e56e0d75cf95fc1bb60d1eb54942c27ae0e62d36a | Python | 7,945 | 217 | import codecs
import hashlib
import pathlib
import importlib.resources
import afmformats
import h5py
from PyQt6 import uic, QtWidgets
class ConvertDialog(QtWidgets.QDialog):
_instance_counter = 0
def __init__(self, parent, *args, **kwargs):
"""Data conversion dialog"""
super(ConvertDialog, s... |
8ddc3519e7e112a666f7f560d881d43342f307718220f484a54dd4e2b4cdaabb | Python | 7,945 | 223 | import numpy as np
import pandas as pd
import utils.NMR_Pretrain_Setup as nmr
from neural_nets.NMR_4ll_Net import NMR_MPNN
from torch.utils.data import DataLoader
import os
import argparse
import torch
from torch.utils.tensorboard import SummaryWriter
import logging
# C : 273,322 0 : 52,511 N : 24,629 S : 4,886 ... |
daf6887a2221b7b9452cebc041a641f81abbc857c7eaa0b772ec4f3b483f3d47 | Python | 7,947 | 221 | import os
import argparse
import time
import PIL.Image as pil
import numpy as np
import mxnet as mx
from mxnet.gluon.data.vision import transforms
import gluoncv
from gluoncv.model_zoo.monodepthv2.layers import disp_to_depth
import matplotlib as mpl
import matplotlib.cm as cm
import cv2
# using cpu
ctx = mx.cpu(0)... |
b1a7423ed951cda16b2fed9bf79ee8d50fb7b1babc9ffe49f5a0c39e32d482ee | Python | 7,948 | 223 | import random
import numpy as np
from math import sqrt
import mxnet as mx
import mxnet.ndarray as nd
from modules import *
# pylint: disable-all
class Generator(nn.HybridBlock):
def __init__(self, fused=True):
super().__init__()
self.progression = nn.HybridSequential()
with self.progress... |
b5222598cc8e53c339104d91db52aca85f5cc921b5038ef7072d30e6a353db5f | Python | 7,950 | 159 | import sys
import os
# setting path
sys.path.append('../TM2_segmentation')
from scipy.ndimage.filters import gaussian_filter
from densenet_regression import DenseNet
from skimage.transform import resize,rescale
import SimpleITK as sitk
import numpy as np
import pandas as pd
import tensorflow as tf
import glob, os, ... |
04602fe802a5e649f64f0e3d9736a31eb2bc872e667e65373924da6d2ccc244d | Python | 7,951 | 198 | #!/usr/bin/env python3
"""
Dx BR — 10,000-permutation null distribution on the in-pool §3.1 / §4.5
LDA-target perm test (AUC, LOO BA, LOCO BA).
Closes the v0.73 review carry-over (Gemini's catch): the paper currently
reports *p ≤ 0.002* reflecting the *n*=500 perm floor (1/501). Bumping
to *n*=10,000 tightens this to... |
2d9a50aa0b80c1e6099192d82668cf4363cfd566e77c7c3c76d6b7d10d1a062d | Python | 7,952 | 256 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Ternary(_BaseLayoutHierarchyType):
_parent_path_str = "layout"
_path_st... |
4fba6df8338e1dd52ea58a09b014fb1f2fc14d744a436e718352482cae76785f | Python | 7,952 | 222 | from typing import Dict, List, Tuple, Union
from PIL.Image import Image
from torch import Tensor
from lightly.transforms.gaussian_blur import GaussianBlur
from lightly.transforms.multi_view_transform import MultiViewTransform
from lightly.transforms.torchvision_v2_compatibility import torchvision_transforms as T
from... |
c813571e9c5105e90b8a1f2d62902149ebb35d4ed62f50b7f152ed47ce97badd | Python | 7,957 | 183 | import numpy as np
import torch
import torch.nn as nn
from dcrnn_cell import DCGRUCell
from utils import *
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
def count_parameters(model):
return sum(p.numel() for p in model.parameters() if p.requires_grad)
class Seq2SeqAttrs:
def __init__... |
5d658e12015944a94b856c9bb8f3bb7f710ca3c704d5670a9ab7e68be4321014 | Python | 7,958 | 217 | import time
import sys
import os
import shlex
import subprocess
import configparser
import logging
logger = logging.getLogger("top." + __name__)
logger.setLevel(logging.DEBUG)
def loglevel_from_verbosity(verbosity):
"""Convert verbosity setting to logging level.
Args:
verbosity (int): Setting value... |
f56d9c699aae776106d9bc19cbeb2ea03167c58df84913d0552d697f1c938389 | Python | 7,960 | 178 | """Writable fsspec filesystem for GitHub repositories.
The ``GithubFileSystem`` shipped with fsspec is read-only (its ``_open`` rejects any write
mode). This module subclasses it to add ``put_file``, which uploads a file by committing it
to the configured branch through the GitHub Contents API with an automatic commit... |
bfa810d86db5eaa6a4ed90cfca377241fb2771ed0cefc5160412dc1c4646f21a | Python | 7,961 | 269 | """Mapping between Python objects, C objects, and R objects."""
# TODO: rename the module with a prefix _ to indicate that this should
# not be used outside of rpy2's own code
from typing import Callable
from typing import Dict
from typing import Literal
from typing import Type
from rpy2.rinterface_lib import openr... |
282aa70faf6bffe010368769a739b7e2299c3c0ea06d1530242179af75ee4418 | Python | 7,963 | 281 | #!/usr/bin/env python
__author__ = "Bjoern Gruening"
__version__ = "1.0"
__date__ = "2012"
__license__ = "GLP3+"
"""
Creates a GenericMolecule Database, with tables and schema
"""
import argparse
import datetime
import sys
import cheminfolib
import generic as config
import psycopg2
from sqlalchemy import create_... |
a7dff293bf5bb7e668dcdeda918cbbecdc1a65132ba8e64a9bd34721d75b44c4 | Python | 7,964 | 187 | import argparse
import numpy as np
import pandas as pd
from cleanlab.datalab.datalab import Datalab
from cleanlab.regression.rank import get_label_quality_scores
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import cross_val_predict, KFold, StratifiedKFold
from xgboost import XGBClassi... |
fbd9752f1747ee81201db77b91a1dad25d8b0f331d7678eb5b326e1122a23fd4 | Python | 7,964 | 301 | r"""
Port of DEBtool_M/animal/get_tj.m — scaled ages and lengths at metamorphosis.
This is a faithful Python transcription of the constant-food branch only,
sufficient for the abp-family holometabolous insects (Drosophila).
See get_tj.m source at:
c:\Users\Panos\AmP Drosophila matlab workspace\DEBtool_M\animal\get_... |
4c812b01a5d69653f889312ce6bc4a7a759ce50bd017a5e59358e7d533451c9f | Python | 7,967 | 207 | """Auto data preparation."""
# pylint: disable=bare-except
import os
import re
from pathlib import Path
import yaml
from ...utils.download import download
from ...utils.filesystem import unzip, untar, PathTree
__all__ = ['url_data']
def url_data(url, path=None, overwrite=False, overwrite_folder=False, sha1_hash=None,... |
544a6d2957c8441d22a2e1aa73dd4de72d215a7c729674983b9fcd458f049b60 | Python | 7,967 | 196 | from graph_bert import *
from BatmanNet.model.models import BatmanNet_finetune
from BatmanNet.model.layers import Readout, GTransEncoder, GTransDecoder
from BatmanNet.util.nn_utils import get_activation_function
from argparse import Namespace
import numpy as np
class CompoundProteinInteractionPrediction(nn.Module):
... |
6b0182898db528d64c58eb419584e0e6f13a193645a4f8886c7ed66d51ec777f | Python | 7,969 | 186 | """Regression tests for the cert7 (round-7-prep) intervention hardening fixes.
Each test pins a silent-corruption / inappropriate-crash bug found by the cert6
inspector in the immediate neighborhood of the round-6 fixes -- the recurrence
pattern where a fix closed one instance of a class but left siblings open:
* BLO... |
9c5a4288980ba5e233c62e1dca28e930093d88f0ab107b5f5fa69802fae8fdf3 | Python | 7,969 | 171 | """Seam-disposition census: memo 6.2 repairs, 6.3 doors, facet settlement (F35).
Items 15/19/21 in test form, analysis-class: one frozen disposition table
naming every existing seam the memo ruled on (6.2), every funded door
(6.3 / item 21), and the facet-settlement mechanics (item 15), each with
its live status. MET ... |
167717b4debd7163e32be38b1034493c965e8469f8147a78b737262447fb90e8 | Python | 7,970 | 200 | import logging
from click import option
import yaml
import os
from pathlib import Path
from models import model
logging.basicConfig( level = logging.INFO )
class Configuration:
def __init__(self, yaml_file, model_class='mdl'):
'''
:param model_class - choices - ['mdl', 'tts']
'''
... |
7d9afd9bfd90e90ca2695b17f5f94c0df28f3fb0724b594fb6a4f0d34e92ef45 | Python | 7,970 | 177 | """
Théo Gauvrit
Mars 2022
Function to create from a excel/csv data file the correlation matrices and correlation nodes and heat map plots
"""
import pandas as pd
import networkx as nx
import numpy as np
from outliers import smirnov_grubbs as grubbs
import scipy.stats as sc
from pyvis.network import Network
import matp... |
d86e543c33dcad1ba93a702a95a11a0f5fc5e2949c20bfce347cc4b49a38c880 | Python | 7,970 | 211 | """4. Dive deep into Training a Simple Pose Model on COCO Keypoints
===================================================================
In this tutorial, we show you how to train a pose estimation model [1]_ on the COCO dataset.
First let's import some necessary modules.
"""
from __future__ import division
import t... |
e8fb3abcb183d906cbee828a5171c7b4b84e6389fd8b982c50d3de5b112b6d66 | Python | 7,970 | 205 | """The completeness witness never verifies a value-free capture.
A clean dispatch census proves that every aten dispatch had an owner; it says
nothing about tensor values. A structure-only capture (meta or real substrate)
therefore settles ``capture_verified=None`` under the witness, exactly as it
does without it, whi... |
9e1f1cf4bd3e3ee611bcc980715d17f6847789cf4b0c6dc99c7bedc6bf9a6a22 | Python | 7,972 | 239 | import logging
from typing import List
import numpy as np
from instance_mongodb import instance_mongodb_sei
from pymatgen.core.structure import Molecule
from pymatgen.analysis.graphs import MoleculeGraph
from minimal_basis.datagen.utils import perturb_along_eigenmode
def expected_transition_state(
ts_molecul... |
ad42271d5c2d1d584a6ad5e78173fe4b40a14217cb2fb35c65470aba376dc53e | Python | 7,975 | 222 | """
Unit tests for larvaworld.lib.util.fitting module.
Tests pure math/scipy optimization and stochastic functions.
"""
import numpy as np
import pytest
from larvaworld.lib.util.fitting import (
simplex,
beta0,
critical_bout,
exp_bout,
)
@pytest.mark.fast
class TestSimplex:
"""Test simplex func... |
266a75413fd06d04cb295d9200a1c1bfc5857d80ebefcffbe0e4da242ea07a8d | Python | 7,976 | 204 | import numpy as np
import cv2 as cv
def detect(img):
"""
:param img: color, deinterlaced image
"""
img_gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
flashes_text_mask = detect_text_and_flashes(img_gray)
border_mask = detect_border(img, flashes_text_mask)
color_bars = detect_color_bars(img)
... |
8858f279513b1b88822c316cf95b361223f5ba578bdfb7d55520165661b17d2c | Python | 7,976 | 202 | import sys
import wandb
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
import pytorch_lightning as pl
from pytorch_lightning.callbacks import ModelCheckpoint
from pytorch_lightning.loggers import WandbLogger
from torchmetrics import MeanSquaredError, R2Score... |
ea0d56d613b4b11fe937c82f279a62815fbd62b67fac160841c6d8c6de73d34c | Python | 7,977 | 161 | # Copyright (c) ByteDance, Inc. and its affiliates.
# All rights reserved.
#
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
#
# This file is basically a copy to: https://github.com/rwightman/pytorch-image-models/blob/v0.5.4/timm/optim/lamb.py
# **... |
5eb93a397f294aeea809a853eb7fb9f244a6c1fe1f2f0b49f8ad7d799fc83f88 | Python | 7,979 | 205 | """The F17 resolver matrix row gate: rungs x verbs, one resolver, one record.
Composition cells from quickstart memo section 6: all three surfaces
serialize byte-equivalent provenance for the same resolved call; the
inferred rung consumes the exact verification trace (never recaptures); the
render facade is the only d... |
35b17ebc82cfcc7379941783101d59976183f34c3dc11ae6f68965387c897976 | Python | 7,980 | 183 | # Written by Seonwoo Min, Seoul National University (mswzeus@gmail.com)
# Some parts of the code were referenced from or inspired by below
# - Tristan Bepler's code (https://github.com/tbepler/protein-sequence-embedding-iclr2019)
# PLUS
""" Homology FASTA file loading functions """
import os
import glob
import numpy ... |
f3f887b4690816c0fb0ff36e0643b08bc8f2087b339252d68dbde5a11968405a | Python | 7,981 | 252 | """
K-Folding script
author: obanmarcos
"""
import os
import os, sys
from config import *
sys.path.append(where_am_i())
import lightning as pl
from lightning.profiler import SimpleProfiler
import argparse
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from utilities import dataloading_utiliti... |
38ab5335ac34e403f65eb73e2a7eaed467c6d5f00886c880df002d6e66f7c058 | Python | 7,985 | 236 | """
Helpers to train with 16-bit precision.
"""
import numpy as np
import torch as th
import torch.nn as nn
from torch._utils import _flatten_dense_tensors, _unflatten_dense_tensors
from . import logger
INITIAL_LOG_LOSS_SCALE = 20.0
def convert_module_to_f16(l):
"""
Convert primitive modules to float16.
... |
f57352e9df41ad6acdb19b8d640e1bb3d774f8df3625e7662595e2e3a642649f | Python | 7,986 | 279 | """
- Modulo per la trasformazione delle features -
Different from the dataloader!!!
"""
import sys
import numpy as np
import torch
import pandas as pd
def get_aminoacid_features(aminoacids):
#print("<<<<", aminoacids)
features = np.zeros((len(aminoacids), 5))
for j, aa in enumerate(aminoacids):
... |
65eaa995e6ade847e906259635dd6be884d3adc60f7b65484082d131b68f6c44 | Python | 7,989 | 206 | """Fail a CI leg whose pytest run executed fewer tests than promised.
The per-backend preview legs guard optional-dependency suites whose tests
``importorskip`` their framework. A missing or import-broken framework then
skips every test and pytest exits 0, so the leg stays green while covering
nothing. This check read... |
974183a9ff5ebbc0e84bb3c4789cf704bd52d5b71b2ad8aa3a60fcb46e16b882 | Python | 7,990 | 219 | from __future__ import annotations
import copy
from typing import Optional
import numpy as np
import pandas as pd
from typing_extensions import Literal
from bream4.device_interfaces.devices.base_device import BaseDeviceInterface
from bream4.toolkit.procedure_components.data_extraction.read_statistics import get_chan... |
0d3802f402350702d08b1b46737dc693819e97361831f345c57b94ea60f00f25 | Python | 7,993 | 247 | import pytest
from pyrosm import get_data
@pytest.fixture
def test_pbf():
pbf_path = get_data("test_pbf")
return pbf_path
@pytest.fixture
def helsinki_pbf():
pbf_path = get_data("helsinki_pbf")
return pbf_path
@pytest.fixture
def test_output_dir():
import os, tempfile
return os.path.join(t... |
3a2637cf2582726081662ec1629bfdd7c75334b682caf8bc2fb26880f06850d0 | Python | 7,993 | 237 | from __future__ import annotations
import json
from pathlib import Path
import pytest
from larvaworld.portal.runtime.display_shortcuts import (
DisplayShortcutsController,
build_display_shortcuts_dialog,
)
from larvaworld.portal.workspace import (
clear_active_workspace_path,
get_workspace_dir,
i... |
6d6ebd8fd97c20dc391b2059b6136139889264b563fd4ae069c57a71e2fca56d | Python | 7,993 | 219 | import hashlib
import numpy as np
import pytest
import seqpro.rag as rag_mod
from seqpro.rag._core import Ragged
def _pack(strings):
"""Return (uint8 data buffer, int64 offsets) for a list of byte strings."""
data = np.frombuffer(b"".join(strings), dtype=np.uint8)
offsets = np.concatenate([[0], np.cumsu... |
689a37c4890d39bd586773da66277b872633b480b7991419e6f09fbb759a7a0b | Python | 7,995 | 195 | # 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 i... |
c1f7f021ce89c9c22119e5ba9ae5708643cdec73345959b033c1048fac850bb0 | Python | 7,995 | 204 | #!/usr/bin/env python3
"""
Dx BC — Channel ablation redo under proper per-fold
====================================================
Re-runs the Dx AM multi-channel reduced-montage analysis under the
proper per-fold per-cohort-deployment pipeline used in v0.79/v0.80,
instead of the legacy whiten-once + LOCO-pooled pipe... |
ecb5fb841cb393250674ae9707d42da8b133e89c4dc1abb9dc15d8688d014e00 | Python | 7,995 | 165 | """
Functionality for dealing with dbkeys.
"""
import logging
import os.path
import re
from json import loads
from sqlalchemy import select
from galaxy.model import HistoryDatasetAssociation
from galaxy.model.scoped_session import galaxy_scoped_session
from galaxy.util import (
galaxy_directory,
sanitize_lis... |
30f40315dc81072e28a7b223c3a2ca97000c5313e6a83b0b1c7542c14cb4061a | Python | 8,000 | 265 |
# coding: utf-8
# In[1]:
import os
import sys
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.metrics import roc_auc_score, average_precision_score
# In[2]:
# Get the current working directory
cwd = os.getcwd()
# Ensure that the path is starting in the scripts directory... |
40e753be3d35a136d7c4531fcb0219da78e5f5d88dec20f6ef61e9a38b1b4dfb | Python | 8,000 | 181 | import unittest
from unittest.mock import MagicMock, patch
import numpy as np
from carbontracker import exceptions
from carbontracker.components.gpu import nvidia
from carbontracker.components.component import (
Component,
create_components,
error_by_name,
)
class TestComponent(unittest.TestCase):
@p... |
a1dbfab06781f653112bde574ad5d91cd815a1a7a8a3665729bba622886238ea | Python | 8,000 | 196 | """SIDECAR seam gates (C01 item 14; architecture memo 6.3 seam 1).
Namespaced typed sidecar families: registration law, payload validation,
size budget, analysis-only behavior when the provider is absent, and plain
persistence as of the coordinated tlspec v9 write (C07): real saves
round-trip the ``"sidecar"`` annotat... |
5771525133f5f67884725dd13ba1f2f85a4bc6718a1ed00b1fd8bd8c6961f88f | Python | 8,002 | 275 | # Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
from itertools import chain
import logging
from typing import Any, Dict, Optional
from .._exceptions import DefinitionError
from .._text import enumeration, plural
from .._utils.parse import find_variables
class CodeBase:
_sep = ' '
def __init__(
... |
7d1e81073dc6884f7af8cf6a2a0696f84bf5f8655bcc10b04fed230b07d460bc | Python | 8,002 | 174 | """Tests for bdpy.dl.torch.domain.image_domain."""
import unittest
import torch
import numpy as np
import warnings
from bdpy.dl.torch.domain import image_domain as image_domain_module
class TestAffineDomain(unittest.TestCase):
"""Tests for bdpy.dl.torch.domain.image_domain.AffineDomain"""
def setUp(self):
... |
dc9c684d4eaa66a41bd514b57983a360dafd88ef769820e214c5a2f47e396336 | Python | 8,004 | 187 | """
This module allow us to have a clear summary of finished experiences
"""
import os
import json
import logging
from os import listdir
from os.path import isfile, join
import torch
from analysis.training_analyser import TrainingAnalyser
class HtmlSummaryGenerator:
"""
This class allow us to create html page... |
8d5e47033f199dd9c454692f7cc5d89045e30800dafb874eb0537c64b21c3bbd | Python | 8,005 | 234 | #@title get secondary structure (SSE) from given PDB file
#@markdown So far it seems the best solution is to steal code from biotite
#@markdown which calculates the SSE of a peptide chain based on the P-SEA algorithm (Labesse 1997)
# CODE FROM BIOKITE
# From Krypton
import numpy as np
import random
import torch
def ve... |
521a261d11acbe7816b5b45fc59e22c202852079cba0e05b8b7a3e55f482cf2f | Python | 8,007 | 195 | # 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 i... |
ff574d565be0f1124d30129ebc31a194201f1b52963cd589c75902e5d22d39bf | Python | 8,007 | 182 | # coding:utf-8
import numpy as np
import PIL
import PIL.ImageDraw
import PIL.ImageFont
import matplotlib
from matplotlib import font_manager
def expand2square(pil_img, background_color):
width, height = pil_img.size
if width == height:
return pil_img
elif width > height:
result = PIL.Image... |
120a3a2d24d319540d62a3d5019f0ddf3c49888b297c64e33a9bc76a42d303ed | Python | 8,009 | 268 | from dataclasses import fields
from typing import Optional
import diffrax
import equinox as eqx
import jax
import jax.numpy as jnp
from cvsx import components as c
from cvsx import cardiac_drivers as drv
# from cvsx import parameters as p
from cvsx import respiratory as resp
class SmithCVS(eqx.Module):
mt: c.V... |
013b9183770b3ad20afc2673869bc16c30b6961fab6aac0c925e3c5e4ea7832d | Python | 8,010 | 210 | # 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... |
80e308305355250944d0da38f13e960be449177eea3997b20dd9e5e0e799dbb8 | Python | 8,010 | 236 | # > http://data.statmt.org/cc-100/fr.txt.xz
#### decompress file
# > split --verbose -a 3 -d -b500M data training_data.
#
#
import os
import pickle
from tqdm import tqdm
from typing import Any
from tokenizers.models import BPE
from tokenizers.trainers import BpeTrainer
from tokenizers.pre_tokenizers import Digits, Whit... |
4656b54227457f146312cffd0c729cd3195ae82c94b6e45146f809edefcd4ae9 | Python | 8,013 | 185 | """Test visualization functions."""
import os
import matplotlib.pyplot as plt
import mne
import numpy as np
import pytest
from mne.viz.utils import _fake_click
from mne_rsa import plot_rdms, plot_rdms_topo, plot_roi_map, rdm_evokeds
from numpy.testing import assert_equal
def load_evokeds():
"""Load the MNE-Samp... |
4b78396f5bdbdbb4af1cd255c0ae67a4a67fee6e983eff0140eb5e4ff70a4b76 | Python | 8,014 | 227 | import numpy as np
from keras.src import constraints
from keras.src import initializers
from keras.src import layers
from keras.src import ops
from keras.src import regularizers
from keras.src import testing
from keras.src.backend.common import AutocastScope
class GroupNormalizationTest(testing.TestCase):
def te... |
2d202fcd772c198d8ed9daca20fb3347925ad86d24ba9fffe759776f1d6347f4 | Python | 8,015 | 248 | """Stuff that differs in different Python versions and platform
distributions."""
from __future__ import absolute_import, division
import codecs
import locale
import logging
import os
import shutil
import sys
from pip._vendor.six import text_type
try:
import ipaddress
except ImportError:
try:
from pi... |
e7a4170ac537d023b0519d54415c622915ac806c7c35ccd51910439c6fe16828 | Python | 8,017 | 192 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Citation-integrity audit for the manuscript.
WHY THIS SCRIPT EXISTS
----------------------
`manuscript/references-verified.md` section C rule 1 states that every in-text
citation must resolve to a DOI in the verified table. That rule was written by
this project and wa... |
008198a66a3f185f9ad524ae5fb3ca485746cbdb1423705ebfb39d1005404638 | Python | 8,018 | 245 | """Tests for image auto-routing in ``tl.trace``."""
from __future__ import annotations
import base64
import builtins
import re
from pathlib import Path
from typing import Any
import pytest
import torch
from torch import nn
import torchlens as tl
import torchlens.bridge.hf as hf_bridge
class _ImageModel(nn.Module)... |
c3f54e0e93fe1ab1e42ee142a681ec0eab6ad6d1bae3ca53297693514b12be6c | Python | 8,020 | 232 | """Echo stats rungs on the shared C02 kernel: soundness as executable code.
Pins snoop memo test rows 13-14: the T-A sampled-blindness regression (a
planted NaN invisible to a subsample must NOT surface as a finiteness
claim), the exact rung's numel-budget refusal, the reuse rung's
never-print-deferred-evidence rule, ... |
95270f92b33f5fc9647612f24dc2b661bb5a80912edb3aadb760f60025e5e376 | Python | 8,022 | 270 | import time
import math
import copy
import os
from math import ceil
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
from torch.utils.data import TensorDataset, DataLoader
from tqdm.notebook import tqdm
import IPython.display
from IPython.display import display
import matplotlib.pyplot as p... |
ac43275de0b1d0c8effd2d2bee7a3e48b964a103c0a343bde7c1de279b1bc9ad | Python | 8,022 | 229 | from abc import ABC, abstractmethod
from typing import Any, Dict, List, Tuple, Union
import torch
from pytorch_lightning import LightningModule
from torch import Tensor
from torch.nn import CrossEntropyLoss, Linear, Module, Parameter, Sequential
from torch.optim import SGD, Optimizer
from lightly.utils.benchmarking.t... |
adfaeb32ae7b7902ab7b36d003ca218c5aff207aee05bb0d67f58a88929092e7 | Python | 8,023 | 172 | """Sparse (top-k gather) MLA forward: 1CTA (64-row tile) vs 2CTA (128-row tile) kernels.
MQA, hdim 64 (rope) + 512 (latent), inference (no grad). For each shape the same inputs
and index lists go through:
2cta FLASH_ATTENTION_MLA_1CTA=0 -- Q heads padded to 128 per token
1cta FLASH_ATTENTION_MLA_1CTA=1 -- pa... |
368e287c578b7d556a3d41168b56503388bc437c75bc3cf2373bebaa961a644e | Python | 8,025 | 239 | # ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (leoxiaobin@gmail.com)
# ------------------------------------------------------------------------------
from __future__ import absolute_import
from __future... |
78aea6e2924cba6fa28a615b84ac23f7542a6917b373fe96b5cc37f729d032ed | Python | 8,025 | 225 | """tlspec v9 entry-dark field slots (C07 coordinated schema write).
Three declared-now, written-later field families, so their Phase-3 writers
need no further version bump:
- ``Op.injection_provenance`` (surgery memo 3.5 / items 8-9, 12; F01 writes):
the injected-op durable structural key. ``None`` on every model o... |
0ec0beeb646c624a445819bae470ac1f332dfbbd9d5e5918dd6be4b76e1e983c | Python | 8,026 | 234 | from unittest.mock import ANY, Mock
import pytest
from kombu import Exchange, Queue
from kombu.utils.functional import maybe_evaluate
from celery.app import routes
from celery.exceptions import QueueNotFound
from celery.utils.imports import qualname
def Router(app, *args, **kwargs):
return routes.Router(*args, ... |
7e7e4445c22a66225fb70226291cf511ba327b8bb7cea48b1c8ef71d8348413f | Python | 8,026 | 236 | # Copyright 2025 Google.
#
# 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, soft... |
c361787ec2579f04f7058db3dab3b4d343464dc616cadc31fcb034f13e788ddc | Python | 8,026 | 172 | import sys
import importlib
from collections import defaultdict
import warnings
from matplotlib.pyplot import hist
from numpy.lib.format import open_memmap
from brian2.only import *
import deepdish as dd
import numpy_ as np
from util import Tree, ensure_unit
from readout import load_results
conds = ('std', 'msc', ... |
dc3e2d05f29257f3186ba7394cffe00ee2604e9a52a0859f55c1bbed34004be1 | Python | 8,026 | 226 | """
Unit tests for stimulators/composed_stimulator.py.
Tests ComposedStimulator initialization, trigger/action wiring,
channel mapping, and _decide logic.
"""
import unittest
from unittest.mock import Mock, patch
from ethoscope.stimulators.composed_stimulator import ComposedStimulator
from ethoscope.stimulators.stim... |
acfa5df672eea80fc76e6af8a1eeae6b36179ced36c24961d6ca356e02b60b05 | Python | 8,027 | 132 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
589e6d9a206dd2c919c4867c526fc8f77a49e768debd699565386356aa36f7ae | Python | 8,028 | 248 | # This example requires the following dependencies to be installed:
# pip install lightly
# Note: The model and training settings do not follow the reference settings
# from the paper. The settings are chosen such that the example can easily be
# run on a small dataset with a single GPU.
import copy
from functools im... |
8ca06dbf50aa4747ed4ff04575a18f3b3c0001ed13f47972672071b71d1577d6 | Python | 8,029 | 223 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import logging
import os
from collections import defaultdict
from slowfast.utils.env import pathmgr
logger = logging.getLogger(__name__)
FPS = 30
AVA_VALID_FRAMES = range(902, 1799)
def load_image_lists(cfg, is_train):
... |
3e571d3c1a06f598f75a7780d10e308243fea28f4d14950abaa9a088714328c7 | Python | 8,030 | 264 | #! /usr/bin/env python
# altschulEriksonDinuclShuffle.py
# P. Clote, Oct 2003
# NOTE: One cannot use function "count(s,word)" to count the number
# of occurrences of dinucleotide word in string s, since the built-in
# function counts only nonoverlapping words, presumably in a left to
# right fashion.
import sys,stri... |
fd130649c0e28b9ccdd5f6927d4dccb9c81dd82563a7942420ce855c699bcc94 | Python | 8,031 | 248 | __author__ = 'quentin'
import serial
from serial.tools import list_ports
import time
import logging
import multiprocessing
from ethoscope.hardware.interfaces.interfaces import BaseInterface
class NoValidPortError(serial.SerialException):
pass
class WrongSleepDepPortError(serial.SerialException):
pass
class ... |
2783f4a778dfe8b7bb884eb4045b700d53a92a1f58d5696c66923ca01b5b02f5 | Python | 8,032 | 205 | # Adapted from https://github.com/NVIDIA/apex/blob/master/setup.py
import sys
import warnings
import os
from packaging.version import parse, Version
import torch
from torch.utils.cpp_extension import BuildExtension, CppExtension, CUDAExtension, CUDA_HOME
from setuptools import setup, find_packages
import subprocess
#... |
2d409ccf5986715e4adc75f6704cc7e7495a6040c4c2a0e879abdf5b3fd33016 | Python | 8,035 | 245 | from model import common
import torch
import torch.nn as nn
from util.tools import extract_image_patches, reduce_mean, reduce_sum, same_padding, reverse_patches
from util.rlutrans import Mlp, TransBlock
import torch.nn.functional as F
def make_model(args, parent=False):
return LBNet(args)
## Channel Attention (... |
7eb68aaf2b99638968652d17ab3d3d5eef9ee9946536caf531cc9a15d41d4a91 | Python | 8,035 | 193 | #!/usr/bin/env python
"""
Example script demonstrating how to preprocess a set of datasets and saving out the results.
TODO:
- provide different entry point by command line argument parsing using argparse
- fix plotting (`time` encapsulated at the moment...)
"""
import numpy as np
import matplotlib.pyplot as plt
tr... |
60479b0cd3eb293b3c183d64fd018e9d862d08b878e0b09f2878a8e4e3d5fd98 | Python | 8,036 | 224 | from warnings import WarningMessage
from tensorflow.keras import backend as K
from tensorflow import keras
from tensorflow.keras.layers import Layer, TimeDistributed, Dense
from tensorflow.keras.models import Model, Sequential
from tensorflow.keras import initializers
import tensorflow as tf
from tf_spiking.surrogates... |
60ce55512a9f750a5e3415fa8a4aa4810cfa5538991472f7ab55967732fd3302 | Python | 8,038 | 221 | #!/usr/bin/env python
"""
Broadly speaking, this script takes the audio downloaded from Common Voice
for a certain language, in addition to the *.tsv files output by CorporaCreator,
and the script formats the data and transcripts to be in a state usable by
DeepSpeech.py
Use "python3 import_cv2.py -h" for help
"""
impor... |
d2b44e5668d1cfe3409ca0b2cd2324e35ca360929579d5c1cc9535ed44181db0 | Python | 8,038 | 193 | import torch
from torch_geometric.nn import radius_graph
from torch_geometric.nn.models import DimeNetPlusPlus
from .atomistic_nn import AtomisticNN
class AtomicDimeNet(AtomisticNN, DimeNetPlusPlus) :
"""Modification of the PyG DimeNetPlusPlus implementation to recover the atomic
contributions to the predict... |
5255492e2d49bace455a70af6190e7c2d21d1e42d4e0d2329c2ffb86b9236334 | Python | 8,039 | 216 | from typing import Any
import numpy as np
from neurogym.core import TrialEnv
from neurogym.utils import spaces
from neurogym.utils.ngym_random import TruncExp
class ContextDecisionMaking(TrialEnv):
"""Context-dependent decision-making task.
The agent simultaneously receives stimulus inputs from two modalit... |
3efd59b641800e3fe8e60b8c4fa304b3a999f8af7e21b9b7f83a929ec23a9ee7 | Python | 8,040 | 197 | """WavTokenizer (neural audio codec) + WuKong (stacked-FM recommendation).
Two architectures with no prior in-tree implementation, reproduced as compact random-init
classics. (Filename uses the agent's `ri_vision_a` namespace though these are audio/reco.)
* WavTokenizer (Ji et al., 2024, arXiv:2408.16532, github ji... |
3637a4b0b6561ef41a6638d3b295433eb2895455975d0c6e3d0269cd32b75952 | Python | 8,042 | 241 | """T-POSITION-shaped text rows: real tokenizer, real architectures (F18).
The LM track at zero network: the REAL vendored GPT-2 tokenizer (byte
identity ledgered in the R0 corpus) drives ``hf_collate`` against a
config-built GPT-2 (learned-absolute decoder — the measured rel 41.6%
defect class) and a config-built BERT... |
f2a4e17e7e80fef18669ef2cc2a53394055908121d73fb05c4ca7d6b2cadda69 | Python | 8,045 | 203 | import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.utils.data
from src.getdata import getdata_from_csv
from src.utils import DrugTargetDataset, collate, AminoAcid, ci
from src.models.DAT import DAT3
parser = argparse.ArgumentParser()
parser.add_argument('--cuda', default=True, help='Dis... |
50c39b842b5d07130358f965d79bee79caca1771ae69c1d0d7183859e077f3c0 | Python | 8,047 | 274 | """Compact PointNet++ SSG classifier for RI atlas rows.
Qi, Yi, Su & Guibas, 2017, "PointNet++: Deep Hierarchical Feature Learning
on Point Sets in a Metric Space." Source: https://github.com/charlesq34/pointnet2
This is a smaller single-scale-grouping (SSG) PointNet++ reimplementation for
draw-constrained catalog r... |
9721d047f264dc9b9ca7d6b06841bc3ecac7c41f868c29b3c45ab763f42e8e14 | Python | 8,047 | 217 | from keras.src.api_export import keras_export
from keras.src.backend.common import is_int_dtype
from keras.src.layers.preprocessing.image_preprocessing.base_image_preprocessing_layer import ( # noqa: E501
BaseImagePreprocessingLayer,
)
from keras.src.ops.core import _saturate_cast
from keras.src.random.seed_genera... |
9d037bcabcaa030292a7ed582cf657d8a0eb28ae5eb0844c2cd0abe098aa2a4a | Python | 8,049 | 207 | """Wrapper for augmenting observations by pixel values."""
import collections
import copy
from collections.abc import MutableMapping
from typing import Any, Dict, List, Optional, Tuple
import numpy as np
import gym
from gym import spaces
STATE_KEY = "state"
class PixelObservationWrapper(gym.ObservationWrapper):
... |
b49c6efa4bc739f452a222ae86b51d6c275b24d35cdb2c15d622bc98faa7ff2b | Python | 8,050 | 277 | import pandas as pd
import tqdm.auto as tqdm
import numpy as np
import attr
import torch
from modular_splicing.evaluation.evaluation_criterion import EvaluationCriterion
from modular_splicing.models_for_testing.load_model_for_testing import step_for_density
from modular_splicing.evaluation.standard_e2e_eval import e... |
bae4e552c19f05747fdd7908eaa76c7aa14f611efcaaa28987ba6239d618c108 | Python | 8,051 | 192 | """Contrastive Loss Functions"""
# Copyright (c) 2020. Lightly AG and its affiliates.
# All Rights Reserved
from typing import Sequence, Union
import torch
from torch import Tensor, nn
from torch import distributed as torch_dist
from lightly.models.modules.memory_bank import MemoryBankModule
from lightly.utils impo... |
028f22b7e9ceabb5714f4ddde4831cdd6d25507819540ccff6b75ed441f72e69 | Python | 8,053 | 204 | """Tests for per-op autograd saved tensor memory accounting."""
from __future__ import annotations
from pathlib import Path
import torch
from torch import nn
import torchlens as tl
from torchlens.backends.torch.ops import _get_autograd_saved_stats_for_tensor
from torchlens.data_classes.layer import Layer
from torch... |
8961b30358ea0e0eaf85823eafc1a349bef67abbc99268c44b256a36ac3cea64 | Python | 8,056 | 250 | #!/usr/bin/env python3
"""
Test runner for backup system tests.
Runs comprehensive tests for the backup system including:
- Unit tests for backup helpers and cache system
- Integration tests for backup API
- Performance tests for cache optimization
- Primary key backup functionality tests
"""
import argparse
import o... |
a4c4606074f5a1383954945dff1c85df9fb344d1dea60142fb4725483bb09e2d | Python | 8,057 | 305 | import matplotlib.pyplot as plt
import pandas as pd
from modular_splicing.utils.plots.results_by_model_group import plot_grouped_results
from modular_splicing.evaluation.evaluate_model_series import (
evaluate_all_series,
)
from modular_splicing.models_for_testing.models_for_testing import (
EndToEndModelsFor... |
abc2c373d716331d0aa5add3450c933afb34d064ba9c8a74b97a5d229c0c82ec | Python | 8,057 | 240 | # SOURCE: vendored from https://github.com/logpai/deep-loglizer @ main
# (deeploglizer/models/{lstm.py, base_model.py}). LogAnomaly: template2vec +
# quantitative + sequential-pattern LSTM for log anomaly detection (Meng et
# al., IJCAI 2019, "LogAnomaly: Unsupervised Detection of Sequential and
# Quantitative Anomalie... |
36d2336de5efe9b352fd7b53cc973266becf1a5deb5f5ca38c15844593624631 | Python | 8,060 | 240 | import re
import inspect
import textwrap
import pydoc
from .docscrape import NumpyDocString
from .docscrape import FunctionDoc
from .docscrape import ClassDoc
class SphinxDocString(NumpyDocString):
def __init__(self, docstring, config=None):
config = {} if config is None else config
self.use_plots... |
597bc2b6b00da06e5be2133928d64652ff4088578085ecf8d00d7853c39440a8 | Python | 8,060 | 170 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import math
from copy import deepcopy
import matplotlib.pyplot as plt
DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
def describe_model(net):
nparams = sum(p.numel() for p in net.parameters() if p.requires_... |
5a7752fcd281a41cf41fdba5dfd905295424e1bb402a3582809bfbbdadd3b01e | Python | 8,060 | 136 | import argparse
import os
from util import util
import torch
import models
import data
class BaseOptions():
"""This class defines options used during both training and test time.
It also implements several helper functions such as parsing, printing, and saving the options.
It also gathers additional opti... |
c17418ec3f2032b826ce6903275cedc24d8e116dc49d3d71c099d8660ad4fea2 | Python | 8,063 | 199 | """
metadata.py
Class for loading metadata TC metadata
for silicon probe extracellular recordings.
Note: this is designed specifically for the Knoblich Lab.
TC documentations should be adapted for specific lab purposes.
"""
import pathlib
import math
import pandas as pd
from ..metadata import (attach_drugtimes, comp... |
1036e9fd683e1c1e3f8bf8a33c84aaa0a3857c61cd12c6335a749c4c8ae6202f | Python | 8,064 | 197 | """Env-flag doctrine: one parser, one registry, "true" never means OFF.
WT1 A-VI item 34: every torchlens-owned boolean environment knob parses
through ``closed_bool_env`` (or a reason-ledgered inline closed-vocabulary
parser), and every ``TORCHLENS_*`` environment READ in the package has a row
in ``ENV_FLAG_REGISTRY`... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.