sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
1c264b54d4a49b88ced753795423df750f3a88039cd264781ec9be2be0cf3334 | Python | 16,434 | 457 | """
Reinhard normalization based on method of:
E. Reinhard, M. Adhikhmin, B. Gooch, and P. Shirley, ‘Color transfer between images’, IEEE Computer Graphics and Applications, vol. 21, no. 5, pp. 34–41, Sep. 2001.
"""
import torch
import numpy as np
from typing import Tuple, Dict, Optional, Union
from contextlib import... |
1dd91dcffe518f66a3faf7ff7ae749978146dcb1af418f12d179b451198e1c80 | Python | 16,434 | 476 | import argparse
import time
from contextlib import contextmanager
import dgl
import dgl.distributed
import dgl.function as fn
import dgl.nn.pytorch as dglnn
import numpy as np
import sklearn.linear_model as lm
import sklearn.metrics as skm
import torch as th
import torch.nn as nn
import torch.nn.functional as F
impor... |
26f83eedb80d5a56d63cb48229bbc50060e7cd98de936c4a741ae5bfc65c8eca | Python | 16,452 | 449 | """
HemiNet Evaluation — Experiment 1.1
Loads the 5-fold trained models and evaluates on held-out folds.
Decoding strategies:
Strategy 1: Simple peak picking (p_eff = p_event × p_active^1.5)
Strategy 2: DP post-processing using predicted freq as period prior (Exp 4.1 preview)
Reports:
- Event F1, Sensitivity, ... |
1c610f8f6b6a38209c9b8c8fece214ef1c16b3fd6935433259578cfe9fa6a698 | Python | 16,460 | 492 | """Launching tool for DGL distributed training"""
import argparse
import json
import logging
import multiprocessing
import os
import re
import signal
import stat
import subprocess
import sys
import time
from functools import partial
from threading import Thread
from typing import Optional
DEFAULT_PORT = 30050
def cl... |
70737f7120a7cd73570420a5e69cd94c1e42226e652a87b11b2b668dce779dbf | Python | 16,462 | 385 | # Copyright 2021 The Fairseq Authors 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
#
#... |
00f34ce5ad1b520efacd7903e01ba90e0c4962657307e96b4733ef5e151e9d55 | Python | 16,464 | 422 | #!/usr/bin/env python3
"""
Render publication-quality EEG characterization figures from JSON data.
Self-contained: only requires matplotlib, numpy, scipy, json.
Reads figure_*_examples_data.json and produces figure_*_examples.png at 300 DPI.
"""
import json
import os
import sys
import numpy as np
import matplotlib
ma... |
f47936c141afee66591c6e494d4e5cb164b46b1d1844c5f2ece88d4c5b5a3353 | Python | 16,480 | 368 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkmeshgenerator.py,v $
## Language: Python
## Date: $Date: 2006/02/23 09:27:52 $
## Version: $Revision: 1.7 $
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENSE file for details.
## This software is dis... |
2ff75d88e02826ff57038867a1d17a7e72271143c9fcaad1c83b9d92535f404c | Python | 16,496 | 370 | import pydicom as dcm
import cv2
import numpy as np
from scipy.signal import find_peaks
class EchoCard(object):
'''
This class collects all information needed for one mouse scan during the end2end framework
Parameters
----------
filepath: string
Path of the file (echocardiogram) to ... |
43023839d26b2e56650143b35defdfd3f25267d178d167ceca4ed302ca17e3b6 | Python | 16,503 | 330 | import unittest
import random
import logging
import itertools
import multiprocessing
import inspyred
class DummyEC(object):
pass
def test_generator(random, args):
return [random.random() for _ in range(6)]
def test_evaluator(candidates, args):
fitness = []
for c in candidates:
fitness.append(... |
f1f2cb7dccc41eb21601795ed979dc5859de2ca0352e14cb4fb22f341024e01d | Python | 16,509 | 481 | """Provide tests for DataladDataGrabber."""
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
# License: AGPL
import warnings
from pathlib import Path
import datalad.api as dl
import pytest
from junifer.datagrabber import DataladDataGrabber, DataType
from junifer.utils import config
_testing_dataset = {
"exa... |
7858437d0041dd28b0d7743df40b8eab2644b6680d242912abe6ce7be524eed2 | Python | 16,514 | 458 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
# vi: set ft=python sts=4 ts=4 sw=4 et:
#
# Copyright The NiPreps Developers <nipreps@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obta... |
a08dca24b64c94ba54014d6f2007f2b62c6e43e60527ddca6f3f3b40007a845b | Python | 16,524 | 486 | import os
import re
import matplotlib
matplotlib.set_loglevel("critical")
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import yaml
from matplotlib import cm
from rl_nav import constants
from typing import List, Tuple, Union, Optional
from plotter import plot_functions
def _split_rollout_by_... |
32d0440d273eb19fdd0456dd84293dc25839728d278dae61e8ff5f964fd618c6 | Python | 16,526 | 435 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtksurfaceappend.py,v $
## Language: Python
## Date: $Date: 2005/09/14 09:49:59 $
## Version: $Revision: 1.4 $
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENSE file for details.
## This software is dis... |
ee6b61aeac0a2fb5700f44c95149a27093f50b75ae714685e776183610882172 | Python | 16,532 | 382 | 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"""
... |
49cb7f60398810711201a6d8aff2050cda1029e5795deb073a3ed5acb8b1dab5 | Python | 16,546 | 518 | # """
# MIT License
# Copyright (c) 2020-2025 Garikoitz Lerma-Usabiaga
# Copyright (c) 2020-2022 Mengxing Liu
# Copyright (c) 2022-2023 Leandro Lecca
# Copyright (c) 2022-2025 Yongning Lei
# Copyright (c) 2023 David Linhardt
# Copyright (c) 2023 Iñigo Tellaetxe
# Permission is hereby granted, free of charge, to any per... |
2726f66efae9c75786e585ef57150402bf73656cd9ccc648c86941d0d8264662 | Python | 16,549 | 469 | import torch
import torch.nn as nn
from torch.autograd import Variable
from einops import rearrange
from einops.layers.torch import Rearrange
import torch
import torch.nn as nn
import torch.nn.functional as F
from functools import partial
from torch.autograd import Variable
from timm.models.layers import Drop... |
8203a545a5fc6564985b7bce47cf4c01aa70d277974c1ec792ff8be195578f94 | Python | 16,559 | 501 | import argparse
import pickle
import time
import dgl
import dgl.function as fn
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader, IterableDataset
from .. import utils
def _init_input_modules(g, ntype, textset, hidden_dims):
# We initia... |
6cad13495d9af01045a42872c2595193007508e4ec8c78b1b3dbb75484bb65bd | Python | 16,578 | 386 | # 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... |
0fe0fdb2a0b1a0b0708ac045d2d108d18a868557ff3fa8a9db9db1421ea9aa6a | Python | 16,582 | 544 | """GNN Benchmark datasets for node classification."""
import os
import numpy as np
import scipy.sparse as sp
from .. import backend as F, transforms
from ..convert import graph as dgl_graph
from .dgl_dataset import DGLBuiltinDataset
from .utils import (
_get_dgl_url,
deprecate_class,
deprecate_property,
... |
219b6bdda0fa44b28ad3ef4c77d271367996bc84b03365e467974a82fce4c5dd | Python | 16,590 | 399 | # Copyright 2026 The HuggingFace Inc. team. All rights reserved.
# Copyright (c) 2026, NVIDIA CORPORATION. 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://... |
45b7513d8081a9461fe77e381331170aa50b726135fdcee3f9321b223ce1383f | Python | 16,592 | 426 | """
Build comprehensive channel-level pseudolabel JSON for all patients.
For each patient in patients.csv, assigns per-channel pd_label and rda_label
with source and confidence metadata.
Sources (in priority order for LPD):
1. Ground truth MW review (from channel_involvement.json, review_status=ground_truth)
2. S... |
b2da00b18b458fbacfae56e0338a62734902443cd4f023efe624c3f702aa4394 | Python | 16,596 | 409 | import torch
import torch.nn as nn
from torchvision.models.utils import load_state_dict_from_url
import torch.nn.functional as F
from torch.nn import Parameter
__all__ = ['ResNet', 'resnet18', 'resnet34', 'resnet50', 'resnet101',
'resnet152', 'resnext50_32x4d', 'resnext101_32x8d',
'wide... |
b42e30778e7327cb009e9ac4ff98913543ebd9ffcd7dfdf825ae809c394034a8 | Python | 16,603 | 463 | """
02_correct_wc_bold_naming.py
-----------------
For WC sessions: match vistadisplog *_params.mat files to BIDS func bold/sbref
by AcquisitionTime, check whether task/run labels agree, and rename BIDS files
to match the params.mat task label when they don't.
How matching works
------------------
1. Read all *_params... |
f0973f182e9e36c6273a5e551815944e47f6269c6eb507c44d9e6fa5a40d99cb | Python | 16,603 | 387 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 29 13:06:05 2019
@author: kai
"""
import argparse
import os
import numpy as np
import yaml
import io
import copy
import matplotlib
try:
from savelouts_best_controls import main as modeloutputs_main
except ModuleNotFoundError as e:
print(e)... |
fa5df652141b4f178d99360681407ae0e4e66a4be5b9b5ff91fa8cc432078819 | Python | 16,606 | 462 | """Diffusion maps module.
This module implements the diffusion maps method for dimensionality
reduction, as introduced in:
Coifman, R. R., & Lafon, S. (2006). Diffusion maps. Applied and Computational
Harmonic Analysis, 21(1), 5–30. DOI:10.1016/j.acha.2006.04.006
"""
__all__ = ['BaseDiffusionMaps', 'SparseDiffusion... |
5917349e31584757a2b7f225cf27e2ab3e7286934e2e1eb35973082ce122d5cd | Python | 16,608 | 568 | """
Copied and adapted from https://github.com/mila-iqia/babyai
"""
from __future__ import annotations
import os
from abc import ABC, abstractmethod
import numpy as np
from minigrid.core.constants import COLOR_NAMES, DIR_TO_VEC
from minigrid.minigrid_env import MiniGridEnv
# Object types we are allowed to describe... |
488dc365f718a007c5f57025d34d9e64a494c10ec1bcc576874f9232987a0784 | Python | 16,631 | 463 | """
This script trains and tests a GraphSAGE model for link prediction on
large graphs using graphbolt dataloader. It is the PyG counterpart of the
example in `examples/graphbolt/link_prediction.py`.
Paper: [Inductive Representation Learning on Large Graphs]
(https://arxiv.org/abs/1706.02216)
While node classificatio... |
d6f815687e8ceb8fcab2f502f31b08977650bbdbe89198620e97bce7fb771269 | Python | 16,634 | 424 | from mne.filter import notch_filter,filter_data
import hdf5storage
import scipy.io as sio
import numpy as np
import pandas as pd
import warnings
import numpy
import math
import os
import pdb
import scipy.io as io
from scipy.signal import find_peaks, detrend, butter, filtfilt
from scipy.stats import shapiro
from scipy i... |
d990bb4434c37819e56964405c43146f0fb28f62e9313077820c59bbb9b39adc | Python | 16,634 | 372 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkdistancetospheres.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; witho... |
897c48fac9f4fd842ea6025364b190ea679ea358342a90c2e90b3c1d1ff9f8f9 | Python | 16,643 | 424 | # python standard library imports
import glob
import os
import sys
import warnings
from concurrent.futures import ThreadPoolExecutor
from functools import cached_property
# scientific computing library imports
import numpy as np
import pandas as pd
from .base.dio_data import _DioData
# neuro base class imports
from ... |
8d786a6b83b63925fceba998d91aadb0183ead00ab27a73c79f365f650aaf776 | Python | 16,663 | 424 | # 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... |
7f585967a243dcaf4a5b46f1433a4d4f1d5ad1c287249c86090a578a884559fd | Python | 16,689 | 538 | import math
import numbers
import backend as F
import dgl
import networkx as nx
import numpy as np
import pytest
import scipy.sparse as sp
from dgl import DGLError
# graph generation: a random graph with 10 nodes
# and 20 edges.
# - has self loop
# - no multi edge
def edge_pair_input(sort=False):
if sort:
... |
64be3c94e3caf6c54075b2249a989d8fcec9cb52632e2ef6728e1e97e8f8bf85 | Python | 16,691 | 410 | """
These functions/modules are mostly taken from the training code elsewhere in the repository.
"""
import os
import copy
import h5py
import yaml
import numpy as np
import tensorflow as tf
from kinematics_decoding import set_kin_dimensions
class RDataset():
"""Defines a dataset object for regression, with si... |
791f6be3df300af3f518e219d7ba18b38a6f82386b923dd20e1ead38fa1f4dc4 | Python | 16,693 | 450 | """Graphbolt sampled subgraph."""
# pylint: disable= invalid-name
from typing import Dict, NamedTuple, Tuple, Union
import torch
from .base import (
apply_to,
CSCFormatBase,
etype_str_to_tuple,
expand_indptr,
is_object_pinned,
isin,
)
from .internal_utils import recursive_apply
__all__ = [... |
8918cf37bdbea1cc0ee6924a6fe2c4fd75d185b0e809111db860ab8545d8d224 | Python | 16,694 | 426 | """
Code for training and evaluationg regression models (hand localization task).
"""
import os
import copy
import h5py
import yaml
import numpy as np
import tensorflow as tf
from kinematics_decoding import set_kin_dimensions
class RDataset():
"""Defines a dataset object for regression, with simple routines to... |
db4844b482a0683ab5081ecd3c006fd1f596eafe2c99523333e73be1400ee6ab | Python | 16,701 | 471 | # Copyright (c) 2025-2026 ByteDance Ltd. and/or its affiliates
# SPDX-License-Identifier: Apache-2.0
from collections.abc import Callable, Mapping
from typing import Any, cast
import jax
from jax import numpy as jnp
from jaqmc.array_types import Params, PRNGKey
from jaqmc.estimator.base import PerWalkerEstimator
fr... |
e0b99be2bab1a632a09752e03ff27aeceadc6ed6baf221efe8e56e57b10257a4 | Python | 16,710 | 592 | """Provide tests for masks."""
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
# Vera Komeyer <v.komeyer@fz-juelich.de>
# Synchon Mandal <s.mandal@fz-juelich.de>
# License: AGPL
import socket
from collections.abc import Callable
from pathlib import Path
import nibabel as nib
import numpy as... |
ef5e69fb15131a29fc3df4b32a99e2922021eaa52b2b0ba8b98c0053b02a343f | Python | 16,711 | 371 | # 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... |
d5111e6dccd28cdd401c44b5cd09a109d6a7664fa2b7283bb20dad45dab253b8 | Python | 16,716 | 377 | """
Tool Name: mst_classification_learn
===================================
Description:
Trains an MST-based classification model from a collected list of SMImage
samples.
This tool acts as an aggregator: each sample is passed through unchanged via
`execute`, and `aggregate` launches `mst_classificati... |
cc8d8429459861167eb19e7f6054a984c917b865e9dcbdbf63e35a9caae735c1 | Python | 16,728 | 363 | # 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 ... |
4a6770b6a3f0b0e06ea20c8a7d4a44a7a284a6df8291d226fdd17d77dbbf3c0c | Python | 16,731 | 444 | # Copyright 2024 The Emu team, BAAI 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
#
# ... |
3db4215226bc932c2c06ca87aa78db84e2e9714f99a33391a758c3a88e4b5090 | Python | 16,752 | 482 | '''
This code is for batch plotting the tmaps,
stored in the l1_surface folder for quick checking
'''
from nilearn import datasets
from nibabel.freesurfer import read_annot
import pandas as pd
import os
import matplotlib.pyplot as plt
import nibabel.freesurfer as fs
import nibabel as nib
from nilearn import plotting
... |
d4a87301cdca21510ff354c204fac1a16f6bdd364e166ea17e665ba7f6f5ba3d | Python | 16,753 | 390 | # Copyright 2026 Illuin Technology and contributors, 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... |
9c4e39cb225a5e107fd88cd6db7ccbb1345cf67b6117b3d15b4ad3daac1b9d74 | Python | 16,783 | 375 | # Copyright 2021 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 ... |
de482ee612ba8552b43ef32596178382e95e2abe5a072481ed70a6d0bcf9eb46 | Python | 16,803 | 464 | import torch
import torch.nn as nn
from torch.autograd import Variable
from einops import rearrange
from einops.layers.torch import Rearrange
import torch
import torch.nn as nn
import torch.nn.functional as F
from functools import partial
from torch.autograd import Variable
from timm.models.layers import Drop... |
2bfc66133029885033b32b3660513ad602ff68efdd5d6f672311b61e7ac1f2bc | Python | 16,813 | 386 | # Copyright 2023 the HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
13383d111053d6d9d225f937eaf031ee0497294d61c72223886ea45675cd13bb | Python | 16,832 | 384 | # Copyright 2026 NAVER Corp. 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... |
63df698201c873785d6f616f64d61e6fcf3f0fcc649c3269a531942728fb72de | Python | 16,854 | 382 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/cohere_compass/modular_cohere_compass.py.
# Do NOT edit this file manually as any edits will be overwritten by th... |
74a35ba78368ae60f9c45773270f8a768eed26b6b7df9700c4814ce7faeaf35d | Python | 16,854 | 391 | # Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
8cd36bdeb58eeda33a638455646213525aa0b63f3f1ce984d4d7d36894dda091 | Python | 16,865 | 393 | 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"""
... |
67668db67f2a8acf9e8c415c26abf758ef47d1924763cb531856bb9e9bb8165b | Python | 16,885 | 430 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/chmv2/modular_chmv2.py.
# Do NOT edit this file manually as any edits will be overwritten by the generation of
# ... |
66427247c36e97b2bbfca647aabfa848cf8b9422295e35518be6b22ddbc15ff9 | Python | 16,913 | 548 | import argparse
import math
import dgl
import torch
import torch.nn.functional as F
from dgl.dataloading.negative_sampler import GlobalUniform
from dgl.nn.pytorch import GraphConv, SAGEConv
from ogb.linkproppred import DglLinkPropPredDataset, Evaluator
from torch.nn import Linear
from torch.utils.data import DataLoad... |
cad67ca372fd0c809a835e4b7aec442010e6922ab784ddae5f80e3bdd2cf18a2 | Python | 16,919 | 491 | #!/usr/bin/env python3
"""
Create BIDS-organized symlinks from lab DICOM directories.
This script reads a CSV mapping file and creates symlinks from the original
lab DICOM directories to a BIDS-structured directory for heudiconv processing.
"""
import os
import pandas as pd
from pathlib import Path
from typing import... |
11acdf3ec2e2383d84c9381df0a63f3438084b4d86bd5b4f085f4bc595119a24 | Python | 16,927 | 534 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
import random
import sys
import time
import dgl
import dgl.function as fn
import matplotlib.pyplot as plt
import numpy as np
import torch
import torch.nn.functional as F
import torch.optim as optim
from dgl.dataloading import (
DataLoader,
... |
82f90b25db6cb81a5777397a46662c4ba8167f71daa6aed1c441c8e8728253e4 | Python | 16,931 | 401 | # 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... |
eeb1a7990dd32056bb5b3adcdf4a91d5ef76a1c6fd36d330b4c454529f9dcf3d | Python | 16,966 | 426 | """
This script allows you to convert MetaCLIP 2 (worldwide) checkpoints from the
original repository to the Hugging Face format.
URL: https://github.com/facebookresearch/MetaCLIP
To convert:
1. git clone the MetaCLIP repository
2. place it in the same directory as this script
3. move the conversion script to the Met... |
1d8dcdc6aec3f8cffe9a452ddc7aae8f3dbfb9a76870e58df1ede1a1630cee14 | Python | 16,989 | 449 | """Whole-slide imaging viewer for graphical interfaces."""
import cv2
import time
import numpy as np
import imgui
import slideflow as sf
from typing import Tuple, Optional, Union, Callable
from .. import gl_utils
from ...utils import EasyDict
# -------------------------------------------------------------------------... |
679e98cd5611e16dbf7d3e62812e65772a2b8a37c7f40bfed3da3f9e8390600c | Python | 16,996 | 420 | # Copyright 2023 Meta Platforms, Inc. 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
#
... |
0b55a78163546b2583fb0e9bd6af990dbc29fc35f0a3489435f25bebf65d7b9f | Python | 17,001 | 449 | # 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 ap... |
45bde059a203a144a1bfa595c2b5bfdb0988d2023e1be006831e3ffbcb0b08b3 | Python | 17,003 | 466 | """
Generate publication-ready architecture figure for HemiCET paper.
Creates a 3-panel composite:
Left: Real EEG input (18-ch bipolar, montage arrangement + simulated evidence)
Center: Architecture diagram (from PaperBanana candidate 2, re-generated)
Right: Real EEG output (same EEG with discharge markers + ... |
8b77b3a63ff6b9ab86e125b4d2348fd134fea2186d6cd3a2ee840bf2eccf6beb | Python | 17,006 | 384 | # 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 ... |
0b1e2411a15a0d9573cace7ba16edb8b8d62cb973133495e2ade54949a9bde7d | Python | 17,007 | 426 | # Copyright 2024 IBM and the HuggingFace Inc. team. All rights reserved.
#
# This code is based on EleutherAI's GPT-NeoX library and the GPT-NeoX
# and OPT implementations in this library. It has been modified from its
# original forms to accommodate minor architectural differences compared
# to GPT-NeoX and OPT used b... |
27babd048747f141e9096b9cf312232b06475fbe87322f778597b01448c500b3 | Python | 17,008 | 472 | """
=========
BCIEditor
=========
"""
import os
import ast
import json
from typing import Literal, TypeVar
from PySide6.QtWidgets import QTextEdit, QCompleter
from PySide6.QtGui import QTextOption
from PySide6.QtCore import Qt
from .highlighters import PythonHighlighter, CSSHighlighter
AUTOCOMPLETER = TypeVar('Au... |
31fb9c0e53403e70a9d9ee9ffefaff256d9329c471f6a4b433ce779db4fd5bf3 | Python | 17,009 | 460 | import re
import numpy as np
import pandas as pd
import torch
import slideflow as sf
import os
from typing import Union, List, Optional, Callable, Tuple, Any, Dict
from os.path import join, dirname, exists
from slideflow import log, errors
from slideflow.util import log, path_to_name
from ._params import TrainerConfig... |
fdf8fcf31b6cda9cb5bfee4dfb522ae8ec90c116c0fd7b4fa96a09e155373005 | Python | 17,018 | 418 | # 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 ... |
d2e0d437419085a32e075208f409ad7a9119ef345c526d3c47d5139db45a65ec | Python | 17,049 | 418 | # Copyright 2025 Meituan 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 requ... |
39e7b3086f07d116d025c8025454bb04c5965a52e29edd12dfcf5e273a70cb98 | Python | 17,062 | 565 | """
Modeling Relational Data with Graph Convolutional Networks
Paper: https://arxiv.org/abs/1703.06103
Code: https://github.com/tkipf/relational-gcn
Difference compared to tkipf/relation-gcn
* l2norm applied to all weights
* remove nodes that won't be touched
"""
import argparse
import gc
import logging
import time
fro... |
4c020a0bcd6cf043e485b8f9699d5a6943e9935ec0606567ee17ee89c6946415 | Python | 17,077 | 552 | ### This program predicts binary classicication of Ames Mutagenicity dataset with Shannon entropy (SMILES/ SMARTS/InChiKey-based), fractional Shannon entropy, bond (type) frequency and MW as descriptors
# import the necessary packages
from imutils import paths
import random
import os
import numpy as np
import pandas a... |
7b230444e83c9775ada46b129ebe8449ef94dcc5d24ac6b5e62b4c983e90ba20 | Python | 17,127 | 440 | # Copyright 2026 The LG AI Research 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
#
# Un... |
c5a81dafd9d4a18fd376b7dd72963b99f1e267d59552a65d1c50ea4ad7e64084 | Python | 17,129 | 372 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/gemma4_unified/modular_gemma4_unified.py.
# Do NOT edit this file manually as any edits will be overwritten by th... |
1dab621c414e81a2fde5be22bc7cb5da27f3b058d2196b8217c486c561c456ce | Python | 17,136 | 566 | """RGCN layer implementation"""
from collections import defaultdict
import dgl
import dgl.function as fn
import dgl.nn as dglnn
import torch as th
import torch.nn as nn
import torch.nn.functional as F
import tqdm
class RelGraphConvLayer(nn.Module):
r"""Relational graph convolution layer.
Parameters
---... |
21f2272614908750dc8e253df0758ec10ad10432cd5a51da4102305054f260c7 | Python | 17,156 | 520 | """
PDNetV2 Dataset.
Builds a PyTorch Dataset from:
- EEG segments (18, 2000) at 200 Hz (10 seconds)
- Discharge timing labels from discharge_times.json
For each patient with review_status='ground_truth' and >=2 discharge times,
we use one 10-second EEG segment aligned to the discharge times.
Targets (all at 100... |
85ebbb5d35106ef8f571815a3bdc1827796466cd5c3ab7249960d4cdd0a3b693 | Python | 17,167 | 385 | # 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... |
345bf891c1a00a99de4ca8b8b3b49665998646a7a8f9c3d8fd1d649d5b5d34b4 | Python | 17,169 | 329 | # 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 ... |
423f9e3a433b506e34d12b94fb8ec36f8d2061e87b0422d4aa0711136799a460 | Python | 17,196 | 440 | # 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... |
a322a78c84c65dfc4e0a647f1458ea6d73c831b57f4dea5e6af1bd5a49a3645a | Python | 17,201 | 420 | # 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... |
50f06a3cbb040d7a235d8fe4619725ed11c994f972e84e8dd8b3eafe9c568289 | Python | 17,213 | 470 | #!/usr/bin/env python3
"""
Generate Fig 3: RDA Characterization Pipeline composite figure.
Three-panel horizontal layout:
Panel A (left): Input 19-channel EEG (average reference, 10s)
Panel B (center): Architecture flowchart (W05 iterative narrowband refinement)
Panel C (right): Output visualization (EEG + na... |
2a70642dd07a312a1df29acace408374e0be6aae8f5c2939d3227083d24e5624 | Python | 17,224 | 451 | """Various search functions for use with GAN embedding interpolation."""
from typing import Iterable, Optional, Tuple
import numpy as np
import slideflow as sf
import tensorflow as tf
import torch
from functools import partial
from sklearn.decomposition import PCA
from slideflow.gan.stylegan2.stylegan2.utils import n... |
961665805532efd0829aa5665c6b9d2c12ac43a0ff91b75eadca421d08ad8ce0 | Python | 17,230 | 385 | # 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... |
fb8636d4671d02f28c32ef58556f473f59f8d18d74b359fec6525d1262b06913 | Python | 17,244 | 467 | import itertools
import re
import subprocess
from copy import copy
from pathlib import Path
import more_itertools
import napari
import numpy
import pandas
from matplotlib import pyplot
from numpy import ndarray
from pandas import DataFrame, Series
from sqlalchemy import create_engine
from tqdm.auto import tqdm
from d... |
7dacf0098bbb6c1a69daf7cda7626d9fa709f8f24fef2b110ad303adb8690087 | Python | 17,260 | 529 | """
This script is a PyG counterpart of ``/examples/graphbolt/rgcn/hetero_rgcn.py``.
"""
import argparse
import time
import dgl.graphbolt as gb
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_geometric.nn import SimpleConv
from tqdm import tqdm
def accuracy(out, labels):
assert ou... |
119a94d3855963014487f272ef13bd2d7e195c76abbcce0cc0ef095ce385a9ac | Python | 17,267 | 470 | from sklearn.preprocessing import StandardScaler, OneHotEncoder
from sklearn.ensemble import GradientBoostingRegressor, GradientBoostingClassifier, RandomForestClassifier, \
RandomForestRegressor
from sklearn.tree import DecisionTreeClassifier, DecisionTreeRegressor
from sklearn.linear_model import LogisticRegressi... |
b59ed3139a28844d823d786b9ca5266399b0de78b8162b51ce2721a7a82864e4 | Python | 17,269 | 389 | from PyQt5.QtCore import Qt
import copy
from PyQt5.QtWidgets import (
QLabel,
QLineEdit,
QWidget,
QVBoxLayout,
QHBoxLayout,
QGridLayout,
QPushButton,
QScrollArea,
QMessageBox
)
from windows.network.network_plot import PlotCanvas
class NetworkParameterWidget(QWidget):
def __init... |
5c3e04d3bc12e51df87fd07a0e60b6fceb3f35975c4b32354a2e78abc26952e4 | Python | 17,272 | 422 | """ Python module containing a class for basic interface of an ML model, as well as functions
shared by multiple model types.
"""
import os
import logging
import numpy as np
from tqdm import tqdm
import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()
from .layer_functions import add_linear_layer
class BaseMode... |
6d4f687c1affaaf376c07f1d5c73cd9ff0d6780f0ef0c7ba580b9499314010bc | Python | 17,282 | 467 | """
Round 4 annotation selection: GPD (all available) + LPD (up to 30) for frequency annotation.
Priority is GPD — we need ~27+ more GPD patients to reach 100 total.
Steps:
1. Load cached external segments (3816 segments, 18ch bipolar, 2000 samples @ 200Hz)
2. Exclude previously annotated patients (canonical + candida... |
123b5096ff9f931e8f678c039939d5e548d7f4d6dd73d4e570d1585ebd575c8c | Python | 17,291 | 51 | import pandas as pd
import os
# a = np.array([[ 83.41],
# [ 14.94],
# [ 70.98],
# [132.93],
# [169.22],
# [126.34],
# [ 65.8 ],
# [ 10.63],
# [ 46.2 ],
# [294.61],
# [214.78],
# [ 8.13],
# [287.12],
# [323.26],
# [ 25.9 ]... |
d95b8cc25121086f95988207a83f220d3bd493856cc27d04430aac28bce2f754 | Python | 17,334 | 534 | from __future__ import annotations
import os
import shutil
import zipfile
from concurrent.futures import as_completed
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
import pandas as pd
from launchcontainers.log_setup import console
def find_subseslist(analysis_dir):
"""
Locate ``... |
4b08e8156a836a15be364785bfd493dab94b766b00e32a16490bb829d7bdec24 | Python | 17,348 | 431 | # 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... |
8830538cd59b680acbc6c9d7c5c403bb426ffb71f1505bc0d7404600c06c9bbb | Python | 17,348 | 270 | """
Score calculation functions for appraise package and the demo notebook.
Author: Xiaozhe Ding
Email: xding@caltech.edu, dingxiaozhe@gmail.com
"""
import pandas as pd
import numpy as np
from appraise.utilities import *
def calculate_B_energetic(N_contact, N_clash=0, clash_penalty_weight=1000):
"""
calcualte ... |
ef4dbd6350903b44fa645f1d7ac04157944b5a8f3b944bd6a5a2c45fd719623e | Python | 17,348 | 423 | import torch
from torch import nn
from typing import Optional, List
from slideflow import log
from slideflow.model.torch_utils import get_device
# -----------------------------------------------------------------------------
class Attention_MIL(nn.Module):
"""Attention-based multiple instance learning model.
... |
497f9b9e518d9275b4dcb00bd48bca55fc70d7098004cd3299357b88f72e5114 | Python | 17,351 | 527 | # /*!
# * Copyright (c) 2022, NVIDIA Corporation
# * Copyright (c) 2022, GT-TDAlab (Muhammed Fatih Balin & Umit V. Catalyurek)
# * 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 ... |
48f600d5a69fb1fb38e677c22bdd5dd6631f31cfa8ae542b573f4417b718fd11 | Python | 17,359 | 612 | import inspect
import json
import os
import pickle
import shutil
import time
import zipfile
from functools import partial, reduce, wraps
from timeit import default_timer
import dgl
import numpy as np
import pandas
import requests
import torch
from ogb.nodeproppred import DglNodePropPredDataset
def _download(url, pa... |
78838ba184630b3193369ff235ec37e28661ac5e25125ce213f3954f6069f547 | Python | 17,381 | 569 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from the modules in `src/transformers/models`.
# Do NOT edit this file manually as any edits will be overwritten by auto-generation of the file.
#... |
8f9990c16d324d6c86b82873f5f196d4fd9ba2ca8898911fe1d8b13759f5aa2d | Python | 17,402 | 477 | """
This script demonstrates node classification with GraphSAGE on large graphs,
merging GraphBolt (GB) and PyTorch Geometric (PyG). GraphBolt efficiently manages
data loading for large datasets, crucial for mini-batch processing. Post data
loading, PyG's user-friendly framework takes over for training, showcasing s... |
c1db7385d4f9f4fdc05e95b90e9958818108ec090d3d039613273e46611030b4 | Python | 17,405 | 440 | import cv2
import torch
import numpy as np
import matplotlib.pyplot as plt
import slideflow as sf
from typing import Union, Tuple, Optional
from . import cwh_to_whc, whc_to_cwh, is_whc
# -----------------------------------------------------------------------------
class ColorProfile:
"""Color profile for histogr... |
543f3fe9a8e8b24125133e9857d3b2302d16a59377dc1239782c6b771ad28e51 | Python | 17,413 | 460 | # Copyright 2025 Arcee AI 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 req... |
fc133d85e27ce16e3927097737bdcb432471fd080c680c2a7196b9779cd9f383 | Python | 17,432 | 482 | """
Evaluate RDA spatial extent estimation against 3-rater ground truth.
Sweeps thresholds for VE, SNR, PLV, and blends.
Reports MAE, Pearson r, ICC(3,1) at optimal threshold.
"""
import numpy as np
import pandas as pd
import scipy.io as sio
from pathlib import Path
import sys
import warnings
warnings.filterwarnings(... |
5e9a43e77d66ed30fae763cb10484dc16ce6e6683d2b7fc93718a139676b8349 | Python | 17,457 | 387 | # 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... |
732d73a908f5988e66728650fcef0cfb37c40ee294a78446efeed6c99d209308 | Python | 17,477 | 445 | # Copyright 2026 BioHub 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 requi... |
e4bea1090637d06872102273309feb1f004fcc5c36aec3970fad652b867ebf84 | Python | 17,506 | 373 | # 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.