code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' import json import os import unittest from transformers import BatchEncoding, MvpTokenizer, MvpTokenizerFast from transformers.models.roberta.tokenization_roberta import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers, require_torch from transformers...
433
def A_ ( _lowerCAmelCase = 1000 ) -> int: UpperCamelCase : Optional[int] = -1 UpperCamelCase : int = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c UpperCamelCase : Optional[Any] = (n *...
629
0
'''simple docstring''' # Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def __UpperCamelCase ( lowercase__ : str, lowercase__ : Dict, lowercase__ : Any ): '''simple docstring''' __lowercase ={ "en": "Machine learning...
119
def A_ ( _lowerCAmelCase ) -> bool: UpperCamelCase : List[Any] = 0 for ch in input_str: UpperCamelCase : Optional[Any] = ord(_lowerCAmelCase ) UpperCamelCase : Optional[Any] = pow(2 , _lowerCAmelCase ) # If we already turned on bit for ...
629
0
"""simple docstring""" def lowerCamelCase_( _lowerCamelCase ) -> bool: '''simple docstring''' _lowerCamelCase : List[Any] = 0 for ch in input_str: _lowerCamelCase : Optional[Any] = ord(_lowerCAmelCase ) _lowerCamelCase : Op...
46
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_common import Confi...
629
0
from __future__ import annotations from typing import Any class SCREAMING_SNAKE_CASE_ : '''simple docstring''' def __init__( self : Any , SCREAMING_SNAKE_CASE__ : Tuple , SCREAMING_SNAKE_CASE__ : List[str] , SCREAMING_SNAKE_CASE__ : ...
305
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowerCamelCase : List[Any] = { """configuration_chinese_clip""": [ """CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ChineseCLIPConfig"""...
629
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_distilbert import DistilBertTokenizer SCREAMING_SNAKE_CASE : Union[str, Any] = logging.get_log...
197
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[int]: UpperCamelCase : List[Any] = [1] for i in range(2 , _lowerCAmelCase ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" UpperCamelCase : Tuple =...
629
0
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor __lowercase = logging.get_logger(__name__) class _lowercase ( __snake_case ): def __init__( self : int , *lowerCamelCase__ : str , **lowerCamelCase__ : List[st...
203
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_confi...
629
0
'''simple docstring''' import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokenizer from transformer...
692
def A_ ( _lowerCAmelCase ) -> bool: return str(_lowerCAmelCase ) == str(_lowerCAmelCase )[::-1] def A_ ( _lowerCAmelCase ) -> int: return int(_lowerCAmelCase ) + int(str(_lowerCAmelCase )[::-1] ) def A_ ( _lowerCAmelCase = 1_0000 ) -> int: UpperCamelCase...
629
0
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqLM, ...
652
__lowerCamelCase : str = 6_5521 def A_ ( _lowerCAmelCase ) -> int: UpperCamelCase : Any = 1 UpperCamelCase : str = 0 for plain_chr in plain_text: UpperCamelCase : List[Any] = (a + ord(_lowerCAmelCase )) % MOD_ADLER UpperCamelCase...
629
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase = logging.get_logger(__name__) _lowerCAmelCase = { """facebook/vit-mae-base""": """https://huggingface.co/facebook/vit-mae-base/resolve/main/config.json"""...
161
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 PaddingStrategy, logging __lo...
629
0
from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def _lowercase ( __lowerCamelCase : Union[str, Any] = True ,*__lowerCamelCase : List[str] ,**__lowerCamelCase : Optional[int] ...
344
from typing import Any def A_ ( _lowerCAmelCase ) -> list[Any]: if not input_list: return [] UpperCamelCase : List[str] = [input_list.count(_lowerCAmelCase ) for value in input_list] UpperCamelCase : Dict = max(_lowerCAmelCase ) # Gets the maximum count in...
629
0
'''simple docstring''' import unittest from transformers import load_tool from transformers.utils import is_torch_available if is_torch_available(): import torch from transformers.testing_utils import require_torch from .test_tools_common import ToolTesterMixin @require_torch class a__( un...
370
from random import shuffle import tensorflow as tf from numpy import array def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]: UpperCamelCase : List[Any] = int(_lowerCAmelCase ) assert noofclusters < len(_lowerCAmelCase ) # Find out the dimensionality Upper...
629
0
'''simple docstring''' from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase ...
433
import os def A_ ( ) -> Union[str, Any]: with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f: UpperCamelCase : Optional[Any] = [] # noqa: E741 for _ in range(20 ): l.append([int(_lowerCAmelCase ) for x in f.readline().split()] ) UpperCamelCase : ...
629
0
'''simple docstring''' import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer UpperCAmelCase = logging.get_logger(__n...
119
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class A__ : _UpperCAmelCase :Union[str, Any] = None def __UpperCamelCase( self ): '''simple docstring''' UpperCamelCase : int ...
629
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCAmelCase : List[Any] = {"""configuration_sew""": ["""SEW_PRETRAINED_CONFIG_ARCHIVE_MAP""", """SEWConfig"""]} try: if not is_torch_available()...
46
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor __lowerCamelCase : Optional[Any] = logging.get_logger(__name__) class A__ ( __snake_case ): def __init__( self , *A_ , **A_ ): '''simple docstring''' ...
629
0
import tempfile import unittest from make_student import create_student_by_copying_alternating_layers from transformers import AutoConfig from transformers.file_utils import cached_property from transformers.testing_utils import require_torch _lowercase : Any ="""sshleifer/bart-tiny-random""" ...
305
from __future__ import annotations import math def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float: UpperCamelCase : Tuple = u for i in range(1 , _lowerCAmelCase ): UpperCamelCase : Any = temp * (u - i) return temp def A_ ( ) -> ...
629
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE : int = { """configurat...
197
# Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar __lowerCamelCase : str = TypeVar("""T""") class A__ ( Generic[T] ): def __init__( ...
629
0
from typing import Callable, List, Optional, Union import PIL import torch from transformers import ( CLIPImageProcessor, CLIPSegForImageSegmentation, CLIPSegProcessor, CLIPTextModel, CLIPTokenizer, ) from diffusers import DiffusionPipeline from diffusers.configuration_utils import FrozenDict fr...
203
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging __low...
629
0
'''simple docstring''' lowerCAmelCase_ : Any = 9.80_665 def _lowerCamelCase ( lowercase : Dict , lowercase : List[str] , lowercase : Any = g ) -> float: if fluid_density <= 0: raise ValueError("Impossible fluid density" ) ...
692
import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from transformers.testing_utils...
629
0
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 ( SegformerConfig, SegformerForImageClassification, SegformerForSemanticSegmenta...
652
__lowerCamelCase : Any = 9.8_0_6_6_5 def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = g ) -> float: if fluid_density <= 0: raise ValueError("Impossible fluid density" ) if volume < 0: raise ValueError("Impossible Object volume" ) if gravity <= 0: raise...
629
0
'''simple docstring''' import re from filelock import FileLock try: import nltk _lowerCAmelCase = True except (ImportError, ModuleNotFoundError): _lowerCAmelCase = False if NLTK_AVAILABLE: with FileLock(".lock") as lock: nltk.download("punkt", quiet=True) ...
161
import numpy as np import qiskit def A_ ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str: UpperCamelCase : Tuple = np.random.default_rng(seed=_lowerCAmelCase ) # Roughly 25% of the qubits will contribute to the key. # So we take more than we need. UpperCamelCase...
629
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _SCREAMING_SNAKE_CASE : Union[str, Any] = {"""configuration_yolos""": ["""YOLOS_PRETRAINED_CONFIG_ARCHIVE_MAP""", """YolosConfig""", """YolosOnnxConfig"""]} ...
344
from typing import TYPE_CHECKING from ...utils import _LazyModule __lowerCamelCase : str = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys __lowerCamelCase : List[str] = _LazyModule(__name__, glo...
629
0
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart import ...
370
# Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> str: UpperCamelCase : Union[str, Any] = { "en": "Machine learning is great, isn't it?", "ru": "Машинное обучение - эт...
629
0
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_...
433
def A_ ( _lowerCAmelCase = 1000 ) -> int: UpperCamelCase : Optional[int] = -1 UpperCamelCase : int = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c UpperCamelCase : Optional[Any] = (n *...
629
0
'''simple docstring''' UpperCAmelCase = """ # Installazione di Transformers ! pip install transformers datasets # Per installare dalla fonte invece dell'ultima versione rilasciata, commenta il comando sopra e # rimuovi la modalità commento al comando seguente. # ! pip install git+https://github.com/huggingface/...
119
def A_ ( _lowerCAmelCase ) -> bool: UpperCamelCase : List[Any] = 0 for ch in input_str: UpperCamelCase : Optional[Any] = ord(_lowerCAmelCase ) UpperCamelCase : Optional[Any] = pow(2 , _lowerCAmelCase ) # If we already turned on bit for ...
629
0
"""simple docstring""" import os import pickle import unittest from transformers import AutoTokenizer from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.models.bert_japanese.tokenization_bert_japanese import ( VOCAB_FILES_NAMES, BertJapaneseTokenizer, CharacterT...
46
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_common import Confi...
629
0
from .dependency_versions_table import deps from .utils.versions import require_version, require_version_core # define which module versions we always want to check at run time # (usually the ones defined in `install_requires` in setup.py) # # order specific notes: # - tqdm must be checked before tokenizers ...
305
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowerCamelCase : List[Any] = { """configuration_chinese_clip""": [ """CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ChineseCLIPConfig"""...
629
0
import gc import math import unittest import torch from diffusers import UNetaDModel from diffusers.utils import floats_tensor, logging, slow, torch_all_close, torch_device from diffusers.utils.testing_utils import enable_full_determinism from .test_modeling_common import ModelTesterMixin, UNetTesterMixin ...
197
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[int]: UpperCamelCase : List[Any] = [1] for i in range(2 , _lowerCAmelCase ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" UpperCamelCase : Tuple =...
629
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) __lowercase = {"""configuration_beit""": ["""BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BeitConfig""", """BeitOnnxConfi...
203
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_confi...
629
0
'''simple docstring''' # Copyright 2023 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-...
692
def A_ ( _lowerCAmelCase ) -> bool: return str(_lowerCAmelCase ) == str(_lowerCAmelCase )[::-1] def A_ ( _lowerCAmelCase ) -> int: return int(_lowerCAmelCase ) + int(str(_lowerCAmelCase )[::-1] ) def A_ ( _lowerCAmelCase = 1_0000 ) -> int: UpperCamelCase...
629
0
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...t...
652
__lowerCamelCase : str = 6_5521 def A_ ( _lowerCAmelCase ) -> int: UpperCamelCase : Any = 1 UpperCamelCase : str = 0 for plain_chr in plain_text: UpperCamelCase : List[Any] = (a + ord(_lowerCAmelCase )) % MOD_ADLER UpperCamelCase...
629
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_c...
161
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 PaddingStrategy, logging __lo...
629
0
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger _SCREAMING_SNAKE_CASE : Dict = get_logger(__name__) class UpperCamelCase__ ( enum.Enum ): a__ : Tuple = 'all_checks' a__ : Any ...
344
from typing import Any def A_ ( _lowerCAmelCase ) -> list[Any]: if not input_list: return [] UpperCamelCase : List[str] = [input_list.count(_lowerCAmelCase ) for value in input_list] UpperCamelCase : Dict = max(_lowerCAmelCase ) # Gets the maximum count in...
629
0
'''simple docstring''' import copy import random from transformers import CLIPTokenizer class a__( __snake_case ): '''simple docstring''' def __init__( self , *__lowerCAmelCase , **__lowerCAmelCase): """simple docstring""" super().__init__(*A_ , ...
370
from random import shuffle import tensorflow as tf from numpy import array def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]: UpperCamelCase : List[Any] = int(_lowerCAmelCase ) assert noofclusters < len(_lowerCAmelCase ) # Find out the dimensionality Upper...
629
0
'''simple docstring''' import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H...
433
import os def A_ ( ) -> Union[str, Any]: with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f: UpperCamelCase : Optional[Any] = [] # noqa: E741 for _ in range(20 ): l.append([int(_lowerCAmelCase ) for x in f.readline().split()] ) UpperCamelCase : ...
629
0
'''simple docstring''' import inspect import os import unittest import torch import accelerate from accelerate import Accelerator from accelerate.test_utils import execute_subprocess_async, require_multi_gpu from accelerate.utils import patch_environment class lowerCAmelCase ( unittest.TestCase ): ...
119
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class A__ : _UpperCAmelCase :Union[str, Any] = None def __UpperCamelCase( self ): '''simple docstring''' UpperCamelCase : int ...
629
0
"""simple docstring""" import os import tempfile import unittest import uuid from pathlib import Path from transformers.testing_utils import get_tests_dir, require_soundfile, require_torch, require_vision from transformers.tools.agent_types import AgentAudio, AgentImage, AgentText from transformers.utils impo...
46
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor __lowerCamelCase : Optional[Any] = logging.get_logger(__name__) class A__ ( __snake_case ): def __init__( self , *A_ , **A_ ): '''simple docstring''' ...
629
0
import random class SCREAMING_SNAKE_CASE_ : '''simple docstring''' @staticmethod def SCREAMING_SNAKE_CASE_ ( SCREAMING_SNAKE_CASE__ : Optional[Any] ) -> Tuple: A : Dict =[ord(A_ ) for i in text] A : Union[str, Any] =[] ...
305
from __future__ import annotations import math def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float: UpperCamelCase : Tuple = u for i in range(1 , _lowerCAmelCase ): UpperCamelCase : Any = temp * (u - i) return temp def A_ ( ) -> ...
629
0
import unittest from transformers import MobileBertConfig, 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_common import ConfigTester from ...test_mo...
197
# Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar __lowerCamelCase : str = TypeVar("""T""") class A__ ( Generic[T] ): def __init__( ...
629
0
import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class _lowercase ( __snake_case ): @require_torch def UpperCamelCase ( self : int ) -> Optional[Any]: ...
203
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging __low...
629
0
'''simple docstring''' import math def _lowerCamelCase ( lowercase : str , lowercase : Optional[Any] ) -> int: _a = len(_lowerCAmelCase ) _a = int(math.floor(math.sqrt(_lowerCAmelCase ) ) ) _a = 0 while ar...
692
import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from transformers.testing_utils...
629
0
import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging a =logging.get_logger(__name__) class A_ ( __snake_case ): _UpperCAmelCase : ...
652
__lowerCamelCase : Any = 9.8_0_6_6_5 def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = g ) -> float: if fluid_density <= 0: raise ValueError("Impossible fluid density" ) if volume < 0: raise ValueError("Impossible Object volume" ) if gravity <= 0: raise...
629
0
'''simple docstring''' def _lowerCAmelCase ( lowercase : Tuple , lowercase : List[str] , lowercase : Optional[int] ) ->int: """simple docstring""" if exponent == 1: return base if exponent % 2 == 0: lowercase__ = ...
161
import numpy as np import qiskit def A_ ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str: UpperCamelCase : Tuple = np.random.default_rng(seed=_lowerCAmelCase ) # Roughly 25% of the qubits will contribute to the key. # So we take more than we need. UpperCamelCase...
629
0
import baseaa def _lowercase ( __lowerCamelCase : List[str] ) -> bytes: '''simple docstring''' return baseaa.baaencode(string.encode('''utf-8''' ) ) def _lowercase ( __lowerCamelCase : Optional[Any] ) -> str: ...
344
from typing import TYPE_CHECKING from ...utils import _LazyModule __lowerCamelCase : str = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys __lowerCamelCase : List[str] = _LazyModule(__name__, glo...
629
0
'''simple docstring''' from __future__ import annotations class a__: '''simple docstring''' def __init__( self , __lowerCAmelCase = 0): """simple docstring""" lowerCAmelCase = key def a_ ( self , __lowerCAmelCase , __lowerCAmelC...
370
# Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> str: UpperCamelCase : Union[str, Any] = { "en": "Machine learning is great, isn't it?", "ru": "Машинное обучение - эт...
629
0
'''simple docstring''' import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin if is_torch_available...
433
def A_ ( _lowerCAmelCase = 1000 ) -> int: UpperCamelCase : Optional[int] = -1 UpperCamelCase : int = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c UpperCamelCase : Optional[Any] = (n *...
629
0
'''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 @dataclass # C...
119
def A_ ( _lowerCAmelCase ) -> bool: UpperCamelCase : List[Any] = 0 for ch in input_str: UpperCamelCase : Optional[Any] = ord(_lowerCAmelCase ) UpperCamelCase : Optional[Any] = pow(2 , _lowerCAmelCase ) # If we already turned on bit for ...
629
0
"""simple docstring""" # limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401 from .uti...
46
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_common import Confi...
629
0
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import logging if TYPE_CHE...
305
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowerCamelCase : List[Any] = { """configuration_chinese_clip""": [ """CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ChineseCLIPConfig"""...
629
0
from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE : Union[str, Any] = logging.get_logger(__name__) SCREAMING_SNAKE_CASE : Tuple = { """naver-clova-ix/donut-base""": """https://huggingface.co/naver-clova-ix/donut-base/resolve/mai...
197
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[int]: UpperCamelCase : List[Any] = [1] for i in range(2 , _lowerCAmelCase ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" UpperCamelCase : Tuple =...
629
0
import logging import math from functools import partial from typing import Any, Callable, Dict, Iterable, List, Optional, Sequence, Tuple, Union import torch from .tensor_utils import tensor_tree_map, tree_map def _lowerCamelCase ( SCREAMING_SNAKE_CASE ): '''simple docstring''' ...
203
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_confi...
629
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 P...
692
def A_ ( _lowerCAmelCase ) -> bool: return str(_lowerCAmelCase ) == str(_lowerCAmelCase )[::-1] def A_ ( _lowerCAmelCase ) -> int: return int(_lowerCAmelCase ) + int(str(_lowerCAmelCase )[::-1] ) def A_ ( _lowerCAmelCase = 1_0000 ) -> int: UpperCamelCase...
629
0
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor a =logging.get_logger(__name__) class A_ ( __snake_case ): def __init__( self : Tuple ,*SCREAMING_SNAKE_CASE__ : int ,**SCREAMING_SNAKE_CAS...
652
__lowerCamelCase : str = 6_5521 def A_ ( _lowerCAmelCase ) -> int: UpperCamelCase : Any = 1 UpperCamelCase : str = 0 for plain_chr in plain_text: UpperCamelCase : List[Any] = (a + ord(_lowerCAmelCase )) % MOD_ADLER UpperCamelCase...
629
0
'''simple docstring''' from typing import Any def _lowerCAmelCase ( lowercase : Optional[Any] ) ->list[Any]: """simple docstring""" if not input_list: return [] lowercase__ = [input_list.count(_lowerCAmelCase ) for value i...
161
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 PaddingStrategy, logging __lo...
629
0
from random import shuffle import tensorflow as tf from numpy import array def _lowercase ( __lowerCamelCase : int ,__lowerCamelCase : List[Any] ) -> Optional[Any]: '''simple docstring''' UpperCamelCase__ : List[Any] = int(_lowerCAmelCas...
344
from typing import Any def A_ ( _lowerCAmelCase ) -> list[Any]: if not input_list: return [] UpperCamelCase : List[str] = [input_list.count(_lowerCAmelCase ) for value in input_list] UpperCamelCase : Dict = max(_lowerCAmelCase ) # Gets the maximum count in...
629
0
'''simple docstring''' def snake_case__ ( _A: Any = 1000000 ) -> int: '''simple docstring''' lowerCAmelCase = [i - 1 for i in range(limit + 1 )] for i in range(2 , limit + 1 ): if phi[i] == i - 1: for j in range(2 * i , limit + 1 , _lowerCAmelCase...
370
from random import shuffle import tensorflow as tf from numpy import array def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]: UpperCamelCase : List[Any] = int(_lowerCAmelCase ) assert noofclusters < len(_lowerCAmelCase ) # Find out the dimensionality Upper...
629
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 ...te...
433
import os def A_ ( ) -> Union[str, Any]: with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f: UpperCamelCase : Optional[Any] = [] # noqa: E741 for _ in range(20 ): l.append([int(_lowerCAmelCase ) for x in f.readline().split()] ) UpperCamelCase : ...
629
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available UpperCAmelCase = { """configuration_mobilenet_v2""": [ """MOBILENET_V2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MobileNetV2Config""...
119
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class A__ : _UpperCAmelCase :Union[str, Any] = None def __UpperCamelCase( self ): '''simple docstring''' UpperCamelCase : int ...
629
0
"""simple docstring""" import logging import os from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional from tqdm import auto as tqdm_lib _lowerCAmelCase ...
46
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor __lowerCamelCase : Optional[Any] = logging.get_logger(__name__) class A__ ( __snake_case ): def __init__( self , *A_ , **A_ ): '''simple docstring''' ...
629
0
import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassificationWithTeacher, Efficien...
305
from __future__ import annotations import math def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float: UpperCamelCase : Tuple = u for i in range(1 , _lowerCAmelCase ): UpperCamelCase : Any = temp * (u - i) return temp def A_ ( ) -> ...
629
0
def __A ( _A , _A , _A ): """simple docstring""" return round(float(moles / volume ) * nfactor ) def __A ( _A , _A , _A ): """simple docstring""" return round(float((moles * 0.0821 * temperature) / (volume) ) ...
197
# Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar __lowerCamelCase : str = TypeVar("""T""") class A__ ( Generic[T] ): def __init__( ...
629
0
__lowercase = { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], """G""": ["""C"""], } def _lowerCamelCase ( SCREAM...
203
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging __low...
629
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class __SCREAMING_SNAKE_CASE (metaclass=__snake_case ): """simple docstring""" __a =['sentencepiece'] def __init__( self : Union[str, Any] , *__a : Union[str, Any] , **__...
692
import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from transformers.testing_utils...
629
0
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 =logging.get_logger(__name__) a ={ """Salesfor...
652
__lowerCamelCase : Any = 9.8_0_6_6_5 def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = g ) -> float: if fluid_density <= 0: raise ValueError("Impossible fluid density" ) if volume < 0: raise ValueError("Impossible Object volume" ) if gravity <= 0: raise...
629
0
'''simple docstring''' import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def _lowerCAmelCase ( lowercase : Union[str, Any] ) ->Any: """simple docstring""" ...
161
import numpy as np import qiskit def A_ ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str: UpperCamelCase : Tuple = np.random.default_rng(seed=_lowerCAmelCase ) # Roughly 25% of the qubits will contribute to the key. # So we take more than we need. UpperCamelCase...
629
0
import unittest from transformers import BertGenerationConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTester...
344
from typing import TYPE_CHECKING from ...utils import _LazyModule __lowerCamelCase : str = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys __lowerCamelCase : List[str] = _LazyModule(__name__, glo...
629
0
'''simple docstring''' def snake_case__ ( _A: List[str] = 1000 ) -> int: '''simple docstring''' return sum(e for e in range(3 , _lowerCAmelCase ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(f'{solution() = }')
370
# Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> str: UpperCamelCase : Union[str, Any] = { "en": "Machine learning is great, isn't it?", "ru": "Машинное обучение - эт...
629
0
'''simple docstring''' from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo UpperCAmelCase = """\ @misc{wu2016googles, title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machin...
433
def A_ ( _lowerCAmelCase = 1000 ) -> int: UpperCamelCase : Optional[int] = -1 UpperCamelCase : int = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c UpperCamelCase : Optional[Any] = (n *...
629
0
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { """xlm-roberta-base""": """https://h...
119
def A_ ( _lowerCAmelCase ) -> bool: UpperCamelCase : List[Any] = 0 for ch in input_str: UpperCamelCase : Optional[Any] = ord(_lowerCAmelCase ) UpperCamelCase : Optional[Any] = pow(2 , _lowerCAmelCase ) # If we already turned on bit for ...
629
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : str = logging.get_logger(__name__) _lowerCAmelCase : Any = { """google/switch-base-8""": """https://huggingface.co/google/switch-base-8/blob/main/conf...
46
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_common import Confi...
629
0
from typing import Any, Dict, Optional import torch import torch.nn.functional as F from torch import nn from ..utils import maybe_allow_in_graph from .activations import get_activation from .attention_processor import Attention from .embeddings import CombinedTimestepLabelEmbeddings @maybe_allow_in_g...
305
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowerCamelCase : List[Any] = { """configuration_chinese_clip""": [ """CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ChineseCLIPConfig"""...
629
0
from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class A_ ( __snake_case ...
197
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[int]: UpperCamelCase : List[Any] = [1] for i in range(2 , _lowerCAmelCase ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" UpperCamelCase : Tuple =...
629
0
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def _lowerCamelCase ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ): '''simple docstring''' A_ = f"{sampling_rate}" A_ = "1" ...
203
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_confi...
629
0
'''simple docstring''' import logging from transformers import PretrainedConfig lowerCAmelCase_ : Any = logging.getLogger(__name__) lowerCAmelCase_ : Tuple = { """bertabs-finetuned-cnndm""": """https://huggingface.co/remi/bertabs-finetuned-cnndm-extractive-abstr...
692
def A_ ( _lowerCAmelCase ) -> bool: return str(_lowerCAmelCase ) == str(_lowerCAmelCase )[::-1] def A_ ( _lowerCAmelCase ) -> int: return int(_lowerCAmelCase ) + int(str(_lowerCAmelCase )[::-1] ) def A_ ( _lowerCAmelCase = 1_0000 ) -> int: UpperCamelCase...
629
0
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging a =logging.get_logger(__name__) a ={ """huggingface/informer-tourism-monthly""": ( """https://huggingface.co/huggingface/informer-tourism-monthly/resolve/main...
652
__lowerCamelCase : str = 6_5521 def A_ ( _lowerCAmelCase ) -> int: UpperCamelCase : Any = 1 UpperCamelCase : str = 0 for plain_chr in plain_text: UpperCamelCase : List[Any] = (a + ord(_lowerCAmelCase )) % MOD_ADLER UpperCamelCase...
629
0
'''simple docstring''' import importlib import inspect import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py _lowerCAmelCase = """src/transformers""" # This is to make ...
161
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 PaddingStrategy, logging __lo...
629
0
from __future__ import annotations def _lowercase ( __lowerCamelCase : Dict ,__lowerCamelCase : Dict ,__lowerCamelCase : Optional[Any] ,) -> tuple: '''simple docstring''' if (electron_conc, hole_conc, intrinsic_conc).count(0 ) != 1: ...
344
from typing import Any def A_ ( _lowerCAmelCase ) -> list[Any]: if not input_list: return [] UpperCamelCase : List[str] = [input_list.count(_lowerCAmelCase ) for value in input_list] UpperCamelCase : Dict = max(_lowerCAmelCase ) # Gets the maximum count in...
629
0
'''simple docstring''' import argparse import os import torch from diffusers import ( CMStochasticIterativeScheduler, ConsistencyModelPipeline, UNetaDModel, ) __lowercase = { """sample_size""": 3_2, """in_channels""": 3, """out_channels""": 3, """layers_per_block""": 2, ...
370
from random import shuffle import tensorflow as tf from numpy import array def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]: UpperCamelCase : List[Any] = int(_lowerCAmelCase ) assert noofclusters < len(_lowerCAmelCase ) # Find out the dimensionality Upper...
629
0
'''simple docstring''' def _snake_case ( _SCREAMING_SNAKE_CASE : Union[str, Any] ) -> bool: """simple docstring""" return str(_lowerCAmelCase ) == str(_lowerCAmelCase )[::-1] def _snake_case ( _SCREAMING_SNAKE_CASE : List[Any] ) ...
433
import os def A_ ( ) -> Union[str, Any]: with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f: UpperCamelCase : Optional[Any] = [] # noqa: E741 for _ in range(20 ): l.append([int(_lowerCAmelCase ) for x in f.readline().split()] ) UpperCamelCase : ...
629
0
'''simple docstring''' import math from typing import Any, Callable, List, Optional, Tuple, Union import numpy as np import torch from ...models import TaFilmDecoder from ...schedulers import DDPMScheduler from ...utils import is_onnx_available, logging, randn_tensor if is_onnx_available(): from ..onnx_ut...
119
import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class A__ : _UpperCAmelCase :Union[str, Any] = None def __UpperCamelCase( self ): '''simple docstring''' UpperCamelCase : int ...
629
0
"""simple docstring""" import argparse from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import BigBirdPegasusConfig, BigBirdPegasusForConditionalGeneration _lowerCAmelCase : Optional[int] = [ # tf -> hf ("""/""", """."""), ("""...
46
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor __lowerCamelCase : Optional[Any] = logging.get_logger(__name__) class A__ ( __snake_case ): def __init__( self , *A_ , **A_ ): '''simple docstring''' ...
629
0
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching between c...
305
from __future__ import annotations import math def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> float: UpperCamelCase : Tuple = u for i in range(1 , _lowerCAmelCase ): UpperCamelCase : Any = temp * (u - i) return temp def A_ ( ) -> ...
629
0
from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def __A ( ): """simple docstring""" __a = 9, 14 # noqa: F841 __a = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, 8, 7], [7, 6, 1], [2, 8, ...
197
# Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar __lowerCamelCase : str = TypeVar("""T""") class A__ ( Generic[T] ): def __init__( ...
629
0
from __future__ import annotations from math import gcd def _lowerCamelCase ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE = 2 , SCREAMING_SNAKE_CASE = 1 , SCREAMING_SNAKE_CASE = 3 , ): '''simple docstring''' if num < 2: raise ValueError('''The input va...
203
from typing import List, Optional, Union import numpy as np import torch import torchaudio.compliance.kaldi as ta_kaldi from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import PaddingStrategy, TensorType, logging __low...
629
0
'''simple docstring''' from dataclasses import dataclass, field from typing import Optional from transformers import AutoConfig, AutoImageProcessor, AutoTokenizer, FlaxVisionEncoderDecoderModel, HfArgumentParser @dataclass class __SCREAMING_SNAKE_CASE : """simple docstring""" ...
692
import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGenerationPipeline from transformers.testing_utils...
629
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) a ={ """configuration_mega""": ["""MEGA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MegaConfig""", """MegaOnnxConfig"""], } try: if not is_torch_available()...
652
__lowerCamelCase : Any = 9.8_0_6_6_5 def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase = g ) -> float: if fluid_density <= 0: raise ValueError("Impossible fluid density" ) if volume < 0: raise ValueError("Impossible Object volume" ) if gravity <= 0: raise...
629
0
'''simple docstring''' def _lowerCAmelCase ( lowercase : Optional[Any] , lowercase : Optional[int] , lowercase : int , lowercase : List[Any] , lowercase : str ) ->int: """simple docstring""" if index == number_of_items: ...
161
import numpy as np import qiskit def A_ ( _lowerCAmelCase = 8 , _lowerCAmelCase = None ) -> str: UpperCamelCase : Tuple = np.random.default_rng(seed=_lowerCAmelCase ) # Roughly 25% of the qubits will contribute to the key. # So we take more than we need. UpperCamelCase...
629
0
import numpy as np import qiskit def _lowercase ( __lowerCamelCase : Tuple = 8 ,__lowerCamelCase : List[str] = None ) -> str: '''simple docstring''' UpperCamelCase__ : Tuple = np.random.default_rng(seed=_lowerCAmelCase ) # Roug...
344
from typing import TYPE_CHECKING from ...utils import _LazyModule __lowerCamelCase : str = {"""tokenization_byt5""": ["""ByT5Tokenizer"""]} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys __lowerCamelCase : List[str] = _LazyModule(__name__, glo...
629
0
'''simple docstring''' class a__: '''simple docstring''' def __init__( self): """simple docstring""" lowerCAmelCase = {} # Mapping from char to TrieNode lowerCAmelCase = False def a_ ( self , __lowerCAmelCase): """simple docstri...
370
# Usage: # ./gen-card-facebook-wmt19.py import os from pathlib import Path def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> str: UpperCamelCase : Union[str, Any] = { "en": "Machine learning is great, isn't it?", "ru": "Машинное обучение - эт...
629
0
'''simple docstring''' import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration UpperCAmelCase = 5_0000 UpperCAmelCase = 5000 UpperCAmelCase = os.path.split(__file__) UpperCAmelCase ...
433
def A_ ( _lowerCAmelCase = 1000 ) -> int: UpperCamelCase : Optional[int] = -1 UpperCamelCase : int = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c UpperCamelCase : Optional[Any] = (n *...
629
0
'''simple docstring''' from graphs.minimum_spanning_tree_kruskal import kruskal def __UpperCamelCase ( ): '''simple docstring''' __lowercase =9 __lowercase =[ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, 8, 7], [7, 6, 1], ...
119
def A_ ( _lowerCAmelCase ) -> bool: UpperCamelCase : List[Any] = 0 for ch in input_str: UpperCamelCase : Optional[Any] = ord(_lowerCAmelCase ) UpperCamelCase : Optional[Any] = pow(2 , _lowerCAmelCase ) # If we already turned on bit for ...
629
0
"""simple docstring""" import pytest from datasets import inspect_metric, list_metrics, load_metric @pytest.fixture def lowerCamelCase_( _lowerCamelCase ) -> int: '''simple docstring''' monkeypatch.setattr("datasets.utils.deprecation_utils._emitted_deprecation_warnings" ...
46
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_common import Confi...
629
0
from __future__ import annotations from cmath import sqrt def A__ ( lowercase: List[Any], lowercase: Tuple, lowercase: List[Any] ) -> tuple[complex, complex]: if a == 0: raise ValueError('Coefficient \'a\' must not be zero.' ) A : Union[str, Any]...
305
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __lowerCamelCase : List[Any] = { """configuration_chinese_clip""": [ """CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ChineseCLIPConfig"""...
629
0
from math import factorial class A_ : def __init__( self : List[str] , __SCREAMING_SNAKE_CASE : Any , __SCREAMING_SNAKE_CASE : Optional[Any] ): __a = real if isinstance(A_ , A_ ): __a = [1] * rank else: __a = rank def __repr__( ...
197
def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[int]: UpperCamelCase : List[Any] = [1] for i in range(2 , _lowerCAmelCase ): factorials.append(factorials[-1] * i ) assert 0 <= k < factorials[-1] * n, "k out of bounds" UpperCamelCase : Tuple =...
629
0
import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, Value, load_dataset from transformers import DPRContex...
203
import inspect import math import tempfile import unittest import numpy as np from transformers import ViTMAEConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_confi...
629
0
'''simple docstring''' import os from collections.abc import Iterator def _lowerCamelCase ( lowercase : List[Any] = "." ) -> Iterator[str]: for dir_path, dir_names, filenames in os.walk(_lowerCAmelCase ): _a = [d for d in dir_names if d != "scripts...
692
def A_ ( _lowerCAmelCase ) -> bool: return str(_lowerCAmelCase ) == str(_lowerCAmelCase )[::-1] def A_ ( _lowerCAmelCase ) -> int: return int(_lowerCAmelCase ) + int(str(_lowerCAmelCase )[::-1] ) def A_ ( _lowerCAmelCase = 1_0000 ) -> int: UpperCamelCase...
629
0
import contextlib from multiprocessing import Pool, RLock from tqdm.auto import tqdm from ..utils import experimental, logging a =logging.get_logger(__name__) class A_ : _UpperCAmelCase : List[str] = None @experimental def SCREAMING_SNAKE_CASE...
652
__lowerCamelCase : str = 6_5521 def A_ ( _lowerCAmelCase ) -> int: UpperCamelCase : Any = 1 UpperCamelCase : str = 0 for plain_chr in plain_text: UpperCamelCase : List[Any] = (a + ord(_lowerCAmelCase )) % MOD_ADLER UpperCamelCase...
629
0
'''simple docstring''' # Imports import numpy as np class __A : """simple docstring""" def __init__( self , _lowerCamelCase=None , _lowerCamelCase=None , _lowerCamelCase=None , _lowerCamelCase=None , _lowerCamelCase=None )-> Any: self....
161
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 PaddingStrategy, logging __lo...
629
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _SCREAMING_SNAKE_CASE : List[Any] = { """configuration_chinese_clip""": [ """CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ChineseCLI...
344
from typing import Any def A_ ( _lowerCAmelCase ) -> list[Any]: if not input_list: return [] UpperCamelCase : List[str] = [input_list.count(_lowerCAmelCase ) for value in input_list] UpperCamelCase : Dict = max(_lowerCAmelCase ) # Gets the maximum count in...
629
0
'''simple docstring''' from PIL import Image def snake_case__ ( _A: Dict , _A: Tuple ) -> Image: '''simple docstring''' def brightness(_A: Union[str, Any] ) -> float: return 128 + level + (c - 128) if not -255.0 <= level <= 255.0: raise ValueError("""l...
370
from random import shuffle import tensorflow as tf from numpy import array def A_ ( _lowerCAmelCase , _lowerCAmelCase ) -> Optional[Any]: UpperCamelCase : List[Any] = int(_lowerCAmelCase ) assert noofclusters < len(_lowerCAmelCase ) # Find out the dimensionality Upper...
629
0
'''simple docstring''' import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def _snake_case ( _SCREAMING_SNAKE_CASE : Union[str, Any] , _SCREAMING_SNAKE_CASE : Dict , _SCREAMING_SNAKE_CASE : Tuple ) ...
433
import os def A_ ( ) -> Union[str, Any]: with open(os.path.dirname(_lowerCAmelCase ) + "/grid.txt" ) as f: UpperCamelCase : Optional[Any] = [] # noqa: E741 for _ in range(20 ): l.append([int(_lowerCAmelCase ) for x in f.readline().split()] ) UpperCamelCase : ...
629
0