sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
fd28bc963db7e8fb5a79b1aac4b847a4ecfa91dc0083a1769519fb80950bcd3a | Python | 12,556 | 287 | # 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 ... |
f81e75183346b513f78471f842a12bd22316f70bf56deb4dd5d96e75c85fec98 | Python | 12,557 | 425 | import multiprocessing as mp
import os
import socket
import time
import unittest
import backend as F
import dgl
import pytest
from numpy.testing import assert_array_equal
from utils import generate_ip_config, reset_envs
if os.name != "nt":
import fcntl
import struct
INTEGER = 2
STR = "hello world!"
HELLO_SE... |
72ba0093724c22e2341fc36f37778076f11a21f7247f8b0110cc82f460779ddd | Python | 12,561 | 306 | """Execution point of the project for trainings"""
import json
from argparse import ArgumentParser, Namespace
from os import listdir
from os.path import join
from typing import Any, Mapping
import tensorflow as tf
from tqdm import tqdm
from data_wrangling.merge_tile import MergeTiles
from data_wrangling.tiling impor... |
c3065c32ece0cd46adf74a1aef5707da48a0596578503dabf47f874da0716663 | Python | 12,571 | 322 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/glm5_next/modular_glm5_next.py.
# Do NOT edit this file manually as any edits will be overwritten by the generati... |
1a6fef0ce2296cee57ae9b6a1a55bbc376cb6c8c4dbfdb98bf7256e2ff6cc786 | Python | 12,598 | 306 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/glm_image/modular_glm_image.py.
# Do NOT edit this file manually as any edits will be overwritten by the generati... |
555fe328d5aaeb1497586329d12307c351a6fc9d1d9056c40c083023ed81d2ec | Python | 12,598 | 305 | import logging
import random
import shutil
import unittest
import pandas as pd
import slideflow as sf
from slideflow.test.utils import TestConfig
class TestDataset(unittest.TestCase):
@classmethod
def setUpClass(cls) -> None:
cls._orig_logging_level = sf.getLoggingLevel() # type: ignore
sf.... |
d2ca71f1b4567581cf51da537fa87c74e29eee5b86f88322a389b7158b13e26f | Python | 12,598 | 300 | import argparse
import logging
import csv
import os
import sys
from PIL import Image
import numpy as np
from sklearn.metrics import f1_score
import torch
from torch.utils.data import DataLoader
from torchvision.transforms import Normalize, Compose, Resize
PACKAGE_PARENT = '..'
SCRIPT_DIR = os.path.dirname(os.path.real... |
3f4fa9c445e43cfde5a2f9a02d9a3313fc235210aa3125fb4c041bc519c51c28 | Python | 12,608 | 239 | #!/usr/bin/env python
## Program: PypeS
## Module: $RCSfile: pype.py,v $
## Language: Python
## Date: $Date: 2006/07/07 10:45:42 $
## Version: $Revision: 1.18 $
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENSE file for details.
## This software is distributed WI... |
b1ea6112e45c7a5aaf5952940913964192b29c5889702857f6bdd1601173a1bf | Python | 12,609 | 352 | """
MIT License
Copyright (c) 2024-2025 Yongning Lei
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 Software without restriction,
including without limitation the rights to use, copy, modify, merge, publis... |
62a55aaaac30b3920fa102cfd8c4f8090d0e5f41454356c51db9b6f79eb574e6 | Python | 12,616 | 308 | #!/usr/bin/env python3
"""V3 ML Classification Contest — comprehensive features for LRDA vs GRDA.
Runs a specific batch of (feature_set, classifier) combinations.
Usage:
python ml_classify_v3.py batch1 # runs combos 0-9
python ml_classify_v3.py batch2 # runs combos 10-19
python ml_classify_v3.py batch3... |
043f81b08a53079a1ec9a507715d911cde8352d28274625a96fc5f57910f5f37 | Python | 12,619 | 347 | # Copyright (c) 2025-2026 ByteDance Ltd. and/or its affiliates
# SPDX-License-Identifier: Apache-2.0
r"""Standard PH derivative backend — reverse-mode reference implementation.
This file is the paper-faithful math anchor for the PH derivative term;
performance and pathological-input hardening live in
:mod:`jaqmc.esti... |
5306e90efb83cf9da87373bec7b88dda5861f5c8784008ddbddfdc67090e42ac | Python | 12,633 | 415 | """User-defined function related data structures."""
from __future__ import absolute_import
class EdgeBatch(object):
"""The class that can represent a batch of edges.
Parameters
----------
graph : DGLGraph
Graph object.
eid : Tensor
Edge IDs.
etype : (str, str, str)
Ed... |
bf1fa578bd1b8580b9d4aeec805141347e0518620c9eede47e50c29c8665665c | Python | 12,645 | 353 | # from linear_warmup_cosine_annealing_warm_restarts_weight_decay import ChainedScheduler
# import torch
# import torch.optim as optim
# from torchvision.models import AlexNet
# from torch.optim import lr_scheduler
# import numpy as np
# import matplotlib.pyplot as plt
# import matplotlib
# model = AlexNet(num_c... |
553c2d1ce340648e7c3b4c0a54b6251deb8d0b19b22888b22386c338e49ce05d | Python | 12,665 | 316 | """
===================================================
:mod:`terminators` -- Algorithm termination methods
===================================================
This module provides pre-defined terminators for evolutionary computations.
Terminators specify when the evolutionary process shou... |
a9627e17c78cd7ef83ad43a54639fe0166d03417c3de117f3cb0be356e683f04 | Python | 12,666 | 194 | #
# Pyserini: Python interface to the Anserini IR toolkit built on Lucene
#
# 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... |
91bede6f0e1377568ef1303659f0d0520eed7c5e7e8863de4aae426cb5a77961 | Python | 12,672 | 308 | """
Bias-correction experiments for Ridge frequency estimation.
Ridge regression systematically underestimates high-frequency LPDs due to
shrinkage toward the mean. This script tests 8 strategies to correct this bias.
Run: conda run -n foe python code/exp_opt_freq_bias.py
"""
import sys
import subprocess
import nump... |
f0c001af3befc691f54e2c5ebe169066cf08fa18a2baedcb2ec9b8aa0ead03ed | Python | 12,676 | 320 | 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"""
... |
082f996c02a8c32e0af1cda4c0858adc5352bf938258a26e3deebfc5cd6518d3 | Python | 12,685 | 301 | #!/usr/bin/env python3
"""Patient-stratified held-out retune for V12 (NB-Hilbert) LRDA frequency.
The published V12 hyperparameters were selected by
code/evaluation/lrda_freq_hyperparam_sweep.py via a 192-combo sweep
**on the same 155-segment canonical-cohort majority-accept LRDA set**
that is used for the EE-vs-EA ev... |
2493be1eac30fc78e8f3267ab98662fffba1d85816c6e841c792c07eae6d5df3 | Python | 12,685 | 356 | # Copyright (c) 2026 ByteDance Ltd. and/or its affiliates.
# SPDX-License-Identifier: Apache-2.0
"""Public API tests for Forward Laplacian inputs, seeds, and guard helpers."""
import operator
import jax
import jax.numpy as jnp
import numpy as np
import pytest
from jaqmc.laplacian import (
LapTuple,
Local1Ja... |
23c77007bfbbf516aa62fba9218660c99b0be8af890c9861b7fd58744ace8ff3 | Python | 12,689 | 231 | # Copyright 2026 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 ... |
ce8bf653a657bac024807c087b440f8aa5415e361717d7de5018bdfea34551af | Python | 12,689 | 239 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/d_fine/modular_d_fine.py.
# Do NOT edit this file manually as any edits will be overwritten by the generation of
... |
23c4873c333b61ad42eb6c4d6b87d78193666fe5143fbed0dd68711818993c2a | Python | 12,693 | 286 | import itertools
import math
import random
import SimpleITK as sitk
import numpy as np
import pandas as pd
import torch
import torch.utils.data as data
from blast_ct.nifti.augmention import RandomAugmentation
from blast_ct.nifti.patch_samplers import PatchSampler
from blast_ct.nifti.rescale import rescale, reorient_i... |
f6132ce78f3883977c83134cecd5b6fde153bc7d1795e477bb249cb1c9396986 | Python | 12,694 | 302 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/efficientloftr/modular_efficientloftr.py.
# Do NOT edit this file manually as any edits will be overwritten by th... |
8cec7429bd1724d783727895dbd010e0a50558206b9239423b021016ea1c2b8b | Python | 12,719 | 298 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/minimax_m3_vl/modular_minimax_m3_vl.py.
# Do NOT edit this file manually as any edits will be overwritten by the ... |
af0bf6d3636ee558ce744a4ea82af75800730558b3b4c5aabc7827f16ba3a319 | Python | 12,725 | 272 | """
Definitions of basic 'edits' (Actions) to transform a product into synthons and reactants
"""
from abc import ABCMeta, abstractmethod
from typing import Optional, Tuple
from rdkit import Chem
from rdkit.Chem import Mol, rdchem
from utils.chem import attach_lg, fix_Hs_Charge, get_atom_Chiral, get_bond_ste... |
55872c761c2274b8596e85dc73ef916983a7307bc141653a688fdcc2c6754212 | Python | 12,727 | 309 | # Copyright 2025 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... |
310001c39da07e6f1cccc0b6e903636cb2ad123604d50cada2fc5e22c3a05e99 | Python | 12,732 | 301 | 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"""
... |
e0ac2ec068a8e885455b67b34e5b9c055c3c85c3797b6515bb276732232183e1 | Python | 12,738 | 278 | # Copyright 2025 The HuggingFace Inc. team and Google LLC. 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... |
40745525950546d2f255a551e3c11c5c6a704578e33d73f95a911bd617a2eb07 | Python | 12,742 | 319 | """Indexable, map-style multi-TFRecord dataset & weighted sampler."""
import slideflow as sf
import multiprocessing as mp
import numpy as np
import pandas as pd
import torch
from typing import Any, Callable, Dict, List, Optional, Union, TYPE_CHECKING
from slideflow.io import detect_tfrecord_format
from slideflow.tfre... |
6b5aca32febd0cd15c83c4de5ab54852550efd7b9d0735921375c5a60d6f7d41 | Python | 12,753 | 399 | """
Train CET-UNet v3 — uses current discharge_times.json (1275 entries, 675 GT)
which includes MW's expanded expert labels.
Changes from v1:
- Saves weights to v3_cet_unet_fold{0-4}.pt (does NOT overwrite v1)
- Uses MPS device
- Same architecture and hyperparameters as v1
"""
import sys
import time
import json... |
57e24212bcad4c2b89c42eeaa4df1c49392ed58ac4bb0a7b6606a2569d5da810 | Python | 12,754 | 352 | import argparse
import time
import dgl
import dgl.function as fn
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
from dgl.data import RedditDataset
from torch.utils.data import DataLoader
class SAGECon... |
1bcc1f08380c46e1920a0809d589298c8db0a20f49835d4f48dc4b1b438fc0d3 | Python | 12,756 | 334 | """RDA Contest Harness — data loading, method evaluation, leaderboard."""
import sys
import json
import time
import warnings
import numpy as np
import pandas as pd
import scipy.io as sio
from pathlib import Path
from scipy.stats import spearmanr
from sklearn.metrics import roc_auc_score
warnings.filterwarnings('ignore... |
540998776006022453c560bfe9edb7056de50254785e1573ee2bdd1b808b9e7c | Python | 12,762 | 300 | #!/usr/bin/env python3
"""Scan the local eeg_bank_spec.h5 for our 501 missing PD-GT patients.
Reads the per-entry `patient_id` attr from every one of the 132,291
segments in `/Volumes/Extreme SSD/.eeg_cache/eeg-test/eeg_bank_spec.h5`,
builds a pid→seg_id map, intersects with our missing PD-GT cohort, and
reports.
For... |
928bccbc462b27670ba340e5823f1a4e8be691e242cf8ae6fa2f6f281f389436 | Python | 12,779 | 316 | # Copyright 2024 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 requir... |
da33a05dec7aaad11029e4d5d5b3a371cb1ccf2713546a29c833cda64aa31e7b | Python | 12,793 | 412 | #!/usr/bin/env python
# coding: utf-8
import argparse
import math
import sys
from collections import OrderedDict
import dgl
import dgl.nn as dglnn
import numpy as np
import torch
import torch.multiprocessing as mp
import torch.nn as nn
import torch.nn.functional as F
import tqdm
from ogb.lsc import MAG240MDataset, MA... |
ffdead89c01684b6a0f93fe0349b3e8d1a199162dab457b9072a27c5f938a29e | Python | 12,798 | 390 | import multiprocessing as mp
import os
import time
import unittest
import backend as F
import dgl
from numpy.testing import assert_array_equal
from utils import generate_ip_config, reset_envs
# Create an one-part Graph
node_map = {"_N": F.tensor([[0, 6]], F.int64)}
edge_map = {("_N", "_E", "_N"): F.tensor([[0, 7]],... |
a2392653161633d4f8aefb473e776113ec5df8844acdba892569407ca56c2d6a | Python | 12,803 | 340 | # 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... |
fcb9a22efe7ab01dc7bbbb995263b01f396ffed341d8a37608d3f04304f8b576 | Python | 12,807 | 315 | ### This program evaluates a set of descriptors of molecules relevant to Ames Mutagenicity dataset using smiles strings
# import necessary packages
import pandas as pd
import numpy as np
# Import necessary packages from rdkit for constructing images from smiles
from rdkit import Chem
from rdkit.Chem import Q... |
d393c9a36f783f7acf56a76c429f289acd177855691d70f116e231e9e353e6e9 | Python | 12,811 | 315 | #!/usr/bin/env python2.7
from __future__ import print_function
from yapsy.PluginManager import PluginManager
import argparse # new in Python2.7
import atexit
import logging
import string
import sys
import threading
import time
logging.basicConfig(level=logging.ERROR)
# Load the plugins from the plugin directory.
ma... |
cbbac0adadc4f00ab09b5385ce85cfdd0a15ac7189ab42eb0b4dd9857718f256 | Python | 12,817 | 294 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/deepseek_vl/modular_deepseek_vl.py.
# Do NOT edit this file manually as any edits will be overwritten by the gene... |
65a4a13a73f92baa74082f0758c0f4f539e7ad0cfb83552d2a62c32e10b142d7 | Python | 12,818 | 307 | import torch
from torch import nn
import torch.nn.functional as F
from collections import defaultdict
class MultiBranch(nn.Module):
""" Multi branch layer
Based on: https://github.com/lvxuan96/CATCaller/blob/e23b234a4937207c9ad7e4e69ab812d158fc1242/train/modules.py#L148
"""
def __init__(self, branche... |
058e23ea54635c44f3c0a158cac7c4ee67a04c9b186b8bc923460d22ecc772c8 | Python | 12,826 | 346 | """
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... |
d82086f7aff0041bbc64ea55dd5bd504513bf8b2df1a125364877f23ca79a73a | Python | 12,833 | 363 | import numpy as np
from math import sqrt
from sklearn.metrics import mean_squared_error, r2_score
import matplotlib.pyplot as plt
from parc import losses
from parc import IO
from matplotlib import animation
def visualize_inference(
y_true: np.ndarray,
y_pred: np.ndarray,
t_idx: list,
case_num: int,
... |
cb98e2c82dbc9dffa02d9895c7ca1710fb527418081a3e354de5a1c135b0f9c7 | Python | 12,835 | 339 | from datetime import datetime
from functools import cached_property
from typing import Union
import matplotlib.pyplot as plt
import numpy as np
# Importing necessary functions from the utility modules
from .utils.numeric import _to_numeric_array, largest_triangle_three_buckets
from .utils.visualization import (
_... |
a6c9290b12db01a383f314864612addc36549467cb0cf630a69a0d4e6ff85b63 | Python | 12,837 | 300 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/hunyuan_vl/modular_hunyuan_vl.py.
# Do NOT edit this file manually as any edits will be overwritten by the genera... |
cc466f2ad6defb4795a60762f9c0dc81f2ced369b0ddead5fef36a187d63bf31 | Python | 12,837 | 350 | import os
from os.path import join
import sys
import matplotlib
matplotlib.use("AGG")
import matplotlib.pyplot as plt
import json
import neuron
import time as tm
import numpy as np
import LFPy
t0 = tm.clock()
## Choose model(s) to test:
#testmodel = 488462965
#testmodel = 478513407
testmodel = 478513... |
c55527ed30259172028ee33323e94dec044658c4bdef7c7b7d8ad683251f895b | Python | 12,844 | 468 | """Network visualisation tools
This module contains tools for network visualisation created for the
investigation of functional connectivity networks from voxel-based
analysis of calcium imaging data.
Some functions build on the networkx package:
@InProceedings{SciPyProceedings_11,
author = {Aric A. Hagberg... |
10a5e5ca59fc569c2e0527a9ecf1462ce7426155c25b54fdcb8e388f8f28cfa1 | Python | 12,847 | 354 | from typing import Optional
import numpy as np
import tnnpy.simpleNNlib as snn
from tnnpy.symdyn import NonlinearDynamicalAutomaton
class NeuralTM:
"""Given an NDA, constructs the equivalent neural network described in
our submitted paper.
:param nda: a symdyn.NonlinearDynamicalAutomaton object
"... |
1d64251d2927cd5e1d40e623fe1bb6addfbc705e5a86fd4c516508fc18f56d0a | Python | 12,853 | 340 | # 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 ... |
b43332b00c632945c4b193c917645b9f63c90e1bf6e7ce4d28d28f5aaa28184b | Python | 12,887 | 334 | """Factory for building feature extractors."""
import importlib
import slideflow as sf
from os.path import join, exists
from typing import Optional, Tuple, Dict, Any, TYPE_CHECKING
from slideflow import errors
from slideflow.model import BaseFeatureExtractor
from ._registry import (is_tensorflow_extractor, is_torch_e... |
5c5f3024a84c246aa999af7829565e0d06e5adc17a890b6af7e3b141c4adfd5a | Python | 12,900 | 324 | """
Experiment T2: Combined strategies from Tier 1.
Combines expanded features + interactions + subtype-specific models.
Experiments:
- t2_expanded_interactions_a5: 14 features (11 expanded + 3 interactions), alpha=5.0
- t2_expanded_interactions_a10: 14 features (11 expanded + 3 interactions), alpha=10.0
- t2_... |
c2187cd20da0b3996046452fb35659f71390e402aff4ab28f3566a873acd70e3 | Python | 12,910 | 322 | import torch
import torch.nn as nn
from timm import create_model
import torch.nn.functional as F
from typing import Optional, List
from . import __available_models__
class Model(nn.Module):
"""
This class utilizes a pre-trained model as a backbone network and
rearranges it as an encoder for fully convolu... |
596f4ba691dfaf40c398c388614d5a85090f2f52967cc71d7ed77e62eb510d58 | Python | 12,911 | 296 | import torch
from modules import BiLSTM, GraphTrans, MSA
from torch import nn
from utlis import *
import dgl
class GraphWriter(nn.Module):
def __init__(self, args):
super(GraphWriter, self).__init__()
self.args = args
if args.title:
self.title_emb = nn.Embedding(
... |
c321dba46e31a53bf4435c697c334183464d859bb5922efdc78b1d4962d03891 | Python | 12,922 | 411 | # Numpy sim implementation
"""
Numpy JR model implementation
==============================
"""
"""
Importage
"""
from mpl_toolkits import mplot3d
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
# %load jr_model.py
"""
Importages
"""
# Generic stuff
from copy import copy,deepcopy
import... |
0b479dffbe2afab1f9a8df3fecb0174e32cb6702d114ff5bf58ab56405c1a417 | Python | 12,924 | 314 | # Copyright (c) 2025 Baidu, Inc. and 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 ... |
8d9eeb624e87569b385b365ba0d0dfcb3a91b0505f9b2f7225448139e1bb75bf | Python | 12,925 | 442 | # -*- coding: utf-8 -*-
"""
Functions for working with data/osf.json file
"""
import os
from pkg_resources import resource_filename
import json
from nilearn.datasets.utils import _md5_sum_file
from neuromaps.datasets.utils import _get_session
# uniquely identify each item ('hemi' can be None)
FNAME_KEYS = ['source'... |
3f2631876640fd878b0d093ae8b3f21a3eaefad6cd6adb08e91bee6d7f492c78 | Python | 12,936 | 390 | """Initialize the distributed services"""
# pylint: disable=line-too-long
import atexit
import gc
import multiprocessing as mp
import os
import queue
import sys
import time
import traceback
from enum import Enum
from .. import utils
from ..base import dgl_warning, DGLError
from . import rpc
from .constants import MAX... |
30d400dd923131ad3b1093077a71404b98e2bddeb1dfd0c0dbe59a3b313d7d37 | Python | 12,938 | 357 | """Load tfrecord files into torch datasets."""
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
import numpy as np
import torch.utils.data
from slideflow.tfrecord import iterator_utils, reader
# -----------------------------------------------------------------------------
def _get_worker_id():
... |
47604e97b3b630b1e0340ddca6b33e1ac98666aee9790f0f7c86d6b048bc2654 | Python | 12,941 | 399 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import gridspec
# change the default font family
plt.rcParams.update({'font.family':'Arial'})
plt.rc('xtick',labelsize=14)
plt.rc('ytick',labelsize=14)
def reldiffs(fother,f1,iother,i1):
iout = []
iout2 = []
rdout = []
... |
15324c61597360b3d0b527dab9ae974b3ca1c03464ed4d30e39db32ae9b7bfcc | Python | 12,945 | 352 | #!/usr/bin/env python3
"""
Scan recent blackboard posts and summarize lifecycle and tag coverage for
plan/dataset runs that are still present in the ring buffer.
"""
from __future__ import annotations
import argparse
import asyncio
import json
import os
import sys
from collections import defaultdict
from dataclasses ... |
c003f96f9f1c006644e1c900e2bedf9ba69412877d1bf26350bdaaaee648ff17 | Python | 12,960 | 322 | """
Deep parameter grid search for the triple-median approach.
Triple median = median(Method_A_freq, Method_B_acf_freq, peak_count_freq)
Method A is pre-computed once. Method B (pointiness+ACF) and peak-count
frequency are recomputed per parameter combo.
Parameter grid (432 combos):
lowpass_hz: [10, 15, 20,... |
072df38b3c2a64589845cf21098dddd1bb7ca8e6c28c812b56e24ad712441aba | Python | 12,964 | 348 | # Copyright 2020 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... |
ff60af24eac97670fe132656500548a328292452839e176b5d486dd481dfc1ea | Python | 12,967 | 307 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/llava_onevision/modular_llava_onevision.py.
# Do NOT edit this file manually as any edits will be overwritten by ... |
71bac24a7c53cacb6af71fdd79cc936001a260c6cad25a165bd3c0688a6ed883 | Python | 12,970 | 365 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from tensorboardX import SummaryWriter
import utils.utils as utils
from abc import ABC, abstractmethod
class AbstractLayer(nn.Module, ABC):
def __init__(self, in_features, out_features, bias=True,
forward_requi... |
90c040e096f61405b9169a808f9105cc2d58c94fe093ee7b4e78b32047c4a07c | Python | 12,976 | 401 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import gridspec
# change the default font family
plt.rcParams.update({'font.family':'Arial'})
plt.rc('xtick',labelsize=14)
plt.rc('ytick',labelsize=14)
def reldiffs(fother,f1,iother,i1):
iout = []
iout2 = []
rdout = []
... |
f00855e3dfe73c5502046974f38ba0b214e036b9232e87ee35f5d65515044864 | Python | 12,979 | 303 | 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"""
... |
6da83fe02401bee7764b579403d9a07594dd5b393187ba29ea0876b1438a16f2 | Python | 12,986 | 349 | import imgui
import cv2
import numpy as np
import threading
from typing import Tuple
from os.path import dirname, join, abspath
from ..gui import gl_utils, imgui_utils
from ..gui.viewer import Viewer
#----------------------------------------------------------------------------
def center_crop(image, width, height):
... |
b7fba2869b9538764a1ad6f41582aecf3442c451c9c71c66d9d5ca9802bae800 | Python | 12,997 | 297 | #!/usr/bin/env python3
"""V14 -- V12 (amplitude) default with V13 (rhythmicity) unanimous override.
Principle: amplitude-based laterality (V12) is correct on ~96% of segments
but fails predictably on a few. The four amplitude-normalized rhythmicity
features (V13: Q-factor, PLV, peak-CV, peak-prom) catch most of those
... |
deca136d204e46e266549aa23f3555991a1d6c91b94d6b78b2de179affd8dc0a | Python | 13,004 | 372 | import itertools
import unittest
from collections import Counter
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
import scipy.sparse as ssp
from dgl import DGLError
from scipy.sparse import rand
from utils import get_cases, ... |
fe7c0af215e38d96d5d020118d1383115840805664d59b8a408aff797fe10609 | Python | 13,009 | 338 | """Provide class for space warping via ANTs antsApplyTransforms."""
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
# License: AGPL
from typing import (
Any,
ClassVar,
)
import nibabel as nib
import numpy as np
from ...data import get_template, get_xfm
from ...pipeline import ExtDep, WorkDirManager
from ... |
0328a6b6fa5c039fceddc94bfa92467043526cc44458df054f4a4b4971df7900 | Python | 13,010 | 377 |
from repli1d.visu_browser import plotly_blocks
from repli1d.analyse_RFD import mapboth
import numpy as np
import glob
def norm2(e, remove_zero=True, cut=None, mean=None, std=None, verbose=False, cutp=None):
if mean is None:
mean = np.nanmean(e)
e /= mean
ep = e.copy()
if std is None:
... |
aedca0ea1818c3b70ed5e33a10161eb92af82fe034ca67c670a5c98d69b451ce | Python | 13,023 | 286 | from windows.simulation.sim_view import SimulationParameterWidget
import utils.CobelSpikeOriginalParams as OriginalParameters
import pandas as pd
import json
from PyQt5.QtWidgets import QMessageBox
import copy
class SimulationController:
def __init__(self, view):
self.view: SimulationParameterWidget = vie... |
ca5d0b192b52e4541a4f70c4e2808de9433f1154ec509f0b8be8a5369f122342 | Python | 13,026 | 348 | # Copyright 2025 Deepseek AI and 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 requi... |
a6c666b46419889ae219bff83a3b137b12444061edc1c3fcc8a625c91624b69d | Python | 13,031 | 350 | """
Improvement #5: Post-hoc confidence filtering.
After DP finds discharge times, apply additional filters to remove
low-confidence detections:
A. Drop discharges with evidence peak below a threshold (relative to median)
B. If IPI CV is very high (irregular), fall back to HPP-only or stricter DP
C. Require mini... |
0da11d2c1b7bff006f224f7d8b37bc90655805761d21a73f6400bbd782d25ff8 | Python | 13,032 | 294 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtksurfaceviewer.py,v $
## Language: Python
## Date: $Date: 2006/05/26 12:35:13 $
## Version: $Revision: 1.10 $
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENCE file for details.
## This software is di... |
dec17b4f7284a3c89461da32434b187edf64e979ab9d60a5620581939dcd1ec2 | Python | 13,033 | 397 | #!/usr/bin/env python3
"""
Batch DICOM deduplication across multiple sessions using a session list file.
Calls parallel_deduplicate.py for each session or group of sessions.
"""
import sys
import subprocess
from pathlib import Path
from typing import List, Tuple
import argparse
import time
def read_session_list(sesl... |
0f2c05e685bbe07c6940420a92c2e4c18062ce69184a2f0629e69d0003210377 | Python | 13,042 | 338 | # Copyright (c) 2022-2026 ByteDance Ltd. and/or its affiliates
# SPDX-License-Identifier: Apache-2.0
'''
Drifting and diffusion for DMC walkers.
'''
import jax
import jax.numpy as jnp
def single_electron_wrapper(position, velocity, nuclei, charges,
time_step, key, updated_position=None):
... |
169bd5a4f141efe93aebe4ca7b1ddafef1829bdb69aadd2f8a5404f3169a3704 | Python | 13,042 | 377 | from pathlib import Path
from unittest.mock import patch
import bids
import nibabel as nb
import numpy as np
import pytest
from nipype.pipeline.engine.utils import generate_expanded_graph
from niworkflows.utils.testing import generate_bids_skeleton
from sdcflows.fieldmaps import clear_registry
from sdcflows.utils.wran... |
3360d006835970b17310ed90a61fb4cd2f568c52b872a3e1a630534e80971acf | Python | 13,051 | 365 | import torch
import torch.nn as nn
import torch.nn.functional as F
from einops import rearrange
from STDP_graph import GraphConstructSTDP
from layers import GraphConvolution
class StdpGCN_context(nn.Module):
"""
增加了上下文,在时间方向使用卷积
其实有点类似TCN?
效果目前 没有加跳步连接 18814次迭代,训练ACC 86, 测试ACC 80.5
... |
7114a33833f8d1229653d56e3581fd7ed32113160196097a3dc9bd657510bea2 | Python | 13,055 | 316 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtksurfaceviewer.py,v $
## Language: Python
## Date: $Date: 2006/05/26 12:35:13 $
## Version: $Revision: 1.10 $
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENCE file for details.
## This software is di... |
65a1752a9984bdf913ab37ea05edda43af92ea9b46ca791569a508e4592a496d | Python | 13,059 | 253 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/minicpm_ocr/modular_minicpm_ocr.py.
# Do NOT edit this file manually as any edits will be overwritten by the gene... |
a6cebd1c2cec45ee61a1de21f53474b8660d33a5f642aa6916e8f522af30a3cf | Python | 13,059 | 438 | from __future__ import annotations
import numpy as np
from minigrid.core.constants import COLOR_NAMES
from minigrid.core.grid import Grid
from minigrid.core.world_object import Ball, Box, Door, Key, WorldObj
from minigrid.minigrid_env import MiniGridEnv
def reject_next_to(env: MiniGridEnv, pos: tuple[int, int]):
... |
98844553bba3465799572200c56ebae3700f51717569512f40b4aa160244129b | Python | 13,061 | 315 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/cosmos3_edge/modular_cosmos3_edge.py.
# Do NOT edit this file manually as any edits will be overwritten by the ge... |
a7651f1732e2e0fcaf42aafb3dd0d52507e0b728c13e856bf0f8ea9c2b20c70f | Python | 13,064 | 338 | # Copyright 2025 The ZhipuAI Inc. team and 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
#
# U... |
12b4c07ea7145936a55c4f93b98a20ce853b9dca375de6a1a4a608dfbb2e2c1f | Python | 13,079 | 376 | # 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... |
35a1f437009719c71fbec10332360f97906d5d205ec86c58e12e90645ac430bd | Python | 13,083 | 325 | # Copyright 2026 Cohere Inc. 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 requir... |
0c4b78c70edacdd1065dad466a2d30e38b605682d8c68052ab5442f66bb82fa7 | Python | 13,095 | 302 | 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"""
... |
2ec73b2a3d4ab8cf98be7187cefe2eae861c85612e61d7de5c24af5278daf941 | Python | 13,095 | 298 | """Tile wise evaluation of WSI"""
from collections import defaultdict
from itertools import product
from multiprocessing import Pool
from os import listdir
from os.path import basename, join
from time import perf_counter
from typing import Any, Dict, List, Mapping, Optional, Sequence, Tuple
import attr
import pandas ... |
5a76d97c6803854352320c20fa75aced37d9a09ddc639b803364c5102d9d10c7 | Python | 13,101 | 365 | #!/usr/bin/env python3
"""Translation code used by server.py."""
import logging
import sys
import time
from multiprocessing import Process, Queue
from collections import defaultdict
from queue import Empty
import numpy
from beam_search_sampler import BeamSearchSampler
from config import load_config_from_json_file
... |
b1694f1e453ef718fd2a79f83f4a13efedbc1b0ad77db67b9b767b8aca34a21f | Python | 13,111 | 301 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkdijkstradistancetopoints.py,v $
## Language: Python
## Date: $$
## Version: $$
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WARRANTY... |
ba38d1501acae549276e98dab0e2af12310f03bc14555ebf39b3ae7521b9d6c0 | Python | 13,111 | 306 | # Copyright 2025 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... |
3a0fefd7dece615aa8b3158c5939f567c6e024c3a0eafca50770fa1feb7df791 | Python | 13,113 | 236 | #
# Pyserini: Python interface to the Anserini IR toolkit built on Lucene
#
# 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... |
83116853d71904668e0b58b2efa8201271ad5ac04cda9c42a3323fa418daaf82 | Python | 13,114 | 484 | # ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.13.7
# kernelspec:
# display_name: Python 3 (ipykernel)
# language: python
# name: python3
# ---
# %% [ma... |
ce0e0fbf75f14b63cfbcba64b0f6fb3fe772c0a31f7e20a3f2707b3b3b4aede5 | Python | 13,126 | 318 | # Copyright 2022 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 ... |
81c1446452628dc0dd298bd835400f117440afe76df461b5e3bd65d9d1f2045a | Python | 13,135 | 351 | # Copyright (c) 2025-2026 ByteDance Ltd. and/or its affiliates
# SPDX-License-Identifier: Apache-2.0
"""Persisted solid-state orbital references."""
import json
from abc import ABC, abstractmethod
from dataclasses import dataclass, field, fields
from pathlib import Path
from typing import Any, ClassVar, cast
import ... |
7acd5d0fd85d142d80b08a8fae0930d2a4e6aa423d47bdad0d30885502bced57 | Python | 13,147 | 373 | """
Round 4 experiment: Matched-filter discharge likelihood envelope + YIN/SRH frequency estimation.
Uses template banks (C for LPD/GPD-specific, D for universal) to create a
discharge likelihood envelope via cross-correlation, then estimates periodicity
using YIN (CMNDF), SRH, and FFT methods.
Variants:
r4_yin_ban... |
9b9569290f8fdf342fe7bacbeb7191d158a761d4bc2bc695f7aa43583d2e68a0 | Python | 13,158 | 597 | # Copyright (c) 2025-2026 ByteDance Ltd. and/or its affiliates
# SPDX-License-Identifier: Apache-2.0
from dataclasses import dataclass, field
from pathlib import Path
import pytest
from click.testing import CliRunner
from jaqmc.app.cli import cli
@dataclass(frozen=True)
class CliDryRunCase:
id: str
app: st... |
549cb592af842f838790a633389ffdf0a4644d3ed62c42c21c77beed51aa1932 | Python | 13,160 | 298 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/hunyuan_vl/modular_hunyuan_vl.py.
# Do NOT edit this file manually as any edits will be overwritten by the genera... |
acfccee55efe1f10b73b98dffad26174e9755a839de6366f65de963203c8ab8f | Python | 13,169 | 341 | """
Round 2 Combiner: test 8 combination strategies using the best findings from Round 1/2.
Methods combined:
A: pd_detect_alternate (apd) event_frequency
B: pointiness ACF (thr=0.10, min_lag=0.25, sigma=0.02, lp=15Hz, ph_frac=0.3)
Peak-count: n_peaks / duration from pointiness trace
IPI: 1 / median(inter-peak... |
0648c9014cf63d6560fe977afafbb49edf264db29097d74f6b8aa5e23338cb44 | Python | 13,170 | 386 | # scientific imports
import datetime as dt
import struct
import warnings
import dask.array as da
import numpy as np
import scipy.io as sio
def check_data(raw_data):
"""
Warns user of potential errors in reading in the data.
Parameters
----------
raw_data : dict
Python dictionary with key... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.