code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass snake_case__ : Union[str, Any] = (3, 9, -11, 0, 7, 5, 1, -1) snake_case__ : Union[str, Any] = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class ...
702
"""simple docstring""" from __future__ import annotations from typing import Any class snake_case_( a__ ): pass class snake_case_: def __init__( self : Any , UpperCamelCase_ : Any ): lowerCAmelCase : Any = data lowerCAmelCa...
637
0
"""simple docstring""" import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrat...
703
"""simple docstring""" from torch import nn class snake_case_( nn.Module ): def __init__( self : int , UpperCamelCase_ : int , UpperCamelCase_ : int ): super().__init__() lowerCAmelCase : str = class_size lowerC...
637
0
"""simple docstring""" from bisect import bisect from itertools import accumulate def _snake_case ( _snake_case : str , _snake_case : Optional[Any] , _snake_case : int , _snake_case : Optional[Any] ): lowerCAmelCase : Optional[int] = sorted(zip(_sna...
704
"""simple docstring""" class snake_case_: def __init__( self : Union[str, Any] , UpperCamelCase_ : str ): lowerCAmelCase : Dict = val lowerCAmelCase : str = None lowerCAmelCase : Dict = None def ...
637
0
"""simple docstring""" from __future__ import annotations from typing import Any class snake_case_( a__ ): pass class snake_case_: def __init__( self : Any , UpperCamelCase_ : Any ): lowerCAmelCase : Any = data lowerCAmelCa...
705
"""simple docstring""" 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 snake_case__ : Tuple = logging.get_logger(__name__) snake_case__...
637
0
"""simple docstring""" from torch import nn class snake_case_( nn.Module ): def __init__( self : int , UpperCamelCase_ : int , UpperCamelCase_ : int ): super().__init__() lowerCAmelCase : str = class_...
706
"""simple docstring""" import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteri...
637
0
"""simple docstring""" import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class snake_case_( unittest.TestCase ): __UpperCamelCase =...
707
"""simple docstring""" import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @datacla...
637
0
"""simple docstring""" snake_case__ : Any = [ (1_000, '''M'''), (900, '''CM'''), (500, '''D'''), (400, '''CD'''), (100, '''C'''), (90, '''XC'''), (50, '''L'''), (40, '''XL'''), (10, '''X'''), (9, '''IX'''), (5, '''V'''), (4, '''IV'''), (1, '''I'...
708
"""simple docstring""" import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_comm...
637
0
"""simple docstring""" def _snake_case ( _snake_case : int ): if not isinstance(_snake_case , _snake_case ): raise ValueError('''Input must be an integer''' ) if input_num <= 0: raise ValueError('''Input must be positive''' ) return sum( ...
709
"""simple docstring""" 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_schedule, ...
637
0
"""simple docstring""" 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 .to...
710
"""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-...
637
0
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extractio...
711
"""simple docstring""" snake_case__ : List[Any] = '''Tobias Carryer''' from time import time class snake_case_: def __init__( self : Optional[Any] , UpperCamelCase_ : Optional[Any] , UpperCamelCase_ : Tuple , UpperCamelCase_ : Optional[int...
637
0
"""simple docstring""" from ....configuration_utils import PretrainedConfig from ....utils import logging snake_case__ : List[Any] = logging.get_logger(__name__) # TODO: upload to AWS snake_case__ : str = { '''yjernite/retribert-base-uncased''': ( '''https://hu...
712
"""simple docstring""" 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 .to...
637
0
"""simple docstring""" import unittest import numpy as np import torch from torch import nn from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import KandinskyVaaPr...
713
"""simple docstring""" # using dfs for finding eulerian path traversal def _snake_case ( _snake_case : Optional[Any] , _snake_case : List[Any] , _snake_case : str , _snake_case : List[Any]=None ): lowerCAmelCase : Any = (path or []) + [u] for ...
637
0
"""simple docstring""" snake_case__ : List[Any] = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.gi...
714
"""simple docstring""" import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, BertTokenizer, ...
637
0
"""simple docstring""" import random def _snake_case ( _snake_case : int , _snake_case : float , _snake_case : bool = False ): lowerCAmelCase : dict = {i: [] for i in range(_snake_case )} # if probability is greater or equal than 1, then genera...
715
"""simple docstring""" import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import Paddin...
637
0
"""simple docstring""" def _snake_case ( _snake_case : int = 1000 ) -> Any: return sum(e for e in range(3 , _snake_case ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(f"""{solution() = }""")
716
"""simple docstring""" def _snake_case ( _snake_case : int = 4000000 ): lowerCAmelCase : int = [0, 1] lowerCAmelCase : List[str] = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: ...
637
0
"""simple docstring""" import requests from bsa import BeautifulSoup def _snake_case ( _snake_case : str = "https://www.worldometers.info/coronavirus" ): lowerCAmelCase : str = BeautifulSoup(requests.get(_snake_case ).text , '''html.parser''' ) lowerCAmelCas...
717
"""simple docstring""" def _snake_case ( _snake_case : float , _snake_case : list[float] ): if discount_rate < 0: raise ValueError('''Discount rate cannot be negative''' ) if not cash_flows: raise ValueError('''Cash flows list cannot be empty'''...
637
0
"""simple docstring""" import datasets from .evaluate import evaluate snake_case__ : List[Any] = '''\ @inproceedings{Rajpurkar2016SQuAD10, title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text}, author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang}, ...
718
"""simple docstring""" from __future__ import annotations def _snake_case ( _snake_case : list[int] , _snake_case : int ): if len(_snake_case ) == 0: return False lowerCAmelCase : List[Any] = len(_snake_case ) // 2 if a_list[midpoint] ...
637
0
import os import pytest from transformers.dynamic_module_utils import get_imports snake_case__ : Dict = ''' import os ''' snake_case__ : Dict = ''' def foo(): import os return False ''' snake_case__ : Dict = ''' def foo(): def bar(): if True: ...
719
"""simple docstring""" import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict snake_case__ : Optional[Any] = namedtuple( ''...
637
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case__ : Dict = { '''configuration_roberta''': ['''RO...
720
"""simple docstring""" def _snake_case ( _snake_case : int , _snake_case : int ): return base * power(_snake_case , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('''Raise base to the power of exponent using recursion...''') snake_case__ : Un...
637
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available snake_case__ : Optional[int] = {'''tokenization_herbert''': ['''HerbertTokenizer''']} try: if not is_tokenizers_available(): raise OptionalDep...
721
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeli...
637
0
"""simple docstring""" import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import CLIPMo...
700
"""simple docstring""" from __future__ import annotations from PIL import Image # Define glider example snake_case__ : int = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0...
637
0
from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( AutoConfig, BertConfig, ...
701
"""simple docstring""" from __future__ import annotations class snake_case_: def __init__( self : int , UpperCamelCase_ : str , UpperCamelCase_ : str ): lowerCAmelCase, lowerCAmelCase : List[str] = text, pattern lowerCAmelCas...
637
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case__ : str = logging.get_logger(__name__) snake_case__ : Union[str, Any] = { '''google/realm-cc-news-pretrained-embedder''': ( '''https://huggingface.co/go...
702
"""simple docstring""" from __future__ import annotations from typing import Any class snake_case_( a__ ): pass class snake_case_: def __init__( self : Any , UpperCamelCase_ : Any ): lowerCAmelCase : Any = data lowerCAmelCa...
637
0
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case__ : Optional[int] = logging.get_logger(__name__) snake_case__ : str = ...
703
"""simple docstring""" from torch import nn class snake_case_( nn.Module ): def __init__( self : int , UpperCamelCase_ : int , UpperCamelCase_ : int ): super().__init__() lowerCAmelCase : str = class_size lowerC...
637
0
"""simple docstring""" import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, BertTokenizer, ...
704
"""simple docstring""" class snake_case_: def __init__( self : Union[str, Any] , UpperCamelCase_ : str ): lowerCAmelCase : Dict = val lowerCAmelCase : str = None lowerCAmelCase : Dict = None def ...
637
0
"""simple docstring""" from sklearn.metrics import mean_squared_error import datasets snake_case__ : int = '''\ @article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. and Thirion, B. and Gris...
705
"""simple docstring""" 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 snake_case__ : Tuple = logging.get_logger(__name__) snake_case__...
637
0
"""simple docstring""" from __future__ import annotations from typing import Any class snake_case_: def __init__( self : Union[str, Any] , UpperCamelCase_ : int , UpperCamelCase_ : int , UpperCamelCase_ : float = 0 ): ...
706
"""simple docstring""" import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteri...
637
0
"""simple docstring""" import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin snake_case__ : List[Any] = get_tests_dir('''fixtur...
707
"""simple docstring""" import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @datacla...
637
0
"""simple docstring""" import sys from pathlib import Path snake_case__ : str = Path(__file__).resolve().parents[3] / '''src''' sys.path.insert(1, str(git_repo_path)) import dataclasses # noqa import io # noqa import itertools # noqa import json # noqa import os # noqa import unittest # ...
708
"""simple docstring""" import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_comm...
637
0
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar snake_case__ : Optional[int] = TypeVar('''T''') class snake_case_( Generic[T] ): def __init__( self : Optional[Any] , UpperCamelCas...
709
"""simple docstring""" 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_schedule, ...
637
0
"""simple docstring""" import pytest from datasets.parallel import ParallelBackendConfig, parallel_backend from datasets.utils.py_utils import map_nested from .utils import require_dill_gt_0_3_2, require_joblibspark, require_not_windows def _snake_case ( _snake_case : Dict ): # pickla...
710
"""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-...
637
0
"""simple docstring""" import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils import req...
711
"""simple docstring""" snake_case__ : List[Any] = '''Tobias Carryer''' from time import time class snake_case_: def __init__( self : Optional[Any] , UpperCamelCase_ : Optional[Any] , UpperCamelCase_ : Tuple , UpperCamelCase_ : Optional[int...
637
0
"""simple docstring""" import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging if is_torch_a...
712
"""simple docstring""" 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 .to...
637
0
"""simple docstring""" from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class snake_case_( a__ ): __Up...
713
"""simple docstring""" # using dfs for finding eulerian path traversal def _snake_case ( _snake_case : Optional[Any] , _snake_case : List[Any] , _snake_case : str , _snake_case : List[Any]=None ): lowerCAmelCase : Any = (path or []) + [u] for ...
637
0
"""simple docstring""" import os from typing import BinaryIO, Optional, Union import numpy as np import pyarrow.parquet as pq from .. import Audio, Dataset, Features, Image, NamedSplit, Value, config from ..features.features import FeatureType, _visit from ..formatting import query_table from ..packaged_modul...
714
"""simple docstring""" import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, BertTokenizer, ...
637
0
"""simple docstring""" snake_case__ : Dict = [ 999, 800, 799, 600, 599, 500, 400, 399, 377, 355, 333, 311, 288, 266, 244, 222, 200, 199, 177, 155, 133, 111, 88, 66, 44, 22, 0, ] snake_c...
715
"""simple docstring""" import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import Paddin...
637
0
"""simple docstring""" from __future__ import annotations def _snake_case ( _snake_case : list[float] , _snake_case : List[str] ) -> Tuple: print(f'''Vertex\tShortest Distance from vertex {src}''' ) for i, d in enumerate(_snake_case ): print(f'''{...
716
"""simple docstring""" def _snake_case ( _snake_case : int = 4000000 ): lowerCAmelCase : int = [0, 1] lowerCAmelCase : List[str] = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: ...
637
0
"""simple docstring""" from __future__ import annotations from math import pi # Define the Reduced Planck Constant ℏ (H bar), speed of light C, value of # Pi and the function snake_case__ = 1.054571817e-34 # unit of ℏ : J * s snake_case__ = 3e8 # unit of c : m * s^-1 def _snake_c...
717
"""simple docstring""" def _snake_case ( _snake_case : float , _snake_case : list[float] ): if discount_rate < 0: raise ValueError('''Discount rate cannot be negative''' ) if not cash_flows: raise ValueError('''Cash flows list cannot be empty'''...
637
0
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging snake_case__ : Optional[int] = '''▁''' snake_case__ : Any ...
718
"""simple docstring""" from __future__ import annotations def _snake_case ( _snake_case : list[int] , _snake_case : int ): if len(_snake_case ) == 0: return False lowerCAmelCase : List[Any] = len(_snake_case ) // 2 if a_list[midpoint] ...
637
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_torch_available, ) snake_case__ : int = { '''configuration_trocr''': ['''TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TrOCRC...
719
"""simple docstring""" import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict snake_case__ : Optional[Any] = namedtuple( ''...
637
0
"""simple docstring""" import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class snake_case_( a__ , ...
720
"""simple docstring""" def _snake_case ( _snake_case : int , _snake_case : int ): return base * power(_snake_case , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('''Raise base to the power of exponent using recursion...''') snake_case__ : Un...
637
0
"""simple docstring""" import torch from diffusers import StableDiffusionPipeline snake_case__ : Optional[Any] = '''path-to-your-trained-model''' snake_case__ : Any = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.floataa).to('''cuda''') snake_case__ :...
721
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeli...
637
0
"""simple docstring""" import argparse import pathlib import fairseq import torch from fairseq.models.roberta import RobertaModel as FairseqRobertaModel from fairseq.modules import TransformerSentenceEncoderLayer from packaging import version from transformers import XLMRobertaConfig, XLMRobertaXLForMaskedLM,...
700
"""simple docstring""" from __future__ import annotations from PIL import Image # Define glider example snake_case__ : int = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0...
637
0
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ) fro...
701
"""simple docstring""" from __future__ import annotations class snake_case_: def __init__( self : int , UpperCamelCase_ : str , UpperCamelCase_ : str ): lowerCAmelCase, lowerCAmelCase : List[str] = text, pattern lowerCAmelCas...
637
0
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XLMRobertaTokenizer, XLMRobertaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_...
702
"""simple docstring""" from __future__ import annotations from typing import Any class snake_case_( a__ ): pass class snake_case_: def __init__( self : Any , UpperCamelCase_ : Any ): lowerCAmelCase : Any = data lowerCAmelCa...
637
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case__ : List[Any] = logging.get_logger(__name__) snake_case__ : List[Any] = { '''tiiuae/falcon-40b''': '''https://huggingface.co/tiiuae/falcon-40b/resolve/main/conf...
703
"""simple docstring""" from torch import nn class snake_case_( nn.Module ): def __init__( self : int , UpperCamelCase_ : int , UpperCamelCase_ : int ): super().__init__() lowerCAmelCase : str = class_size lowerC...
637
0
"""simple docstring""" import argparse import torch from diffusers.pipelines.stable_diffusion.convert_from_ckpt import download_from_original_stable_diffusion_ckpt if __name__ == "__main__": snake_case__ : int = argparse.ArgumentParser() parser.add_argument( '''--checkpoint_path''', d...
704
"""simple docstring""" class snake_case_: def __init__( self : Union[str, Any] , UpperCamelCase_ : str ): lowerCAmelCase : Dict = val lowerCAmelCase : str = None lowerCAmelCase : Dict = None def ...
637
0
"""simple docstring""" def _snake_case ( _snake_case : str , _snake_case : str ): lowerCAmelCase : int = len(_snake_case ) lowerCAmelCase : int = len(_snake_case ) lowerCAmelCase : int = ( first_str_length if first_...
705
"""simple docstring""" 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 snake_case__ : Tuple = logging.get_logger(__name__) snake_case__...
637
0
"""simple docstring""" import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import Token...
706
"""simple docstring""" import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteri...
637
0
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from typing import Optional import numpy as np import torch from datasets import load_dataset from torchvision.transforms import Compose, Lambda, Normalize, RandomHorizontalFlip, RandomResizedCrop, ToTensor imp...
707
"""simple docstring""" import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @datacla...
637
0
"""simple docstring""" from __future__ import annotations from typing import Any class snake_case_: def __init__( self : Union[str, Any] , UpperCamelCase_ : int ): lowerCAmelCase : Optional[int] = num_of_nodes lowerCAmelCase : list[list[...
708
"""simple docstring""" import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_comm...
637
0
"""simple docstring""" import os import zipfile import requests from get_ci_error_statistics import download_artifact, get_artifacts_links def _snake_case ( _snake_case : str , _snake_case : List[Any]=7 ): lowerCAmelCase : Any = None if token is not None: ...
709
"""simple docstring""" 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_schedule, ...
637
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) snake_case__ : Optional[Any] = { '''configuration_mobilevit''': ['''MOBILEVIT_PRETRAIN...
710
"""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-...
637
0
"""simple docstring""" import unittest import numpy as np import torch from .utils_summarization import build_mask, compute_token_type_ids, process_story, truncate_or_pad class snake_case_( unittest.TestCase ): def lowerCamelCase__ ( self : Union[str, Any] ): ...
711
"""simple docstring""" snake_case__ : List[Any] = '''Tobias Carryer''' from time import time class snake_case_: def __init__( self : Optional[Any] , UpperCamelCase_ : Optional[Any] , UpperCamelCase_ : Tuple , UpperCamelCase_ : Optional[int...
637
0
"""simple docstring""" from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import ConfigTester from ...test_model...
712
"""simple docstring""" 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 .to...
637
0
"""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(): from ..mod...
713
"""simple docstring""" # using dfs for finding eulerian path traversal def _snake_case ( _snake_case : Optional[Any] , _snake_case : List[Any] , _snake_case : str , _snake_case : List[Any]=None ): lowerCAmelCase : Any = (path or []) + [u] for ...
637
0
"""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 TokenizerTe...
714
"""simple docstring""" import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, BertTokenizer, ...
637
0
"""simple docstring""" import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import Paddi...
715
"""simple docstring""" import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import Paddin...
637
0
"""simple docstring""" from __future__ import annotations import numpy as np def _snake_case ( _snake_case : np.ndarray ) -> List[str]: lowerCAmelCase : int = np.shape(_snake_case ) if rows != columns: lowerCAmelCase : Union[str, Any] ...
716
"""simple docstring""" def _snake_case ( _snake_case : int = 4000000 ): lowerCAmelCase : int = [0, 1] lowerCAmelCase : List[str] = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: ...
637
0
"""simple docstring""" from itertools import product from cva import COLOR_BGR2GRAY, cvtColor, imread, imshow, waitKey from numpy import dot, exp, mgrid, pi, ravel, square, uinta, zeros def _snake_case ( _snake_case : Optional[int] , _snake_case : Union[str, Any] ): lowerCA...
717
"""simple docstring""" def _snake_case ( _snake_case : float , _snake_case : list[float] ): if discount_rate < 0: raise ValueError('''Discount rate cannot be negative''' ) if not cash_flows: raise ValueError('''Cash flows list cannot be empty'''...
637
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor snake_case__ : List[str] = logging.get_logger(__name__) class snake_case_( a__ ): def __init__( self : Union[str, Any] , *UpperCamelCase...
718
"""simple docstring""" from __future__ import annotations def _snake_case ( _snake_case : list[int] , _snake_case : int ): if len(_snake_case ) == 0: return False lowerCAmelCase : List[Any] = len(_snake_case ) // 2 if a_list[midpoint] ...
637
0
from string import ascii_uppercase snake_case__ : Union[str, Any] = {str(ord(c) - 55): c for c in ascii_uppercase} def _snake_case ( _snake_case : int , _snake_case : int ): if isinstance(_snake_case , _snake_case ): raise TypeError('''int() can\'t...
719
"""simple docstring""" import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict snake_case__ : Optional[Any] = namedtuple( ''...
637
0
"""simple docstring""" from sklearn.metrics import matthews_corrcoef import datasets snake_case__ : List[Any] = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classifi...
720
"""simple docstring""" def _snake_case ( _snake_case : int , _snake_case : int ): return base * power(_snake_case , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('''Raise base to the power of exponent using recursion...''') snake_case__ : Un...
637
0
"""simple docstring""" from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case__ : Optional[int] = logging.get_logger(__name__) snake_case__ : int = { '''snap-research/efficientformer-l1-300''': ( '''ht...
721
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeli...
637
0
"""simple docstring""" import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class snake_case_( a__ , unit...
700
"""simple docstring""" from __future__ import annotations from PIL import Image # Define glider example snake_case__ : int = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0...
637
0
from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case__ : Tuple = logging.get_logger(__name__) snake_case__ : Optional[int] = { '''facebook/vit-mae-base''': '''https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json''', # Se...
701
"""simple docstring""" from __future__ import annotations class snake_case_: def __init__( self : int , UpperCamelCase_ : str , UpperCamelCase_ : str ): lowerCAmelCase, lowerCAmelCase : List[str] = text, pattern lowerCAmelCas...
637
0
"""simple docstring""" from dataclasses import dataclass, field from typing import Optional @dataclass class snake_case_: __UpperCamelCase = field( default='''codeparrot/codeparrot''' , metadata={'''help''': '''Model name or path of model to be trained.'''} ) __UpperCame...
702
"""simple docstring""" from __future__ import annotations from typing import Any class snake_case_( a__ ): pass class snake_case_: def __init__( self : Any , UpperCamelCase_ : Any ): lowerCAmelCase : Any = data lowerCAmelCa...
637
0
"""simple docstring""" import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py snake_case__ : List[str] = '''.''' if __name__ == "__main__": snake_case__ : Any = os.path.join(REPO_...
703
"""simple docstring""" from torch import nn class snake_case_( nn.Module ): def __init__( self : int , UpperCamelCase_ : int , UpperCamelCase_ : int ): super().__init__() lowerCAmelCase : str = class_size lowerC...
637
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_speech_available, is_torch_available snake_case__ : str = { '''configuration_audio_spectrogram_transformer''': [ '''AUDIO_SPECTROGRAM_TRANSFORMER_PRETRAINED_...
704
"""simple docstring""" class snake_case_: def __init__( self : Union[str, Any] , UpperCamelCase_ : str ): lowerCAmelCase : Dict = val lowerCAmelCase : str = None lowerCAmelCase : Dict = None def ...
637
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer...
705
"""simple docstring""" 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 snake_case__ : Tuple = logging.get_logger(__name__) snake_case__...
637
0
"""simple docstring""" def _snake_case ( _snake_case : int , _snake_case : list ): _enforce_args(_snake_case , _snake_case ) if n == 0: return 0 lowerCAmelCase : List[str] = float('''-inf''' ) for i in range(1 , n...
706
"""simple docstring""" import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteri...
637
0
"""simple docstring""" from queue import Queue from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from ..models.auto import AutoTokenizer class snake_case_: def lowerCamelCase__ ( self : List[str] , UpperCamelCase_ : List[str] ): raise No...
707
"""simple docstring""" import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @datacla...
637
0
"""simple docstring""" from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available snake_case__ : List[str] = { '''configuration_cpmant''': ['''CPMANT_PRETRAINED_CONFIG_A...
708
"""simple docstring""" import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_comm...
637
0
"""simple docstring""" 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 .token...
709
"""simple docstring""" 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_schedule, ...
637
0
"""simple docstring""" import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class snake_case_( a__ , unittest.TestCase ): __UpperCamelCase = Phobe...
710
"""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-...
637
0
"""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'''...
711
"""simple docstring""" snake_case__ : List[Any] = '''Tobias Carryer''' from time import time class snake_case_: def __init__( self : Optional[Any] , UpperCamelCase_ : Optional[Any] , UpperCamelCase_ : Tuple , UpperCamelCase_ : Optional[int...
637
0
"""simple docstring""" import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import Paddin...
712
"""simple docstring""" 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 .to...
637
0
"""simple docstring""" def _snake_case ( _snake_case : int = 4000000 ): lowerCAmelCase : int = [0, 1] lowerCAmelCase : List[str] = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: ...
713
"""simple docstring""" # using dfs for finding eulerian path traversal def _snake_case ( _snake_case : Optional[Any] , _snake_case : List[Any] , _snake_case : str , _snake_case : List[Any]=None ): lowerCAmelCase : Any = (path or []) + [u] for ...
637
0
"""simple docstring""" from math import ceil def _snake_case ( _snake_case : Optional[int] , _snake_case : Optional[Any] ): lowerCAmelCase : str = list(range(0 , _snake_case ) ) lowerCAmelCase : List[str] = [item for sublist in list(devic...
714
"""simple docstring""" import os import shutil import sys import tempfile import unittest from pathlib import Path import pytest import transformers from transformers import ( BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, GPT2_PRETRAINED_CONFIG_ARCHIVE_MAP, AutoTokenizer, BertConfig, BertTokenizer, ...
637
0
"""simple docstring""" def _snake_case ( _snake_case : list[int] ): if not nums: # Makes sure that the list is not empty raise ValueError('''List is empty''' ) lowerCAmelCase : int = sum(_snake_case ) / len(_snake_case ) # Calculate the avera...
715
"""simple docstring""" import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import Paddin...
637
0
"""simple docstring""" def _snake_case ( _snake_case : int , _snake_case : int , _snake_case : int ) -> Any: if exponent == 1: return base if exponent % 2 == 0: lowerCAmelCase : Dict = _modexpt(_snake_case , exponent //...
716
"""simple docstring""" def _snake_case ( _snake_case : int = 4000000 ): lowerCAmelCase : int = [0, 1] lowerCAmelCase : List[str] = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2] > n: ...
637
0
"""simple docstring""" import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import PoolFormerConfig, PoolFormerForImageClassification, PoolFormerImageProcessor f...
717
"""simple docstring""" def _snake_case ( _snake_case : float , _snake_case : list[float] ): if discount_rate < 0: raise ValueError('''Discount rate cannot be negative''' ) if not cash_flows: raise ValueError('''Cash flows list cannot be empty'''...
637
0
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @...
718
"""simple docstring""" from __future__ import annotations def _snake_case ( _snake_case : list[int] , _snake_case : int ): if len(_snake_case ) == 0: return False lowerCAmelCase : List[Any] = len(_snake_case ) // 2 if a_list[midpoint] ...
637
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case__ : Dict = {'''configuration_xlnet''': ['''XLNET_PRETRAINED_CONFIG_ARCH...
719
"""simple docstring""" import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict snake_case__ : Optional[Any] = namedtuple( ''...
637
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) snake_case__ : Optional[Any] = { '''configuration_spee...
720
"""simple docstring""" def _snake_case ( _snake_case : int , _snake_case : int ): return base * power(_snake_case , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('''Raise base to the power of exponent using recursion...''') snake_case__ : Un...
637
0
"""simple docstring""" import math def _snake_case ( _snake_case : int ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 ar...
721
"""simple docstring""" import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeli...
637
0
"""simple docstring""" import math import sys import cva import numpy as np def _snake_case ( _snake_case : np.ndarray , _snake_case : float ): # For applying gaussian function for each element in matrix. lowerCAmelCase : str = math.sqrt(_snake_case ) ...
700
"""simple docstring""" from __future__ import annotations from PIL import Image # Define glider example snake_case__ : int = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0...
637
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 .tokenization_barthez import Ba...
701
"""simple docstring""" from __future__ import annotations class snake_case_: def __init__( self : int , UpperCamelCase_ : str , UpperCamelCase_ : str ): lowerCAmelCase, lowerCAmelCase : List[str] = text, pattern lowerCAmelCas...
637
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case__ : List[Any] = { '''configuration_clipseg''': [ '''CLIPSEG_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''CLIPSegConfig''', ...
702
"""simple docstring""" from __future__ import annotations from typing import Any class snake_case_( a__ ): pass class snake_case_: def __init__( self : Any , UpperCamelCase_ : Any ): lowerCAmelCase : Any = data lowerCAmelCa...
637
0
"""simple docstring""" from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf,...
703
"""simple docstring""" from torch import nn class snake_case_( nn.Module ): def __init__( self : int , UpperCamelCase_ : int , UpperCamelCase_ : int ): super().__init__() lowerCAmelCase : str = class_size lowerC...
637
0
"""simple docstring""" from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder snake_case__ : int = datasets.utils.logging.get_logger(__name__) class snake_case_( folder_based_builder.FolderBased...
704
"""simple docstring""" class snake_case_: def __init__( self : Union[str, Any] , UpperCamelCase_ : str ): lowerCAmelCase : Dict = val lowerCAmelCase : str = None lowerCAmelCase : Dict = None def ...
637
0
"""simple docstring""" def _snake_case ( _snake_case : Union[str, Any] , _snake_case : Any ): lowerCAmelCase : Tuple = [1] for i in range(2 , _snake_case ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k ...
705
"""simple docstring""" 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 snake_case__ : Tuple = logging.get_logger(__name__) snake_case__...
637
0
"""simple docstring""" from math import factorial, radians def _snake_case ( _snake_case : float , _snake_case : int = 18 , _snake_case : int = 10 ): lowerCAmelCase : Optional[int] = angle_in_degrees - ((angle_in_degrees // 360.0) * 360.0) ...
706
"""simple docstring""" import time import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, torch_device from ..test_modeling_common import ids_tensor if is_torch_available(): import torch from transformers.generation import ( MaxLengthCriteri...
637
0
"""simple docstring""" snake_case__ : List[Any] = '''Tobias Carryer''' from time import time class snake_case_: def __init__( self : Optional[Any] , UpperCamelCase_ : Optional[Any] , UpperCamelCase_ : Tuple , UpperCamelCase_ : Optional[int...
707
"""simple docstring""" import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @datacla...
637
0
"""simple docstring""" def _snake_case ( _snake_case : int ): if length <= 0 or not isinstance(_snake_case , _snake_case ): raise ValueError('''Length must be a positive integer.''' ) return [n * (2 * n - 1) for n in range(_snake_case )] if __name__ == "_...
708
"""simple docstring""" import unittest from parameterized import parameterized from transformers import LlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_comm...
637
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case__ : int = logging.get_logger(__name__) snake_case__ : List[str] = { '''microsoft/swinv2-tiny-patch4-window8-256''': ( '''https://huggingface.co/microsoft/s...
709
"""simple docstring""" 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_schedule, ...
637
0
"""simple docstring""" from __future__ import annotations snake_case__ : Optional[Any] = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] snake_case__ : str = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def _snake_case ( _snake_case : ...
710
"""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-...
637
0
"""simple docstring""" def _snake_case ( _snake_case : int , _snake_case : int ) -> List[Any]: return base * power(_snake_case , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print('''Raise base to the power of exponent using recursion...''') sna...
711
"""simple docstring""" snake_case__ : List[Any] = '''Tobias Carryer''' from time import time class snake_case_: def __init__( self : Optional[Any] , UpperCamelCase_ : Optional[Any] , UpperCamelCase_ : Tuple , UpperCamelCase_ : Optional[int...
637
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case__ : str = { '''configuration_time_series_transformer''': [ '''TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', ...
712
"""simple docstring""" 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 .to...
637
0
"""simple docstring""" import json import logging import os import socket import git import numpy as np import torch logging.basicConfig( format='''%(asctime)s - %(levelname)s - %(name)s - PID: %(process)d - %(message)s''', datefmt='''%m/%d/%Y %H:%M:%S''', level=logging.INFO, ) snake_case__ : ...
713
"""simple docstring""" # using dfs for finding eulerian path traversal def _snake_case ( _snake_case : Optional[Any] , _snake_case : List[Any] , _snake_case : str , _snake_case : List[Any]=None ): lowerCAmelCase : Any = (path or []) + [u] for ...
637
0