sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
ada4e1b6781b0aebb90233fc9727d8ac5d9e128996c9f306344904394659e7cd | Python | 13,173 | 306 | # Copyright 2024 The ggml.ai team and The HuggingFace Inc. team. and pygguf author (github.com/99991)
# https://github.com/99991/pygguf
#
# 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
#
# ... |
9a601b55485d4d0f1d12774fadb2ff51d5ff244be03353a4db3e0f8885a519c5 | Python | 13,190 | 487 | #!/usr/bin/env python
from __future__ import print_function
import pdb
import random
import sys
from collections import OrderedDict
import numpy as np
import numpy.random as npr
from sklearn import preprocessing
################################################################################
# dna_io.py
#
# Methods t... |
9fbc06d60ab56a8cf3c7f41ca3c0912d82cb338e6815e4c1aa991d0f47a41b77 | Python | 13,202 | 337 | """
Laterality classification experiments: left vs right for LPD patients.
Tests different classifiers, feature subsets, and class balancing via LOPO CV.
Run: conda run -n foe python code/exp_opt_lat_class.py
"""
import sys
import json
import time
import subprocess
import numpy as np
from pathlib import Path
CODE_D... |
64354694e0585b4fae61e5a4352280a6570e31ca78912fd2bd0c8a0a4ce28c77 | Python | 13,215 | 406 | # @license
# Copyright 2017 Google Inc.
# 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... |
9ecf67acc6aca967b4f48a70034eedec771116244fbbf18bc80557f6f8cdefc8 | Python | 13,221 | 372 | """
ML regression experiment: predict frequency from signal processing features.
Uses leave-one-out cross-validation with Ridge, Random Forest, and Gradient Boosting.
"""
import sys
import numpy as np
import warnings
from pathlib import Path
warnings.filterwarnings('ignore')
CODE_DIR = Path(__file__).resolve().pare... |
6a5d3b5aa15c2cc6c51221e49ca56f4f71ed5aaa3f1539af765fca239c2e3b17 | Python | 13,234 | 215 |
"""
Created on Tue May 19 2020
Last updated Tue Apr 12 2022
@author: nsauthier@gmail.com
Create a dataframe with normal reference range for all values (along with statistics)
Reference range were either extractedfrom the oasis raw data
or from logic (i.e. min=0, max=0) or rarely manually decided
Some of them are m... |
b83b8beada5e089892671123b9c66b6b15f0b8f3b5b99e2853fac0ff89ddfe53 | Python | 13,239 | 262 | ## Program: VMTK
## Language: Python
## Date: February 12, 2018
## Version: 1.4
## Copyright (c) Richard Izzo, Luca Antiga, All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNE... |
769319e752de9891fb8671bf0675f11a8d056acfebffbbced6a78b094bea595e | Python | 13,241 | 390 | import os
import pandas as pd
import logging
from sklearn.compose import ColumnTransformer
from sklearn.pipeline import Pipeline
from sklearn.utils.validation import check_array
from sklearn.tree._tree import DTYPE
from dbconnection.connector import get_connector, get_tables
from mlmodel.mlmanager import MLManager, Op... |
d899b19e6451ca8af4abb6578aa894081ef96b9e7dcee3d0f0992d1e4870851e | Python | 13,244 | 349 | # 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... |
e00ca73604da5914450db2432944b0805425e1837a58e883191c5de043eca74d | Python | 13,260 | 406 | import os
import subprocess
from pathlib import Path
import yaml
import sys
import hashlib
import asyncio
import argparse
# ----------------------
# Load Configuration
# ----------------------
CONFIG_PATH = Path(
os.environ.get("SIMPLEMIND_TOOL_ENV_CONFIG", Path(__file__).with_name("env.yaml"))
).expanduser()
de... |
b4334548f3556fede0a863ebdba82b3d7137b9eeb79e09e048f025db667c5d8d | Python | 13,264 | 388 | # Copyright (c) 2026 ByteDance Ltd. and/or its affiliates.
# SPDX-License-Identifier: Apache-2.0
"""Transform behavior tests for Forward Laplacian."""
import jax
import jax.numpy as jnp
from jaqmc.laplacian import LapTuple, forward_laplacian, make_laplacian_input
from tests.laplacian.helpers import (
assert_allc... |
0d179ccdf64c84de509315aa2aa4f52cce59b51325c90da0a32728683f196c18 | Python | 13,269 | 317 | # -*- coding: utf-8 -*-
"""
Script to plot KCNA1 mutations - Figure 6
"""
__author__ = "Nils A. Koch"
__copyright__ = "Copyright 2022, Nils A. Koch"
__license__ = "MIT"
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os
import string
from Figures.plotstyle import mut_style
import seaborn... |
8236d1b6fdbfb714ca41348dbdce019e6573e7637fd10eb31f3134b79afb8dd3 | Python | 13,271 | 285 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/colqwen2/modular_colqwen2.py.
# Do NOT edit this file manually as any edits will be overwritten by the generation... |
42dbf6c96027cb8c4e2da09d053c38431d1bf2aed640b59a0f67b1d06d8f54fa | Python | 13,273 | 335 | """Torch modules for graph attention networks v2 (GATv2)."""
# pylint: disable= no-member, arguments-differ, invalid-name
import torch as th
from torch import nn
from .... import function as fn
from ....base import DGLError
from ....utils import expand_as_pair
from ...functional import edge_softmax
from ..utils import... |
5040c78a69ef5d17f8eeba6788a7014450532b95d90e4737a7c8428b931e02a2 | Python | 13,279 | 573 | from __future__ import absolute_import
import builtins
import numbers
import os
import mxnet as mx
import mxnet.ndarray as nd
import numpy as np
from ... import ndarray as dglnd
from ...function.base import TargetCode
from ...utils import version
if version.parse(mx.__version__) < version.parse("1.6.0"):
raise ... |
6d0a8d8419d418c8babf3d35c3a5a5ba281316bf66a8e22cc29172c216fac869 | Python | 13,297 | 317 | from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import (
QWidget,
QVBoxLayout,
QLineEdit,
QPushButton,
QGridLayout,
QLabel,
QSpacerItem,
QSizePolicy,
QHBoxLayout,
QScrollArea,
QComboBox,
)
from windows.simulation.sim_plot import PlotCanvas
from typing import TYPE_CHEC... |
1a383e20222e8b97a9b19213e6c3bfe1b4164480a3f25117e57412d74cc8928b | Python | 13,298 | 435 | import os
import pickle
import numpy as np
from scipy.spatial.distance import cdist
from tqdm.auto import tqdm
from .. import backend as F
from ..convert import graph as dgl_graph
from .dgl_dataset import DGLDataset
from .utils import download, extract_archive, load_graphs, save_graphs, Subset
def sigma(dists, kth... |
407b1e8eb12a66f47be2f5a4eaa21709b7f1bc8aab1557792b043ddc07661457 | Python | 13,299 | 464 | import argparse
import itertools
import sys
import dgl
import dgl.nn as dglnn
import psutil
import torch as th
import torch.nn as nn
import torch.nn.functional as F
from dgl import AddReverse, Compose, ToSimple
from dgl.nn import HeteroEmbedding
from ogb.nodeproppred import DglNodePropPredDataset, Evaluator
from tqd... |
9f35c638788c995f4014df6c8514bb2dcdd08e8da397adc28e5aff0a7b3f3ec3 | Python | 13,304 | 328 | # Copyright 2021 Facebook AI Research & 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
#
# ... |
a29e55d530373b13114ee962c6764fe0edf5e8239a5eeadc000d6462a65c1791 | Python | 13,304 | 383 | # impute benchmark on standard VAE
import anndata
import numpy as np
import pandas as pd
import torch
import torch.nn.functional as F
import os
import mygene
from utils import load_annotations
from sklearn.model_selection import train_test_split
from torch.utils.data import Dataset, DataLoader
from datasets import R... |
d14c00a6aa0eab3390a851c3ee5ae8fac9c56d1767e02dd4972ec5b37cb5e249 | Python | 13,305 | 379 | """
train_utils.py
==============
Shared training utilities for SimpleMind segmentation learners (2D & 3D).
Includes:
- compute_iou
- plot_loss_miou
- train_val_test_split
- add_decoder_dropout
- is_no_augmentation_config
- visualization helpers (optional)
"""
import os, re, torch, numpy as n... |
173967b7199af19ddf6bee944112a7c879000fb0be178558acf3800cf088a338 | Python | 13,311 | 382 | import copy
import rdkit.Chem as Chem
import torch
import torch.nn as nn
import torch.nn.functional as F
from dgl import batch, unbatch
from .chemutils import (
attach_mols_nx,
copy_edit_mol,
decode_stereo,
enum_assemble_nx,
set_atommap,
)
from .jtmpn import DGLJTMPN, mol2dgl_single as mol2dgl_de... |
d34a3c4991ca328d6a9afdc8e7512ddfc49c17239cb9dab8834e7aa0f0a9452f | Python | 13,317 | 298 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# 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 ... |
267e6c184aa0f659194d5c91d840fef13acd935bacb671efa9b0bfd4293b515b | Python | 13,320 | 292 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/cohere2_vision/modular_cohere2_vision.py.
# Do NOT edit this file manually as any edits will be overwritten by th... |
0771f6711d8b578a706297dd3445037a276e2c53eb001f6d4f2c69fea4be2d3f | Python | 13,325 | 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... |
071c788281b098dfa96198eb5ad43a3f8819b245faf38ae457066dd4b7589efe | Python | 13,334 | 401 | # repo originally forked from https://github.com/Confusezius/Deep-Metric-Learning-Baselines
"""to do:
clean all of the files - particularly the main.py and also the losses and dataset files and the file for doing the dataloading
-- fast loading etc
need to change all of the copyrights at the top of all of the files... |
6bdbdadd3824cacffbbfb51c46e97edaf4520af6266f7011ba18789b202660b4 | Python | 13,349 | 417 | import argparse
import logging
import time
import mxnet as mx
import numpy as np
from data import *
from gluoncv.data.batchify import Pad
from gluoncv.utils import makedirs
from model import faster_rcnn_resnet101_v1d_custom, RelDN
from mxnet import gluon, nd
from utils import *
import dgl
def parse_args():
pars... |
e818fd82b4395d49de610250a8fdb09ec615e035c4bd801a923d5dcc41c1d0d7 | Python | 13,352 | 368 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtksurfaceclipper.py,v $
## Language: Python
## Date: $Date: 2006/05/26 12:35:13 $
## Version: $Revision: 1.9 $
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENSE file for details.
## This software is di... |
2fa7731b1070a366486e0fc0bd2b780fc27dde5af6701aa094a5113afb38a0e9 | Python | 13,363 | 373 | # 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... |
da4e60c47022310601cefcfa0e0dc5a11d5205c673f3ea1c29c7ae7c7f56537b | Python | 13,370 | 394 | """
Segmentation Evaluation Utility
================================
This module provides utilities for computing segmentation performance metrics:
- Dice coefficient (F1 score for segmentation)
- Hausdorff distance (boundary accuracy measure)
- Statistical summaries across multiple samples
Can be used standalone or ... |
52f2f2bb37564dd9bdd1d517550b2d80da1f41b18d1db8dfbf1e2456e979e3df | Python | 13,371 | 352 | #!/usr/bin/env python3
"""
Evaluate 3-way LPD vs GPD vs BIPD subtype classification.
Uses per-hemisphere discharge timing features from bipd_cache/
combined with ChannelPD-Net channel probabilities.
Features:
- 18 per-channel PD probabilities
- 8 timing-pair features (from L/R hemisphere discharge sequences)
Usa... |
d5ff809fcda169d2640619e85e8359b41938efae45d730157fae6a718c6a7f41 | Python | 13,379 | 430 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib import gridspec
def reldiffs(fother,f1,iother,i1):
iout = []
rdout = []
N1 = len(f1)
Nother = len(fother)
for i in range(Nother):
ithis = iother[i]
for j in range(N1):
ibasic = i1[j]
... |
75880f0499a5416605fe9b7ddf16026ef7e294ba0a8b8f7f38078ba8698d5c94 | Python | 13,380 | 340 | import torch
import numpy as np
import torch.nn as nn
from persist import models, utils
class PERSIST:
'''
Class for using the predictive and robust gene selection for spatial
transcriptomics (PERSIST) method.
Args:
train_dataset: dataset of training examples (ExpressionDataset).
val_data... |
86dfd62e4d91396e03ebd5fafeb72c223103c41dd0aa353dfc104293b9428dce | Python | 13,390 | 325 | '''
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), 'nn-t... |
58578fe79027f3b00713366818c41ac71f0ebcf19f7b727482f74cbd16d03c3c | Python | 13,393 | 322 | '''
'''
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__))
CUR_DIR = ''
#MODELS_DIR = os.path.join(os.path.dirname(CUR_DIR), 'models/')
MODELS_DIR = os.path.join('', 'models/')
class Con... |
d6eb47c5e675d0700b851d7d3251603e388e7a2efdc58131b5ff5f46f8d8f242 | Python | 13,417 | 295 | # 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 ... |
bf47fd35a27cb24f6f8f720cfac8fae878c36576bee21bea07615433e6346e8c | Python | 13,436 | 363 | 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 = 4785... |
634d129249f2a6be37e2fd1fb67402865615232f2167cd68ac5b336c40a969e3 | Python | 13,450 | 372 | """DataPipe utilities"""
import threading
import time
from collections import deque
from typing import final, List, Set, Type # pylint: disable=no-name-in-module
from torch.utils.data import functional_datapipe, IterDataPipe, MapDataPipe
from torch.utils.data.graph import DataPipe, DataPipeGraph, traverse_dps
__al... |
2fe01aeafe80c2318634081183d10d87e2fad76efb9446e4d505acce9737ff53 | Python | 13,452 | 316 | from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
from typing import Any, Dict, List
try:
import yaml
except ImportError as exc: # pragma: no cover - exercised in runtime, not tests
raise RuntimeError(
"skills_runtime requires PyYAML. Activate the smcore e... |
0d28f632447536b3dd89e4845e108bac2be3c13c9d6909b2582d29f3e5c372fe | Python | 13,456 | 447 | 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 dgl.geometry import (
farthest_point_sampler,
) # dgl.geometry.pytorch -> dgl.geometry
from torch.autograd import Variable
"""
Part of the code are adapted from
https://github.com/yanx27... |
41b3396b3b1a768e59ad910f694fb44cd3210a3bde8daeb2e84ca35f02a5b591 | Python | 13,459 | 369 | 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 = 47851... |
f14a470796d4a5006c2f39d8a1d9023b54570ad357b68319f97fdfbb6ee16aa7 | Python | 13,463 | 311 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkimagewriter.py,v $
## Language: Python
## Date: $Date: 2006/07/27 08:27:40 $
## Version: $Revision: 1.18 $
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENSE file for details.
## This software is dist... |
5ac606fa8cac97108951e17d2c6830419671d2bd0004e27599d8e2f3843dc1ce | Python | 13,466 | 347 | """
Evaluate frequency estimation improvements for HemiCET+DP.
Tests:
F1: Current CNN+ACF freq → HemiCET+DP (baseline, F1=0.891)
F2: Two-pass: CNN freq → HemiCET+DP → IPI freq → re-run DP
F3: FFT of HemiCET evidence trace as freq estimate
F4: ACF of HemiCET evidence trace as freq estimate
F5: HemiCET evidenc... |
719411ba6a78b529a70da7e50fd45f3459c53ec074f17ed0d927b861a69f43de | Python | 13,471 | 330 | """
Tool Name: qc_tooth_segmentation_v1
===================================
Description:
Perform dental semantic and spatial-coherence QC for one labeled arch
SMMesh. This capability interprets FDI/jaw metadata while consuming
geometric operands from general mesh/point tools.
Parameters:
- input_mesh:... |
729224010011eb07bc04b6da5866bcd0ae14125f5a5ba3b370bfe13e28aded0c | Python | 13,473 | 306 | """
analysis_checker/prf_prepare.py
================================
PRF prepare output spec.
Expected structure:
analysis_dir / sub-XX / ses-XX / func / <files>
─── Groups per session (8 total) ────────────────────────────────────────────
maskinfo-L all left-hemi ROI maskinfo JSONs (fixed list)
ma... |
e163fddc866da3f80ac781b7211eda60ad62eba565ded3d22550fe4ab6b50ca0 | Python | 13,476 | 318 | import argparse
import asyncio
import json
import os
import tempfile
import time
import unittest
from pathlib import Path
from unittest.mock import patch
from simplemind.runtime import bb_session
def write_manifest(root: Path, **overrides):
artifact_dir = root / "sms"
artifact_dir.mkdir(parents=True, exist_o... |
5b20c0a3625edc0001a98f09ce3c6b5baa1100e1d7ad8dee649e4d45c8468665 | Python | 13,477 | 369 | # 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... |
c667de30171957e43be1077a693911c470dd758d2776df35c944e82f6222d0e3 | Python | 13,480 | 409 | """Data utilities."""
from collections import namedtuple
import networkx as nx
import scipy as sp
from .. import backend as F
from ..base import DGLError
from . import checks
def elist2tensor(elist, idtype):
"""Function to convert an edge list to edge tensors.
Parameters
----------
elist : iterabl... |
bf8ee55bb1a6dc40ca3523b1b4bea6bc8b023b0359d16f875fa9a2c11934e806 | Python | 13,481 | 318 | """Tensorflow modules for graph attention networks(GAT)."""
import numpy as np
# pylint: disable= no-member, arguments-differ, invalid-name
import tensorflow as tf
from tensorflow.keras import layers
from .... import function as fn
from ....base import DGLError
from ...functional import edge_softmax
from ..utils impo... |
fda0fa1c706d20bda78464253f21be927163889d941211e8fb737f08c2ef1714 | Python | 13,481 | 333 | # 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... |
fe3f9c23593a8e70fe0336b27b411737f483feaef569e0700ce3099bb9b82c98 | Python | 13,481 | 351 | """QC algorithm for applying tissue segmentation (via U-Net-like models)."""
import cv2
import slideflow as sf
import numpy as np
import shapely.geometry as sg
from typing import Union, Optional, List
from scipy.ndimage import label
from .strided_dl import StridedDL_V2
# --------------------------------------------... |
929caf1e1da4cc6bd1f2d506223da5b1a194d5adec096f18385ef9799c514814 | Python | 13,482 | 415 | """Fraud Dataset
"""
import os
import numpy as np
from scipy import io
from .. import backend as F
from ..convert import heterograph
from .dgl_dataset import DGLBuiltinDataset
from .utils import _get_dgl_url, load_graphs, save_graphs
class FraudDataset(DGLBuiltinDataset):
r"""Fraud node prediction dataset.
... |
738f5e52cae54c0a940404f59478da333f7a88c42e35af0e37dcf72db92c5545 | Python | 13,491 | 399 | import os
import pickle as pkl
import random
import dgl
import numpy as np
import torch
from torch.utils.data import DataLoader, Dataset
# Split data into train/eval/test
def split_data(hg, etype_name):
src, dst = hg.edges(etype=etype_name)
user_item_src = src.numpy().tolist()
user_item_dst = dst.numpy(... |
ee9ac86b7cb12210adc82885af6bdb95a043a6b36ef2b185db40f0ad688d88c2 | Python | 13,510 | 304 | """
Contains a class that converts the pre-processed binary file into a numpy array. The logic behind
each conversion step is thoroughly document through comments in the code.
"""
import pickle
import os
import struct
import logging
import hashlib
import numpy as np
from tqdm import tqdm
import matplotlib
class Prepr... |
25b8405f95a1d29e1527b98db291b05b85b2d632b29123411550b168a31c69e8 | Python | 13,511 | 304 | # 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... |
9426175f62260ceedc837e98ac58728d2857c00885f434c4a8c6d0b7bcd64a41 | Python | 13,524 | 364 | # Copyright 2025 Nicolas Boizard, Duarte M. Alves, Hippolyte Gisserot-Boukhlef and the EuroBert 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... |
1901f2bd000c384899c9c1239209b328d2b2ae245bef9c63e80a1dde0fdc932c | Python | 13,531 | 281 | from operator import itemgetter
import dill
import numpy as np
import pandas as pd
from allensdk.brain_observatory.ecephys.ecephys_project_cache import EcephysProjectCache
from scipy.stats import zscore
from sklearn.preprocessing import MinMaxScaler
from Utils.Settings import var_thr, neuropixel_dataset, output_folder_... |
f215eb61fb828101898e8a5f5345f0140211baa28deb7d3667b1299fb5412593 | Python | 13,536 | 322 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/lightglue/modular_lightglue.py.
# Do NOT edit this file manually as any edits will be overwritten by the generati... |
83080bef85540c3ceedfc1a140db485daa5325359956ccde0e6a0e6b2a7eeb1b | Python | 13,537 | 311 | 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"""
... |
b5ec47b7850f265498adcb26bcbd0e471dbb8334bd953dd4ddf4e8ba89d93f40 | Python | 13,538 | 360 | from ..core_model_loading import ConversionOps
from ..quantizers.quantizers_utils import get_module_from_name, should_convert_module
from ..utils import is_torch_available, logging
if is_torch_available():
import torch
import torch.nn as nn
import torch.nn.functional as F
logger = logging.get_logger(__na... |
92e96f818e108fda2b5497cf5bc3587fa8af6eac35adb33996c44ca91cf34cad | Python | 13,550 | 394 | '''
This code is adapted from process steps on eICU of previous works (cited)
https://github.com/Google-Health/records-research/tree/master/graph-convolutional-transformer
'''
import csv
import tensorflow as tf
tf.compat.v1.enable_eager_execution()
import sys
import pickle
import argparse
import numpy as np
from sklea... |
a17cb86ac56ff9c304efa0cb51c6d0e4f31d43bd8f89d7bdd3750b48f5becba1 | Python | 13,551 | 382 | #!/usr/bin/env python3
"""
Filter subseslist based on modality and depth criteria.
This script reads a CSV file with session data and creates a filtered subseslist.txt
based on user-specified criteria.
"""
from pathlib import Path
from typing import Optional, List
import pandas as pd
import typer
from rich.console im... |
fd86379cba946bc62673cf96c65760224bd615657a3d491fda9e1dcfa1c9d557 | Python | 13,551 | 361 | # 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 ... |
f06152f61df58bd69588d89228de865b9a2afd86aca80681774900a7eb1f7dfa | Python | 13,553 | 322 | # Copyright 2024 Cohere 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 by the Meta AI team tha... |
88d27fb4e5865346292ac4c7ed6878e09b3dd0be14d6ed370d483f6141ad6c34 | Python | 13,563 | 293 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/inkling/modular_inkling.py.
# Do NOT edit this file manually as any edits will be overwritten by the generation o... |
d21b8714f17d7663b2a8c2289ed5bb2b94877e3c73d130ec838e06e39f27f394 | Python | 13,566 | 362 | 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:
# Most used:
#testmodel = 488462965
#testmodel = 478513407
te... |
28a1e553ffb2961bbc80ba6ae9cbce9a11704fbb8ad6e0c06021685bdbe589d4 | Python | 13,569 | 395 | import dgl
import dgl.function as fn
import scipy.sparse
import torch
import torch.nn as nn
import torch.nn.functional as F
from dgl import DGLGraph
from dgl.nn import AvgPooling, GraphConv, MaxPooling
from dgl.ops import edge_softmax
from functions import edge_sparsemax
from torch import Tensor
from torch.nn import P... |
15ec76da305f305b247b45f22ba18f33881cfc0e22e2955da721106297dc8289 | Python | 13,583 | 282 | #!/usr/bin/env python3
# -----------------------------------------------------------------------------
# Copyright (c) Yongning Lei 2025-2026
# Apache-2.0 license
# -----------------------------------------------------------------------------
"""
epi_vol2surf.py
Orchestrator for the EPI vol2surf pipeline. For each sub... |
d61f591a8cab593cdf927ba157459c98a345ed814f1a3fcb13ccc46821909451 | Python | 13,583 | 336 | import sys
import os
sys.path.append("../utils")
from WDKernel import wdkernel_gram_matrix, get_K_value, parallel_wdkernel_gram_matrix
import time
from datetime import timedelta
from contextlib import redirect_stdout
from datetime import datetime
from sklearn.svm import SVC
from sklearn.model_selection import train_tes... |
a41b93b75e2a8ced54bf5fc9d07c78a7dba97ce2b49cd94357a8c344c9ca3e1d | Python | 13,592 | 384 | """TFRecord reading/writing utilities for both Tensorflow and PyTorch."""
import cv2
import copy
import os
import struct
import numpy as np
from PIL import Image
from multiprocessing.dummy import Pool as DPool
from os.path import exists, isdir, isfile, join
from random import shuffle
from typing import Any, Dict, Opti... |
e67e192c3b7745b73bce667c2d9434c200609a5359f345d577535c9f946c49d4 | Python | 13,597 | 332 | # 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... |
0a41c87e58f42b37d0fb0a10675653a8fae5e365d6779d24662283ca4831edf8 | Python | 13,612 | 295 | from networks import tpdi_networks
from networks import bp_network
import torch
import numpy as np
import random
from torch.utils.data import DataLoader
import numpy as np
from utils import utils
def generate_data_from_teacher(args, num_train=1000, num_test=100, n_in=5, n_out=5,
... |
511fa10a73bf58df48b282a958dceee3ab36bd1265350c0cc87f15056931c71b | Python | 13,620 | 306 | # 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... |
65dbc974d10d2407f7323ad24af412ac031b0cfb625c9049453c20f67b60e818 | Python | 13,620 | 413 | import os
import re
import unittest
from collections.abc import Iterable, Mapping
import backend as F
import dgl.graphbolt as gb
import pytest
import torch
from torch.torch_version import TorchVersion
from . import gb_test_utils
def test_pytorch_cuda_allocator_conf():
env = os.getenv("PYTORCH_CUDA_ALLOC_CONF")... |
b428cd92ad5da9322f7a7dae2fbcb35debe7be9a68aa551f4b4a46ec07f3206b | Python | 13,620 | 371 | from typing import Dict, Optional, Tuple, Union, Any
import torch
import numpy as np
import torchvision
import slideflow as sf
from rich.progress import Progress
from slideflow.dataset import Dataset
from slideflow.io.torch import cwh_to_whc, whc_to_cwh, is_cwh
from slideflow.norm import StainNormalizer
from slideflo... |
0378b0225065da737ff1361a2e39765f382694c268fbd07481882574a752904d | Python | 13,632 | 328 | """
Tool Name: morphology
=================================
Description:
Performs morphological processing on binary masks (SMImage) in 2D or 3D.
Masks are assumed to contain only 0 and 1 values.
Parameters:
- input_image (SMImage): Input binary mask to be processed (2D or 3D).
- morphological_task (s... |
8abbe0a29de8b25ec8a6ff81c7e579eb4e75acfc7892516ff178e55235af302a | Python | 13,649 | 277 | # Copyright 2020 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 ... |
7570d8b69982c59967b3fc915547933f5b1f47f62b7ae110cdfa7749451ffbae | Python | 13,657 | 324 | #!/usr/bin/env python
from optparse import OptionParser
import copy, math, os, pdb, random, subprocess, sys, time
import h5py
import numpy as np
import matplotlib.pyplot as plt
from PIL import Image
import pandas as pd
import seaborn as sns
from scipy.stats import spearmanr, pearsonr
from sklearn.linear_model import R... |
f7f903f9a13d4da501a6337961b72a601c50b8c7ab6bd643f99656a374ee5caa | Python | 13,665 | 474 | import argparse
import random
import dgl
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from dgl.dataloading import GraphDataLoader
from ogb.graphproppred import Evaluator
from ogb.graphproppred.mol_encoder import AtomEncoder
from preprocessing import... |
00afecfd1ad744f45470771a514a1da58dc5c8d9ca4b7158612ffaddf66283e0 | Python | 13,671 | 350 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtksurfaceendclipper.py,v $
## Language: Python
## Date: $Date: 2015/12/01 14:45:13 $
## Version: $Revision: 1.0 $
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENSE file for details.
## This software is... |
ba722f920612834a60b39b6eb7b8e2c73c646a3497917ae9f7e07f7aac254eaa | Python | 13,692 | 366 | 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:
# Most used:
#testmodel = 488462965
#testmodel = 478513407
te... |
aae76380d85e212d87dcfd428a9021c625588fc09d8bc0d9673278af3eb4740b | Python | 13,703 | 334 | ####################################################################################################
# Copyright (c) 2021-, 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... |
f602fbd92a5ce596d660c5608e03d94782b9d3b80d454b6889cdf5c932232775 | Python | 13,714 | 358 | # 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
#
... |
a80996d963dcf61b438fd8ddabbb0ee6321a1384b6e357aef2c13b8f036de380 | Python | 13,735 | 364 | #!/usr/bin/env python3
"""Path (C): re-extract missing 10-second EEG segments from S3 morgoth1.
After Steps 1 + 2 (Alex + IRR), some PD-GT patients still have
discharge_times.json annotations but no resolvable EEG. Their multi-recording
source data lives in
s3://bdsp-opendata-credentialed/morgoth1/data/internal_dat... |
0f4df73db43cda9136f37eb89ba6a8cb0e732004279c65d2e6e6a47a8e93f1b0 | Python | 13,743 | 346 | # Copyright 2026 The OpenBMB Team 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
#
# Un... |
deee467fb0394ebe31d638781926e336263e38ffc3846ac33812acfb9151a4c2 | Python | 13,777 | 325 | # Copyright 2025 Sesame 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... |
192aaa98cfbc718a2f1406ee6c9c942c532f76aded54168ff7bcc3a718abbbf0 | Python | 13,781 | 461 | import numpy as np
import tensorflow as tf
from ..._sparse_ops import (
_bwd_segment_cmp,
_csrmask,
_csrmm,
_csrsum,
_gsddmm,
_gspmm,
_scatter_add,
_segment_reduce,
)
from ...base import ALL, is_all
from ...heterograph_index import create_unitgraph_from_csr
from .tensor import asnumpy,... |
597cc4ffb0af6176b4cac20db6a5e7ca3c99e01f596e09b06c4a09c9a43858ab | Python | 13,786 | 402 | # Kai Sandbrink
# 2021-12-14
import numpy as np
import matplotlib
#from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
import os
import pandas as pd
def unit_classification_plot(modelinfo, runinfo):
r2threshold = 0.2 #threshold above which units are count... |
84db68e9c40e64c93c9ae3d8bc3fe0f2d2e06a958a14d87a7d8de5374e735721 | Python | 13,804 | 336 | # Copyright 2025 the Cohere 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 applicabl... |
5c239c4de872e2717ba04d4ae66fdbda85c6628cfa8bc0f431ff13f8a11ad3a6 | Python | 13,822 | 336 | # Copyright 2018 The Google AI Language 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
#
# Unle... |
c69088a0b922160a60b2119c010abdce20154aa9dc4e7ef0a2cccbf81ae3da94 | Python | 13,825 | 326 | '''
Class and forward pass definitions for various neural network models.
These functions/modules are mostly taken from the training code elsewhere in the repository.
'''
import os
from collections import OrderedDict
import tensorflow as tf
slim = tf.contrib.slim
cudnn_rnn = tf.contrib.cudnn_rnn
MODELS_DIR = 'mod... |
54e5424f5471c5a39ed4d15297c2b4327b50983cd656a2de8ac8027594e783b6 | Python | 13,830 | 354 | #!/usr/bin/env python
"""
Tools for extracting epigenetic data tracks.
Part of ChromaWalker package"""
import numpy as np
import os
import subprocess
import matplotlib.pyplot as plt
import dataFileReader as dfr
import hiCGraphProc as hgp
################################
epigentypes_default = ['Histone', 'TFBS', '... |
46687fe6949c1a42de1ef239e0afdec334e8a8b3fc3a86afb4c0049f27b9b945 | Python | 13,838 | 313 | """Load image data from disk"""
import random
from copy import deepcopy
from os import listdir
from os.path import isfile, join
from time import time
from typing import Any, List, Mapping, Sequence
import tensorflow as tf
from numpy import arange
from utils.utils import get_paired_samples
from .augment_data import ... |
a76d39ee84bd7a205b4b15f8a062016652544d6818a5ffde6c564510dbc8f497 | Python | 13,838 | 472 | """
Copied and adapted from https://github.com/mila-iqia/babyai.
Levels described in the Baby AI ICLR 2019 submission, with the `Unlock` instruction.
"""
from __future__ import annotations
from minigrid.core.constants import COLOR_NAMES
from minigrid.core.world_object import Ball, Box, Key
from minigrid.envs.babyai.c... |
ee5153b001a1d0e894d0858f06005a62d1e3ff66d03cc7cda4785d7475a33b55 | Python | 13,848 | 352 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtkmeshdatareader.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 d... |
3d85a88c4b8ac4023e10900185e942d823da82c76f062541d9f23856bff481c3 | Python | 13,850 | 374 | """
Experiment 0: Per-hemisphere baseline using current pipeline.
Runs the existing discharge detector on each hemisphere independently
to establish the F1 to beat.
Baseline A: Run on the affected hemisphere only (using laterality labels)
Baseline B: Run on both hemispheres, keep the one with more discharges
Usage:
... |
f361047540e6e6dfe1c64688bff4a068b798742677d5c8fd14be0a60fa090b82 | Python | 13,858 | 333 | """
This module contains functions related to sequence alignment and barcode
demultiplexing in the ST pipeline
"""
import logging
import subprocess
from subprocess import CalledProcessError
from stpipeline.common.utils import fileOk
from stpipeline.common.stats import qa_stats
import os
import shutil
def alignReads(... |
07383762ee4b9f09ed1ae4b037ce33517e8e2fd9314dc0a957ad0620e9fd9e9e | Python | 13,862 | 424 | #!/usr/bin/env python3
import typer
from pathlib import Path
from datetime import datetime, timedelta
import scipy.io as sio
import json
from rich.console import Console
from rich.table import Table
from launchcontainers.utils import atomic_rename_pairs
app = typer.Typer()
console = Console()
def parse_mat_datetime... |
5dbd107e664aac78b5b33eb33e238dba62d8482135aa77799a56aedbca1ce959 | Python | 13,873 | 315 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# 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... |
8c01158632351456ff73417dda93fa011629156712fb6bc4d07795a5266da498 | Python | 13,874 | 324 | """OpenGL utility functions for rendering shapes and textures."""
import functools
import contextlib
import numpy as np
import OpenGL.GL as gl
import OpenGL.GL.ARB.texture_float
from ..utils import EasyDict
# -----------------------------------------------------------------------------
class Texture:
"""Class t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.