sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
3ab03d006ed5b34adbfe3d1e059ef0397d20e52638c21c9beb396906f30db4d0 | Python | 22,640 | 538 | # coding=utf-8
# Copyright 2023 HuggingFace 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 ag... |
e7acfdf7a10561acfa9dfee3f55d5d8f3a653fda35cd2ba051af2d262b65a81e | Python | 22,658 | 458 | import numpy as np
import networkx as nx
import os.path
import matplotlib.pyplot as plt
import time
import gc
gc.collect()
import warnings
warnings.filterwarnings("ignore")
import os
from scipy.integrate import odeint
os.system('cls' if os.name == 'nt' else 'clear')
plt.rc('font',size=15)
UseDoubleWell=1... |
f7104499efa3fde7fa7f12c75a580506eef4e4c1df193ee3d0f2515603ecd52f | Python | 22,670 | 640 | """
Module to define updates for non-conjugate matrix factorisation models.
Reference: 'Fast Variational Bayesian Inference for Non-Conjugate Matrix Factorisation models' by Seeger and Bouchard (2012)
PseudoY: general class for pseudodata
PseudoY_seeger: general class for pseudodata using seeger aproach
Poi... |
2a94373857c857932aa3bc5369fa9dfeea4550a911f03438b806028621ee798b | Python | 22,690 | 551 |
import pdb
import pickle
import numpy as np
import oci
from tqdm import tqdm
import torch
import matplotlib.pyplot as plt
import yaml
from latent_time_stepping.datasets.AE_dataset import AEDataset
from latent_time_stepping.oracle import ObjectStorageClientWrapper
from latent_time_stepping.preprocessor import Preproces... |
882f01e0c67daa4061fdc83f354edf8ea5ed956fb5fef9806f2d26a3df0540bd | Python | 22,692 | 670 | import argparse
import copy
import random
import numpy as np
import torch
import torch.nn as nn
import torch.optim as optim
from models import GNN
from torch_geometric.data import DataLoader
from torch_geometric.nn import global_add_pool, global_max_pool, global_mean_pool
from datasets import MoleculeDataset
class ... |
de9a408e18fcec7a46125d3bac929374e0211b3edac16106fe0ff4a613463197 | Python | 22,718 | 588 | import argparse
import logging
import math
import os
import random
from pathlib import Path
from typing import Optional
import jax
import jax.numpy as jnp
import numpy as np
import optax
import torch
import torch.utils.checkpoint
import transformers
from datasets import load_dataset
from flax import jax_utils
from fla... |
ca2d10cf6c36680683b4ed544e489b9d3bcd954f8b4418ed1d9886587e7f263a | Python | 22,720 | 444 | # -*- coding: utf-8 -*-
import sys, os
env_path = os.path.dirname(os.path.abspath(__file__))
sys.path.append(env_path + "/../")
sys.path.append(env_path + "/seq2struct")
sys.path.append(env_path + "/seq2struct/esmfold_openfold")
import torch
import numpy as np
import pandas as pd
import re, time, random,... |
65a3d0f6ed42af7189c22394163effd66adca68e6f6f518517bf7b8b35b727d4 | Python | 22,721 | 581 | import copy
import logging
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import Any, Dict, List, Optional
import yaml
from ray._common.utils import binary_to_hex
from ray._private.ray_constants import env_integer
from ray._rayle... |
03f66ee794e0d1f586d384e5fc05a8927792494f212b2fe82adf1dd446c21ccd | Python | 22,736 | 554 | import asyncio
import logging
import os
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from typing import TYPE_CHECKING, Dict, List, Optional, Set, Tuple
import ray
import ray.dashboard.consts as dashboard_consts
import ray.dashboard.utils as dashboard_utils
import ray.experimental.internal... |
a72d147b3b0b010df56eafed4f3a21c1095828f573eddc4591a8235343deb8e0 | Python | 22,737 | 482 | import logging
import os
import pathlib
from typing import Dict, List, Optional
import ray._private.ray_constants as ray_constants
from ray._common.network_utils import get_localhost_ip
from ray._private.resource_isolation_config import ResourceIsolationConfig
from ray._private.utils import get_ray_client_dependency_e... |
12578ac6a4cd774a1856c0d2eb06b3f0217c2ea5d4b52b2297be05990fd2c9dc | Python | 22,739 | 611 | import logging
from itertools import combinations
from typing import Dict, List, Tuple
import numpy as np
import keras
import tensorflow as tf
import tensorflow.keras.backend as K
import tensorflow_probability as tfp
from tensorflow.keras.losses import categorical_crossentropy
from tensorflow.keras.layers import conc... |
df0216007e39964e037266eefbb90917883fdff1658c7a7424339c66dbeb5ffa | Python | 22,756 | 642 | # Main required import
# NB: this script is not made for running, it only holds functions to support other scripts
#----------------------------------------------------------------------------#
import numpy as np
import matplotlib.pyplot as plt
import mne
from matplotlib.colors import LinearSegmentedColormap
from mne... |
4c770418a311fd25eeaca90b70a887510f88af3d010751fb3792b9b7d01c8cf9 | Python | 22,775 | 527 | # Copyright 2023 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... |
1989e626a515bda11b7e14e3b41b23e96efe22d610badf052c3ddbdb6fa6d996 | Python | 22,781 | 538 | from typing import Callable, Optional, Union, Tuple, Iterator
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch import autocast
from convex_optim_base.prox_optim import ProxSolverParams
from new_style_optim.prox_optim import _optim_FISTA
from new_style_optim.accelerated_... |
b8b0499417840e056b9724dd343ffdb58591fe9627d95fae7f637d79ba0857a2 | Python | 22,785 | 436 | import inspect
from typing import Callable, List, Optional, Union
import torch
from transformers import (
CLIPImageProcessor,
CLIPTextModel,
CLIPTokenizer,
MBart50TokenizerFast,
MBartForConditionalGeneration,
pipeline,
)
from diffusers import DiffusionPipeline
from diffusers.configuration_util... |
7497d5bf4e16d619e77e8da6129fabfe05848a20917c5debe87b77d86f7fa228 | Python | 22,798 | 564 | # coding=utf-8
# Copyright 2023 HuggingFace 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 ag... |
a93ece5ef64a194a0f417c1673fcb75c093821df069878a93e9855a9cd4f57e4 | Python | 22,804 | 587 | # coding=utf-8
# Copyright 2023 HuggingFace 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 ag... |
56b8a1cbeee808a8629c6391222fdee0e990c653704cf7b8bb5ec15cabd55c7b | Python | 22,807 | 608 | import copy
import itertools
import logging
import math
import pickle
import os
import sys
from pathlib import Path
from typing import Dict, List, Optional, Tuple, Union
from pprint import pformat, pprint
import glob
import pytorch_lightning as pl
import click
import numpy as np
import pandas as pd
import psutil
impor... |
a462c3e508a85fd95e286575d096f0a4835032e0d506d05fc607f0ce77b39259 | Python | 22,822 | 493 | import inspect
from typing import List, Optional, Union
import PIL
import torch
from torch.nn import functional as F
from transformers import (
CLIPImageProcessor,
CLIPTextModelWithProjection,
CLIPTokenizer,
CLIPVisionModelWithProjection,
)
from diffusers import (
DiffusionPipeline,
ImagePipel... |
3cbbadc34a5d1f087e6b8e2484db499525f370c9d03d1da16e5fa722f0c32df5 | Python | 22,843 | 632 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.utils.data import Dataset, DataLoader
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
import argparse
import pdb
import os
import sys
import... |
ad5d8ca4a996bdcc4caba44957de056d6d02e3581207d05c04e7072dcaa2d715 | Python | 22,843 | 442 | from setup import *
def get_ld_last_days(df, criteria, max_days, min_reversal_number):
"""
This function determines the last day (aka the day the animal met the LD train criteria for the first time). The
function grabs all the rows that meets the minimum required reversal number and then checks if i... |
f998bfbe10b147d22ad0fee2c15cda6c98b660a07085368e108e750e836594c8 | Python | 22,845 | 578 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
6a4e1963c43f9874601b5789fe70f2a9d7734440518ff98160ba9caaae4d2266 | Python | 22,846 | 550 | import numpy as np
import matplotlib.pyplot as plt
import scipy as sp
import UnitMatchPy.Param_fun as pf
#from sklearn.metrics import roc_auc_score
def re_scale(vector):
"""
This function does 0-99 rescaling to get good scores.
"""
score = ( np.nanquantile(vector,0.99) - vector) / (np.nanquantile(vecto... |
0bca19990da91d8655653c5f14df363612745f09b99bd06787d9d10c4f9a802f | Python | 22,850 | 680 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from anndata import AnnData
from pandas.api.types import is_numeric_dtype
from .._registry import register_function
from ._scanpy_compat import _prepare_dataframe, default_palette, obs_df
pycomplexheatmap_install = False
def _global_imports(modu... |
3028d60f121a002e004b779360244a690a12c57b25967f48e12fd7325f8e174b | Python | 22,854 | 631 | import collections.abc as cabc
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib
from matplotlib import colors, colormaps, rcParams, patheffects
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from matplotlib.colors import Colormap, Normalize
from typing impo... |
0bd0fd6c577b2241cd6ac88ce43693888ae6a2b232ad65b3b4c4a6822ae267e9 | Python | 22,864 | 544 | import dataclasses
import logging
from typing import Any, AsyncIterator, Dict, List, Optional, Union
import packaging.version
import ray
from ray.dashboard.modules.dashboard_sdk import SubmissionClient
from ray.dashboard.modules.job.common import (
JobDeleteResponse,
JobLogsResponse,
JobStatus,
JobSto... |
0f7fcdb68532d72fc3e12ab3c0d705dfeaf3462fade541921b64507776d05a50 | Python | 22,872 | 541 | r"""End-point binding free energy (MM-GBSA) for :mod:`omicverse.mol.md`.
This is the bridge that turns a *static* docking score into a
*dynamics-averaged* binding estimate: take an MD trajectory of the complex,
and for each frame evaluate
.. math::
\Delta G_\mathrm{bind} = \langle G_\mathrm{complex}\rangle
... |
b4b85a6cd3bf1b5530b3b13377c529e8bb463826fd0e9fbefaee4015665df5ee | Python | 22,872 | 570 | """10x Atera (WTA Preview) reader for OmicVerse spatial I/O.
Atera ships a Xenium-compatible ``outs/`` bundle with three additions worth
calling out:
1. ``nucleus_boundaries.parquet`` — per-cell nucleus polygon vertices, in the
same long-table format as ``cell_boundaries.parquet``.
2. ``morphology_focus/`` — multi... |
a728915e1c48d085ac1738202c861d6e8b6aa3cd7ae8b3e052fc4c695ebda937 | Python | 22,890 | 477 | # biolgca is a Python package for simulating different kinds of lattice-gas
# cellular automata (LGCA) in the biological context.
# Copyright (C) 2018-2022 Technische Universität Dresden, Germany.
# The full license notice is found in the file lgca/__init__.py.
"""Utilities for plotting properties and outputs of all L... |
3566ec08a50d20a3cfbfd169314ab2d439b2a604757acf64077b342ae374f622 | Python | 22,900 | 475 | # Copyright 2023 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... |
2d37e846a204076620afa6018eac0df87ee6a32947ec8b92b176b6c4310c5397 | Python | 22,910 | 549 | # Copyright 2009-2010 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... |
b5a721aaa002860a98babb57fc4e730b709f18df6bdbd88a71c61cc5b052cac8 | Python | 22,924 | 606 | # built-in dependencies
from typing import Any, Dict, IO, List, Tuple, Union, Optional, cast
from heapq import nlargest
# 3rd part dependencies
import numpy as np
from numpy.typing import NDArray
import cv2
# project dependencies
from deepface.modules import modeling
from deepface.models.Detector import Detector, Det... |
df5eebaa5c68ea391dfa0b11276200636afcc1fa2cb267bd19873c836b481eea | Python | 22,924 | 467 | import numpy as np
import networkx as nx
import os.path
import matplotlib.pyplot as plt
import time
import gc
gc.collect()
import warnings
warnings.filterwarnings("ignore")
import os
from scipy.integrate import odeint
os.system('cls' if os.name == 'nt' else 'clear')
plt.rc('font',size=15)
UseDoubleWell=1... |
d05368d3b7f3deff5d6b04792df6811b7cfaaf3fb4e6ef446d3ea57631a8b3ca | Python | 22,930 | 531 | #!/usr/bin/env python3.7
"""Defines the runner module.
The copyrights of this software are owned by Duke University.
Please refer to the LICENSE and README.md files for licensing instructions.
The source code can be found on the following GitHub repository: https://github.com/wmglab-duke/ascent
"""
import base64
imp... |
a5c430fcb9a6fa418bc886977e544d9a557dfc278fa7eee1b3178c0bc93da7f5 | Python | 22,935 | 482 | import argparse
import os
import time
import sys
# for linux env.
sys.path.insert(0,'..')
import pickle
import utils
import pickle
import matplotlib.pyplot as plt
import numpy as np
import csv
from collections import Counter, defaultdict
import pandas as pd
import json
from datetime import datetime
from tqdm import tqd... |
35442454f232be150a1b26d0cb207052fa62bc0c8338edb5269d29a879baa67b | Python | 22,942 | 592 | # ML4H is released under the following BSD 3-Clause License:
# Copyright (c) 2020, Broad Institute, Inc. and The General Hospital Corporation.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# *... |
6a1bfe336ccdc638ce8e04d3208db96c326f4b0f021b81549f7a8feee63ee32e | Python | 22,947 | 558 | import copy
import glob
from keras import layers
from keras.models import Model
import numpy as np
from numpy.random import seed
import os
import pandas as pd
import shutil
import sys
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.applications import MobileNetV2
from tensorflow.keras.applica... |
a575c5742611081ee07064d4e6d0ebfb950a8d90ff0ad95e6d928831a486c175 | Python | 22,949 | 478 | '''
********
Lisa CLI
********
Installing LISA using pip or conda adds the "lisa" command to your path. LISA's functionality is divided into three main subcommands:
* `lisa oneshot`_ : one genelist
* `lisa multi`_ : multiple genelists
* `lisa regions`_ : one genelist and a list of regions
Which are used depending on... |
fa09cc6a5d31f35ecaa6b7dfd98c4033898568e849ba61c67793eb6a139d0904 | Python | 22,951 | 644 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
Benchmark the autobatching + Ray Serve batch-inference server.
This is the batch-server analogue of ``sweep_inference_benchmark.py``. Instead ... |
80b8701f71e31643c1339d7139927b4e643fb8f099abdb577a08918422fc4b2c | Python | 22,958 | 478 | '''
********
Lisa CLI
********
Installing LISA using pip or conda adds the "lisa" command to your path. LISA's functionality is divided into three main subcommands:
* `lisa oneshot`_ : one genelist
* `lisa multi`_ : multiple genelists
* `lisa regions`_ : one genelist and a list of regions
Which are used depending on... |
6c067937982073bafa91500346b7b309648e20d24047846c2a86ab3d5c19e014 | Python | 22,960 | 552 | import torch
import torch.optim as optim
from torch.utils.data import Dataset, DataLoader, SubsetRandomSampler, random_split
import pandas as pd
import numpy as np
import os
import random
from collections import defaultdict, Counter
from itertools import combinations
import json
import torch.nn as nn
import torch.nn.fu... |
7a7f84bb801aedc44a51c12ee3d01e90d1d6af27ead807076c2acb03216ccd5a | Python | 22,961 | 631 | import collections
import warnings
from contextlib import contextmanager
from functools import partial
from typing import Any, Callable, Generator, Iterator, Mapping, Optional, Protocol, Sequence, Union, runtime_checkable
import torch
from threadpoolctl import threadpool_limits
from torch.utils.data import DataLoader ... |
f2be5b59c2a8c344407335796eb700bde5bd25e16c490a6043cc9158a1ba6953 | Python | 22,963 | 497 | import numpy as np
import plotly
import plotly.subplots
import exputils as eu
# TODO: Feature - allow to first unselect certain experiments, and then switch to their elements, to just see the selected experiments
# https://webappl.blogspot.com/2020/05/plotly-eventregister.html, see plotly_restyle event
# I... |
ac51318f154206bba187db08a4bef8f0e28fb98f92741fb4042d655b8ced2afd | Python | 22,965 | 466 | import numpy as np
import networkx as nx
import os.path
import matplotlib.pyplot as plt
import time
import gc
gc.collect()
import warnings
warnings.filterwarnings("ignore")
import os
from scipy.integrate import odeint
os.system('cls' if os.name == 'nt' else 'clear')
plt.rc('font',size=15)
UseDoubleWell=1... |
5873a44c53aa123e69952eb9a6a50afbf49b4d4217e5a49b460c0401b06d10aa | Python | 22,967 | 550 | r"""Trajectory analysis for :mod:`omicverse.mol.md`, built on MDTraj.
Every function accepts an :class:`~omicverse.mol.md.MDTrajectory`, an
``mdtraj.Trajectory``, or a path to a trajectory file.
.. important::
On a periodic (explicit-solvent) system, molecules that cross a box
boundary are wrapped back by the i... |
18ec09d24e572175c39d3e2e3467fee55a6014ba7b7400bd3d131d2aa13d80d5 | Python | 23,002 | 471 | import numpy as np
import networkx as nx
import os.path
import matplotlib.pyplot as plt
import gc
gc.collect()
import warnings
warnings.filterwarnings("ignore")
import os
os.system('cls' if os.name == 'nt' else 'clear')
plt.rc('font',size=15)
plt.rc('font',size=15)
UseDoubleWell=1
RCType=0# Different RC ... |
15f83b77b038e649d628e3b67ddcb936a24a07ee80c4cc705286e06b073bcc2f | Python | 23,010 | 454 | import numpy as np
import networkx as nx
import os.path
import matplotlib.pyplot as plt
import time
import math
import gc
gc.collect()
import warnings
warnings.filterwarnings("ignore")
import os
os.system('cls' if os.name == 'nt' else 'clear')
plt.rc('font',size=15)
UseDoubleWell=1
RCType=0# Different R... |
131e91ada178838b171f1b603f0d436d79adf29b1989bad82456f2a3e6b750fd | Python | 23,035 | 547 | #!/usr/bin/env python
'''
BGTCS MFM
Usage:
mfm [options] [<key>=<value>]...
Options:
-l --list List all options
-h --help Show this screen
'''
import pdb
import numpy as np
import pickle
import sys
import os
from docopt import docopt
from tabulate import tabulate
from utils import progbar
from swift imp... |
b681dfdcbbea16c97986f33707e25b47e3049aca99777fc4470a22dd3b20808d | Python | 23,045 | 567 | import ast
import json
import math
import os
import shutil
import numpy as np
import psutil
import yaml
# Canonical export order for sheets when multiple are exported into one spikes.npy. Sheets not listed
# here are appended in sorted-name order, so unit indexing stays deterministic across trials/runs while
# still ... |
572fed9d32477cd66db4adc87be730824d876ff9fd383f8326e4504dcdce6271 | Python | 23,060 | 586 | import xyzStageCmds
import leicaCmds as Leica
import atumCmds_2 as Atum
from tkinter import *
import threading
import time
import logging
Stages = xyzStageCmds.stages(3) # need to specify the number of axes to create
def setPickupPosition():
Stages.setPickupPositionNoOffset()
return
def... |
71bed391961c72df2ebfff11908311490d031c88c6ecd69cebb6436518668718 | Python | 23,065 | 516 | #
# CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables
# © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+)
# Source code:
# https://github.com/AdaptiveMotorControlLab/CEBRA
#
# Please see LICENSE.md for the full license document:
# https://github.com/AdaptiveMotorControlLab/CEBRA/bl... |
903420452ada727dd1d7066fe9ecc1ada6cf852701a3a6e7c65ff5a3e4128169 | Python | 23,087 | 572 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Some more tests for specific tiles."""
from unittest import SkipTest
from numpy.testing import assert_array_equal
from torch import arange, ones, zeros, zer... |
38397f851a1494b67a0d3cf2299dd615637868a0b8ab52d6544e16295e786cf5 | Python | 23,089 | 673 | from tensorflow.keras.layers import (
Conv2D,
Conv3D,
MaxPooling2D,
MaxPool3D,
UpSampling3D,
UpSampling2D,
Dense,
ZeroPadding2D,
ZeroPadding3D
)
from tensorflow.keras.layers import Concatenate
import numpy as np
def autoencoder_single_256(network_param):
def local_network_funct... |
f3e306f9c7c7a17efde074e0111524b9aeb1ed8f4e909a9ba3820f19e1d6ce26 | Python | 23,092 | 399 | # -*- coding: utf-8 -*-
"""3D SIM reconstruction with neural-space time model.
Example:
To run the 3D SIM reconstruction, download the dataset and run the following command::
$ python ./nstm/sim3d_main.py --config=mito_cell
This will load args stored in examples/configs/mito_cell.yaml and run the 3D ... |
90cf98cb011509ebf33aadb6600459f583dc22c03cb17d9e3a0364dbf46621cc | Python | 23,095 | 573 | import matplotlib.pyplot as plt
import seaborn as sns
import torch.nn as nn
import pandas as pd
import numpy as np
import itertools
import torch
import os
from task import CSW
from model import ShortCut
from model import TabularShortCutIS
from model import SimplePETracker
from model import SimpleContext
from model impo... |
13dadb5c42c091ebab59eb4eec486c716d5798af6d4d35b5cdc10be691d35145 | Python | 23,099 | 434 | import inspect
from typing import Callable, List, Optional, Union
import PIL.Image
import torch
from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, CLIPVisionModel
from ...models import AutoencoderKL, UNet2DConditionModel
from ...schedulers import KarrasDiffusionSchedulers
from ...utils import ... |
9de15b614225e62986a4fc69ebd338ee998e9ebac0be56dab9eead404741810b | Python | 23,104 | 650 | # Copyright 2023 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
25699d3400a1ca79a76bf7bf2877e95d3cf1642ce961d40ae4cde0956d4696d9 | Python | 23,139 | 487 | import importlib
import torch
import torch.nn as nn
from .buildingblocks import Encoder, Decoder, FinalConv, DoubleConv, ExtResNetBlock, SingleConv
from .utils import create_feature_maps
class UNet3D(nn.Module):
"""
3DUnet model from
`"3D U-Net: Learning Dense Volumetric Segmentation from Sparse Annotat... |
4731c8023c84c78f0397658697d50ea0e53f9560752bb5b070e903c2c796aefa | Python | 23,149 | 604 | # Ultralytics YOLO 🚀, GPL-3.0 license
"""
Common modules
"""
import math
import torch
import torch.nn as nn
from ultralytics.yolo.utils.tal import dist2bbox, make_anchors
from ultralytics.yolo.utils import LOGGER
from torch.nn.parameter import Parameter
from math import sqrt
from math import log
import torch.nn.f... |
bf4259745e3398ef2aa978e1a8a4efaa985d57cad1abe7083789615146d2f1ae | Python | 23,168 | 552 | #!/usr/bin/env python
# Functions for ICA-AROMA v0.3 beta
from __future__ import division
from __future__ import print_function
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import range
from past.utils import old_div
def runICA(fslDir, inFile, outDir, m... |
c0521f7dc5a44510d423a4b3acfe4192d874355bc561fe1b2eea5b46d196e0f0 | Python | 23,173 | 541 |
import gym
import numpy
import random
import os
from gym import error, spaces, utils
from gym.utils import seeding
from matplotlib import pyplot
from collections import OrderedDict
import gym_sted
from gym_sted import rewards, defaults
from gym_sted.utils import SynapseGenerator, MicroscopeGenerator, get_foreground,... |
dd63553d235cdb97ca6a3b244b40dc0dddb29fdac3a452e69cde0448a3f66b77 | Python | 23,182 | 687 | from nipype.interfaces.base import BaseInterface, BaseInterfaceInputSpec, traits, File, Str, TraitedSpec, Directory, CommandLineInputSpec, CommandLine, InputMultiPath, isdefined, Bunch, OutputMultiPath
from nipype.interfaces.ants.base import ANTSCommand, ANTSCommandInputSpec
from nipype.interfaces.fsl.base import FSLCo... |
0be74e130494a5f387b364a33ced90ec5363d1b201e0649871da57a902293a78 | Python | 23,194 | 683 | """Repertoire metrics for single-cell AIRR data.
Diversity, repertoire overlap, group abundance, spectratype, clonotype
modularity and V(D)J gene usage — an AnnData-native reimplementation of the
core of scirpy's ``tl`` repertoire-metric functions.
"""
from __future__ import annotations
from typing import Optional
i... |
0cfd8764749e84db7d1b58f365af940a959e3428187c09cce2588e6496a3c252 | Python | 23,218 | 717 | """CLI for code-only OmicVerse generation."""
from __future__ import annotations
import argparse
import contextlib
import importlib
import io
import json
import os
import socket
import sys
from pathlib import Path
from types import SimpleNamespace
from typing import Any, Callable, Dict, List, Optional, TextIO, Tuple
... |
405047c1bfe6ac67277b5c340254bfd734e47b014b582b66d1aefa02965ee33a | Python | 23,221 | 611 | r"""Lipidomics-specific helpers.
Lipidomics data has more structure than generic metabolomics because
every lipid follows the **LIPID MAPS shorthand notation**:
PC 34:1 phosphatidylcholine, 34 carbons total, 1 double bond
TAG 54:3 triacylglycerol, 54C, 3 double bonds
LPE 18:0 lysophosph... |
d016072db2d83539b01c2268178fa49a55977accb386f1387c0d3bd0553c1356 | Python | 23,224 | 465 | import os
import torch
import torch.nn as nn
import pandas
import numpy as np
# from torchsummary import summary
# from tensorboardX import SummaryWriter
# from torchviz import make_dot
# import graphviz
class CVAE(nn.Module):
def __init__(self, input_shape=(64,64,64,1), latent_size=16, batch_size=64,beta=1,gamma=... |
8fb3e49d5f0e3b4c53d5889627551b013fadf683df6a77a7a70bd2e28d639be6 | Python | 23,225 | 369 | import logging
from datetime import datetime
from agent.classifiers.utils.device_mgmt import get_gradient_accumulation_steps
from agent.classifiers.transformer_classifier import transformer_classifier
from agent.classifiers.ffnn_classifier import ffnn
from agent.classifiers.tr_ffnn_ensemble_classifier import tr_ffnn
... |
aae8fec43ac6a76f0d534f1484a8c52708c5a971454ac377c8ac4734bdb9f394 | Python | 23,234 | 619 | """Utilities for loading and routing OmicVerse project Agent Skills."""
from __future__ import annotations
from importlib import import_module
import logging
import re
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Dict, Iterable, List, Optional, Tuple
# Optional YAML suppor... |
884f422514d266ffc6f91724d296037bd5b8d4ed5a7afd850102365e236f7732 | Python | 23,253 | 746 | from __future__ import annotations
import warnings
from functools import singledispatch, wraps
from operator import mul, truediv
from typing import TYPE_CHECKING, Literal, Any, TypedDict
import logging
try:
from typing import Unpack
except ImportError:
from typing_extensions import Unpack
import numba
import... |
7b518cfe5b212ea96b68312becfdb079544e099f7ce98e6375a135a3115ba5ff | Python | 23,259 | 537 | """Coherent synthetic GWAS cohort for ``ov.genetics`` tutorials and tests.
:func:`simulate_gwas_study` generates ONE internally-consistent study —
genotypes with realistic LD block structure and population
substructure, a heritable quantitative trait, a matched bulk-expression
panel carrying real cis-eQTLs, and a smal... |
3ff4224b26882ce453dd94701a7aeb8ca1e5fe234301f4fef0ae458a355ad8f4 | Python | 23,265 | 621 | import re
import time
from dataclasses import dataclass, field
from enum import Enum
from typing import Dict, List, Optional, Tuple
from ray.autoscaler.v2.instance_manager.common import InstanceUtil
from ray.core.generated.autoscaler_pb2 import NodeState, NodeStatus
from ray.core.generated.instance_manager_pb2 import ... |
3ff7c6ccebd816d6676f9cabf5a73d04658a0885b03837c95cbc229681955595 | Python | 23,269 | 502 | """
The script reads the CSV files with Dice coefficient (and other segmentation metrics) computed using
[MetricReloaded](https://github.com/ivadomed/MetricsReloaded/blob/main/compute_metrics_reloaded.py) from the BIDS
structured data folder, creates a combined dataframe, and then creates a boxplot from the data.
The s... |
1e874f209a4dca167b2d7db55b08e9dce9e3742ea22473bcc587e599b60ca4da | Python | 23,293 | 514 | import torch
import random
import yaml
import argparse
import pandas as pd
import os
from os import cpu_count
import cv2
import numpy as np
import math
from transforms.albu import IsotropicResize
from multiprocessing import Manager
from multiprocessing.pool import Pool
from progress.bar import Bar
from tqdm import tqdm... |
591cec557ebea377f824648c22c6a46862250aa2823c6081f27ef76f49df6204 | Python | 23,314 | 537 | # Copyright 2023 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... |
584f66a24469e4378ea539969c697a4ef16d2f8e624afbba201c94bfefa9606d | Python | 23,318 | 540 | import os
import sys
from datetime import datetime
from typing import List
from unittest import mock
import pytest
from ci.ray_ci.configs import DEFAULT_PYTHON_TAG_VERSION
from ci.ray_ci.container import _DOCKER_ECR_REPO
from ci.ray_ci.docker_container import GPU_PLATFORM
from ci.ray_ci.ray_docker_container import Ra... |
4ed725929cf3ce4d0af893f585ab01bf2866976ec6b2db56d22d625eba84c95a | Python | 23,332 | 529 | r"""Sanger sequencing (.ab1) — basecalling, reference alignment, and the
construct-verification loop.
Why this lives in ``ov.alignment``
---------------------------------
Reading a chromatogram is a sequence-alignment job that shells out to an
external binary — exactly the shape this module already has for ``mafft`` /... |
462388cbffefcfe91127d0e5f275b474331373966cfbb874fda0e54f360e84c8 | Python | 23,391 | 377 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'form_pending.ui'
#
# Created by: PyQt5 UI code generator 5.15.2
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore,... |
ea9ba413203de4cd8977e3cd58faae80f41a687370869b68cf1a07bbf25e7816 | Python | 23,391 | 599 | # Part of this code is derived/taken from https://github.com/leoxiaobin/deep-high-resolution-net.pytorch
import os
import pickle
import random
from collections import OrderedDict
from collections import defaultdict
import cv2
import json_tricks as json
import numpy as np
from pycocotools.coco import COCO
from pycocoto... |
462864bf47f9b01f52fcd814876f80f331475840bdfc566661d764ad03346a64 | Python | 23,398 | 571 | import numpy as np
import scipy.sparse as sp
import tensorflow as tf
import os
import re
import pandas as pd
import logging
from sklearn.model_selection import KFold
import sklearn
import random
from random import choices
import argparse
from scipy import stats
random.seed(996)
import os
os.environ['CUDA... |
48581e226d45e5b5363bbb31d42bca06d65e2f4d51bd54fee63e83eaad981816 | Python | 23,402 | 534 | import visionloader as vl
import numpy as np
from typing import List, Union, Dict, Tuple, Callable, Optional, Type, Sequence, Any
import torch
from lib.data_utils.matched_cells_struct import OrderedMatchedCellsStruct
from lib.data_utils.sta_metadata import RGB_CONVERSION
import spikebinning
from fastconv import co... |
1ddce8a74ee7acb5d7120e167e59267f609284c91c135c1b6a1b19248c79baf1 | Python | 23,414 | 659 | import numpy as np
import pandas as pd
from scipy.sparse import issparse
from matplotlib.colors import cnames, is_color_like, ListedColormap, to_rgb
from matplotlib import patheffects, rcParams
import scanpy as sc
import anndata
from collections.abc import Sequence as SequenceABC
from typing import Union, Sequence
#fr... |
693211bd0eb05f4c25c9924162a283830528842cd1d68de0684d3cee8084fdd6 | Python | 23,441 | 638 |
import re
import requests
from .._registry import register_function
# ── Consensus score helpers ─────────────────────────────────────────────
#
# Used by CellVote.vote() to attach a per-cluster confidence score to the
# final consensus label. Three complementary metrics are computed from the
# 5 candidate labels (o... |
5a06bb5fd19e63ee6f80306ab5ad0ca57655d53bdfb991e6e57dbfb1b4ac5d25 | Python | 23,450 | 671 | import logging
import multiprocessing as mp
import os
import statistics
import time
import numpy as np
import pfrl
def _run_episodes(
env,
agent,
n_steps,
n_episodes,
max_episode_len=None,
logger=None,
):
"""Run multiple episodes and return returns."""
assert (n_steps is None) != (n_... |
213aa9a2d4ab02ea9c04b737251f2e6fa3ae64280b9bdbf04fc0dfe5017678aa | Python | 23,464 | 607 | r"""In-memory multiple sequence alignment and trees, for protein work.
``mafft`` / ``fasttree`` / ``build_phylogeny`` already existed, and they are
pipeline shaped: FASTA path in, FASTA path out, nucleotide defaults, vsearch
``;size=`` annotations stripped on the way. That is right for the 16S pipeline
they were writt... |
43661296edde3ee9df0fa2973f0ef803946aa165340738cb1612fe4f299a59db | Python | 23,465 | 389 | import matplotlib.pyplot as plt
import pickle
import numpy as np
import os
from util import *
from sklearn.metrics import accuracy_score, confusion_matrix, roc_auc_score, roc_curve, precision_recall_curve, PrecisionRecallDisplay
def plot_scatter_plot(label_d, score_d, label_a, score_a, filename):
junc_prob = label... |
b1afb584d068761bb641956bb7f00a35b6b8b723018de61568af07126372d09d | Python | 23,507 | 706 | import sys
from datetime import datetime, timezone
from unittest import mock
import pytest
import requests
from ci.ray_ci.automation.crane_lib import CraneError, call_crane_copy
from ci.ray_ci.automation.docker_tags_lib import (
AuthTokenException,
DockerHubRateLimitException,
RetrieveImageConfigException... |
6d7e9d5808b134d47d543faf57dfebb507d73ed0d95674a5014febc01e100791 | Python | 23,508 | 632 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
# pylint: disable=too-many-instance-attributes
"""High level analog transfer tiles (analog)."""
from typing import Optional, Tuple, List, Dict, Any
from copy i... |
f70c31231a721a1735c6feeb2b0ab6389e50f896e5537b77069bfcd02841df33 | Python | 23,510 | 504 | #!/usr/bin/env python3.7
"""Defines MockSample class.
The copyrights of this software are owned by Duke University. Please
refer to the LICENSE and README.md files for licensing instructions. The
source code can be found on the following GitHub repository:
https://github.com/wmglab-duke/ascent
"""
import json
impor... |
6ae93260211ecc763e7f35fb8dec7993b9e94c625acc5c3b6b0d9de287b5397b | Python | 23,513 | 556 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
"""
Resolve complex SV from inversion/translocation breakpoints and CNV intervals.
"""
import argparse
import sys
import subprocess
from collections import deque
from operator import attrgetter
import itertools
import pysam
import pybedtools as pbt
import svtk.utils as ... |
66c84f1fa1df44ca5e0c50de31482c0d151000d4bcdcab5740ba0474e33a4800 | Python | 23,514 | 567 | r"""Classifier-evaluation plots: ROC curves and confusion matrices.
``ov.pl`` had no way to draw the two figures that every classification result
ends up needing. Both functions here are data-first — arrays, a ``DataFrame``,
or an ``AnnData`` (``.obs``) all work — and both handle the multi-model and
multi-class cases ... |
4cda3be2be795629dd684321667c91e53e9bc1d14853882546d0ed332459dede | Python | 23,525 | 642 | #
# CEBRA: Consistent EmBeddings of high-dimensional Recordings using Auxiliary variables
# © Mackenzie W. Mathis & Steffen Schneider (v0.4.0+)
# Source code:
# https://github.com/AdaptiveMotorControlLab/CEBRA
#
# Please see LICENSE.md for the full license document:
# https://github.com/AdaptiveMotorControlLab/CEBRA/bl... |
9b6bc662ec53532839ae39c8fb3fb8dc1f3744411b70815600389d403e40128b | Python | 23,528 | 419 | from copy import deepcopy
from typing import Union, Tuple, List
import numpy as np
import pandas as pd
import torch
from batchgenerators.augmentations.utils import SEG_TIEBREAKS
from einops import rearrange
from scipy.ndimage import find_objects
from torch.nn import functional as F
from nnunetv2.configuration import ... |
280c4eeba8874465bafd4c5a81e6be35d95e03bc0cae930613b542e240f1087a | Python | 23,535 | 496 | import os
import cv2
import numpy as np
import torch
from torchvision.transforms import transforms
from models_.hrnet import HRNet
from models_.poseresnet import PoseResNet
class SimpleHRNet:
"""
SimpleHRNet class.
The class provides a simple and customizable method to load the HRNet network, load the ... |
cdfc183cf459254ae5115806f1730a8df01e6aedfc48da7c14fb6a94c2326558 | Python | 23,538 | 528 |
import random
import torch.nn.functional as F
import numpy as np
from torch.utils.data import Dataset
import sys
import pandas as pd
from tqdm import tqdm
from sklearn.preprocessing import LabelEncoder
from collections import OrderedDict
import scanpy as sc
import anndata as ad
import os
import math
import torch
im... |
08668785ac076a16981f146fac0747f63feb9faf730c91a23735f8b7560845cf | Python | 23,543 | 618 | ####################################################################################################
# Copyright (c) 2016 - 2024, EPFL / Blue Brain Project
# Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch>
#
# This file is part of NeuroMorphoVis <https://github.com/BlueBrain/NeuroMorphoVis>
#
# This program is fre... |
0a4d55bfeb108a068b944722506f8d744308fb67db45b3cfafdb1bfa3aea218d | Python | 23,551 | 419 | import torch
import torch.nn as nn
class gru_Linear(nn.Module):
def __init__(self, input_size, hidden_size, output_size):
super(gru_Linear, self).__init__()
self.Fc1 = nn.Linear(in_features=input_size, out_features=hidden_size, bias=True)
self.Fc2 = nn.Linear(in_features=hidden_size, out_... |
71414d7a87631db48cf14b5de23431250883988a3d2d3fd26db9a331a743f1c4 | Python | 23,557 | 520 | from enum import Enum
from functools import cached_property, partial
from typing import Any, Iterator, List, Optional, Sequence, Set, Tuple
import pyarrow as pa
import pyarrow.dataset as pds
from pyarrow.fs import FileSystem, LocalFileSystem
from ray._common.utils import env_integer
from ray.data._internal.arrow_bloc... |
7d09b6b6403ba5786b51fcf954f10e3b2c3e64cb480795c84f95ac523e1fd192 | Python | 23,559 | 476 | import functools
from general_touchscreen import *
from ld_train import *
from ld_probe import *
from acquisition_extinction import *
hab_one_parameters = ['RewardIRBeamBrokenCount', 'ScreenIRBeamBrokenCount', 'CrossedRewardToScreen',
'CrossedScreenToReward', 'BottomWindowTouches', 'TopW... |
a93017e62d0dd1b7630f6cc0b6ad6b192da4b776ee4951f707250299811101da | Python | 23,562 | 693 | import numpy as np
import pandas as pd
from scipy.sparse import csr_matrix
from scipy.sparse import coo_matrix, issparse
from ._compat import PAGA
from .._registry import register_function
# TODO: Add docstrings
class PAGA_tree(PAGA):
"""TODO."""
def __init__(
self,
adata,
groups=None... |
35dd5ec52bae6ab5e86ad1ba29ebaf03b638a57d87b6a34c441c25eec27b5861 | Python | 23,566 | 617 | # -*- coding: utf-8 -*-
# (C) Copyright 2020, 2021, 2022, 2023, 2024 IBM. All Rights Reserved.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.