code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
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 lowercase_ = logging.get_logger(__name__) class __UpperCamelCase ( lowerCAmelCase__ ): """si...
303
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator from typing import Any class UpperCamelCase : def __init__( self, lowerCAmelCase__) -> Optional[int]: snake_case_ = data snake_case_ ...
69
0
"""simple docstring""" def __magic_name__ ( __snake_case : Union[str, Any] = 50 ) -> int: lowercase : str = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_...
202
"""simple docstring""" import inspect import re from transformers.utils import direct_transformers_import # 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 __UpperCamelCase = '''src/transformers''' # This ...
69
0
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer lowercase : Optional[Any] = logging.get_logger(__name__) lowercase : Dict = {"""vocab_...
99
"""simple docstring""" from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean __UpperCamelCase = 0 __UpperCamelCase = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], ...
69
0
import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin A_ : Optional[Any] = get_tests_dir('fixtures/test_sent...
333
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: while a != 0: snake_case_ , snake_case_ = b % a, a return b def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: ...
69
0
from functools import reduce _snake_case : Tuple = ( "73167176531330624919225119674426574742355349194934" "96983520312774506326239578318016984801869478851843" "85861560789112949495459501737958331952853208805511" "12540698747158523863050715693290963295227443043557" "66896648950445244...
123
"""simple docstring""" 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, ) __UpperCamelCase = { '''configuratio...
69
0
from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean SCREAMING_SNAKE_CASE__ : Optional[Any] = 0 SCREAMING_SNAKE_CASE__ : int = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are ...
48
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaP...
69
0
import os def A_ ( _UpperCAmelCase = "matrix.txt" ): with open(os.path.join(os.path.dirname(_UpperCAmelCase ) , _UpperCAmelCase ) ) as in_file: SCREAMING_SNAKE_CASE_: Union[str, Any] = in_file.read() SCREAMING_SNAKE_CASE_: int = [[int(_UpperC...
13
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase ) -> list: if len(UpperCAmelCase ) <= 1: return [tuple(UpperCAmelCase )] snake_case_ = [] def generate(UpperCAmelCase , UpperCAmelCase ): snake_case_ = ...
69
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { """facebook/data2vec-...
302
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta.token...
69
0
'''simple docstring''' from __future__ import annotations import math def SCREAMING_SNAKE_CASE_ ( _UpperCAmelCase : int ) -> list[int]: if num <= 0: _a : List[Any] =F"{num}: Invalid input, please enter a positive integer." raise ...
276
"""simple docstring""" import sys from collections import defaultdict class UpperCamelCase : def __init__( self) -> Optional[int]: snake_case_ = [] def a_ ( self, lowerCAmelCase__) -> Any: return self.node_pos...
69
0
'''simple docstring''' from __future__ import annotations import random import unittest from transformers import TransfoXLConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ...
250
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCamelCase = { '''configuration_mctct''': ['''MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MCTCTConfig'''], '''feature_extraction_mctct''': ['''MCTCTFe...
69
0
'''simple docstring''' import pytest import requests from datasets.utils.file_utils import http_head from .utils import OfflineSimulationMode, RequestWouldHangIndefinitelyError, offline @pytest.mark.integration def __UpperCAmelCase ( ): with offline(OfflineSimulationMode.CONNECTION_TIMES_OUT ...
145
"""simple docstring""" from math import factorial def UpperCAmelCase ( UpperCAmelCase = 20 ) -> int: snake_case_ = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... snake_case_ = n // 2 return int(fa...
69
0
def a__ ( snake_case , snake_case ): """simple docstring""" _validate_point(snake_case ) _validate_point(snake_case ) if len(snake_case ) != len(snake_case ): raise ValueError('''Both points must be in the same n-dimensional space''' ) return float(sum(abs(a - b ...
303
"""simple docstring""" import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: ...
69
0
"""simple docstring""" import inspect import unittest from huggingface_hub import hf_hub_download from transformers import ConvNextConfig, UperNetConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import is...
202
"""simple docstring""" import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class UpperCamelCase ( lowerCAmelCase__ ): ...
69
0
import subprocess import sys from transformers import BertConfig, BertModel, BertTokenizer, pipeline from transformers.testing_utils import TestCasePlus, require_torch class A__ ( lowerCAmelCase__ ): """simple docstring""" @require_torch def __lowercase ( self) -> ...
99
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ) -> bool: # 1. Validate that path exists between current and next vertices if graph[path[curr_ind - 1]][next_ver] == 0: return False ...
69
0
import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor A_ : int = logging.get_logger(__name__) class A_ ( lowerCAmelCase__ ): '''simple docstring''' def __init__(self , *lowercase__ , **lowe...
333
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) __Up...
69
0
import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def lowerCAmelCase_ ( __lowerCamelCase , __lowerCamelCase , __lowerCamelCase ): __snake_case : Union[str, Any] = OmegaConf.load(__lowerCamelCase ) ...
123
"""simple docstring""" from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def UpperCAmelCase ( ) -> int: snake_case_ = HfArgumentParser(UpperCAmelCase ) snake_case_ = parser.parse_args_into_dataclasses()[0] ...
69
0
import json import os import tempfile import datasets from utils import generate_example_dataset, get_duration SCREAMING_SNAKE_CASE__ : Dict = 50000 SCREAMING_SNAKE_CASE__ : int = 5000 SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ : List[Any] = os.p...
48
"""simple docstring""" from __future__ import annotations def UpperCAmelCase ( UpperCAmelCase ) -> None: create_state_space_tree(UpperCAmelCase , [] , 0 , [0 for i in range(len(UpperCAmelCase ) )] ) def UpperCAmelCase ( UpperCAmel...
69
0
import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging lowerCAmelCase : Optional[Any] = logging.get_logger(__name__) def A_ ( _UpperCAmelCase , _UpperCAmelCase ): SCREAMING_SNAKE_CASE_: Optio...
13
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase = False ) -> bool: if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 10 not in (1, 3, 7, 9): # can quickly check last digit return False ...
69
0
import os def lowerCAmelCase__ ( ): """simple docstring""" with open(os.path.dirname(_SCREAMING_SNAKE_CASE ) + """/p022_names.txt""" ) as file: __a = str(file.readlines()[0] ) __a = names.replace("""\"""" , """""" ).split(""",""" ) ...
302
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __UpperCamelCase = { '''configuration_resnet''': ['''RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Re...
69
0
'''simple docstring''' def SCREAMING_SNAKE_CASE_ ( _UpperCAmelCase : List[str] ,_UpperCAmelCase : Tuple = False ) -> bool: if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 10 not in (1, 3, 7, 9): # can qu...
276
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging ...
69
0
'''simple docstring''' import argparse import os from . import ( ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BART_PRETRAINED_MODEL_ARCHIVE_LIST, BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,...
250
"""simple docstring""" from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = '''T5Config''' class UpperCamelCase ...
69
0
'''simple docstring''' import math class A__ : """simple docstring""" def _lowerCAmelCase ( self : List[str] , lowerCAmelCase__ : Union[str, Any] , lowerCAmelCase__ : Union[str, Any] ) -> int: """simple docstring""" ...
145
"""simple docstring""" import argparse __UpperCamelCase = '''docs/source/_static/js/custom.js''' def UpperCAmelCase ( UpperCAmelCase ) -> int: with open(UpperCAmelCase , encoding='utf-8' , newline='\n' ) as f: snake_case_ = f....
69
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta.tokenization_ta import TaToken...
303
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator from typing import Any class UpperCamelCase : def __init__( self, lowerCAmelCase__) -> Optional[int]: snake_case_ = data snake_case_ ...
69
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSD...
202
"""simple docstring""" import inspect import re from transformers.utils import direct_transformers_import # 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 __UpperCamelCase = '''src/transformers''' # This ...
69
0
from __future__ import annotations import unittest from transformers import BlenderbotConfig, BlenderbotTokenizer, is_tf_available from transformers.testing_utils import require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ConfigTester fro...
99
"""simple docstring""" from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean __UpperCamelCase = 0 __UpperCamelCase = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], ...
69
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, ) A_ : List[Any] = { 'configuration_bert': ...
333
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: while a != 0: snake_case_ , snake_case_ = b % a, a return b def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: ...
69
0
from __future__ import annotations class a : """simple docstring""" def __init__( self : Tuple , lowerCamelCase : List[Any] , lowerCamelCase : Dict ) -> str: __snake_case , __snake_case : Dict = text, pattern _...
123
"""simple docstring""" 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, ) __UpperCamelCase = { '''configuratio...
69
0
def A ( _SCREAMING_SNAKE_CASE ) -> bool: if not all(x.isalpha() for x in string ): raise ValueError("String must only contain alphabetic characters." ) lowerCamelCase : Dict = sorted(string.lower() ) return len(_SCREAMING_SNAKE_...
48
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaP...
69
0
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 # Copied from diffusers.sc...
13
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase ) -> list: if len(UpperCAmelCase ) <= 1: return [tuple(UpperCAmelCase )] snake_case_ = [] def generate(UpperCAmelCase , UpperCAmelCase ): snake_case_ = ...
69
0
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class SCREAMING_SNAKE_CASE ( lowerCAmelCase__ ): __lowerCamelCase : ...
302
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta.token...
69
0
'''simple docstring''' def SCREAMING_SNAKE_CASE_ ( _UpperCAmelCase : Optional[int] ) -> bool: return str(_UpperCAmelCase ) == str(_UpperCAmelCase )[::-1] def SCREAMING_SNAKE_CASE_ ( _UpperCAmelCase : List[str] ) -> int: return int(_UpperCAmelCase ) + int(...
276
"""simple docstring""" import sys from collections import defaultdict class UpperCamelCase : def __init__( self) -> Optional[int]: snake_case_ = [] def a_ ( self, lowerCAmelCase__) -> Any: return self.node_pos...
69
0
'''simple docstring''' from __future__ import annotations from collections.abc import Generator def _A ( ) -> Generator[int, None, None]: _lowercase : List[Any] = {} _lowercase : List[str] = 2 while True: _lowercase : List[str] = factor_ma...
250
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCamelCase = { '''configuration_mctct''': ['''MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MCTCTConfig'''], '''feature_extraction_mctct''': ['''MCTCTFe...
69
0
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __a = logging.get_logger(__name__) __a = {'vocab_f...
145
"""simple docstring""" from math import factorial def UpperCAmelCase ( UpperCAmelCase = 20 ) -> int: snake_case_ = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... snake_case_ = n // 2 return int(fa...
69
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { """facebook/wav2vec2-base-960h""": """https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/co...
303
"""simple docstring""" import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: ...
69
0
"""simple docstring""" def __magic_name__ ( __snake_case : str ) -> int: lowercase : Any = [[0 for _ in range(__snake_case )] for _ in range(m + 1 )] for i in range(m + 1 ): lowercase : str = 1 for n in ra...
202
"""simple docstring""" import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class UpperCamelCase ( lowerCAmelCase__ ): ...
69
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging lowercase : Any = logging.get_logger(__name__) lowercase ...
99
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ) -> bool: # 1. Validate that path exists between current and next vertices if graph[path[curr_ind - 1]][next_ver] == 0: return False ...
69
0
import inspect import re from transformers.utils import direct_transformers_import # 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 A_ : List[Any] = 'src/transformers' # This is to make sur...
333
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) __Up...
69
0
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor _snake_case : List[str] = logging.get_logger(__name__) class a (lowerCAmelCase__ ): """simple docstring""" def __init__( self : str , *lowerCamel...
123
"""simple docstring""" from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def UpperCAmelCase ( ) -> int: snake_case_ = HfArgumentParser(UpperCAmelCase ) snake_case_ = parser.parse_args_into_dataclasses()[0] ...
69
0
import qiskit def A ( _SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE ) -> qiskit.result.counts.Counts: lowerCamelCase : List[str] = qiskit.Aer.get_backend("aer_simulator" ) # Create a Quantum Circuit acting on the q register lowerCamelCase : ...
48
"""simple docstring""" from __future__ import annotations def UpperCAmelCase ( UpperCAmelCase ) -> None: create_state_space_tree(UpperCAmelCase , [] , 0 , [0 for i in range(len(UpperCAmelCase ) )] ) def UpperCAmelCase ( UpperCAmel...
69
0
from __future__ import annotations from collections.abc import Iterator from typing import Any class __lowercase : """simple docstring""" def __init__( self : Optional[int] , lowerCAmelCase__ : Tuple): SCREAMING_SNAKE_CASE_: Dict = data SCREAMING_S...
13
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase = False ) -> bool: if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 10 not in (1, 3, 7, 9): # can quickly check last digit return False ...
69
0
import gc import unittest import numpy as np import torch from diffusers import StableDiffusionKDiffusionPipeline from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu enable_full_determinism() @slow @require_torch_gpu class ...
302
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __UpperCamelCase = { '''configuration_resnet''': ['''RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Re...
69
0
'''simple docstring''' from __future__ import annotations import math import numpy as np from numpy.linalg import norm def SCREAMING_SNAKE_CASE_ ( _UpperCAmelCase : Dict ,_UpperCAmelCase : Optional[Any] ) -> float: return math.sqrt(sum(pow(a - b ,2 ) for a, b in...
276
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging ...
69
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _snake_case = { 'configuration_nllb_moe': [ 'NLLB_MOE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'NllbMoeConfig', ] } try: if not is_torch_available():...
250
"""simple docstring""" from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = '''T5Config''' class UpperCamelCase ...
69
0
'''simple docstring''' import math def __UpperCAmelCase ( a_: List[str], a_: Any ): if 0 not in (x, y): # We use the relation x^y = y*log10(x), where 10 is the base. return y * math.logaa(a_ ) else: if x == 0: # 0 raised to any number is 0 ...
145
"""simple docstring""" import argparse __UpperCamelCase = '''docs/source/_static/js/custom.js''' def UpperCAmelCase ( UpperCAmelCase ) -> int: with open(UpperCAmelCase , encoding='utf-8' , newline='\n' ) as f: snake_case_ = f....
69
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { """funnel-transformer/small""": """https://huggingface.co/funnel-transformer/small/resolve/main/config.json""", """funnel-transformer/...
303
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator from typing import Any class UpperCamelCase : def __init__( self, lowerCAmelCase__) -> Optional[int]: snake_case_ = data snake_case_ ...
69
0
"""simple docstring""" import torch from torch import nn from transformers import CLIPPreTrainedModel, CLIPVisionModel from ...models.attention import BasicTransformerBlock from ...utils import logging _A : str = logging.get_logger(__name__) # pylint: disable=invalid-name cla...
202
"""simple docstring""" import inspect import re from transformers.utils import direct_transformers_import # 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 __UpperCamelCase = '''src/transformers''' # This ...
69
0
import socket def A_ ( ) -> List[str]: a__ : Any = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) a__ : Dict = socket.gethostname() a__ : List[str] = 1_2312 sock.connect((host, port) ) sock.send(B'Hello server!' ) with o...
99
"""simple docstring""" from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean __UpperCamelCase = 0 __UpperCamelCase = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], ...
69
0
from dataclasses import dataclass from enum import Enum from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import BaseOutput, is_torch_available, is_transformers_available @dataclass class A_ ( lowerCAmelCase__ ): '''simple d...
333
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: while a != 0: snake_case_ , snake_case_ = b % a, a return b def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: ...
69
0
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTImageProcessor, ViTMSNConfig, ViTMSNModel from transformers.image_utils import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD torch.set_grad_enabled(False) de...
123
"""simple docstring""" 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, ) __UpperCamelCase = { '''configuratio...
69
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE__ : Optional[Any] = { 'configuration_lxmert': ['LXMERT_PRETRAINED_CONFI...
48
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaP...
69
0
def A_ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_: Union[str, Any] = len(_UpperCAmelCase ), len(grid[0] ) if ( min(_UpperCAmelCase , _UpperCAmelCase ) < 0 or ro...
13
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase ) -> list: if len(UpperCAmelCase ) <= 1: return [tuple(UpperCAmelCase )] snake_case_ = [] def generate(UpperCAmelCase , UpperCAmelCase ): snake_case_ = ...
69
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { """asapp/sew-tiny-100k""": """https://huggingface.co/asapp/sew-tiny-100k/resolve/main/config.json""", # See a...
302
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta.token...
69
0
'''simple docstring''' import argparse import os import pickle import sys import torch from transformers import TransfoXLConfig, TransfoXLLMHeadModel, load_tf_weights_in_transfo_xl from transformers.models.transfo_xl import tokenization_transfo_xl as data_utils from transformers.models.t...
276
"""simple docstring""" import sys from collections import defaultdict class UpperCamelCase : def __init__( self) -> Optional[int]: snake_case_ = [] def a_ ( self, lowerCAmelCase__) -> Any: return self.node_pos...
69
0
'''simple docstring''' import torch from transformers import AutoModel class a__ ( torch.nn.Module ): def __init__( self , _UpperCamelCase="sayef/fsner-bert-base-uncased" ): """simple docstring""" super(lowerCAmelCase__ , self ).__init__() _lowercase : ...
250
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCamelCase = { '''configuration_mctct''': ['''MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MCTCTConfig'''], '''feature_extraction_mctct''': ['''MCTCTFe...
69
0
'''simple docstring''' from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def __UpperCAmelCase ( ): _UpperCAmelCase : int = HfArgumentParser(a_ ) _UpperCAmelCase : Optional[int] = parser.parse_args_into_dataclasses()[0] ...
145
"""simple docstring""" from math import factorial def UpperCAmelCase ( UpperCAmelCase = 20 ) -> int: snake_case_ = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... snake_case_ = n // 2 return int(fa...
69
0
def a__ ( snake_case ): """simple docstring""" return "".join([hex(snake_case )[2:].zfill(2 ).upper() for byte in list(snake_case )] ) def a__ ( snake_case ): """simple docstring""" # Check data validity, following RFC3548 # https://www.ietf.org/rfc/rfc3548.txt i...
303
"""simple docstring""" import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: ...
69
0
"""simple docstring""" import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is...
202
"""simple docstring""" import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class UpperCamelCase ( lowerCAmelCase__ ): ...
69
0
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 ..models.auto.modelin...
99
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ) -> bool: # 1. Validate that path exists between current and next vertices if graph[path[curr_ind - 1]][next_ver] == 0: return False ...
69
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A_ : Optional[int] = logging.get_logger(__name__) A_ : str = { 'f...
333
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) __Up...
69
0
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder _snake_case : Tuple = datasets.utils.logging.get_logger(__name__) class a (folder_based_builder.FolderBasedBuilderConfig ): """simple d...
123
"""simple docstring""" from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def UpperCAmelCase ( ) -> int: snake_case_ = HfArgumentParser(UpperCAmelCase ) snake_case_ = parser.parse_args_into_dataclasses()[0] ...
69
0
import argparse import os import torch from transformers.utils import WEIGHTS_NAME SCREAMING_SNAKE_CASE__ : Optional[int] = ['small', 'medium', 'large'] SCREAMING_SNAKE_CASE__ : Any = 'lm_head.decoder.weight' SCREAMING_SNAKE_CASE__ : List[str] = 'lm_he...
48
"""simple docstring""" from __future__ import annotations def UpperCAmelCase ( UpperCAmelCase ) -> None: create_state_space_tree(UpperCAmelCase , [] , 0 , [0 for i in range(len(UpperCAmelCase ) )] ) def UpperCAmelCase ( UpperCAmel...
69
0
import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore lowerCAmelCase : List[Any] = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" lowerCAmelCase : Dict = [fil...
13
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase = False ) -> bool: if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 10 not in (1, 3, 7, 9): # can quickly check last digit return False ...
69
0
import functools from typing import Any def lowerCAmelCase__ ( _SCREAMING_SNAKE_CASE : List[str] , _SCREAMING_SNAKE_CASE : List[str] ): """simple docstring""" if not isinstance(_SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ) or len(_SCREAMING_SNAKE_CASE ) == 0: ra...
302
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __UpperCamelCase = { '''configuration_resnet''': ['''RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Re...
69
0
'''simple docstring''' import torch from ..models.auto import AutoModelForSequenceClassification, AutoTokenizer from .base import PipelineTool class A__ ( lowerCAmelCase__ ): __UpperCamelCase : Optional[int] = "facebook/bart-large-mnli" ...
276
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging ...
69
0
'''simple docstring''' from math import factorial def _A ( snake_case = 20 ) -> int: _lowercase : Any = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... _lowercase : Dict = n // 2 return int(factorial(snake_case ...
250
"""simple docstring""" from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = '''T5Config''' class UpperCamelCase ...
69
0
'''simple docstring''' from __future__ import annotations from collections.abc import Iterable, Iterator from dataclasses import dataclass __a = (3, 9, -11, 0, 7, 5, 1, -1) __a = (4, 6, 2, 0, 8, 10, 3, -2) @dataclass class A__ : """simple docstring""" Upp...
145
"""simple docstring""" import argparse __UpperCamelCase = '''docs/source/_static/js/custom.js''' def UpperCAmelCase ( UpperCAmelCase ) -> int: with open(UpperCAmelCase , encoding='utf-8' , newline='\n' ) as f: snake_case_ = f....
69
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 DPRContext...
303
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator from typing import Any class UpperCamelCase : def __init__( self, lowerCAmelCase__) -> Optional[int]: snake_case_ = data snake_case_ ...
69
0
"""simple docstring""" import warnings from functools import wraps from typing import Callable def __magic_name__ ( __snake_case : Optional[int] ) -> Callable: @wraps(__snake_case ) def _inner_fn(*__snake_case : List[str] , **__snake_case : ...
202
"""simple docstring""" import inspect import re from transformers.utils import direct_transformers_import # 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 __UpperCamelCase = '''src/transformers''' # This ...
69
0
from __future__ import annotations lowercase : Any = list[list[int]] # assigning initial values to the grid lowercase : List[Any] = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9...
99
"""simple docstring""" from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean __UpperCamelCase = 0 __UpperCamelCase = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], ...
69
0
import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def __a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE , ...
333
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: while a != 0: snake_case_ , snake_case_ = b % a, a return b def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: ...
69
0
import sys from collections import defaultdict class a : """simple docstring""" def __init__( self : Optional[int] ) -> Optional[int]: __snake_case : List[str] = [] def __snake_case ( self : Union[str, Any] , lower...
123
"""simple docstring""" 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, ) __UpperCamelCase = { '''configuratio...
69
0
from pathlib import Path import fire from tqdm import tqdm def A ( _SCREAMING_SNAKE_CASE="ro" ,_SCREAMING_SNAKE_CASE="en" ,_SCREAMING_SNAKE_CASE="wmt16" ,_SCREAMING_SNAKE_CASE=None ) -> None: try: import datasets except (ModuleNotFoundError, ImportError)...
48
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaP...
69
0
import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ......
13
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase ) -> list: if len(UpperCAmelCase ) <= 1: return [tuple(UpperCAmelCase )] snake_case_ = [] def generate(UpperCAmelCase , UpperCAmelCase ): snake_case_ = ...
69
0
import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency lowerCamelCase__ = { """E""": 12.70, """T""": 9.06, """A""": 8.17, """O""": 7.51, """I""": 6.97, """N""": 6.75, """S""": 6.33, """H""": 6.09, """R""": 5.99, """D""": 4.25, """L""": ...
302
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta.token...
69
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging A__: Union[str, Any] = logging.get_logger(__name__) A__: Union[str, Any] = { '''bigcode/gpt_bigcode-santacoder''': '''https://huggingface.co/bigcod...
276
"""simple docstring""" import sys from collections import defaultdict class UpperCamelCase : def __init__( self) -> Optional[int]: snake_case_ = [] def a_ ( self, lowerCAmelCase__) -> Any: return self.node_pos...
69
0
'''simple docstring''' from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class a__ : pass
250
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCamelCase = { '''configuration_mctct''': ['''MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MCTCTConfig'''], '''feature_extraction_mctct''': ['''MCTCTFe...
69
0
'''simple docstring''' def __UpperCAmelCase ( a_: Union[str, Any], a_: Dict ): if not (isinstance(a_, a_ ) and isinstance(a_, a_ )): raise ValueError("longest_common_substring() takes two strings for inputs" ) _UpperCAmelCase : List[str] ...
145
"""simple docstring""" from math import factorial def UpperCAmelCase ( UpperCAmelCase = 20 ) -> int: snake_case_ = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... snake_case_ = n // 2 return int(fa...
69
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowercase_ = { """configuration_squeezebert""": [ """SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """SqueezeBertConfig""", """...
303
"""simple docstring""" import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: ...
69
0
"""simple docstring""" import argparse import os import shutil from pathlib import Path import onnx import torch from packaging import version from torch.onnx import export from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, StableDiffusionPipeline _A : Dict = ...
202
"""simple docstring""" import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class UpperCamelCase ( lowerCAmelCase__ ): ...
69
0
import argparse import json import torch from diffusers import DDPMScheduler, LDMPipeline, UNetaDModel, VQModel def A_ ( A__ , A__=1 ) -> Any: if n_shave_prefix_segments >= 0: return ".".join(path.split('.' )[n_shave_prefix_segments:] ) else: return...
99
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ) -> bool: # 1. Validate that path exists between current and next vertices if graph[path[curr_ind - 1]][next_ver] == 0: return False ...
69
0
A_ : List[Any] = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] A_ : Optional[int] = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] A_ : List[Any] = { 0: 'Sunday', 1: 'Monday', 2: 'Tuesday', 3: 'Wednesday', 4: 'Thursday', 5: 'Friday', 6: 'Saturday', } def ...
333
"""simple docstring""" import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) __Up...
69
0
import multiprocessing from typing import TYPE_CHECKING, Optional, Union from .. import Dataset, Features, config from ..formatting import query_table from ..packaged_modules.sql.sql import Sql from ..utils import logging from .abc import AbstractDatasetInputStream if TYPE_CHECKING: import sqlitea import s...
123
"""simple docstring""" from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def UpperCAmelCase ( ) -> int: snake_case_ = HfArgumentParser(UpperCAmelCase ) snake_case_ = parser.parse_args_into_dataclasses()[0] ...
69
0
def A ( _SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE ) -> int: while a != 0: lowerCamelCase , lowerCamelCase : Dict = b % a, a return b def A ( _SCREAMING_SNAKE_CASE ,_SCREAMING_SNAKE_CASE ) -> int: if gcd(_SCRE...
48
"""simple docstring""" from __future__ import annotations def UpperCAmelCase ( UpperCAmelCase ) -> None: create_state_space_tree(UpperCAmelCase , [] , 0 , [0 for i in range(len(UpperCAmelCase ) )] ) def UpperCAmelCase ( UpperCAmel...
69
0
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.utils import cached_property from ......
13
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase = False ) -> bool: if n == 2: return True if not n % 2 or n < 2: return False if n > 5 and n % 10 not in (1, 3, 7, 9): # can quickly check last digit return False ...
69
0
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, Wav...
302
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __UpperCamelCase = { '''configuration_resnet''': ['''RESNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Re...
69
0
'''simple docstring''' import argparse A__: Any = '''docs/source/_static/js/custom.js''' def SCREAMING_SNAKE_CASE_ ( _UpperCAmelCase : str ) -> int: with open(_UpperCAmelCase ,encoding="""utf-8""" ,newline="""\n""" ) as f: _a : O...
276
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging ...
69
0
'''simple docstring''' import argparse from tax import checkpoints from transformers import AutoConfig, FlaxAutoModelForSeqaSeqLM def _A ( snake_case , snake_case , snake_case ) -> List[str]: _lowercase : Dict = AutoConfig.from_pretrained(snake_case ) _lowe...
250
"""simple docstring""" from ...utils import logging from ..ta.modeling_tf_ta import TFTaEncoderModel, TFTaForConditionalGeneration, TFTaModel from .configuration_mta import MTaConfig __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase = '''T5Config''' class UpperCamelCase ...
69
0
'''simple docstring''' import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex from .utils import re...
145
"""simple docstring""" import argparse __UpperCamelCase = '''docs/source/_static/js/custom.js''' def UpperCAmelCase ( UpperCAmelCase ) -> int: with open(UpperCAmelCase , encoding='utf-8' , newline='\n' ) as f: snake_case_ = f....
69
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) lowercase_ = {"""configuration_reformer""": ["""REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Reformer...
303
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator from typing import Any class UpperCamelCase : def __init__( self, lowerCAmelCase__) -> Optional[int]: snake_case_ = data snake_case_ ...
69
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _A : Optional[int] = {"""configuration_swin""": ["""SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """SwinConfig""", """SwinOnnxConfi...
202
"""simple docstring""" import inspect import re from transformers.utils import direct_transformers_import # 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 __UpperCamelCase = '''src/transformers''' # This ...
69
0
lowercase : Optional[Any] = range(2, 2_0 + 1) lowercase : List[str] = [1_0**k for k in range(ks[-1] + 1)] lowercase : Union[str, Any] = {} def A_ ( A__ , A__ , A__ , A__ ) -> Optional[int]: a__ : Optional[Any] = ...
99
"""simple docstring""" from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean __UpperCamelCase = 0 __UpperCamelCase = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], ...
69
0
def __a ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> list[str]: '''simple docstring''' return [sentence[i : i + ngram_size] for i in range(len(SCREAMING_SNAKE_CASE ) - ngram_size + 1 )] if __name__ == "__main__": from doctest import tes...
333
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: while a != 0: snake_case_ , snake_case_ = b % a, a return b def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: ...
69
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _snake_case : Tuple = { "configuration_biogpt": ["BIOGPT_PRETRAINED_CONFIG_ARCHIVE_MAP", "BioGptConfig"], "tokenization_biogpt": ["BioGptTokenizer"], ...
123
"""simple docstring""" 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, ) __UpperCamelCase = { '''configuratio...
69
0
from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar SCREAMING_SNAKE_CASE__ : Optional[int] = TypeVar('T') class UpperCamelCase__ (Generic[T] ): '''simple docstring''' lowerCamelCase_ : Tuple...
48
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaP...
69
0
import math import os from copy import deepcopy import datasets import evaluate import torch import transformers from datasets import load_dataset from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer from accelerate import Accelerator from accelerate.tes...
13
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase ) -> list: if len(UpperCAmelCase ) <= 1: return [tuple(UpperCAmelCase )] snake_case_ = [] def generate(UpperCAmelCase , UpperCAmelCase ): snake_case_ = ...
69
0
import numpy as np import torch from torch.utils.data import Dataset, IterableDataset from ..utils.generic import ModelOutput class SCREAMING_SNAKE_CASE ( lowerCAmelCase__ ): def __init__( self : Optional[int] , __lowercase : Any , __lowercase ...
302
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) if is_sentencepiece_available(): from ..ta.token...
69
0
'''simple docstring''' import json import os from dataclasses import dataclass from functools import partial from typing import Callable import flax.linen as nn import jax import jax.numpy as jnp import joblib import optax import wandb from flax import jax_utils, struct, traverse_util ...
276
"""simple docstring""" import sys from collections import defaultdict class UpperCamelCase : def __init__( self) -> Optional[int]: snake_case_ = [] def a_ ( self, lowerCAmelCase__) -> Any: return self.node_pos...
69
0
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotA...
250
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __UpperCamelCase = { '''configuration_mctct''': ['''MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''MCTCTConfig'''], '''feature_extraction_mctct''': ['''MCTCTFe...
69
0
'''simple docstring''' import sys from pathlib import Path __a = 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 # noqa from copy import d...
145
"""simple docstring""" from math import factorial def UpperCAmelCase ( UpperCAmelCase = 20 ) -> int: snake_case_ = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1, # 2, 3,... snake_case_ = n // 2 return int(fa...
69
0
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 checkouts and running tests. lowercase_ = abspath(join(dirname(dirname(dirname(__file__))), """src...
303
"""simple docstring""" import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModel, PreTrainedModel from ...utils import logging __UpperCamelCase = logging.get_logger(__name__) def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase ) -> int: ...
69
0