sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
10abb023ac21d74824fbdbe085981ea72212a7b384df050f0b6cb5d250d7c0df | Python | 13,882 | 436 | import typing
import skimage.measure
import pandas as pd
import numpy as np
import pd_detector.utils
import pd_detector
def hilo_dynamic_auto6(
seg: np.ndarray,
Fs: float,
thresh_hi: float,
thresh_lo: float,
smooth_win: float,
freq_lo: float,
freq_hi: float,
channel_labels: typing.Li... |
153104c67116b2e67c7455eb27fad66d5aa674a2426a70bcc91f150bd4b59150 | Python | 13,882 | 399 | from collections import defaultdict
import click
import os
import pandas as pd
import nibabel as nib
import numpy as np
import deepdish as dd
import matplotlib.pyplot as plt
import seaborn as sns
import scipy.stats as ss
from connectivity import weights as cweights
from connectivity import visualize as summary
from ... |
fc2bc306d82d036893834f416ca8e0b6a927731898060e7fecdf9c249e9c7b21 | Python | 13,882 | 297 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/deepseek_vl_hybrid/modular_deepseek_vl_hybrid.py.
# Do NOT edit this file manually as any edits will be overwritt... |
5ffb375ed5174a484893506af87f826681d020d7bc03ba7d39e05cbb5f771d3b | Python | 13,887 | 427 | # Copyright (c) 2026 ByteDance Ltd. and/or its affiliates.
# SPDX-License-Identifier: Apache-2.0
"""Sparse indexing Jacobian behavior."""
import logging
import operator
import jax
import jax.numpy as jnp
import numpy as np
import pytest
from jaqmc.laplacian import (
LapTuple,
Local1Jacobian,
Local2Jacob... |
6da8df91ad38f9302c8e41cd91da5828b82c3aa19edb6300d20acf4b2e4e0676 | Python | 13,902 | 319 | # Copyright 2025 NVIDIA CORPORATION and 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
#
... |
cff0bf27afc7549e2e5b3a0e0cd86fb41e1be3d16d791e379fab8c61cf887fda | Python | 13,906 | 417 | """
04_check_sbref_bold_dtype.py
--------------------------------------
Check that sbref and bold NIfTI files have matching dtypes for each sub/ses.
For each run, reads the NIfTI header of the sbref and its paired bold and
compares the datatype code. A mismatch means fmriprep will build hmc_boldref
from the sbref (co... |
dd7c22cec15a0577658c3be51f14184dc39702f87244a892bd57ca907f33eae6 | Python | 13,907 | 369 | from copy import copy
from math import sqrt
from typing import Optional
import torch
from tqdm import tqdm
import matplotlib.pyplot as plt
import networkx as nx
from torch_geometric.nn import MessagePassing
from torch_geometric.data import Data
from torch_geometric.utils import k_hop_subgraph, to_networkx
import numpy... |
d384982eb6034330c20f62bf5105df999d60538ea9600101525c489d76d63103 | Python | 13,910 | 302 | # Copyright 2023 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 applicab... |
65d189bf818b9ec733d5496d99ce45ab86a06f9b58febd2bcb27db02691b1335 | Python | 13,914 | 341 | """MXNet modules for graph attention networks(GAT)."""
# pylint: disable= no-member, arguments-differ, invalid-name
import math
import mxnet as mx
from mxnet.gluon import nn
from mxnet.gluon.contrib.nn import Identity
from .... import function as fn
from ....base import DGLError
from ....utils import expand_as_pair
f... |
2f7960633758ec61af9bbd6f8fbbccdf1a68bea212ec85c47d56ba86d197fbb8 | Python | 13,919 | 378 | #!/usr/bin/env python3
from __future__ import annotations
import json
import pickle
import shutil
from pathlib import Path
from nnunet_common import (
append_log,
fold_dir,
fold_final_checkpoint_path,
fold_latest_checkpoint_path,
fold_validation_summary_path,
nnunet_env,
nnunet_paths,
... |
4b8e48b143c0cb0c8e95fc2ffd97cbd59cdb386bf7ceca7a6f9e5ab72a6febf7 | Python | 13,925 | 263 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/deimv2/modular_deimv2.py.
# Do NOT edit this file manually as any edits will be overwritten by the generation of
... |
cd189205cb1f8f047f07be5e27777e93f70400814e3d704d8010071a24cb6286 | Python | 13,934 | 376 | """
==================
Subprocess handler
==================
"""
import os
import sys
import socket
import logging
import subprocess
import importlib.util
from urllib import request
from queue import Queue, Empty
from contextlib import closing
from typing import TypeVar, Optional
from PySide6.QtWidgets import QApplic... |
a54dfbfcb1cfd799da3f3d8eb8b772f2840ec75ed657105e6f87d0c1757fedc3 | Python | 13,937 | 432 | import pickle
import logging
import json
from typing import Optional
import numpy as np
from kafka import KafkaProducer
from openbci_stream.utils import interpolate_datetime
from bci_framework.extensions import properties as prop
# from .utils import loop_consumer, fake_loop_consumer, thread_this, subprocess_this, m... |
04cffd194411787971123a016eb654ea39cdbb5002c543609869cdbce3679e95 | Python | 13,942 | 306 | import hashlib
import itertools
import json
import logging
import os
from functools import lru_cache
from typing import Any
import torch
from transformers.distributed import DistributedConfig
from transformers.generation.configuration_utils import CompileConfig
from transformers.utils import is_torch_accelerator_avai... |
52a9636d7afaa42e347ff69cc7bd27cb5b463785d75a41ad85c994923c059ea1 | Python | 13,948 | 397 | import os
import threading
import numpy as np
import slideflow as sf
import multiprocessing as mp
from queue import Queue
from functools import partial
from typing import Union, Optional, Tuple
from tqdm import tqdm
class _StridedQC:
def __init__(
self,
tile_px: int,
tile_um: Union[str, ... |
40545340a144aad4d74c6cedb4eae5daa4efd54ae432649583e19b5d756c02c7 | Python | 13,988 | 297 | # 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, s... |
b1a31e414a994d2ce5cb26a2093a5a4437dba1db218de210b4c8145f8ed8f2ad | Python | 13,993 | 396 | # Copyright 2026 The Jina-AI and HuggingFace Inc. teams. 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 r... |
a9cfe48c6d46eef5b6e774b5b8a652ccc06cc7ded0be0083d614de987228335c | Python | 14,001 | 420 | """
Voltage topography and CSD-based spatial localization for LPD/GPD.
Compares 4 methods on multi-rater segments:
1. CNN+PLV (current) -- from PDProfiler
2. Voltage at peak -- mean discharge voltage topography -> regions
3. CSD at peak -- CSD of mean discharge voltage -> regions
4. Hybrid CNN+CSD -- a... |
0c01b7facb11a90e3be84fdf9cdef16ba948edbd555a8f7fe12c992c1bceba26 | Python | 14,002 | 321 | # Copyright 2025 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... |
10eb0e515f4209e5c1bf15fc23a3a3367952cdfa5f33986e687d96ab8cfb4bfb | Python | 14,013 | 328 | import numpy
import matplotlib.pyplot as plt
def avg_and_rms(x):
N = len(x)
avgx = numpy.mean(x)
rmsx = 0
for i in range(N):
rmsx += (avgx-x[i])**2
rmsx = numpy.sqrt(rmsx/(N-1))
return avgx,rmsx
def manual(filename,idelay,idur,spikedurat):
"""Manual approach"""
... |
a4e3abd2b55565b516933a2047ff5ab6c95bbbaac3936a1eb37002752ccc80a1 | Python | 14,014 | 398 | """Round 4 contest methods — 8 new approaches targeting identified gaps.
Methods:
- FOOOF peak height above aperiodic background
- PCA delta dominance (first principal component)
- Half-segment frequency stability
- Wiener entropy (spectral flatness)
- Ensemble/channel disagreement
- ACF at multiple lags
... |
edda7e71d0dc390c8b942bd5c5e74a81f4d2fc9caf588b370e3530376c6f8dd5 | Python | 14,022 | 450 | # Copyright (c) 2026 ByteDance Ltd. and/or its affiliates
# SPDX-License-Identifier: Apache-2.0
from typing import cast
import numpy as np
import pytest
from jax import numpy as jnp
from jaqmc.app.solid.reference import PlaneWaveSolidReference, SolidReference, qe
from tests.app.solid.reference.helpers import (
_... |
f2e7719ec934a1780948c434c17403138acd6c2950aa69c7ab13e91ed9c0a68f | Python | 14,025 | 348 | #!/usr/bin/env python3
"""Ingest the independent expert v1 annotation results into labels.csv.
Reads the raw JSON exports under
data/labels/raw_inputs/independent_expert_v1/{SZ,TZ}/
(one set of four files per rater, plus a 400-entry combined RDA file
for SZ -- see the README in that folder) and appends rows to
d... |
1fc103b2ae1a1b114037ac0fcb3dc5a217cfbb3ba1599a0e446e72ee74d2519e | Python | 14,031 | 434 | import math
from typing import Optional, Tuple, Sequence, Type
import numpy as np
import scanpy as sc
import anndata as ad
import pandas as pd
from torch.utils.data import Dataset, DataLoader
from torch import nn
import torch
import torch.backends.cudnn as cudnn
import torch.optim as optim
from sklearn.neighbors import... |
c4e3b6452c090839bc2e9520ddebcc7bebbb714effc762ac2b583e41c212ae1a | Python | 14,047 | 433 | """NN modules"""
import dgl.function as fn
import dgl.nn.pytorch as dglnn
import torch as th
import torch.nn as nn
from torch.nn import init
from utils import get_activation, to_etype_name
class GCMCGraphConv(nn.Module):
"""Graph convolution module used in the GCMC model.
Parameters
----------
in_fe... |
71756e31186a0c79002c5575ce350cb33f8cc918722a5dff548bf60fd3d69a1d | Python | 14,050 | 386 | import ast
import os
from typing import Callable, List, Optional
import numpy as np
import pandas as pd
import pydantic as dt
import yaml
from .. import backend as F
from ..base import dgl_warning, DGLError
from ..convert import heterograph as dgl_heterograph
class MetaNode(dt.BaseModel):
"""Class of node_data ... |
af7332fe6a4347f2154597f0e44440bb97e51e23f05385e3ef7b5dec13f9db15 | Python | 14,051 | 329 | import numpy
import matplotlib.pyplot as plt
def avg_and_rms(x):
N = len(x)
avgx = numpy.mean(x)
rmsx = 0
for i in range(N):
rmsx += (avgx-x[i])**2
rmsx = numpy.sqrt(rmsx/(N-1))
return avgx,rmsx
def manual(filename,idelay,idur,spikedurat):
"""Manual approach"""
... |
7807883724becb594abc56b50686a31117a7a4142c9b1a10e43bdcf5c60827b9 | Python | 14,065 | 305 | # Copyright 2024 The HuggingFace Inc. 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 ... |
f0ee8de8ae915abb0c0b0bdcc14d2d9a1959762448ec35be3f0914f9806b3d9e | Python | 14,080 | 320 | # Copyright 2025 The HuggingFace Inc. 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 t... |
0021c442ddacb7d5149a33fe77f47cd86b78258f57da085396b32c22dbdf06a9 | Python | 14,081 | 442 | import os
import tempfile
import time
import unittest
import warnings
import backend as F
import dgl
import dgl.ndarray as nd
import numpy as np
import pytest
import scipy as sp
from dgl.data.utils import load_labels, load_tensors, save_tensors
np.random.seed(44)
def generate_rand_graph(n):
arr = (sp.sparse.ra... |
9656ce23f960da78c1eaab4b25d5e1d79249f5797ab175d295b3bee36f119f52 | Python | 14,082 | 347 | """
Combination experiments: test combinations of the top-performing approaches.
Combos tested:
1. combo_acfthr010_peakcount: ACF thr=0.10, average ACF freq with peak-count freq
2. combo_acfthr010_subharm: ACF thr=0.10 + subharmonic correction (L/2,L/3,L/4 @ 0.3)
3. combo_acfthr010_peakcount_bayesian: combo#1 + Bayesi... |
572d35cb12301750acf617d86b302e39c5d4a260287c78342b5bab01e97525cd | Python | 14,084 | 378 | #!/usr/bin/env python3
"""
DICOM Symlink Organizer
-----------------------
Reorganizes DICOM data by creating symlinks with a standardized structure.
Part of the MRIworkflow project.
Create from src: dcm folder
to targ: project/dicom folder with structure: sub-xx/ses-yy
This script is used to create symlink from pr... |
6e1f8c19639adc2280683817b5df7592059a133e2c0c7ade2332544ce83536e0 | Python | 14,085 | 428 | """Heterograph NN modules"""
from functools import partial
import torch as th
import torch.nn as nn
from ...base import DGLError
__all__ = ["HeteroGraphConv", "HeteroLinear", "HeteroEmbedding"]
class HeteroGraphConv(nn.Module):
r"""A generic module for computing convolution on heterogeneous graphs.
The he... |
edbf76cc62dadbcce2303b58fbd77d39035bd03098683549b7aa642c443f0ba3 | Python | 14,085 | 383 | """
Experiment: Multi-scale pointiness + harmonic-aware ACF peak selection.
Tests:
r2_multiscale_best - pointiness at half_win=4,8,12,16; pick scale with highest ACF peak
r2_harmonic_aware - half_win=8, ACF all peaks, score = height/lag (favors fundamental)
r2_harmonic_penalty - ACF all peaks, check ... |
a9b5e84f5aa1373d4cb4914e863b6e2c80709b4320d3e75dfdb2b6b5cfa8a0a0 | Python | 14,098 | 386 | import os
import time
import sys
import tensorflow as tf
from numpy.random import seed
import numpy as np
import yaml
from gradient_utility import gradforceop_triplNODEN
from gradient_utility import gradforceop_rNODEN
from gradient_utility import grad_twobody_par
from gradient_utility import grad_threebody_par
from... |
7e1ed40f0d210c4317ab4c368aff87ab7e640bf21418e23186b04079cdc4e2c1 | Python | 14,118 | 384 | """Modules that transforms between graphs and between graph and tensors."""
import torch.nn as nn
from ...transforms import knn_graph, radius_graph, segmented_knn_graph
def pairwise_squared_distance(x):
"""
x : (n_samples, n_points, dims)
return : (n_samples, n_points, n_points)
"""
x2s = (x * x)... |
dc905a328e4b37526d0a454bd5eef60ae0265e8ef030691660ef3ffb31d90835 | Python | 14,123 | 357 | """
Experiment T1: Expanded feature sets beyond the 6 base SP features.
New features:
1. f_hps: Harmonic Product Spectrum on pointiness trace
2. f_fft_car: FFT on pointiness of CAR-referenced data
3. n_detected: Number of channels with valid ACF periodicity
4. f_range: Range of per-channel FFT frequency estima... |
57c37fadc8f9a8930bb4230bbbe6ab3150187169618b9cb98fbde4cbf7d42ad7 | Python | 14,158 | 331 | import numpy
import matplotlib.pyplot as plt
def avg_and_rms(x):
N = len(x)
avgx = numpy.mean(x)
rmsx = 0
for i in range(N):
rmsx += (avgx-x[i])**2
rmsx = numpy.sqrt(rmsx/(N-1))
return avgx,rmsx
def manual(filename,idelay,idur,spikedurat):
"""Manual approach"""
... |
7ec408fc58a18a05c22674c32480b46e899929a9240b5ea3d04004207cf2951b | Python | 14,161 | 459 | """
Data utils for processing bAbI datasets
"""
import os
import string
import dgl
import torch
from dgl.data.utils import (
_get_dgl_url,
download,
extract_archive,
get_download_dir,
)
from torch.utils.data import DataLoader
def get_babi_dataloaders(batch_size, train_size=50, task_id=4, q_type=0):... |
44e72b3bcf095bf1b7c942dfe93941e3c0a0f880faa068a94b395b0f17275a67 | Python | 14,171 | 326 | # Copyright 2024 The HuggingFace 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 applicabl... |
c23352595092ae7e19740b799a07358dee7610e731b2d0dee828cba8f401848c | Python | 14,178 | 283 | import sys, os
CURRENT_SRC_DIR = os.path.dirname(os.path.realpath(__file__))
sys.path.append(CURRENT_SRC_DIR + "/../../slayerPyTorch/src")
import math
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from . import slayer
import slayerCuda
import slayerLoihiCuda
from .... |
37c6a0206f7284867af4994cfd1f66a9e0e8e77bbc1ad9968adcecbd1692b17b | Python | 14,182 | 411 | """
Classes for DICOM session and protocol checking.
"""
from pathlib import Path
from typing import List, Optional, Set, Tuple
from dataclasses import dataclass, field
import re
from launchcontainers.log_setup import console
@dataclass
class ProtocolCheck:
"""Results for a single protocol/series."""
proto... |
4cdb01edf89359f9b36db0c8cb048968a6ff6d63a85881d56f41cbb65e3ae64f | Python | 14,190 | 354 | # Copyright 2024 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... |
0fcffef874520102f8da0e2d4f766299f88e959849e165889bf43995d259273d | Python | 14,212 | 343 | #!/usr/bin/env python3
"""
Figure optimization loop using Gemini as visual critic.
Iteratively improves figure generation scripts by:
1. Rendering current figures
2. Sending to Gemini for visual critique
3. Rewriting the code based on feedback
4. Re-rendering and repeating
Supports multiple figure groups: characteriz... |
b54ca0be688cd302ff3c034eebe33abf637e0d21811cb2963ba19f7ca7fb17aa | Python | 14,216 | 369 | #!/usr/bin/env python
import pkgutil
import threading
import click
import numpy as np
import glfw
import OpenGL.GL as gl
import OpenGL.GL.ARB.texture_float
from os.path import dirname, realpath, join
from PIL import Image, ImageFont
from contextlib import contextmanager
from functools import lru_cache
from os.path im... |
fcaa482fe6f1866d15b22edc2c82cb0145a7bf4063df6d4eed1b4fc67e9ae77f | Python | 14,219 | 342 | '''
Class and forward pass definitions for various neural network models.
'''
import os
from collections import OrderedDict
import tensorflow as tf
slim = tf.contrib.slim
cudnn_rnn = tf.contrib.cudnn_rnn
CUR_DIR = os.path.dirname(os.path.realpath(__file__))
MODELS_DIR = os.path.join(os.path.dirname(CUR_DIR), '../n... |
4ba715dfada8325015ff3866385b1bbe99c967a28c6be108689097a49fd6fd3e | Python | 14,225 | 361 | #
# Copyright (c) 2022 by Contributors
#
# 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 ... |
0e976fa268eca91f748bcc4bd68e198ccf77270614b8725cd1e38678f9f0d085 | Python | 14,238 | 389 | from datetime import datetime
from functools import cached_property
import matplotlib.pyplot as plt
import numpy as np
from .utils.numeric import _to_numeric_array, largest_triangle_three_buckets
from .utils.visualization import (
_plt_add_ax_connected_top,
_plt_ax_to_pix,
_plt_setup_fig_axis,
_plt_sh... |
1a50a95926e5ab73fd3c78a7a183c7aeb2ead4f95288ea9b347179e6cb9925f6 | Python | 14,239 | 414 | from itertools import product
import backend as F
import dgl
import dgl.function as fn
import networkx as nx
import numpy as np
import pytest
from utils import get_cases, parametrize_idtype
def udf_copy_src(edges):
return {"m": edges.src["u"]}
def udf_copy_edge(edges):
return {"m": edges.data["e"]}
def ... |
235bfefdf68b86406ac57d9d4a6e1869fea783fab345c8e99d88390dfe7c9d65 | Python | 14,243 | 411 | # Copyright (c) 2024-2026 ByteDance Ltd. and/or its affiliates
# SPDX-License-Identifier: Apache-2.0
'''
A show case for LapNet with PH and ECP.
LapNet: https://github.com/bytedance/LapNet
'''
import sys
import time
from typing import Sequence, Tuple
from absl import app, logging
import jax
import jax.numpy as jnp... |
2ba5d240a2093ca764c262ed9e65f31477e9a3ebf36a6548631fe729f1cbef47 | Python | 14,255 | 323 | # Copyright 2021 VinAI Research and the HuggingFace Inc. 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 applic... |
42ea747f4c8ce068b77080fbc85805c01735bb59e981d0557fe52d75a9171ef9 | Python | 14,255 | 431 | from pathlib import Path
import flammkuchen as fl
import numpy as np
from bouter import EmbeddedExperiment
from lotr.behavior import get_fictive_heading
from lotr.data_preprocessing.anatomy import reshape_stack, transform_points
from lotr.data_preprocessing.stimulus import get_all_trials_df
from lotr.default_vals imp... |
959392ff2767b50e4b2f2541b1306b475bc2eb96b4962461363c5ea157a170e4 | Python | 14,262 | 373 | import os
import os.path as osp
import numpy as np
from PIL import Image
import cv2
import skimage
from parc import IO
def parse_data(dir_data: str, time_steps: int, del_t: int) -> np.ndarray:
"""parse the raw data and return numpy arrays with microstructure images and temp/pressure outputs
Args:
dir... |
100c5801027f028db456e440b480d31c5c1ae74b65354de672957ac9cae7c5de | Python | 14,275 | 339 | # Copyright 2026 IBM and 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... |
571e7c6f0a54189b07bf9926e1e4eda5dfa7ecf7550187e7726b7fab5b46330e | Python | 14,282 | 418 | import argparse
import socket
import time
from contextlib import contextmanager
import dgl
import dgl.distributed
import dgl.nn.pytorch as dglnn
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import tqdm
def load_subtensor(g, seeds, input_node... |
4f5925e226c87c37ea1065b3f0543adba342c898b9f68c33d93ab6181da8272c | Python | 14,284 | 303 | """
Functions needed to prepare the input fasta for Alphafold2 modeling.
Author: Xiaozhe Ding
Email: xding@caltech.edu, dingxiaozhe@gmail.com
"""
import os
import pandas as pd
import numpy as np
from appraise.modeling_backends import (
backend_supports_multichain_native_inputs,
save_modeling_input,
)
def sa... |
64b7416292efd2fc16a804db3ce61de370378174feb16b461cdebfa329eac4a0 | Python | 14,299 | 392 | from .aorticarcharteries import (
aorta_generator,
brachiocephalic_trunk_static,
left_common_carotid,
left_common_carotid_II,
left_subclavian,
left_subclavian_IV,
left_subclavian_VI,
right_common_carotid,
right_common_carotid_V,
right_common_carotid_VII,
right_subc... |
aaadb437e5e133fe417935bf82acfb6f1abf5f4608409ee7549c788d025275a1 | Python | 14,303 | 364 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from examples/modular-transformers/modular_multimodal2.py.
# Do NOT edit this file manually as any edits will be overwritten by the generation... |
af8bc5a3b77626f032f97560561855cc711b31fcd79312bc250a4dcc91fdd702 | Python | 14,315 | 420 | """Datasets used in How Powerful Are Graph Neural Networks?
(chen jun)
Datasets include:
MUTAG, COLLAB, IMDBBINARY, IMDBMULTI, NCI1, PROTEINS, PTC, REDDITBINARY, REDDITMULTI5K
https://github.com/weihua916/powerful-gnns/blob/master/dataset.zip
"""
import os
import numpy as np
from .. import backend as F
from ..conver... |
f950c9dda2c5100ac5de5cbe98f7dd0b0fe396baa72863cbbf374bb7e161abb9 | Python | 14,325 | 447 | import tensorflow as tf
import keras
class PARC(keras.Model):
def __init__(
self, input_size, n_fields=2, n_timesteps=19, n_featuremaps=128, **kwargs
):
super(PARC, self).__init__(**kwargs)
self.n_fields = n_fields
self.n_timesteps = n_timesteps
self.n_featur... |
a62278bac8243c3203a1b0504a1dd3bc33953a2f0b39ece022b361f3a843de65 | Python | 14,327 | 447 | import tensorflow as tf
import keras
class PARC(keras.Model):
def __init__(
self, input_size, n_fields=2, n_timesteps=19, n_featuremaps=128, **kwargs
):
super(PARC, self).__init__(**kwargs)
self.n_fields = n_fields
self.n_timesteps = n_timesteps
self.n_featur... |
c66115938208259f03d7f488d60ab084a94b91790fa15d00640f50a79f812dc5 | Python | 14,327 | 402 | """V4 Unified Methods — simultaneously estimate classification, lateralization, and frequency.
Each method processes hemispheres independently and returns:
left_score, right_score — RDA strength per hemisphere (for lateralization + classification)
left_freq, right_freq — estimated frequency per hemisphere
... |
c4438b0d442ed62a0304812f41515066db8d5991548adef8a40402c9a353b731 | Python | 14,334 | 319 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkimagereader.py,v $
## Language: Python
## Date: $Date: 2006/05/22 08:33:12 $
## Version: $Revision: 1.16 $
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENSE file for details.
## This software is dist... |
cd2c5f78472178f5a81e0f976c226cbb23e8b0e48dd1ffe47a6ecbc98fdfba7a | Python | 14,336 | 322 | """
Contains a class that takes the dataset's possible positions and a few path-related options,
and creates train, validation, and test paths for the tracking experiments
"""
import os
import logging
import hashlib
import pickle
import numpy as np
from tqdm import tqdm
PI = np.pi
class PathCreator():
""" Creat... |
2e842f4a1586a89c8bcb21e9f510773fb72df1af3b34c0ca9bfd052dcac27c35 | Python | 14,357 | 398 | # Copyright 2021 AlQuraishi Laboratory
#
# 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... |
4912d8c1ea8f3b61e457d9e718ea37327a4b1c355f28d998f96cb65fcf4357d8 | Python | 14,366 | 312 | # Copyright 2021 The Facebook AI Research Team Authors and The HuggingFace Inc. 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
#
# Un... |
16a40cf6949f51897186fd23cf231ef114da64d9b2681492b5760008e3141fae | Python | 14,371 | 425 | """Implementation for core graph computation."""
# pylint: disable=not-callable
import numpy as np
from . import backend as F, function as fn, ops
from .base import ALL, dgl_warning, DGLError, EID, is_all, NID
from .frame import Frame
from .udf import EdgeBatch, NodeBatch
def is_builtin(func):
"""Return true if ... |
7875e934a67fb8fe1a54d16e95621c74c973db8f34ff0c3bbf20dd5262ba3f5a | Python | 14,372 | 411 | """Factory for building PyTorch feature extractors."""
import inspect
import slideflow as sf
from tqdm import tqdm
from typing import Tuple, Generator, Optional, TYPE_CHECKING
from slideflow import errors
from ._slide import features_from_slide
from ._registry import _torch_extractors, is_torch_extractor, register_to... |
9761340e0ea21507c3d09c5503e66937fa925c4deb00588cc948c2671c8e8197 | Python | 14,379 | 450 | # coding=utf-8
# Copyright 2020 The SimCLR 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 applicable law or... |
d1569c571c719ae68568b12eb38b9f439694657284152e18b18ebfbf2611a574 | Python | 14,381 | 374 | # Copyright 2025 The HuggingFace 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 applicabl... |
9a5a6d83b1297a3333882a3834e0cf1da5e21469c01ad089f9828fff724840f3 | Python | 14,394 | 424 | from collections import defaultdict
import rdkit.Chem as Chem
from rdkit.Chem.EnumerateStereoisomers import EnumerateStereoisomers
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import minimum_spanning_tree
MST_MAX_WEIGHT = 100
MAX_NCAND = 2000
def set_atommap(mol, num=0):
for atom in mol.GetAtom... |
0726355097cde41e2d81daccaa1395185c741024d9ba29996b41dfd533cfe695 | Python | 14,400 | 342 | import os
import numpy as np
import pandas as pd
import imgui
import slideflow as sf
import multiprocessing as mp
import matplotlib.pyplot as plt
import matplotlib.image as mpl_image
from os.path import join, exists, dirname, abspath
from slideflow import log
from PIL import Image
from io import BytesIO
from tkinter.fi... |
a335f4a7cbcb30d79c94190fdeceb5c9d91f0dfc1a75c38c944482e47751d20b | Python | 14,400 | 295 | # ========== Packages ==========
import mne, os
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.ticker as tick
import pandas as pd
from statannotations.Annotator import Annotator
from basic.stats import apply_stat_test
# ========== Functions ==========
def plot_topomaps_band(df_psd_ch,epochs,b_... |
9495788e2a943a297b3168fe0ba791de3ce3ba566f76a960988ebd5be52183c4 | Python | 14,417 | 335 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 8 14:41:57 2022
@author: nelab
"""
import torch
from torch import nn
import pytorch_lightning as pl
import torchmetrics
from Utils.cutmix_3d import CutMixCriterion
from sklearn.metrics import roc_auc_score
GPUS = torch.cuda.device_count()
class ... |
7cd617b7e97916941542693d0c4d688fa314cd5532788298cd75128c8d552be9 | Python | 14,442 | 296 | """ QM9 dataset for graph property prediction (regression) """
import os
import numpy as np
from .. import backend as F
from ..convert import graph as dgl_graph
from .dgl_dataset import DGLDataset
from .utils import _get_dgl_url, download, extract_archive
class QM9EdgeDataset(DGLDataset):
r"""QM9Edge dataset ... |
e6a1cdaa339dae7b097596bcad8bb5050d4d2971cf7f26c738e4853c4b6c7eb2 | Python | 14,445 | 356 | import numpy as np
import imgui
import glfw
import OpenGL.GL as gl
from typing import Optional, List, Tuple, Union
from .imgui_utils import input_text
from ..gui import gl_utils
from ..gui.viewer import SlideViewer
# -----------------------------------------------------------------------------
class AnnotationCaptur... |
33391bfc99902b4cc8ddb93a12b3960df6891ae1d72be2b6cd7eb03572661c1c | Python | 14,447 | 306 | # Copyright 2023 The HuggingFace Inc. 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 ... |
58281823f5086b122b5752b607150030e1a4773fb1d89bf6f327c7fc54ee4d76 | Python | 14,448 | 395 | import math
import os
import random
import time
import dgl
import dgl.function as fn
import numpy as np
import scipy
import torch as th
from dgl.sampling import pack_traces, random_walk
from torch.utils.data import DataLoader
# The base class of sampler
class SAINTSampler:
"""
Description
-----------
... |
c44fa6373fff621a617ec0e6757065a24e21fed1dec109e4755175728f8af066 | Python | 14,448 | 369 | """
Generate Fig 0 (Figure 1 in paper): Six raw EEG examples for the introduction.
A 3x2 grid showing clear and ambiguous IIIC patterns:
Row 1: Clear LPD (A), Clear GPD (B)
Row 2: Clear LRDA (C), Clear GRDA (D)
Row 3: Ambiguous LPD (E), Ambiguous mixed (F)
Each panel shows 10 seconds of raw EEG in bipolar banan... |
191f94c1b21611a55802210db99068ce57b18b0f2b083b6cae89bbd071e05a50 | Python | 14,456 | 443 | import math
import os
import sys
import time
from collections import defaultdict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from numpy import random
from torch.nn.parameter import Parameter
from tqdm.auto import tqdm
from utils import *
import dgl
import dgl.function as fn
... |
9057a8e6c69bd6ab5321afd6a6cd89cd3f402edc10bad8765637f26a680bc865 | Python | 14,458 | 312 | import pydicom as dcm
import numpy as np
import os
import pandas as pd
from PIL import Image
import cv2
from scipy.signal import find_peaks, savgol_filter
import argparse
def make_timeseries(filepath):
"""
This function opens a DICOM echocardiography, converts it to grayscale, crops so only image information i... |
68822a81da409dcc41bf85b3273c7f12136f0a4366a043aa1826a81529d3872e | Python | 14,463 | 369 | """
Generate Fig 0 (Figure 1 in paper): Six raw EEG examples for the introduction.
A 3x2 grid showing clear and ambiguous IIIC patterns:
Row 1: Clear LPD (A), Clear GPD (B)
Row 2: Clear LRDA (C), Clear GRDA (D)
Row 3: Ambiguous LPD (E), Ambiguous mixed (F)
Each panel shows 10 seconds of raw EEG in bipolar banan... |
1b9bd85af6f58da17c158060ad5ab7310ec1e8e37e73a158f584b3209a914578 | Python | 14,466 | 374 | """
Active learning: select most informative external segments for expert annotation.
Computes 5 frequency estimates per segment, selects the most uncertain (highest
inter-method disagreement) per patient, then picks top 50 LPD + 30 GPD candidates.
Run: conda run -n foe_dl python code/dl/select_for_annotation.py
"""
... |
0c89bb4b1f815389748239dcb7f2d3134cb5bdebdb2faf65b30a619dd1deaf31 | Python | 14,472 | 422 | """Macenko H&E stain normalization."""
from __future__ import division
import cv2
import numpy as np
from typing import Tuple, Dict, Optional
from contextlib import contextmanager
import slideflow.norm.utils as ut
class MacenkoNormalizer:
preset_tag = 'macenko'
def __init__(
self,
alpha: ... |
4c259f4fbb2e4263783575266825544a3f8e07e843d597ebbea2f9d5f97f4195 | Python | 14,477 | 483 | """Datasets introduced in the Geom-GCN paper."""
import os
import numpy as np
from ..convert import graph
from .dgl_dataset import DGLBuiltinDataset
from .utils import _get_dgl_url
class GeomGCNDataset(DGLBuiltinDataset):
r"""Datasets introduced in
`Geom-GCN: Geometric Graph Convolutional Networks
<http... |
f6a9446fd882104e80f6ddae70880a96d57ee92e63af2789547f81455e258987 | Python | 14,479 | 401 | """ Python module that contains functions to manipulate the datasets used to train the models
"""
import logging
import concurrent.futures
import numpy as np
from sklearn.preprocessing import Binarizer, Normalizer
def create_noisy_features(
features,
labels,
experiment_settings,
data_parameters,
):
... |
cacef04d6fcf5ecbb0a38da191664cddd8c8ad827991831f8975264dcaf3a499 | Python | 14,490 | 422 | """
.. _model-tree-lstm:
Tree-LSTM in DGL
==========================
**Author**: Zihao Ye, Qipeng Guo, `Minjie Wang
<https://jermainewang.github.io/>`_, `Jake Zhao
<https://cs.nyu.edu/~jakezhao/>`_, Zheng Zhang
.. warning::
The tutorial aims at gaining insights into the paper, with code as a mean
... |
ea9a3375554bb9c0aa08b1605745b3b07036caacb2c39baa9cd43abf7890831c | Python | 14,512 | 434 | """
Train HemiCET v3 — 8-channel hemisphere CET-UNet with expanded expert labels.
Uses current discharge_times.json (1275 entries, 675 GT) which includes
MW's expanded discharge timing labels.
Changes from v1/v2:
- Saves weights to v3_hemi_cet_fold{0-4}.pt in hemi_cache/ (does NOT overwrite v1/v2)
- Uses MPS devi... |
4a3f91cdcd0576882352c4428a74dd0f862f1684f50cd9f5e697f1cfb21c1532 | Python | 14,518 | 355 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/deepseek_ocr2/modular_deepseek_ocr2.py.
# Do NOT edit this file manually as any edits will be overwritten by the ... |
b2c152e0626f16380e9fa5435464e2772470250a3f9107b6637eafeb0662ffab | Python | 14,521 | 619 | """Tensorflow backend implementation"""
from __future__ import absolute_import
import builtins
import numbers
import numpy as np
import tensorflow as tf
from ... import ndarray as nd
from ...function.base import TargetCode
from ...utils import version
if version.parse(tf.__version__) < version.parse("2.3.0"):
r... |
602dbdf3363d02ef3fd2db02302d9403551dec28dd911c15753881780efd31f3 | Python | 14,545 | 401 | """Provide abstract base class for datalad-based DataGrabber."""
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
# Leonard Sasse <l.sasse@fz-juelich.de>
# Synchon Mandal <s.mandal@fz-juelich.de>
# License: AGPL
import atexit
import os
import tempfile
from pathlib import Path
from typing impo... |
326455b13e5f92541ab99bb10c4897aebbaf5105f7eef504d8a8f06e80fa5772 | Python | 14,559 | 299 | # Copyright 2026 The HuggingFace 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 applicabl... |
ef2230e130baa3e48eaab5d1e8ce3108786c7aecc6cf7ccdb396b6c771e88370 | Python | 14,563 | 364 | """
Partially inspired by torchtune's flex attention implementation
Citation:
@software{torchtune,
title = {torchtune: PyTorch's finetuning library},
author = {torchtune maintainers and contributors},
url = {https//github.com/pytorch/torchtune},
license = {BSD-3-Clause},
month = apr,
year = {2024}
}
"""
# ... |
654659151968a96593250a436a2169432494168d88a649ac82e3c57a00a75299 | Python | 14,573 | 481 | # This file is part of alternative least squares calculation
import numpy as np
from numpy.linalg import norm
from matrix_operations import *
from lsq_components import *
from lsq_conjugate_gradients import Precondition
from lsq_aprecon import Aprecon
EPS = np.finfo('float').eps
EMPTY_ARRAY = np.array([])... |
45b9acfc8fda9211469ab995f4112e0d9ffd79d9dffb11ac254ca4acc0802c73 | Python | 14,598 | 361 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkmeshwriter2.py,v $
## Language: Python
## Date: $Date: 2006/07/27 08:27:40 $
## Version: $Revision: 1.13 $
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENSE file for details.
## This software is dist... |
0b245b970503bb360b18bc79fcd79140672b26399a163b89e0608cd3c8538d90 | Python | 14,599 | 408 | # Copyright (c) 2024-2026 ByteDance Ltd. and/or its affiliates
# SPDX-License-Identifier: Apache-2.0
from typing import List, Tuple
import chex
import jax
import jax.numpy as jnp
import ml_collections
from jaqmc_legacy.loss import utils
DEFAULT_OVERLAP_PENALTY_CONFIG = ml_collections.ConfigDict({
# ConfigDict re... |
cee6327f4daaee637ad99863bcf19038e5f441931c6c27fa2328e1f022cbea47 | Python | 14,600 | 283 | import os
import sys
import time
import numpy as np
from scipy.io import savemat, loadmat
import h5py
from tuncat.utils import find_dataset
if (sys.version_info.major+sys.version_info.minor/10)>=3.8:
from multiprocessing.shared_memory import SharedMemory
from tuncat.traces_from_masks_mp_shm_neighbors import tr... |
268d0db97dbfe38c879e6ecf45943af53d1ec7b761c1484a379f5906cfd855a4 | Python | 14,606 | 325 | import logging
import os
import torch
import torch.nn as nn
from torch import optim
from torch.utils.data import DataLoader, random_split
from torchvision.transforms import RandomAffine, Compose, Resize, ToTensor, RandomHorizontalFlip
from tensorboardX import SummaryWriter
from datetime import datetime
from utils imp... |
bbbe3c47cb261f3dab23fa66ac141329d6c42cc9c3eee838444a696b2d4eecc8 | Python | 14,606 | 400 | # neuro base class imports
import os
import sys
import time
import warnings
import dask
# other imports
import dask.bag as db
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from scipy import ndimage
from scipy.signal import find_peaks, medfilt, savgol_filter
from .base.epoch_data import _Epoc... |
fb1b49a8fca92039854408292a54d5c8e57eac9f76a37f9079fa976074c8cbf4 | Python | 14,612 | 344 | # Copyright 2026 The HuggingFace 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 applicabl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.