sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
9dfcee5ef982a3c7a19aee42563aeb9f5bbbd5d4759f5acacce9f315988406a9 | Python | 317 | 10 | from pdearena.configs.config_blast import BlastVelocityDensityTemperatureTimeIntegratorConfig
from pdearena.utils.constants import SEED0
config = BlastVelocityDensityTemperatureTimeIntegratorConfig(
model="Transolver_cond1_moeulerx4",
lr=6e-4,
weight_decay=0.0,
devices=2,
seed=SEED0
)
|
711168e5175f07ec47c6c7ac0765420fc257a8079431c631b23198bd93fb878e | Python | 318 | 13 | from langchain_core.example_selectors import __all__
EXPECTED_ALL = [
"BaseExampleSelector",
"LengthBasedExampleSelector",
"MaxMarginalRelevanceExampleSelector",
"SemanticSimilarityExampleSelector",
"sorted_values",
]
def test_all_imports() -> None:
assert set(__all__) == set(EXPECTED_ALL)
|
7ab83284739672585654359057490fef6c53e39eb6dfb11d6f27dbd9e4c30585 | Python | 319 | 8 | # This file is a part of the `allegro` package. Please see LICENSE and README at the root for information on using it.
from nequip.scripts._package_utils import register_libraries_as_external_for_packaging
register_libraries_as_external_for_packaging(
extern_modules=["cuequivariance", "cuequivariance_torch"]
)
|
5689f62f656fd4549634bb558047223fe520a4443a059d54c5adbe3aa60b9284 | Python | 320 | 11 | from utils.config import ConfigConstructor
class BasicSubmiter(object):
def __init__(self, cfg_path):
self.cfg = self.get_config(cfg_path)
def get_config(self, config_path):
config_construct = ConfigConstructor(config_path)
config = config_construct.get_config()
return config
|
f5ec22f6492324f27db077750ff8199fdd63d36a6ac452438389e659a9a8fed5 | Python | 320 | 19 | from langchain_core.outputs import (
ChatGeneration,
ChatGenerationChunk,
ChatResult,
Generation,
GenerationChunk,
LLMResult,
RunInfo,
)
__all__ = [
"ChatGeneration",
"ChatGenerationChunk",
"ChatResult",
"Generation",
"GenerationChunk",
"LLMResult",
"RunInfo",
]
|
22ee22a786a846c5295ba77866d27fde72c3dc44efd5ec0319e02cf67f3638f0 | Python | 321 | 16 | from langchain_core.tracers import __all__
EXPECTED_ALL = [
"BaseTracer",
"ConsoleCallbackHandler",
"EvaluatorCallbackHandler",
"LangChainTracer",
"LogStreamCallbackHandler",
"Run",
"RunLog",
"RunLogPatch",
]
def test_all_imports() -> None:
assert set(__all__) == set(EXPECTED_ALL)... |
f991030b369d11c6db0bdb7f04067a857ee8628244b1735b638338c3f716a055 | Python | 321 | 10 | from pdearena.configs.config_blast import BlastVelocityDensityTemperatureTimeIntegratorConfig
from pdearena.utils.constants import SEED0
config = BlastVelocityDensityTemperatureTimeIntegratorConfig(
model="Unetmod-cond1-v3-euler-64_4_1",
lr=2e-4,
weight_decay=0.0,
devices=1,
seed=SEED0
)
... |
3595f58891b5b547476bb30f155629b35d63c5e9ba031525d935a016c6b276f4 | Python | 322 | 15 | from bindsnet.models.models import (
DiehlAndCook2015,
DiehlAndCook2015v2,
IncreasingInhibitionNetwork,
LocallyConnectedNetwork,
TwoLayerNetwork,
)
__all__ = [
"TwoLayerNetwork",
"DiehlAndCook2015v2",
"DiehlAndCook2015",
"IncreasingInhibitionNetwork",
"LocallyConnectedNetwork",
... |
d443c99dd871c47366e472562f10bdec0aa0de603fc413729e544367a1079f95 | Python | 322 | 12 | from pdearena.configs.config_coal import CoalVelocityVfracTempTimeIntegratorConfig
from pdearena.utils.constants import SEED0
config = CoalVelocityVfracTempTimeIntegratorConfig(
model="FFNO_cond2_euler_residual",
lr=1e-3,
weight_decay=0.0,
devices=2,
xpad=2,
ypad=2,
seed=SEED0,
)... |
080754a5cdbcd3d45ed4937c532f455457c4e4434a57461d2f7da1f9bc08fa9c | Python | 323 | 12 | from pdearena.configs.config_coal import CoalVelocityVfracTempTimeIntegratorConfig
from pdearena.utils.constants import SEED0
config = CoalVelocityVfracTempTimeIntegratorConfig(
model="FFNO_cond2_spatial_spectral",
lr=1e-3,
weight_decay=0.0,
devices=2,
xpad=2,
ypad=2,
seed=SEED0
... |
23d39dce881353bf3baddb225f8d88c540e2b7ce8f2d4d879087539a1cb0110f | Python | 323 | 15 | import numpy as np
from sys import argv, exit, stderr
argc = len(argv)
file_rmean = argv[1]
fxlen = int(argv[2])
rmean = np.fromfile(file_rmean, dtype=np.float32).reshape((fxlen, fxlen))
vals = rmean[rmean != -1] # sentinel for bad fit
mean = np.mean(vals)
std = np.std(vals)
print('{} {} {}'.format(fxlen,mean,std... |
fda327a92e42dd6f54d6620890232a4488adbd4af97628f7961cbd8d7bd4eb02 | Python | 324 | 13 | #!/usr/bin/env python
# coding: utf-8
# Copyright (c) venkatesh-sivaraman
# Distributed under the terms of the Modified BSD License.
def _jupyter_nbextension_paths():
return [{
'section': 'notebook',
'src': 'nbextension/static',
'dest': 'emblaze',
'require': 'emblaze/extension'
... |
813f29b8ae588a7d9d3c7e7097826e0fb1d7435b457853ea986e1fca89962a93 | Python | 325 | 12 | #%%
import os
from time import time
import numpy as np
import matplotlib.pyplot as plt
# given a session
MDA_PATH = "/media/hanlin/Liuyang_10T_backup/jiaaoZ/data_converted/mda_files/Tundra21h_220110/whole_20hour/converted_data_seg1.mda"
print(MDA_PATH)
# ts = time()
# ephys_data = readmda(os.path.join(MDA_PATH))
# ti... |
5ece3d671158c3d0c4381872d0f239dc6afb0e55e1e5fa4403187715a5eec04a | Python | 326 | 10 | from pdearena.configs.config_blast import BlastVelocityDensityTemperatureTimeIntegratorConfig
from pdearena.utils.constants import SEED0
config = BlastVelocityDensityTemperatureTimeIntegratorConfig(
model="Unetmod-cond1-v5-MOEx4-euler-32_4_1",
lr=2e-4,
weight_decay=0.0,
devices=1,
seed=SEED... |
77f5fd2f2e91a23afc77f6e63967bd98c8154683ae715fcb0207711355203bbf | Python | 327 | 9 | from .chunker import FindChunks
from .data_helper import DataHelper
from .dependency import DependencyParser
from .normalizer import Normalizer
from .postagger import POSTagger
from .stemmer import FindStems
from .tokenizer import Tokenizer
from .token_merger import ClassifierChunkParser
from .spell_checker import Spel... |
af0077526999218db088e044890bf9dfe178c22e899640547caf206d7b51620a | Python | 327 | 15 | from pycromanager import JavaBackendAcquisition, multi_d_acquisition_events
import numpy as np
def hook_fn(event):
return event
with JavaBackendAcquisition(
directory="/Users/henrypinkard/tmp",
name="acquisition_name",
post_camera_hook_fn=hook_fn,
) as acq:
acq.acquire(multi_d_acquisition_event... |
68ea70e6782be4ece8ea70f5ad0a6027fe51646595e712ba9bfb39985a8c558a | Python | 329 | 17 | #!/usr/bin/python
import sys
import json
def run(doc):
sums = 0
for site, output in doc['input'].items():
sums = sums + output['sum'];
sums = sums / len(doc['input'])
if sums > 10000:
success = True
else:
success = False
output = { "output": { "sum": sums }, "success": success }
retur... |
d362575941aabfa6940a4ffc48f0c2ba730671bd3ea28f7258819e87fdac5834 | Python | 330 | 14 | # -*- coding: utf-8 -*-
try:
import importlib.metadata as importlib_metadata
except ModuleNotFoundError:
import importlib_metadata
import hbayesdm
from hbayesdm.diagnostics import *
__all__ = []
__all__ += hbayesdm.diagnostics.__all__
# Load version from the metadata
__version__ = importlib_metadata.version(... |
4c0222cf46cb8ac7e77927a0a4c46a4ba0c83153caebc5d9ec5b41d727a5b271 | Python | 331 | 11 | import sys
from test_tube import HyperOptArgumentParser
class ProtBertPPIArgParser(HyperOptArgumentParser):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def error(self, message):
self.print_help(sys.stderr)
sys.stderr.write('\nError: %s\n' % message)
s... |
aaea92c321c54451e4fbbbf835ecc8c981a55bf88d13fd92990859d2e9741701 | Python | 331 | 14 | # yapf:disable
log_config = dict(
interval=50,
hooks=[
dict(type='CustomizedTextLoggerHook', by_epoch=False),
# dict(type='TensorboardLoggerHook')
])
# yapf:enable
dist_params = dict(backend='nccl')
log_level = 'INFO'
load_from = None
resume_from = None
workflow = [('train', 1)]
cudnn_benchm... |
befc626607780448b8f297483a97c80bc2ddec7486709ad8a4113630efb1435f | Python | 331 | 16 | from sys import version_info
if version_info.major > 2:
from MRdataset import cli
else:
raise NotImplementedError("MRdataset requires Python 3 or higher. "
"Upgrade to Python 3+ or use environments.")
def main():
"""Entry point."""
cli.cli()
if __name__ == '__main__':
... |
6bbd74c9a7bb8b4f3c53d2ba117691bf925fd7d956994a03344480ed73cf7c72 | Python | 332 | 25 | import numpy as np
def decorator(func):
def wrapper(x):
print('I am decorating',x)
y = func(x)
print('it has been decorated',y)
return y
return wrapper
data = np.random.randint(0,1000)
@decorator
def sum1(x):
return x+1
'''
equivalent to
sum1 = decorator(sum1)
'''
print... |
9e6de849e2504d00645289492813220363a3e45530e6968a7c0107f08a00b491 | Python | 332 | 19 | from langchain_core.tools import (
BaseTool,
SchemaAnnotationError,
StructuredTool,
Tool,
ToolException,
create_schema_from_function,
tool,
)
__all__ = [
"BaseTool",
"SchemaAnnotationError",
"StructuredTool",
"Tool",
"ToolException",
"create_schema_from_function",
... |
b204f6f0a128b8b80dd85130d08785cf30825adc64f6c3997fc89be0fc98755d | Python | 332 | 13 | """Evaluators that measure embedding distances."""
from langchain_classic.evaluation.embedding_distance.base import (
EmbeddingDistance,
EmbeddingDistanceEvalChain,
PairwiseEmbeddingDistanceEvalChain,
)
__all__ = [
"EmbeddingDistance",
"EmbeddingDistanceEvalChain",
"PairwiseEmbeddingDistanceEv... |
41e8e2eac60b1d76fcb8a92c94e621101f1dbd62b53d1a04938cfd0fa5f0c7cd | Python | 333 | 18 | import logging
import logging.config
def get_logger(conf, name='train'):
logging.config.fileConfig(conf)
logger = logging.getLogger(name)
# print(logger)
# logger.debug('debug')
logger.info('GET LOGGER FROM CONF FILE')
return(logger)
# conf = './logger/logging.conf'
# a = get_... |
72a8b530f203a1bf05d3ac29766f916006a3a278c4495069a969a7e4136b5758 | Python | 333 | 8 | import morgana.DatasetTools.io
import morgana.DatasetTools.arrangefluodata
import morgana.DatasetTools.arrangemorphodata
import morgana.DatasetTools.fluorescence
import morgana.DatasetTools.morphology
import morgana.DatasetTools.multiprocessing
import morgana.DatasetTools.segmentation
import morgana.DatasetTools.straig... |
f0eecc7cc8cdbc5a1a1034ec6b2d28177655fa39040c91460b47ad326508ee4d | Python | 333 | 15 | from langchain_core.runnables.configurable import (
DynamicRunnable,
RunnableConfigurableAlternatives,
RunnableConfigurableFields,
StrEnum,
make_options_spec,
)
__all__ = [
"DynamicRunnable",
"RunnableConfigurableAlternatives",
"RunnableConfigurableFields",
"StrEnum",
"make_opti... |
084e98cb2faaa3ce7b4d73858df0d8770438ca6f60a14aa22d6fab56330e06e5 | Python | 335 | 16 | from sys import version_info
if version_info.major > 2:
from mrQA.cli import cli
else:
raise NotImplementedError('Protocol Compliance requires Python 3 or higher.'
'Upgrade to Python 3+ or use environments.')
def main():
"""Entry point."""
cli()
if __name__ == '__main_... |
596c4ef40433e24b5c5fb0dc5e51bf9e1c929fcb97379a3e6c6694737bbc1a97 | Python | 335 | 11 | from pdearena.configs.config_blast import BlastVelocityDensityTemperatureDeltaTPredConfig
from pdearena.utils.constants import Paths, BlastConstants
config = BlastVelocityDensityTemperatureDeltaTPredConfig(
model="convNeXT-tiny",
noise_level=1e-2,
lr=2e-4,
weight_decay=0.0,
loss="mae",
... |
ed7407f668afbc8f4c65ebd7d3f0168e7c908227c85eb087b64f66e53754f0b7 | Python | 335 | 15 | from setuptools import setup, find_packages
setup(
name='MuTILs_Panoptic',
version='',
url='',
license='',
author='Mohamed Amgad',
author_email='mohamed.amgad01@gmail.com',
description='',
packages=find_packages(),
namespace_packages=['mutils_panoptic', 'utils', 'configs'],
zip... |
17faba6a056ee896d85bde9e57336374a09f3da657d7776ff96318c381d49274 | Python | 337 | 10 | """Test functionality related to prompt utils."""
from langchain_core.example_selectors import sorted_values
def test_sorted_vals() -> None:
"""Test sorted values from dictionary."""
test_dict = {"key2": "val2", "key1": "val1"}
expected_response = ["val1", "val2"]
assert sorted_values(test_dict) == e... |
d9952cf90425cea0b726e338948250b8df12245647eca87cab724dac18adc323 | Python | 337 | 13 | from setuptools import setup, find_packages
setup(
name="oset",
version="0.1.0",
description="An implementation of OSET in Python.",
author="Reza Sameni",
author_email="reza.sameni@gmail.com",
license="BSD-3-Clause",
packages=find_packages("src"),
package_dir={"": "src"},
python_req... |
22becde417a457343d467b59a4dcc81f47d4645e11036503d569c36790823e8a | Python | 338 | 12 | from pdearena.configs.config_blast import BlastVelocityDensityTemperatureTimeIntegratorConfig
from pdearena.utils.constants import SEED0
config = BlastVelocityDensityTemperatureTimeIntegratorConfig(
model="FFNO_cond1_moeulerx4",
lr=1e-3,
weight_decay=0.0,
devices=8,
xpad=2,
ypad=2,
... |
668cf05f5f5149ace192aed59e661e791f355ade1441c6caab516f58b7db30ab | Python | 338 | 18 | from langchain_classic import graphs
EXPECTED_ALL = [
"MemgraphGraph",
"NetworkxEntityGraph",
"Neo4jGraph",
"NebulaGraph",
"NeptuneGraph",
"KuzuGraph",
"HugeGraph",
"RdfGraph",
"ArangoGraph",
"FalkorDBGraph",
]
def test_all_imports() -> None:
assert set(graphs.__all__) == ... |
aa020c82193eaea471e41e841895c009ea3e19ab723b29086bed5d6859357125 | Python | 339 | 14 | import numpy as np
from sys import argv, exit, stderr
argc = len(argv)
lccratio_file = argv[1]
fxlen = int(argv[2])
lccratio = np.fromfile(lccratio_file, dtype=np.float32).reshape((fxlen, fxlen))
assert(np.min(lccratio) >= 0.0)
lccratio1 = np.sum(np.abs(lccratio - 1.0) <= 0.05)
print('{} {}'.format(fxlen,lccratio1... |
daefc47437b1def58eaf6817c19c6c8fd1106f718f21b3c163c9ce7a3ecace31 | Python | 339 | 15 | from .process_batch import processBatch
from .trainer import Trainer
from .evaluator import Evaluator
from .balanced_data_loader import BalancedDataLoader
from .utils import *
from .layers import *
from .metrics import *
from .transforms import *
__all__ = [
'processBatch',
'Trainer',
'Evaluator',
'Bal... |
4d6310c48bda287fafc0dbfc2953cd589df7779e8a4bea1943ac73052fe5b691 | Python | 340 | 16 | import unittest
from . import API_1
from . import API_2
from . import dist
def suite():
all_tests = []
all_tests.append(API_1.suite())
all_tests.append(API_2.suite())
all_tests.append(dist.suite())
return unittest.TestSuite(all_tests)
if __name__ == "__main__":
unittest.TextTestRunner(verbosi... |
c08b4bb99d44a9d4759a9874493fbe297b71dccf3d32e9e0c0f34ad0308fc36e | Python | 340 | 15 | from setuptools import setup, Extension
from Cython.Build import cythonize
import numpy
# Define the extension module
extensions = [
Extension("cy_argwhere", ["cy_argwhere.pyx"],
include_dirs=[numpy.get_include()]), # Add NumPy include dir here
]
setup(
name="CythonUtils",
ext_modules=cyth... |
c195cf2254bfea6f0635d53586a0a69d55d98c636c35042be6c8e0b92bc373e0 | Python | 340 | 15 | from langchain_core.output_parsers.json import (
SimpleJsonOutputParser,
)
from langchain_core.utils.json import (
parse_and_check_json_markdown,
parse_json_markdown,
parse_partial_json,
)
__all__ = [
"SimpleJsonOutputParser",
"parse_and_check_json_markdown",
"parse_json_markdown",
"par... |
f94ab8d58c62c767caaee33acd07fcdc5425b358cf438e4cce74e2c077dba3fe | Python | 340 | 16 | import os
import numpy as np
A = np.ones((200, 60, 1))
B = np.ones((200, 1))
# Use the reshape function to reshape A into the shape of (200, 60)
A = A.reshape((200, 60))
# The shape of the output result
print(A.shape) # (200, 60)
a = np.concatenate((A, B), axis=1)
a = a[:, 1:]
a = a.reshape((200, 60,... |
1933bded33d93b094d3d3bf70192f7f2829826170482f4d7b83b993dd3f14aaf | Python | 341 | 18 | import os
from setuptools import setup, find_packages
version = "1.0.0"
if os.getenv("RUNNING_ON_COLAB") == "1":
setup(
name='sam',
version=version,
packages=find_packages(),
)
else:
setup(
name="sam",
version=version,
packages=["sam"],
package_dir={... |
30bd109b7fbb78ac56e0b829a1636e8dea10b84e31d928b0785764a8d88def35 | Python | 341 | 19 | """Global values and configuration that apply to all of LangChain."""
from langchain_core.globals import (
get_debug,
get_llm_cache,
get_verbose,
set_debug,
set_llm_cache,
set_verbose,
)
__all__ = [
"get_debug",
"get_llm_cache",
"get_verbose",
"set_debug",
"set_llm_cache",
... |
64142c045635143b9f9ddb294b49395209e7ea46e4eba0be150fa5c869e8fd3b | Python | 342 | 12 | from pdearena.configs.config_blast import BlastVelocityDensityTemperatureTimeIntegratorConfig
from pdearena.utils.constants import SEED0
config = BlastVelocityDensityTemperatureTimeIntegratorConfig(
model="FFNO_cond1_euler_residual",
lr=1e-3,
weight_decay=0.0,
devices=4,
xpad=2,
ypad=2... |
a0cf824f0444812c6e217773083bd09aa6cbd3d6888b9f57c79443e4bda40e25 | Python | 342 | 12 | import os
def get_tests_directory():
"""discover and return the absolute path of the root directory"""
testdir = os.getcwd()
if not testdir.endswith("tests"):
testdir = os.path.join(testdir, "tests")
if not os.path.exists(testdir):
raise ValueError("can not find test directory"... |
e25e500410f9009bbbf745f50c18806074cc42ad87ad93bb28e83ac638660fca | Python | 342 | 15 | import pytest
from langchain_classic.retrievers.document_compressors.listwise_rerank import (
LLMListwiseRerank,
)
@pytest.mark.requires("langchain_openai")
def test__list_rerank_init() -> None:
from langchain_openai import ChatOpenAI
LLMListwiseRerank.from_llm(
llm=ChatOpenAI(api_key="foo"),
... |
f215b0e71a7847a55c26b653bdc9210f73fb39f98b075cf38f2beb9ac125649c | Python | 343 | 8 | DEFAULT_WINDOW_WIDTH_MS = 10e3
# DEFAULT_TARGET_IP_ADDR = "tcp://192.168.137.124:5557" # KR260 home
DEFAULT_TARGET_IP_ADDR = "tcp://192.168.137.248:5557" # KR260 Lab
# DEFAULT_TARGET_IP_ADDR = "tcp://127.0.0.1:5557" # Local
# DEFAULT_TARGET_IP_ADDR = "tcp://192.168.137.104:5557" # ZCU102
DEFAULT_SAVE_PATH... |
32307d6f5a02be4d048e0374cf39c774d4ceb31698d93ecc1ebf8427e7d6d579 | Python | 344 | 14 | from langchain_classic.indexes import __all__
def test_all() -> None:
"""Use to catch obvious breaking changes."""
expected = [
"aindex",
"GraphIndexCreator",
"index",
"IndexingResult",
"SQLRecordManager",
"VectorstoreIndexCreator",
]
assert sorted(__all... |
3e854cc65bb60266670452324ca9bb7beabd09c4328291e8f01cd54495508b84 | Python | 344 | 12 | from pdearena.configs.config_blast import BlastVelocityDensityTemperatureTimeIntegratorConfig
from pdearena.utils.constants import SEED0
config = BlastVelocityDensityTemperatureTimeIntegratorConfig(
model="FFNO_cond1_spatial_spectral",
lr=1e-3,
weight_decay=0.0,
devices=4,
xpad=2,
ypad... |
ca0e524b7c70d1a32e57200f7a127d40219f79b5e2d8b91619ee18658d772627 | Python | 344 | 12 | from pdearena.configs.config_coal import CoalVelocityVfracTempDeltaTPredConfig
from pdearena.utils.constants import Paths, CoalConstants
config = CoalVelocityVfracTempDeltaTPredConfig(
model="convNeXT-tiny",
noise_level=1e-2,
include_derivatives=True,
lr=2e-4,
weight_decay=0.0,
loss="m... |
1cc33eca5977841fe2d78874deba836489f54f83a3dd1ddc4697144ccb6d3b8b | Python | 346 | 12 | import numpy as np
import pysindy as ps
import pandas as pd
from pysindy.feature_library import FourierLibrary
t = np.linspace(0, 1, 100)
x = 3 * np.exp(-2 * t) + 3
y = 0.5 * np.exp(t)
X = np.stack((x, y), axis=-1) # First column is x, second is y
model = ps.SINDy(feature_names=["x", "y"], feature_library=FourierLib... |
5d48197be23936908d5b8a91187cba91984922b465f4c4abcca7af59190b748f | Python | 346 | 19 | from bindsnet.evaluation.evaluation import (
all_activity,
assign_labels,
logreg_fit,
logreg_predict,
ngram,
proportion_weighting,
update_ngram_scores,
)
__all__ = [
"assign_labels",
"logreg_fit",
"logreg_predict",
"all_activity",
"proportion_weighting",
"ngram",
... |
ec0557d1af38f5f0c981c4314eed5c0e883cf13c0db4793078ef69852b074a34 | Python | 346 | 9 | """Core geometry/algorithm library for CraniumPy.
Pure computation: mesh objects in, mesh objects or measurements out.
No GUI, no rendering, no file dialogs, no disk round-tripping between
pipeline steps. Both the web API (api/) and the desktop app (desktop/)
call into this package; neither owns any algorithm logic.
"... |
1793063e53015c55c469355b3c3d02f53540bef420b924759265ba7a192455d1 | Python | 348 | 12 | from pdearena.configs.config_coal import CoalVelocityVfracTempDeltaTPredConfig
from pdearena.utils.constants import Paths, CoalConstants
config = CoalVelocityVfracTempDeltaTPredConfig(
model="convNeXT-tiny-max",
noise_level=1e-2,
include_derivatives=True,
lr=2e-4,
weight_decay=0.0,
los... |
fe35eb5540b676bcbd6e8cb93d64845ff65bc922ccc1e221629caf3449df40f2 | Python | 348 | 11 | import pytest
import pytest_socket
import requests
def test_socket_disabled() -> None:
"""This test should fail."""
with pytest.raises(pytest_socket.SocketBlockedError):
# Ignore S113 since we don't need a timeout here as the request
# should fail immediately
requests.get("https://www.... |
14f0d031ede51e0c0b61a030039a01820da60a40712c34834ea257d9c39bdbe4 | Python | 349 | 11 | from pycromanager import JavaBackendAcquisition, multi_d_acquisition_events
def img_process(image, metadata):
print(metadata['Axes'])
# TODO: process and save images.
with JavaBackendAcquisition(image_process_fn=img_process) as acq:
events = multi_d_acquisition_events(num_time_points=2, time_interval_s=... |
6cf6a175c6809d42cd563e2471a9fc2288120edee950ac9a128518c7211497ce | Python | 349 | 17 | #!/usr/bin/python
import sys
import json
doc = json.loads(sys.stdin.read())
sums = 0
for site, output in doc['input'].items():
sums = sums + output['sum'];
sums = sums / len(doc['input'])
if sums > 4:
success = True
else:
success = False
output = { "output": { "sum": sums }, "success": success }
sys.stdo... |
520e5eb76bcea0a2150652ece968961e4744cd89de8e9720c6821922fce80d14 | Python | 350 | 16 | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 25 16:28:30 2023
@author: biener
"""
import numpy as np
import mAECell_Utils as utils
from NN_Rslt_Anal import NN_Stat as stat
NN_Stat_O = stat()
Chi2 = NN_Stat_O.Multi_Chi2()
Chi2_FName = utils.fSaveAs(Title='Save chi2 Files')
np.savetxt(Chi2_FName, Chi... |
ba55babba8370261222c36d83dd2400178ee4f4ebfb86ca3fd59a8e7e24de474 | Python | 350 | 7 | """Summarization checker chain for verifying accuracy of text generation.
Chain that tries to verify the accuracy of text generation by splitting it into a
list of facts, then checking if those facts are true or not, and rewriting
the text to make it more truthful. It will repeat this loop until it hits `max_tries` or... |
d04593eb92f55f057088e916b131bb1aef274c3a1c50c64fecf2ab6c6c436875 | Python | 350 | 14 | # builtin modules
import os
import shutil
def moveFile(fileName, dest):
path = os.path.join(dest, fileName)
if os.path.exists(path):
if os.path.abspath(dest) != os.getcwd():
os.remove(path)
shutil.move(fileName, dest)
else:
shutil.move(fileName, dest)
return... |
c75b52aba9f0c8f45d4c122d32a5a8b904645a2e1e99ffc02204afef89c0245d | Python | 351 | 16 | #!/usr/bin/python
import sys
import json
doc = json.loads(sys.stdin.read())
for site, output in doc['input'].items():
outFile = output['outFile']
break
if doc['state']['iteration'] == 100:
success = True
else:
success = False
output = { "output": { "outputFile": outFile }, "success": success }
sys.st... |
d3f0a9f1f5dbec79cf2dccbd37fa03d1bcb1a3560e87be91fd4b18fb2b2c13eb | Python | 351 | 13 | """Utilities involving logging.
"""
import logging
def configure_logging(level=logging.WARNING):
"""Configure the global logging package.
Args:
level: logging level below which logging messages are ignored
"""
format = '%(asctime)s - %(name)s [%(levelname)s] %(message)s'
logging.basicConf... |
e4b922074854ffa92cb04d8b81255a8f4495e4d8752dc49791ef94ed737884f1 | Python | 351 | 12 | from core.runner import get_runner
from submiter.basic_submiter import BasicSubmiter
class Submiter(BasicSubmiter):
def __init__(self, cfg):
super(Submiter, self).__init__(cfg)
self.runner = self.get_runner()(self.cfg, self.writer)
def get_runner(self):
runner = get_runner(self.cfg["r... |
ef36277d586358ab80823622e2f6bfd3fcd7156b13d25c8fd2b70a0dcad86e18 | Python | 352 | 12 | fpath = 'model-300-3-direct/test_withReagents.cbond.num_cands_core{}.txt'
for n in [6, 8, 10, 12, 14, 16, 18, 20]:
with open(fpath.format(n), 'r') as fid:
tot = 0.
cands = 0.
for line in fid:
tot += 1
cands += int(line.strip())
print('Average num cands using n = {... |
1180933d053e608d248170ef11ac1cfcf109ec0747344688e7af4265b416b763 | Python | 353 | 14 | import torch
torch.autograd.set_detect_anomaly(False)
torch.autograd.profiler.profile(False)
torch.autograd.profiler.emit_nvtx(False)
from example_code import example_train
from example_code import example_dataset
from example_code import example_plot
if __name__=='__main__':
example_dataset.main()
example_tra... |
40c08966352ddf16333ed099e74d544977601467a12fd1dc7e4325c4868333d1 | Python | 353 | 16 | from langchain_classic.prompts.loading import __all__
EXPECTED_ALL = [
"_load_examples",
"_load_few_shot_prompt",
"_load_output_parser",
"_load_prompt",
"_load_prompt_from_file",
"_load_template",
"load_prompt",
"load_prompt_from_config",
]
def test_all_imports() -> None:
assert s... |
9bd2e37447b9cebcf1ebff4761eb1da62c8710263b5772329a44859d0549c2fb | Python | 353 | 12 | """Module defines common test data."""
from pathlib import Path
_THIS_DIR = Path(__file__).parent
_EXAMPLES_DIR = _THIS_DIR / "integration_tests" / "examples"
# Paths to test PDF files
HELLO_PDF = _EXAMPLES_DIR / "hello.pdf"
LAYOUT_PARSER_PAPER_PDF = _EXAMPLES_DIR / "layout-parser-paper.pdf"
DUPLICATE_CHARS = _EXAM... |
d71916c69f26bd6350f5dd02b3d4140244586ce4fe8744a299341a144e726237 | Python | 353 | 9 | import tensorflow as tf
def _grad(model, model_inputs, y_true, loss):
with tf.GradientTape() as tape:
model_pred = model(model_inputs, training=False)
# y_pred = model_pred['cartesian position']
loss_value = loss(y_true=y_true, y_pred=model_pred)
return loss_value, tape.gradient(loss_v... |
eeb6c6d7506c7c378aca0078983c2fd003e9bb09e535da4a6ae03e110f9bb1fc | Python | 355 | 14 | class ExpRegistry(type):
_registry = {}
def __new__(cls, name, bases, attrs):
new_cls = super().__new__(cls, name, bases, attrs)
cls._registry[name] = new_cls
return new_cls
def __class_getitem__(cls, key):
return cls._registry[key]
class ExpClass(metaclass=ExpRegistry):
... |
5844965a0dcf152b8fe5e9ebf62ec98d193714222f053208b48fbfa4bd29a996 | Python | 356 | 14 | # class ModelRegistry(type):
# _registry = {}
#
# def __new__(cls, name, bases, attrs):
# new_cls = super().__new__(cls, name, bases, attrs)
# cls._registry[name] = new_cls
# return new_cls
#
# def __class_getitem__(cls, key):
# return cls._registry[key]
class ModelClass():
... |
9ad00d200e81f336fee08d023003db85a3c8d1afa2e320638ad7aa85cdcc13ec | Python | 356 | 15 | from setuptools import setup
setup(name='parsivar',
packages=['parsivar'],
version='0.2.3.1',
description='Python library for preprocessing Persian text.',
author='ICT',
author_email='',
url='',
download_url = '',
install_requires=['nltk>=3.6.6'],
python_requires=">=3.3",
classifiers = []... |
ad99736d9b41a64ceef99e50d18b913aadcd899afafa7c6e91141be4a19e97a2 | Python | 356 | 9 | # Python implementation for Band Pass filtering a signal
import numpy as np
import scipy.signal as scsig
def BandPassFilter(signal, k_BP, fc):
alpha = (1 - k_BP*np.cos(2*np.pi*fc) - np.sqrt(2*k_BP*(1-np.cos(2*np.pi*fc)) - k_BP**2 * np.sin(2 * np.pi * fc)**2))/(1-k_BP)
signal_f = scsig.filtfilt(1-alpha, [1, -al... |
e68845a13c61a6c47296d611c0096675a4a173308f3e4cafc5b734490e5b4c21 | Python | 358 | 13 | """Relevant prompts for constructing indexes."""
from langchain_core._api import warn_deprecated
warn_deprecated(
since="0.1.47",
message=(
"langchain.indexes.prompts will be removed in the future."
"If you're relying on these prompts, please open an issue on "
"GitHub to explain your ... |
47c012f9d68b2601aed3df069fb5bb6b2af98fea4c40fa6cc5e8313ee0930d05 | Python | 359 | 9 | from createdir import createdir, parse_bellybuttonseg_args
if __name__ == "__main__":
args = parse_bellybuttonseg_args('Create a new BellyButton project')
if args is None: # Error in parsing
raise ValueError("Error: Invalid arguments provided.")
createdir(0, file_path=args['file_pat... |
b55ddc02013f94414557a712b6abbb867e38fc689fefa35e76d5790bb72b133a | Python | 361 | 10 | """Chains and utils related to evaluating question answering functionality."""
from langchain_classic.evaluation.qa.eval_chain import (
ContextQAEvalChain,
CotQAEvalChain,
QAEvalChain,
)
from langchain_classic.evaluation.qa.generate_chain import QAGenerateChain
__all__ = ["ContextQAEvalChain", "CotQAEvalC... |
f6697c4629e7d7e01796901100bc308fd15ab3dca1ca9b1957b3560d88424b36 | Python | 361 | 14 |
def test_run__turboreg(image_registration_fixture):
ref_path = image_registration_fixture[0]
data_path = image_registration_fixture[1]
from imagingplus.utils.images import ImportTiff
from imagingplus.processing.turboreg import run__turboreg
ref_img = ImportTiff(ref_path)[1]
run__turboreg(stac... |
a48ba2a66e2da9ea06da8afa0e3e8cd257d04a58cb493d4644524256c596cb20 | Python | 362 | 13 | from setuptools import setup, find_packages
setup(
name="scdp",
version="0.1.0",
description="OrbFlow: equivariant flow matching for orbital coefficient / density prediction",
packages=find_packages(),
package_data={
"scdp.model.equiformer_v3": ["Jd.pt"],
"scdp.model.scn": ["Jd.pt"]... |
646f45d83ad0fcfa183bf3ff52633b297cc097d7901441a0deaf924e13aa29e1 | Python | 364 | 13 | from langchain_core.output_parsers.openai_functions import (
JsonKeyOutputFunctionsParser,
JsonOutputFunctionsParser,
PydanticAttrOutputFunctionsParser,
PydanticOutputFunctionsParser,
)
__all__ = [
"JsonKeyOutputFunctionsParser",
"JsonOutputFunctionsParser",
"PydanticAttrOutputFunctionsPars... |
8ce6315fac6f3140eb26a1acb3048ff083f7558c1740a65c3c3a5f26cf942cf0 | Python | 364 | 10 | prompt_template = """Given the following question and context, extract any part of the context *AS IS* that is relevant to answer the question. If none of the context is relevant return {no_output_str}.
Remember, *DO NOT* edit the extracted parts of the context.
> Question: {{question}}
> Context:
>>>
{{context}}
>>>... |
bda476efb7052963f101d5b0451efbb61f0907656b6c21ea3d95713f278da61a | Python | 364 | 13 | from utils.my_containers import Constructor
model_register = Constructor()
from .encoder.cnn.cnn import CnnEncoder
from .encoder.gnn.gnn import GNNEncoder
from .encoder.graph_transformer.transformer_model import GraphTransformer
from .decoder.vae.vae import VariationalAutoEncoder
def get_model(model_cfg):
retu... |
39788a24da807b95341e57bf5b6fda4517e2c41da78564143392999a9ec83687 | Python | 365 | 13 | import numpy as np
import sys
import flatmap_util as fmutil
flatmap_nrrd = sys.argv[1]
pixel_res = int(sys.argv[2])
fmap_vd, fmask = fmutil.load_flatmap(flatmap_nrrd)
fx_d, fy_d = fmutil.get_discrete_flat_coordinates(fmap_vd.raw, pixel_res, fmask)
pix_uniq = np.unique(np.vstack((fx_d, fy_d)).T, axis=0)
print(pixel_... |
33a59dad9f6918b80e9d1f83c42d80928f9c2947880c8e41f6947dbfac910dac | Python | 366 | 11 | from pycromanager import multi_d_acquisition_events, Core, Acquisition, start_headless, stop_headless
mm_app_path = r"C:\Users\henry\Micro-Manager-nightly"
config = mm_app_path + r"\MMConfig_demo.cfg"
start_headless(mm_app_path, config, python_backend=True)
with Acquisition() as acq:
acq.acquire(multi_d_acquisiti... |
7ac8f85a717719f194aaafeed698f9a12f822d22e9f4bf19a17becf3f9606f6f | Python | 366 | 12 | from pdearena.configs.config_blast import BlastVelocityDensityTemperatureDeltaTPredConfig
from pdearena.utils.constants import Paths, BlastConstants
config = BlastVelocityDensityTemperatureDeltaTPredConfig(
model="convNeXT-tiny",
noise_level=1e-2,
include_derivatives=True,
lr=2e-4,
weight_d... |
04e5f12810e65e87acc943ea2db9ea55fa6754b8e1574ba9c3a94d2be21d684d | Python | 367 | 15 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Dec 19 17:15:11 2022
@author: biener
"""
import torch
from NN_Rslt_Anal import NN_Rslt_Anal as Ana
Ana_O = Ana()
Scale = 0.1968121
Conc_Interp, _, Conc_GT, _ = Ana_O.genConc(selIter = -1, c0 = torch.tensor([Scale, 0.0, 0.0, 0.0]),
... |
ab86d7691cfe286e597ed972ce7b350e9d9e3569edd6d58e778bbcfb98f4df9c | Python | 367 | 15 | from langchain_core.language_models import (
BaseLanguageModel,
LanguageModelInput,
LanguageModelOutput,
get_tokenizer,
)
from langchain_core.language_models.base import _get_token_ids_default_method
__all__ = [
"BaseLanguageModel",
"LanguageModelInput",
"LanguageModelOutput",
"_get_tok... |
6d4e13f836e94a0f049f84a3da5d1fd81fdd5555ab83a0c32fc2ffb7c0f87c34 | Python | 369 | 19 | from setuptools import setup
setup(
name="se3_diffusion",
packages=[
'data',
'analysis',
'model',
'experiments',
'openfold'
],
package_dir={
'data': './data',
'analysis': './analysis',
'model': './model',
'experiments': './experime... |
75efe74c08eaaea0a656080b2f85e7f6c066eca7d9496a11a4c9f210453cd6e9 | Python | 369 | 18 | import torch
from genie.utils.geo_utils import distance, dihedral
def get_template_fn(template):
if template == 'v1':
return v1, 1
def v1(t):
# [b, n_res, n_res, 1]
d = distance(torch.stack([
t.trans.unsqueeze(2).repeat(1, 1, t.trans.shape[1], 1), # Ca_1
t.trans.unsqueeze(1).repeat(1, t.trans.shape[1], 1,... |
a33ae6bb412d689255480ccafeeee7cf15a9afd38eb1c5a400d1d283ea885584 | Python | 369 | 13 | """In memory store that is not thread safe and has no eviction policy.
This is a simple implementation of the BaseStore using a dictionary that is useful
primarily for unit testing purposes.
"""
from langchain_core.stores import InMemoryBaseStore, InMemoryByteStore, InMemoryStore
__all__ = [
"InMemoryBaseStore",... |
68901db55e1ce73d343593ef8ae5574290403926661cd62f0c1be7c0c47904c7 | Python | 370 | 12 | from pdearena.configs.config_blast import BlastVelocityDensityTemperatureDeltaTPredConfig
from pdearena.utils.constants import Paths, BlastConstants
config = BlastVelocityDensityTemperatureDeltaTPredConfig(
model="convNeXT-tiny-max",
noise_level=1e-2,
include_derivatives=True,
lr=2e-4,
weig... |
856107dad408ea3c03c070e2fbcdbee703c63cc8850273cdc37175767780b0ae | Python | 370 | 15 | from .painn import PaiNN
# from .painn_v2 import PaiNN
from .lightning import PaiNNLightning
from .painn_foundation import PaiNN as PaiNNFoundation
from .painn_downstream_head import PaiNNWithDownstreamHead
from .loss import L2Loss, CosineLoss
__all__ = [
PaiNN,
PaiNNLightning,
PaiNNFoundation,
PaiN... |
35a079bd5ce961abcaf3240605d61f7989fe68192f1c414ece7129c55b7b0658 | Python | 371 | 10 | from mrQA.run_parallel import process_parallel
from pathlib import Path
from MRdataset.config import MRDS_EXT
DATA_ROOT = Path('/media/sinhah/extremessd/ABCD-375/dicom-baseline')
OUTPUT_DIR = DATA_ROOT.parent / (DATA_ROOT.stem + '_mrqa_files')
name = 'abcd-375'
output_path = OUTPUT_DIR / f'{name}{MRDS_EXT}'
process_... |
61c36822f9db4607fa38e01843ee0d993b6df27ce61986b194a2aa906ae8a4d6 | Python | 372 | 12 | # -*- coding: utf-8 -*-
"""
Methods for state-specific information.
The methods here are based on the following paper:
| Neil J. Thomson, Owen N. Vickery, Callum M. Ives, Ulrich Zachariae:
| Ion-water coupling controls class A GPCR signal transduction pathways.
| https://doi.org/10.1101/2020.08... |
a41723117da5a6fcf088acd48e7b6435ab76b99d2101f730e0c4f0f30494179e | Python | 373 | 16 |
class DatasetRegistry(type):
_registry = {}
def __new__(cls, name, bases, attrs):
new_cls = super().__new__(cls, name, bases, attrs)
if name != "Dataset":
cls._registry[name] = new_cls
return new_cls
def __class_getitem__(cls, key):
return cls._registry[key]
... |
02c7b62bfc3f33651452f9072561594896e6456454e3fe700903d96c9f25125b | Python | 374 | 13 | # Author: vivekv2@gmail.com
from typing import Callable
def default_args(default_args: str) -> Callable:
"""This returns a decorator that attaches a default_args field to the
function object, which is used to populate the arg textfield in the app."""
def dec(fn: Callable) -> Callable:
fn.default_... |
076a902a709e9f8552347c1a7e9ee3a59e4a1e7681dda5df24e2c9a478e67af5 | Python | 375 | 4 | ALL_MODELS = ['ALL', 'ACOUS', 'BASE', 'BG_0-100', 'BG_60-80', 'BG_H2O', 'HET_0-100', 'HET_60-80', 'ILLUM_5mm', 'ILLUM_POINT',
'INVIS', 'INVIS_ACOUS', 'INVIS_SKIN', 'INVIS_SKIN_ACOUS', 'MSOT', 'MSOT_ACOUS', 'MSOT_ACOUS_SKIN',
'MSOT_SKIN', 'RES_0.15', 'RES_0.15_SMALL', 'RES_0.6', 'RES_1.2', 'S... |
e0d3779f5b23f3691f3a95e03866e5dd19d139ba1ae24c38a0e873983436c810 | Python | 375 | 12 | # from pkg_resources import get_distribution
# __version__ = get_distribution('scalex').version
__version__ = '1.1.1'
__author__ = 'Kai Cao'
__email__ = 'caokai@amss.ac.cn'
from .function import Run, get_prior, label_reweight, load_file, filter_data, batch_scale
__all__ = ['Run', 'get_prior', 'label_reweight', 'load... |
48e2d4a8003e764f410ca3706da584b0d503c7ef3bbcce81224e6db60b0742c7 | Python | 376 | 13 | from pdearena.configs.config_coal import CoalVelocityVfracTempDeltaTPredConfig
from pdearena.utils.constants import Paths, CoalConstants
config = CoalVelocityVfracTempDeltaTPredConfig(
model="convNeXT-tiny",
noise_level=1e-2,
include_derivatives=True,
include_cfl_features=True,
lr=2e-4,
... |
8302718bfe986b6213769004efc01e1468d411079913cc0ed0ee6fd6779cbe72 | Python | 376 | 15 | from .graph_func import graph_construction, combine_graph_dict
from .utils_func import adata_preprocess, fix_seed
from .SEDR_model import Sedr
from .clustering_func import mclust_R, leiden, louvain
__all__ = [
"graph_construction",
"combine_graph_dict",
"adata_preprocess",
"fix_seed",
... |
264f524b1f6ce131b88ab48b2edfc3962b1665296a28c43f21b691557816c662 | Python | 377 | 15 | from distutils.core import setup
from setuptools import find_packages
setup(
name="keras-explainability",
version="1.0.0",
author="Esten Høyland Leonardsen",
author_email="estenleonardsen@gmail.com",
packages=find_packages(),
url="https://github.com/estenhl/keras-explainability",
install_re... |
41ce39ff27e6c7a29ca37882488f6870da01236774819b743b4b61f9d6572e73 | Python | 377 | 16 | from langchain_classic.prompts.base import __all__
EXPECTED_ALL = [
"BasePromptTemplate",
"StringPromptTemplate",
"StringPromptValue",
"_get_jinja2_variables_from_template",
"check_valid_template",
"get_template_variables",
"jinja2_formatter",
"validate_jinja2",
]
def test_all_imports... |
895c9cf66eb3daedbec7b09d3be07cdec4d18f7b8c2aeb8111ba9a7d0d8593ee | Python | 378 | 16 | checkpoint_config = dict(interval=1)
# yapf:disable
log_config = dict(
interval=50,
hooks=[
dict(type='CustomizedTextLoggerHook'),
# dict(type='TensorboardLoggerHook')
])
# yapf:enable
custom_hooks = [dict(type='NumClassCheckHook')]
dist_params = dict(backend='nccl')
log_level = 'INFO'
load... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.