input
stringlengths
33
5k
output
stringlengths
32
5k
from dataclasses import dataclass, asdict, field from typing import ( Union, Dict, Optional, TYPE_CHECKING, Iterable, ) import numpy as np from ..base.backend import BaseBackendMixin from ....helper import dataclass_from_dict, filter_dict if TYPE_CHECKING: from ....typing import DocumentArray...
from dataclasses import dataclass, asdict, field from typing import ( Union, Dict, Optional, TYPE_CHECKING, Iterable, ) import numpy as np from ..base.backend import BaseBackendMixin from ....helper import dataclass_from_dict if TYPE_CHECKING: from ....typing import DocumentArraySourceType, A...
"""Standard LangChain interface tests.""" from langchain_core.embeddings import Embeddings from langchain_tests.unit_tests.embeddings import EmbeddingsUnitTests from langchain_fireworks import FireworksEmbeddings class TestFireworksStandard(EmbeddingsUnitTests): @property def embeddings_class(self) -> type[...
"""Standard LangChain interface tests""" from langchain_core.embeddings import Embeddings from langchain_tests.unit_tests.embeddings import EmbeddingsUnitTests from langchain_fireworks import FireworksEmbeddings class TestFireworksStandard(EmbeddingsUnitTests): @property def embeddings_class(self) -> type[E...
import sys import pytest from hypothesis import given, settings, strategies from xgboost.testing import no_cupy from xgboost.testing.updater import check_quantile_loss_extmem sys.path.append("tests/python") from test_data_iterator import run_data_iterator from test_data_iterator import test_single_batch as cpu_singl...
import sys import pytest from hypothesis import given, settings, strategies from xgboost.testing import no_cupy from xgboost.testing.updater import check_quantile_loss_extmem sys.path.append("tests/python") from test_data_iterator import run_data_iterator from test_data_iterator import test_single_batch as cpu_singl...
import gzip import logging import os from datetime import datetime from torch.utils.data import DataLoader from sentence_transformers import InputExample, LoggingHandler, SentenceTransformer, evaluation, losses, models, util #### Just some code to print debug information to stdout logging.basicConfig( format="%(...
import gzip import logging import os from datetime import datetime from torch.utils.data import DataLoader from sentence_transformers import InputExample, LoggingHandler, SentenceTransformer, evaluation, losses, models, util #### Just some code to print debug information to stdout logging.basicConfig( format="%(...
from typing import Optional from llama_index.core.storage.docstore.keyval_docstore import KVDocumentStore from llama_index.core.storage.docstore.types import DEFAULT_BATCH_SIZE from llama_index.storage.kvstore.gel import GelKVStore class GelDocumentStore(KVDocumentStore): """ Gel Document (Node) store. ...
from typing import Optional from llama_index.core.storage.docstore.keyval_docstore import KVDocumentStore from llama_index.core.storage.docstore.types import DEFAULT_BATCH_SIZE from llama_index.storage.kvstore.gel import GelKVStore class GelDocumentStore(KVDocumentStore): """Gel Document (Node) store. A Gel...
import abc from abc import ABC from typing import TYPE_CHECKING, Any, Generic, List, Tuple, Type, TypeVar, Union from docarray.computation import AbstractComputationalBackend from docarray.typing.abstract_type import AbstractType if TYPE_CHECKING: from pydantic import BaseConfig from pydantic.fields import Mo...
import abc from abc import ABC from typing import TYPE_CHECKING, Any, Generic, List, Tuple, Type, TypeVar, Union from docarray.typing.abstract_type import AbstractType if TYPE_CHECKING: from pydantic import BaseConfig from pydantic.fields import ModelField T = TypeVar('T', bound='AbstractTensor') ShapeT = Ty...
from llama_index_instrumentation import ( DispatcherSpanMixin, # noqa get_dispatcher, # noqa root_dispatcher, # noqa root_manager, # noqa ) from llama_index_instrumentation.dispatcher import ( DISPATCHER_SPAN_DECORATED_ATTR, # noqa Dispatcher, # noqa Manager, # noqa ) from llama_index...
import inspect from abc import ABC from typing import Any, List from llama_index.core.instrumentation.dispatcher import ( Dispatcher, Manager, DISPATCHER_SPAN_DECORATED_ATTR, ) from llama_index.core.instrumentation.event_handlers import NullEventHandler from llama_index.core.instrumentation.span_handlers i...
# Copyright (c) OpenMMLab. All rights reserved. from unittest import TestCase import pytest import torch from mmengine import Config from mmengine.data import InstanceData from mmdet import * # noqa from mmdet.models.dense_heads import RPNHead class TestRPNHead(TestCase): def test_init(self): """Test ...
# Copyright (c) OpenMMLab. All rights reserved. from unittest import TestCase import torch from mmengine import Config from mmengine.data import InstanceData from mmdet import * # noqa from mmdet.models.dense_heads import RPNHead class TestRPNHead(TestCase): def test_rpn_head_loss(self): """Tests rpn ...
# Copyright (c) OpenMMLab. All rights reserved. from .base_global_accsessible import BaseGlobalAccessible, MetaGlobalAccessible from .log_buffer import LogBuffer from .logger import MMLogger, print_log from .message_hub import MessageHub __all__ = [ 'LogBuffer', 'MessageHub', 'MetaGlobalAccessible', 'BaseGlobalAcc...
# Copyright (c) OpenMMLab. All rights reserved. from .base_global_accsessible import BaseGlobalAccessible, MetaGlobalAccessible __all__ = ['MetaGlobalAccessible', 'BaseGlobalAccessible']
_base_ = './fcos_r50-caffe_fpn_gn-head_1x_coco.py' # model settings model = dict( data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], bgr_to_rgb=True, pad_size_divisor=32), backbone=dict( type='ResNeXt'...
_base_ = './fcos_r50-caffe_fpn_gn-head_1x_coco.py' # model settings model = dict( data_preprocessor=dict( type='DetDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], bgr_to_rgb=True, pad_size_divisor=32), backbone=dict( type='ResNeXt'...
import os from pathlib import Path import numpy as np import pytest from PIL.Image import Image, fromarray from jina import DocumentArray, Document, Executor from ...normalizer import ImageNormalizer @pytest.fixture def numpy_image_uri(tmpdir): blob = np.random.randint(255, size=(96, 96, 3), dtype='uint8') ...
import os import numpy as np import pytest from PIL.Image import Image, fromarray from jina import DocumentArray, Document from ...normalizer import ImageNormalizer cur_dir = os.path.dirname(os.path.abspath(__file__)) @pytest.fixture def numpy_image_uri(tmpdir): blob = np.random.randint(255, size=(96, 96, 3), d...
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import numpy as np import torch from mmdet.models.dense_heads import PAAHead, paa_head from mmdet.models.dense_heads.paa_head import levels_to_images def test_paa_head_loss(): """Tests paa head loss when truth is empty and non-empty.""" class mock_...
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import numpy as np import torch from mmdet.models.dense_heads import PAAHead, paa_head from mmdet.models.dense_heads.paa_head import levels_to_images def test_paa_head_loss(): """Tests paa head loss when truth is empty and non-empty.""" class mock_...
"""Simple Reader that loads highlights from Readwise.io.""" import datetime import json from typing import List, Optional import requests from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document def _get_readwise_data(api_key: str, updated_after: Optional[datetime.datetime] ...
"""Simple Reader that loads highlights from Readwise.io.""" import datetime import json from typing import List, Optional import requests from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document def _get_readwise_data(api_key: str, updated_after: Optional[datetime.datetime] ...
from setuptools import find_packages, setup with open("README.md", mode="r", encoding="utf-8") as readme_file: readme = readme_file.read() setup( name="sentence-transformers", version="3.1.0.dev0", author="Nils Reimers, Tom Aarsen", author_email="info@nils-reimers.de", description="Multilingu...
from setuptools import find_packages, setup with open("README.md", mode="r", encoding="utf-8") as readme_file: readme = readme_file.read() setup( name="sentence-transformers", version="3.1.0.dev0", author="Nils Reimers, Tom Aarsen", author_email="info@nils-reimers.de", description="Multilingu...
from typing import TYPE_CHECKING, Any from langchain._api import create_importer if TYPE_CHECKING: from langchain_community.tools import ( BaseSparkSQLTool, InfoSparkSQLTool, ListSparkSQLTool, QueryCheckerTool, QuerySparkSQLTool, ) # Create a way to dynamically look up...
from typing import TYPE_CHECKING, Any from langchain._api import create_importer if TYPE_CHECKING: from langchain_community.tools import ( BaseSparkSQLTool, InfoSparkSQLTool, ListSparkSQLTool, QueryCheckerTool, QuerySparkSQLTool, ) # Create a way to dynamically look up...
import numpy as np from absl.testing import parameterized from keras.src import dtype_policies from keras.src import layers from keras.src import testing class ZeroPadding1DTest(testing.TestCase, parameterized.TestCase): def test_zero_padding_1d(self): inputs = np.random.rand(1, 2, 3) outputs = l...
import numpy as np from absl.testing import parameterized from keras.src import layers from keras.src import testing class ZeroPadding1DTest(testing.TestCase, parameterized.TestCase): def test_zero_padding_1d(self): inputs = np.random.rand(1, 2, 3) outputs = layers.ZeroPadding1D(padding=(1, 2))(i...
import gc import unittest import torch from diffusers import ( StableDiffusionInpaintPipeline, ) from diffusers.utils import load_image from diffusers.utils.testing_utils import ( backend_empty_cache, enable_full_determinism, require_torch_accelerator, slow, torch_device, ) from .single_file_...
import gc import unittest import torch from diffusers import ( StableDiffusionInpaintPipeline, ) from diffusers.utils import load_image from diffusers.utils.testing_utils import ( enable_full_determinism, require_torch_gpu, slow, ) from .single_file_testing_utils import SDSingleFileTesterMixin enab...
# Copyright (c) OpenMMLab. All rights reserved. """Tests for async interface.""" import asyncio import os import sys import asynctest import mmcv import torch from mmdet.apis import async_inference_detector, init_detector if sys.version_info >= (3, 7): from mmdet.utils.contextmanagers import concurrent class ...
"""Tests for async interface.""" import asyncio import os import sys import asynctest import mmcv import torch from mmdet.apis import async_inference_detector, init_detector if sys.version_info >= (3, 7): from mmdet.utils.contextmanagers import concurrent class AsyncTestCase(asynctest.TestCase): use_defau...
""" This script contains an example how to perform semantic search with PyTorch. It performs exact nearest neighborh search. As dataset, we use the Quora Duplicate Questions dataset, which contains about 500k questions (we only use about 100k): https://www.quora.com/q/quoradata/First-Quora-Dataset-Release-Question-Pai...
""" This script contains an example how to perform semantic search with PyTorch. It performs exact nearest neighborh search. As dataset, we use the Quora Duplicate Questions dataset, which contains about 500k questions (we only use about 100k): https://www.quora.com/q/quoradata/First-Quora-Dataset-Release-Question-Pai...
from typing import Dict from sentence_transformers import SentenceTransformer from . import SentenceEvaluator import torch from torch.utils.data import DataLoader import logging from ..util import batch_to_device import os import csv logger = logging.getLogger(__name__) class LabelAccuracyEvaluator(SentenceEvaluato...
from sentence_transformers import SentenceTransformer from . import SentenceEvaluator import torch from torch.utils.data import DataLoader import logging from ..util import batch_to_device import os import csv logger = logging.getLogger(__name__) class LabelAccuracyEvaluator(SentenceEvaluator): """ Evaluate...
_base_ = '../cascade_rcnn/cascade-mask-rcnn_r101_fpn_1x_coco.py' model = dict( backbone=dict( dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False), stage_with_dcn=(False, True, True, True)))
_base_ = '../cascade_rcnn/cascade_mask_rcnn_r101_fpn_1x_coco.py' model = dict( backbone=dict( dcn=dict(type='DCN', deform_groups=1, fallback_on_stride=False), stage_with_dcn=(False, True, True, True)))
from datetime import datetime from typing import Any, List from backend.blocks.exa._auth import ( ExaCredentials, ExaCredentialsField, ExaCredentialsInput, ) from backend.data.block import Block, BlockCategory, BlockOutput, BlockSchema from backend.data.model import SchemaField from backend.util.request im...
from datetime import datetime from typing import Any, List from backend.blocks.exa._auth import ( ExaCredentials, ExaCredentialsField, ExaCredentialsInput, ) from backend.data.block import Block, BlockCategory, BlockOutput, BlockSchema from backend.data.model import SchemaField from backend.util.request im...
from llama_index.tools.mcp.base import McpToolSpec from llama_index.tools.mcp.client import BasicMCPClient from llama_index.tools.mcp.utils import ( workflow_as_mcp, get_tools_from_mcp_url, aget_tools_from_mcp_url, ) __all__ = [ "McpToolSpec", "BasicMCPClient", "workflow_as_mcp", "get_tools...
from llama_index.tools.mcp.base import McpToolSpec from llama_index.tools.mcp.client import BasicMCPClient from llama_index.tools.mcp.utils import workflow_as_mcp, get_tools_from_mcp_url, aget_tools_from_mcp_url __all__ = [ "McpToolSpec", "BasicMCPClient", "workflow_as_mcp", "get_tools_from_mcp_url", ...
# Copyright (c) OpenMMLab. All rights reserved. import os from typing import Optional import torch try: import torch_npu # noqa: F401 import torch_npu.npu.utils as npu_utils # Enable operator support for dynamic shape and # binary operator support on the NPU. npu_jit_compile = bool(os.getenv('NP...
# Copyright (c) OpenMMLab. All rights reserved. import os from typing import Optional import torch try: import torch_npu # noqa: F401 # Enable operator support for dynamic shape and # binary operator support on the NPU. npu_jit_compile = bool(os.getenv('NPUJITCompile', False)) torch.npu.set_comp...
import numpy as np import pytest from keras.src import backend from keras.src import ops from keras.src import testing from keras.src.random import seed_generator class SeedGeneratorTest(testing.TestCase): def test_seed_generator_initialization(self): gen = seed_generator.SeedGenerator() self.ass...
import numpy as np import pytest from keras.src import backend from keras.src import ops from keras.src import testing from keras.src.random import seed_generator class SeedGeneratorTest(testing.TestCase): def test_seed_generator_initialization(self): gen = seed_generator.SeedGenerator() self.ass...
from collections import defaultdict import torch import transforms as reference_transforms def get_modules(use_v2): # We need a protected import to avoid the V2 warning in case just V1 is used if use_v2: import torchvision.datapoints import torchvision.transforms.v2 return torchvisio...
from collections import defaultdict import torch import transforms as reference_transforms def get_modules(use_v2): # We need a protected import to avoid the V2 warning in case just V1 is used if use_v2: import torchvision.datapoints import torchvision.transforms.v2 return torchvisio...
import os from typing import Optional import fsspec from llama_index.core.storage.index_store.keyval_index_store import KVIndexStore from llama_index.core.storage.index_store.types import ( DEFAULT_PERSIST_DIR, DEFAULT_PERSIST_FNAME, DEFAULT_PERSIST_PATH, ) from llama_index.core.storage.kvstore.simple_kvst...
import os from typing import Optional import fsspec from llama_index.core.storage.index_store.keyval_index_store import KVIndexStore from llama_index.core.storage.index_store.types import ( DEFAULT_PERSIST_DIR, DEFAULT_PERSIST_FNAME, DEFAULT_PERSIST_PATH, ) from llama_index.core.storage.kvstore.simple_kvst...
import logging from autogpt_libs.utils.cache import thread_cached from backend.data.block import ( Block, BlockCategory, BlockInput, BlockOutput, BlockSchema, BlockType, get_block, ) from backend.data.execution import ExecutionStatus from backend.data.model import SchemaField logger = log...
import logging from autogpt_libs.utils.cache import thread_cached from backend.data.block import ( Block, BlockCategory, BlockInput, BlockOutput, BlockSchema, BlockType, get_block, ) from backend.data.execution import ExecutionStatus from backend.data.model import SchemaField logger = log...
from typing import Dict, Optional, Sequence import torch from jina import DocumentArray, Executor, requests from jina_commons.batching import get_docs_batch_generator from transformers import CLIPModel, CLIPTokenizer class CLIPTextEncoder(Executor): """Encode text into embeddings using the CLIP model.""" de...
from typing import Dict, Optional, Sequence import torch from jina import DocumentArray, Executor, requests from jina_commons.batching import get_docs_batch_generator from transformers import CLIPModel, CLIPTokenizer class CLIPTextEncoder(Executor): """Encode text into embeddings using the CLIP model.""...
""" In this example we train a semantic search model to search through Wikipedia articles about programming articles & technologies. We use the text paragraphs from the following Wikipedia articles: Assembly language, C , C Sharp , C++, Go , Java , JavaScript, Keras, Laravel, MATLAB, Matplotlib, MongoDB, MySQL, Natura...
""" In this example we train a semantic search model to search through Wikipedia articles about programming articles & technologies. We use the text paragraphs from the following Wikipedia articles: Assembly language, C , C Sharp , C++, Go , Java , JavaScript, Keras, Laravel, MATLAB, Matplotlib, MongoDB, MySQL, Natura...
_base_ = [ '../_base_/models/mask_rcnn_r50_fpn.py', '../_base_/datasets/coco_panoptic.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] model = dict( type='PanopticFPN', semantic_head=dict( type='PanopticFPNHead', num_classes=54, in_channels=256, ...
_base_ = [ '../_base_/models/mask_rcnn_r50_fpn.py', '../_base_/datasets/coco_panoptic.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] model = dict( type='PanopticFPN', semantic_head=dict( type='PanopticFPNHead', num_classes=54, in_channels=256, ...
import io import warnings from abc import ABC from docarray.typing.tensor.abstract_tensor import AbstractTensor from docarray.utils._internal.misc import import_library, is_notebook class AbstractImageTensor(AbstractTensor, ABC): def to_bytes(self, format: str = 'PNG') -> bytes: """ Convert image...
import io import warnings from abc import ABC from typing import TYPE_CHECKING from docarray.typing.tensor.abstract_tensor import AbstractTensor from docarray.utils._internal.misc import import_library, is_notebook class AbstractImageTensor(AbstractTensor, ABC): def to_bytes(self, format: str = 'PNG') -> bytes: ...
import json import logging import os from typing import Dict, List import torch from torch import Tensor, nn from .tokenizer import WhitespaceTokenizer logger = logging.getLogger(__name__) class BoW(nn.Module): """Implements a Bag-of-Words (BoW) model to derive sentence embeddings. A weighting can be adde...
import torch from torch import Tensor from torch import nn from typing import Union, Tuple, List, Iterable, Dict import os import json import logging import numpy as np from .tokenizer import WhitespaceTokenizer logger = logging.getLogger(__name__) class BoW(nn.Module): """Implements a Bag-of-Words (BoW) model t...
from typing import TYPE_CHECKING, Any, Optional, Type, TypeVar, Union from docarray.typing.proto_register import _register_proto from docarray.typing.url.any_url import AnyUrl from docarray.typing.url.filetypes import TEXT_FILE_FORMATS if TYPE_CHECKING: from pydantic import BaseConfig from pydantic.fields imp...
from typing import TYPE_CHECKING, Any, Optional, Type, TypeVar, Union from docarray.typing.proto_register import _register_proto from docarray.typing.url.any_url import AnyUrl from docarray.typing.url.filetypes import TEXT_FILE_FORMATS if TYPE_CHECKING: from pydantic import BaseConfig from pydantic.fields imp...
# Copyright (c) OpenMMLab. All rights reserved. from .augment_wrappers import AutoAugment, RandAugment from .colorspace import (AutoContrast, Brightness, Color, ColorTransform, Contrast, Equalize, Invert, Posterize, Sharpness, Solarize, SolarizeAdd) from .formatting imp...
# Copyright (c) OpenMMLab. All rights reserved. from .augment_wrappers import AutoAugment, RandAugment from .colorspace import (AutoContrast, Brightness, Color, ColorTransform, Contrast, Equalize, Invert, Posterize, Sharpness, Solarize, SolarizeAdd) from .formatting imp...
import math import torch import torchaudio.prototype.functional as F from parameterized import parameterized from torch.autograd import gradcheck from torchaudio_unittest.common_utils import TestBaseMixin class AutogradTestImpl(TestBaseMixin): @parameterized.expand( [ (8000, (2, 3, 5, 7)), ...
import math import torch import torchaudio.prototype.functional as F from parameterized import parameterized from torch.autograd import gradcheck from torchaudio_unittest.common_utils import TestBaseMixin class AutogradTestImpl(TestBaseMixin): @parameterized.expand( [ (8000, (2, 3, 5, 7)), ...
_base_ = './faster_rcnn_regnetx-3.2GF_fpn_1x_coco.py' # learning policy max_epochs = 24 train_cfg = dict(max_epochs=max_epochs) param_scheduler = [ dict( type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500), dict( type='MultiStepLR', begin=0, end=max_epochs, ...
_base_ = './faster_rcnn_regnetx-3.2GF_fpn_1x_coco.py' lr_config = dict(step=[16, 22]) runner = dict(type='EpochBasedRunner', max_epochs=24)
from __future__ import annotations import functools import operator from typing import Any, TYPE_CHECKING import torch # NOTE: other files rely on the imports below from torch._dynamo import callback as compilation_callback # noqa: F401 from torch._inductor.runtime.cache_dir_utils import ( # noqa: F401 cache_d...
from __future__ import annotations import functools import operator from typing import Any, TYPE_CHECKING import torch # NOTE: other files rely on the imports below from torch._dynamo import callback as compilation_callback # noqa: F401 from torch._inductor.runtime.cache_dir_utils import ( # noqa: F401 cache_d...
_base_ = './fcos_r50_caffe_fpn_gn-head_1x_coco.py' # model settings model = dict(bbox_head=dict(center_sampling=True, center_sample_radius=1.5))
_base_ = './fcos_r50_caffe_fpn_gn-head_1x_coco.py' model = dict(bbox_head=dict(center_sampling=True, center_sample_radius=1.5))
_base_ = [ '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] teacher_ckpt = 'http://download.openmmlab.com/mmdetection/v2.0/paa/paa_r101_fpn_1x_coco/paa_r101_fpn_1x_coco_20200821-0a1825a4.pth' # noqa model = dict( type='LAD', data_preprocess...
_base_ = [ '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] teacher_ckpt = 'http://download.openmmlab.com/mmdetection/v2.0/paa/paa_r101_fpn_1x_coco/paa_r101_fpn_1x_coco_20200821-0a1825a4.pth' # noqa model = dict( type='LAD', data_preprocess...
from typing import TYPE_CHECKING, Any from langchain._api import create_importer if TYPE_CHECKING: from langchain_community.tools import O365SendMessage from langchain_community.tools.office365.send_message import SendMessageSchema # Create a way to dynamically look up deprecated imports. # Used to consolida...
from typing import TYPE_CHECKING, Any from langchain._api import create_importer if TYPE_CHECKING: from langchain_community.tools import O365SendMessage from langchain_community.tools.office365.send_message import SendMessageSchema # Create a way to dynamically look up deprecated imports. # Used to consolida...
# Copyright (c) OpenMMLab. All rights reserved. import unittest from unittest import TestCase import torch from mmdet.registry import MODELS from mmdet.testing import demo_mm_inputs, demo_mm_proposals, get_roi_head_cfg from mmdet.utils import register_all_modules class TestMaskScoringRoiHead(TestCase): def set...
# Copyright (c) OpenMMLab. All rights reserved. import unittest from unittest import TestCase import torch from mmdet.registry import MODELS from mmdet.testing import demo_mm_inputs, demo_mm_proposals, get_roi_head_cfg from mmdet.utils import register_all_modules class TestMaskScoringRoiHead(TestCase): def set...
# Copyright (c) OpenMMLab. All rights reserved. from .data_preprocessor import (BatchFixedSizePad, BatchResize, BatchSyncRandomResize, BoxInstDataPreprocessor, DetDataPreprocessor, MultiBranchDataPreprocessor) from .reid_dat...
# Copyright (c) OpenMMLab. All rights reserved. from .data_preprocessor import (BatchFixedSizePad, BatchResize, BatchSyncRandomResize, BoxInstDataPreprocessor, DetDataPreprocessor, MultiBranchDataPreprocessor) __all__ = [ ...
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.src.datasets.boston_housing import load_data as load_data
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.src.datasets.boston_housing import load_data
# coding=utf-8 # 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 ag...
# coding=utf-8 # 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 ag...
"""**Messages** are objects used in prompts and chat conversations. **Class hierarchy:** .. code-block:: BaseMessage --> SystemMessage, AIMessage, HumanMessage, ChatMessage, FunctionMessage, ToolMessage --> BaseMessageChunk --> SystemMessageChunk, AIMessageChunk, HumanMessageChunk, ChatMessageChu...
"""**Messages** are objects used in prompts and chat conversations. **Class hierarchy:** .. code-block:: BaseMessage --> SystemMessage, AIMessage, HumanMessage, ChatMessage, FunctionMessage, ToolMessage --> BaseMessageChunk --> SystemMessageChunk, AIMessageChunk, HumanMessageChunk, ChatMessageChu...
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
# Copyright 2024 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicabl...
import os import json import time import pytest from urllib import request from jina import Flow from docarray import Document from jina import helper from jina import Executor, requests from tests import validate_callback cur_dir = os.path.dirname(os.path.abspath(__file__)) # check if this can be bypassed IGNORED_...
import os import json import time import pytest from urllib import request from jina import Flow from docarray import Document from jina import helper from jina import Executor, requests from tests import validate_callback cur_dir = os.path.dirname(os.path.abspath(__file__)) # check if this can be bypassed IGNORED_...
# Copyright (c) OpenMMLab. All rights reserved. from .utils import (get_device, get_max_cuda_memory, is_cuda_available, is_mlu_available) __all__ = [ 'get_max_cuda_memory', 'get_device', 'is_cuda_available', 'is_mlu_available' ]
# Copyright (c) OpenMMLab. All rights reserved. from .utils import get_max_cuda_memory __all__ = ['get_max_cuda_memory']
# Copyright (c) OpenMMLab. All rights reserved. from unittest.mock import Mock import torch from mmengine.data import BaseDataElement from mmengine.hooks import NaiveVisualizationHook class TestNaiveVisualizationHook: def test_after_train_iter(self): naive_visualization_hook = NaiveVisualizationHook() ...
# Copyright (c) OpenMMLab. All rights reserved. from unittest.mock import Mock import torch from mmengine.data import BaseDataElement from mmengine.hooks import NaiveVisualizationHook class TestNaiveVisualizationHook: def test_after_train_iter(self): naive_visualization_hook = NaiveVisualizationHook() ...
__version__ = "3.0.0.dev0" __MODEL_HUB_ORGANIZATION__ = "sentence-transformers" import importlib import os from .datasets import SentencesDataset, ParallelSentencesDataset from .LoggingHandler import LoggingHandler from .SentenceTransformer import SentenceTransformer from .similarity_functions import SimilarityFuncti...
__version__ = "2.8.0.dev0" __MODEL_HUB_ORGANIZATION__ = "sentence-transformers" import importlib import os from .datasets import SentencesDataset, ParallelSentencesDataset from .LoggingHandler import LoggingHandler from .SentenceTransformer import SentenceTransformer from .readers import InputExample from .cross_enco...
# mypy: allow-untyped-defs """List of Python standard library modules. Sadly, there is no reliable way to tell whether a module is part of the standard library except by comparing to a canonical list. This is taken from https://github.com/PyCQA/isort/tree/develop/isort/stdlibs, which itself is sourced from the Python...
# mypy: allow-untyped-defs """List of Python standard library modules. Sadly, there is no reliable way to tell whether a module is part of the standard library except by comparing to a canonical list. This is taken from https://github.com/PyCQA/isort/tree/develop/isort/stdlibs, which itself is sourced from the Python...
from typing import Iterator, MutableSequence, TypeVar from docarray.array.doc_list.sequence_indexing_mixin import IndexingSequenceMixin T_item = TypeVar('T_item') class ListAdvancedIndexing(IndexingSequenceMixin[T_item]): """ A list wrapper that implements custom indexing You can index into a ListAdvan...
from typing import Iterator, MutableSequence, TypeVar from docarray.array.doc_list.sequence_indexing_mixin import IndexingSequenceMixin T_item = TypeVar('T_item') class ListAdvancedIndexing(IndexingSequenceMixin[T_item]): """ A list wrapper that implements custom indexing You can index into a ListAdvan...
from abc import abstractmethod from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Sequence, Type, Union from docarray.document import BaseDocument if TYPE_CHECKING: from docarray.typing import NdArray, TorchTensor class AbstractDocumentArray(Sequence): document_type: Type[BaseDocument] _...
from abc import abstractmethod from typing import TYPE_CHECKING, Dict, Iterable, List, Optional, Sequence, Type, Union from docarray.document import BaseDocument if TYPE_CHECKING: from docarray.typing import NdArray, TorchTensor class AbstractDocumentArray(Sequence): document_type: Type[BaseDocument] _...
# ruff: noqa: E501 """Test LLMCheckerChain functionality.""" import pytest from langchain.chains.llm_checker.base import LLMCheckerChain from langchain.chains.llm_checker.prompt import ( _CHECK_ASSERTIONS_TEMPLATE, _CREATE_DRAFT_ANSWER_TEMPLATE, _LIST_ASSERTIONS_TEMPLATE, _REVISED_ANSWER_TEMPLATE, ) ...
# ruff: noqa: E501 """Test LLMCheckerChain functionality.""" import pytest from langchain.chains.llm_checker.base import LLMCheckerChain from langchain.chains.llm_checker.prompt import ( _CHECK_ASSERTIONS_TEMPLATE, _CREATE_DRAFT_ANSWER_TEMPLATE, _LIST_ASSERTIONS_TEMPLATE, _REVISED_ANSWER_TEMPLATE, ) ...
import multiprocessing import time import pytest from docarray import DocumentArray, Document from docarray.helper import random_port @pytest.mark.parametrize( 'conn_config', [ (dict(protocol='grpc'), 'grpc://127.0.0.1:$port/'), (dict(protocol='grpc'), 'grpc://127.0.0.1:$port'), (dic...
import multiprocessing import time import pytest from docarray import DocumentArray from docarray.helper import random_port @pytest.mark.parametrize( 'conn_config', [ (dict(protocol='grpc'), 'grpc://127.0.0.1:$port/'), (dict(protocol='grpc'), 'grpc://127.0.0.1:$port'), (dict(protocol...
# Copyright (c) OpenMMLab. All rights reserved. import copy import os.path as osp import unittest import numpy as np from mmengine.data import BaseDataElement as PixelData from mmengine.data import InstanceData from mmdet.core import DetDataSample from mmdet.core.mask import BitmapMasks from mmdet.datasets.pipelines ...
# Copyright (c) OpenMMLab. All rights reserved. import copy import os.path as osp import unittest import numpy as np from mmengine.data import BaseDataElement as PixelData from mmengine.data import InstanceData from mmdet.core import DetDataSample from mmdet.core.mask import BitmapMasks from mmdet.datasets.pipelines ...
# Copyright (c) OpenMMLab. All rights reserved. import unittest from unittest import TestCase import torch from parameterized import parameterized from mmdet import * # noqa from mmdet.core import DetDataSample from .utils import demo_mm_inputs, get_detector_cfg class TestRPN(TestCase): @parameterized.expand(...
# Copyright (c) OpenMMLab. All rights reserved. import unittest from unittest import TestCase import torch from parameterized import parameterized from mmdet import * # noqa from tests.test_models.test_detectors.test_single_stage import ( _demo_mm_inputs, _get_detector_cfg) class TestRPN(TestCase): @param...
import logging import random from datasets import load_dataset from sentence_transformers import SparseEncoder from sentence_transformers.sparse_encoder.evaluation import SparseInformationRetrievalEvaluator logging.basicConfig(format="%(message)s", level=logging.INFO) # Load a model model = SparseEncoder("naver/spl...
import logging import random from datasets import load_dataset from sentence_transformers.sparse_encoder import ( MLMTransformer, SparseEncoder, SparseInformationRetrievalEvaluator, SpladePooling, ) logging.basicConfig(format="%(asctime)s - %(message)s", datefmt="%Y-%m-%d %H:%M:%S", level=logging.INF...
# 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...
from collections.abc import AsyncIterator, Iterator, Sequence from typing import ( Any, Callable, Optional, TypeVar, Union, ) from langchain_core.stores import BaseStore K = TypeVar("K") V = TypeVar("V") class EncoderBackedStore(BaseStore[K, V]): """Wraps a store with key and value encoders/...
from collections.abc import AsyncIterator, Iterator, Sequence from typing import ( Any, Callable, Optional, TypeVar, Union, ) from langchain_core.stores import BaseStore K = TypeVar("K") V = TypeVar("V") class EncoderBackedStore(BaseStore[K, V]): """Wraps a store with key and value encoders/...
# Copyright 2025 Open AI and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
# Copyright 2024 Open AI and The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required ...
import pytest from docarray import BaseDoc from docarray.documents import ImageDoc from docarray.typing import NdArray class MyDoc(BaseDoc): embedding: NdArray text: str image: ImageDoc @pytest.mark.parametrize('protocol', ['protobuf', 'pickle']) @pytest.mark.parametrize('compress', ['lz4', 'bz2', 'lzm...
import pytest from docarray import BaseDocument from docarray.documents import ImageDoc from docarray.typing import NdArray class MyDoc(BaseDocument): embedding: NdArray text: str image: ImageDoc @pytest.mark.parametrize('protocol', ['protobuf', 'pickle']) @pytest.mark.parametrize('compress', ['lz4', '...
from typing import List import requests from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class LinearReader(BaseReader): """ Linear reader. Reads data from Linear issues for the passed query. Args: api_key (str): Personal API token. """ ...
from typing import List import requests from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class LinearReader(BaseReader): """Linear reader. Reads data from Linear issues for the passed query. Args: api_key (str): Personal API token. """ def __...
# Copyright (c) OpenMMLab. All rights reserved. import torch def preprocess_panoptic_gt(gt_labels, gt_masks, gt_semantic_seg, num_things, num_stuff, img_metas): """Preprocess the ground truth for a image. Args: gt_labels (Tensor): Ground truth labels of each bbox, ...
# Copyright (c) OpenMMLab. All rights reserved. import torch def preprocess_panoptic_gt(gt_labels, gt_masks, gt_semantic_seg, num_things, num_stuff): """Preprocess the ground truth for a image. Args: gt_labels (Tensor): Ground truth labels of each bbox, with sha...
"""Bing Search API toolkit.""" from typing import TYPE_CHECKING, Any from langchain._api import create_importer if TYPE_CHECKING: from langchain_community.tools import BingSearchResults, BingSearchRun # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation w...
"""Bing Search API toolkit.""" from typing import TYPE_CHECKING, Any from langchain._api import create_importer if TYPE_CHECKING: from langchain_community.tools import BingSearchResults, BingSearchRun # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation w...
"""Module for argparse for Client""" def mixin_client_protocol_parser(parser): """Add the arguments for the protocol to the client parser :param parser: the parser configure """ from jina.enums import ProtocolType parser.add_argument( '--protocol', type=ProtocolType.from_string,...
"""Module for argparse for Client""" def mixin_client_protocol_parser(parser): """Add the arguments for the protocol to the client parser :param parser: the parser configure """ from jina.enums import GatewayProtocolType parser.add_argument( '--protocol', type=GatewayProtocolTyp...
try: from docarray import BaseDoc as Document from docarray import DocArray as DocumentArray docarray_v2 = True except ImportError: from docarray import Document, DocumentArray docarray_v2 = False
try: from docarray import BaseDocument as Document from docarray import DocumentArray docarray_v2 = True except ImportError: from docarray import Document, DocumentArray docarray_v2 = False
# 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...
# ruff: noqa # 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/LICE...
# Copyright (c) OpenMMLab. All rights reserved. from .batch_sampler import AspectRatioBatchSampler from .class_aware_sampler import ClassAwareSampler __all__ = ['ClassAwareSampler', 'AspectRatioBatchSampler']
# Copyright (c) OpenMMLab. All rights reserved. from .class_aware_sampler import ClassAwareSampler from .distributed_sampler import DistributedSampler from .group_sampler import DistributedGroupSampler, GroupSampler from .infinite_sampler import InfiniteBatchSampler, InfiniteGroupBatchSampler __all__ = [ 'Distribu...
import json import pathlib from typing import Any, Callable, List, Optional, Tuple from urllib.parse import urlparse from PIL import Image from .utils import download_and_extract_archive, verify_str_arg from .vision import VisionDataset class CLEVRClassification(VisionDataset): """`CLEVR <https://cs.stanford.ed...
import json import pathlib from typing import Any, Callable, List, Optional, Tuple from urllib.parse import urlparse from PIL import Image from .utils import download_and_extract_archive, verify_str_arg from .vision import VisionDataset class CLEVRClassification(VisionDataset): """`CLEVR <https://cs.stanford.ed...
"""Database Tool.""" from typing import Any, List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.core.utilities.sql_wrapper import SQLDatabase from sqlalchemy import MetaData, t...
"""Database Tool.""" from typing import Any, List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.core.utilities.sql_wrapper import SQLDatabase from sqlalchemy import MetaData, t...
"""Module for helper functions for clients.""" from typing import Tuple, Optional from docarray import Document, DocumentArray from jina.enums import DataInputType from jina.types.request.data import DataRequest def _new_data_request_from_batch( batch, data_type: DataInputType, endpoint: str, target: Optional[st...
"""Module for helper functions for clients.""" from typing import Tuple from docarray import Document, DocumentArray from jina.enums import DataInputType from jina.types.request.data import DataRequest def _new_data_request_from_batch( _kwargs, batch, data_type, endpoint, target, parameters ): req = _new_dat...
from docarray.typing.proto_register import _register_proto from docarray.typing.tensor.image.abstract_image_tensor import AbstractImageTensor from docarray.typing.tensor.ndarray import NdArray MAX_INT_16 = 2**15 @_register_proto(proto_type_name='image_ndarray') class ImageNdArray(AbstractImageTensor, NdArray): "...
from docarray.typing.proto_register import _register_proto from docarray.typing.tensor.image.abstract_image_tensor import AbstractImageTensor from docarray.typing.tensor.ndarray import NdArray MAX_INT_16 = 2**15 @_register_proto(proto_type_name='image_ndarray') class ImageNdArray(AbstractImageTensor, NdArray): "...
# 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 typing import Generator, Optional import pytest from docarray import BaseDoc, DocList from docarray.documents import ImageDoc from docarray.typing import ImageUrl, NdArray from docarray.utils.map import map_docs, map_docs_batched from tests.units.typing.test_bytes import IMAGE_PATHS N_DOCS = 2 def load_from_d...
from langchain_core.exceptions import TracerException from langchain_core.tracers.base import BaseTracer __all__ = ["BaseTracer", "TracerException"]
from langchain_core.exceptions import TracerException from langchain_core.tracers.base import BaseTracer __all__ = ["TracerException", "BaseTracer"]
# flake8: noqa # 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/LI...
# flake8: noqa # 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/LI...
# flake8: noqa # 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/LI...
# flake8: noqa # 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/LI...
""" This examples trains a CrossEncoder for the STSbenchmark task. A CrossEncoder takes a sentence pair as input and outputs a label. Here, it output a continuous labels 0...1 to indicate the similarity between the input pair. It does NOT produce a sentence embedding and does NOT work for individual sentences. Usage:...
""" This examples trains a CrossEncoder for the STSbenchmark task. A CrossEncoder takes a sentence pair as input and outputs a label. Here, it output a continuous labels 0...1 to indicate the similarity between the input pair. It does NOT produce a sentence embedding and does NOT work for individual sentences. Usage:...
"""Wikipedia tool spec.""" from typing import Any, Dict from llama_index.core.tools.tool_spec.base import BaseToolSpec class WikipediaToolSpec(BaseToolSpec): """ Specifies two tools for querying information from Wikipedia. """ spec_functions = ["load_data", "search_data"] def load_data( ...
"""Wikipedia tool spec.""" from typing import Any, Dict from llama_index.core.tools.tool_spec.base import BaseToolSpec class WikipediaToolSpec(BaseToolSpec): """ Specifies two tools for querying information from Wikipedia. """ spec_functions = ["load_data", "search_data"] def load_data( ...
from typing import List, Optional import numpy as np import pytest from docarray import BaseDoc, DocList from docarray.typing import NdArray def test_base_document_init(): doc = BaseDoc() assert doc.id is not None def test_update(): class MyDocument(BaseDoc): content: str title: Optio...
from typing import List, Optional from docarray.base_doc.doc import BaseDoc def test_base_document_init(): doc = BaseDoc() assert doc.id is not None def test_update(): class MyDocument(BaseDoc): content: str title: Optional[str] = None tags_: List doc1 = MyDocument( ...
import numpy as np import pytest from pydantic import parse_obj_as from docarray import BaseDocument from docarray.documents import Mesh3D from tests import TOYDATA_DIR LOCAL_OBJ_FILE = str(TOYDATA_DIR / 'tetrahedron.obj') REMOTE_OBJ_FILE = 'https://people.sc.fsu.edu/~jburkardt/data/obj/al.obj' @pytest.mark.slow @p...
import numpy as np import pytest from docarray.documents import Mesh3D from tests import TOYDATA_DIR LOCAL_OBJ_FILE = str(TOYDATA_DIR / 'tetrahedron.obj') REMOTE_OBJ_FILE = 'https://people.sc.fsu.edu/~jburkardt/data/obj/al.obj' @pytest.mark.slow @pytest.mark.internet @pytest.mark.parametrize('file_url', [LOCAL_OBJ_...
__copyright__ = "Copyright (c) 2021 Jina AI Limited. All rights reserved." __license__ = "Apache-2.0" import copy from typing import Dict from jina import requests, DocumentArray, Executor from jina_commons import get_logger try: from jinahub.indexers.searcher.FaissSearcher import FaissSearcher except: from...
__copyright__ = "Copyright (c) 2021 Jina AI Limited. All rights reserved." __license__ = "Apache-2.0" import copy from typing import Dict from jina import requests, DocumentArray, Executor from jina_commons import get_logger from jinahub.indexers.searcher.FaissSearcher.faiss_searcher import FaissSearcher from jinahu...
from typing import Any, Optional, Type, TypeVar, Union import numpy as np from docarray.base_document import BaseDocument from docarray.typing import AnyEmbedding, ImageBytes, ImageUrl from docarray.typing.tensor.abstract_tensor import AbstractTensor from docarray.typing.tensor.image.image_tensor import ImageTensor f...
from typing import Any, Optional, Type, TypeVar, Union import numpy as np from docarray.base_document import BaseDocument from docarray.typing import AnyEmbedding, ImageBytes, ImageUrl from docarray.typing.tensor.abstract_tensor import AbstractTensor from docarray.typing.tensor.image.image_tensor import ImageTensor f...
# Copyright (c) OpenMMLab. All rights reserved. # from mmengine.dist import get_dist_info, all_reduce from collections import OrderedDict from typing import Generator, List from unittest.mock import MagicMock, Mock import torch from torch._utils import (_flatten_dense_tensors, _take_tensors, ...
# Copyright (c) OpenMMLab. All rights reserved. # from mmengine.dist import get_dist_info, all_reduce from collections import OrderedDict from typing import Generator, List from unittest.mock import MagicMock, Mock import torch from torch._utils import (_flatten_dense_tensors, _take_tensors, ...
""" =================================== How to write your own v2 transforms =================================== .. note:: Try on `collab <https://colab.research.google.com/github/pytorch/vision/blob/gh-pages/main/_generated_ipynb_notebooks/plot_custom_transforms.ipynb>`_ or :ref:`go to the end <sphx_glr_downlo...
""" =================================== How to write your own v2 transforms =================================== This guide explains how to write transforms that are compatible with the torchvision transforms V2 API. """ # %% import torch from torchvision import datapoints from torchvision.transforms import v2 # %% ...
# noqa: D300,D400 # Copyright (c) 2016, Aaron Christianson # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of source code must retain the above copyright # notice, this...
# noqa: D300,D400 # Copyright (c) 2016, Aaron Christianson # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of source code must retain the above copyright # notice, this...
""" ========================================================== Demonstrating the different strategies of KBinsDiscretizer ========================================================== This example presents the different strategies implemented in KBinsDiscretizer: - 'uniform': The discretization is uniform in each featur...
""" ========================================================== Demonstrating the different strategies of KBinsDiscretizer ========================================================== This example presents the different strategies implemented in KBinsDiscretizer: - 'uniform': The discretization is uniform in each featur...
""" =================================== How to write your own v2 transforms =================================== .. note:: Try on `collab <https://colab.research.google.com/github/pytorch/vision/blob/gh-pages/main/_generated_ipynb_notebooks/plot_custom_transforms.ipynb>`_ or :ref:`go to the end <sphx_glr_downlo...
""" =================================== How to write your own v2 transforms =================================== .. note:: Try on `collab <https://colab.research.google.com/github/pytorch/vision/blob/gh-pages/main/_generated_ipynb_notebooks/plot_custom_transforms.ipynb>`_ or :ref:`go to the end <sphx_glr_downlo...
class AudioMetaData: """AudioMetaData() Return type of ``torchaudio.info`` function. :ivar int sample_rate: Sample rate :ivar int num_frames: The number of frames :ivar int num_channels: The number of channels :ivar int bits_per_sample: The number of bits per sample. This is 0 for lossy format...
class AudioMetaData: """Return type of ``torchaudio.info`` function. This class is used by :py:mod:`"sox_io" backend<torchaudio.backends.sox_io_backend>` and :py:mod:`"soundfile" backend<torchaudio.backends.soundfile_backend>`. :ivar int sample_rate: Sample rate :ivar int num_frames: The number of...
from typing import TYPE_CHECKING, Any from langchain._api import create_importer if TYPE_CHECKING: from langchain_community.chat_message_histories import ( SingleStoreDBChatMessageHistory, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation ...
from typing import TYPE_CHECKING, Any from langchain._api import create_importer if TYPE_CHECKING: from langchain_community.chat_message_histories import ( SingleStoreDBChatMessageHistory, ) # Create a way to dynamically look up deprecated imports. # Used to consolidate logic for raising deprecation ...
# Owner(s): ["oncall: jit"] import os import sys import torch # Make the helper files in test/ importable pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) sys.path.append(pytorch_test_dir) from torch.testing._internal.common_utils import raise_on_run_directly from torch.testing._inter...
# Owner(s): ["oncall: jit"] import os import sys import unittest import torch # Make the helper files in test/ importable pytorch_test_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) sys.path.append(pytorch_test_dir) from torch.jit.frontend import _IS_ASTUNPARSE_INSTALLED from torch.testing._inte...
"""Init file of LlamaIndex.""" __version__ = "0.12.14" import logging from logging import NullHandler from typing import Callable, Optional try: # Force pants to install eval_type_backport on 3.9 import eval_type_backport # noqa # type: ignore except ImportError: pass # response from llama_index.core....
"""Init file of LlamaIndex.""" __version__ = "0.12.13" import logging from logging import NullHandler from typing import Callable, Optional try: # Force pants to install eval_type_backport on 3.9 import eval_type_backport # noqa # type: ignore except ImportError: pass # response from llama_index.core....
"""Test loaders for common functionality.""" import inspect import os import numpy as np import pytest import sklearn.datasets def is_pillow_installed(): try: import PIL # noqa: F401 return True except ImportError: return False FETCH_PYTEST_MARKERS = { "return_X_y": { ...
"""Test loaders for common functionality.""" import inspect import os import numpy as np import pytest import sklearn.datasets def is_pillow_installed(): try: import PIL # noqa return True except ImportError: return False FETCH_PYTEST_MARKERS = { "return_X_y": { "fet...
from __future__ import annotations from typing import Any, List, Optional, Tuple, Union import PIL.Image import torch from torchvision.transforms import InterpolationMode from ._datapoint import Datapoint, FillTypeJIT class Mask(Datapoint): @classmethod def _wrap(cls, tensor: torch.Tensor) -> Mask: ...
from __future__ import annotations from typing import Any, List, Optional, Tuple, Union import PIL.Image import torch from torchvision.transforms import InterpolationMode from ._datapoint import Datapoint, FillTypeJIT class Mask(Datapoint): @classmethod def _wrap(cls, tensor: torch.Tensor) -> Mask: ...
from . import _extension from .api import CheckpointException from .default_planner import DefaultLoadPlanner, DefaultSavePlanner from .filesystem import FileSystemReader, FileSystemWriter from .hf_storage import HuggingFaceStorageReader, HuggingFaceStorageWriter from .metadata import ( BytesStorageMetadata, Ch...
from . import _extension from ._hf_planner import _HuggingFaceLoadPlanner, _HuggingFaceSavePlanner from .api import CheckpointException from .default_planner import DefaultLoadPlanner, DefaultSavePlanner from .filesystem import FileSystemReader, FileSystemWriter from .hf_storage import HuggingFaceStorageReader, Hugging...
import logging import re from github import Github from pydantic import BaseModel, SecretStr from pydantic_settings import BaseSettings class Settings(BaseSettings): github_repository: str github_token: SecretStr deploy_url: str | None = None commit_sha: str run_id: int is_done: bool = False ...
import logging import re from github import Github from pydantic import SecretStr from pydantic_settings import BaseSettings class Settings(BaseSettings): github_repository: str github_token: SecretStr deploy_url: str | None = None commit_sha: str run_id: int is_done: bool = False def main(...
import inspect from keras.src.api_export import keras_export from keras.src.initializers.constant_initializers import Constant from keras.src.initializers.constant_initializers import Identity from keras.src.initializers.constant_initializers import Ones from keras.src.initializers.constant_initializers import STFTIni...
import inspect from keras.src.api_export import keras_export from keras.src.initializers.constant_initializers import Constant from keras.src.initializers.constant_initializers import Identity from keras.src.initializers.constant_initializers import Ones from keras.src.initializers.constant_initializers import Zeros f...
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.api import activations from keras.api import applications from keras.api import callbacks from keras.api import config from keras.api import constraints from keras.api import datasets fro...
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.api import activations from keras.api import applications from keras.api import callbacks from keras.api import config from keras.api import constraints from keras.api import datasets fro...
import copy import warnings from dataclasses import InitVar, dataclass, field from pathlib import Path from typing import Any, Dict, Optional, Union from .. import config @dataclass class DownloadConfig: """Configuration for our cached path manager. Attributes: cache_dir (`str` or `Path`, *optional*...
import copy import warnings from dataclasses import InitVar, dataclass, field from pathlib import Path from typing import Any, Dict, Optional, Union from .. import config @dataclass class DownloadConfig: """Configuration for our cached path manager. Attributes: cache_dir (`str` or `Path`, *optional*...