sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
a64744b7781c97fdcc83e72bc95f9f735484aef5f153ba4d0414bf3c7c2b32a4 | Python | 29,001 | 797 | """
Copyright (c) Facebook, Inc. and its affiliates.
Copyright (c) Microsoft Corporation.
Licensed under the MIT License.
Adapted from https://github.com/FAIR-Chem/fairchem/blob/main/src/fairchem/core/models/gemnet/gemnet.py.
"""
import warnings
from dataclasses import dataclass
from pathlib import Path
from typing im... |
b5bca03841faf2fd4b55efccd868c9c20952779b7d833e259506d59c95a59d7e | Python | 29,017 | 732 | #!/usr/bin/env python
# %%
from einops.layers.torch import Rearrange
from einops import rearrange
import os
import sys
from pathlib import Path
from logging import getLogger, basicConfig
from typing import Literal, Optional
from argparse import ArgumentParser
import torch
from torch.utils.data import DataLoader
impor... |
9cc288e12ae65b2e00ab8349565315edf98a75649e0e4a2759ae53049690ac1f | Python | 29,053 | 499 | ###20210924原始数据记录的过程取消2×2bining模式
##保留数据存储的线程模式
###20211011,修改日期文件夹的获取方式
##20240109 图像记录改为25fps/s
from __future__ import absolute_import, division
from psychopy import sound, gui, visual, core, data, event, logging, clock, monitors
from psychopy.constants import (NOT_STARTED, STARTED, PLAYING, PAUSED,
... |
931e1a3c723d1389a1c2269317d77969345f3b1507b9c5634a09c5d76fbbcccd | Python | 29,071 | 806 | """The span tagger head: additive loss, real gradients, scored detection.
A real ETEBrendaModel over the tiny injected BERT (``patch_base_model``), a
tiny on-disk encodings file, and a matching token-label store — so the whole
path from `config.token_supervision` to the `test/detection_*` metrics runs
without the BREN... |
5e958ca5fa6df9e41ef4382df9ad0580a0e48308ca76c56594db97b0acf628f4 | Python | 29,156 | 617 | #!/usr/bin/env python
# ENCODE DCC reporting module wrapper
# Author: Jin Lee (leepc12@gmail.com)
import sys
import os
import json
import base64
import argparse
from encode_common import *
from encode_common_log_parser import *
from encode_common_html import *
from collections import OrderedDict
ATAQC_HTML_HEAD = \
... |
d0a9f908d62a367064c3752c78e082161c6e154a611dde8b8616337dff1574ba | Python | 29,232 | 829 | #!/usr/bin/env python
"""Measure whether the document-level class objective localizes.
Re-runs the frozen base model over a sample of validation documents, pushes the
token embeddings through the trained hidden block and class head, and compares
the per-token class probabilities against gold mentions located by string... |
c7eee7505052c129e2912edd99bf4e140916b9e83ab956af696a47c6fba5ea9b | Python | 29,249 | 678 | import warnings
from types import SimpleNamespace
from typing import Literal, List, Optional, Tuple, Union
import torch
import numpy as np
from anndata import AnnData
from .._settings import settings
from .basemodelmixin import BaseModelMixin
from ..data.dataprocessors import prepare_data
from ..preprocess... |
1ccce14f98ecb9d128e1a42ee7605afdfb4f9a9b58f17f9aa02d252f2cc01d43 | Python | 29,301 | 734 | import sys
import os
sys.path.append((os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))))
# Set random seed
import random
import numpy as np
import torch
# Fix random seed
seed = 2025
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.cuda.manu... |
c6fbf71d5c1d7631be03750d96ece3fc1e00c92833f2c3e5b6768e6def56ff95 | Python | 29,325 | 795 | import os
import sys
sys.path.append(".")
from turtle import update
from PyQt5.QtWidgets import (
QApplication,
QMainWindow,
QTextEdit,
QLineEdit,
QFileDialog,
QMessageBox,
QProgressBar,
QVBoxLayout,
QHBoxLayout,
QLabel,
QPushButton,
QGridLayout,
QWidget,
QComboBo... |
9ed5de2e2fb59b3d1e8779dbb973ecb162fd7784bca7868e72effb887906b6e3 | Python | 29,401 | 809 | import itertools
import os
from collections import defaultdict
from collections.abc import Callable, Iterator, Sequence
from pathlib import Path
from typing import Any
import numpy as np
import torch
import pandas as pd
from sklearn.decomposition import PCA
from sklearn.metrics import mean_absolute_error, mean_squared... |
87366f98d6c37257b067a8bd2e5c1156c66b086624dfb05300ce2143653aa3fe | Python | 29,443 | 717 | #!/usr/bin/env python3
"""
plot_revision.py — Revision figures for K-attention (BIB-26-0525).
Usage:
python plot_revision.py # all figures
python plot_revision.py --exp A # Exp A heatmap only
python plot_revision.py --exp B # Exp B learning curves only
python plot_revision.py --exp C ... |
ca00cceb2c5de838e980dd1399dbea0fe15f4439b1b28251fd9627228c719fb7 | Python | 29,461 | 829 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# The code in this file is adapted from the BeiT implementation which can be found here:
# https://github.com/microsoft/unilm/tree/master/beit... |
daaf9e6064483fda800565ddcdc251ed1ec05971bc7e6b11512664cf0e10e6f9 | Python | 29,537 | 374 | """
Original work by ProGamerGov at
https://github.com/ProGamerGov/neural-dream/blob/master/neural_dream/models/inception/inception5h.py
The MIT License (MIT)
Copyright (c) 2020 ProGamerGov
Copyright (c) 2015 Justin Johnson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this softwar... |
7a445c2ebfbf3ba2c9be81288ab68240ba7d03017e73e1094a8a063d6a330747 | Python | 29,546 | 785 | # ##############################################################################
# GPLv3 LICENSE INFO #
# #
# Copyright (C) 2020 Mario S. Valdés-Tresanco and Mario E. Valdés-Tresanco ... |
fd84aa22da6bc02035750218fff35e0330af8aeb9cdfa2af99e3c514cd46aa2f | Python | 29,586 | 374 | """
Original work by ProGamerGov at
https://github.com/ProGamerGov/neural-dream/blob/master/neural_dream/models/inception/inception5h.py
The MIT License (MIT)
Copyright (c) 2020 ProGamerGov
Copyright (c) 2015 Justin Johnson
Permission is hereby granted, free of charge, to any person obtaining a copy
of this softwar... |
d860e6abb04c36eeaf2b85be5ab59e1a5280b7b889872f10939db6f0e8dd0b02 | Python | 29,597 | 615 | from __future__ import annotations
from dataclasses import dataclass
from pathlib import Path
import pandas as pd
from st_risk.eval.layer_eval import (
score_proxy_bin_monotonicity_summary,
score_proxy_bin_summary,
score_proxy_comparison_summary,
score_proxy_retention_curve,
)
from st_risk.models.io ... |
4770da71360ea21568b53726f54a73da5ad3c82ccd78eaf1e51eec2b8ae0bd84 | Python | 29,599 | 802 | import json
from pathlib import Path
from dataclasses import InitVar, dataclass, field
from typing import Any, Dict, List, Mapping, Optional, Tuple, Union
from typing_extensions import Self, Literal
import numpy as np
from scipy.sparse import spmatrix, csr_matrix
from anndata import AnnData
from datasets import Datase... |
1c71a02efcff7432ef862f134667c785224ae216f052a7c3bc54db466721a99f | Python | 29,609 | 785 | #!/usr/bin/env python3
import itertools
from collections import defaultdict
import networkx as nx
import numpy as np
from networkx.algorithms.components import connected_components
from pgmpy.base import UndirectedGraph
from pgmpy.factors import factor_product
from pgmpy.factors.discrete import DiscreteFactor
from pg... |
42c1df0f339023c7e39dae74a54bba94e031593c29ba6fcbbdfb87b4f4696bfe | Python | 29,639 | 576 | ## script for plotting boxplots and scatter plots of simple stats such as count of approaches, count of interactions, chasings etc...
import matplotlib.pyplot as plt
import numpy as np
import igraph as ig
import networkx as nx
import pandas as pd
import os
import sys
import pandas as pd
import seaborn as sns
from scip... |
7cc3e1a22dc3c94b9140d6fbe04141e15b3b3e5edbd609266debe9675eaf0c7f | Python | 29,721 | 597 | import numpy as np
from phantoms.Clara_experiment_phantom import Clara_experiment_phantom
from phantoms.BphP_cylindrical_phantom import BphP_cylindrical_phantom
from phantoms.plane_cylinder_tumour import plane_cyclinder_tumour
from phantoms.water_phantom import water_phantom
import json
import h5py
import os
im... |
9fc0c7140d87c2b212d3e7c9fa4db4aca8b1ccb6da60ff7870527968c52aaa18 | Python | 29,732 | 764 | from __future__ import division
import sys, os, re, logging, datetime
import numpy as np
import pandas as pd
import scipy.stats as stats
import matplotlib.pyplot as plt
import seaborn as sns
from pkg_resources import parse_version
pdlow = parse_version(pd.__version__) < parse_version('0.17.0')
def read_sumdata(sumFil... |
6ba2c5cc02a89b22c3080dc44d8e848d953bc1e45814d896f0a2da55a464ab63 | Python | 29,742 | 633 | #!/usr/bin/env python
# ENCODE DCC reporting module wrapper
# Author: Jin Lee (leepc12@gmail.com)
import sys
import os
import json
import base64
import argparse
from encode_common import *
from encode_common_log_parser import *
from encode_common_html import *
from collections import OrderedDict
ATAQC_HTML_HEAD = \
... |
31ecc365c508aff370a0a8aec6d03f0d9a6aab446786d0aaadd59eeaa82d7881 | Python | 29,763 | 758 | import logging
import time
import math
import numpy as np
import torch
import torch.nn as nn
from pyexpat.model import XML_CQUANT_OPT
from torch_scatter import scatter
from .common.registry import registry
from .common.utils import conditional_grad
from .utils.base import BaseModel
from .utils.smearing import (
Ga... |
646acad722ef7628bc5c56df4941e2a70615fa024302fcdc0c5cd0e745e21d10 | Python | 29,777 | 700 | import itertools
import click
import cv2
import matplotlib.pyplot as plt
import moving_least_squares
import numpy as np
import scipy.fftpack
import scipy.ndimage
import sklearn.linear_model
import xarray as xr
from tqdm import tqdm
import traceback
from ..stitching.libreg import cross_correlation_fft, match_template_br... |
896fe8f469bee11b0e9d32bcba2d0205ef215eeac64ba369e81998019535b548 | Python | 29,784 | 643 | import bigstream.transform as bst
import logging
import os, tempfile
import numpy as np
import zarr
import time
from itertools import product
from scipy.interpolate import LinearNDInterpolator
from dask.distributed import as_completed, wait
from ClusterWrap.decorator import cluster
import bigstream.utility as ut
from ... |
4ff181c2f3cbb81e4c41aa00de7e22f9257112730bba5b35a1456a0ae9b65940 | Python | 29,802 | 579 | import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.tensorboard import SummaryWriter
import torchvision
import torchvision.transforms as transforms
import torchvision.transforms.functional as TF
from torch.utils.data import Dataset
# Related to DDP (Distributed Data Parallelism)
import torc... |
cb3e0d95b2a45bf7376786d835564bfc05e6fa6ea66dd75a09403412d17d803a | Python | 29,811 | 730 | """
This code started out as a PyTorch port of Ho et al's diffusion models:
https://github.com/hojonathanho/diffusion/blob/1e0dceb3b3495bbe19116a5e1b3596cd0706c543/diffusion_tf/diffusion_utils_2.py
Docstrings have been added, as well as DDIM sampling and a new collection of beta schedules.
"""
import math
import rand... |
ceebe50e204829835050cc24a520296273f1ce5c6980da85cbcb59e9b0a43cd6 | Python | 29,818 | 815 | #!/usr/bin/env python
# @license
# Copyright 2020 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 applicab... |
8dadc7c90c923a39874455193a5ce9409cf28980e59cc9788145f037e4a1ada8 | Python | 29,860 | 1,077 | from __future__ import annotations
import argparse
import csv
import json
import math
import os
import re
import time
import traceback
import warnings
from collections import Counter, defaultdict
from concurrent.futures import ProcessPoolExecutor, as_completed
from pathlib import Path
from typing import Dict, List, Op... |
97618d53fd5dd23d045c9317985baeccbb2c2fae19d771850395a6042d98b9f6 | Python | 29,872 | 708 | from __future__ import annotations
import logging
from typing import TYPE_CHECKING
import numpy as np
import torch
import xarray as xr
from scipy.cluster import hierarchy
from scipy.spatial.distance import squareform
from statsmodels.stats.multitest import multipletests
from scvi import REGISTRY_KEYS
from scvi.data ... |
57e4c0331cd2d9225ef415db0c6c05a82ba117984fccc0f82719350aac046125 | Python | 29,891 | 848 | # Copyright (c) Facebook, Inc. All Rights Reserved
"""
Processors for all downstream (ds) tasks.
"""
import json
import os
import pickle
import random
import math
import numpy as np
import torch
from collections import defaultdict
from .processor import (
MetaProcessor,
VideoProcessor,
TextProcessor,
... |
87ebc177e76a649f4beb7b2681e4e3d2a0158a77966b6ce23957b94a24473559 | Python | 29,894 | 727 | ###### Trainer ##########
import warnings
from typing import Optional, Union
from collections import defaultdict
import os
import time
from matplotlib.ticker import MaxNLocator
import copy
import math
import numpy as np
import random
import torch
import torch.nn as nn
import matplotlib
from matplotlib import pyplot ... |
16337c5ab37893ba295c97400ea8cc7cb26732b158b0e89c9f38c058b743642a | Python | 29,897 | 821 | from os.path import dirname, realpath
from analysis.vis_utils import get_reactome_pathway_names
from config_path import PATHWAY_PATH
from setup import saving_dir
current_dir = dirname(realpath(__file__))
module_path = current_dir
import pandas as pd
import numpy as np
from os.path import join
import matplotlib.pyplot... |
706bf9dda461c1cf581d2e4444d2bce251771dae4f96753312e03e0c7c78fd19 | Python | 29,901 | 714 | from __future__ import annotations
import importlib
import logging
import warnings
from typing import TYPE_CHECKING
import anndata
import numpy as np
import pandas as pd
import torch
from scvi import REGISTRY_KEYS, settings
from scvi.data._utils import _validate_adata_dataloader_input, get_anndata_attribute
from scv... |
0838364b97ab404b5b893743e81a226095e70a8696fda3ec9db255bd2df5d116 | Python | 29,914 | 746 | """Lazy ZIP over HTTP"""
from __future__ import annotations
import io
import logging
import re
from bisect import bisect_left
from bisect import bisect_right
from contextlib import contextmanager
from tempfile import NamedTemporaryFile
from typing import IO
from typing import TYPE_CHECKING
from typing import Any
fro... |
59d05536b022502da6c387e480b4c4ac2601ba42305783966ba3f3f610b6cd22 | Python | 29,933 | 904 | #!/usr/bin/env python
import argparse
import collections
import copy
import heapq
import json
import logging
import os
import re
import sqlite3
import uuid
import numpy as np
import neuroglancer
import neuroglancer.cli
debug_graph = False
verbose_merging = False
def normalize_edge(e):
id_a, id_b = e
if i... |
36ce4633d371093928302cced2c9e6b832878d603f78ff8fadd74279a526c78e | Python | 29,945 | 771 | """The three mention scores, pinned on fixtures with known answers.
Detection and linking are the deliverable of the span pipeline, so their
arithmetic is asserted here value by value — a fixture with known spans, known
gold IDs and a known ignore set — independent of any model or checkpoint.
"""
import numpy
import ... |
5cd65f66b6a67eabe137571fe39a028b096310ec258fb681ec2fab17cd526173 | Python | 29,952 | 768 | #BEM spatial-jitter simulations with realistic sensor arrays using MNE Python
#%%
# Imports
import os.path as op
import numpy as np
import pyvista as pv
import mne
from pyvistaqt import BackgroundPlotter
from bfieldtools import sphtools as sph
import functions
#%% Simulation parameters
jitlevel = 1e-2 #level of spat... |
70753eeab3b7785affa1d60b3c61d11613759431afda7eb506689366e85d04fb | Python | 29,975 | 651 | import os
import re
import traceback
from collections import namedtuple
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import yaml
from dotenv import load_dotenv
from utils.features import (
aggregate_features,
annotate_panels,
export_significant_html_table,
libiv,
logreg_c... |
28d46ba9764abd6b85a943e9484a1242271695baf7cb56c35326fd6880b61031 | Python | 29,990 | 712 | #
# Copyright 2017-2023 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with
# Sandia Corporation, the U.S. Government retains certain rights in this software.
#
# See LICENSE for full license details
#
import numpy as np
from .wrapper_core import WrapperCore
from simulator.parameters.core_parameters... |
3186c7e31298295fbd77dd5295aa5e57d880b092097be3530e0188a421d8f184 | Python | 30,036 | 717 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Dict, List, Tuple, Optional
import torch
import torch.nn as nn
from fairseq import utils
from fairseq.modules import Layer... |
c2e278b37ea2a78010d9eb65ea895ac75bb30bc24e2d44fe1f724d6809e9feb5 | Python | 30,053 | 810 | """The linking block an evaluation reports, over corpora BRENDA did not make.
Kept out of `d3text.linking_eval` because assembling it costs a surface-form
index — a 256 MB tail read of the entity dump plus a scan of every split,
and about 1 GB more resident at the build's peak from hashing that dump
whole to verify it... |
d82ce78c48ed9b89b56670aa48534003819bc47e75e23d61ab7139d1731e7080 | Python | 30,091 | 732 | """ Utility functions. """
import numpy as np
import scipy.ndimage
import moving_least_squares
import skimage.segmentation
import skimage.measure
import skimage.morphology
from collections import namedtuple
from scipy.interpolate import griddata
from tqdm import tqdm
import skimage.feature
import itertools
from skimag... |
4ee52ca0e1746e908a80c546580e3b7d30965df5bb77ade1a32064306408a349 | Python | 30,211 | 599 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, 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 cop... |
6bd563bd39539b85ea6a4e13e1841695e4c40a5099dc7259c1c5b66d8fb6bb87 | Python | 30,212 | 600 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, 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 cop... |
97c819170239765f01e92663bf9932a8d291a8d9c7afd818d0cd1b8c9ed251c3 | Python | 30,257 | 679 | import time
import RPi.GPIO as GPIO
from VariableList import var_list
class buttonprogram:
def __init__(self, UIinstance):
self.sendtoUI = UIinstance
#INITIALIZE PINS
GPIO.setup(var_list.latchpin, GPIO.OUT)
GPIO.setup(var_list.clockpin, GPIO.OUT)
GPIO.setup(var_list.datapin... |
c4b443c3763e7b9f476efa49e2becc22e8eb73c8f8aae3b92c80fab8c0254081 | Python | 30,258 | 882 |
import pickle
import scanpy as sc
from matplotlib import ticker
import sys
sys.path.append('./scctools')
from scctools import *
from adjustText import adjust_text
# # load data
ad = sc.read('./FM27_cell_133454_wk.h5')
all_gene = list(ad.var_names)
es_mk=pd.read_csv('./res_mk.csv', index_col = 0)
res_mm=pd.read_cs... |
be101a5b5a580677c3526dc4fa452b172e62c58ed20ea9ccb2d39eee44ded242 | Python | 30,261 | 679 | import time
import RPi.GPIO as GPIO
from VariableList import var_list
class buttonprogram:
def __init__(self, UIinstance):
self.sendtoUI = UIinstance
#INITIALIZE PINS
GPIO.setup(var_list.latchpin, GPIO.OUT)
GPIO.setup(var_list.clockpin, GPIO.OUT)
GPIO.setup(var_list.datapin... |
b73b928b78775a2ba77fb894f6a69dea8e2f2561f93e1a3c454aa76244c74c75 | Python | 30,263 | 809 | import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
import sys
sys.path.append(".")
from turtle import update
from PyQt5.QtWidgets import (
QApplication,
QMainWindow,
QTextEdit,
QLineEdit,
QFileDialog,
QMessageBox,
QProgressBar,
QVBoxLayout,
QHBoxLayout,
QLabel,
QPushButton,
... |
3d55bc365c6308b26363befaaefa86704a0328e0d1aca77a15b2df3264252a37 | Python | 30,340 | 712 | # Copyright 2021 DeepMind Technologies Limited
#
# 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 agr... |
916a9130b1f7aba7ab2b8a4628e23d171f3b84815f2d618a3c67934e1a7c65a8 | Python | 30,447 | 780 | """Fixture-backed tests for BrendaDataset and its sampler.
These use the `tiny_brenda` HDF5 fixture (see conftest.py) rather than the
~300 MB BRENDA files, so they run fast and offline.
"""
import os
import pickle
import h5py
import numpy as np
import pandas as pd
import pytest
import torch
from d3text.data.data im... |
ece74cac0311d479e92aa17f8b20fffd323dd6d530b07766e485947021b893c2 | Python | 30,490 | 714 | import warnings, sys, string
import numpy as np
from skimage.transform import rotate
from sklearn.metrics import pairwise_distances
from scipy import stats as st
from scipy.spatial import distance as spd
import matplotlib.pyplot as plt
def RQA(DATA,TYPE,EMB,DEL,ZSCORE,NORM,LINELENGTH,SETPARA,SETVALUE,PLOTOPTION,nargou... |
aafd8b74894d5a57d4373a85a3438905712b14190e1172c3fdc2d64bdfc183af | Python | 30,500 | 986 | # LICENSE INFORMATION
#
# Copyright (c) 2011-2013 Sergey Astanin
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy... |
0333484d52ebc4c63ec6bcad058dd59e981cd47f6d4a22c7299a3bb08de69bbd | Python | 30,546 | 779 | # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
from itertools import product as iter_prod
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
from .base import Plotter
from .colo... |
2558207192560626908f6ddd626e6fdd442fa99d033994d4d67bbe97f59de273 | Python | 30,550 | 741 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
python %prog study.file population.file gene-association.file
This program returns P-values for functional enrichment in a cluster of
study genes using Fisher's exact test, and corrected for multiple testing
(including Bonferroni, Holm, Sidak, and false discovery rate... |
c6311356bf43275216073e7f1ff551457117fdfeeb92b63e4ddc5c42b5f95234 | Python | 30,556 | 818 | import numpy as np
import torch
import os
import json
import pickle
import matplotlib.pyplot as plt
from torch.utils.data import DataLoader
from sklearn.model_selection import train_test_split
from sklearn.metrics import balanced_accuracy_score, f1_score
from celltype_ibl.models.BiModalEmbedding import BimodalEmbedding... |
eddce46dfaa387fd231e18851d6fa94f9b97dfc3a73473edebb00427a8574006 | Python | 30,557 | 755 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Dict, List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from fairseq import utils
f... |
7c72f70df6ae345bfec9319c59896117709626d080cf4d86b40eb38f3cd37413 | Python | 30,570 | 918 | from __future__ import annotations
import base64
import logging
import re
import uuid
from pathlib import Path
from typing import TYPE_CHECKING
from typing import NoReturn
import pytest
import requests
import responses
from cleo.io.null_io import NullIO
from keyring.credentials import SimpleCredential
from poetry.... |
1dfb7c2d7ef585c57ebd351ef837b084d1b50c38013b59238077337c89597eb0 | Python | 30,609 | 660 | # coding=utf-8
# Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team.
# Copyright (c) 2018, 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... |
91badfa81a5cc390d91225a3c4d986af5608898a9f7400df888c5d0dae8ed65a | Python | 30,610 | 661 | # coding=utf-8
# Copyright 2018 The OpenAI Team Authors and HuggingFace Inc. team.
# Copyright (c) 2018, 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... |
4ba99a7b7d3e0beaeabc67583097ea9fa0ec423126dbac401bba9e45efbdaf5b | Python | 30,614 | 843 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import io
import logging
import os
import pickle
import random
import socket
import struct
import subprocess
import warnings
from argparse imp... |
bd09ecac3c37ddda0d08a2d681027990910a2314f6da930ea4843b840311a6ac | Python | 30,634 | 926 | # coding=utf-8
# Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team.
# Copyright (c) 2018, 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 cop... |
4b7f799d9f2a24529315defbedd6e8e17d7e54ac5fcffe812ce353c755dfd452 | Python | 30,639 | 831 | import os
import pickle
import numpy as np
import pytest
import torch
from anndata import AnnData
from mudata import MuData
import scvi.model._totalvi as totalvi_module
from scvi import REGISTRY_KEYS
from scvi.data import pbmcs_10x_cite_seq, synthetic_iid
from scvi.model import TOTALVI
from scvi.nn._utils import ExpA... |
7f053a27cd65685c6d70ea258cf87fa90d73faf1e426d40cfdf92db4d5c2657a | Python | 30,647 | 692 | # -*- coding: utf-8 -*-
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
import time
import os
import numpy as np
import scipy.io
from scipy.spatial import Delaunay
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.rcParams["figure.dpi"] = 200
fro... |
94092ad9f3d3f64349449cbe6921e6024774f4fbe42bab2acca1100627ccd0c7 | Python | 30,733 | 735 | from __future__ import annotations
import collections
import functools
import itertools
import time
from enum import IntEnum
from typing import TYPE_CHECKING
from poetry.core.packages.dependency import Dependency
from poetry.mixology.failure import SolveFailureError
from poetry.mixology.incompatibility import Incom... |
3d45bb18b58bf6a1a836bf62df9ad1db21eb18a70d185bbb59bca7728cfcc7a0 | Python | 30,803 | 1,359 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
06_analyze_similarity_prediction_errors.py
使用已经训练完成的相似度实验权重,对CASF-2016逐复合物重新预测,
定位Figure 6中20%相似度点的局部性能下降来自哪些测试靶点或蛋白家族。
本脚本不重新训练模型。
自动寻找历史路径:
图数据:
- processed_data/graphs/
- processed_data/graphs_raw/
测试列表:
- processed_data/splits/test_generalization_2016.txt
- pro... |
8a1529715818ed3378eaad4ccdf11ba4af8075855880df49ecc0c020c4d47d79 | Python | 30,822 | 535 | #三个头0414
import logging
import argparse
import torch.optim as optim
from torch.utils.data import DataLoader
from tensorboardX import SummaryWriter
import dataload.fs_datasets as data
import utils.gpu as gpu
from utils import cosine_lr_scheduler
from utils.log import Logger
from modelR.fs_lodet_hbb import LODe... |
4cd3ab6a845af17ccb1f276f99b19a837c16c43f4faa32e0fb8deb69844d1e63 | Python | 30,828 | 784 | """
Data loading module for the Streamlit EEG dashboard.
Provides a DataStore class that lazily loads experiment results from
pickle and CSV files, caches them, and computes derived analytics.
"""
import os
import glob
import pickle
import itertools
import logging
import streamlit as st
import pandas as pd
import nu... |
0c30dfaebb887eff73480b794872b4a54039e34f747e5e7748fb0f24d693a6b5 | Python | 30,927 | 701 | """
Collation Functions for Medical Image Batches
Efficient batch collation for variable-length medical imaging sequences with
support for:
- Background filtering
- Random cropping
- Patch dropout
- Study-aware batching
"""
import math
import random
import torch
import torch.nn.functional as F
from typing import List... |
0004e4915f82ac2f550981501b77b13a2a77ac93a9fc6f15970b51253a711e09 | Python | 30,942 | 771 | import warnings
from functools import cache
from math import ceil, floor
import lightning.pytorch as pl
import numpy as np
import torch
from torch.utils.data import (
BatchSampler,
DataLoader,
Dataset,
RandomSampler,
SequentialSampler,
)
from scvi import REGISTRY_KEYS, settings
from scvi.data impo... |
eca8f0c310f198694ea6638aecbac197837efb7978f19b8af34a9731a29d61aa | Python | 30,947 | 788 | # -*- coding: utf-8 -*-
"""
Main Code for the gut-brain analysis pipeline
"""
import h5py
import numpy as np
import scipy
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
def windowed_variance(signal, kern_mean=None, kern_var=None, fs=6000):
"""
Estimate smoothed sliding varia... |
9aa59968236d9706e52d0e0d83ec5cb5ed4763642b411ddc8108be9d36a966c5 | Python | 30,993 | 894 | import inspect
import re
from abc import ABC, abstractmethod
from typing import Any, Type
import numpy as np
class BaseTokenizer(ABC):
"""
This class represents a possible general abstraction for tokenizers.
All the tokenizers used in examples will inherit from this class. However, users may
themselv... |
3309b628d63ff04d2b0e1e3439d41fb6dcdeb00b8af696b3fb7007f1a5c078a0 | Python | 31,002 | 855 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import copy
import logging
from typing import Dict, List, Optional, Tuple
import numpy as np
import torch
import torch.nn as nn
from torch im... |
7748e4fffcc6c3ad64ef7fdb563342411a9a6f003a8f66544baa3259ced0ca0b | Python | 31,021 | 737 | # utils/training_utils.py
import copy
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import pickle
import re
import seaborn as sns
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from moove.models.CNN import CNN
from moove.mo... |
efa7c8fea4019893e10848a5a327e4d6c15c1e709b31ba2d4a1bc1f70af34248 | Python | 31,045 | 929 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Develop an RdF model to classify cells as pyknotic"""
import csv
import os
import shutil
from copy import deepcopy
from typing import Optional, Any
from pathlib import Path
import math
import traceback
import numpy as np
import pandas as pd
import matplotlib
matplotli... |
b9c59ac8cc6154b2f6001e5ba4a2f272ea9a0c8fa27ba09bfc86a359f2539c53 | Python | 31,083 | 677 | import json
import os
import math
import collections
import time
from tqdm import trange
from packaging import version
from typing import Optional, Tuple, Union, Dict, Any, List
import torch
import torch.nn as nn
from torch.utils.data import RandomSampler
from torch.utils.data.dataloader import DataLoader
from torch.u... |
c262a3ad74180b2d33a6d76aabe85fae7c6d0c04eda99019668c7f444876dbd4 | Python | 31,083 | 543 | "废弃"
import logging
import argparse
import torch.optim as optim
from torch.utils.data import DataLoader
from tensorboardX import SummaryWriter
import dataload.meta_datasets as data
import dataload.fs_datasets as data_fs
import utils.gpu as gpu
from utils import cosine_lr_scheduler
from utils.log import Logger... |
319a3c1060347f0e9c8582e9b3a6ac6964eced5e6273e8ac9322e854683091ab | Python | 31,084 | 876 | from __future__ import annotations
import json
import os
import re
import shutil
from collections.abc import Callable
from dataclasses import dataclass
from pathlib import Path
from typing import Any
DEFAULT_SITE_URL = "https://pgmpy.org"
DEFAULT_VERSIONS_FILE = Path(__file__).resolve().parents[1] / "versions.json"
T... |
83518e49249922dd161824f216943a6974f9322bb5b6cdfe501316d709f9ae66 | Python | 31,121 | 534 | import os.path
import shutil
from copy import deepcopy
from functools import lru_cache
from typing import List, Union, Tuple, Type
import numpy as np
from batchgenerators.utilities.file_and_folder_operations import load_json, join, save_json, isfile, maybe_mkdir_p
from dynamic_network_architectures.architectures.unet ... |
703bdec3e10c95d14970dd55325554ff8ab0fa44913501f794d14da10f09cc9e | Python | 31,124 | 925 | # -*- coding: utf-8 -*-
"""
Clean, organized imports
"""
# ===== Standard Library =====
import os
import random
from collections import Counter
# ===== Third-Party Libraries =====
import numpy as np
import pandas as pd
import torch
from torch.utils.data import Dataset, DataLoader, WeightedRandomSampler
from torc... |
834062d8564484d5aea4283efc83ea7927d0e394e1bcfbe811540145bad96346 | Python | 31,129 | 707 | #!/usr/bin/env python
# Author_and_contribution: Niklas Mueller-Boetticher; created template
# Author_and_contribution: Thomas Chartrand; co-wrote initial versions of
# thalamus subsetting functions
# Author_and_contribution: Meghan Turner; wrote code in file, co-wrote
# ... |
67b34a0433b456426cbd13b3fa62debba2a12c1e907bc1971ca2a682123b7707 | Python | 31,187 | 695 | '''
By K. Butenko
Functions for PathwayTune (see description in the headers)
'''
import json
import os
import sys
from scipy.spatial.distance import canberra, cityblock, euclidean, braycurtis, cosine
import numpy as np
import copy
import h5py
import shutil
import pandas as pd
# def create_netblend_dictionari... |
db6eb0015916e6efac6185f44e008ba7f4650a94770832dfeaadb6ca1349e571 | Python | 31,221 | 891 | # coding=utf-8
# Copyright 2019 The Open AI 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
#
# ... |
515b708486b992d078883f35470522ef486e504e2104afc71367724a3ac55fbc | Python | 31,222 | 892 | # coding=utf-8
# Copyright 2019 The Open AI 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
#
# ... |
25ce897dde7adda5eaba44c91559a03e2bca6f0a8c48d7b06293b37e69411484 | Python | 31,243 | 885 | """Unit tests for the epoch schedule.
CPU only: `Model.__init__` loads no base model, so a real `Model` subclass with
a single `Linear` is enough to drive a whole `fit`. The early-stopping and
snapshot tests live here rather than with the models because the comparison and
the best-epoch state are the `Trainer`'s.
"""
... |
b9b31e1974e1d2333d5be8b88e2753317f85b9b61e50069e8ac8052ec704ff00 | Python | 31,263 | 846 | import numpy as np
import pandas as pd
from scipy import signal, optimize, stats
from scipy.sparse import csr_matrix
import os
import psutil
import gc
from pathlib import Path
from tqdm.auto import tqdm
from .ccg_fast import acg as compute_acg_fast
__all__ = [
'run_all_ephys_properties',
'get_ephys_parameters'... |
d19c112c939ed808258e15b1ace6502d844327f0a848a9b8a992002239f7a85f | Python | 31,302 | 873 | """Build a database of article references from BRENDA.
Each reference is linked to the enzymes it is associated with on BRENDA and to
the organisms the article references as expressing each one. `sync_doc_db` is
the entry point.
"""
import argparse
import ast
import asyncio
import itertools
import logging
from collec... |
91a1e2b9de301cdd97c6d4a52c36d919e104bc9595c20e03155722ce23e1f5c1 | Python | 31,323 | 680 | import os
import numpy as np
import torch
import pandas as pd
from string import ascii_uppercase, ascii_lowercase
alphabet_list = list(ascii_uppercase+ascii_lowercase)
from utils.pdb_processing import ld_convert, seq_to_pdb, get_pdb_chains
from utils.chroma_sample import binder_sample
from utils.pose_filtering impor... |
23e0d40dae52db07ca61ce82f7a52b946c9529ffb8ca82b5b0a8b294fd2373fc | Python | 31,364 | 945 | import math
from typing import Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils.tensor import symmetrize, apc
from product_key_memory import PKM
from functools import partial
def gelu(x):
"""Implementation of the gelu activation function.
For information: OpenAI G... |
8a9669c36e82ed6453939975cbca47bd0f6deed352ec5e5291753ff83ac1a987 | Python | 31,366 | 846 | from typing import Union, List, Tuple, Sequence, Dict, Any, Optional, Collection
from copy import copy
from pathlib import Path
import pickle as pkl
import logging
import random
import lmdb
import numpy as np
import torch
import torch.nn.functional as F
from torch.utils.data import Dataset
from scipy.spatial.distance ... |
1fb0b148ec6bf8d3da70cca937be3dffd53d6d2a1e08faf25b03a23e793b131f | Python | 31,647 | 695 | """
hippie-wf3dacg — Conditional VAE with waveform + 3D-ACG features
================================================================
Variant of HIPPIE that ingests the waveform + 3D-ACG featurization from
the C4 database (Beau et al., 2024) instead of HIPPIE's default
waveform + ISI + 1D-ACG. The unimodal encoders ar... |
4f7df2c47ad08adc86faa77bb206be1607aebdd4ab7f86e25c76a066e7e93dcd | Python | 31,652 | 879 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import itertools
import logging
import math
import operator
import os
import queue
import time
from threading import Thread
from typing import... |
59e83f041706a41334a318b258a78d611a15ce05f29cda7d477eb4b4fa7320a6 | Python | 31,677 | 878 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import contextlib
import copy
import logging
import math
import re
from argparse import Namespace
from dataclasses import dataclass, field
fro... |
58542256cf2847602de5966ca072c0bd34512c50846fe417b75a9cc1fa9d0237 | Python | 31,780 | 716 | import os
from abc import abstractmethod
from logging import getLogger
from typing import Optional, Literal, Any
import math
import torch
from torch import nn
import torch.nn.functional as F
from einops import rearrange
try:
from flash_attn.layers.rotary import apply_rotary_emb
except ImportError:
pass
from ... |
87d3a215a8e52063e3b4b9b53151653b33f23af5d6e151d2c13ef9b9def97261 | Python | 31,929 | 872 | # Copyright (c) 2022 The Google Research Authors.
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# Adapted from https://github.com/google-research/google-research/blob/master/d3pm/text/diffusion.py
# Siginificant changes:
# * adapt code style/ formatting
# * Jax -> PyTorch
# * Remove Diffusio... |
7897e552b25e9726081d5fe3615906ba8691e5bc56ecfe773c2da69e31aae843 | Python | 31,953 | 873 | # /usr/bin/env python
'''
Written by Kong Xiaolu and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
'''
import csv
import math
import time
import numpy as np
import torch
import scipy.io as sio
'''********** Functions for computing simulated BOLD signals ***********'''
def CBI... |
86ada7767824b25e8145275e89c18c2bb5b7e3b06cf50099bde5508338bfdf79 | Python | 31,977 | 758 | # -*- coding: utf-8 -*-
# ##############################################################################
# GPLv3 LICENSE INFO #
# #
# Copyright (C) 2020 Mario S. Valdés-Tresanco and M... |
c456a7ae3973678269245888b66722926e8ac555e3ea59203a142711df243c0a | Python | 31,984 | 951 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import collections
import contextlib
import copy
import importlib
import logging
import os
import sys
import warnings
from ite... |
93c58566a1deb75ba46e861df0f91cde172c666ef3588ae4dd96eeed63ea1c2e | Python | 32,007 | 831 | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from pathlib import Path
from typing import Dict, Tuple, Callable
from einops import rearrange
from torch.utils.data import DataLoader
import pytorch_lightning as L
from datasets import load_dataset, load_from_disk, DatasetDict
from k... |
fea6605e46d7fd17b765d3dc1d2db23de6a46351d3c9d5b553dddf83bf9e987a | Python | 32,040 | 867 | # /usr/bin/env python
'''
Written by Kong Xiaolu and CBIG under MIT license:
https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md
'''
import csv
import math
import time
import numpy as np
import torch
import scipy.io as sio
'''********** Functions for computing simulated BOLD signals ************'''
def CB... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.