code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging A: Union[str, Any] = logging.get_logger(__name__) A: int = { "s-JoL/Open-Llama-V1": "https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json", } class SCREAMING_S...
160
"""simple docstring""" from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax imp...
645
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) A = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except Optional...
187
"""simple docstring""" import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, ...
645
0
import unittest from transformers import BigBirdConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax from transformers.models.big_bird...
622
"""simple docstring""" import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis from lavis.models import load_model_and_preprocess from PIL import Image from transfo...
645
0
"""simple docstring""" from tempfile import TemporaryDirectory from unittest import TestCase from unittest.mock import MagicMock, patch from transformers import AutoModel, TFAutoModel from transformers.onnx import FeaturesManager from transformers.testing_utils import SMALL_MODEL_IDENTIFIER, require_tf, require_to...
644
"""simple docstring""" import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable,...
645
0
"""simple docstring""" import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prep...
115
"""simple docstring""" # This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for ...
645
0
from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge UpperCamelCase__ =[ 'Prosecutor: "No videos were used in the crash investigation" German papers say they saw a cell phone video of the' ' fi...
249
"""simple docstring""" import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( lowercase ): """simple docstring""" def __init_...
645
0
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { '''microsoft/markuplm-base''': '''https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json''', '''microsoft/markuplm-large''': ...
84
"""simple docstring""" import os def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' lowerCAmelCase : str = len(grid[0] ) lowerCAmelCase : List[str] = len(SCREAMING_SNAKE_CASE ) lowerCAmelCase : Optional[int] = ...
645
0
from argparse import ArgumentParser from .add_new_model import AddNewModelCommand from .add_new_model_like import AddNewModelLikeCommand from .convert import ConvertCommand from .download import DownloadCommand from .env import EnvironmentCommand from .lfs import LfsCommands from .pt_to_tf import PTtoTFCom...
628
"""simple docstring""" import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import...
645
0
import numpy as np UpperCamelCase__ = [ ["a", "b", "c", "d", "e"], ["f", "g", "h", "i", "k"], ["l", "m", "n", "o", "p"], ["q", "r", "s", "t", "u"], ["v", "w", "x", "y", "z"], ] class __SCREAMING_SNAKE_CASE : def __init__( self ): UpperCa...
619
"""simple docstring""" # Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar lowerCAmelCase__ = TypeVar('''T''') class SCREAMING_SNAKE_CASE__ ( Ge...
645
0
"""simple docstring""" import multiprocessing from typing import TYPE_CHECKING, Optional, Union from .. import Dataset, Features, config from ..formatting import query_table from ..packaged_modules.sql.sql import Sql from ..utils import logging from .abc import AbstractDatasetInputStream ...
58
"""simple docstring""" from sklearn.metrics import fa_score import datasets lowerCAmelCase__ = ''' The F1 score is the harmonic mean of the precision and recall. It can be computed with the equation: F1 = 2 * (precision * recall) / (precision + recall) ''' lowerCAmelCase__ = ''' Args: ...
645
0
SCREAMING_SNAKE_CASE_ : Dict = range(2, 20 + 1) SCREAMING_SNAKE_CASE_ : List[Any] = [10**k for k in range(ks[-1] + 1)] SCREAMING_SNAKE_CASE_ : List[str] = {} def SCREAMING_SNAKE_CASE ( snake_case , snake_case , snake_case , snake_case ) -> ...
375
"""simple docstring""" from ...processing_utils import ProcessorMixin class SCREAMING_SNAKE_CASE__ ( lowercase ): """simple docstring""" a : int ="SpeechT5FeatureExtractor" a : Any ="SpeechT5Tokenizer" def __init__( self , snake_case...
645
0
"""simple docstring""" import math def _snake_case ( UpperCamelCase : int ): UpperCAmelCase : Union[str, Any] = [] UpperCAmelCase : Optional[Any] = 2 UpperCAmelCase : int = int(math.sqrt(UpperCamelCase ) ) # Size of every segment UpperCAmelCase ...
160
"""simple docstring""" import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def a__ ( ): '''simple docstring''' print("Making key files..." ) make_key_files("rsa" , 1_0_2_...
645
0
from __future__ import annotations import bisect def a(lowercase__ , lowercase__ , lowercase__ = 0 , lowercase__ = -1 ): '''simple docstring''' if hi < 0: snake_case_ = len(lowercase__ ) while lo < hi: snake_case_ = lo + (hi - lo) // 2 if sorted_c...
187
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, TensorType lowe...
645
0
def _lowerCAmelCase ( A__ , A__ ): lowercase__ = len(A__ ) lowercase__ = len(A__ ) lowercase__ = ( first_str_length if first_str_length > second_str_length else second_str_length ) lowercase__ = [] for char_count in range(A__ ): ...
622
"""simple docstring""" import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class SCREAMING_SNAKE_CASE__ ( lowercase ): """simple docstring""" a : int ="Speech2TextFeatureExtractor" a : int ="Speech...
645
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tensorflow_text_available, is_torch_available __lowerCAmelCase : Any = { "configuration_ernie": ["ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP", "ErnieConfig", "ErnieOnnxConfig...
644
"""simple docstring""" import inspect import unittest from transformers import YolosConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import...
645
0
"""simple docstring""" from math import sqrt def A_ (__a ): '''simple docstring''' assert isinstance(__a , __a ) and ( number >= 0 ), "'number' must been an int and positive" A_ = True # 0 and 1 are none primes. if number <= 1: A_...
115
"""simple docstring""" import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope="session" ) def a__ ( ): ...
645
0
from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable UpperCamelCase__ ={'configuration_dpt': ['DPT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'DPTConfig']} try: if not is_vis...
249
"""simple docstring""" import sys lowerCAmelCase__ = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''12540698747158523863050715693290963295227443043557''' ...
645
0
from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar UpperCAmelCase = TypeVar('''T''') class A_ ( Generic[T] ): '''simple docstring''' def __init__( self , snake_case = True ): lowercase = {} # dictionary of li...
84
"""simple docstring""" from string import ascii_uppercase lowerCAmelCase__ = {str(ord(c) - 55): c for c in ascii_uppercase} def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : int ): '''simple docstring''' if isinstance(SCREAMING...
645
0
from collections.abc import Sequence def lowerCAmelCase( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ )-> List[str]: """simple docstring""" return sum(c * (x**i) for i, c in enumerate(SCREAMING_SNAKE_CASE_ ) ) def lowerCAmelCase( SCREA...
628
"""simple docstring""" from __future__ import annotations def a__ ( SCREAMING_SNAKE_CASE : list[float] , SCREAMING_SNAKE_CASE : list[float] ): '''simple docstring''' lowerCAmelCase : int = sorted(numsa + numsa ) lowerCAmelCase , ...
645
0
from typing import List, Optional, TypeVar from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets from .dataset_dict import DatasetDict, IterableDatasetDict from .info import DatasetInfo from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _i...
619
"""simple docstring""" from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ =...
645
0
"""simple docstring""" import os import string import sys __lowerCAmelCase : Any = 1 << 8 __lowerCAmelCase : int = { '''tab''': ord('''\t'''), '''newline''': ord('''\r'''), '''esc''': 27, '''up''': 65 + ARROW_KEY_FLAG...
58
"""simple docstring""" import unittest from transformers import LiltConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_commo...
645
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE_ : int = {'''configuration_xglm''': [''...
375
"""simple docstring""" from random import randint, random def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : bool = False , SCREAMING_SNAKE_CASE : ...
645
0
"""simple docstring""" import os from pathlib import Path def _snake_case ( UpperCamelCase : str , UpperCamelCase : List[Any] , UpperCamelCase : Dict , UpperCamelCase : Dict ): UpperCAmelCase : Optional[int] = { "en": "Machine learning i...
160
"""simple docstring""" from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax imp...
645
0
import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): impo...
187
"""simple docstring""" import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, ...
645
0
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : int = logging.get_logger(__name__) a__ : Optional[Any] = { "google/vivit-b-16x2-kinetics400": ( "https://huggingface.co/google/vivit-b-16x2-kinetics400/resolve/main/config.json" ...
622
"""simple docstring""" import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis from lavis.models import load_model_and_preprocess from PIL import Image from transfo...
645
0
"""simple docstring""" from string import ascii_uppercase __lowerCAmelCase : str = {str(ord(c) - 55): c for c in ascii_uppercase} def _UpperCAmelCase ( lowerCamelCase__ , lowerCamelCase__ ): """simple docstring""" if isinstance(lowerCamelCase__ , lowerCame...
644
"""simple docstring""" import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable,...
645
0
"""simple docstring""" import functools from typing import Any def A_ (__a , __a ): '''simple docstring''' if not isinstance(__a , __a ) or len(__a ) == 0: raise ValueError("the string should be not empty string" ) if not isinstance(__a , __a ) ...
115
"""simple docstring""" # This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for ...
645
0
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, resize, to_channel_...
249
"""simple docstring""" import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor lowerCAmelCase__ = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( lowercase ): """simple docstring""" def __init_...
645
0
import os import sys import unittest UpperCAmelCase = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, '''utils''')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_object, find_backend, r...
84
"""simple docstring""" import os def a__ ( SCREAMING_SNAKE_CASE : int ): '''simple docstring''' lowerCAmelCase : str = len(grid[0] ) lowerCAmelCase : List[str] = len(SCREAMING_SNAKE_CASE ) lowerCAmelCase : Optional[int] = ...
645
0
import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def lowerCAmelCase( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_=5 )-> Union[str, Any]: """simple docstring""" a...
628
"""simple docstring""" import os import tempfile import unittest from transformers import DistilBertConfig, is_torch_available from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import...
645
0
import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_backbone_common import B...
619
"""simple docstring""" # Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar lowerCAmelCase__ = TypeVar('''T''') class SCREAMING_SNAKE_CASE__ ( Ge...
645
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available __lowerCAmelCase : Union[str, Any] = { '''configuration_rag''': ['''RagConfig'''], '''retrieval_ra...
58
"""simple docstring""" from sklearn.metrics import fa_score import datasets lowerCAmelCase__ = ''' The F1 score is the harmonic mean of the precision and recall. It can be computed with the equation: F1 = 2 * (precision * recall) / (precision + recall) ''' lowerCAmelCase__ = ''' Args: ...
645
0
from .testing import ( are_the_same_tensors, execute_subprocess_async, require_bnb, require_cpu, require_cuda, require_huggingface_suite, require_mps, require_multi_gpu, require_multi_xpu, require_safetensors, require_single_gpu, require_single_xpu, require_torc...
375
"""simple docstring""" from ...processing_utils import ProcessorMixin class SCREAMING_SNAKE_CASE__ ( lowercase ): """simple docstring""" a : int ="SpeechT5FeatureExtractor" a : Any ="SpeechT5Tokenizer" def __init__( self , snake_case...
645
0
"""simple docstring""" from __future__ import annotations from typing import Any def _snake_case ( UpperCamelCase : list[Any] ): create_state_space_tree(UpperCamelCase , [] , 0 ) def _snake_case ( UpperCamelCase : list[Any] , UpperCamelCase : list[Any] , ...
160
"""simple docstring""" import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def a__ ( ): '''simple docstring''' print("Making key files..." ) make_key_files("rsa" , 1_0_2_...
645
0
from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline A = logging.get_logger(__name__) # pylint: disable=invalid-name class SCREAMING_SNAKE_CASE ( __snake_case ): """simpl...
187
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, TensorType lowe...
645
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a__ : int = { "configuration_blip_2": [ "BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP", "Blip2Config", "Blip2QFormerConfig", "Blip2VisionConfig", ...
622
"""simple docstring""" import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class SCREAMING_SNAKE_CASE__ ( lowercase ): """simple docstring""" a : int ="Speech2TextFeatureExtractor" a : int ="Speech...
645
0
"""simple docstring""" from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class a_ ( __UpperCamelCase ): UpperCamelCase_ : List[Any] = ["image_processor", "tokenizer"] UpperCamelCase_ : Dict = "AutoImageProcessor"...
644
"""simple docstring""" import inspect import unittest from transformers import YolosConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import...
645
0
"""simple docstring""" import random import unittest import numpy as np from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionImgaImgPipeline, PNDMScheduler, ) from diffusers.utils import flo...
115
"""simple docstring""" import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope="session" ) def a__ ( ): ...
645
0
from __future__ import annotations def lowerCamelCase__ (__lowerCamelCase ): if len(__lowerCamelCase ) == 0: return [] _SCREAMING_SNAKE_CASE : Optional[Any] = min(__lowerCamelCase ), max(__lowerCamelCase ) _SCREAMING_SNAKE_C...
249
"""simple docstring""" import sys lowerCAmelCase__ = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''12540698747158523863050715693290963295227443043557''' ...
645
0
import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis from lavis.models import load_model_and_preprocess from PIL import Image from transformers import ( AutoTokenizer...
84
"""simple docstring""" from string import ascii_uppercase lowerCAmelCase__ = {str(ord(c) - 55): c for c in ascii_uppercase} def a__ ( SCREAMING_SNAKE_CASE : int , SCREAMING_SNAKE_CASE : int ): '''simple docstring''' if isinstance(SCREAMING...
645
0
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int = 100 ) -> int: '''simple docstring''' __lowerCamelCase : Tuple = 0 __lowerCamelCase : Dict = 0 for i in range(1 , n + 1 ): sum_of_squares += i**2 sum_of_int...
646
"""simple docstring""" import math def lowercase_ ( _lowerCamelCase: int ) -> list[int]: '''simple docstring''' __lowerCamelCase : Optional[int] = [] __lowerCamelCase : Tuple = 2 __lowerCamelCase : str = int(math.sqrt(_lowerCamelCase ) ...
646
1
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int = 1000000 ) -> int: '''simple docstring''' __lowerCamelCase : str = 1 __lowerCamelCase : Dict = 1 __lowerCamelCase : Optional[Any] = {1: 1} for inputa in range(2 , _lowe...
646
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers i...
646
1
"""simple docstring""" from pathlib import Path import fire from tqdm import tqdm def lowercase_ ( _lowerCamelCase: List[str]="ro" , _lowerCamelCase: List[str]="en" , _lowerCamelCase: List[str]="wmt16" , _lowerCamelCase: List[str]=None ) -> None: '''simple docstring...
646
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer __A = log...
646
1
"""simple docstring""" # Imports import numpy as np class _snake_case : def __init__( self : Union[str, Any] , UpperCAmelCase : Dict=None , UpperCAmelCase : Any=None , UpperCAmelCase : Optional[int]=None , UpperCAmelCase : ...
646
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __A = logging.get_logger(__name__) class _snake_case ( a__ ): def __init__( self : Optional[Any] , *UpperCAmelCase : int , **...
646
1
"""simple docstring""" from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo __A = '''\ @misc{wu2016googles, title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation}, author={Yonghui...
646
"""simple docstring""" import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp...
646
1
"""simple docstring""" import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed f...
646
"""simple docstring""" from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("repo_id" , ["canonical_dataset_name", "org-name/dataset-name"] ) @pytest.mark.parametrize("path" , ["filename.csv", "filename with blanks.csv"] ) @pytest.mark.parame...
646
1
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
646
"""simple docstring""" import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class _snake_case ( ctypes.Structure ): # _fields is a specific attr expected by ctypes snake_case__ = [("...
646
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_ima...
646
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTe...
646
1
"""simple docstring""" from __future__ import annotations __A = list[tuple[int, int]] __A = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], ...
646
"""simple docstring""" def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float ) -> float: '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(F"""{price_plus_tax(100, 0.25) = }""") print(F"""{price_plus_tax(1_25.50, 0.05) =...
646
1
"""simple docstring""" import unittest from transformers import XLMConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common impo...
646
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_ima...
646
1
"""simple docstring""" import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_to...
646
"""simple docstring""" import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require...
646
1
"""simple docstring""" from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class _snake_case ( a__ ): def __init__( self : Union[str, Any] , UpperCAmelCas...
646
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''naver-clova-ix/donut-base''': '''https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json''', # See all Donut models at https://h...
646
1
"""simple docstring""" __A = {} def lowercase_ ( _lowerCamelCase: int , _lowerCamelCase: int , _lowerCamelCase: int ) -> int: '''simple docstring''' if late == 3 or absent == 2: return 0 # if we have no days left, and have not failed any oth...
646
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''SenseTime/deformable-detr''': '''https://huggingface.co/sensetime/deformable-detr/resolve/main/config.j...
646
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''xlm-roberta-base''': '''https://huggingface.co/xlm-robe...
646
"""simple docstring""" import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowercase_ ( _lowerCamelCase: Any , _lowerCamelCase: int , _lowerCamelCase: Union[str, Any] ) ...
646
1
"""simple docstring""" import argparse import shutil import time from json import JSONDecodeError from logging import getLogger from pathlib import Path from typing import Dict, List import torch from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTok...
646
"""simple docstring""" import math from collections.abc import Iterator from itertools import takewhile def lowercase_ ( _lowerCamelCase: int ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or n...
646
1
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''SenseTime/deformable-detr''': '''https://huggingface.co/sensetime/deformable-detr/resolve/main/config.j...
646
"""simple docstring""" from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge __A = [ '''Prosecutor: "No videos were used in the crash investigation" German papers say they saw a cell phone video of t...
646
1
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''microsoft/unispeech-sat-base-100h-libri-ft''': ( '''https://huggingface.co/microsoft/unispeech-sat-base-100h...
646
"""simple docstring""" from manim import * class _snake_case ( a__ ): def lowerCamelCase__ ( self : str ): __lowerCamelCase : Tuple = Rectangle(height=0.5 , width=0.5 ) __lowerCamelCase : Dict = Rectangle(height=...
646
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''unc-nlp/lxmert-base-uncased''': '''https://huggingface.co/unc-nlp/lxmert-base-uncased/resolve/main/config.json''', } class _snake_case ( a__...
646
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
646
1
"""simple docstring""" import unittest from transformers import CamembertTokenizer, CamembertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import is_torch_available from ...test_tokenization_common import TokenizerTeste...
646
"""simple docstring""" import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 __A = 0b101100111110110010010000011110111011000110011110 # bin(x)...
646
1
"""simple docstring""" import argparse import json from dataclasses import dataclass, field from functools import partial from pathlib import Path from typing import List import timm import torch import torch.nn as nn from huggingface_hub import hf_hub_download from torch import Tensor from transformers import A...
646
"""simple docstring""" # Imports import numpy as np class _snake_case : def __init__( self : Union[str, Any] , UpperCAmelCase : Dict=None , UpperCAmelCase : Any=None , UpperCAmelCase : Optional[int]=None , UpperCAmelCase : ...
646
1
"""simple docstring""" import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokeniz...
646
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...te...
646
1
"""simple docstring""" import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) __A = pytest.mark.integration @pytest.mark.parametrize("path" , ["paws", "csv"...
646
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backbo...
646
1
"""simple docstring""" import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor __A = logging.getLogger(__name__) __A = 50 # max width of layer names...
646
"""simple docstring""" import math def lowercase_ ( _lowerCamelCase: int ) -> list[int]: '''simple docstring''' __lowerCamelCase : Optional[int] = [] __lowerCamelCase : Tuple = 2 __lowerCamelCase : str = int(math.sqrt(_lowerCamelCase ) ...
646
1
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging if TYPE_CHECKING: from ... import FeatureExtractionMixin, PreTrainedToken...
646
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers i...
646
1
"""simple docstring""" import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, require...
646
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer __A = log...
646
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_...
646
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __A = logging.get_logger(__name__) class _snake_case ( a__ ): def __init__( self : Optional[Any] , *UpperCAmelCase : int , **...
646
1
"""simple docstring""" import math from datetime import datetime, timedelta def lowercase_ ( _lowerCamelCase: int ) -> datetime: '''simple docstring''' __lowerCamelCase : str = year % 19 __lowerCamelCase : Dict = year % 4 __lowerCamelCase : L...
646
"""simple docstring""" import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp...
646
1
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int , _lowerCamelCase: list[int] , _lowerCamelCase: int ) -> int: '''simple docstring''' def count_of_possible_combinations(_lowerCamelCase: int ) -> int: if target < 0: ...
646
"""simple docstring""" from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("repo_id" , ["canonical_dataset_name", "org-name/dataset-name"] ) @pytest.mark.parametrize("path" , ["filename.csv", "filename with blanks.csv"] ) @pytest.mark.parame...
646
1
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTe...
646
"""simple docstring""" import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class _snake_case ( ctypes.Structure ): # _fields is a specific attr expected by ctypes snake_case__ = [("...
646
1
"""simple docstring""" from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch...
646
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTe...
646
1
"""simple docstring""" from bisect import bisect from itertools import accumulate def lowercase_ ( _lowerCamelCase: Tuple , _lowerCamelCase: str , _lowerCamelCase: List[Any] , _lowerCamelCase: Union[str, Any] ) -> Any: '''simple docstring''' __lowerCamelCase ...
646
"""simple docstring""" def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float ) -> float: '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(F"""{price_plus_tax(100, 0.25) = }""") print(F"""{price_plus_tax(1_25.50, 0.05) =...
646
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, DDIMScheduler, LDMTextToImagePipeline, UNetaDConditionModel from diffusers.utils.testing_utils import ( enable_full_deter...
646
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_ima...
646
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __A = { '''configuration_git''': ['''GIT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GitConfig''', '''GitVisionConfig'''], '''processing_git''': ['''GitProcessor'''],...
646
"""simple docstring""" import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require...
646
1
"""simple docstring""" import unittest from transformers import TrOCRConfig from transformers.testing_utils import is_torch_available, require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import M...
646
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''naver-clova-ix/donut-base''': '''https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json''', # See all Donut models at https://h...
646
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''s-JoL/Open-Llama-V1''': '''https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json''', } class _snake_case ( a__ ): snake_ca...
646
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''SenseTime/deformable-detr''': '''https://huggingface.co/sensetime/deformable-detr/resolve/main/config.j...
646
1
"""simple docstring""" def lowercase_ ( _lowerCamelCase: list[int] ) -> list[list[int]]: '''simple docstring''' __lowerCamelCase : Optional[Any] = [] if len(_lowerCamelCase ) == 1: return [nums.copy()] for _ in range(len(_lowerCamelCase ) ):...
646
"""simple docstring""" import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowercase_ ( _lowerCamelCase: Any , _lowerCamelCase: int , _lowerCamelCase: Union[str, Any] ) ...
646
1
"""simple docstring""" def lowercase_ ( _lowerCamelCase: int , _lowerCamelCase: int ) -> int: '''simple docstring''' __lowerCamelCase : Any = 1 # To kept the Calculated Value # Since C(n, k) = C(n, n-k) if k > (n - k): __lowerCamelCase ...
646
"""simple docstring""" import math from collections.abc import Iterator from itertools import takewhile def lowercase_ ( _lowerCamelCase: int ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or n...
646
1
"""simple docstring""" def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float ) -> float: '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(F"""{price_plus_tax(100, 0.25) = }""") print(F"""{price_plus_tax(1_25.50, 0.05) =...
646
"""simple docstring""" from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge __A = [ '''Prosecutor: "No videos were used in the crash investigation" German papers say they saw a cell phone video of t...
646
1
"""simple docstring""" # Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar __A = TypeVar('''T''') class _snake_case ( Generic[T] ): def __init__...
646
"""simple docstring""" from manim import * class _snake_case ( a__ ): def lowerCamelCase__ ( self : str ): __lowerCamelCase : Tuple = Rectangle(height=0.5 , width=0.5 ) __lowerCamelCase : Dict = Rectangle(height=...
646
1
"""simple docstring""" from __future__ import annotations __A = 1.6_0_2_1e-1_9 # units = C def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float , _lowerCamelCase: float , ) -> tuple[str, float]: '''simple docstring''' if (conductivity, electron_con...
646
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
646
1
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backbo...
646
"""simple docstring""" import numpy as np import torch from imwatermark import WatermarkEncoder # Copied from https://github.com/Stability-AI/generative-models/blob/613af104c6b85184091d42d374fef420eddb356d/scripts/demo/streamlit_helpers.py#L66 __A = 0b101100111110110010010000011110111011000110011110 # bin(x)...
646
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __A = { '''configuration_blip''': [ '''BLIP_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Bli...
646
"""simple docstring""" # Imports import numpy as np class _snake_case : def __init__( self : Union[str, Any] , UpperCAmelCase : Dict=None , UpperCAmelCase : Any=None , UpperCAmelCase : Optional[int]=None , UpperCAmelCase : ...
646
1
"""simple docstring""" import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCLIPTextConfig, XCLIPVisio...
646
"""simple docstring""" from __future__ import annotations import inspect import unittest import numpy as np from transformers import DeiTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...te...
646
1
"""simple docstring""" class _snake_case : def __init__( self : Tuple , UpperCAmelCase : Union[str, Any] ): # we need a list not a string, so do something to change the type __lowerCamelCase : Optional[Any] = arr.split("," ) ...
646
"""simple docstring""" import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backbo...
646
1
"""simple docstring""" import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, AdamW, ...
646
"""simple docstring""" import math def lowercase_ ( _lowerCamelCase: int ) -> list[int]: '''simple docstring''' __lowerCamelCase : Optional[int] = [] __lowerCamelCase : Tuple = 2 __lowerCamelCase : str = int(math.sqrt(_lowerCamelCase ) ...
646
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers i...
646
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from transformers i...
646
1
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaControlnetImgaImgPipeline, KandinskyVaaPriorEmbaEmbPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import flo...
646
"""simple docstring""" import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer __A = log...
646
1
"""simple docstring""" __A = 256 # Modulus to hash a string __A = 1000003 def lowercase_ ( _lowerCamelCase: str , _lowerCamelCase: str ) -> bool: '''simple docstring''' __lowerCamelCase : Optional[int] = len(_lowerCamelCase ) __lowerCamelCase ...
646
"""simple docstring""" import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor __A = logging.get_logger(__name__) class _snake_case ( a__ ): def __init__( self : Optional[Any] , *UpperCAmelCase : int , **...
646
1
"""simple docstring""" from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import D...
646
"""simple docstring""" import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fsspec_head, ftp...
646
1
"""simple docstring""" import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import numpy as np import pandas as pd from datasets import load_dataset import transformers from transformers import ( AutoConfig, BartForSequence...
646
"""simple docstring""" from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize("repo_id" , ["canonical_dataset_name", "org-name/dataset-name"] ) @pytest.mark.parametrize("path" , ["filename.csv", "filename with blanks.csv"] ) @pytest.mark.parame...
646
1
"""simple docstring""" import argparse import json from tqdm import tqdm def lowercase_ ( ) -> List[str]: '''simple docstring''' __lowerCamelCase : Tuple = argparse.ArgumentParser() # Required parameters parser.add_argument( "--src_path" , type=_lowe...
646
"""simple docstring""" import os import sys from contextlib import contextmanager # Windows only if os.name == "nt": import ctypes import msvcrt # noqa class _snake_case ( ctypes.Structure ): # _fields is a specific attr expected by ctypes snake_case__ = [("...
646
1
"""simple docstring""" from typing import Dict, Optional import numpy as np import datasets __A = ''' IoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union between the predicted segmentation and the ground truth. For binary (two classes) or multi-cl...
646
"""simple docstring""" import unittest from typing import Dict, List, Optional, Union import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTe...
646
1
"""simple docstring""" from typing import Any class _snake_case : def __init__( self : str , UpperCAmelCase : Any ): __lowerCamelCase : Tuple = data __lowerCamelCase : List[Any] = None def __repr__( se...
646
"""simple docstring""" def lowercase_ ( _lowerCamelCase: float , _lowerCamelCase: float ) -> float: '''simple docstring''' return price * (1 + tax_rate) if __name__ == "__main__": print(F"""{price_plus_tax(100, 0.25) = }""") print(F"""{price_plus_tax(1_25.50, 0.05) =...
646
1
"""simple docstring""" import argparse import math import traceback import dateutil.parser as date_parser import requests def lowercase_ ( _lowerCamelCase: Union[str, Any] ) -> Any: '''simple docstring''' __lowerCamelCase : Union[str, Any] = {} __lowerCamelCase ...
646
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import AutoencoderKL, CycleDiffusionPipeline, DDIMScheduler, UNetaDConditionModel from diffusers.utils import floats_tensor, load_ima...
646
1
"""simple docstring""" import json import os import unittest from typing import Tuple from transformers import WavaVecaPhonemeCTCTokenizer from transformers.models.wavaveca.tokenization_wavaveca import VOCAB_FILES_NAMES from transformers.models.wavaveca_phoneme.tokenization_wavaveca_phoneme import WavaVecaPhoneme...
646
"""simple docstring""" import shutil import tempfile import unittest from transformers import ClapFeatureExtractor, ClapProcessor, RobertaTokenizer, RobertaTokenizerFast from transformers.testing_utils import require_sentencepiece, require_torchaudio from .test_feature_extraction_clap import floats_list @require...
646
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __A = { '''configuration_nezha''': ['''NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''NezhaConfig'''], } try: if not is_torch_available()...
646
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''naver-clova-ix/donut-base''': '''https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json''', # See all Donut models at https://h...
646
1
"""simple docstring""" __A = { '''A''': '''.-''', '''B''': '''-...''', '''C''': '''-.-.''', '''D''': '''-..''', '''E''': '''.''', '''F''': '''..-.''', '''G''': '''--.''', '''H''': '''....''', '''I''': '''..''', '''J''': '''.---''', '''K''': '''-.-''', '''L''': '''.-..''', '''M''': '''--''', '''N''': ''...
646
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __A = logging.get_logger(__name__) __A = { '''SenseTime/deformable-detr''': '''https://huggingface.co/sensetime/deformable-detr/resolve/main/config.j...
646
1
"""simple docstring""" from __future__ import annotations import math import random from typing import Any class _snake_case : def __init__( self : int ): __lowerCamelCase : list[Any] = [] __lowerCamelCase : int = 0 __lowe...
646
"""simple docstring""" import argparse import torch from ...utils import logging from . import AlbertConfig, AlbertForPreTraining, load_tf_weights_in_albert logging.set_verbosity_info() def lowercase_ ( _lowerCamelCase: Any , _lowerCamelCase: int , _lowerCamelCase: Union[str, Any] ) ...
646
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { '''naver-clova-ix/donut-base''': '''https://huggingface.co/naver-clova-ix/donut-base/resolve/main/config.json''', # See all Donut models at https://h...
646
"""simple docstring""" import math from collections.abc import Iterator from itertools import takewhile def lowercase_ ( _lowerCamelCase: int ) -> bool: '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or n...
646
1
"""simple docstring""" import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __A = logging.get_logger(__name__) class _snake_case ( a__ ): snake_case__ = ["input_ids", "attenti...
646
"""simple docstring""" from collections import defaultdict from pathlib import Path import pandas as pd from rouge_cli import calculate_rouge_path from utils import calculate_rouge __A = [ '''Prosecutor: "No videos were used in the crash investigation" German papers say they saw a cell phone video of t...
646
1