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
import math import os import sys def UpperCamelCase ( snake_case__ : str ) -> str: UpperCamelCase : Tuple = '' try: with open(snake_case__ , 'rb' ) as binary_file: UpperCamelCase : Dict = binary_file.read() for...
40
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_confi...
126
0
'''simple docstring''' import math import os import unittest from transformers import MegatronBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configur...
41
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A: Optional[int] = { """configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""], } try: if not is_torch_avail...
126
0
'''simple docstring''' def _UpperCamelCase ( __UpperCamelCase = 1_00_00_00 ) -> int: lowerCamelCase_ = 1 lowerCamelCase_ = 1 lowerCamelCase_ = {1: 1} for inputa in range(2 ,__UpperCamelCase ): lowerCamelCase_ = 0 lower...
42
'''simple docstring''' import os from datetime import datetime as dt from github import Github _A: Any = [ """good first issue""", """feature request""", """wip""", ] def _lowerCAmelCase ( )-> Optional[int]: __UpperCAmelCase = Github(os.environ['GITHUB_TOKEN...
126
0
from datetime import datetime import matplotlib.pyplot as plt import torch def _a ( SCREAMING_SNAKE_CASE ): """simple docstring""" for param in module.parameters(): lowercase__ = False def _a ( ): """simple docstring""" lowercase__ = '''cuda''...
43
'''simple docstring''' from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): ...
126
0
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers.testing_utils import require_vision from transformers.utils import is_vision_available if is_vision_available(): from PIL import Image from transformers import AutoProcessor, BlipaProces...
44
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> bool: return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(_lowerCAmelCase ) ) def _lowerCAmelCase ( _lowerCAme...
126
0
import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def A ( lowercase__ : Optional[Any] ) -> Any: Up...
45
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase = " " )-> list: __UpperCAmelCase = [] __UpperCAmelCase = 0 for index, char in enumerate(_lowerCAmelCase ): if char == separator: split_words.append(string[last_index:index] ) __Uppe...
126
0
"""simple docstring""" import os from distutils.util import strtobool def lowerCamelCase_( _lowerCamelCase , _lowerCamelCase ) -> List[str]: '''simple docstring''' for e in env_keys: _lowerCamelCase : List[Any] = int(os.environ.get(_lowerCamelCase ...
46
'''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, ...
126
0
import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPrior...
47
'''simple docstring''' from __future__ import annotations _A: Tuple = list[list[int]] # assigning initial values to the grid _A: Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0]...
126
0
'''simple docstring''' import re def A ( UpperCamelCase_ : str ) -> str: '''simple docstring''' if len(re.findall("[ATCG]" , UpperCamelCase_ ) ) != len(UpperCamelCase_ ): raise ValueError("Invalid Strand" ) return dna.translate(dna.maketrans("A...
48
'''simple docstring''' import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor _A: Any = logging.get_logger(__name__) class UpperCAmelCase ( UpperCAmelCase_ ): def __init__( self , *__A , **__A ): ...
126
0
"""simple docstring""" import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, P...
49
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision...
126
0
'''simple docstring''' from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effe...
50
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase )-> bool: __UpperCAmelCase = len(_lowerCAmelCase ) # We need to create solution object to save path. __UpperCAmelCase = [[0 for _ in range(_lowerCAmelCase )] for _ in range(_lo...
126
0
'''simple docstring''' import string def __snake_case ( SCREAMING_SNAKE_CASE_ : str ) -> str: """simple docstring""" UpperCAmelCase = '''''' for i in sequence: UpperCAmelCase = ord(SCREAMING_SNAKE_CASE_ ) if 65 <= extract <= 90: ...
51
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING _A: List[str] = logging.get_...
126
0
"""simple docstring""" import numpy as np import torch from torch.nn import CrossEntropyLoss from transformers import AutoModelForCausalLM, AutoTokenizer import datasets from datasets import logging A = '''\ ''' A = ''' Perplexity (PPL) is one of the most common ...
52
'''simple docstring''' import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency _A: Optional[Any] = { """E""": 12.70, """T""": 9.06, """A""": 8.17, """O""": 7.51, """I""": 6.97, """N""": 6.75, """S""": 6.33, """H""": 6.09, """R...
126
0
def a_ ( lowerCAmelCase_ : str, lowerCAmelCase_ : str ): def get_matched_characters(lowerCAmelCase_ : str, lowerCAmelCase_ : str ) -> str: __lowerCAmelCase = [] __lowerCAmelCase = min(len(_stra ), len(_stra ...
53
'''simple docstring''' from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class UpperCAmelCase ( UpperCAmelCase_ ): _A : Optional[int] = CustomTokenizer pass
126
0
import os from typing import Dict, List, Union import tensorflow as tf from keras_nlp.tokenizers import BytePairTokenizer from tensorflow_text import pad_model_inputs from .tokenization_gpta import GPTaTokenizer class A ( tf.keras.layers.Layer ): def __init__( s...
54
'''simple docstring''' import re from filelock import FileLock try: import nltk _A: Optional[int] = True except (ImportError, ModuleNotFoundError): _A: Dict = False if NLTK_AVAILABLE: with FileLock(""".lock""") as lock: nltk.download("""punkt"...
126
0
from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, flip_channel_order, get_resize_output_image_size, rescale, resize, to_channel_dimension...
55
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase = 10_00 )-> int: __UpperCAmelCase = 2**power __UpperCAmelCase = 0 while n: __UpperCAmelCase , __UpperCAmelCase = r + n % 10, n // 10 return r if __name__ == "__main__": print(solution(int(str(input())....
126
0
'''simple docstring''' from pickle import UnpicklingError import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict from ..utils import logging _a : List[Any] = logging.get_logger(__name__) def _a (lowe...
56
'''simple docstring''' from typing import Any import numpy as np def _lowerCAmelCase ( _lowerCAmelCase )-> bool: return np.array_equal(_lowerCAmelCase , matrix.conjugate().T ) def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> Any: __UpperCAmel...
126
0
from ...utils import ( OptionalDependencyNotAvailable, is_flax_available, is_torch_available, is_transformers_available, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable:...
57
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
126
0
"""simple docstring""" import importlib import math import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Tuple, Union import flax import jax.numpy as jnp from ..utils import BaseOutput __lowerCAmelCase : Tuple ...
58
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class UpperCAmelCase ( UpperCAmelCase_ ...
126
0
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 = { "YituTech/conv-bert-base": "https://huggingface.co/YituTec...
59
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _A: List[Any] = datasets.load_iris() _A: Union[str, Any] = np.array(data["""data"""]) _A: Union[str, Any] ...
126
0
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class __lowerCAmelCase : lowerCamelCase_ : Any = None def lowerCamelCase (self ) -> Optional[int]: '''simple docstring''' snake_case_ : ...
60
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def _lowerCAmelCase ( _lowerCAmelCase="ro" , _lowerCAmelCase="en" , _lowerCAmelCase="wmt16" , _lowerCAmelCase=None )-> None: try: import datasets except (ModuleNotFoundError, Imp...
126
0
import argparse import os import shutil from pathlib import Path import onnx import torch from packaging import version from torch.onnx import export from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, StableDiffusionPipeline UpperCamelCase = version.parse(version.pars...
61
'''simple docstring''' import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_...
126
0
import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow snake_case = False class SCREAMING_SNAKE_CASE ( unittest.TestCase ): '''simple docstrin...
62
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_confi...
126
0
class a : """simple docstring""" def __init__( self : List[str] ) -> None: __UpperCAmelCase : dict[str, TrieNode] = {} # Mapping from char to TrieNode __UpperCAmelCase : List[str] = False def UpperCAmel...
63
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A: Optional[int] = { """configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""], } try: if not is_torch_avail...
126
0
from __future__ import annotations from collections.abc import Callable from typing import Any, Generic, TypeVar lowercase_ : Tuple = TypeVar('T') class _lowerCamelCase ( Generic[T] ): def __init__( self , lowerCAmelCase , lowerCAmelCase ) -> None: SCREAMING_SNAKE...
64
'''simple docstring''' import os from datetime import datetime as dt from github import Github _A: Any = [ """good first issue""", """feature request""", """wip""", ] def _lowerCAmelCase ( )-> Optional[int]: __UpperCAmelCase = Github(os.environ['GITHUB_TOKEN...
126
0
"""simple docstring""" from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable __UpperCAmelCase = {'configuration_gpt_neox': ['GPT_NEOX_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTNeoXConf...
65
'''simple docstring''' from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): ...
126
0
import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debug.metrics as met class lowerCAmel...
66
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> bool: return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(_lowerCAmelCase ) ) def _lowerCAmelCase ( _lowerCAme...
126
0
from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependency...
67
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase = " " )-> list: __UpperCAmelCase = [] __UpperCAmelCase = 0 for index, char in enumerate(_lowerCAmelCase ): if char == separator: split_words.append(string[last_index:index] ) __Uppe...
126
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "google/realm-cc-news-pretrained-embedder": ( "https://huggingface.co/google/realm-cc-news-pretrained-embedder/resolve/main/config.json" ), "google/realm-cc-n...
68
'''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, ...
126
0
'''simple docstring''' import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def __Upper...
69
'''simple docstring''' from __future__ import annotations _A: Tuple = list[list[int]] # assigning initial values to the grid _A: Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0]...
126
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase : Dict = { "configuration_xlm_roberta_xl": [ "XLM_ROBERTA_XL_PRETRAINED_CONFIG_ARCHIVE_MAP", "XLMRobertaXLConfig", ...
70
'''simple docstring''' import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor _A: Any = logging.get_logger(__name__) class UpperCAmelCase ( UpperCAmelCase_ ): def __init__( self , *__A , **__A ): ...
126
0
'''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, ) _lowerCamelCase = pytest.mark.integration @pytest.mark...
71
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision...
126
0
'''simple docstring''' from maths.prime_check import is_prime def UpperCamelCase ( lowercase_ : int ) -> int: '''simple docstring''' if not isinstance(lowercase_ , lowercase_ ): lowercase =f'Input value of [number={number}] must be an integer' raise TypeError(l...
72
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase )-> bool: __UpperCAmelCase = len(_lowerCAmelCase ) # We need to create solution object to save path. __UpperCAmelCase = [[0 for _ in range(_lowerCAmelCase )] for _ in range(_lo...
126
0
import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger a_ : Optional[Any] = get_logger(__name__) a_ : Dict = R'\n Args:\n input_ids (`jnp.ndarray` of shape `(batch_si...
73
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING _A: List[str] = logging.get_...
126
0
from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def a__ ( snake_case = True , *snake_case , **snake_case ): """simple docstring""" if not is_tqdm_available(): raise ImportErro...
74
'''simple docstring''' import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency _A: Optional[Any] = { """E""": 12.70, """T""": 9.06, """A""": 8.17, """O""": 7.51, """I""": 6.97, """N""": 6.75, """S""": 6.33, """H""": 6.09, """R...
126
0
'''simple docstring''' import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def a__ ( lowerCAmelCase__ , lowerCAmelCase__ , lowerC...
75
'''simple docstring''' from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class UpperCAmelCase ( UpperCAmelCase_ ): _A : Optional[int] = CustomTokenizer pass
126
0
"""simple docstring""" import os from pathlib import Path def __UpperCAmelCase ( ): from torch.utils.cpp_extension import load __lowercase : List[Any] = Path(__UpperCamelCase ).resolve().parent.parent.parent / '''kernels''' / '''deformable_detr''' ...
76
'''simple docstring''' import re from filelock import FileLock try: import nltk _A: Optional[int] = True except (ImportError, ModuleNotFoundError): _A: Dict = False if NLTK_AVAILABLE: with FileLock(""".lock""") as lock: nltk.download("""punkt"...
126
0
"""simple docstring""" def _UpperCamelCase ( UpperCamelCase ) -> list: """simple docstring""" __UpperCAmelCase : List[Any] = len(UpperCamelCase ) for _ in range(UpperCamelCase ): for i in range(_ % 2 , arr_size - 1 , ...
77
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase = 10_00 )-> int: __UpperCAmelCase = 2**power __UpperCAmelCase = 0 while n: __UpperCAmelCase , __UpperCAmelCase = r + n % 10, n // 10 return r if __name__ == "__main__": print(solution(int(str(input())....
126
0
'''simple docstring''' import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, ...
78
'''simple docstring''' from typing import Any import numpy as np def _lowerCAmelCase ( _lowerCAmelCase )-> bool: return np.array_equal(_lowerCAmelCase , matrix.conjugate().T ) def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> Any: __UpperCAmel...
126
0
import unittest import torch from torch import nn from diffusers.models.activations import get_activation class UpperCAmelCase_ ( unittest.TestCase ): def __UpperCAmelCase ( self ): UpperCAmelCase__ : Any = get_activation("""swi...
79
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
126
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer __UpperCamelCase : Union[str, Any] = {"""vocab_file""": """vocab.txt""", """tokenizer_file""": ...
80
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class UpperCAmelCase ( UpperCAmelCase_ ...
126
0
def lowerCAmelCase_ ( __lowerCamelCase = 1_0_0_0_0_0_0 ): __snake_case : Dict = set(range(3 , __lowerCamelCase , 2 ) ) primes.add(2 ) for p in range(3 , __lowerCamelCase , 2 ): if p not in primes: ...
81
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _A: List[Any] = datasets.load_iris() _A: Union[str, Any] = np.array(data["""data"""]) _A: Union[str, Any] ...
126
0
"""simple docstring""" from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_ava...
82
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def _lowerCAmelCase ( _lowerCAmelCase="ro" , _lowerCAmelCase="en" , _lowerCAmelCase="wmt16" , _lowerCAmelCase=None )-> None: try: import datasets except (ModuleNotFoundError, Imp...
126
0
"""simple docstring""" import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from acceler...
83
'''simple docstring''' import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_...
126
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { '''facebook/data2vec...
84
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_confi...
126
0
import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class snake_case ( UpperCamelCase_ ): lowercase_ = (DPMSolverSDESched...
85
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A: Optional[int] = { """configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""], } try: if not is_torch_avail...
126
0
from ..utils import DummyObject, requires_backends class _a ( metaclass=snake_case_ ): """simple docstring""" _lowerCamelCase : Optional[Any] = ['torch', 'transformers', 'onnx'] def __init__( self : str , *UpperCAmelCase ...
86
'''simple docstring''' import os from datetime import datetime as dt from github import Github _A: Any = [ """good first issue""", """feature request""", """wip""", ] def _lowerCAmelCase ( )-> Optional[int]: __UpperCAmelCase = Github(os.environ['GITHUB_TOKEN...
126
0
import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": _lowerCamelCase : str = pd.read_csv("""sample_data.csv""", header=None) _lowerCamelCa...
87
'''simple docstring''' from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): ...
126
0
"""simple docstring""" import os from pathlib import Path def _snake_case ( ): """simple docstring""" from torch.utils.cpp_extension import load _lowerCamelCase : Optional[Any] = Path(__snake_case ).resolve().parent.parent.parent / """kernels""" / """de...
88
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> bool: return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(_lowerCAmelCase ) ) def _lowerCAmelCase ( _lowerCAme...
126
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE : Union[str, Any] = logging.get_logger(__name__) SC...
89
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase = " " )-> list: __UpperCAmelCase = [] __UpperCAmelCase = 0 for index, char in enumerate(_lowerCAmelCase ): if char == separator: split_words.append(string[last_index:index] ) __Uppe...
126
0
'''simple docstring''' from __future__ import annotations __UpperCAmelCase = [] def _snake_case ( A , A , A ) -> bool: for i in range(len(A ) ): if board[row][i] == 1: return False for i ...
90
'''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, ...
126
0
"""simple docstring""" # Lint as: python3 import dataclasses import re from dataclasses import dataclass from functools import total_ordering from typing import Optional, Union _lowercase = re.compile(r'''^(?P<major>\d+)''' r'''\.(?P<minor>\d+)''' r'''\.(?P<patch>\d+)$''') @total_ordering @dataclass...
91
'''simple docstring''' from __future__ import annotations _A: Tuple = list[list[int]] # assigning initial values to the grid _A: Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0]...
126
0
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler,...
92
'''simple docstring''' import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor _A: Any = logging.get_logger(__name__) class UpperCAmelCase ( UpperCAmelCase_ ): def __init__( self , *__A , **__A ): ...
126
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) __A = { """configuration_layoutlmv3""": [ """L...
93
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision...
126
0
'''simple docstring''' import argparse import os from . import ( ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BART_PRETRAINED_MODEL_ARCHIVE_LIST, BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, DISTILBERT_PRETRAINED_CONFIG_ARCH...
94
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase )-> bool: __UpperCAmelCase = len(_lowerCAmelCase ) # We need to create solution object to save path. __UpperCAmelCase = [[0 for _ in range(_lowerCAmelCase )] for _ in range(_lo...
126
0
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, Wava...
95
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING _A: List[str] = logging.get_...
126
0
"""simple docstring""" from __future__ import annotations import requests __lowerCamelCase = set( 'approved_at_utc approved_by author_flair_background_color\nauthor_flair_css_class author_flair_richtext author_flair_template_id author_fullname\nauthor_premium can_mod_post cate...
96
'''simple docstring''' import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency _A: Optional[Any] = { """E""": 12.70, """T""": 9.06, """A""": 8.17, """O""": 7.51, """I""": 6.97, """N""": 6.75, """S""": 6.33, """H""": 6.09, """R...
126
0
def a ( ): '''simple docstring''' return 1 def a ( snake_case__: int ): '''simple docstring''' return 0 if x < 0 else two_pence(x - 2 ) + one_pence() def a ( snake_case__: int ): '''simple docstring''' return 0 if x...
97
'''simple docstring''' from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class UpperCAmelCase ( UpperCAmelCase_ ): _A : Optional[int] = CustomTokenizer pass
126
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class __lowerCAmelCase ( metaclass=__magic_name__ ): """simple docstring""" _snake_case : Dict = ['transformers', 'torch', 'note_seq'] def __init__( self : Tuple ...
98
'''simple docstring''' import re from filelock import FileLock try: import nltk _A: Optional[int] = True except (ImportError, ModuleNotFoundError): _A: Dict = False if NLTK_AVAILABLE: with FileLock(""".lock""") as lock: nltk.download("""punkt"...
126
0
import argparse import datetime def a (lowerCAmelCase__ ): __a = { """0""": """Sunday""", """1""": """Monday""", """2""": """Tuesday""", """3""": """Wednesday""", """4""": """Thursday""", """5""": """Friday""", """6""": """Saturday"""...
99
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase = 10_00 )-> int: __UpperCAmelCase = 2**power __UpperCAmelCase = 0 while n: __UpperCAmelCase , __UpperCAmelCase = r + n % 10, n // 10 return r if __name__ == "__main__": print(solution(int(str(input())....
126
0
import json import os import unittest from transformers import AutoTokenizer, GPTaTokenizer, GPTaTokenizerFast from transformers.models.gpta.tokenization_gpta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @requi...
100
'''simple docstring''' from typing import Any import numpy as np def _lowerCAmelCase ( _lowerCAmelCase )-> bool: return np.array_equal(_lowerCAmelCase , matrix.conjugate().T ) def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> Any: __UpperCAmel...
126
0
import asyncio import os import re import sys import tempfile import unittest from contextlib import contextmanager from copy import deepcopy from distutils.util import strtobool from enum import Enum from importlib.util import find_spec from pathlib import Path from unittest.mock import patch impo...
101
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
126
0
"""simple docstring""" import unittest import numpy as np import requests 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 ImageProcessingSavingTestMixin, pr...
102
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class UpperCAmelCase ( UpperCAmelCase_ ...
126
0
"""simple docstring""" import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from...
103
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _A: List[Any] = datasets.load_iris() _A: Union[str, Any] = np.array(data["""data"""]) _A: Union[str, Any] ...
126
0
"""simple docstring""" import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger UpperCamelCase = get_logger(__name__) class UpperCamelCase__ ( enum.Enum ): """simple d...
104
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def _lowerCAmelCase ( _lowerCAmelCase="ro" , _lowerCAmelCase="en" , _lowerCAmelCase="wmt16" , _lowerCAmelCase=None )-> None: try: import datasets except (ModuleNotFoundError, Imp...
126
0
import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging.INFO) UpperCamelCase__ : str =...
105
'''simple docstring''' import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_...
126
0
import os from datetime import datetime as dt from github import Github __snake_case :int =[ 'good first issue', 'feature request', 'wip', ] def lowerCamelCase_ ( ) -> Any: '''simple docstring''' A = Github(os.environ['GITHUB_TOK...
106
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_confi...
126
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _UpperCAmelCase : Any = { '''configuration_maskformer''': ['''MASKFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MaskFormerConf...
107
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A: Optional[int] = { """configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""], } try: if not is_torch_avail...
126
0
import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class SCREAMING_SNAKE_CASE__ ( nn.Module ): '''simple docstring''' _lowerCamelCase = 42 _lowerCamelCase = 4...
108
'''simple docstring''' import os from datetime import datetime as dt from github import Github _A: Any = [ """good first issue""", """feature request""", """wip""", ] def _lowerCAmelCase ( )-> Optional[int]: __UpperCAmelCase = Github(os.environ['GITHUB_TOKEN...
126
0
'''simple docstring''' import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGenerati...
109
'''simple docstring''' from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): ...
126
0
def __a ( A__ : Optional[Any] , A__ : Any ): SCREAMING_SNAKE_CASE = word.split() def justify(A__ : str , A__ : Tuple , A__ : Tuple ) -> str: SCREAMING_SNAKE_CASE = max_width - width SCREAMING_SNAKE_CASE = le...
16
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> bool: return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(_lowerCAmelCase ) ) def _lowerCAmelCase ( _lowerCAme...
126
0
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start_docstrings_t...
439
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase = " " )-> list: __UpperCAmelCase = [] __UpperCAmelCase = 0 for index, char in enumerate(_lowerCAmelCase ): if char == separator: split_words.append(string[last_index:index] ) __Uppe...
126
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __snake_case :Optional[Any] ={"""configuration_yolos""": ["""YOLOS_PRETRAINED_CONFIG_ARCHIVE_MAP""", """YolosConfig""", """YolosOnnxConfig"""]} try: if not ...
106
'''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, ...
126
0
"""simple docstring""" import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def __A ( a_ : Tuple , a_ : Dict , a_ : Tuple )-> Optional[...
698
'''simple docstring''' from __future__ import annotations _A: Tuple = list[list[int]] # assigning initial values to the grid _A: Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0]...
126
0
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision fr...
120
'''simple docstring''' import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor _A: Any = logging.get_logger(__name__) class UpperCAmelCase ( UpperCAmelCase_ ): def __init__( self , *__A , **__A ): ...
126
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenizat...
206
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision...
126
0
import re from filelock import FileLock try: import nltk _UpperCAmelCase = True except (ImportError, ModuleNotFoundError): _UpperCAmelCase = False if NLTK_AVAILABLE: with FileLock(".lock") as lock: nltk.download("punkt", quiet=True) def __UpperCamelCase (lowe...
699
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase )-> bool: __UpperCAmelCase = len(_lowerCAmelCase ) # We need to create solution object to save path. __UpperCAmelCase = [[0 for _ in range(_lowerCAmelCase )] for _ in range(_lo...
126
0
import argparse import importlib from pathlib import Path # Test all the extensions added in the setup __SCREAMING_SNAKE_CASE : Dict = [ """kernels/rwkv/wkv_cuda.cu""", """kernels/rwkv/wkv_op.cpp""", """kernels/deformable_detr/ms_deform_attn.h""", """kernels/deformable_detr/cuda/ms_deform...
348
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING _A: List[str] = logging.get_...
126
0
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from ...utils import logging, randn_tensor from ..pipeline_utils import AudioPipelineOutput, DiffusionPipeline A_ : List[str] =logging.get_logger(__name__) # pylint: disable=invalid-name class __a ( ...
650
'''simple docstring''' import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency _A: Optional[Any] = { """E""": 12.70, """T""": 9.06, """A""": 8.17, """O""": 7.51, """I""": 6.97, """N""": 6.75, """S""": 6.33, """H""": 6.09, """R...
126
0
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __lowercase : Dict = logging.get_logger(__...
476
'''simple docstring''' from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class UpperCAmelCase ( UpperCAmelCase_ ): _A : Optional[int] = CustomTokenizer pass
126
0
'''simple docstring''' import io import itertools import json from dataclasses import dataclass from typing import Optional import pyarrow as pa import pyarrow.json as paj import datasets from datasets.table import table_cast from datasets.utils.file_utils import readline __lowerCAmelCase = datasets.uti...
358
'''simple docstring''' import re from filelock import FileLock try: import nltk _A: Optional[int] = True except (ImportError, ModuleNotFoundError): _A: Dict = False if NLTK_AVAILABLE: with FileLock(""".lock""") as lock: nltk.download("""punkt"...
126
0
import os import tempfile import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from torch import nn from transformers import ( Adafactor, AdamW, get_constant_sched...
16
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase = 10_00 )-> int: __UpperCAmelCase = 2**power __UpperCAmelCase = 0 while n: __UpperCAmelCase , __UpperCAmelCase = r + n % 10, n // 10 return r if __name__ == "__main__": print(solution(int(str(input())....
126
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig a_ : str = { """albert-base-v1""": """https://huggingface.co/albert-base-v1/resolve/main/config.json""", """albert-large-v1""": """https://hugging...
439
'''simple docstring''' from typing import Any import numpy as np def _lowerCAmelCase ( _lowerCAmelCase )-> bool: return np.array_equal(_lowerCAmelCase , matrix.conjugate().T ) def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase )-> Any: __UpperCAmel...
126
0
import argparse import logging from collections import namedtuple import torch from model_bertabs import BertAbsSummarizer from models.model_builder import AbsSummarizer # The authors' implementation from transformers import BertTokenizer logging.basicConfig(level=logging.INFO) __snake_case :str =...
106
'''simple docstring''' # Copyright 2022 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
126
0
"""simple docstring""" import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from transformers import ...
698
'''simple docstring''' import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class UpperCAmelCase ( UpperCAmelCase_ ...
126
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase_ : List[str] = { """configuration_swinv2""": ["""SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Swinv2Config"""], } try: if not is_tor...
120
'''simple docstring''' from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split _A: List[Any] = datasets.load_iris() _A: Union[str, Any] = np.array(data["""data"""]) _A: Union[str, Any] ...
126
0
import math import os import unittest from transformers import MegatronBertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_com...
206
'''simple docstring''' from pathlib import Path import fire from tqdm import tqdm def _lowerCAmelCase ( _lowerCAmelCase="ro" , _lowerCAmelCase="en" , _lowerCAmelCase="wmt16" , _lowerCAmelCase=None )-> None: try: import datasets except (ModuleNotFoundError, Imp...
126
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _UpperCAmelCase = { """configuration_canine""": ["""CANINE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """CanineConfig"""], """tokenization_canine""": ["""Cani...
699
'''simple docstring''' import warnings from typing import Dict import numpy as np from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline if is_tf_available(): from ..models.auto.modeling_tf_auto import TF_...
126
0
from collections.abc import Sequence def UpperCAmelCase__ ( __magic_name__ : Tuple = None ): '''simple docstring''' if nums is None or not nums: raise ValueError('''Input sequence should not be empty''' ) lowerCAmelCase : Any = nums[0] for i in range(1 ...
348
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_confi...
126
0
"""simple docstring""" import os from typing import Dict, List, Union import tensorflow as tf from keras_nlp.tokenizers import BytePairTokenizer from tensorflow_text import pad_model_inputs from .tokenization_gpta import GPTaTokenizer class __a ( tf.keras.layers.Layer ): def __in...
650
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _A: Optional[int] = { """configuration_lilt""": ["""LILT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LiltConfig"""], } try: if not is_torch_avail...
126
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) __lowercase : List[str] = {"""configuration_beit""": ["""BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP"...
476
'''simple docstring''' import os from datetime import datetime as dt from github import Github _A: Any = [ """good first issue""", """feature request""", """wip""", ] def _lowerCAmelCase ( )-> Optional[int]: __UpperCAmelCase = Github(os.environ['GITHUB_TOKEN...
126
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling...
358
'''simple docstring''' from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): ...
126
0
import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..table import array_cast...
16
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase )-> bool: return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(_lowerCAmelCase ) ) def _lowerCAmelCase ( _lowerCAme...
126
0
from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline a_ : Any = logging.get_logger(__name__) @add_end...
439
'''simple docstring''' def _lowerCAmelCase ( _lowerCAmelCase , _lowerCAmelCase = " " )-> list: __UpperCAmelCase = [] __UpperCAmelCase = 0 for index, char in enumerate(_lowerCAmelCase ): if char == separator: split_words.append(string[last_index:index] ) __Uppe...
126
0
def lowerCamelCase_ ( lowerCAmelCase__ : Union[str, Any] , lowerCAmelCase__ : int ) -> str: '''simple docstring''' if number < 0 or shift_amount < 0: raise ValueError('both inputs must be positive integers' ) A = str(bin(_lowerCAmelC...
106
'''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, ...
126
0
"""simple docstring""" from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split lowerCamelCase__ : List[Any] = datasets.load_iris() lowerCamelCase__ : Union[str, Any] = np.array(data["data"]) lowerC...
698
'''simple docstring''' from __future__ import annotations _A: Tuple = list[list[int]] # assigning initial values to the grid _A: Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0]...
126
0
'''simple docstring''' import numpy as np import qiskit def UpperCAmelCase_ ( A = 8 , A = None ): '''simple docstring''' _a : str = np.random.default_rng(seed=_lowerCAmelCase ) # Roughly 25% of the qubits will contribute to the key. # So we take more than we ne...
120
'''simple docstring''' import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor _A: Any = logging.get_logger(__name__) class UpperCAmelCase ( UpperCAmelCase_ ): def __init__( self , *__A , **__A ): ...
126
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _UpperCamelCase : Dict ={ """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenizat...
206
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision...
126
0
from __future__ import annotations from typing import Any class _UpperCAmelCase : '''simple docstring''' def __init__( self : Optional[Any] , UpperCamelCase__ : Any , UpperCamelCase__ : int , UpperCamelCase__ : Union[str, Any] = 0 ): A , ...
699
'''simple docstring''' from __future__ import annotations def _lowerCAmelCase ( _lowerCAmelCase )-> bool: __UpperCAmelCase = len(_lowerCAmelCase ) # We need to create solution object to save path. __UpperCAmelCase = [[0 for _ in range(_lowerCAmelCase )] for _ in range(_lo...
126
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __SCREAMING_SNAKE_CASE : Any = { """configuration_vivit""": ["""VIVIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """VivitConfig"""], ...
348
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING _A: List[str] = logging.get_...
126
0