input
stringlengths
33
5k
output
stringlengths
32
5k
from pathlib import Path from typing import Any, List, Union from langchain_community.document_loaders.unstructured import ( UnstructuredFileLoader, validate_unstructured_version, ) class UnstructuredMarkdownLoader(UnstructuredFileLoader): """Load `Markdown` files using `Unstructured`. You can run t...
from pathlib import Path from typing import Any, List, Union from langchain_community.document_loaders.unstructured import ( UnstructuredFileLoader, validate_unstructured_version, ) class UnstructuredMarkdownLoader(UnstructuredFileLoader): """Load `Markdown` files using `Unstructured`. You can run t...
__copyright__ = "Copyright (c) 2021 Jina AI Limited. All rights reserved." __license__ = "Apache-2.0" import subprocess from pathlib import Path import pytest from jina import Document, DocumentArray @pytest.fixture() def docs_with_text() -> DocumentArray: return DocumentArray([Document(text='hello world') for ...
__copyright__ = "Copyright (c) 2021 Jina AI Limited. All rights reserved." __license__ = "Apache-2.0" import pytest from jina import Document, DocumentArray @pytest.fixture() def docs_with_text() -> DocumentArray: return DocumentArray([Document(text='hello world') for _ in range(10)]) @pytest.fixture() def doc...
# SPDX-License-Identifier: Apache-2.0 # Copyright 2023 The HuggingFace Authors. from typing import Any, Dict, List, Optional, Union from huggingface_hub import HfFileSystem from . import config from .table import CastError from .utils.track import TrackedIterable, tracked_list, tracked_str class DatasetsError(Excep...
# SPDX-License-Identifier: Apache-2.0 # Copyright 2023 The HuggingFace Authors. class DatasetsError(Exception): """Base class for exceptions in this library.""" class DefunctDatasetError(DatasetsError): """The dataset has been defunct.""" class FileNotFoundDatasetsError(DatasetsError, FileNotFoundError): ...
import os import time import pytest from jina import Deployment, 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.slo...
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 ...
"""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...
"""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...
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.api import _tf_keras from keras.api import activations from keras.api import applications from keras.api import backend from keras.api import callbacks from keras.api import config from k...
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.api import _tf_keras from keras.api import activations from keras.api import applications from keras.api import backend from keras.api import callbacks from keras.api import config from k...
import os # DO NOT EDIT. Generated by api_gen.sh from keras.api import DTypePolicy from keras.api import FloatDTypePolicy from keras.api import Function from keras.api import Initializer from keras.api import Input from keras.api import InputSpec from keras.api import KerasTensor from keras.api import Layer from keras...
import os # DO NOT EDIT. Generated by api_gen.sh from keras.api import DTypePolicy from keras.api import FloatDTypePolicy from keras.api import Function from keras.api import Initializer from keras.api import Input from keras.api import InputSpec from keras.api import KerasTensor from keras.api import Layer from keras...
import logging from collections import defaultdict from typing import Any, Dict, List, Optional, Sequence from autogpt_libs.utils.cache import thread_cached from fastapi import APIRouter, Depends, HTTPException from prisma.enums import AgentExecutionStatus, APIKeyPermission from typing_extensions import TypedDict imp...
import logging from collections import defaultdict from typing import Any, Sequence from autogpt_libs.utils.cache import thread_cached from fastapi import APIRouter, Depends, HTTPException from prisma.enums import APIKeyPermission import backend.data.block from backend.data import execution as execution_db from backe...
_base_ = [ '../_base_/models/rpn_r50_caffe_c4.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] val_evaluator = dict(metric='proposal_fast') test_evaluator = val_evaluator
_base_ = [ '../_base_/models/rpn_r50_caffe_c4.py', '../_base_/datasets/coco_detection.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # dataset settings img_norm_cfg = dict( mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False) train_pipeline = [ dict(type=...
"""Test chat model integration using standard integration tests.""" from langchain_tests.integration_tests import ChatModelIntegrationTests from langchain_ollama.chat_models import ChatOllama class TestChatOllama(ChatModelIntegrationTests): @property def chat_model_class(self) -> type[ChatOllama]: r...
"""Test chat model integration using standard integration tests.""" from typing import Type from langchain_tests.integration_tests import ChatModelIntegrationTests from langchain_ollama.chat_models import ChatOllama class TestChatOllama(ChatModelIntegrationTests): @property def chat_model_class(self) -> Ty...
import logging import bleach from bleach.css_sanitizer import CSSSanitizer from jinja2 import BaseLoader from jinja2.sandbox import SandboxedEnvironment from markupsafe import Markup logger = logging.getLogger(__name__) def format_filter_for_jinja2(value, format_string=None): if format_string: return fo...
import logging import bleach from jinja2 import BaseLoader from jinja2.sandbox import SandboxedEnvironment from markupsafe import Markup logger = logging.getLogger(__name__) class TextFormatter: def __init__(self): self.env = SandboxedEnvironment(loader=BaseLoader(), autoescape=True) self.env.fi...
from typing import TYPE_CHECKING, Any from langchain._api import create_importer if TYPE_CHECKING: from langchain_community.utilities.vertexai import ( create_retry_decorator, get_client_info, init_vertexai, raise_vertex_import_error, ) # Create a way to dynamically look up de...
from typing import TYPE_CHECKING, Any from langchain._api import create_importer if TYPE_CHECKING: from langchain_community.utilities.vertexai import ( create_retry_decorator, get_client_info, init_vertexai, raise_vertex_import_error, ) # Create a way to dynamically look up de...
"""Tools for interacting with an Apache Cassandra database.""" from typing import List from llama_index.core.bridge.pydantic import Field from llama_index.core.schema import Document from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.cassandra.cassandra_database_wrapper import ( ...
"""Tools for interacting with an Apache Cassandra database.""" from typing import List from llama_index.core.bridge.pydantic import Field from llama_index.core.schema import Document from llama_index.core.tools.tool_spec.base import BaseToolSpec from llama_index.tools.cassandra.cassandra_database_wrapper import ( ...
from __future__ import annotations import math from pathlib import Path import numpy as np import pytest from packaging.version import Version, parse from tokenizers import Tokenizer from sentence_transformers import SentenceTransformer from sentence_transformers.models.StaticEmbedding import StaticEmbedding try: ...
from __future__ import annotations import math from pathlib import Path import numpy as np import pytest from tokenizers import Tokenizer from sentence_transformers import SentenceTransformer from sentence_transformers.models.StaticEmbedding import StaticEmbedding try: import model2vec except ImportError: m...
from typing import Any, Dict, Optional, Union import numpy as np import PIL.Image import torch from torch.nn.functional import one_hot from torchvision.prototype import datapoints from torchvision.prototype.transforms import functional as F, Transform from torchvision.prototype.transforms.utils import is_simple_ten...
from typing import Any, Dict, Optional, Union import numpy as np import PIL.Image import torch from torch.nn.functional import one_hot from torchvision.prototype import features from torchvision.prototype.transforms import functional as F, Transform class LabelToOneHot(Transform): _transformed_types = (features...
""" This scripts demonstrates how to train a Sparse Encoder model for Information Retrieval. As dataset, we use sentence-transformers/msmarco-bm25, where we have triplets versions of MSMARCO mined thanks to BM25. As loss function, we use MultipleNegativesRankingLoss in the SpladeLoss. """ import logging import trac...
""" This scripts demonstrates how to train a Sparse Encoder model for Information Retrieval. As dataset, we use sentence-transformers/msmarco-bm25, where we have triplets versions of MSMARCO mined thanks to BM25. As loss function, we use MultipleNegativesRankingLoss in the SpladeLoss. """ import logging import trac...
# Copyright (c) OpenMMLab. All rights reserved. from ..builder import DETECTORS from .two_stage import TwoStageDetector @DETECTORS.register_module() class CascadeRCNN(TwoStageDetector): r"""Implementation of `Cascade R-CNN: Delving into High Quality Object Detection <https://arxiv.org/abs/1906.09756>`_""" ...
from ..builder import DETECTORS from .two_stage import TwoStageDetector @DETECTORS.register_module() class CascadeRCNN(TwoStageDetector): r"""Implementation of `Cascade R-CNN: Delving into High Quality Object Detection <https://arxiv.org/abs/1906.09756>`_""" def __init__(self, backbone, ...
"""Pydantic v1 compatibility shim.""" from pydantic.v1.main import * # noqa: F403 from langchain_core._api import warn_deprecated warn_deprecated( "0.3.0", removal="1.0.0", alternative="pydantic.v1 or pydantic", message=( "As of langchain-core 0.3.0, LangChain uses pydantic v2 internally. " ...
"""Pydantic v1 compatibility shim.""" from langchain_core._api import warn_deprecated try: from pydantic.v1.main import * # noqa: F403 except ImportError: from pydantic.main import * # type: ignore[assignment,no-redef] # noqa: F403 warn_deprecated( "0.3.0", removal="1.0.0", alternative="pydanti...
import json from json import JSONDecodeError from typing import Union from langchain_core.agents import AgentAction, AgentActionMessageLog, AgentFinish from langchain_core.exceptions import OutputParserException from langchain_core.messages import ( AIMessage, BaseMessage, ToolCall, ) from langchain_core.o...
import json from json import JSONDecodeError from typing import Union from langchain_core.agents import AgentAction, AgentActionMessageLog, AgentFinish from langchain_core.exceptions import OutputParserException from langchain_core.messages import ( AIMessage, BaseMessage, ToolCall, ) from langchain_core.o...
# Copyright 2022 The TensorFlow Authors. 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 applica...
# Copyright 2022 The TensorFlow Authors. 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 applica...
_base_ = [ '../_base_/models/mask-rcnn_r50_fpn.py', '../_base_/datasets/coco_instance.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # please install mmcls>=1.0 # import mmcls.models to trigger register_module in mmcls custom_imports = dict(imports=['mmcls.models'], allow_faile...
_base_ = [ '../_base_/models/mask_rcnn_r50_fpn.py', '../_base_/datasets/coco_instance.py', '../_base_/schedules/schedule_1x.py', '../_base_/default_runtime.py' ] # please install mmcls>=1.0 # import mmcls.models to trigger register_module in mmcls custom_imports = dict(imports=['mmcls.models'], allow_faile...
from deprecated import deprecated from typing import Optional from .workflow import Workflow from .events import StartEvent, StopEvent from .decorators import StepConfig from .utils import get_steps_from_class, get_steps_from_instance @deprecated( reason="Install `llama-index-utils-workflow` and use the import `...
from deprecated import deprecated from typing import Optional from .workflow import Workflow from .events import StartEvent, StopEvent from .decorators import StepConfig from .utils import get_steps_from_class, get_steps_from_instance @deprecated( reason="Install `llama-index-utils-workflow` and use the import `...
from keras.src import activations from keras.src import backend from keras.src.api_export import keras_export from keras.src.layers.layer import Layer def _large_negative_number(dtype): """Return a Large negative number based on dtype.""" if backend.standardize_dtype(dtype) == "float16": return -3e4 ...
from keras.src import activations from keras.src import backend from keras.src.api_export import keras_export from keras.src.layers.layer import Layer def _large_negative_number(dtype): """Return a Large negative number based on dtype.""" if backend.standardize_dtype(dtype) == "float16": return -3e4 ...
"""Helper functions for managing the LangChain API. This module is only relevant for LangChain developers, not for users. .. warning:: This module and its submodules are for internal use only. Do not use them in your own code. We may change the API at any time with no warning. """ from typing import TYPE...
"""Helper functions for managing the LangChain API. This module is only relevant for LangChain developers, not for users. .. warning:: This module and its submodules are for internal use only. Do not use them in your own code. We may change the API at any time with no warning. """ from typing import TYPE...
from ._transforms import BarkScale, BarkSpectrogram, InverseBarkScale __all__ = [ "BarkScale", "BarkSpectrogram", "InverseBarkScale", ]
from ._transforms import ( AddNoise, BarkScale, BarkSpectrogram, Convolve, Deemphasis, FFTConvolve, InverseBarkScale, Preemphasis, Speed, SpeedPerturbation, ) __all__ = [ "AddNoise", "BarkScale", "BarkSpectrogram", "Convolve", "Deemphasis", "FFTConvolve",...
import os from nvflare.apis.executor import Executor from nvflare.apis.fl_constant import FLContextKey, ReturnCode from nvflare.apis.fl_context import FLContext from nvflare.apis.shareable import Shareable, make_reply from nvflare.apis.signal import Signal import xgboost as xgb from xgboost import callback class Su...
import os from nvflare.apis.executor import Executor from nvflare.apis.fl_constant import FLContextKey, ReturnCode from nvflare.apis.fl_context import FLContext from nvflare.apis.shareable import Shareable, make_reply from nvflare.apis.signal import Signal import xgboost as xgb from xgboost import callback class Su...
from typing import Union, Dict, Any import google.ai.generativelanguage as glm import google.generativeai as genai from llama_index.core.base.llms.types import ( ChatMessage, ChatResponse, CompletionResponse, ImageBlock, TextBlock, ) from llama_index.core.multi_modal_llms.base import ChatMessage fr...
from typing import Union import google.ai.generativelanguage as glm import google.generativeai as genai from llama_index.core.base.llms.types import ( ChatMessage, ChatResponse, CompletionResponse, ImageBlock, TextBlock, ) from llama_index.core.multi_modal_llms.base import ChatMessage from llama_in...
import pytest from jina import Flow @pytest.mark.parametrize('protocol', ['grpc', 'http', 'websocket']) def test_dry_run(protocol): f = Flow(protocol=protocol).add() with f: dry_run = f.dry_run() dry_run_negative = f.dry_run() assert dry_run assert not dry_run_negative @pytest.mark.par...
import pytest from jina import Flow @pytest.mark.parametrize('protocol', ['grpc', 'http', 'websocket']) def test_dry_run(protocol): f = Flow(protocol=protocol).add() with f: dry_run = f.dry_run() dry_run_negative = f.dry_run() assert dry_run assert not dry_run_negative
"""Test Self-hosted LLMs.""" import pickle from typing import Any, List, Optional from langchain_community.llms import SelfHostedHuggingFaceLLM, SelfHostedPipeline model_reqs = ["pip:./", "transformers", "torch"] def get_remote_instance() -> Any: """Get remote instance for testing.""" import runhouse as rh...
"""Test Self-hosted LLMs.""" import pickle from typing import Any, List, Optional from langchain_community.llms import SelfHostedHuggingFaceLLM, SelfHostedPipeline model_reqs = ["pip:./", "transformers", "torch"] def get_remote_instance() -> Any: """Get remote instance for testing.""" import runhouse as rh...
from typing import TYPE_CHECKING, TypeVar import numpy as np from pydantic import parse_obj_as from docarray.typing.proto_register import _register_proto from docarray.typing.tensor.ndarray import NdArray from docarray.typing.url.url_3d.url_3d import Url3D if TYPE_CHECKING: from docarray.documents.point_cloud.po...
from typing import TypeVar import numpy as np from pydantic import parse_obj_as from docarray.typing.proto_register import _register_proto from docarray.typing.tensor.ndarray import NdArray from docarray.typing.url.url_3d.url_3d import Url3D T = TypeVar('T', bound='PointCloud3DUrl') @_register_proto(proto_type_nam...
from keras.src import backend from keras.src.api_export import keras_export from keras.src.layers.layer import Layer @keras_export("keras.layers.Dropout") class Dropout(Layer): """Applies dropout to the input. The `Dropout` layer randomly sets input units to 0 with a frequency of `rate` at each step duri...
from keras.src import backend from keras.src.api_export import keras_export from keras.src.layers.layer import Layer @keras_export("keras.layers.Dropout") class Dropout(Layer): """Applies dropout to the input. The `Dropout` layer randomly sets input units to 0 with a frequency of `rate` at each step duri...
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder logger = datasets.utils.logging.get_logger(__name__) class AudioFolderConfig(folder_based_builder.FolderBasedBuilderConfig): """Builder Config for AudioFolder.""" ...
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder logger = datasets.utils.logging.get_logger(__name__) class AudioFolderConfig(folder_based_builder.FolderBasedBuilderConfig): """Builder Config for AudioFolder.""" ...
import pytest from llama_index.llms.bedrock_converse.utils import get_model_name from io import BytesIO from unittest.mock import MagicMock, patch from llama_index.core.base.llms.types import ( AudioBlock, ImageBlock, MessageRole, TextBlock, ) from llama_index.llms.bedrock_converse.utils imp...
import pytest from llama_index.llms.bedrock_converse.utils import get_model_name from io import BytesIO from unittest.mock import MagicMock, patch from llama_index.core.base.llms.types import ( AudioBlock, ImageBlock, MessageRole, TextBlock, ) from llama_index.llms.bedrock_converse.utils imp...
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.src.backend.common.dtypes import result_type as result_type from keras.src.backend.common.global_state import clear_session as clear_session from keras.src.backend.common.keras_tensor imp...
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.src.backend.common.dtypes import result_type from keras.src.backend.common.global_state import clear_session from keras.src.backend.common.keras_tensor import is_keras_tensor from keras.s...
import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder CI_HUB_USER = "__DUMMY_TRANSFORMERS_USER__" CI_HUB_USER_FULL_NAME = "Dummy User" CI_HUB_USER_TOKEN = "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" CI_HUB_ENDPOINT = "...
import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder CI_HUB_USER = "__DUMMY_TRANSFORMERS_USER__" CI_HUB_USER_FULL_NAME = "Dummy User" CI_HUB_USER_TOKEN = "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" CI_HUB_ENDPOINT = "...
""" This is a simple application for sentence embeddings: semantic search We have a corpus with various sentences. Then, for a given query sentence, we want to find the most similar sentence in this corpus. This script outputs for various queries the top 5 most similar sentences in the corpus. """ import torch from...
""" This is a simple application for sentence embeddings: semantic search We have a corpus with various sentences. Then, for a given query sentence, we want to find the most similar sentence in this corpus. This script outputs for various queries the top 5 most similar sentences in the corpus. """ from sentence_tran...
try: import sklearn except ImportError: sklearn = None def _validate_data(estimator, *args, **kwargs): """Validate the input data. wrapper for sklearn.utils.validation.validate_data or BaseEstimator._validate_data depending on the scikit-learn version. TODO: remove when minimum scikit-learn ...
try: import sklearn except ImportError: sklearn = None def _validate_data(estimator, *args, **kwargs): """Validate the input data. wrapper for sklearn.utils.validation.validate_data or BaseEstimator._validate_data depending on the scikit-learn version. TODO: remove when minimum scikit-learn ...
from llama_index.core.instrumentation.events import BaseEvent class ExceptionEvent(BaseEvent): """ ExceptionEvent. Args: exception (BaseException): exception. """ exception: BaseException @classmethod def class_name(cls) -> str: """Class name.""" return "Excepti...
from llama_index.core.instrumentation.events import BaseEvent class ExceptionEvent(BaseEvent): """ExceptionEvent. Args: exception (BaseException): exception. """ exception: BaseException @classmethod def class_name(cls) -> str: """Class name.""" return "ExceptionEven...
from __future__ import annotations from typing import Literal from sentence_transformers.losses.GISTEmbedLoss import GISTEmbedLoss from sentence_transformers.sparse_encoder.SparseEncoder import SparseEncoder class SparseGISTEmbedLoss(GISTEmbedLoss): def __init__( self, model: SparseEncoder, ...
from __future__ import annotations from typing import Literal from sentence_transformers.losses.GISTEmbedLoss import GISTEmbedLoss from sentence_transformers.sparse_encoder.SparseEncoder import SparseEncoder class SparseGISTEmbedLoss(GISTEmbedLoss): def __init__( self, model: SparseEncoder, ...
import functools import warnings from collections import defaultdict from typing import Any, Dict, Optional, Sequence, Tuple, Type, TypeVar, Union import torch from torchvision import tv_tensors from torchvision.transforms.v2 import Transform from torchvision.transforms.v2._utils import is_pure_tensor T = TypeVar(...
import functools import warnings from collections import defaultdict from typing import Any, Dict, Optional, Sequence, Tuple, Type, TypeVar, Union import torch from torchvision import datapoints from torchvision.transforms.v2 import Transform from torchvision.transforms.v2._utils import is_pure_tensor T = TypeVar(...
from langchain_core.tracers.langchain_v1 import LangChainTracerV1, get_headers __all__ = ["LangChainTracerV1", "get_headers"]
from langchain_core.tracers.langchain_v1 import LangChainTracerV1, get_headers __all__ = ["get_headers", "LangChainTracerV1"]
import os from pathlib import Path from typing import List, Tuple, Union import torchaudio from torch import Tensor from torch.hub import download_url_to_file from torch.utils.data import Dataset from torchaudio.datasets.librispeech import _get_librispeech_metadata from torchaudio.datasets.utils import _extract_tar ...
import os from pathlib import Path from typing import List, Tuple, Union import torchaudio from torch import Tensor from torch.hub import download_url_to_file from torch.utils.data import Dataset from torchaudio.datasets.librispeech import _get_librispeech_metadata from torchaudio.datasets.utils import extract_archive...
__version__ = '0.32.1' import logging from docarray.array import DocList, DocVec from docarray.base_doc.doc import BaseDoc from docarray.utils._internal.misc import _get_path_from_docarray_root_level __all__ = ['BaseDoc', 'DocList', 'DocVec'] logger = logging.getLogger('docarray') handler = logging.StreamHandler()...
__version__ = '0.32.0' import logging from docarray.array import DocList, DocVec from docarray.base_doc.doc import BaseDoc from docarray.utils._internal.misc import _get_path_from_docarray_root_level __all__ = ['BaseDoc', 'DocList', 'DocVec'] logger = logging.getLogger('docarray') handler = logging.StreamHandler()...
import numpy as np import pytest import torch from pydantic import parse_obj_as from docarray import BaseDocument from docarray.documents import ImageDoc from docarray.utils.misc import is_tf_available tf_available = is_tf_available() if tf_available: import tensorflow as tf import tensorflow._api.v2.experime...
import numpy as np import pytest import torch from pydantic import parse_obj_as from docarray import BaseDocument from docarray.documents import Image from docarray.utils.misc import is_tf_available tf_available = is_tf_available() if tf_available: import tensorflow as tf import tensorflow._api.v2.experimenta...
# TODO: Remove this config after benchmarking all related configs _base_ = 'fcos_r50-caffe_fpn_gn-head_1x_coco.py' # dataset settings train_dataloader = dict(batch_size=4, num_workers=4)
# TODO: Remove this config after benchmarking all related configs _base_ = 'fcos_r50_caffe_fpn_gn-head_1x_coco.py' # dataset settings train_dataloader = dict(batch_size=4, num_workers=4)
from __future__ import annotations import logging from typing import TYPE_CHECKING, Any from sentence_transformers.evaluation import TranslationEvaluator if TYPE_CHECKING: import numpy as np from torch import Tensor from sentence_transformers.sparse_encoder.SparseEncoder import SparseEncoder logger = ...
from __future__ import annotations import logging from typing import TYPE_CHECKING, Any from sentence_transformers.evaluation import TranslationEvaluator if TYPE_CHECKING: import numpy as np from torch import Tensor from sentence_transformers.sparse_encoder.SparseEncoder import SparseEncoder logger = ...
# Copyright (c) OpenMMLab. All rights reserved. import collections from mmdet.registry import TRANSFORMS @TRANSFORMS.register_module() class Compose: """Compose multiple transforms sequentially. Args: transforms (Sequence[dict | callable]): Sequence of transform object or config dict to ...
# Copyright (c) OpenMMLab. All rights reserved. import collections from mmcv.utils import build_from_cfg from ..builder import PIPELINES @PIPELINES.register_module() class Compose: """Compose multiple transforms sequentially. Args: transforms (Sequence[dict | callable]): Sequence of transform objec...
from langchain_core.messages import ( AIMessage, FunctionMessage, HumanMessage, SystemMessage, ) from langchain_core.output_parsers.openai_tools import ( parse_tool_call, ) from langchain_community.chat_models.tongyi import ( convert_dict_to_message, convert_message_to_dict, ) def test__c...
from langchain_core.messages import ( AIMessage, FunctionMessage, HumanMessage, SystemMessage, ) from langchain_core.output_parsers.openai_tools import ( parse_tool_call, ) from langchain_community.chat_models.tongyi import ( convert_dict_to_message, convert_message_to_dict, ) def test__c...
from typing import Optional import numpy as np import pytest import torch from docarray import BaseDoc, DocList, DocVec from docarray.documents import ImageDoc from docarray.typing import NdArray, TorchTensor class MyDoc(BaseDoc): embedding: NdArray text: str image: ImageDoc def test_from_to_json_docl...
from typing import Optional import numpy as np import pytest import torch from docarray import BaseDoc, DocList, DocVec from docarray.documents import ImageDoc from docarray.typing import NdArray, TorchTensor class MyDoc(BaseDoc): embedding: NdArray text: str image: ImageDoc def test_from_to_json_docl...
# Copyright (c) Meta Platforms, Inc. and affiliates. # This software may be used and distributed according to the terms of the Llama 2 Community License Agreement. from typing import List, Optional import fire from llama import Llama, Dialog def main( ckpt_dir: str, tokenizer_path: str, temperature: fl...
# Copyright (c) Meta Platforms, Inc. and affiliates. # This software may be used and distributed according to the terms of the Llama 2 Community License Agreement. from typing import Optional import fire from llama import Llama def main( ckpt_dir: str, tokenizer_path: str, temperature: float = 0.6, ...
import logging from collections import defaultdict from typing import Annotated, Any, Dict, List, Optional, Sequence from fastapi import APIRouter, Body, Depends, HTTPException from prisma.enums import AgentExecutionStatus, APIKeyPermission from typing_extensions import TypedDict import backend.data.block from backen...
import logging from collections import defaultdict from typing import Annotated, Any, Dict, List, Optional, Sequence from fastapi import APIRouter, Body, Depends, HTTPException from prisma.enums import AgentExecutionStatus, APIKeyPermission from typing_extensions import TypedDict import backend.data.block from backen...
""" Top-level module of Jina. The primary function of this module is to import all of the public Jina interfaces into a single place. The interfaces themselves are located in sub-modules, as described below. """ import os as _os import platform as _platform import signal as _signal import sys as _sys import warnings...
""" Top-level module of Jina. The primary function of this module is to import all of the public Jina interfaces into a single place. The interfaces themselves are located in sub-modules, as described below. """ import os as _os import platform as _platform import signal as _signal import sys as _sys import warnings...
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...
# Copyright (c) OpenMMLab. All rights reserved. from mmengine.utils import collect_env as collect_base_env from mmengine.utils import get_git_hash import mmdet def collect_env(): """Collect the information of the running environments.""" env_info = collect_base_env() env_info['MMDetection'] = mmdet.__ver...
# Copyright (c) OpenMMLab. All rights reserved. from mmcv.utils import collect_env as collect_base_env from mmcv.utils import get_git_hash import mmdet def collect_env(): """Collect the information of the running environments.""" env_info = collect_base_env() env_info['MMDetection'] = mmdet.__version__ +...
_base_ = [ '../_base_/models/retinanet_r50_fpn.py', '../common/mstrain_3x_coco.py' ] # optimizer model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101)) optim_wrapper = dict( optimizer=dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001))
_base_ = [ '../_base_/models/retinanet_r50_fpn.py', '../common/mstrain_3x_coco.py' ] # optimizer model = dict(pretrained='torchvision://resnet101', backbone=dict(depth=101)) optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0001)
from typing import Optional, Dict, List, Set, Tuple import numpy as np import pytest import torch from docarray import DocumentArray from docarray.base_document import BaseDocument from docarray.typing import NdArray, TorchTensor @pytest.mark.proto def test_proto_simple(): class CustomDoc(BaseDocument): ...
from typing import Optional import numpy as np import pytest import torch from docarray import DocumentArray from docarray.base_document import BaseDocument from docarray.typing import NdArray, TorchTensor @pytest.mark.proto def test_proto_simple(): class CustomDoc(BaseDocument): text: str doc = Cu...
"""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 backend from keras.api import callbacks from keras.api import config from keras.api import constraints from...
import threading import fsspec.asyn import torch from ...iterable_dataset import IterableDataset, _apply_feature_types from ...utils.logging import get_logger logger = get_logger(__name__) def _set_fsspec_for_multiprocess() -> None: """ Clear reference to the loop and thread. This is necessary otherwi...
import fsspec.asyn import torch from ...iterable_dataset import IterableDataset, _apply_feature_types from ...utils.logging import get_logger logger = get_logger(__name__) def _set_fsspec_for_multiprocess() -> None: """ Clear reference to the loop and thread. This is necessary otherwise HTTPFileSystem ...
__copyright__ = "Copyright (c) 2020-2021 Jina AI Limited. All rights reserved." __license__ = "Apache-2.0" import subprocess import numpy as np import pytest from executor.audioclip_image import AudioCLIPImageEncoder from jina import Document, DocumentArray, Flow @pytest.mark.parametrize("request_size", [1, 10, 50,...
__copyright__ = "Copyright (c) 2020-2021 Jina AI Limited. All rights reserved." __license__ = "Apache-2.0" import subprocess import numpy as np import pytest from executor.audioclip_image import AudioCLIPImageEncoder from jina import Document, DocumentArray, Flow @pytest.mark.parametrize("request_size", [1, 10, 50,...
"""Init file of LlamaIndex.""" __version__ = "0.12.25" 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.24.post1" 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...
"""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 ...
import datetime from typing import Any import prisma.models import pydantic import backend.data.block as block_model import backend.data.graph as graph_model import backend.server.model as server_model class LibraryAgent(pydantic.BaseModel): id: str # Changed from agent_id to match GraphMeta agent_id: str...
import typing import pydantic class LibraryAgent(pydantic.BaseModel): id: str # Changed from agent_id to match GraphMeta version: int # Changed from agent_version to match GraphMeta is_active: bool # Added to match GraphMeta name: str description: str isCreatedByUser: bool # Made inpu...
""" Top-level module of Jina. The primary function of this module is to import all of the public Jina interfaces into a single place. The interfaces themselves are located in sub-modules, as described below. """ import os as _os import platform as _platform import signal as _signal import sys as _sys import warnings...
""" Top-level module of Jina. The primary function of this module is to import all of the public Jina interfaces into a single place. The interfaces themselves are located in sub-modules, as described below. """ import os as _os import platform as _platform import signal as _signal import sys as _sys import warnings...
"""All minimum dependencies for scikit-learn.""" # Authors: The scikit-learn developers # SPDX-License-Identifier: BSD-3-Clause import argparse from collections import defaultdict # scipy and cython should by in sync with pyproject.toml NUMPY_MIN_VERSION = "1.19.5" SCIPY_MIN_VERSION = "1.6.0" JOBLIB_MIN_VERSION = "1...
"""All minimum dependencies for scikit-learn.""" # Authors: The scikit-learn developers # SPDX-License-Identifier: BSD-3-Clause import argparse from collections import defaultdict # scipy and cython should by in sync with pyproject.toml NUMPY_MIN_VERSION = "1.19.5" SCIPY_MIN_VERSION = "1.6.0" JOBLIB_MIN_VERSION = "1...
import subprocess import pytest from jina import Document, DocumentArray, Flow from tfidf_text_executor import TFIDFTextEncoder _EMBEDDING_DIM = 130107 @pytest.mark.parametrize('request_size', [1, 10, 50, 100]) def test_integration(request_size: int): docs = DocumentArray( [Document(text='just some rand...
import subprocess import pytest from jina import Document, DocumentArray, Flow from ...tfidf_text_executor import TFIDFTextEncoder _EMBEDDING_DIM = 130107 @pytest.mark.parametrize('request_size', [1, 10, 50, 100]) def test_integration(request_size: int): docs = DocumentArray( [Document(text='just some ...
"""Argparser module for Flow""" from jina.parsers.base import set_base_parser from jina.parsers.helper import KVAppendAction, add_arg_group from jina.parsers.orchestrate.base import mixin_essential_parser def mixin_flow_features_parser(parser): """Add the arguments for the Flow features to the parser :param...
"""Argparser module for Flow""" from jina.parsers.base import set_base_parser from jina.parsers.helper import KVAppendAction, add_arg_group from jina.parsers.orchestrate.base import mixin_essential_parser def mixin_flow_features_parser(parser): """Add the arguments for the Flow features to the parser :param...
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
# Owner(s): ["module: dynamo"] """ PYTEST_DONT_REWRITE (prevents pytest from rewriting assertions, which interferes with test_adam in OptimizerTests) """ import functools import torch import torch._dynamo import torch._dynamo.test_case import torch._dynamo.testing from torch.nn import Parameter class MyOptimizer(to...
# Owner(s): ["module: dynamo"] """ PYTEST_DONT_REWRITE (prevents pytest from rewriting assertions, which interferes with test_adam in OptimizerTests) """ import functools import torch import torch._dynamo import torch._dynamo.test_case import torch._dynamo.testing from torch.nn import Parameter class MyOptimizer(tor...
# Copyright (c) OpenMMLab. All rights reserved. from .distributed_sampler import DistributedSampler from .group_sampler import DistributedGroupSampler, GroupSampler __all__ = ['DistributedSampler', 'DistributedGroupSampler', 'GroupSampler']
from .distributed_sampler import DistributedSampler from .group_sampler import DistributedGroupSampler, GroupSampler __all__ = ['DistributedSampler', 'DistributedGroupSampler', 'GroupSampler']
from typing import Optional import numpy as np import pytest import torch from pydantic.tools import parse_obj_as, schema_json_of from docarray import BaseDoc from docarray.base_doc.io.json import orjson_dumps from docarray.typing import ( AudioNdArray, NdArray, VideoBytes, VideoNdArray, VideoTorc...
from typing import Optional import numpy as np import pytest import torch from pydantic.tools import parse_obj_as, schema_json_of from docarray import BaseDoc from docarray.base_doc.io.json import orjson_dumps from docarray.typing import ( AudioNdArray, NdArray, VideoBytes, VideoNdArray, VideoTorc...
_base_ = './fovea_r50_fpn_4xb4-1x_coco.py' # learning policy max_epochs = 24 param_scheduler = [ dict( type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500), dict( type='MultiStepLR', begin=0, end=max_epochs, by_epoch=True, milestones=[16, 22], ...
_base_ = './fovea_r50_fpn_4x4_1x_coco.py' # learning policy max_epochs = 24 param_scheduler = [ dict( type='LinearLR', start_factor=0.001, by_epoch=False, begin=0, end=500), dict( type='MultiStepLR', begin=0, end=max_epochs, by_epoch=True, milestones=[16, 22], ...
# Copyright (c) OpenMMLab. All rights reserved. from .approx_max_iou_assigner import ApproxMaxIoUAssigner from .assign_result import AssignResult from .atss_assigner import ATSSAssigner from .base_assigner import BaseAssigner from .center_region_assigner import CenterRegionAssigner from .grid_assigner import GridAssign...
from .approx_max_iou_assigner import ApproxMaxIoUAssigner from .assign_result import AssignResult from .atss_assigner import ATSSAssigner from .base_assigner import BaseAssigner from .center_region_assigner import CenterRegionAssigner from .grid_assigner import GridAssigner from .hungarian_assigner import HungarianAssi...
import os import yaml from jina import Gateway from jina.jaml import JAML from jina.serve.executors import BaseExecutor class MyDummyGateway(Gateway): async def setup_server(self): self.server = 'dummy server' async def run_server(self): self.logger.info(self.server) async def shutdown...
import os import yaml from jina import Gateway from jina.jaml import JAML from jina.serve.executors import BaseExecutor class MyDummyGateway(Gateway): async def setup_server(self): self.server = 'dummy server' async def run_server(self): self.logger.info(self.server) async def teardown...
""" This scripts runs the evaluation (dev & test) for the AskUbuntu dataset Usage: python eval_askubuntu.py [sbert_model_name_or_path] """ import gzip import logging import os import sys from datasets import Dataset from sentence_transformers import SentenceTransformer, util from sentence_transformers.evaluation im...
""" This scripts runs the evaluation (dev & test) for the AskUbuntu dataset Usage: python eval_askubuntu.py [sbert_model_name_or_path] """ import gzip import logging import os import sys from sentence_transformers import LoggingHandler, SentenceTransformer, evaluation, util #### Just some code to print debug inform...
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.src.callbacks.backup_and_restore import ( BackupAndRestore as BackupAndRestore, ) from keras.src.callbacks.callback import Callback as Callback from keras.src.callbacks.callback_list ...
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.src.callbacks.backup_and_restore import BackupAndRestore from keras.src.callbacks.callback import Callback from keras.src.callbacks.callback_list import CallbackList from keras.src.callba...
# Copyright (c) OpenMMLab. All rights reserved. from unittest.mock import Mock from mmengine.hooks import DistSamplerSeedHook class TestDistSamplerSeedHook: def test_before_epoch(self): hook = DistSamplerSeedHook() # Test dataset sampler runner = Mock() runner.epoch = 1 ...
# Copyright (c) OpenMMLab. All rights reserved. from unittest.mock import Mock from mmengine.hooks import DistSamplerSeedHook class TestDistSamplerSeedHook: def test_before_epoch(self): hook = DistSamplerSeedHook() # Test dataset sampler runner = Mock() runner.epoch = 1 ...
from __future__ import annotations import logging from typing import Optional, Type from langchain_core.callbacks import CallbackManagerForToolRun from pydantic import BaseModel, Field, HttpUrl from langchain_community.tools.edenai.edenai_base_tool import EdenaiTool logger = logging.getLogger(__name__) class Obje...
from __future__ import annotations import logging from typing import Optional, Type from langchain_core.callbacks import CallbackManagerForToolRun from pydantic import BaseModel, Field, HttpUrl from langchain_community.tools.edenai.edenai_base_tool import EdenaiTool logger = logging.getLogger(__name__) class Obje...
from typing import TYPE_CHECKING, Any from langchain._api import create_importer if TYPE_CHECKING: from langchain_community.chains.openapi.requests_chain import ( REQUEST_TEMPLATE, APIRequesterChain, APIRequesterOutputParser, ) # Create a way to dynamically look up deprecated imports....
from typing import TYPE_CHECKING, Any from langchain._api import create_importer if TYPE_CHECKING: from langchain_community.chains.openapi.requests_chain import ( REQUEST_TEMPLATE, APIRequesterChain, APIRequesterOutputParser, ) # Create a way to dynamically look up deprecated imports....
from typing import Optional import numpy as np import pytest import torch from pydantic.tools import parse_obj_as, schema_json_of from docarray import BaseDoc from docarray.base_doc.io.json import orjson_dumps from docarray.typing import AudioBytes, AudioTorchTensor, AudioUrl from docarray.utils._internal.misc import...
from typing import Optional import numpy as np import pytest import torch from pydantic.tools import parse_obj_as, schema_json_of from docarray import BaseDoc from docarray.base_doc.io.json import orjson_dumps from docarray.typing import AudioTorchTensor, AudioUrl from docarray.utils._internal.misc import is_tf_avail...
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...
import abc from abc import ABC from typing import TYPE_CHECKING, Any, Generic, Tuple, Type, TypeVar 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 = TypeVar('ShapeT...
from pathlib import Path from typing import Callable, Optional, Tuple, Union from torch import Tensor from torchaudio import AudioMetaData def load( filepath: Union[str, Path], out: Optional[Tensor] = None, normalization: Union[bool, float, Callable] = True, channels_first: bool = True, num_frame...
from pathlib import Path from typing import Callable, Optional, Tuple, Union from torch import Tensor def load( filepath: Union[str, Path], out: Optional[Tensor] = None, normalization: Union[bool, float, Callable] = True, channels_first: bool = True, num_frames: int = 0, offset: int = 0, ...
"""Tool for the Metaphor search API.""" from typing import Dict, List, Optional, Union from langchain_core._api.deprecation import deprecated from langchain_core.callbacks import ( AsyncCallbackManagerForToolRun, CallbackManagerForToolRun, ) from langchain_core.tools import BaseTool from langchain_community....
"""Tool for the Metaphor search API.""" from typing import Dict, List, Optional, Union from langchain_core._api.deprecation import deprecated from langchain_core.callbacks import ( AsyncCallbackManagerForToolRun, CallbackManagerForToolRun, ) from langchain_core.tools import BaseTool from langchain_community....
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.src.applications.inception_v3 import InceptionV3 as InceptionV3 from keras.src.applications.inception_v3 import ( decode_predictions as decode_predictions, ) from keras.src.applicatio...
"""DO NOT EDIT. This file was autogenerated. Do not edit it by hand, since your modifications would be overwritten. """ from keras.src.applications.inception_v3 import InceptionV3 from keras.src.applications.inception_v3 import decode_predictions from keras.src.applications.inception_v3 import preprocess_input
from typing import List, Optional import pytest from langchain_core.documents import Document from langchain_community.vectorstores import SQLiteVec from tests.integration_tests.vectorstores.fake_embeddings import ( FakeEmbeddings, fake_texts, ) def _sqlite_vec_from_texts( metadatas: Optional[List[dict]...
from typing import List, Optional import pytest from langchain_core.documents import Document from langchain_community.vectorstores import SQLiteVec from tests.integration_tests.vectorstores.fake_embeddings import ( FakeEmbeddings, fake_texts, ) def _sqlite_vec_from_texts( metadatas: Optional[List[dict]...
"""Base argparser module for Pod and Deployment runtime""" import argparse import os from jina.enums import PollingType from jina.helper import random_identity from jina.parsers.helper import _SHOW_ALL_ARGS, add_arg_group def mixin_essential_parser(parser): """Mixing in arguments required by every module into th...
"""Base argparser module for Pod and Deployment runtime""" import argparse import os from jina.enums import PollingType from jina.helper import random_identity from jina.parsers.helper import _SHOW_ALL_ARGS, add_arg_group def mixin_essential_parser(parser): """Mixing in arguments required by every module into th...
""" Demo for using xgboost with sklearn =================================== """ import multiprocessing from sklearn.datasets import fetch_california_housing from sklearn.model_selection import GridSearchCV import xgboost as xgb if __name__ == "__main__": print("Parallel Parameter optimization") X, y = fetch...
""" Demo for using xgboost with sklearn =================================== """ import multiprocessing from sklearn.datasets import fetch_california_housing from sklearn.model_selection import GridSearchCV import xgboost as xgb if __name__ == "__main__": print("Parallel Parameter optimization") X, y = fetch_...
from langchain_core.documents import Document from langchain_core.language_models import FakeListChatModel from langchain.retrievers.document_compressors import LLMChainExtractor def test_llm_chain_extractor() -> None: documents = [ Document( page_content=( "The sky is blue. C...
from langchain_core.documents import Document from langchain_core.language_models import FakeListChatModel from langchain.retrievers.document_compressors import LLMChainExtractor def test_llm_chain_extractor() -> None: documents = [ Document( page_content=( "The sky is blue. C...
from enum import Enum from typing import Callable, List, Union from numpy import ndarray from torch import Tensor from .util import ( cos_sim, dot_score, euclidean_sim, manhattan_sim, pairwise_cos_sim, pairwise_dot_score, pairwise_euclidean_sim, pairwise_manhattan_sim, ) class Simila...
from enum import Enum from typing import Callable, Union from numpy import ndarray from torch import Tensor from .util import ( cos_sim, dot_score, euclidean_sim, manhattan_sim, pairwise_cos_sim, pairwise_dot_score, pairwise_euclidean_sim, pairwise_manhattan_sim, ) class SimilarityFu...
import types from typing import TYPE_CHECKING from docarray.utils._internal.misc import ( _get_path_from_docarray_root_level, import_library, ) if TYPE_CHECKING: from docarray.index.backends.elastic import ElasticDocIndex # noqa: F401 from docarray.index.backends.elasticv7 import ElasticV7DocIndex #...
import types from typing import TYPE_CHECKING from docarray.utils._internal.misc import ( _get_path_from_docarray_root_level, import_library, ) if TYPE_CHECKING: from docarray.index.backends.elastic import ElasticV7DocIndex # noqa: F401 from docarray.index.backends.hnswlib import HnswDocumentIndex #...
# Copyright (c) OpenMMLab. All rights reserved. import time from typing import Any, Optional, Sequence, Tuple, Union from mmengine.data import BaseDataElement from mmengine.registry import HOOKS from .hook import Hook DATA_BATCH = Optional[Sequence[Tuple[Any, BaseDataElement]]] @HOOKS.register_module() class IterTi...
# Copyright (c) OpenMMLab. All rights reserved. import time from typing import Any, Optional, Sequence, Tuple, Union from mmengine.data import BaseDataElement from mmengine.registry import HOOKS from .hook import Hook DATA_BATCH = Optional[Sequence[Tuple[Any, BaseDataElement]]] @HOOKS.register_module() class IterTi...
_base_ = 'cascade-mask-rcnn_regnetx-3.2GF_fpn_ms-3x_coco.py' model = dict( backbone=dict( type='RegNet', arch='regnetx_800mf', out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch', ini...
_base_ = 'cascade_mask_rcnn_regnetx-3.2GF_fpn_mstrain_3x_coco.py' model = dict( backbone=dict( type='RegNet', arch='regnetx_800mf', out_indices=(0, 1, 2, 3), frozen_stages=1, norm_cfg=dict(type='BN', requires_grad=True), norm_eval=True, style='pytorch', ...
from hypothesis import given, note, settings, strategies import xgboost as xgb from xgboost import testing as tm pytestmark = tm.timeout(20) parameter_strategy = strategies.fixed_dictionaries({ 'booster': strategies.just('gblinear'), 'eta': strategies.floats(0.01, 0.25), 'tolerance': strategies.floats(1...
from hypothesis import given, note, settings, strategies import xgboost as xgb from xgboost import testing as tm pytestmark = tm.timeout(20) parameter_strategy = strategies.fixed_dictionaries({ 'booster': strategies.just('gblinear'), 'eta': strategies.floats(0.01, 0.25), 'tolerance': strategies.floats(1...
"""Simple Reader that loads text relevant to a certain search keyword from subreddits.""" from typing import List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class RedditReader(BaseReader): """ Subreddit post and top-level comments reader for R...
"""Simple Reader that loads text relevant to a certain search keyword from subreddits.""" from typing import List, Optional from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class RedditReader(BaseReader): """ Subreddit post and top-level comments reader for Re...
import csv import pathlib from typing import Any, Callable, Optional, Union import PIL from .folder import make_dataset from .utils import download_and_extract_archive, verify_str_arg from .vision import VisionDataset class GTSRB(VisionDataset): """`German Traffic Sign Recognition Benchmark (GTSRB) <https://ben...
import csv import pathlib from typing import Any, Callable, Optional, Tuple, Union import PIL from .folder import make_dataset from .utils import download_and_extract_archive, verify_str_arg from .vision import VisionDataset class GTSRB(VisionDataset): """`German Traffic Sign Recognition Benchmark (GTSRB) <http...
from typing import Optional import numpy as np import pytest import torch from pydantic.tools import parse_obj_as, schema_json_of from docarray import BaseDocument from docarray.base_document.io.json import orjson_dumps from docarray.typing import ( AudioNdArray, NdArray, VideoNdArray, VideoTorchTenso...
from typing import Optional import numpy as np import pytest import torch from pydantic.tools import parse_obj_as, schema_json_of from docarray import BaseDocument from docarray.base_document.io.json import orjson_dumps from docarray.typing import ( AudioNdArray, NdArray, VideoNdArray, VideoTorchTenso...
from pathlib import Path from typing import Any, Callable, Optional, Tuple, Union import PIL.Image from .folder import make_dataset from .utils import download_and_extract_archive, verify_str_arg from .vision import VisionDataset class RenderedSST2(VisionDataset): """`The Rendered SST2 Dataset <https://github.c...
from pathlib import Path from typing import Any, Callable, Optional, Tuple import PIL.Image from .folder import make_dataset from .utils import download_and_extract_archive, verify_str_arg from .vision import VisionDataset class RenderedSST2(VisionDataset): """`The Rendered SST2 Dataset <https://github.com/open...
import logging from datasets import load_dataset from sentence_transformers import SparseEncoder from sentence_transformers.sparse_encoder.evaluation import SparseTripletEvaluator logging.basicConfig(format="%(message)s", level=logging.INFO) # Load a model model = SparseEncoder("naver/splade-cocondenser-ensembledis...
import logging from datasets import load_dataset from sentence_transformers.sparse_encoder import ( SparseEncoder, SparseTripletEvaluator, ) logging.basicConfig(format="%(message)s", level=logging.INFO) # Load a model model = SparseEncoder("naver/splade-cocondenser-ensembledistil") # Load triplets from the...
from __future__ import annotations try: from typing import Self except ImportError: from typing_extensions import Self import torch from torch import nn from sentence_transformers.models.Module import Module class LSTM(Module): """Bidirectional LSTM running over word embeddings.""" config_keys: li...
from __future__ import annotations import json import os import torch from safetensors.torch import load_model as load_safetensors_model from safetensors.torch import save_model as save_safetensors_model from torch import nn class LSTM(nn.Module): """Bidirectional LSTM running over word embeddings.""" def ...
"""Callback Handler streams to stdout on new llm token.""" from __future__ import annotations import sys from typing import TYPE_CHECKING, Any from typing_extensions import override from langchain_core.callbacks.base import BaseCallbackHandler if TYPE_CHECKING: from langchain_core.agents import AgentAction, Ag...
"""Callback Handler streams to stdout on new llm token.""" from __future__ import annotations import sys from typing import TYPE_CHECKING, Any from typing_extensions import override from langchain_core.callbacks.base import BaseCallbackHandler if TYPE_CHECKING: from langchain_core.agents import AgentAction, Ag...
"""Zendesk reader.""" import json from typing import List from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class ZendeskReader(BaseReader): """ Zendesk reader. Reads data from a Zendesk workspace. Args: zendesk_subdomain (str): Zendesk subdomain ...
"""Zendesk reader.""" import json from typing import List from llama_index.core.readers.base import BaseReader from llama_index.core.schema import Document class ZendeskReader(BaseReader): """Zendesk reader. Reads data from a Zendesk workspace. Args: zendesk_subdomain (str): Zendesk subdomain ...