id
stringlengths
19
21
content
stringlengths
722
86.7k
evocodebench_data_101
import logging from typing import List, Optional, Any from agents.agent_lifecycle import AgentLifecycle from agents.agent_similarity import AgentSimilarity from agents.agent_persistence_manager import AgentPersistenceManager from integrations.openaiwrapper import OpenAIAPIWrapper logger= logging.getLogger() class ...
evocodebench_data_102
import logging from typing import List from agents.microagent import MicroAgent from integrations.openaiwrapper import OpenAIAPIWrapper from agents.agent_similarity import AgentSimilarity from agents.agent_persistence_manager import AgentPersistenceManager from numpy import ndarray from prompt_management.prompts import...
evocodebench_data_103
import sqlite3 import json from integrations.agent_persistence import AbstractAgentPersistence class SQLiteAgentPersistence(AbstractAgentPersistence): def __init__(self, filename="agents.db"): self.filename = filename self._initialize_database() def _initialize_database(self): """ ...
evocodebench_data_104
import sqlite3 import json from integrations.agent_persistence import AbstractAgentPersistence class SQLiteAgentPersistence(AbstractAgentPersistence): def __init__(self, filename="agents.db"): self.filename = filename self._initialize_database() def _initialize_database(self): """ ...
evocodebench_data_105
import sqlite3 import json from integrations.agent_persistence import AbstractAgentPersistence class SQLiteAgentPersistence(AbstractAgentPersistence): def __init__(self, filename="agents.db"): self.filename = filename self._initialize_database() def _initialize_database(self): """ ...
evocodebench_data_106
import sqlite3 import hashlib import json import functools ## Originally from https://www.kevinkatz.io/posts/memoize-to-sqlite def memoize_to_sqlite(func_name: str, filename: str = "cache.db"): """ Memoization decorator that caches the output of a method in a SQLite database. """ def decorator(fun...
evocodebench_data_107
import sqlite3 import hashlib import json import functools ## Originally from https://www.kevinkatz.io/posts/memoize-to-sqlite def memoize_to_sqlite(func_name: str, filename: str = "cache.db"): """ Memoization decorator that caches the output of a method in a SQLite database. """ def decorator(fun...
evocodebench_data_108
import os from contextlib import redirect_stdout import argparse from copy import deepcopy from XAgent.config import CONFIG, ARGS from command import CommandLine, CommandLineParam def parse_args() -> argparse.Namespace: """ Parse the command line arguments and return them as an argparse.Namespace object. ...
evocodebench_data_109
import json import openai from XAgent.logs import logger from XAgent.config import CONFIG, get_apiconfig_by_model, get_model_name from tenacity import ( retry, stop_after_attempt, wait_exponential, retry_if_not_exception_type, wait_chain, wait_none, ) import importlib.metadata as metadata if m...
evocodebench_data_110
import os from time import time from typing import Any, Optional from litdata.constants import _BOTO3_AVAILABLE, _IS_IN_STUDIO if _BOTO3_AVAILABLE: import boto3 import botocore from botocore.credentials import InstanceMetadataProvider from botocore.utils import InstanceMetadataFetcher class S3Client...
evocodebench_data_111
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_112
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_113
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_114
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_115
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_116
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_117
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_118
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_119
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_120
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_121
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_122
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_123
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_124
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_125
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_126
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_127
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_128
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_129
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_130
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_131
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_132
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_133
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_134
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_135
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_136
import datetime import os import re import sys from dataclasses import dataclass from pathlib import Path from time import sleep from typing import Optional, Union from urllib import parse from lightning_cloud.openapi import V1CloudSpace from lightning_cloud.rest_client import LightningClient # To avoid adding lightn...
evocodebench_data_137
import datetime import os import re import sys from dataclasses import dataclass from pathlib import Path from time import sleep from typing import Optional, Union from urllib import parse from lightning_cloud.openapi import V1CloudSpace from lightning_cloud.rest_client import LightningClient # To avoid adding lightn...
evocodebench_data_138
import datetime import os import re import sys from dataclasses import dataclass from pathlib import Path from time import sleep from typing import Optional, Union from urllib import parse from lightning_cloud.openapi import V1CloudSpace from lightning_cloud.rest_client import LightningClient # To avoid adding lightn...
evocodebench_data_139
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_140
import datetime import os import re import sys from dataclasses import dataclass from pathlib import Path from time import sleep from typing import Optional, Union from urllib import parse from lightning_cloud.openapi import V1CloudSpace from lightning_cloud.rest_client import LightningClient # To avoid adding lightn...
evocodebench_data_141
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_142
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_143
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_144
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_145
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_146
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_147
from typing import Any, List, Tuple import numpy as np from litdata.utilities.env import _DistributedEnv def _intra_node_chunk_shuffle( distributed_env: _DistributedEnv, chunks_per_ranks: List[List[int]], seed: int, current_epoch: int, ) -> List[int]: chunk_indexes_per_nodes: Any = [[] for _ in ...
evocodebench_data_148
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_149
import io import os import urllib from contextlib import contextmanager from subprocess import DEVNULL, Popen from typing import Any, Callable, List, Optional, Tuple, Union from litdata.constants import _IS_IN_STUDIO, _LIGHTNING_CLOUD_LATEST if _LIGHTNING_CLOUD_LATEST: from lightning_cloud.openapi import ( ...
evocodebench_data_150
from typing import Any, List, Tuple import numpy as np from litdata.utilities.env import _DistributedEnv def _intra_node_chunk_shuffle( distributed_env: _DistributedEnv, chunks_per_ranks: List[List[int]], seed: int, current_epoch: int, ) -> List[int]: chunk_indexes_per_nodes: Any = [[] for _ in ...
evocodebench_data_151
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_152
import concurrent import json import logging import os import random import shutil import signal import tempfile import traceback import types from abc import abstractmethod from dataclasses import dataclass from multiprocessing import Process, Queue from pathlib import Path from queue import Empty from time import sle...
evocodebench_data_153
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_154
# Copyright The Lightning AI team. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writi...
evocodebench_data_155
import concurrent import json import logging import os import random import shutil import signal import tempfile import traceback import types from abc import abstractmethod from dataclasses import dataclass from multiprocessing import Process, Queue from pathlib import Path from queue import Empty from time import sle...
evocodebench_data_156
import concurrent import json import logging import os import random import shutil import signal import tempfile import traceback import types from abc import abstractmethod from dataclasses import dataclass from multiprocessing import Process, Queue from pathlib import Path from queue import Empty from time import sle...
evocodebench_data_157
import concurrent import json import logging import os import random import shutil import signal import tempfile import traceback import types from abc import abstractmethod from dataclasses import dataclass from multiprocessing import Process, Queue from pathlib import Path from queue import Empty from time import sle...
evocodebench_data_158
import concurrent import json import logging import os import random import shutil import signal import tempfile import traceback import types from abc import abstractmethod from dataclasses import dataclass from multiprocessing import Process, Queue from pathlib import Path from queue import Empty from time import sle...
evocodebench_data_159
import concurrent import json import logging import os import random import shutil import signal import tempfile import traceback import types from abc import abstractmethod from dataclasses import dataclass from multiprocessing import Process, Queue from pathlib import Path from queue import Empty from time import sle...
evocodebench_data_160
import concurrent import json import logging import os import random import shutil import signal import tempfile import traceback import types from abc import abstractmethod from dataclasses import dataclass from multiprocessing import Process, Queue from pathlib import Path from queue import Empty from time import sle...
evocodebench_data_161
import concurrent import json import logging import os import random import shutil import signal import tempfile import traceback import types from abc import abstractmethod from dataclasses import dataclass from multiprocessing import Process, Queue from pathlib import Path from queue import Empty from time import sle...
evocodebench_data_162
from typing import Literal import torch from torch import nn class NetworkWithSkipLayers(torch.nn.Module): def __init__(self, skip_layers, output_layers) -> None: super().__init__() self.skip_layers = skip_layers self.output_layers = output_layers def forward(self, x): input ...
evocodebench_data_163
from typing import List, Tuple import numpy as np from pydantic import Field from iris.io.class_configs import Algorithm from iris.io.dataclasses import EyeCenters, GeometryPolygons from iris.io.errors import GeometryRefinementError from iris.utils import math class Smoothing(Algorithm): """Implementation of co...
evocodebench_data_164
from typing import List, Optional, Tuple import numpy as np from iris.io.dataclasses import IrisTemplate from iris.io.errors import MatcherError def normalized_HD(irisbitcount: int, maskbitcount: int, sqrt_totalbitcount: float, nm_dist: float) -> float: """Perform normalized HD calculation. Args: i...
evocodebench_data_165
from typing import Tuple import numpy as np from pydantic import Field from iris.io.class_configs import Algorithm from iris.io.dataclasses import EyeCenters, GeometryPolygons from iris.io.errors import EyeCentersEstimationError class BisectorsMethod(Algorithm): """Implementation of eye's center estimation algo...
evocodebench_data_166
import abc from copy import deepcopy from typing import Any, List import pydantic from pydantic import Extra from iris.callbacks.callback_interface import Callback class ImmutableModel(pydantic.BaseModel): """Specifies configurations for validating classes which objects should be immutable.""" class Config...
evocodebench_data_167
import abc from collections import defaultdict import collections import typing from collections import deque import dataclasses import inspect import json from dataclasses import is_dataclass from typing import get_origin, get_args, Any, Mapping, MutableMapping, OrderedDict, Literal, Union, get_type_hints, \ Type,...
evocodebench_data_168
import inspect from typing import get_type_hints, Literal, get_origin, Tuple, Callable, Optional, Dict, Union import json from tanuki.models.embedding import Embedding from tanuki.models.function_description import FunctionDescription from tanuki.models.function_type import FunctionType from tanuki.utils import get_sou...
evocodebench_data_169
import hashlib import logging import math import numpy as np from bitarray import bitarray from tanuki.persistence.filter.bloom_interface import IBloomFilterPersistence class BloomFilter: def __init__(self, persistence: IBloomFilterPersistence, size=None, hash...
evocodebench_data_170
import hashlib import logging import math import numpy as np from bitarray import bitarray from tanuki.persistence.filter.bloom_interface import IBloomFilterPersistence class BloomFilter: def __init__(self, persistence: IBloomFilterPersistence, size=None, hash...
evocodebench_data_171
import hashlib import logging import math import numpy as np from bitarray import bitarray from tanuki.persistence.filter.bloom_interface import IBloomFilterPersistence class BloomFilter: def __init__(self, persistence: IBloomFilterPersistence, size=None, hash...
evocodebench_data_172
from pydantic import BaseModel from typing import Dict, List from tanuki.language_models.llm_configs.abc_base_config import BaseModelConfig from tanuki.language_models.llm_configs import DEFAULT_TEACHER_MODELS, DEFAULT_STUDENT_MODELS from tanuki.constants import DEFAULT_TEACHER_MODEL_NAMES, DEFAULT_DISTILLED_MODEL_NAME...
evocodebench_data_173
from typing import List import logging import time # import abstract base class from openai import OpenAI from openai.types import CreateEmbeddingResponse from openai.types.fine_tuning import FineTuningJob from tanuki.language_models.llm_finetune_api_abc import LLM_Finetune_API from tanuki.models.embedding import Emb...
evocodebench_data_174
"""Tools module""" # Copyright (c) 2023 # Author: Hugo Delatte <delatte.hugo@gmail.com> # License: BSD 3 clause # Implementation derived from: # Riskfolio-Lib, Copyright (c) 2020-2023, Dany Cajas, Licensed under BSD 3 clause. # Statsmodels, Copyright (C) 2006, Jonathan E. Taylor, Licensed under BSD 3 clause. from enu...
evocodebench_data_175
"""Tools module""" # Copyright (c) 2023 # Author: Hugo Delatte <delatte.hugo@gmail.com> # License: BSD 3 clause # Implementation derived from: # Riskfolio-Lib, Copyright (c) 2020-2023, Dany Cajas, Licensed under BSD 3 clause. # Statsmodels, Copyright (C) 2006, Jonathan E. Taylor, Licensed under BSD 3 clause. from enu...
evocodebench_data_176
import json from typing import Any, Dict from tanuki.function_modeler import FunctionModeler from tanuki.language_models.llm_api_abc import LLM_API from tanuki.models.function_description import FunctionDescription from tanuki.models.function_example import FunctionExample from tanuki.models.language_model_output impo...
evocodebench_data_177
"""Tools module""" # Copyright (c) 2023 # Author: Hugo Delatte <delatte.hugo@gmail.com> # License: BSD 3 clause # Implementation derived from: # Riskfolio-Lib, Copyright (c) 2020-2023, Dany Cajas, Licensed under BSD 3 clause. # Statsmodels, Copyright (C) 2006, Jonathan E. Taylor, Licensed under BSD 3 clause. from enu...
evocodebench_data_178
"""Datasets module.""" # Copyright (c) 2023 # Author: Hugo Delatte <delatte.hugo@gmail.com> # License: BSD 3 clause # Implementation derived from: # scikit-portfolio, Copyright (c) 2022, Carlo Nicolini, Licensed under MIT Licence. # scikit-learn, Copyright (c) 2007-2010 David Cournapeau, Fabian Pedregosa, Olivier # Gr...
evocodebench_data_179
# Copyright (c) Facebook, Inc. and its affiliates. import collections from dataclasses import dataclass from typing import Callable, List, Optional, Tuple import torch from torch import nn from detectron2.structures import Boxes, Instances, ROIMasks from detectron2.utils.registry import _convert_target_to_string, loca...
evocodebench_data_180
"""Equation module""" # Copyright (c) 2023 # Author: Hugo Delatte <delatte.hugo@gmail.com> # License: BSD 3 clause import re import warnings import numpy as np import numpy.typing as npt from skfolio.exceptions import EquationToMatrixError, GroupNotFoundError __all__ = ["equations_to_matrix"] def equations_to_ma...
evocodebench_data_181
# Copyright (c) Facebook, Inc. and its affiliates. import os import sys import tempfile from contextlib import ExitStack, contextmanager from copy import deepcopy from unittest import mock import torch from torch import nn # need some explicit imports due to https://github.com/pytorch/pytorch/issues/38964 import dete...
evocodebench_data_182
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. """ Common data processing utilities that are used in a typical object detection data pipeline. """ import logging import numpy as np from typing import List, Union import pycocotools.mask as mask_util import torch from PIL import Image from d...
evocodebench_data_183
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. """ Common data processing utilities that are used in a typical object detection data pipeline. """ import logging import numpy as np from typing import List, Union import pycocotools.mask as mask_util import torch from PIL import Image from d...
evocodebench_data_184
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. """ See "Data Augmentation" tutorial for an overview of the system: https://detectron2.readthedocs.io/tutorials/augmentation.html """ import numpy as np import torch import torch.nn.functional as F from fvcore.transforms.transform import ( ...
evocodebench_data_185
# Copyright (c) Facebook, Inc. and its affiliates. # -*- coding: utf-8 -*- import typing from typing import Any, List import fvcore from fvcore.nn import activation_count, flop_count, parameter_count, parameter_count_table from torch import nn from detectron2.export import TracingAdapter __all__ = [ "activation_...
evocodebench_data_186
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. """ See "Data Augmentation" tutorial for an overview of the system: https://detectron2.readthedocs.io/tutorials/augmentation.html """ import numpy as np import torch import torch.nn.functional as F from fvcore.transforms.transform import ( ...
evocodebench_data_187
# Copyright (c) Facebook, Inc. and its affiliates. import colorsys import logging import math from enum import Enum, unique import cv2 import matplotlib as mpl import matplotlib.colors as mplc import matplotlib.figure as mplfigure import numpy as np import pycocotools.mask as mask_util import torch from detectron2.dat...
evocodebench_data_188
# Copyright (c) Facebook, Inc. and its affiliates. import colorsys import logging import math from enum import Enum, unique import cv2 import matplotlib as mpl import matplotlib.colors as mplc import matplotlib.figure as mplfigure import numpy as np import pycocotools.mask as mask_util import torch from detectron2.dat...
evocodebench_data_189
# Copyright (c) Facebook, Inc. and its affiliates. import colorsys import logging import math from enum import Enum, unique import cv2 import matplotlib as mpl import matplotlib.colors as mplc import matplotlib.figure as mplfigure import numpy as np import pycocotools.mask as mask_util import torch from detectron2.dat...
evocodebench_data_190
# Copyright (c) Facebook, Inc. and its affiliates. import colorsys import logging import math from enum import Enum, unique import cv2 import matplotlib as mpl import matplotlib.colors as mplc import matplotlib.figure as mplfigure import numpy as np import pycocotools.mask as mask_util import torch from detectron2.dat...
evocodebench_data_191
# Copyright (c) Facebook, Inc. and its affiliates. import io import numpy as np import torch from detectron2 import model_zoo from detectron2.config import CfgNode, instantiate from detectron2.data import DatasetCatalog from detectron2.data.detection_utils import read_image from detectron2.modeling import build_model ...
evocodebench_data_192
# Copyright (c) Facebook, Inc. and its affiliates. import math from typing import List, Tuple import torch from detectron2.layers.rotated_boxes import pairwise_iou_rotated from .boxes import Boxes class RotatedBoxes(Boxes): """ This structure stores a list of rotated boxes as a Nx5 torch.Tensor. It supp...
evocodebench_data_193
# Copyright (c) Facebook, Inc. and its affiliates. from detectron2.utils.registry import Registry PROPOSAL_GENERATOR_REGISTRY = Registry("PROPOSAL_GENERATOR") PROPOSAL_GENERATOR_REGISTRY.__doc__ = """ Registry for proposal generator, which produces object proposals from feature maps. The registered object will be cal...
evocodebench_data_194
# Copyright (c) Facebook, Inc. and its affiliates. import logging from typing import Dict, List, Tuple, Union import torch from torch import nn from torch.nn import functional as F from detectron2.config import configurable from detectron2.layers import ShapeSpec, batched_nms, cat, cross_entropy, nonzero_tuple from de...
evocodebench_data_195
#!/usr/bin/env python3 # Copyright 2004-present Facebook. All Rights Reserved. from ..structures import Instances from detectron2.utils.registry import Registry from ..config.config import CfgNode as CfgNode_ from detectron2.config import configurable TRACKER_HEADS_REGISTRY = Registry("TRACKER_HEADS") TRACKER_HEADS_R...
evocodebench_data_196
# Copyright (c) Facebook, Inc. and its affiliates. import math from typing import List, Tuple, Union import torch from fvcore.nn import giou_loss, smooth_l1_loss from torch.nn import functional as F from detectron2.layers import cat, ciou_loss, diou_loss from detectron2.structures import Boxes # Value for clamping la...
evocodebench_data_197
# -*- coding: utf-8 -*- # Copyright (c) Alibaba, Inc. and its affiliates. import cv2 import numpy as np def resize_image(input_image, resolution): H, W, C = input_image.shape H = float(H) W = float(W) k = float(resolution) / min(H, W) H *= k W *= k H = int(np.round(H / 64.0)) * 64 W = ...
evocodebench_data_198
from collections import defaultdict from math import log import string def update_url_scores(old: dict[str, float], new: dict[str, float]): for url, score in new.items(): if url in old: old[url] += score else: old[url] = score return old def normalize_string(input_str...
evocodebench_data_199
from collections import defaultdict from math import log import string def update_url_scores(old: dict[str, float], new: dict[str, float]): for url, score in new.items(): if url in old: old[url] += score else: old[url] = score return old def normalize_string(input_str...
evocodebench_data_200
# Copyright (c) Facebook, Inc. and its affiliates. import math from typing import List, Tuple import torch from detectron2.layers.rotated_boxes import pairwise_iou_rotated from .boxes import Boxes class RotatedBoxes(Boxes): """ This structure stores a list of rotated boxes as a Nx5 torch.Tensor. It supp...