sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
0ed87409e099b2e66121c426985d2a52a98fc8948caeb1f83e93b223a3c50916 | Python | 15,436 | 396 | # Copyright 2022 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
#
... |
45279b601d3bdbe1ed39fea73e000932e008aab51ea688d3bc132a6b7fc8f0b2 | Python | 15,444 | 373 | #!/usr/bin/env python3
"""Reproduce the C1 production-config discharge-timing F1 on current models.
The headline manuscript number is F1=0.889, mean timing MAE=1.0 ms, n=582,
sourced from paper_materials/archive/method_comparison_table.json (committed
by hand in 2026-03-23 as 'HemiCET v2 + DP (C1)'). The script that p... |
c8a645d22f13f94067c3a61ace2337e9a22e1f2bef28a78b98a5fdd4cb357445 | Python | 15,454 | 378 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/embedding_gemma2/modular_embedding_gemma2.py.
# Do NOT edit this file manually as any edits will be overwritten b... |
cb4dc88a3b867d8300113d16539b8be157b227d0206cf5fd15ab27067e5eed1b | Python | 15,496 | 465 | import argparse
import os
import random
import time
import dgl
import numpy as np
import torch
import torch.multiprocessing as mp
from model import SkipGramModel
from reading_data import LineDataset
from torch.utils.data import DataLoader
from utils import check_args, sum_up_params
class LineTrainer:
def __init... |
e7200109d94ee3ef17d53818d6c3a8753e0421158e84d79f502563f1d8d26e1e | Python | 15,506 | 364 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from examples/modular-transformers/modular_super.py.
# Do NOT edit this file manually as any edits will be overwritten by the generation of
# ... |
2fee13b8f017340f7eb3d096cb94fce8dc332f625192cd3d100f7fe7e73d1cce | Python | 15,508 | 483 | import math
import os
import sys
import time
from collections import defaultdict
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
import tqdm
from numpy import random
from torch.nn.parameter import Parameter
from utils import *
import dgl
import dgl.function as fn
def get_graph(... |
c9fefc5de822f0feb67ee5f8fc4bdb9268a89fa85d6827a9cdd39f5e4d6106f2 | Python | 15,508 | 396 | #!/usr/bin/env python3
# Copyright 2026 Alibaba DAMO Academy 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/... |
fac70333bbc715a7922f9bdc717cfd67cda6452163995cf8494d657b72cf64b0 | Python | 15,518 | 286 | # autosegment.py | a pipeline for automated brain tumour segmentation with variable MRI sequence availability
#
# Citation | James K Ruffle, Samia Mohinta, Robert Gray, Harpreet Hyare, Parashkev Nachev. Brain tumour segmentation with incomplete imaging data. Brain Communications. 2023.
# DOI 10.1093/braincomms/fcad118... |
aaeca11c32c3b686110262979597a21e96dcf174f0a27f63cc967a0141d5d427 | Python | 15,542 | 372 | # 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
#
# ... |
0baf9a7da82370e41a8d433d44a7d85b1bc2b365302ced0a4aeadf0001c84fab | Python | 15,555 | 510 | import random
import unittest
import backend as F
import dgl
import numpy as np
import pytest
import torch
from dgl.ops import gather_mm, gsddmm, gspmm, segment_reduce
from utils import parametrize_idtype
from utils.graph_cases import get_cases
# Set seeds to make tests fully reproducible.
SEED = 12345 # random.ran... |
fefe118fab1abc92212daa047b3406a0f28c2680f287ee4e9af3961d7dd9465b | Python | 15,557 | 361 | 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"""
... |
b2d4bd2095095619daa2bfcf712c0e6b6879b7f03a68b33be3f39515e02ef1ae | Python | 15,560 | 428 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... |
1bfa8d9221c44fe4f93f00c58cec97a92f07dbc961a0c98ec7f9b60cce9f0113 | Python | 15,563 | 371 | """
Tool Name: torch2d_point_regression_learn
=========================================
Train a PyTorch 2D landmark regressor from CXR ``SMImage`` samples. During
Carina training, ``input_image.label_array`` contains the trachea ROI and
``point_x``/``point_y`` arrive from per-sample CSV arguments.
"""
from __future__... |
690caf77701b4adfaa87f224e7dc0563a7730723404e6b4aa81d1f4a9a40910a | Python | 15,563 | 451 | """
This script trains and tests a GraphSAGE model for node classification
on large graphs using GraphBolt dataloader.
Paper: [Inductive Representation Learning on Large Graphs]
(https://arxiv.org/abs/1706.02216)
Unlike previous dgl examples, we've utilized the newly defined dataloader
from GraphBolt. This example wi... |
c542c4a349d969fc1adb6fbb69e0a21e8609287064689ce630d57df00ac9a027 | Python | 15,566 | 484 | import math
from functools import partial
import dgl.function as fn
import dgl.nn.pytorch as dglnn
import torch
import torch.nn as nn
import torch.nn.functional as F
from dgl import function as fn
from dgl._ffi.base import DGLError
from dgl.base import ALL
from dgl.nn.pytorch.utils import Identity
from dgl.ops import ... |
9f340db3aafde4a909bd6b45ec9c139970ca5b4fcc54db84163592ba7d2af7f1 | Python | 15,574 | 432 | #!/usr/bin/env python3
"""Build machine-readable planning exports for skills_dir.
This script combines:
- the canonical tree in registry/skills.yaml
- the current and target overlays
- the tagged planning rows in skills_dir/todo.md
and emits compact export surfaces under registry/exports/.
"""
from __future__ import... |
f9df6a592a7fe3a073db88101b9edc08dc5c5629ee9a7baaabaea77e891adab3 | Python | 15,583 | 388 | # 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 ... |
2a29aa31ac2a5f7f6027748ac722e360f2a8edc4c0a3dbb0f07979f3a5aa60e3 | Python | 15,590 | 417 | """Unified data structure for input and ouput of all the stages in loading process."""
from dataclasses import dataclass
from typing import Dict, List, Tuple, Union
import torch
from .base import (
apply_to,
CSCFormatBase,
etype_str_to_tuple,
expand_indptr,
is_object_pinned,
)
from .internal_util... |
62f54fb6825e64b4ef66a2fd9489244493416af7199a91631ae41c32549c88c2 | Python | 15,632 | 353 | #!/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... |
d4f4549132c0c2fbc7e2cafa35e8ef049d619e4796331ee76141995e3d8736e2 | Python | 15,632 | 149 | from Utils.Legends_supplementary_variables import *
from Utils.Settings import Adapt_for_Nature_style
from Utils.Utils import Naturize_text
legends_supplementary = {
"Figure 1-Figure supplement 1. Spatial coordinates of all recorded brain regions.": "2D histograms (upper diagonal), "
"scatter plots (lower diag... |
fc41e4f10b112b4a35c9a0c7d8cf252ddd7ff63b1dcb4c5ba192cf14808546bb | Python | 15,649 | 479 | #!/usr/bin/env python3
"""
Build Fig 3: RDA Characterization Pipeline — fully reproducible from data.
Three-panel layout matching Fig 2 style:
Panel A: Input 19-channel EEG (no shading, no markers)
Panel B: RDA pipeline architecture (from draw_panel_b_rda.py)
Panel C: Output EEG (hemisphere shading, topoplot ins... |
8067cd180fdb0333ff89d119e5fe99147a4a57b9cfd3d9cf8083d1eb7c4478df | Python | 15,650 | 210 | targets = {}
# Retired C++ build configurations. The C++ tree lives in ProteoWizard/pwiz-cpp now and these
# configurations build from that repo; nothing in this repo may trigger them. Kept here,
# commented out, so the ids stay findable when the TeamCity side is re-pointed. bt83, bt143,
# bt17, bt209, the master Test... |
fdc0633e661228a5babab1f6c59ea594ffa0b61428282b20c5fc742e4b2aedcb | Python | 15,662 | 447 | """Submodule for calculating/displaying pixel attribution (saliency maps)."""
from typing import Any, Callable, Dict, Optional
import slideflow as sf
import numpy as np
import saliency.core as saliency
from functools import partial
from slideflow import errors
from slideflow.grad.plot_utils import (comparison_plot, i... |
1e64f3dc61e7eb96ff638cff955139519cb6da480c7551f28e10af74113fdd8e | Python | 15,708 | 382 | ### This script models and runs a 2D GNN-based network architecture to predict logp values of molecules as per the dataset
# Importing necessary packages
import time
start_time = time.time()
from openbabel import pybel
import networkx as nx
import pandas as pd
import matplotlib.pyplot as plt
# Importing C... |
3cfa9c9666db8cf32b32a506fc0b828c4239cf55e4a899ad64cc955012b6b503 | Python | 15,709 | 427 | # Copyright (c) 2025-2026 ByteDance Ltd. and/or its affiliates
# SPDX-License-Identifier: Apache-2.0
from abc import ABC, abstractmethod
from collections.abc import Callable, Mapping
from typing import Any
import jax
from jax import numpy as jnp
from jaqmc.array_types import Params, PRNGKey
from jaqmc.data import Ba... |
565ad46d6e78ee076166581ca18d7cce45f43eebc1a64c86a8ff839d993a5fde | Python | 15,718 | 377 | # Copyright 2023 Meta 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 requ... |
0f5e859c8401738cf9013dfdd151f7ab43f07a8ddf0a071b09ca4a98c014e1d9 | Python | 15,730 | 333 | #!/usr/bin/env python3
# -----------------------------------------------------------------------------
# Copyright (c) Yongning Lei 2025-2026
# Apache-2.0 license
# -----------------------------------------------------------------------------
"""
run_all_combos.py
Top-level driver for the EPI vol2surf pipeline. For ea... |
a3b3c24389a79957201fff78eb55e6d8ba44ec054b6b9479750ffc6b3c60b934 | Python | 15,751 | 361 | 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"""
... |
a6dbcd72a2156a1e75b499c9dc3bb7a27278500d0a66090a6f8e079812c4aeb2 | Python | 15,777 | 383 | """Pix2Pix implementation inspired by
https://github.com/tensorflow/examples/blob/master/
tensorflow_examples/models/pix2pix/pix2pix.py"""
from typing import Callable, Sequence, Tuple
import tensorflow as tf
from tensorflow.keras import Model, initializers, layers
from tensorflow.keras.layers import (Add, Dense, Dro... |
3e89241ffad5f2512673a99abd14a85d71bd17c1b30122c68330c60df9059045 | Python | 15,778 | 292 | import argparse
import subprocess
import os
import json
parser = argparse.ArgumentParser()
parser.add_argument('--cell', type=str, default="K562")
parser.add_argument('--root', type=str, default="./")
parser.add_argument('--update', action="store_true")
parser.add_argument('--start', default="rfdpeak",choices=["rfdpe... |
30804d9466e5f838bf495c9a2d0dafcd428b09460cf3cdd9818c10296fb777b3 | Python | 15,786 | 456 | import sys
import os
sys.path.append("../utils")
import time
from datetime import timedelta
from contextlib import redirect_stdout
from datetime import datetime
from sklearn.svm import SVC
from sklearn.metrics import roc_curve, auc, roc_auc_score, accuracy_score, f1_score
from sklearn.metrics import classification_repo... |
817df90d8b2b2b260a51e16c06bdf9735499deeb15ccfd79a7b86d7c334edc9b | Python | 15,786 | 474 | import re
import numpy as np
from scipy.stats import mannwhitneyu
from constants import BASES, GLOBAL_ALIGN_FUNCTION, LOCAL_ALIGN_FUNCTION, MATRIX, ALIGNMENT_GAP_OPEN_PENALTY, ALIGNMENT_GAP_EXTEND_PENALTY
from utils import find_runs
REPORT_COLUMNS = ['read_id', # id of the read
'len_reference', # ... |
cd6699207b7f4d31903d1da0441cab24d9ec4705cdb67bfccaff99d5d1dab6ca | Python | 15,800 | 389 | #!/usr/bin/env python
## Program: VMTK
## Module: $RCSfile: vmtklevelsetsegmentation.py,v $
## Language: Python
## Date: $Date: 2006/05/31 10:51:21 $
## Version: $Revision: 1.19 $
## Copyright (c) Luca Antiga, David Steinman. All rights reserved.
## See LICENSE file for details.
## This softwar... |
7e09a74701d75e08a1650aa68320fb14d22044ca773d9b191631d96fa99bb0bd | Python | 15,822 | 514 | # Copyright (c) 2026 ByteDance Ltd. and/or its affiliates.
# SPDX-License-Identifier: Apache-2.0
"""Sparse arithmetic Jacobian behavior."""
import logging
import operator
import jax
import jax.numpy as jnp
import numpy as np
import pytest
from jaqmc.laplacian import (
LapTuple,
Local1Jacobian,
Local2Jac... |
b500e5831222ec4e3951ce05a24738f4d2bdfae9faac35c60fe6f5f2d867750b | Python | 15,822 | 453 | """
ResNet code gently borrowed from
https://github.com/pytorch/vision/blob/master/torchvision/models/resnet.py
"""
from __future__ import print_function, division, absolute_import
from timm.models.registry import register_model
from collections import OrderedDict
import math
from torch.autograd import Variable... |
8122253f5b2adea5c4766dc0c2e01ea3435d3ef083dca1fcb03f51959431db10 | Python | 15,840 | 390 | """Torch modules for graph attention networks(GAT)."""
# 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
# pylint: enable=W0235
c... |
aadb2bc2c2e47609d01429eac90fab0a4f3fc54dc75f0d2d09d9346a5fee9389 | Python | 15,859 | 381 | # Copyright 2021 The OpenAI Team Authors 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
#
# ... |
c6fe6f992b0d544d56ee4ac57d06c79a5a29474e978d4d111b8e1402063f7e18 | Python | 15,866 | 444 | """Network Embedding NN Modules"""
# pylint: disable= invalid-name
import random
import torch
import torch.nn.functional as F
from torch import nn
from torch.nn import init
from tqdm.auto import trange
from ...base import NID
from ...convert import to_heterogeneous, to_homogeneous
from ...random import choice
from ... |
29d16ccf5e1d8d9e6d205d417310821ba26a8939a4356e0ea98e7f4adf93f88b | Python | 15,872 | 413 | # 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... |
7c8388a9ff6ae898978e0d03829a96fe3750fb58fe207946e70f74cb9bc29d44 | Python | 15,875 | 421 | """Notification-only supervision for one SimpleMind Session (SMS).
The supervisor is deliberately not an SMS lifecycle authority. It observes
the same reconciliation data as ``bb_session status`` and records its own
state and transition events beside the manifest. It never changes the SMS
manifest, starts or stops s... |
318f68297e4f95d74ca1634bd65d0acd2869b412b39b59c2072e03b7fae58ff1 | Python | 15,901 | 406 | """
Subtype classification experiments: LPD vs GPD.
Tests different classifiers, regularization strengths, feature subsets,
and class balancing strategies for LOPO subtype classification.
Run: conda run -n foe python code/exp_opt_subtype_class.py
"""
import sys
import json
import time
import subprocess
import numpy ... |
4baff9524722fca4e81f979209189a78e7c40e48697f7d9367b57001cbd9f836 | Python | 15,902 | 470 | # Copyright (c) 2025-2026 ByteDance Ltd. and/or its affiliates
# SPDX-License-Identifier: Apache-2.0
"""Read Quantum ESPRESSO output files from a ``.save`` directory.
XML metadata and HDF5 wavefunction files are combined into the typed models
used to build a solid reference.
"""
import xml.etree.ElementTree as ET
fr... |
501c0ed591391e8dbe47a65c3cc6172732d3c829449768002d8e361ebdc4cba9 | Python | 15,904 | 359 | # Copyright 2026 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... |
3b8ed7501b557cb1e320830abb6b81625e76b2d57eb658f4b4634e36c0430ba6 | Python | 15,907 | 479 | """Provide tests for XGBEarlyStoppingCV."""
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
# License: AGPL
import pandas as pd
import pytest
from sklearn.utils.validation import _is_fitted
pytest.importorskip("xgboost")
from julearn.models.xgb_cvearlystopping import (
XGBClassifierCVEarlyStopping,
... |
fc8c05a66931b76168dfe7af3fe63b84229e3908a9199df20e414905390363ea | Python | 15,908 | 542 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Code for the paper:
Baladron, J., Vitay, J., Fietzek, T. and Hamker, F. H.
The contribution of the basal ganglia and cerebellum to motor learning: a neuro-computational approach.
Copyright the Authors (License MIT)
Training procedure of the basal ganglia module in ... |
df5155173ec325bd1cc0cb59cf9b812234bc64ab89b6f0097325e6a79f4c7dbc | Python | 15,917 | 428 | __author__ = 'Giovanni Sirio Carmantini'
from itertools import product
import matplotlib.pyplot as plt
import numpy as np
import tnnpy.symdyn as sd
from tnnpy import neuraltm
# Parsers and repair shifts
input_syms = [" ", "s", "o"]
parse_syms = [" ", "s", "o", "S"]
A_delta = {"S": ["s", "o"], " ": [" "]} # Parser f... |
b27df925e2b6efef1895ad073a8fcdc53297e591352eef3302691fd5bdb484f5 | Python | 15,918 | 480 | import argparse, os, pickle, time
import random
import sys
sys.path.append("..")
import shutil
import dgl
import numpy as np
import seaborn
import torch
import torch.optim as optim
from dataset import LanderDataset
from matplotlib import pyplot as plt
from models import LANDER
from utils import build_next_level, d... |
80e07b2f610bd7186a6eb67127fe40d7bcead3dd1d4c0e0cf3524636296f0648 | Python | 15,924 | 458 | import os
import tempfile
import unittest
import backend as F
import numpy as np
import pydantic
import pytest
import torch
from dgl import graphbolt as gb
def to_on_disk_tensor(test_dir, name, t):
path = os.path.join(test_dir, name + ".npy")
t = t.numpy()
np.save(path, t)
# The Pytorch tensor is a... |
8f3cd0cf2558e6de2c63b66df5861ac4e86dbb82ca61af7f1664b78e505d8527 | Python | 15,925 | 352 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# 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... |
f10b8dfbc992524b64863ad10a30fa250957785a2f21ab07c44c1962a4fd3f7c | Python | 15,932 | 492 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import math
import os
import random
import time
import dgl
import numpy as np
import torch
import torch.nn.functional as F
import torch.optim as optim
from matplotlib import pyplot as plt
from matplotlib.ticker import AutoMinorLocator, MultipleLocator
fro... |
fb7014ca685fbaa54c5e0b1897b1191b497022f4a2f952771757a7c663d1eabd | Python | 15,934 | 458 | """
Generate PD consistency viewer.
Computes morphological consistency scores for all patients and builds
an HTML viewer showing cases ranked by consistency score (high to low).
Must run with: conda run -n foe python code/generate_consistency_viewer.py
"""
import sys, json, base64, io
import numpy as np
import panda... |
5c448535acaf6562a94325ad162e63e352e90ec9411b77b88e9e78f19891a5d4 | Python | 15,939 | 456 | # Copyright 2023 Microsoft Corporation
# Copyright (c) 2026 ByteDance Ltd. and/or its affiliates.
# SPDX-License-Identifier: Apache-2.0
#
# This file has been modified by ByteDance Ltd. and/or its affiliates. on 2026.
#
# Original file was released under MIT, with the full license text
# available at licenses/folx_MIT.... |
993643b6eec5ed04e92bd673969059c15d32cf4aed45ca95fa062b9603b192b3 | Python | 15,942 | 422 | '''
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 pandas as pd
import csv
import tensorflow as tf
tf.compat.v1.enable_eager_execution()
import sys
import pickle
from sklearn import model... |
bbdfb31cb4d65ec65cb241f9d754915d7320642e6cccc741405cdeefb41edd3f | Python | 15,953 | 411 | # Copyright 2024 TikTok 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... |
6cfc99f3902153a2bb6c57124151f723a6a5f1efdab4918aefb0101238e42c15 | Python | 15,955 | 364 | # Copyright 2026 OpenBMB 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... |
4b8461e92cd6a3906b90541d1a066bd8e6abbb90a212775f9e3948dd5b4912a9 | Python | 15,959 | 452 | # Copyright (c) 2025-2026 ByteDance Ltd. and/or its affiliates
# SPDX-License-Identifier: Apache-2.0
from enum import StrEnum
import jax
import numpy as np
from jax import numpy as jnp
from jaqmc.array_types import PRNGKey
from jaqmc.sampler.mcmc import SamplingProposal, gaussian_proposal
class DistanceType(StrEnu... |
76be38d5682d93d06238e33245cfca860d76cfc4d54c743903f4f5eb726983a1 | Python | 15,969 | 408 | # 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 t... |
7c77e94f92ad9776343d26cb1097dd800f21a0d0d38b8bd75d06bad2733fcc1d | Python | 16,019 | 318 | # Copyright 2018 The HuggingFace Inc. team, The Hugging Face 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 ap... |
921e339c316e0858f8b58990d88de23be62d4920687d8a9e9b047bec2bfcb288 | Python | 16,038 | 395 | # 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 ... |
0f64038b60695279d7fd1fe86663aa3b1171953389e3bfa6e8969e2719426813 | Python | 16,041 | 419 | ## Program: VMTK
## Language: Python
## Date: January 10, 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 FITNES... |
8854f8185d8cbe6e37f4ba25f57235b6a3a4c72a5716272f035d5a362746cfed | Python | 16,046 | 505 | import enum
import inspect
import logging
from abc import ABC, abstractmethod, abstractstaticmethod
from pathlib import Path
from typing import Callable, Dict, List, Optional, Tuple, Union
import yaml
from dgl.dataloading.negative_sampler import GlobalUniform, PerSourceUniform
from numpydoc import docscrape
from pydan... |
a96ff97541b7e9155c10846ec4cc6cc52c5a15d626249a9ecc6c3f88451de3d6 | Python | 16,066 | 463 | #!/usr/bin/env python3
"""
apply_chromosome_defaults.py
---------------------------------
Utility script that decodes a chromosome bitstring using the tunable metadata from
an assembled plan and writes the selected values back into the source plan files
as the new default `value` entries.
"""
from __future__ import a... |
a11e45bff5185d91cb1a8d7846385b09fad25cd81a187460f1423320acee991d | Python | 16,075 | 435 | #!/usr/bin/env python3
"""
Evaluate LPD vs GPD subtype classification using ChannelPD-Net features
plus handcrafted frequency/laterality features.
Features (26 total):
- 18 per-channel PD probabilities (from predictions.json)
- 5 frequency features: f_B (ACF), f_peaks, f_fft, f_tkeo, f_coh
- 3 laterality feature... |
cc5fe6abc391c9a0097fedd084263b772aff71e15c02708b257ea2c4bbbaf534 | Python | 16,090 | 365 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# 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... |
4edd718cd75631677b4d5aca3f0886ad7f58bd2c66a251c8448ea8c6dc715a59 | Python | 16,105 | 370 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# 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... |
9b7640d93edd1b8a2c007d58547824fe52e361c71acd75b7c167b472515b4f27 | Python | 16,115 | 454 | """GraphBolt Itemset."""
import textwrap
from typing import Dict, Iterable, Tuple, Union
import torch
from .internal_utils import gb_warning
__all__ = ["ItemSet", "HeteroItemSet", "ItemSetDict"]
def is_scalar(x):
"""Checks if the input is a scalar."""
return (
len(x.shape) == 0 if isinstance(x, to... |
edc7ee905275e3a7965122b67ae2dd5166d97958e996d7c46a9a81e9a9622c66 | Python | 16,128 | 330 | # Copyright 2018 The HuggingFace Inc. team, The Hugging Face 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 ap... |
15700d0936d444cda8404bfbb385105174cc1c3fcbaf793236c9558a6f217ae9 | Python | 16,133 | 501 | # Copyright 2021 Yifei Ma
# with references from "sklearn.decomposition.LatentDirichletAllocation"
# with the following original authors:
# * Chyi-Kwei Yau (the said scikit-learn implementation)
# * Matthew D. Hoffman (original onlineldavb implementation)
#
# Licensed under the Apache License, Version 2.0 (the "License... |
e57f2e802b4bdfcd63b90acd5cff3aec05c61d1d5da4559f38869c52b18ab111 | Python | 16,134 | 317 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/edgetam_video/modular_edgetam_video.py.
# Do NOT edit this file manually as any edits will be overwritten by the ... |
7d690d6ba6726016421290cda274e9c746f6e0046c509e2d7d386f6a361ab57e | Python | 16,139 | 416 | import os
from copy import deepcopy
import numpy as np
import pandas as pd
import matplotlib.cbook as cbook
from scipy.optimize import brentq
from sklearn.neighbors import KernelDensity
from .constants import BASES, AUC_STEP
class EvaluationReport():
def __init__(self, df, modelname, output_path = None, overwri... |
3ee1b6517d67f14bb702e1f0498b139281cde0181aa856ef1ebbcc75d59c220e | Python | 16,142 | 519 | import json
import pickle
import random
import dgl
import numpy as np
import torch
NODE_TYPE = {"entity": 0, "root": 1, "relation": 2}
def write_txt(batch, seqs, w_file, args):
# converting the prediction to real text.
ret = []
for b, seq in enumerate(seqs):
txt = []
for token in seq:
... |
669ba4cc469f17c70370b2fd0d25a66650784bb7ebfdb937a611a203cbfdfd6f | Python | 16,144 | 354 | #!/usr/bin/python
###
# Author: Tyler Jang, Theo Kataras
# Date: 5/19/2022
#
# Inputs: genotype csv file, hand count results file from count over roi,
# results of count over dir in each classifier folder.
# Outputs: csv table with accuracy measurements for each classifier.
# Description: This file compares st... |
8a392d578bb931a429403daf9d217c36db9927dda7d4bc3bc98e6f51f1b35897 | Python | 16,152 | 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"""
... |
8448e97e7c084c17efea2e813dc07c97511e64dde3ca36eb46cf247970a0e0c8 | Python | 16,153 | 408 | #!/usr/bin/env python
from optparse import OptionParser
import os
import random
import subprocess
import sys
import numpy as np
import pandas as pd
from sklearn import preprocessing
import h5py
import matplotlib.pyplot as plt
import seaborn as sns
#####################################################################... |
f080d285effc3a993ed28bdeb76e4eb0f9d09574452f95694cec24bd9a917ddc | Python | 16,155 | 416 | import os
from copy import deepcopy
import numpy as np
import pandas as pd
import matplotlib.cbook as cbook
from scipy.optimize import brentq
from sklearn.neighbors import KernelDensity
from .constants import BASES, AUC_STEP
class EvaluationReport():
def __init__(self, df, modelname, output_path = None, overwri... |
9852ae9a1e811fb02d6682d087693427cf887371952af08da9ff5dbd76bee160 | Python | 16,165 | 367 | # 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... |
69ffc3605f6d1f7ba39cd23f685309bf8d58e7c3ae8e37f97d0949c449c6527c | Python | 16,169 | 442 | from __future__ import print_function, division
import csv
import functools
import json
import os
import random
import warnings
import numpy as np
import torch
from pymatgen.core.structure import Structure
from torch.utils.data import Dataset, DataLoader
from torch.utils.data.dataloader import default_collate
from to... |
ca08f186e623fd0b57e5cabec47b017f4dc0a8f1a23ef53ddb7022af797aa6e1 | Python | 16,177 | 452 | """
Module for extracting statistics from data and running the preprocessing function.
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import scipy.stats as stats
from generative_models import *
from basic_functions import *
from distance_functions import *
from summary_sta... |
3797cde5211741288a5a468f657c7cca8076212f3291021c85fa942744bcf30d | Python | 16,180 | 530 | #!/usr/bin/env python
# A Global import to make code python 2 and 3 compatible
from __future__ import print_function
import numpy as np
import networkx as nx
import pandas as pd
# ==================== Anatomical Functions =================
def anatomical_node_attributes():
'''
default anatomical nodal attr... |
42ecad0d92b164d541a64fa12d998e2a526eea7daeab87be0adc369743f7fec5 | Python | 16,192 | 383 | # 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨
# This file was automatically generated from src/transformers/models/audio_spectrogram_transformer/modular_audio_spectrogram_transformer.py.
# Do NOT edit this file manually as any e... |
be848c4eef93fdcd4ac97cfdbbdcf03c19c588a533f7e77b286ca50e6f0201bf | Python | 16,192 | 138 | from Utils.Legends_variables import *
from Utils.Settings import Adapt_for_Nature_style
from Utils.Utils import Naturize_text
legends = {"Figure 1. Ripple strength correlation depends significantly on distance.":
f"(A) Correlation matrices showing the variabilty of ripple strength correlation betwee... |
cb6342472c238cc31076829e2aac2fd3ad1478ee5d894afc6ba1e6439b0bc252 | Python | 16,197 | 387 | #!/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... |
e63a5241a1c5bb68d1b000227f9d4ea62f7e9cda154cb38f12850a5feee4dfe0 | Python | 16,215 | 461 | import argparse
import logging
import os
import platform
from pathlib import Path
import array_readwriter
import constants
import numpy as np
import pyarrow
import pyarrow.csv as csv
from utils import (
generate_read_list,
generate_roundrobin_read_list,
get_idranges,
get_node_types,
read_json,
)
... |
0b45eae2aa2eb1f462b1b24a773f1364523f5e1e6245781297ac23ea48099699 | Python | 16,216 | 507 | """
From https://github.com/wanghao14/Stain_Normalization
Uses the spams package:
http://spams-devel.gforge.inria.fr/index.html
Use with python via e.g https://anaconda.org/conda-forge/python-spams
"""
from __future__ import division
import cv2
import numpy as np
from typing import Union, List, Tuple
# -----------... |
0cd48aede4690ccc46a41803457debceacb7372dba1c5dac1dc2ee42232b9fae | Python | 16,217 | 654 | """Provide functions for CLI."""
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
# Synchon Mandal <s.mandal@fz-juelich.de>
# License: AGPL
import pathlib
import subprocess
import sys
from pathlib import Path
import click
from ..api import functions as cli_func
from ..utils import (
configure_lo... |
3ddf4466ec9a6343083a7ac0011339eaa408302ca04d80a955ee0f52effc1526 | Python | 16,224 | 365 | #!/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 LICENSE file for details.
## This software is di... |
ace56dc90f56ce39a85a6ae98f26cdf04010cdef6d9b21f97f033b33251cceb5 | Python | 16,228 | 540 | """Base classes for julearn estimators."""
# Authors: Federico Raimondo <f.raimondo@fz-juelich.de>
# Sami Hamdan <s.hamdan@fz-juelich.de>
# License: AGPL
from typing import Any
import numpy as np
import pandas as pd
from numpy.typing import ArrayLike
from sklearn.base import BaseEstimator, TransformerMixin
... |
bb24413de9f2f35a831c809315fe6b0b34c74ae6f23a2b6cb00b814665e91f25 | Python | 16,238 | 349 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 27 13:34:09 2020
Contains function for evaluating models
@author: ladan
"""
# import packages
import os
import pickle # pip/pip3 install pickle-mixin
import pandas as pd
import numpy as np
#import scipy as sp
from sklearn.preprocessing import Stand... |
00d75208d2a9cbdc68b686e131eec141d67831b2dc34d7f3906c267a06f2d6a1 | Python | 16,250 | 431 | import dgl.function as DGLF
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from dgl import batch, dfs_labeled_edges_generator, line_graph
from .chemutils import enum_assemble_nx, get_mol
from .mol_tree_nx import DGLMolTree
from .nnutils import cuda, GRUUpdate, tocpu
MAX_NB = 8
M... |
7fbc663cda1c08b59d337d054675b2bcf5d2dbf7fd50d125cc38a2f24a4b2a08 | Python | 16,274 | 524 | """Base types and utilities for Graph Bolt."""
from collections import deque
from dataclasses import dataclass
import torch
from torch.torch_version import TorchVersion
if (
TorchVersion(torch.__version__) >= "2.3.0"
and TorchVersion(torch.__version__) < "2.3.1"
):
# Due to https://github.com/dmlc/dgl/is... |
8e7c62f11e99d4260b216adc4324b27fdd46dee7ae441986fabfb7b52cb97996 | Python | 16,275 | 391 | """
RDA Task A: Frequency estimation experiments (10 methods).
Uses rda_optimization_harness for dataset loading and LOPO evaluation.
"""
import sys
import numpy as np
import warnings
from pathlib import Path
warnings.filterwarnings('ignore')
CODE_DIR = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(... |
9ffc39bc1dea02478022850ddca3bc76587887e13049903a2461d2267e15e5ac | Python | 16,309 | 481 | #!/usr/bin/env python3
"""
Migrate the current label system to a unified two-file structure.
Input files (NOT modified):
- data/labels/annotations.csv
- data/labels/segment_labels.csv
- data/labels/discharge_times.json
- data/labels/archive_labels/rda_wave_labels.json
Output files:
- data/labels/labels.csv ... |
50e873c91ea40a623d74936ed8c03147441c614512dc7b1b77df0290e044871a | Python | 16,330 | 397 | #!/usr/bin/env python3
"""
Generate a static HTML dashboard showing dataset inventory by pattern type.
Reads from:
- data/labels/patients.csv
- data/labels/segments.csv
- data/labels/harvest_manifest.json
- data/labels/bipd_harvest_manifest.json (optional)
- data/labels/rda_harvest_manifest.json (optional... |
4dd0a14ede865ce8f02b7194d3bb3f0d03139ab11167fe923e00654ba3b97766 | Python | 16,337 | 533 | import numpy as np
import networkx as nx
# ==================== Nodal methods =======================
def calc_nodal_partition(G):
'''
Calculate a nodal partition of G using the louvain algorithm as
iBrainNetworkommunity.best_partition`
Note that this is a time intensive process and it is also
no... |
6c983f1a6692f26ec7b2af6b6496f7e767d6c37df1d5089bf6a221e8429ed802 | Python | 16,347 | 360 | # Copyright 2022 ABEJA, 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
#
# Unless ... |
d350959edde173805fcc46f2401dda4c7ed384096a36e54f46783d1e3ed2236c | Python | 16,372 | 444 | """Round 5 contest methods — advanced signal processing approaches.
Methods:
- V5_TFRidgeStability: Time-frequency ridge stability via STFT
- V5_HarmonicStructure: Harmonic power ratios (2f, 3f vs f)
- V5_ICA_DeltaComponent: FastICA dominant delta component
- V5_RecurrenceQuantification: Recurrence plot determinism
- ... |
46ad361b87944bfdf435d643d162c25eb5ec382ca1c77b26775f8cdf59ee6a91 | Python | 16,395 | 428 | """
This script trains and tests a GraphSAGE model for link prediction on
large graphs using graphbolt dataloader.
Paper: [Inductive Representation Learning on Large Graphs]
(https://arxiv.org/abs/1706.02216)
Unlike previous dgl examples, we've utilized the newly defined dataloader
from GraphBolt. This example will h... |
eab85840e13ab019ffa5e9f2d979ae8e67b4ed4a7bdc4922f2e9d49e72ed8120 | Python | 16,401 | 506 | import dask.array as da
import numpy as np
import pytest
from scipy.ndimage import median_filter
from pyecap.base.utils.median import *
def simple_median(arr):
return np.sort(arr)[arr.size // 2]
def simple_rolling_median(data, kernel_size):
edge = kernel_size // 2
median_filtered = np.empty_like(data)
... |
786193112ece33976d5a3911e204f4b5fd494d7a788f2ba252af8ed3752103c8 | Python | 16,411 | 355 | # Copyright 2023 The Suno AI 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
#
#... |
5414a7b68b3086815afb4ed9ff3cf0c908591ac85759542a0c16436a21b95514 | Python | 16,416 | 490 | import warnings
import os
import numpy as np
import pandas as pd
import networkx as nx
import matplotlib.pyplot as plt
import matplotlib as mpl
import seaborn as sns
def create_df_sns_barplot(bundleGraphs, original_network):
"""
In order to plot barplot (with error bars) with the help of seaborn,
it is ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.