input
stringlengths
33
5k
output
stringlengths
32
5k
_base_ = [ '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] lang_model_name = 'bert-base-uncased' model = dict( type='GroundingDINO', num_queries=900, with_box_refine=True, as_two_stage=True, data_preprocessor=dict( type...
_base_ = [ '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] lang_model_name = 'bert-base-uncased' model = dict( type='GroundingDINO', num_queries=900, with_box_refine=True, as_two_stage=True, data_preprocessor=dict( type...
_base_ = [ '../_base_/models/fast-rcnn_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] train_pipeline = [ dict( type='LoadImageFromFile', file_client_args={{_base_.file_client_args}}), dict(type='LoadProposal...
_base_ = [ '../_base_/models/fast-rcnn_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] dataset_type = 'CocoDataset' data_root = 'data/coco/' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rg...
# Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
# Copyright 2025 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
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", ...
from langchain_core.tools import ( BaseTool, SchemaAnnotationError, StructuredTool, Tool, ToolException, create_schema_from_function, tool, ) __all__ = [ "SchemaAnnotationError", "create_schema_from_function", "ToolException", "BaseTool", "Tool", "StructuredTool", ...
_base_ = ['co_dino_5scale_r50_8xb2_1x_coco.py'] pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_large_patch4_window12_384_22k.pth' # noqa load_from = 'https://download.openmmlab.com/mmdetection/v3.0/codetr/co_dino_5scale_swin_large_16e_o365tococo-614254c9.pth' # noqa # model s...
_base_ = ['co_dino_5scale_r50_8xb2_1x_coco.py'] pretrained = 'https://github.com/SwinTransformer/storage/releases/download/v1.0.0/swin_large_patch4_window12_384_22k.pth' # noqa load_from = 'https://download.openmmlab.com/mmdetection/v3.0/codetr/co_dino_5scale_swin_large_22e_o365-0a33e247.pth' # noqa # model setting...
""" Initializer script that installs stuff to pip. """ from __future__ import annotations import argparse import logging import os import shutil import subprocess import sys import time def run_command(args: list[str]) -> subprocess.CompletedProcess[bytes]: logging.debug("$ %s", " ".join(args)) start_time =...
""" Initializer script that installs stuff to pip. """ from __future__ import annotations import argparse import logging import os import shutil import subprocess import sys import time def run_command( args: list[str], env: dict[str, str] | None = None, ) -> subprocess.CompletedProcess[str]: logging.de...
from typing import Optional from docarray import Document, DocumentArray from pydantic import BaseModel from uvicorn import Config, Server from jina import Gateway, __default_host__ from jina.clients.request import request_generator class DummyResponseModel(BaseModel): arg1: Optional[str] arg2: Optional[str...
from typing import Optional from docarray import Document, DocumentArray from pydantic import BaseModel from uvicorn import Config, Server from jina import Gateway, __default_host__ from jina.clients.request import request_generator class DummyResponseModel(BaseModel): arg1: Optional[str] arg2: Optional[str...
_base_ = '../_base_/default_runtime.py' # dataset settings dataset_type = 'CocoDataset' data_root = 'data/coco/' image_size = (1024, 1024) # Example to use different file client # Method 1: simply set the data root and let the file I/O module # automatically infer from prefix (not support LMDB and Memcache yet) # da...
_base_ = '../_base_/default_runtime.py' # dataset settings dataset_type = 'CocoDataset' data_root = 'data/coco/' image_size = (1024, 1024) file_client_args = dict(backend='disk') # comment out the code below to use different file client # file_client_args = dict( # backend='petrel', # path_mapping=dict({ # ...
# Copyright (c) OpenMMLab. All rights reserved. __version__ = '0.6.0' def parse_version_info(version_str): """Parse the version information. Args: version_str (str): version string like '0.1.0'. Returns: tuple: version information contains major, minor, micro version. """ versio...
# Copyright (c) OpenMMLab. All rights reserved. __version__ = '0.5.0' def parse_version_info(version_str): """Parse the version information. Args: version_str (str): version string like '0.1.0'. Returns: tuple: version information contains major, minor, micro version. """ versio...
from typing import Optional import torch from ..utils import logging logger = logging.get_logger(__name__) def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: """ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch, num_key_v...
from typing import Optional, Tuple import torch from ..utils import logging logger = logging.get_logger(__name__) def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor: """ This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch, nu...
"""Tracker for XGBoost collective.""" import ctypes import json import socket from enum import IntEnum, unique from typing import Dict, Optional, Union from .core import _LIB, _check_call, _deprecate_positional_args, make_jcargs def get_family(addr: str) -> int: """Get network family from address.""" return...
"""Tracker for XGBoost collective.""" import ctypes import json import socket from enum import IntEnum, unique from typing import Dict, Optional, Union from .core import _LIB, _check_call, _deprecate_positional_args, make_jcargs def get_family(addr: str) -> int: """Get network family from address.""" return...
from typing import Any import torch import enum from torch._C import _from_dlpack from torch._C import _to_dlpack as to_dlpack __all__ = [ "DLDeviceType", "from_dlpack", "to_dlpack", ] class DLDeviceType(enum.IntEnum): # Enums as in DLPack specification (aten/src/ATen/dlpack.h) kDLCPU = 1, ...
from typing import Any import torch import enum from torch._C import _to_dlpack as to_dlpack __all__ = [ "DLDeviceType", "from_dlpack", ] class DLDeviceType(enum.IntEnum): # Enums as in DLPack specification (aten/src/ATen/dlpack.h) kDLCPU = 1, kDLCUDA = 2, kDLCUDAHost = 3, kDLOpenCL = 4,...
# THIS FILE HAS BEEN AUTOGENERATED. To update: # 1. modify the `_deps` dict in setup.py # 2. run `make deps_table_update`` deps = { "Pillow": "Pillow>=10.0.1,<=15.0", "accelerate": "accelerate>=0.26.0", "av": "av", "beautifulsoup4": "beautifulsoup4", "blobfile": "blobfile", "codecarbon": "codeca...
# THIS FILE HAS BEEN AUTOGENERATED. To update: # 1. modify the `_deps` dict in setup.py # 2. run `make deps_table_update`` deps = { "Pillow": "Pillow>=10.0.1,<=15.0", "accelerate": "accelerate>=0.26.0", "av": "av", "beautifulsoup4": "beautifulsoup4", "blobfile": "blobfile", "codecarbon": "codeca...
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.src.ops.nn import average_pool as average_pool from keras.src.ops.nn import batch_normalization as batch_normalization from keras.src.ops.nn import binary_crossentropy as binary_crossentr...
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.src.ops.nn import average_pool as average_pool from keras.src.ops.nn import batch_normalization as batch_normalization from keras.src.ops.nn import binary_crossentropy as binary_crossentr...
import numpy as np import pytest from docarray import BaseDoc, DocList from docarray.base_doc import AnyDoc from docarray.documents import ImageDoc, TextDoc from docarray.typing import NdArray @pytest.mark.proto def test_simple_proto(): class CustomDoc(BaseDoc): text: str tensor: NdArray da ...
import numpy as np import pytest from docarray import BaseDoc, DocList from docarray.base_doc import AnyDoc from docarray.documents import ImageDoc, TextDoc from docarray.typing import NdArray @pytest.mark.proto def test_simple_proto(): class CustomDoc(BaseDoc): text: str tensor: NdArray da ...
_base_ = './solo_r50_fpn_1x_coco.py' # model settings model = dict( mask_head=dict( type='DecoupledSOLOHead', num_classes=80, in_channels=256, stacked_convs=7, feat_channels=256, strides=[8, 8, 16, 32, 32], scale_ranges=((1, 96), (48, 192), (96, 384), (192, 76...
_base_ = [ './solo_r50_fpn_1x_coco.py', ] # model settings model = dict( mask_head=dict( type='DecoupledSOLOHead', num_classes=80, in_channels=256, stacked_convs=7, feat_channels=256, strides=[8, 8, 16, 32, 32], scale_ranges=((1, 96), (48, 192), (96, 384),...
from __future__ import annotations from .CSRLoss import CSRLoss from .CSRReconstructionLoss import CSRReconstructionLoss from .FlopsLoss import FlopsLoss from .SparseAnglELoss import SparseAnglELoss from .SparseCachedGISTEmbedLoss import SparseCachedGISTEmbedLoss from .SparseCachedMultipleNegativesRankingLoss import S...
from __future__ import annotations from sentence_transformers.sparse_encoder.losses.CSRLoss import CSRLoss from sentence_transformers.sparse_encoder.losses.CSRReconstructionLoss import ( CSRReconstructionLoss, ) from sentence_transformers.sparse_encoder.losses.FlopsLoss import FlopsLoss from sentence_transformers....
# Copyright (c) OpenMMLab. All rights reserved. from typing import Optional import torch def get_max_cuda_memory(device: Optional[torch.device] = None) -> int: """Returns the maximum GPU memory occupied by tensors in megabytes (MB) for a given device. By default, this returns the peak allocated memory since ...
# Copyright (c) OpenMMLab. All rights reserved. from typing import Optional import torch def get_max_cuda_memory(device: Optional[torch.device] = None) -> int: """Returns the maximum GPU memory occupied by tensors in megabytes (MB) for a given device. By default, this returns the peak allocated memory since ...
import itertools from keras.src import tree from keras.src.trainers.data_adapters import data_adapter_utils from keras.src.trainers.data_adapters.data_adapter import DataAdapter class GeneratorDataAdapter(DataAdapter): """Adapter for Python generators.""" def __init__(self, generator): first_batches...
import itertools from keras.src import tree from keras.src.trainers.data_adapters import data_adapter_utils from keras.src.trainers.data_adapters.data_adapter import DataAdapter class GeneratorDataAdapter(DataAdapter): """Adapter for Python generators.""" def __init__(self, generator): first_batches...
# Copyright (c) OpenMMLab. All rights reserved. from .accuracy import Accuracy, accuracy from .ae_loss import AssociativeEmbeddingLoss from .balanced_l1_loss import BalancedL1Loss, balanced_l1_loss from .cross_entropy_loss import (CrossEntropyCustomLoss, CrossEntropyLoss, binary_cross_e...
# Copyright (c) OpenMMLab. All rights reserved. from .accuracy import Accuracy, accuracy from .ae_loss import AssociativeEmbeddingLoss from .balanced_l1_loss import BalancedL1Loss, balanced_l1_loss from .cross_entropy_loss import (CrossEntropyLoss, binary_cross_entropy, cross_entropy, m...
_base_ = './detr_r50_8xb2-500e_coco.py' model = dict( backbone=dict( depth=18, init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet18')), neck=dict(in_channels=[512]))
_base_ = './detr_r50_8xb2-500e_coco.py' model = dict( backbone=dict( depth=18, init_cfg=dict(type='Pretrained', checkpoint='torchvision://resnet18')), bbox_head=dict(in_channels=512))
_base_ = './scnet_x101_64x4d_fpn_20e_coco.py' data = dict(samples_per_gpu=1, workers_per_gpu=1) optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001) # NOTE: `auto_scale_lr` is for automatically scaling LR, # USER SHOULD NOT CHANGE ITS VALUES. # base_batch_size = (8 GPUs) x (1 samples per GPU) auto_...
_base_ = './scnet_x101_64x4d_fpn_20e_coco.py' data = dict(samples_per_gpu=1, workers_per_gpu=1) optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)
from typing import Optional, Union, Callable, Tuple, TYPE_CHECKING, Dict if TYPE_CHECKING: # pragma: no cover import numpy as np from docarray.typing import ArrayType from docarray import DocumentArray class MatchMixin: """A mixin that provides match functionality to DocumentArrays""" def match...
from typing import Optional, Union, Callable, Tuple, TYPE_CHECKING, Dict if TYPE_CHECKING: import numpy as np from docarray.typing import ArrayType from docarray import DocumentArray class MatchMixin: """A mixin that provides match functionality to DocumentArrays""" def match( self, ...
from typing import Union, Optional, Iterable from ..base.seqlike import BaseSequenceLikeMixin from .... import Document from ...memory import DocumentArrayInMemory class SequenceLikeMixin(BaseSequenceLikeMixin): """Implement sequence-like methods""" def _insert_doc_at_idx(self, doc, idx: Optional[int] = Non...
from typing import Union, Optional from ..base.seqlike import BaseSequenceLikeMixin from .... import Document class SequenceLikeMixin(BaseSequenceLikeMixin): """Implement sequence-like methods""" def _insert_doc_at_idx(self, doc, idx: Optional[int] = None): if idx is None: idx = len(self...
from docarray import Document, DocumentArray import pytest @pytest.mark.filterwarnings('ignore::UserWarning') def test_add_ignore_existing_doc_id(start_storage): elastic_doc = DocumentArray( storage='elasticsearch', config={ 'n_dim': 3, 'columns': [('price', 'int')], ...
from docarray import Document, DocumentArray import pytest def test_add_ignore_existing_doc_id(start_storage): elastic_doc = DocumentArray( storage='elasticsearch', config={ 'n_dim': 3, 'columns': [('price', 'int')], 'distance': 'l2_norm', 'index_na...
from keras.src import backend from keras.src.api_export import keras_export from keras.src.dtype_policies import dtype_policy from keras.src.dtype_policies.dtype_policy import QUANTIZATION_MODES from keras.src.dtype_policies.dtype_policy import DTypePolicy from keras.src.dtype_policies.dtype_policy import FloatDTypePol...
from keras.src import backend from keras.src.api_export import keras_export from keras.src.dtype_policies import dtype_policy from keras.src.dtype_policies.dtype_policy import QUANTIZATION_MODES from keras.src.dtype_policies.dtype_policy import DTypePolicy from keras.src.dtype_policies.dtype_policy import FloatDTypePol...
import numpy as np import pytest import torch from pydantic import parse_obj_as from docarray import BaseDocument from docarray.documents import Image REMOTE_JPG = ( 'https://upload.wikimedia.org/wikipedia/commons/8/80/' 'Dag_Sebastian_Ahlander_at_G%C3%B6teborg_Book_Fair_2012b.jpg' ) @pytest.mark.slow @pyte...
import numpy as np import pytest import torch from pydantic import parse_obj_as from docarray import BaseDocument from docarray.documents import Image REMOTE_JPG = ( 'https://upload.wikimedia.org/wikipedia/commons/8/80/' 'Dag_Sebastian_Ahlander_at_G%C3%B6teborg_Book_Fair_2012b.jpg' ) @pytest.mark.slow @pyte...
from __future__ import annotations from sentence_transformers.sparse_encoder.losses.CSRLoss import CSRLoss from sentence_transformers.sparse_encoder.losses.CSRReconstructionLoss import ( CSRReconstructionLoss, ) from sentence_transformers.sparse_encoder.losses.SparseAnglELoss import SparseAnglELoss from sentence_t...
from __future__ import annotations from sentence_transformers.sparse_encoder.losses.CSRLoss import CSRLoss from sentence_transformers.sparse_encoder.losses.CSRReconstructionLoss import ( CSRReconstructionLoss, ) from sentence_transformers.sparse_encoder.losses.SparseCachedGISTEmbedLoss import ( SparseCachedGIS...
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
# coding=utf-8 # Copyright 2022 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
# Copyright (c) OpenMMLab. All rights reserved. from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig from ..builder import DETECTORS from .single_stage_instance_seg import SingleStageInstanceSegmentor @DETECTORS.register_module() class SOLOv2(SingleStageInstanceSegmentor): """`SOLOv2: Dynamic and Fas...
# Copyright (c) OpenMMLab. All rights reserved. from mmdet.core.utils import ConfigType, OptConfigType, OptMultiConfig from ..builder import DETECTORS from .single_stage_instance_seg import SingleStageInstanceSegmentor @DETECTORS.register_module() class SOLOv2(SingleStageInstanceSegmentor): """`SOLOv2: Dynamic an...
# Copyright (c) OpenMMLab. All rights reserved. from unittest import TestCase import numpy as np import torch from mmengine.config import ConfigDict from mmengine.structures import InstanceData from mmdet import * # noqa from mmdet.models.dense_heads import SOLOV2Head from mmdet.structures.mask import BitmapMasks ...
# Copyright (c) OpenMMLab. All rights reserved. from unittest import TestCase import numpy as np import torch from mmengine.config import ConfigDict from mmengine.structures import InstanceData from mmdet import * # noqa from mmdet.models.dense_heads import SOLOV2Head from mmdet.structures.mask import BitmapMasks ...
from __future__ import annotations import logging from typing import Any, Dict, Optional from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.tools import BaseTool from langchain_core.utils import get_from_dict_or_env from pydantic import model_validator logger = logging.getLogger(__nam...
from __future__ import annotations import logging from typing import Any, Dict, Optional from langchain_core.callbacks import CallbackManagerForToolRun from langchain_core.tools import BaseTool from langchain_core.utils import get_from_dict_or_env from pydantic import model_validator logger = logging.getLogger(__nam...
__copyright__ = "Copyright (c) 2020-2021 Jina AI Limited. All rights reserved." __license__ = "Apache-2.0" import subprocess from typing import Iterable, Optional import torch from jina import DocumentArray, Executor, requests from jina.logging.logger import JinaLogger from jina_commons.batching import get_docs_batc...
__copyright__ = "Copyright (c) 2020-2021 Jina AI Limited. All rights reserved." __license__ = "Apache-2.0" import subprocess from typing import Iterable, Optional import torch from jina import DocumentArray, Executor, requests from jina.logging.logger import JinaLogger from jina_commons.batching import get_docs_batc...
"""Tests for training continuation.""" import json from typing import Any, Dict, TypeVar import numpy as np import pytest import xgboost as xgb # pylint: disable=too-many-locals def run_training_continuation_model_output(device: str, tree_method: str) -> None: """Run training continuation test.""" datasets...
"""Tests for training continuation.""" import json from typing import Any, Dict, TypeVar import numpy as np import pytest import xgboost as xgb # pylint: disable=too-many-locals def run_training_continuation_model_output(device: str, tree_method: str) -> None: """Run training continuation test.""" datasets ...
# Copyright (c) OpenMMLab. All rights reserved. import warnings import torch.nn as nn from mmcv.runner import BaseModule, auto_fp16 from mmdet.models.backbones import ResNet from mmdet.models.utils import ResLayer as _ResLayer from mmdet.registry import MODELS @MODELS.register_module() class ResLayer(BaseModule): ...
# Copyright (c) OpenMMLab. All rights reserved. import warnings import torch.nn as nn from mmcv.runner import BaseModule, auto_fp16 from mmdet.models.backbones import ResNet from mmdet.models.builder import SHARED_HEADS from mmdet.models.utils import ResLayer as _ResLayer @SHARED_HEADS.register_module() class ResLa...
""" Official evaluation script for v1.1 of the SQuAD dataset. """ import argparse import json import re import string import sys from collections import Counter def normalize_answer(s): """Lower text and remove punctuation, articles and extra whitespace.""" def remove_articles(text): return re.sub(r...
""" Official evaluation script for v1.1 of the SQuAD dataset. """ import argparse import json import re import string import sys from collections import Counter def normalize_answer(s): """Lower text and remove punctuation, articles and extra whitespace.""" def remove_articles(text): return re.sub(r...
__copyright__ = "Copyright (c) 2021 Jina AI Limited. All rights reserved." __license__ = "Apache-2.0" import os import subprocess from pathlib import Path import pytest TEST_DIR = os.path.dirname(os.path.abspath(__file__)) @pytest.fixture(scope='session', autouse=True) def create_model_weights(): path_to_model...
__copyright__ = "Copyright (c) 2021 Jina AI Limited. All rights reserved." __license__ = "Apache-2.0" import os import pytest TEST_DIR = os.path.dirname(os.path.abspath(__file__)) @pytest.fixture(scope='session', autouse=True) def create_model_weights(): path_to_model = os.path.join(TEST_DIR, 'model', 'model_s...
""" Wrapper script to run a command inside a Docker container """ import argparse import grp import itertools import os import pathlib import pwd import subprocess import sys import textwrap OPS_DIR = pathlib.Path(__file__).expanduser().resolve().parent PROJECT_ROOT_DIR = OPS_DIR.parent LINEWIDTH = 88 TEXT_WRAPPER = ...
""" Wrapper script to run a command inside a Docker container """ import argparse import grp import itertools import os import pathlib import pwd import subprocess import sys import textwrap OPS_DIR = pathlib.Path(__file__).expanduser().resolve().parent PROJECT_ROOT_DIR = OPS_DIR.parent LINEWIDTH = 88 TEXT_WRAPPER = ...
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import torch from mmdet.models.roi_heads.mask_heads import (DynamicMaskHead, FCNMaskHead, MaskIoUHead) from .utils import _dummy_bbox_sampling def test_mask_head_loss(): """Test mask head loss when mask tar...
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import torch from mmdet.models.roi_heads.mask_heads import (DynamicMaskHead, FCNMaskHead, MaskIoUHead) from .utils import _dummy_bbox_sampling def test_mask_head_loss(): """Test mask head loss when mask tar...
# Copyright (c) OpenMMLab. All rights reserved. from unittest import TestCase from unittest.mock import Mock, patch from mmdet.engine.hooks import YOLOXModeSwitchHook class TestYOLOXModeSwitchHook(TestCase): @patch('mmdet.engine.hooks.yolox_mode_switch_hook.is_model_wrapper') def test_is_model_wrapper_and_p...
# Copyright (c) OpenMMLab. All rights reserved. from unittest import TestCase from unittest.mock import Mock, patch from mmdet.engine.hooks import YOLOXModeSwitchHook class TestYOLOXModeSwitchHook(TestCase): @patch('mmdet.engine.hooks.yolox_mode_switch_hook.is_model_wrapper') def test_is_model_wrapper_and_p...
import unittest import torch import torchaudio.prototype.functional as F from torchaudio_unittest.common_utils import nested_params, TestBaseMixin, torch_script class TorchScriptConsistencyTestImpl(TestBaseMixin): def _assert_consistency(self, func, inputs, shape_only=False): inputs_ = [] for i i...
import torch import torchaudio.prototype.functional as F from torchaudio_unittest.common_utils import nested_params, TestBaseMixin, torch_script class TorchScriptConsistencyTestImpl(TestBaseMixin): def _assert_consistency(self, func, inputs, shape_only=False): inputs_ = [] for i in inputs: ...
# Licensed to the LF AI & Data foundation under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the "License"); # you may not use this fil...
from pydantic import parse_obj_as from docarray import BaseDoc from docarray.documents import TextDoc def test_simple_init(): t = TextDoc(text='hello') assert t.text == 'hello' def test_str_init(): t = parse_obj_as(TextDoc, 'hello') assert t.text == 'hello' def test_doc(): class MyDoc(BaseDoc...
import os import subprocess directory = os.path.dirname(os.path.realpath(__file__)) def run(*command: str) -> None: print(f">>>>> Running poetry run {' '.join(command)}") subprocess.run(["poetry", "run"] + list(command), cwd=directory, check=True) def lint(): try: run("ruff", "check", ".", "--e...
import os import subprocess directory = os.path.dirname(os.path.realpath(__file__)) def run(*command: str) -> None: print(f">>>>> Running poetry run {' '.join(command)}") subprocess.run(["poetry", "run"] + list(command), cwd=directory, check=True) def lint(): try: run("ruff", "check", ".", "--e...
# We follow the original implementation which # adopts the Caffe pre-trained backbone. _base_ = [ '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings preprocess_cfg = dict( mean=[102.9801, 115.9465, 122.7717], std=[1.0, 1.0, 1.0...
# We follow the original implementation which # adopts the Caffe pre-trained backbone. _base_ = [ '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # model settings preprocess_cfg = dict( mean=[102.9801, 115.9465, 122.7717], std=[1.0, 1.0, 1.0...
from __future__ import annotations from typing import Any, Dict, Optional from docarray import BaseDoc, DocList from docarray.typing import AnyEmbedding, AnyTensor class LegacyDocument(BaseDoc): """ This Document is the LegacyDocument. It follows the same schema as in DocList v1. It can be useful to sta...
from __future__ import annotations from typing import Any, Dict, Optional from docarray import BaseDoc, DocArray from docarray.typing import AnyEmbedding, AnyTensor class LegacyDocument(BaseDoc): """ This Document is the LegacyDocument. It follows the same schema as in DocArray v1. It can be useful to s...
import logging from fastapi import Request from backend.data import integrations from backend.data.model import APIKeyCredentials, Credentials from backend.integrations.providers import ProviderName from backend.integrations.webhooks._base import BaseWebhooksManager from backend.util.request import Requests logger =...
import logging from fastapi import Request from backend.data import integrations from backend.data.model import APIKeyCredentials, Credentials from backend.integrations.providers import ProviderName from backend.integrations.webhooks._base import BaseWebhooksManager from backend.util.request import Requests logger =...
import grpc from grpc_health.v1 import health, health_pb2, health_pb2_grpc from grpc_reflection.v1alpha import reflection from pydantic import BaseModel from uvicorn import Config, Server from jina import Gateway, __default_host__ from jina.proto import jina_pb2, jina_pb2_grpc class DummyResponseModel(BaseModel): ...
import grpc from grpc_health.v1 import health, health_pb2, health_pb2_grpc from grpc_reflection.v1alpha import reflection from pydantic import BaseModel from uvicorn import Config, Server from jina import Gateway, __default_host__ from jina.proto import jina_pb2, jina_pb2_grpc class DummyResponseModel(BaseModel): ...
from typing import Union, List class InputExample: """Structure for one input example with texts, the label and a unique id""" def __init__(self, guid: str = "", texts: List[str] = None, label: Union[int, float] = 0): """ Creates one InputExample with the given texts, guid and label ...
from typing import Union, List class InputExample: """ Structure for one input example with texts, the label and a unique id """ def __init__(self, guid: str = "", texts: List[str] = None, label: Union[int, float] = 0): """ Creates one InputExample with the given texts, guid and label...
# Copyright (c) OpenMMLab. All rights reserved. from unittest.mock import patch from mmengine.testing import RunnerTestCase class TestEmptyCacheHook(RunnerTestCase): def test_with_runner(self): with patch('torch.cuda.empty_cache') as mock_empty_cache: cfg = self.epoch_based_cfg c...
# Copyright (c) OpenMMLab. All rights reserved. from unittest.mock import Mock from mmengine.hooks import EmptyCacheHook class TestEmptyCacheHook: def test_emtpy_cache_hook(self): hook = EmptyCacheHook(True, True, True) runner = Mock() hook._after_iter(runner, 0) hook._before_epo...
# coding: utf-8 from pathlib import Path import pandas as pd from sklearn.metrics import mean_squared_error import lightgbm as lgb print("Loading data...") # load or create your dataset regression_example_dir = Path(__file__).absolute().parents[1] / "regression" df_train = pd.read_csv(str(regression_example_dir / "r...
# coding: utf-8 from pathlib import Path import pandas as pd from sklearn.metrics import mean_squared_error import lightgbm as lgb print('Loading data...') # load or create your dataset regression_example_dir = Path(__file__).absolute().parents[1] / 'regression' df_train = pd.read_csv(str(regression_example_dir / 'r...
"""Init params.""" from llama_index.readers.huggingface_fs.base import HuggingFaceFSReader __all__ = ["HuggingFaceFSReader"]
"""Init params.""" from llama_index.readers.huggingface_fs.base import HuggingFaceFSReader __all__ = ["HuggingFaceFSReader"]
import os import time import pytest from jina import Flow, Executor class SlowExecutor(Executor): def close(self) -> None: with open( os.path.join(self.metas.workspace, 'test'), 'w', encoding='utf-8' ) as f: time.sleep(10) f.write('x') @pytest.mark.slow def ...
import os import time import pytest from jina import Flow, Executor class SlowExecutor(Executor): def close(self) -> None: with open(os.path.join(self.metas.workspace, 'test'), 'w', encoding='utf-8') as f: time.sleep(10) f.write('x') @pytest.mark.slow def test_slow_executor_clo...
from __future__ import annotations import logging from typing import TYPE_CHECKING, Any, Callable from sentence_transformers.evaluation import RerankingEvaluator from sentence_transformers.util import cos_sim if TYPE_CHECKING: import numpy as np from torch import Tensor from sentence_transformers.sparse...
from __future__ import annotations import logging from typing import TYPE_CHECKING, Any, Callable from sentence_transformers.evaluation import RerankingEvaluator from sentence_transformers.util import cos_sim if TYPE_CHECKING: import numpy as np from torch import Tensor from sentence_transformers.sparse...
import logging from typing import Annotated from autogpt_libs.auth.middleware import APIKeyValidator from fastapi import APIRouter, Body, Depends, Query from fastapi.responses import JSONResponse from backend.data.user import ( get_user_by_email, set_user_email_verification, unsubscribe_user_by_token, ) f...
import logging from typing import Annotated from autogpt_libs.auth.middleware import APIKeyValidator from fastapi import APIRouter, Body, Depends from backend.data.user import get_user_by_email, set_user_email_verification from backend.server.v2.postmark.models import ( PostmarkBounceEnum, PostmarkBounceWebho...
import collections import json import os import string from typing import Iterable, List from .WordTokenizer import ENGLISH_STOP_WORDS, WordTokenizer class WhitespaceTokenizer(WordTokenizer): """ Simple and fast white-space tokenizer. Splits sentence based on white spaces. Punctuation are stripped from t...
from typing import List, Iterable import collections import string import os import json from .WordTokenizer import WordTokenizer, ENGLISH_STOP_WORDS class WhitespaceTokenizer(WordTokenizer): """ Simple and fast white-space tokenizer. Splits sentence based on white spaces. Punctuation are stripped from to...
import os from pathlib import Path from typing import Any, Callable, Optional, Tuple, Union from .folder import default_loader from .utils import check_integrity, download_and_extract_archive, download_url from .vision import VisionDataset class SBU(VisionDataset): """`SBU Captioned Photo <http://www.cs.virgini...
import os from pathlib import Path from typing import Any, Callable, Optional, Tuple, Union from PIL import Image from .utils import check_integrity, download_and_extract_archive, download_url from .vision import VisionDataset class SBU(VisionDataset): """`SBU Captioned Photo <http://www.cs.virginia.edu/~vicent...
_base_ = ['faster-rcnn_r50_fpn_32xb2-1x_openimages.py'] model = dict( roi_head=dict(bbox_head=dict(num_classes=500)), test_cfg=dict(rcnn=dict(score_thr=0.01))) # dataset settings dataset_type = 'OpenImagesChallengeDataset' train_dataloader = dict( dataset=dict( type=dataset_type, ann_file=...
_base_ = ['faster-rcnn_r50_fpn_32xb2-1x_openimages.py'] model = dict( roi_head=dict(bbox_head=dict(num_classes=500)), test_cfg=dict(rcnn=dict(score_thr=0.01))) # dataset settings dataset_type = 'OpenImagesChallengeDataset' train_dataloader = dict( dataset=dict( type=dataset_type, ann_file=...
from datasets import load_dataset from sentence_transformers import ( SentenceTransformer, SentenceTransformerTrainer, SentenceTransformerTrainingArguments, losses, ) from sentence_transformers.evaluation import EmbeddingSimilarityEvaluator, SimilarityFunction from sentence_transformers.training_args im...
from sentence_transformers import losses from sentence_transformers import SentenceTransformer, SentenceTransformerTrainer, SentenceTransformerTrainingArguments from sentence_transformers.evaluation import EmbeddingSimilarityEvaluator, SimilarityFunction from sentence_transformers.training_args import BatchSamplers fro...
# Copyright (c) OpenMMLab. All rights reserved. # flake8: noqa from .fileio import * from .registry import * from .utils import *
# Copyright (c) OpenMMLab. All rights reserved. # flake8: noqa from .fileio import * from .utils import *
_base_ = [ '../_base_/models/ssd300.py', '../_base_/datasets/voc0712.py', '../_base_/default_runtime.py' ] model = dict( bbox_head=dict( num_classes=20, anchor_generator=dict(basesize_ratio_range=(0.2, 0.9)))) # dataset settings dat...
_base_ = [ '../_base_/models/ssd300.py', '../_base_/datasets/voc0712.py', '../_base_/default_runtime.py' ] model = dict( bbox_head=dict( num_classes=20, anchor_generator=dict(basesize_ratio_range=(0.2, 0.9)))) # dataset settings dat...
from ...utils import is_torch_available if is_torch_available(): from .auraflow_transformer_2d import AuraFlowTransformer2DModel from .cogvideox_transformer_3d import CogVideoXTransformer3DModel from .consisid_transformer_3d import ConsisIDTransformer3DModel from .dit_transformer_2d import DiTTransfor...
from ...utils import is_torch_available if is_torch_available(): from .auraflow_transformer_2d import AuraFlowTransformer2DModel from .cogvideox_transformer_3d import CogVideoXTransformer3DModel from .consisid_transformer_3d import ConsisIDTransformer3DModel from .dit_transformer_2d import DiTTransfor...
from __future__ import annotations from sentence_transformers.sparse_encoder.data_collator import SparseEncoderDataCollator from sentence_transformers.sparse_encoder.evaluation import ( SparseBinaryClassificationEvaluator, SparseEmbeddingSimilarityEvaluator, SparseInformationRetrievalEvaluator, SparseM...
from __future__ import annotations from sentence_transformers.sparse_encoder.data_collator import SparseEncoderDataCollator from sentence_transformers.sparse_encoder.evaluation import ( SparseBinaryClassificationEvaluator, SparseEmbeddingSimilarityEvaluator, SparseInformationRetrievalEvaluator, SparseM...
import csv import os from pathlib import Path from typing import Tuple, Union from torch import Tensor from torch.utils.data import Dataset from torchaudio.datasets.utils import _load_waveform SAMPLE_RATE = 16000 class FluentSpeechCommands(Dataset): """Create *Fluent Speech Commands* :cite:`fluent` Dataset ...
import csv import os from pathlib import Path from typing import Union import torchaudio from torch.utils.data import Dataset class FluentSpeechCommands(Dataset): """Create *Fluent Speech Commands* :cite:`fluent` Dataset Args: root (str of Path): Path to the directory where the dataset is found. ...
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import torch from mmdet.models.dense_heads import ATSSHead def test_atss_head_loss(): """Tests atss head loss when truth is empty and non-empty.""" s = 256 img_metas = [{ 'img_shape': (s, s, 3), 'scale_factor': 1, 'pad_sh...
import mmcv import torch from mmdet.models.dense_heads import ATSSHead def test_atss_head_loss(): """Tests atss head loss when truth is empty and non-empty.""" s = 256 img_metas = [{ 'img_shape': (s, s, 3), 'scale_factor': 1, 'pad_shape': (s, s, 3) }] train_cfg = mmcv.Conf...
from abc import ABC from collections import namedtuple from dataclasses import is_dataclass, asdict from typing import Dict, Optional, TYPE_CHECKING if TYPE_CHECKING: from docarray.typing import DocumentArraySourceType, ArrayType TypeMap = namedtuple('TypeMap', ['type', 'converter']) class BaseBackendMixin(ABC)...
from abc import ABC from collections import namedtuple from dataclasses import is_dataclass, asdict from typing import Dict, Optional, TYPE_CHECKING if TYPE_CHECKING: from ....typing import DocumentArraySourceType, ArrayType TypeMap = namedtuple('TypeMap', ['type', 'converter']) class BaseBackendMixin(ABC): ...
from typing import Any from io import StringIO def md_to_df(md_str: str) -> Any: """Convert Markdown to dataframe.""" try: import pandas as pd except ImportError: raise ImportError( "You must install the `pandas` package to use this node parser." ) # Replace " by ...
from typing import Any from io import StringIO def md_to_df(md_str: str) -> Any: """Convert Markdown to dataframe.""" try: import pandas as pd except ImportError: raise ImportError( "You must install the `pandas` package to use this node parser." ) # Replace " by ...
# Copyright (c) OpenMMLab. All rights reserved. from .anchor_free_head import AnchorFreeHead from .anchor_head import AnchorHead from .atss_head import ATSSHead from .autoassign_head import AutoAssignHead from .cascade_rpn_head import CascadeRPNHead, StageCascadeRPNHead from .centernet_head import CenterNetHead from .c...
# Copyright (c) OpenMMLab. All rights reserved. from .anchor_free_head import AnchorFreeHead from .anchor_head import AnchorHead from .atss_head import ATSSHead from .autoassign_head import AutoAssignHead from .cascade_rpn_head import CascadeRPNHead, StageCascadeRPNHead from .centernet_head import CenterNetHead from .c...
import functools from typing import TYPE_CHECKING if TYPE_CHECKING: from ..providers import ProviderName from ._base import BaseWebhooksManager # --8<-- [start:load_webhook_managers] @functools.cache def load_webhook_managers() -> dict["ProviderName", type["BaseWebhooksManager"]]: webhook_managers = {} ...
from typing import TYPE_CHECKING if TYPE_CHECKING: from ..providers import ProviderName from ._base import BaseWebhooksManager _WEBHOOK_MANAGERS: dict["ProviderName", type["BaseWebhooksManager"]] = {} # --8<-- [start:load_webhook_managers] def load_webhook_managers() -> dict["ProviderName", type["BaseWebhoo...
# Copyright (c) OpenMMLab. All rights reserved. from mmengine.registry import HOOKS from .hook import Hook @HOOKS.register_module() class DistSamplerSeedHook(Hook): """Data-loading sampler for distributed training. When distributed training, it is only useful in conjunction with :obj:`EpochBasedRunner`, ...
# Copyright (c) OpenMMLab. All rights reserved. from mmengine.registry import HOOKS from .hook import Hook @HOOKS.register_module() class DistSamplerSeedHook(Hook): """Data-loading sampler for distributed training. When distributed training, it is only useful in conjunction with :obj:`EpochBasedRunner`, ...
# Copyright (c) OpenMMLab. All rights reserved. import argparse import mmengine def parse_args(): parser = argparse.ArgumentParser(description='Override Category') parser.add_argument('data_root') return parser.parse_args() def main(): args = parse_args() ChessPieces = [{ 'id': 1, ...
# Copyright (c) OpenMMLab. All rights reserved. import argparse import mmengine def parse_args(): parser = argparse.ArgumentParser(description='Override Category') parser.add_argument('data_root') return parser.parse_args() def main(): args = parse_args() ChessPieces = [{ 'id': 1, ...
# Copyright (c) OpenMMLab. All rights reserved. import warnings from abc import ABCMeta, abstractmethod from typing import Any, List, Optional, Sequence, Tuple, Union from mmengine.data import BaseDataElement from mmengine.dist import (broadcast_object_list, collect_results, is_main_process)...
# Copyright (c) OpenMMLab. All rights reserved. import warnings from abc import ABCMeta, abstractmethod from typing import Any, List, Optional, Sequence, Tuple, Union from mmengine.data import BaseDataSample from mmengine.dist import (broadcast_object_list, collect_results, is_main_process) ...
import warnings from typing import TYPE_CHECKING, Any, Tuple, Type, TypeVar, Union import numpy as np from docarray.typing.bytes.audio_bytes import AudioBytes from docarray.typing.proto_register import _register_proto from docarray.typing.url.any_url import AnyUrl from docarray.typing.url.filetypes import AUDIO_FILE_...
import warnings from typing import TYPE_CHECKING, Any, Tuple, Type, TypeVar, Union import numpy as np from docarray.typing.bytes.audio_bytes import AudioBytes from docarray.typing.proto_register import _register_proto from docarray.typing.url.any_url import AnyUrl from docarray.typing.url.filetypes import AUDIO_FILE_...
_base_ = [ '../_base_/models/retinanet_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # TODO: delete custom_imports after mmcls supports auto import # please install mmcls>=1.0 # import mmcls.models to trigger register_module in m...
_base_ = [ '../_base_/models/retinanet_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # please install mmcls>=0.20.0 # import mmcls.models to trigger register_module in mmcls custom_imports = dict(imports=['mmcls.models'], allow_f...
# Licensed to the LF AI & Data foundation under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the "License"); # you may not use this fil...
from docarray.base_doc.any_doc import AnyDoc from docarray.base_doc.base_node import BaseNode from docarray.base_doc.doc import BaseDoc from docarray.utils._internal.misc import ( _get_path_from_docarray_root_level, import_library, ) __all__ = ['AnyDoc', 'BaseDoc', 'BaseNode'] def __getattr__(name: str): ...
def get_doc_value(): return 'MyExecutorBeforeReload'
def get_doc_value(): return 'MyExecutorBeforeReload'
import os import sys from pathlib import Path import pytest from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node from .utils import execute_subprocess_async, get_torch_dist_unique_port, require_torch def test_split_dataset_by_node_map_style(): full_ds = Dataset.f...
import os import sys from pathlib import Path import pytest from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node from .utils import execute_subprocess_async, get_torch_dist_unique_port, require_torch def test_split_dataset_by_node_map_style(): full_ds = Dataset.f...
import os import time import uuid from contextlib import contextmanager from typing import Optional import pytest import requests from huggingface_hub.hf_api import HfApi, RepositoryNotFoundError CI_HUB_USER = "__DUMMY_TRANSFORMERS_USER__" CI_HUB_USER_FULL_NAME = "Dummy User" CI_HUB_USER_TOKEN = "hf_hZEmnoOEYISjraJt...
import os import time import uuid from contextlib import contextmanager from typing import Optional import pytest import requests from huggingface_hub.hf_api import HfApi, RepositoryNotFoundError CI_HUB_USER = "__DUMMY_TRANSFORMERS_USER__" CI_HUB_USER_FULL_NAME = "Dummy User" CI_HUB_USER_TOKEN = "hf_hZEmnoOEYISjraJt...
# Copyright (c) OpenMMLab. All rights reserved. from mmcv.cnn import ConvModule, Linear from mmcv.runner import ModuleList, auto_fp16 from mmdet.registry import MODELS from .fcn_mask_head import FCNMaskHead @MODELS.register_module() class CoarseMaskHead(FCNMaskHead): """Coarse mask head used in PointRend. C...
# Copyright (c) OpenMMLab. All rights reserved. from mmcv.cnn import ConvModule, Linear from mmcv.runner import ModuleList, auto_fp16 from mmdet.models.builder import HEADS from .fcn_mask_head import FCNMaskHead @HEADS.register_module() class CoarseMaskHead(FCNMaskHead): """Coarse mask head used in PointRend. ...
_base_ = [ '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] teacher_ckpt = 'https://download.openmmlab.com/mmdetection/v2.0/paa/paa_r50_fpn_1x_coco/paa_r50_fpn_1x_coco_20200821-936edec3.pth' # noqa preprocess_cfg = dict( mean=[123.675, 116.28, ...
_base_ = [ '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] teacher_ckpt = 'https://download.openmmlab.com/mmdetection/v2.0/paa/paa_r50_fpn_1x_coco/paa_r50_fpn_1x_coco_20200821-936edec3.pth' # noqa model = dict( type='LAD', # student bac...
""" Develop installable templates. """ import re import shutil import subprocess from pathlib import Path from typing import Annotated, Optional import typer from langchain_cli.utils.packages import get_langserve_export, get_package_root package_cli = typer.Typer(no_args_is_help=True, add_completion=False) @packa...
""" Develop installable templates. """ import re import shutil import subprocess from pathlib import Path from typing import Optional import typer from typing_extensions import Annotated from langchain_cli.utils.packages import get_langserve_export, get_package_root package_cli = typer.Typer(no_args_is_help=True, a...
# Copyright (c) OpenMMLab. All rights reserved. from .base_video_metric import BaseVideoMetric from .cityscapes_metric import CityScapesMetric from .coco_caption_metric import COCOCaptionMetric from .coco_metric import CocoMetric from .coco_occluded_metric import CocoOccludedSeparatedMetric from .coco_panoptic_metric i...
# Copyright (c) OpenMMLab. All rights reserved. from .base_video_metric import BaseVideoMetric from .cityscapes_metric import CityScapesMetric from .coco_caption_metric import COCOCaptionMetric from .coco_metric import CocoMetric from .coco_occluded_metric import CocoOccludedSeparatedMetric from .coco_panoptic_metric i...
from typing import TYPE_CHECKING, Any, Optional, Type, TypeVar, Union import numpy as np from docarray.base_doc import BaseDoc from docarray.documents import AudioDoc from docarray.typing import AnyEmbedding, AnyTensor from docarray.typing.tensor.abstract_tensor import AbstractTensor from docarray.typing.tensor.video...
from typing import Any, Optional, Type, TypeVar, Union import numpy as np from docarray.base_doc import BaseDoc from docarray.documents import AudioDoc from docarray.typing import AnyEmbedding, AnyTensor from docarray.typing.tensor.abstract_tensor import AbstractTensor from docarray.typing.tensor.video.video_tensor i...
from __future__ import annotations from typing import Any, Optional, Union import PIL.Image import torch from ._tv_tensor import TVTensor class Image(TVTensor): """:class:`torch.Tensor` subclass for images. .. note:: In the :ref:`transforms <transforms>`, ``Image`` instances are largely i...
from __future__ import annotations from typing import Any, Optional, Union import PIL.Image import torch from ._tv_tensor import TVTensor class Image(TVTensor): """[BETA] :class:`torch.Tensor` subclass for images. .. note:: In the :ref:`transforms <transforms>`, ``Image`` instances are largely ...
import importlib from types import ModuleType import pytest from ...utils import needs_py39, needs_py310 @pytest.fixture( name="test_module", params=[ "app_b.test_main", pytest.param("app_b_py310.test_main", marks=needs_py310), "app_b_an.test_main", pytest.param("app_b_an_py3...
from docs_src.app_testing.app_b import test_main def test_app(): test_main.test_create_existing_item() test_main.test_create_item() test_main.test_create_item_bad_token() test_main.test_read_nonexistent_item() test_main.test_read_item() test_main.test_read_item_bad_token()
# Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
# Copyright 2020 The HuggingFace Datasets Authors and the TensorFlow Datasets Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
import os # type: ignore[import-not-found] from exa_py import Exa from langchain_core.utils import convert_to_secret_str def initialize_client(values: dict) -> dict: """Initialize the client.""" exa_api_key = values.get("exa_api_key") or os.environ.get("EXA_API_KEY") or "" values["exa_api_key"] = conver...
import os # type: ignore[import-not-found] from exa_py import Exa # type: ignore from langchain_core.utils import convert_to_secret_str def initialize_client(values: dict) -> dict: """Initialize the client.""" exa_api_key = values.get("exa_api_key") or os.environ.get("EXA_API_KEY") or "" values["exa_ap...
# Copyright (c) OpenMMLab. All rights reserved. # Copyright (c) 2019 Western Digital Corporation or its affiliates. from mmdet.registry import MODELS from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig from .single_stage import SingleStageDetector @MODELS.register_module() class YOLOV3(SingleStageDetec...
# Copyright (c) OpenMMLab. All rights reserved. # Copyright (c) 2019 Western Digital Corporation or its affiliates. from mmdet.core.utils.typing import ConfigType, OptConfigType, OptMultiConfig from mmdet.registry import MODELS from .single_stage import SingleStageDetector @MODELS.register_module() class YOLOV3(Sing...
import os import torch import torchaudio.prototype.transforms as T import torchaudio.transforms as transforms from torchaudio_unittest.common_utils import nested_params, TorchaudioTestCase class BatchConsistencyTest(TorchaudioTestCase): def assert_batch_consistency(self, transform, batch, *args, atol=1e-8, rtol=...
import torch import torchaudio.prototype.transforms as T from torchaudio_unittest.common_utils import nested_params, TorchaudioTestCase class BatchConsistencyTest(TorchaudioTestCase): @nested_params( [T.Convolve, T.FFTConvolve], ["full", "valid", "same"], ) def test_Convolve(self, cls, mod...
# Copyright 2020 The HuggingFace Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
# Copyright 2020 The HuggingFace Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to...
# Copyright 2024 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 agreed to in writ...
# Copyright 2024 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 agreed to in writ...
# -*- coding: utf-8 -*- """ Audio Datasets ============== **Author**: `Moto Hira <moto@meta.com>`__ ``torchaudio`` provides easy access to common, publicly accessible datasets. Please refer to the official documentation for the list of available datasets. """ # When running this tutorial in Google Colab, install the...
# -*- coding: utf-8 -*- """ Audio Datasets ============== ``torchaudio`` provides easy access to common, publicly accessible datasets. Please refer to the official documentation for the list of available datasets. """ # When running this tutorial in Google Colab, install the required packages # with the following. # ...
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
# Copyright 2024 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
# coding=utf-8 # Copyright 2023 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable...
"""Query Understanding agent pack.""" from typing import Any, Dict, List, Optional from llama_index.core.agent import AgentRunner from llama_index.core.callbacks import CallbackManager from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.core.llms.llm import LLM from llama_index.core.tools.type...
"""Query Understanding agent pack.""" from typing import Any, Dict, List, Optional from llama_index.core.agent import AgentRunner from llama_index.core.callbacks import CallbackManager from llama_index.core.llama_pack.base import BaseLlamaPack from llama_index.core.llms.llm import LLM from llama_index.core.tools.type...
"""Helpers for interfacing array like objects.""" import copy import ctypes import json from typing import Literal, Optional, Protocol, Tuple, Type, TypedDict, Union, cast import numpy as np from ._typing import CNumericPtr, DataType, NumpyOrCupy from .compat import import_cupy class _ArrayLikeArg(Protocol): @...
"""Helpers for interfacing array like objects.""" import copy import ctypes import json from typing import Literal, Optional, Protocol, Tuple, Type, TypedDict, Union, cast import numpy as np from ._typing import CNumericPtr, DataType, NumpyOrCupy from .compat import import_cupy class _ArrayLikeArg(Protocol): @...
# flake8: noqa import numpy as np from keras.src import backend from keras.src import ops from keras.src import testing from keras.src.optimizers.nadam import Nadam class NadamTest(testing.TestCase): def test_config(self): optimizer = Nadam( learning_rate=0.5, beta_1=0.5, ...
# flake8: noqa import numpy as np from keras.src import backend from keras.src import ops from keras.src import testing from keras.src.optimizers.nadam import Nadam class NadamTest(testing.TestCase): def test_config(self): optimizer = Nadam( learning_rate=0.5, beta_1=0.5, ...
"""Documents module. **Document** module is a collection of classes that handle documents and their transformations. """ from importlib import import_module from typing import TYPE_CHECKING if TYPE_CHECKING: from .base import Document from .compressor import BaseDocumentCompressor from .transformers imp...
"""Documents module. **Document** module is a collection of classes that handle documents and their transformations. """ from langchain_core.documents.base import Document from langchain_core.documents.compressor import BaseDocumentCompressor from langchain_core.documents.transformers import BaseDocumentTransformer ...
import sys from absl import logging from keras.src.api_export import keras_export from keras.src.backend.common import global_state @keras_export( [ "keras.config.enable_interactive_logging", "keras.utils.enable_interactive_logging", ] ) def enable_interactive_logging(): """Turn on inter...
import sys from absl import logging from keras.src.api_export import keras_export from keras.src.backend.common import global_state @keras_export( [ "keras.config.enable_interactive_logging", "keras.utils.enable_interactive_logging", ] ) def enable_interactive_logging(): """Turn on inter...
"""Language models. **Language Model** is a type of model that can generate text or complete text prompts. LangChain has two main classes to work with language models: **Chat Models** and "old-fashioned" **LLMs**. **Chat Models** Language models that use a sequence of messages as inputs and return chat messages as ...
"""Language models. **Language Model** is a type of model that can generate text or complete text prompts. LangChain has two main classes to work with language models: **Chat Models** and "old-fashioned" **LLMs**. **Chat Models** Language models that use a sequence of messages as inputs and return chat messages as ...
_base_ = [ '../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] model = dict( data_preprocessor=dict( # The mean and std are used in PyCls when training RegNets mean=[103.53, 116.28, 123....
_base_ = [ '../_base_/models/faster_rcnn_r50_fpn.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] model = dict( backbone=dict( _delete_=True, type='RegNet', arch='regnetx_3.2gf', out_indices=(0, 1, 2, 3), ...