sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
b66a0987e8f58ac803d3a8cc1dcd913fecfef18e9c92cfc09967b80a9b85a079 | Python | 11,244 | 322 | from os import PathLike
from typing import Union, Sequence, Optional
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from sklearn.metrics import r2_score, mean_squared_error
from sklearn.metrics import (
accuracy_score,
roc_auc_score,
average_precision_score,
precision_score,
... |
08bc32bcd71d57ba7374069fda93519b530e2cde49e799ed1e4c3ded63ada4c5 | Python | 11,246 | 279 | from typing import Any, Dict, List, Tuple
import pandas as pd
import requests
from dash import dash_table as dt
from codecarbon.core.emissions import Emissions
from codecarbon.input import DataSource, DataSourceException
class Data:
def __init__(self):
self._data_source = DataSource()
self._emis... |
6f6f2278b5546473c6feb6227e7b959fe4e4ba1f345cd626a87e53ba5fec09a4 | Python | 11,246 | 278 | #!/usr/bin/env python3
"""
Dx AQ — PD-vs-HC under FULL 15-feature pipeline (5D + AP_TOPO + CONN_ALPHA).
Reuses extras already extracted by Dx AP. Connectivity features (iPLV/dPLI
in alpha band) are present in the extras JSONs from the original extraction.
"""
from __future__ import annotations
import os, sys, json, tim... |
2a25436a4b342bbb51d9d8a6a9a6a2a70e0ef168f05bd1ebbd3724e97fa7b58a | Python | 11,249 | 233 | from SocialGNN_withU_modelfunctions import SocialGNN, SocialGNN_E, CueBasedLSTM, get_inputs_outputs, get_inputs_outputs_baseline
import os, sys
import pickle
import numpy as np
from collections import namedtuple, Counter
from sklearn.model_selection import ParameterGrid
import time
import argparse
from distutils.util i... |
34353fb74f0f403bc7ed165d4a8d04ce18a27a7c8e98313614bfca064478839c | Python | 11,250 | 261 | '''Reveral detector for gradients' classification.
'''
import numpy
import pandas
from scipy import stats, signal, sparse
from scipy.spatial.distance import pdist, squareform
import parcellation_project.analyses.flatmaps as fm_analyses
from parcellation_project.plotting import connectivity_structure
from ..tree_help... |
e6f6bf95a9544e2d93d18614c434a5334df0538cdb031465ce06b231951cc150 | Python | 11,252 | 306 | """Robustness sprint PR 1 — regression coverage for correctness guards.
Covers:
- Nested ``trace`` / ``active_logging`` must raise rather than
silently corrupt the outer Trace.
- Instrumented functorch / vmap / grad transforms warn at the boundary, while raw
uninstrumented transform regions retain ... |
fb6c7bff129e30d42b974df0e15a7b9c5c5fc319e9ed4835df0789e4f26dacfc | Python | 11,252 | 343 | """
Import a DEB parameter set from an Add-my-Pet (AmP) results page.
AmP publishes each species entry as an HTML results page containing a parameter
table and a data/predictions table. This module converts such a page into the JSON
form that :meth:`~larvaworld.lib.model.deb.deb_equations.DEBPars.from_amp_json`
consum... |
9aa9842c311f2a701a8660ae41d139aa8bb45958c911dbcefaa40a51c33f0a26 | Python | 11,256 | 258 | #!/usr/bin/env python3
"""
File: plot_interferon_signaling.py
Created: 2022/07/12
Last Changed:
Author: M.Vochteloo
Copyright (C) 2020 M.Vochteloo
Copyright (C) 2020 University Medical Center Groningen.
A copy of the BSD 3-Clause "New" or "Revised" License can be found in the
LICENSE file in the r... |
60e4e08633de7be18e933a4870e252959cb38ccc7d902c7dd1203f15e2d89f04 | Python | 11,257 | 335 | """Utility functions for tests."""
import os
import re
import subprocess
import tarfile
from contextlib import contextmanager
from glob import glob
from gzip import GzipFile
from io import BytesIO
import nibabel as nb
import numpy as np
import requests
from bids.layout import BIDSLayout
from nipype import logging
LO... |
99cd44490e52fe4297e25bd2e4c008a37872c6b73d6fdb830e6ffdfc28dd76fc | Python | 11,257 | 309 | #!/usr/bin/env python
# =============================================================================
# MODULE DOCSTRING
# =============================================================================
"""
Utility functions for graphs.
"""
# ==========================================================================... |
d81ac7d750f704fa237255223d2342d2a40d4bfdcbee8ea477acde6ad7def2d7 | Python | 11,259 | 289 | """Progress of downloads and reads on stderr: a tqdm bar, or a widget in Jupyter when
ipywidgets is installed."""
import contextlib
import importlib.util
import sys
import threading
import time
from pathlib import Path
from pyrosm._log import _printable
_clock = time.monotonic
# How often an open bar is redrawn, so ... |
45e807f65131accadec9b2aa5450a409c528766dccbc2f0160076fabbfdb3cee | Python | 11,267 | 261 | import os
import sys
from argparse import ArgumentParser
from collections import OrderedDict
import pandas as pd
import torch
import torch.nn as nn
import torch.optim as optim
import torchvision.transforms as transforms
from monai.networks.nets import UNet
from tensorboardX import SummaryWriter
from torch.optim.lr_sch... |
a13668e097437c1b8de6f2b2ef74af47015d035ae16ec92a7884e1d808eeb6e1 | Python | 11,270 | 251 | #!/usr/bin/env python3
"""
Dx BN2 — Training-pool τ under the SAME deployment LDA (corrected)
====================================================================
The Dx BN result reported a τ = -12 from proper_loco LOCO scores
applied to figshare scores at scale ~-3.5. That mismatch was an
artifact: proper_loco train... |
06482b0a3f5d004f28ae7a771da8f18ff4461a6c4ffe068b135413849aec3a0c | Python | 11,273 | 282 | """
This module contain all connectivity estimates
"""
import numpy as np
def relu(x):
"""Rectifying linear unit.
Parameters
----------
x : scalar
Input.
Returns
-------
scalar
x if x >= 0 else 0.
"""
return x if x >= 0 else 0.0
class Connectivity:
def __i... |
e089236817e579a51b9a88719bcc0cd28716a4ac044981c89c838d5fa6a28c10 | Python | 11,274 | 274 | """Persisted-field registry: the one queryable index of the tlspec envelope.
The v9 envelope (megaplan P05 / ecosystem MEMO 3.1, 3.3) needs one place that
can answer, per record contract: which field names are DECLARED, which of
them PERSIST (``FieldPolicy`` other than ``DROP``), what evidence TIER each
persisted fiel... |
cd0bc7250979df25c8b2c6ad8da22ad0de8f467a15401fd2b11995cf3a21d0a8 | Python | 11,275 | 238 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
r =[0.896,0.9456,0.9455,0.9634]
#r = 2 * np.random.rand(100) #生成100个服从“0~1”均匀分布的随机样本值
theta = np.linspace( 2/5 * np.pi,4/5 * np.pi, 5)[:-1] #生成角度
area = 100 * np.array(r)**3 #面积
colors = ['darkorange','cornflowerblue','mediu... |
dba678179c50990d396e80ff84af348838007842858256cf06dcc44750f2dd17 | Python | 11,276 | 290 | """Every torchlens module must be importable STANDALONE (no circular-import trap).
``import torchlens.bundle`` -- a documented PUBLIC module -- raised
``ImportError: cannot import name 'AmbiguousLabelError' from partially initialized
module 'torchlens.bundle'`` whenever it was the first torchlens module imported in a
... |
11b00f04dd0a6bd248e471157216460d6e5209f5219fb02b2f60c760e8a3c698 | Python | 11,279 | 343 | import numpy as np
import scipy
import brian2.only as br
from tqdm import tqdm
import matplotlib as mpl
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
import network
import analysis
import fig2
from functools import partial
from multiprocessing import Manager, Pool
import sys... |
784bfbdcadc994aedd9b7a49d491270ad9b50a62823aa504e86ba1909da98fdd | Python | 11,280 | 300 | import csv
import glob
import itertools
import os
import re
import json
from collections import OrderedDict
import numpy as np
import nipy
import nibabel
import pandas as pd
#import bdpy
from .fmriprep import create_bdata_singlesubject
def create_bdata_spm_domestic(dpath, data_mode='volume_native',
... |
df79abf38a73345c757620ace9c6bdf6f55d14a0624a72a7bca6bd31facd29a7 | Python | 11,285 | 271 | from typing import Any, Dict, List, Optional, Tuple
import argparse
import functools
import os
import pickle
import random
import pandas as pd
import torch
import tqdm
import transformers
from .hotflip import HotFlip
from .utils import device, PrefixLoss, PrefixModel, PrefixPool
class AutoPrompt(HotFlip):
args... |
402a3d23cd8f18e18443ce80b074ca1d453d5a1964601bd29d36e540f0499fa1 | Python | 11,291 | 300 | """r35 stage-2 regressions: contract-before-touch admission (corr2_6, I5),
physical input fingerprints (hon1_3 H-a + H_B_RESOLUTION R2), and per-call /
ambient execution-context restore (corr2_8, decision E).
"""
from __future__ import annotations
from pathlib import Path
from typing import Any
import pytest
import ... |
44f579dbdc4eb389b7277323c29181b3f0a65de9e8056013bad34a8b3580e926 | Python | 11,294 | 294 | """``torch.autograd.grad`` called inside forward is a recorded, faithfully validated boundary op.
The call becomes one ``autogradgrad`` op per returned gradient
(``transform_kind="autograd.grad"``, ``is_transform=True``), parented on the recorded
tensors among its ``outputs``/``inputs``/``grad_outputs``. Its saved ``o... |
480b177b3f7b08d01dac558ff1a1f55cdaa1883ff24cae41234f8c3987827521 | Python | 11,295 | 224 | # -------------------------------------------------------------------------------------
# Code to perform model fitting
# Marta Blanco-Pozo, 2023
# Adapted from Akam, Costa & Dayan (2015), Simple Plans or Sophisticated Habits? State, Transition and Learning Interactions in the Two-Step Task
# --------------------------... |
203b78a1033ed6ed979e312d919385770fec8569d792fdf8d0e1446088938cd5 | Python | 11,302 | 236 | #==============================================================================#
# Author: Dominik Müller #
# Copyright: 2024 IT-Infrastructure for Translational Medical Research, #
# University of Augsburg ... |
e2154bf04e6e160e459df39cc97c32f96c3a4fbee5184de0d061ceb27a0a3f41 | Python | 11,302 | 348 | # -*- coding: utf-8 -*-
#
# pyRiemann documentation build configuration file, created by
# sphinx-quickstart on Sun Apr 19 13:17:55 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
#... |
44124e7735c21bfb1c71c924fe671f2e94b7e606fd066ac8305980ec3aba574d | Python | 11,303 | 294 | # coding=utf-8
# Copyright 2023 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
ed8ea334eee43223688029bb600ac264c18d3e5259a44abc7a9333a0dcbc29bf | Python | 11,305 | 266 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
f82e54c2dc2719b88c0038193ee34692678feacfa33e1de696a180545744d02f | Python | 11,308 | 343 | import time
import functools as ft
import traceback
import jax
import jax.tree_util as jtu
import jax.numpy as jnp
import matplotlib.pyplot as plt
import wfdb
import diffrax
import equinox as eqx
import optax
import jaxopt
from plotly.subplots import make_subplots
jax.config.update("jax_enable_x64", True)
jax.config.... |
34b8d46d4079fa16280557b538df8a0d0981ec8cfbd5be446a954be3d9aaf530 | Python | 11,312 | 321 | """
Multi-GPU matrix multiplication example using PyTorch with ROCm AMD GPUs,
designed to run for 2 minutes at 100% load.
This script includes detailed logging of environment variables, GPU availability, memory usage, and computation progress.
It also handles GPU memory allocation failures gracefully by attempting a sm... |
9c9e19de2e82518a916d033b3df70ef132f23ed2be1c766e379873e56f376885 | Python | 11,315 | 375 | """
Custom class for scrollable and customizable tkinter frame.
Used in various ready-to-use base classes.
SimplyFire - Customizable analysis of electrophysiology data
Copyright (C) 2022 Megumi Mori
This program comes with ABSOLUTELY NO WARRANTY
This program is free software: you can redistribute it and/or modify
it ... |
efcdc2035d72cb78ef61e6d813c1c7d5690816d42017c569aed8272e40a4737a | Python | 11,316 | 286 | """Semantic-tier REAL-MODEL CI test (A03 row gate; WT1 A-I bundle requirement).
The entire semantic appliance tier used to be validated only on hand-rolled
zero-parameter toys, which is how five independent real-model breakages
shipped (silent no-op patches, the attribution autograd crash, the 5.x
logit-lens refusal).... |
2e6bc38eeecb246fb039886847a65cd8099d3cada85b2075549a4c8d18675a71 | Python | 11,328 | 365 | # [2022-10-23] Downloaded from https://github.com/openai/triton/blob/master/python/tutorials/06-fused-attention.py
# for benchmarking.
# We fixed a few dtype cast to make it work for bf16
"""
Fused Attention
===============
This is a Triton implementation of the Flash Attention algorithm
(see: Dao et al., https://arxi... |
46035a9a90cfb5cbdd153e1c51e4541086781ff3d3c5cbaa5cb47446569ef1bb | Python | 11,330 | 323 | """5. Train Your Own Model on ImageNet
==========================================
``ImageNet`` is the most well-known dataset for image classification.
Since it was published, most of the research that advances the state-of-the-art
of image classification was based on this dataset.
Although there are a lot of availab... |
c399960506321ebfccbd461f765a16afbdb48f870e8b68e188c1fe2605c85c56 | Python | 11,330 | 284 | import os
import json
import random
import warnings
import numpy as np
import torch
from collections import defaultdict
from src.data.tokenize import tokenize_pet_txt, tokenize_pet_mlm_txt
from src.utils.util import device
class WSCReader(object):
'''
WSC reads WSC dataset
'''
def __init__(self, co... |
bbe01bae9e386bff1172ee7754de3810b0e39ce1d316da387238880a0576ccee | Python | 11,333 | 295 | #==========================================================================
#
# Copyright NumFOCUS
#
# 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/l... |
b484e6794831c559f393421ff19c532eae0eac76e05dfae9e293cb95510e6e0a | Python | 11,335 | 265 | # --------------------------------------------------------
# Based on BEiT, timm, DINO and DeiT code bases
# https://github.com/microsoft/unilm/tree/master/beit
# https://github.com/rwightman/pytorch-image-models/tree/master/timm
# https://github.com/facebookresearch/deit
# https://github.com/facebookresearch/dino
# --... |
5e89f595d305f3975e703076c40a9873f71c3d5d295c19abfceb1825385604b6 | Python | 11,338 | 311 | import os
import sys
import numpy as np
import torch
from tqdm.auto import tqdm
import wandb
from reporting import get_metrics
class Trainer:
r"""Class to train a model.
This contains an internal training loop which takes care of validation and can be
extended with custom functionality using hooks.
... |
3bda634af70af92581a311f94fbf1258ea81d4cde5e1713cabfb64ad87f1c300 | Python | 11,342 | 317 | """Plain-attribute fidelity facts for the validation deepcopy and fallback paths.
Validation runs its ground truth and its replay on deep copies of the model so the
caller's model state is untouched. Two facts decide whether that is sound:
* whether ``copy.deepcopy`` reproduced every plain attribute's instance namesp... |
a0e6946e249380e95fe822c2461c4cbbfca1f2dfa2f60fed784757a8b8e936e6 | Python | 11,342 | 380 | import cv2
import numpy as np
import logging
from typing import List, Tuple
import nway.image_processing_utils as impu
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
class TransformException(Exception):
pass
class Transform():
"""identity transform and base class for other transforms.
... |
a95ab22f49fc2d8c63b8c1bb66751aed0d6bb36924acc76c0383ff4d98463cd4 | Python | 11,344 | 305 | # type: ignore[override]
import os
from typing import Any, Callable, Optional
import torch
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader, random_split
from pl_bolts.datasets import ConcatDataset
from pl_bolts.transforms.dataset_normalizations import stl10_normalization
from... |
10cf73afc6cd5254217978d8d86a46d635a3853380cba4fbe25635ed8cdb57c1 | Python | 11,345 | 332 | #!/usr/bin/env python3
"""
state_geometry.py — Vendored 5D state-geometry feature extractor.
Self-contained pure-numpy implementation of `compute_phi_5d` and its
dependencies. Originally lived in `paper5_5d/pipelines/reprocess_car_local.py`;
vendored here so this testsuite is a complete self-standing deposit
that does... |
2ff636a4d5c3221f2e18af1dcd1b515296292c6ee51e9f1a5f21a70de17308a0 | Python | 11,346 | 264 | #!/usr/bin/env python3
"""run_wafer_meta_solver.py
Takes multiple solved orders created by run_wafer_solver.py and automatically
"assimilates" them into a single solved order. Done with a majority method
based on solved-order neighbor edges, and solving again with TSP solver.
This process should not be required f... |
44716c5595eb15b15f973e4997dde85f347d4e5090347c50f782cd4eed443f44 | Python | 11,347 | 314 | """TensorFlow eager capture tests."""
from __future__ import annotations
from typing import Any
import numpy as np
import pytest
from conftest import tensorflow_backend_modules
import torchlens as tl
tf, keras, _TF_BACKEND_SKIP_REASON = tensorflow_backend_modules()
pytestmark = [
pytest.mark.tf_backend,
... |
7319f89c5c10d8aaffc74ceeaab4b7e3536f41ebe49884c2763d88a25f26c610 | Python | 11,349 | 261 | import os
import torch
from collections import OrderedDict
from abc import ABC, abstractmethod
from . import networks
class BaseModel(ABC):
"""This class is an abstract base class (ABC) for models.
To create a subclass, you need to implement the following five functions:
-- <__init__>: ... |
f96b23b71eb6be45fe3f22697357ec594fee1eaadbf03f24eaba4aec8ea8cc4e | Python | 11,350 | 324 | """
Unit tests for EthoDB user-related methods.
Tests the new user querying methods added for notification recipient filtering:
- getAllUsers with admin_only parameter
- getUsersForDevice with running_only parameter
- getUserByRun method
"""
import os
import shutil
import tempfile
from datetime import datetime
impor... |
c96871b5755b05555f1a9a1860ec687212aaa37ac038627ac95b19bdf5d3f696 | Python | 11,351 | 295 | """tvscope B7/B8: shaping-op contract, adapters, and export acceptance.
One recorded shaping operation shared by every consumer; the file route and
the in-memory route are numerically identical; row order is tied to
stimulus ids with typed refusals on disagreement; the exported artifact
reloads in a process that reads... |
0d6127417f2d55bca26df77f9c45cfe1cf15b8a5ee7deaf1f44eef145b9cb9c4 | Python | 11,352 | 267 | """Repo-wide docstring coverage gate for ``torchlens/`` (grind r3, R69).
The exemption policy is the orchestrator's D3 ruling: dunder methods and
trivial pass-through properties are exempt; EVERY other function, method, and
class in the package -- public or load-bearing internal -- requires a
docstring. Both exemption... |
b1bc9c1ecfa5ea18769c33a80577f2cb0ba9f8bdcac906a95182f6e9dad88918 | Python | 11,357 | 320 | #!/usr/bin/env python3
"""
5D Eval — Diagnostic G: per-cohort batch normalization.
The pooled z-score across cohorts used in Diagnostic F loses cohort-
specific mean/variance drift — a known domain-shift problem. This script
tests two alternative normalization schemes:
1. pooled (baseline): global mean+SD across al... |
9f07107799c43a769817c474ad73e0fdfa36b13e158a3958e22bbd5aec81b77d | Python | 11,358 | 313 | """
Ethoscope streaming management module.
This module provides connection sharing and multi-client streaming capabilities
for Ethoscope devices using a simple, HTTP-compatible approach.
"""
import errno
import logging
import pickle
import queue
import socket
import struct
import time
from collections.abc import Iter... |
a0e3fcaf502adc0bd90d76c8fdf07449ffe875dd3a4ca05d7a52dbf96f1a8ce9 | Python | 11,359 | 331 | """LorentzNet and ParT: physics-motivated particle jet classifiers.
LorentzNet:
Gong et al., "An Efficient Lorentz Equivariant Graph Neural Network for
Jet Tagging." arXiv:2201.08187 (2022).
Source: https://github.com/sdogsq/LorentzNet-release
ParT (Particle Transformer):
Qu et al., "Particle Transformer for ... |
0d3cc62134a51e8850ba4df73d7095560ee039c0b469d1f569248750ad97d477 | Python | 11,360 | 366 | # -*- coding: utf-8 -*-
#
# pyrem documentation build configuration file, created by
# sphinx-quickstart on Mon Jul 14 19:30:54 2014.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... |
8611e9fd561a01c12cc0fa107bb0329472938897558d22e3906f34dd45eaa7f1 | Python | 11,361 | 253 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
f394f248fedbf7c970c3099a778ded12aa28d02e9ea36ca8dabd8e1cf7cb39dc | Python | 11,361 | 270 | import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers import BertModel
class Config():
def __init__(self, pro_vocab_size, use_cuda, tgt_len, d_embed, d_ff, d_k, d_v, n_layers, n_heads):
self.use_cuda = use_cuda
self.pro_voc... |
b7fdbb3b8cd26e809d92d6a31cbb1d030652e8747780184fc5a9c43c2d33f8a9 | Python | 11,364 | 385 | """
Integration test for project cascade delete functionality.
This test verifies that when a project is deleted, all related entities
are automatically deleted via CASCADE:
- Experiments
- Runs
- Emissions
- Project Tokens
To run this test:
1. Start the database: docker-compose up -d postgres
2. Run migration: uv ru... |
d283258aa2de543180af6fe39ff91e1b1b10e8b79c3cad55f780ad01aa686f52 | Python | 11,365 | 308 | """Digest primitives + model identity contract tests (extract memo items 1 + 6).
Covers the pinned threaded-Merkle crypto digest (thread-count invariance is
THE thing a Merkle fold can silently get wrong — T-IDENTITY-COST's invariance
half), the order-sensitive value reduction (the collision battery that killed
the sa... |
3f76f2766542d2f538206c35345e27fb776f7eae349a1bf650a13516a68f755b | Python | 11,369 | 243 | from __future__ import division
import numpy as np
from abc import ABCMeta, abstractmethod
# abstract class python 2 & 3 compatible
ABC = ABCMeta('ABC', (object,), {})
class Task(ABC):
""" The base task class.
The base task class provides the structure that users can use to\
define a new task. This st... |
97453738f4f017f81b7fe30053a55c2f8ea1eef1a086c6ac1cd2dc27aa092784 | Python | 11,370 | 364 | # -*- coding: utf-8 -*-
"""
For information and usage see README, or http://pypi.python.org/pypi/numericalunits
"""
#Copyright (C) 2012-2016 Steven Byrnes
#
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the ... |
a729faaac3bb4561795d93326bac16e86c183cab89dfbeda0a31b030a7b862fd | Python | 11,374 | 353 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Outsidetextfont(_BaseTraceHierarchyType):
_parent_path_str = "icicle"
_pa... |
868df82a010a5d4049183555dbc337d833c67b34dfd68b2175efacd4262dfadb | Python | 11,376 | 317 | """Static-label live interventions and halt on the technical-preview MLX backend.
The lifted contract: ``trace(intervene=tl.when(static_selector, action))`` and
``trace(halt=static_selector)`` genuinely dispatch — the replacement flows into
downstream ops, the frontier op ends a halted partial trace — while
value-depe... |
ca2be71a909ec7e49e5a6321041d543fe7d857c8216a79b674ba84d77f4c858d | Python | 11,378 | 313 | """Round-24 security regression: construction gadget via output-container reconstruction.
FINDING (R24-SEC1, MEDIUM -- construction gadget): the portable output ``ContainerSpec``
(torchlens-owned, so the safe unpickler admits it) carries ``type_module`` /
``type_qualname`` / ``fields`` / ``keys`` as attacker-influence... |
6d06e3a70ea6f706d89514af07f060ec4b92f017454027ae151dd520a6bc9a7a | Python | 11,379 | 353 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Outsidetextfont(_BaseTraceHierarchyType):
_parent_path_str = "treemap"
_p... |
8928504f49efa1f2795844c366925c770a2c37cda19aa811c7405bd89765b40e | Python | 11,379 | 285 | import subprocess
from collections import namedtuple
from functools import lru_cache
from typing import Callable
from codecarbon.core.gpu_device import GPUDevice
from codecarbon.external.logger import logger
@lru_cache(maxsize=1)
def is_rocm_system():
"""Returns True if the system has an rocm-smi interface."""
... |
da880b17fa0716b20cfdf38641f9313e2ca1ee7cfba8ab46adbb142e594cc33f | Python | 11,380 | 353 | # --- THIS FILE IS AUTO-GENERATED ---
# Modifications will be overwitten the next time code generation run.
from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Outsidetextfont(_BaseTraceHierarchyType):
_parent_path_str = "sunburst"
_... |
92150ddb79eec141db0e17f1ea4c8e5bd15ec4a68dcd5f8be1a919f822fe09cd | Python | 11,384 | 243 | import glob
import pandas as pd
import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt
from nilearn.glm.first_level import make_first_level_design_matrix
from nilearn.glm.first_level import FirstLevelModel
from nilearn.plotting import plot_design_matrix
from nilearn import image
import sys
# non-inte... |
0481a80b2979446208f3acf9d00143ef3fbb86425c2eb2313d31933a0062c7fa | Python | 11,389 | 338 | import os
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from tqdm import trange
class Generator(nn.Module):
def __init__(self, input_size, embed_size , hidden_size, output_size,
n_layers=2,use_cuda=None,optimizer_instance=torch.optim.Adadelta, lr... |
c19f7d78e946bf124b15181fae413ddca94bcc14cd0d0caa1c8b611fa6618666 | Python | 11,390 | 315 | # 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... |
327e44679fda46cb230bde03c3c387482a99840b1f5499d96773911beca2005e | Python | 11,392 | 335 | """
Target Detection Diagnostics Module
This module provides comprehensive diagnostic capabilities for target detection
in the TargetGridROIBuilder, including image quality analysis, detailed logging,
and systematic collection of detection samples for future analysis.
"""
__author__ = "giorgio"
import json
import lo... |
092021be3cedd048b4a02d256b36790f755df0ce100af86ceec06379b3d1b7d9 | Python | 11,397 | 322 | """File I/O for model objects.
Notes
-----
Model loader function import model objects locally to prevent circular imports.
"""
import io
from specparam.io.files import save_json
from specparam.io.utils import create_file_path
from specparam.utils.select import dict_select_keys
from specparam.utils.convert import dic... |
0acbed3fd2ebd9599606c55bbf6277143ccb170a02ca2655588ebdd7f535eb54 | Python | 11,404 | 248 | import json
import numpy as np
import os, sys
import random
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import torch.nn.functional as F
from t... |
fcc7340692a0407a3e2f470a12eb40db6ae0cffe177d6fa42600b604263f16e0 | Python | 11,405 | 247 | import json
import numpy as np
import os, sys
import random
from collections import Counter
from sklearn import preprocessing
from sklearn.metrics import f1_score
from sklearn.metrics import confusion_matrix
import torch
import torch.nn as nn
import torch.nn.utils.rnn as rnn_utils
import torch.nn.functional as F
from t... |
39b975794f61a3569316372113bae047d37bf55ff549fe4124743ade09ecc5e2 | Python | 11,406 | 395 | from typing import List, Tuple, Union
from schemas import *
from flask import Flask, request, render_template, send_file, Response
from flask_cors import CORS, cross_origin
import json
import sqlite3
import os
import dateparser
import vizapi
__path_to_db_file = "covid-india.db"
__db_uri = f'file:{__path_to_db_file}?... |
2556f5ae4e80a857a2e8e5d8703e236e9b998890fcdc99f594d2fd46236d5f6c | Python | 11,407 | 266 | """Prepare custom datasets for object detection
===============================================
With GluonCV, we have already provided built-in support for widely used public datasets with zero
effort, e.g. :ref:`sphx_glr_build_examples_datasets_pascal_voc.py` and :ref:`sphx_glr_build_examples_datasets_mscoco.py`.
Ho... |
16c90ac6337daced5019999862be5b7f954274445104c701b4c3177d9abcdcb4 | Python | 11,410 | 308 | """F09 CP3: sumfam items 11, 13-16, 19-20 -- the family re-base, the
SurfaceRegistry, the capability card, PartialTrace typed refusals, and
the family-gate composition rows.
Named rows exercised: D22 (executable-spelling CI: every registry
spelling runs on a real fixture in its declared state), D24 (the
capability car... |
dc430103232002768ea9192254f46c0b60f07a915e6f34072e95ecf6c2d5caa5 | Python | 11,411 | 297 | import hashlib
import json
import os
import random
import sys
import time
import yaml
from openai import (
APIConnectionError,
APITimeoutError,
InternalServerError,
OpenAI,
RateLimitError,
)
context_files = json.loads(sys.argv[1])
question = sys.argv[2]
model = sys.argv[3]
model_type = sys.argv[4]... |
236bcd4ec3730795d958d0b37ce7e93ae4be98b99fa995c6fa3f15559d35b989 | Python | 11,413 | 246 | # pylint: disable=line-too-long,too-many-lines,missing-docstring,arguments-differ,unused-argument
import mxnet as mx
from mxnet import init
from mxnet.gluon import nn
from mxnet.gluon.nn import HybridBlock
from ..inception import inception_v3
__all__ = ['inceptionv3_ucf101', 'inceptionv3_hmdb51', 'inceptionv3_kinetics... |
e23dd3c67b9d74434a6a66bacf92c2cd75ec6b4e4c57049f4c1a703e05ac6c3d | Python | 11,414 | 327 | import warnings
from collections import defaultdict
from collections.abc import Iterable, Mapping, Sequence
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scanpy as sc
import seaborn as sns
from anndata import AnnData
from matplotlib.axes import Axes
from mudata import MuData
from scipy.... |
4b5d506c8962919e3ad9d507d8ffc67df4e2f4b12da8efc76ac9ffe365535f0c | Python | 11,416 | 230 | """DO NOT EDIT.
This file was autogenerated. Do not edit it by hand,
since your modifications would be overwritten.
"""
from keras.src.ops.numpy import abs as abs
from keras.src.ops.numpy import absolute as absolute
from keras.src.ops.numpy import add as add
from keras.src.ops.numpy import all as all
from keras.src.o... |
656375df206645044161f214d4188e8391365e92a72178e21235f16180f97623 | Python | 11,417 | 268 |
import random as rd
import pprint
import mlflow
from types import FunctionType
from operator import itemgetter
def activate_param(param, attribute):
""" Evaluate what value should be evaluated coming from PARAMS structure
Inputs:
param: Is one of the keys defined in your param di... |
a15d66f1cd0ae5559a6cb1b405987d47ef4d124460cabee81835e94eb6d6c235 | Python | 11,418 | 286 | """Round-9 security regression: foreign import at load via appliance modules.
Both untrusted-deserialization gates treated EVERY ``torchlens.*`` submodule as
inert first-party code safe to import + inspect without a trust opt-in:
* ``SafeBundleUnpickler.find_class`` (``torchlens/_io/_safe_unpickle.py``) --
the ``to... |
5ba25bf36b40b08e0278d375f56a21d19175c6c1da8eeee0b9ccc471928c851c | Python | 11,420 | 299 | """
===============================================================================
Online Artifact Detection with Riemannian Potato Field
===============================================================================
Example of Riemannian Potato Field (RPF) [1]_ applied on EEG time-series to
detect artifacts in onli... |
2246bc75f00f64bb70ca37b0d6a0d23cb7fcdc29c874b94b6593313c171d70e8 | Python | 11,425 | 276 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Wrappers enclosing scripts which are invoked more than once
"""
import numpy as np
import pandas as pd
from pycircstat.descriptive import cdiff
from library.comput_utils import rcc_wrapper, get_tspdiff, calc_exin_samepath, acc_metrics
from scipy.ndimage import gaussia... |
e5e7fb515107270d3316a419b5a27633b732ef672e7082bd15025edd1030ca1d | Python | 11,426 | 288 | """W051-EXTRACT: resume identity defects (audit 2.10a / 2.10c / 2.10d).
(a) The D6 identity record measures ``state_dict()`` only, so same weights +
different hyperparameters resumed to a MIXED ``status=complete`` artifact;
the signature now carries a structural record compared on resume.
(c) The callable-iden... |
d916881e3773f89f9c98d439cbebfaf50fa3b03fe22591cb8845b7f15cf33e38 | Python | 11,427 | 277 | #!/usr/bin/python
#-*-coding:utf-8-*-
# Copyright (c) 2021 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use... |
564b7dcdb3295aee5dae766c24e511be29506b6611d5abac9e36877887a521d5 | Python | 11,429 | 344 | import os
import re
import numpy as np
import pandas as pd
from tqdm import tqdm
import torch
from transformers import AutoTokenizer
from irnlm.models.tokenizer import read_bpe
from irnlm.data.text_tokenizer import tokenize
from irnlm.models.gpt2.modeling_hacked_gpt2_integral import GPT2LMHeadModel
from irnlm.models.... |
d3a052ae328176e8fe49f24af3af1183acc0ca38a2e97e4b59488ef5fdb52080 | Python | 11,429 | 297 | import itertools
from typing import Tuple
import matplotlib.pyplot as plt
import numpy as np
from .support_function import *
def step1_basic_estimation(
noisy_img: np.ndarray,
param: Tuple[int, int, int, int, float, float, float, float, str],
mask: np.ndarray,
verbose: bool = False,
) -> np.ndarray:... |
375e56ade0daa664aa0d133e02d96731f58b830245b362227f820130583503ee | Python | 11,430 | 287 | """
===============================================================================
Online Artifact Detection with Riemannian Potato
===============================================================================
Example of Riemannian Potato [1]_ applied on EEG time-series to detect
artifacts in online processing. It ... |
e9b6c1986fd38ddbf13b618e0cb54b61e784f337503e21cac890e8ea8460f166 | Python | 11,436 | 268 | """
This module contains nonlinear solvers used in time stepping.
At the moment this is simply Newton's method.
"""
# Spitfire - a Python-C++ library for building tabulated chemistry models and solving differential equations
# Copyright 2019 National Technology & Engineering Solutions of Sandia, LL... |
8f64d9ddb4b4032f106e6046d9801c93461b7d0f444d144392bd37955df422d5 | Python | 11,437 | 248 | import numpy as np
import os
import sys
import ntpath
import time
from . import util, html
from subprocess import Popen, PIPE
# try:
#from func_timeout import func_timeout, FunctionTimedOut
# except ImportError:
# print("module func_timeout was not installed. Please install func_timeout using pip install func-timeou... |
b120b0abb2f38a0275a50b31060028765bdc72bcde41a3ef2fd2bbf6215a21d0 | Python | 11,437 | 268 | from typing import Dict, List
import numpy as np
import imodels
import imodelsx.augtree.llm
from imodelsx.augtree.embed import EmbsManager
from imodelsx.augtree.stump import Stump, StumpClassifier, StumpRegressor
import logging
import warnings
from sklearn.base import BaseEstimator, ClassifierMixin, RegressorMixin
cla... |
aba2da18c8b8a63366da366fc0dd66d32d0139a1de58952beda99a3457c0a143 | Python | 11,449 | 265 | from pathlib import Path
from IPython.core.display import display
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import mne
import mne_connectivity
from tqdm.notebook import tqdm
import pandas as pd
import statsmodels.api as sm
import statsmodels.formula.api as smf
from scipy.stats import pea... |
a72bdb17fe78de52a1d5571e6c33c324ddf247ac70d4e8c863247d00963a8ca9 | Python | 11,453 | 338 | import abc
from types import SimpleNamespace
import typing
from rpy2.robjects.robject import RObjectMixin
import rpy2.rinterface as rinterface
from rpy2.rinterface import StrSexpVector
from rpy2.robjects import help as rhelp
from rpy2.robjects import conversion
_get_exported_value = rinterface.baseenv['::']
getmethod ... |
cedf4c613c290160bcd83cdea2829d4e29352f1126be9268883d9fb8fc9496ce | Python | 11,462 | 346 | import pycocotools.mask as mask
import numpy as np
import shapely
from shapely.geometry import LineString, Point
from database import (
fix_ids,
ImageModel,
DatasetModel,
CategoryModel,
AnnotationModel
)
def paperjs_to_coco(image_width, image_height, paperjs):
"""
Given a paperjs Compound... |
2db10e3cd7912019553d96f2c3704fdf09cad85086161e30ffc827676df1596b | Python | 11,463 | 285 | """Snapshot equality tests for module-containment metadata."""
from __future__ import annotations
import inspect
import json
import os
import re
from pathlib import Path
from typing import Any
import pytest
import torch.nn.functional
from _module_containment_snapshot import build_snapshot
from _oracle_env import (
... |
5fc1adf33f22592890bfe18f7ba2b662c4345fa201894ab7f05a802f932344e0 | Python | 11,464 | 408 | '''
File: data_distribution.py
Project: data_distribution
Created Date: 2023-10-07 08:43:33
Author: chenkaixu
-----
Comment:
This is a python file for valize the data distribution.
Here we use the TSNE to valize the data distribution.
The dataset is used the split_pad_dataset_512。
Have a good code time!
-----
Last Mod... |
6aa2a6138675599d822254ee8397251d33e39ee6911cb1da7b70c17ef83da8c1 | Python | 11,465 | 271 | """Cross-run selection alignment (L6 stage 4a).
``ResolvedSelection.align_to(target)`` re-binds a selection resolved on
trace A onto trace B, keyed on the L1 STRUCTURAL SITE KEYS (``op.site_key``,
``site_key_v1``) that every ACT :class:`~torchlens.selection.SiteEntry`
records as its bridging relation. This is the sanc... |
954d054cda1fbe2c23f640438bcc90179aeb4ab84e7f87ca34aa97c686283828 | Python | 11,465 | 299 | """ Code to fine-tune hugging-face implementation of GPT2 model.
https://huggingface.co/
"""
import warnings
warnings.simplefilter(action="ignore")
import os
import gc
import glob
import logging
import argparse
import pandas as pd
from transformers import (
AdamW,
GPT2Config,
get_linear_schedule_with_war... |
a20789c449c3308391899bf7c2c5b27c15f965f0085b8fc9d64adc957e6cf9c0 | Python | 11,465 | 254 | import torch
import torch.nn as nn
import numpy as np
import torch.nn.functional as F
from external_src.group_free_3D.pointnet2 import pointnet2_utils
class PointsObjClsModule(nn.Module):
def __init__(self, seed_feature_dim):
""" object candidate point prediction from seed point features.
Args:... |
6da00b6bf36f31479b6a141cdeb7ae843bc81eb787174117b7be9c7d7a2867e9 | Python | 11,466 | 284 |
import os
os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
os.environ['CUDA_LAUNCH_BLOCKING'] = '1'
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import init
from torch.utils.data import TensorDataset, DataLoader
import numpy as np
import matplotlib.pyplot as plt
import scipy... |
ec7bf0d25a88c036f312fdeaa26b749a0f99e206f3a33c1d8993337e97f06d34 | Python | 11,470 | 278 | import torch
import torch.nn.functional as F
from bioseq2seq.translate.decode_strategy import DecodeStrategy
def sample_topp(logits, keep_topp):
sorted_logits, sorted_indices = torch.sort(logits,
descending=True,
dim=1)... |
4f2342036d96353bdc460689f3948ea77d465cfab2ec7619196f2957a32b3789 | Python | 11,471 | 342 | """Tests for class-agnostic TorchLens state adapter helpers."""
from __future__ import annotations
from typing import ClassVar
import pytest
import torch
from torchlens._io import FieldPolicy, TorchLensIOError
from torchlens._io.runnable import assert_sparse_core_has_no_tensor_payload
from torchlens._io.scrub impor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.