code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
import os import sys import unittest _UpperCamelCase = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import get_test_info # noqa: E402 from get_test_info import ( # noqa: E402 get_model_to_test_mapping, get_model_to_...
275
def _lowercase ( lowercase__ = 2_0_0 ): __lowerCAmelCase : Union[str, Any] = [1, 2, 5, 1_0, 2_0, 5_0, 1_0_0, 2_0_0] __lowerCAmelCase : Dict = [0] * (pence + 1) __lowerCAmelCase : Optional[int] = 1 # base case: 1 way to make 0 pence ...
275
1
"""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-2.0 #...
314
"""simple docstring""" import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def _snake_case ( _snake_case ...
314
1
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, AutoTokenizer...
339
from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo UpperCAmelCase__ = "\\n@misc{wu2016googles,\n title={Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation},\n author={Yonghui Wu and...
339
1
'''simple docstring''' import inspect from typing import Optional, Union import numpy as np import PIL import torch from torch.nn import functional as F from torchvision import transforms from transformers import CLIPFeatureExtractor, CLIPModel, CLIPTextModel, CLIPTokenizer from diffusers import ( Autoenc...
357
'''simple docstring''' from __future__ import annotations # This is the precision for this function which can be altered. # It is recommended for users to keep this number greater than or equal to 10. a : Optional[int] = 1_0 def __lowerCamelCase ( _lowercase , _lowercase , ...
338
0
"""simple docstring""" lowerCamelCase_ : List[Any] = """0.18.2""" from .configuration_utils import ConfigMixin from .utils import ( OptionalDependencyNotAvailable, is_flax_available, is_inflect_available, is_invisible_watermark_available, is_k_diffusion_ava...
81
'''simple docstring''' from __future__ import annotations from collections import Counter from random import random class lowerCAmelCase__ : def __init__( self ): """simple docstring""" lowercase_ : int = ...
93
0
'''simple docstring''' snake_case__ = { "joule": 1.0, "kilojoule": 10_00, "megajoule": 1_00_00_00, "gigajoule": 10_00_00_00_00, "wattsecond": 1.0, "watthour": 36_00, "kilowatthour": 3_60_00_00, "newtonmeter": 1.0, "calorie_nutr": 41_86.8, "kil...
4
'''simple docstring''' from __future__ import annotations from PIL import Image # Define glider example snake_case__ = [ [0, 1, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0, 0], [1, 1, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0...
4
1
import warnings from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dimension...
20
'''simple docstring''' import argparse import gc import json import os import re import torch from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedTokenizerFast, RwkvConfig from transformers.modeling_utils import WEIGHTS_INDEX_NAME, s...
3
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 checkou...
185
import warnings from contextlib import contextmanager from ....processing_utils import ProcessorMixin class __a ( UpperCAmelCase ): _a : Optional[int] = 'MCTCTFeatureExtractor' _a : int = 'AutoTokenizer' def __init__( self , _SCREAMING_SNAKE_CASE...
185
1
import json import os import shutil import tempfile import unittest import numpy as np from transformers import BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES, BertTokenizer from transformers.testing_utils import require_tokenizers, require_vision from transformers.utils ...
314
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase__ ( A__ ): """simple docstring""" a = (UnCLIPScheduler,) def lowercase_ ( self : List[str] , **__lowerCamelCase ...
314
1
from __future__ import annotations from typing import Any def UpperCamelCase_( lowerCamelCase_ ) -> Dict: create_state_space_tree(UpperCamelCase__ , [] , 0 ) def UpperCamelCase_( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ) -> Any:...
352
import argparse import json import os import numpy as np import PIL import requests import tensorflow.keras.applications.efficientnet as efficientnet import torch from huggingface_hub import hf_hub_download from PIL import Image from tensorflow.keras.preprocessing import image from transformers import ( Effici...
84
0
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class snake_case_ (UpperCamelCase_ ): UpperCAmelCase__ : Dict = ["""image_processor""", """tokenizer"""] UpperCAmelCase__ : List[str] =...
240
import warnings from typing import List import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import is_flax_available, is_tf_available, is_torch_available class lowercase_ ( UpperCamelCase_ ): """simple d...
338
0
"""simple docstring""" def __UpperCAmelCase ( lowercase = 4_00_00_00 ): """simple docstring""" _UpperCAmelCase = [] _UpperCAmelCase , _UpperCAmelCase = 0, 1 while b <= n: if b % 2 == 0: even_fibs.append(lowercase ) _UpperCAmelCase , _UpperCAmelCase = b, a +...
30
"""simple docstring""" from itertools import product def __UpperCAmelCase ( lowercase ,lowercase ): """simple docstring""" _UpperCAmelCase = sides_number _UpperCAmelCase = max_face_number * dice_number _UpperCAmelCase = [0] * (max_total + 1) _UpperCAmelCase = 1 _U...
30
1
'''simple docstring''' __snake_case ={ "joule": 1.0, "kilojoule": 1_000, "megajoule": 1_000_000, "gigajoule": 1_000_000_000, "wattsecond": 1.0, "watthour": 3_600, "kilowatthour": 3_600_000, "newtonmeter": 1.0, "calorie_nutr": 4_186.8, "kilocalori...
4
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import ASTFeatureExtractor from transformers.testing_utils import require_torch, require_torchaudio from transformers.utils.import_utils import is_torch_available from ...test_sequence_...
4
1
def _a ( a :list ) -> list: a = len(a ) for i in range(1 , a ): a = collection[i] a = 0 a = i - 1 while low <= high: a = (low + high) // 2 if val < collection[mid]: a = mid - 1 else: a = mid + 1 ...
357
import numpy as np import torch import tqdm from ...models.unet_ad import UNetaDModel from ...pipelines import DiffusionPipeline from ...utils import randn_tensor from ...utils.dummy_pt_objects import DDPMScheduler class lowercase_ ( lowercase ): '''simp...
26
0
'''simple docstring''' from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def UpperCAmelCase__ ( UpperCAmelCase_ : str , UpperCAmelCase_ : float | Decimal , UpperCAmelCase_ : float = 10**-10 ) ...
185
'''simple docstring''' from math import isqrt def UpperCAmelCase__ ( UpperCAmelCase_ : int ) -> bool: return all(number % divisor != 0 for divisor in range(2 , isqrt(UpperCAmelCase_ ) + 1 ) ) def UpperCAmelCase__ ( UpperCAmelCase_ : int = 1...
185
1
import importlib import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Union import torch from ..utils import BaseOutput _A : List[str] = '''scheduler_config.json''' class __SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE_ ): _UpperCAmelC...
350
import pprint import requests _A : Any = 'https://zenquotes.io/api' def _a ( ) -> list: """simple docstring""" return requests.get(API_ENDPOINT_URL + '''/today''' ).json() def _a ( ) -> list: """simple docstring""" return requests.get(API_EN...
265
0
"""simple docstring""" from random import randint from tempfile import TemporaryFile import numpy as np def A_ ( _lowercase, _lowercase, _lowercase ): '''simple docstring''' snake_case_ :Dict = 0 if start < end: snake_case_ :Dict = randint(_lowerca...
66
"""simple docstring""" import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloyd_if imp...
84
0
import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin lowerCamelCase_ : List[Any] = get_tests_dir("""fixtures/spi...
365
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import IterableDataset from tor...
223
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __a = logging.get_logger(__name__) __a = { # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert } class lowercase__( UpperCAmelCase ): """simple docstring""" ...
30
import importlib.metadata import warnings from copy import deepcopy from packaging import version from ..utils import logging from .import_utils import is_accelerate_available, is_bitsandbytes_available if is_bitsandbytes_available(): import bitsandbytes as bnb import torch import t...
30
1
'''simple docstring''' import fire from torch.utils.data import DataLoader from tqdm import tqdm from transformers import AutoTokenizer from utils import SeqaSeqDataset, pickle_save def A (__lowerCamelCase :Any , __lowerCamelCase :int , __lowerCamelCase :str=1024 , __lowerCamelCase ...
357
'''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 _lowercase = """src/transformers""" # This is to make...
229
0
'''simple docstring''' # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
272
import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils import is_torch_availabl...
26
0
"""simple docstring""" import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING A__ : Optional[Any] = logging.get_logger(...
351
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import _LazyModule A__ : Tuple = {'tokenization_byt5': ['ByT5Tokenizer']} if TYPE_CHECKING: from .tokenization_byta import ByTaTokenizer else: import sys A__ : Dict = _LazyModule(__name__, globals()['__fi...
209
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) a : Union[str, Any] = { """configuration_speech_to_text"...
265
'''simple docstring''' import inspect from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stab...
265
1
from __future__ import annotations from dataclasses import dataclass @dataclass class UpperCAmelCase__ : """simple docstring""" UpperCAmelCase__ : float UpperCAmelCase__ : TreeNode | None = None UpperCAmelCase__ : TreeNode | None = None...
358
from __future__ import annotations def _UpperCAmelCase ( SCREAMING_SNAKE_CASE__ : int , SCREAMING_SNAKE_CASE__ : int ): if b == 0: return (1, 0) ((__UpperCamelCase) , (__UpperCamelCase)) =extended_euclid(SCREAMING_SNAKE_CASE__ , a % ...
117
0
import unittest from parameterized import parameterized from transformers import AutoTokenizer, GPTNeoXConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import C...
252
'''simple docstring''' import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import to...
223
0
"""simple docstring""" import requests def lowercase ( _snake_case : str , _snake_case : str ) ->None: """simple docstring""" __snake_case : Dict = {'''Content-Type''': '''application/json'''} __snake_case : Optional[Any] = ...
24
"""simple docstring""" import json import os import tempfile from unittest.mock import patch import torch from torch.utils.data import DataLoader, TensorDataset from accelerate import DistributedType, infer_auto_device_map, init_empty_weights from accelerate.accelerator import Accelerator from accelerate.state imp...
24
1
"""simple docstring""" import argparse import intel_extension_for_pytorch as ipex import torch from diffusers import DPMSolverMultistepScheduler, StableDiffusionPipeline SCREAMING_SNAKE_CASE__ = argparse.ArgumentParser("Stable Diffusion script with intel optimization", add_help=False) parser.add_ar...
46
'''simple docstring''' import numpy as np import torch from torch.utils.data import DataLoader from accelerate.utils.dataclasses import DistributedType class _lowercase : '''simple docstring''' def __init__( self : Optional[int] , SCREAMING_SNAKE_CASE...
229
0
"""simple docstring""" def lowerCAmelCase_( lowercase_ : Dict ) -> Any: _lowerCamelCase = [0] * len(lowercase_ ) _lowerCamelCase = [] _lowerCamelCase = [1] * len(lowercase_ ) for values in graph.values(): for i in values: ...
365
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __SCREAMING_SNAKE_CASE : Tuple = logging.get_logger(__name__) __SC...
73
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) lowerCAmelCase : Union[str, Any] ={ '''configuration_...
223
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_xlnet import...
209
0
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_to...
141
from __future__ import annotations def UpperCamelCase (lowercase_: list[int] , lowercase_: list[int] , lowercase_: int ) -> tuple[float, list[float]]: A__ : Tuple = list(range(len(lowercase_ ) ) ) A__ : Union[str, Any] = [v / w for v, w in zip(lo...
141
1
from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDiffusionScheduler from ...utils...
49
import argparse import fairseq import torch from transformers import UniSpeechSatConfig, UniSpeechSatForCTC, UniSpeechSatForPreTraining, logging logging.set_verbosity_info() snake_case__ : Dict = logging.get_logger(__name__) snake_case__ : Optional[Any] ...
117
0
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor UpperCAmelCase__ : List[str] =logging.get_logger(__name__) class __A ( a ): def __init__( self , *UpperCAmelCase_ , **UpperCAmelCase_ ): warnings...
370
# this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files not under git won't be considered # sinc...
262
0
import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTester from .....
24
import socket def lowerCamelCase__ ( ) -> Any: __snake_case = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) __snake_case = socket.gethostname() __snake_case = 1_2312 sock.connect((host, port) ...
24
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCAmelCase: Optional[Any] = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except Optiona...
96
'''simple docstring''' import copy import os import cva import numpy as np from matplotlib import pyplot as plt class a__: def __init__( self : Optional[int] ): a : int = '' a : List[str] = '' a : int = ...
96
1
'''simple docstring''' from math import isclose, sqrt def __lowercase ( __lowercase , __lowercase , __lowercase ) -> tuple[float, float, float]: '''simple docstring''' _A = point_y / 4 / point_x _A = 2 * normal_gradient / (1 + normal_grad...
79
import os import sys a =os.path.join(os.path.dirname(__file__), """src""") sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, AutoModelForSequenceClassification, AutoToken...
73
0
"""simple docstring""" import glob import os import random from string import ascii_lowercase, digits import cva lowerCamelCase__ = '''''' lowerCamelCase__ = '''''' lowerCamelCase__ = '''''' lowerCamelCase__ = 1 # (0 is vertical, 1 is horizontal) def lowercase__ ...
371
"""simple docstring""" import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings lowerCamelCase__ = R"\n [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and\n can be used to control...
310
0
'''simple docstring''' from pickle import UnpicklingError import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict from ..utils import logging UpperCAmelCase = logging.get_logger(__name__) def __UpperCamelCase ( ...
141
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingStrategy, logging from .tokenization_realm import RealmToken...
141
1
"""simple docstring""" def A ( _lowercase ): if not isinstance(_lowercase , _lowercase ): raise ValueError('''Input must be an integer''' ) if input_num <= 0: raise ValueError('''Input must be positive''' ) return sum( di...
371
import argparse import torch from transformers import BertForMaskedLM if __name__ == "__main__": __UpperCamelCase : Dict = argparse.ArgumentParser( description=( 'Extraction some layers of the full BertForMaskedLM or RObertaForMaskedLM for Transfer Learned' ...
258
0
"""simple docstring""" import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """facebook/encodec_24khz"...
16
import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available from ...test_tokenization_common import TokenizerTesterMi...
262
0
import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever UpperCamelCase__ =logging.getLogger(__name__) class lowerCAmelCase__( __lowercase ): def __init__( self ...
365
import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import ...
325
0
"""simple docstring""" import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging lowercase...
96
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator from typing import Any class lowerCAmelCase__ : '''simple docstring''' def __init__( self , lowercase ): _lowerCamelCase : Any = da...
96
1
import os def lowerCAmelCase__ ( ): snake_case_ : List[Any] = os.path.dirname(os.path.realpath(__UpperCAmelCase ) ) snake_case_ : List[Any] = os.path.join(__UpperCAmelCase , "triangle.txt" ) with open(__UpperCAmelCase ) as f: snake_case_ ...
355
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import center_crop, normalize, rescale, resize, to_channel_dimension_format from ...image_utils import ( IMAGENET_STANDARD_MEAN, ...
36
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase__ :str = logging.get_logger(__name__) lowercase__ :Tuple = { # See all MEGATRON_BERT models at https://huggingface.co/models?filter=bert } class lowercase ( SCREAMING_SNAKE_CASE__ ): lo...
101
def _A ( _lowercase ) -> list[int]: """simple docstring""" if length <= 0 or not isinstance(_lowercase , _lowercase ): raise ValueError('Length must be a positive integer.' ) return [n * (2 * n - 1) for n in range(_lowercase )] i...
310
0
def snake_case__ ( SCREAMING_SNAKE_CASE_ : int = 50_000_000 ): '''simple docstring''' lowercase__ : List[Any] = set() lowercase__ : Any = int((limit - 24) ** (1 / 2) ) lowercase__ : Any = set(range(3 , prime_square_limit + ...
216
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_gpta import GPTaTokenizer if TYPE_CHECKING: ...
216
1
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 from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowercase ...
20
'''simple docstring''' import os import shutil import tempfile import unittest import numpy as np from transformers import AutoTokenizer, BarkProcessor from transformers.testing_utils import require_torch, slow @require_torch class __UpperCAmelCase ( unittest.TestCase ): '''simple d...
258
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 i...
328
from datetime import datetime import matplotlib.pyplot as plt import torch def lowerCAmelCase_ ( UpperCamelCase_ ) -> int: for param in module.parameters(): UpperCamelCase_ = False def lowerCAmelCase_ ( ) -> Dict: UpperCamelCa...
328
1
"""simple docstring""" from argparse import ArgumentParser from . import BaseTransformersCLICommand def lowercase__ ( snake_case_ :Dict ): return DownloadCommand(args.model , args.cache_dir , args.force , args.trust_remote_code ) class ...
332
import gc import importlib.metadata import tempfile import unittest from packaging import version from transformers import ( AutoModel, AutoModelForCausalLM, AutoModelForSeqaSeqLM, AutoModelForSequenceClassification, AutoTokenizer, BitsAndBytesConfig, pipeline, ) from transformers.testing...
325
0
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_pegasus import PegasusToken...
359
"""simple docstring""" import json import os from collections import Counter import torch import torchvision import torchvision.transforms as transforms from PIL import Image from torch import nn from torch.utils.data import Dataset UpperCAmelCase : str = {1: (1, 1), 2: (2, 1), 3: (3, 1),...
320
0
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class __A ( a ): """simple ...
71
def A ( _lowerCamelCase ): '''simple docstring''' if bit_count < 0: raise ValueError("The given input must be positive" ) # get the generated string sequence _lowerCAmelCase : List[str] = gray_code_sequence_string(_lowerCamelCase ) ...
36
0
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from ...
56
"""simple docstring""" import inspect import unittest from transformers import RegNetConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_common import...
56
1
from typing import Callable, Optional from .. import Features from ..packaged_modules.generator.generator import Generator from .abc import AbstractDatasetInputStream class UpperCamelCase__ ( __lowercase ): def __init__(self : int , snake_case_ : Callable , snake_case_ : Op...
216
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): import ...
216
1
from itertools import count def _a ( UpperCAmelCase = 50 ) -> int: """simple docstring""" lowerCamelCase__ : Optional[Any] = [1] * min_block_length for n in count(UpperCAmelCase ): fill_count_functions.append(1 ) for block_length i...
368
from math import factorial class __SCREAMING_SNAKE_CASE : def __init__( self : List[Any] , A : Dict , A : Any ) ->Optional[Any]: lowerCamelCase__ : Tuple = real if isinstance(A , A ): ...
265
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...
328
def A_ ( ) -> list[list[int]]: '''simple docstring''' return [list(range(1000 - i , -1000 - i , -1 ) ) for i in range(1000 )] lowercase__ : List[str] = generate_large_matrix() lowercase__ : Tuple ...
328
1
'''simple docstring''' import os lowerCamelCase_ = {'''I''': 1, '''V''': 5, '''X''': 10, '''L''': 50, '''C''': 1_00, '''D''': 5_00, '''M''': 10_00} def __lowercase ( __lowercase ) -> int: '''simple docstring''' _A = 0 _A = 0 whi...
174
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ = logging.get_logger(__name__) lowerCamelCase_ ...
174
1
'''simple docstring''' from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable __SCREAMING_SNAKE_CASE : Optional[int] = {"""configuration_gpt_neox""": ["""GPT_NEOX_PRETRAINED_CONFIG_ARCH...
31
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, ...
320
0
'''simple docstring''' import json import os import tempfile from unittest.mock import patch import torch from torch.utils.data import DataLoader, TensorDataset from accelerate import DistributedType, infer_auto_device_map, init_empty_weights from accelerate.accelerator import Accelerator fro...
222
'''simple docstring''' from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale,...
222
1
'''simple docstring''' import dataclasses import re import string from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple import numpy as np from . import residue_constants a : Any = Mapping[str, np.ndarray] a : Tuple = Mapping[str, Any] # Is a nested dict. ...
56
'''simple docstring''' import argparse import torch from torch import nn from transformers import SpeechaTextConfig, SpeechaTextForConditionalGeneration def __magic_name__ ( __UpperCAmelCase ) -> str: '''simple docstring''' snake_case_ = [ '''encoder.version''', ...
56
1
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 : Union[str, Any] = logging.get_logger(__name__) __A : Optional[Any] = { 'google...
49
from __future__ import annotations def __UpperCamelCase ( _A : list[int | str] ) ->None: """simple docstring""" create_state_space_tree(_A , [] , 0 , [0 for i in range(len(_A ) )] ) def __UpperCamelCase ( _A ...
49
1
"""simple docstring""" from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_images,...
347
'''simple docstring''' from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def __lowerCamelCase ( _lowercase ) -> Optional[Any]: return getitem, k def __lowerCamelCase ( _lowercase , _lowercase ) ...
265
0
from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_common import ConfigTe...
352
from __future__ import annotations import csv import requests from bsa import BeautifulSoup def UpperCamelCase( lowercase_ = "" ) -> dict[str, float]: '''simple docstring''' snake_case_ = url or """https://www.imdb.com/chart/top/?ref_=nv_mv_250""" snake_case_ = ...
34
0
'''simple docstring''' import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, Truncati...
174
'''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 OptionalDepen...
174
1
def _snake_case( SCREAMING_SNAKE_CASE__ ) -> str: return " ".join(input_str.split()[::-1] ) if __name__ == "__main__": import doctest doctest.testmod()
285
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging lowercase : Union[str, Any] = logging.get_logger(_...
285
1
from math import factorial def A ( lowercase = 100 ) -> int: '''simple docstring''' return sum(int(lowercase ) for x in str(factorial(lowercase ) ) ) if __name__ == "__main__": print(solution(int(input("Enter the Number: ").strip())))
222
import inspect import unittest from math import floor from transformers import CvtConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_common import Confi...
222
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer __snake_case ={"""vocab_file""": """vocab.txt""", """tokenize...
55
'''simple docstring''' import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common im...
55
1
from ....configuration_utils import PretrainedConfig from ....utils import logging __snake_case :Union[str, Any] = logging.get_logger(__name__) __snake_case :Optional[int] = { '''Visual-Attention-Network/van-base''': ( '''https://huggingface.co/Visual-Attention-Network...
49
import unittest from diffusers.pipelines.pipeline_utils import is_safetensors_compatible class _A ( unittest.TestCase ): def _lowerCamelCase ( self : List[Any]): '''simple docstring''' __a = [ '''safety_checker/pytorch_mo...
49
1
'''simple docstring''' import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from trans...
322
'''simple docstring''' import pytest lowerCamelCase__ = '__dummy_dataset1__' lowerCamelCase__ = '\nimport json\nimport os\n\nimport datasets\n\n\nREPO_URL = "https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/"\nURLS = {"train": REPO_URL + "wikiann-...
322
1
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class __lowerCamelCase ( __a): """si...
39
'''simple docstring''' import os from distutils.util import strtobool def snake_case_ (_a : Union[str, Any] , _a : List[Any] ): for e in env_keys: UpperCAmelCase = int(os.environ.get(_a , -1 ) ) if val >= 0: return ...
34
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_torch_av...
357
"""simple docstring""" from collections import Counter import numpy as np from sklearn import datasets from sklearn.model_selection import train_test_split __snake_case = datasets.load_iris() __snake_case = np.array(data['''data''']) __snake_case = np.array(data['''target''']) __snake_case...
153
0
def __lowerCamelCase ( UpperCamelCase__ ): '''simple docstring''' assert column_title.isupper() snake_case_ = 0 snake_case_ = len(UpperCamelCase__ ) - 1 snake_case_ = 0 while index >= 0: snake_case_ =...
285
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils import...
285
1
'''simple docstring''' from math import factorial, pi def SCREAMING_SNAKE_CASE__ ( __A , __A = 30 ) -> float: if not isinstance(__A , (int, float) ): raise ValueError('maclaurin_sin() requires either an int or float for theta' ) if not isinstance(__A ...
363
'''simple docstring''' import dataclasses import json import sys import types from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser, ArgumentTypeError from copy import copy from enum import Enum from inspect import isclass from pathlib import Path from typing import Any, Callable, Dict, Iterable, L...
160
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize,...
55
'''simple docstring''' import json import os import unittest from transformers.models.blenderbot_small.tokenization_blenderbot_small import ( VOCAB_FILES_NAMES, BlenderbotSmallTokenizer, ) from ...test_tokenization_common import TokenizerTesterMixin class snake_case ( l...
55
1
from __future__ import annotations from typing import TypedDict class _a ( _lowercase): _a : str _a : int def lowerCamelCase_ ( _a ): """simple docstring""" if not isinstance(_a , _a ): raise TypeError('''The parameter s ...
211
from collections.abc import Iterable from typing import Any class _a : def __init__( self : Union[str, Any] , _SCREAMING_SNAKE_CASE : int | None = None )-> Tuple: lowerCAmelCase__ : Union[str, Any] = value lowerCAmelCase__ : Node | No...
211
1
import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils import is_torch_...
322
import os from datetime import datetime as dt from github import Github _a = [ '''good first issue''', '''feature request''', '''wip''', ] def _a ( ) -> List[Any]: """simple docstring""" __lowerCAmelCase: Dict = Github(os.envi...
322
1
"""simple docstring""" import re def a__ ( __SCREAMING_SNAKE_CASE ) -> bool: __lowerCAmelCase: str = re.compile( R"^(?:0|94|\+94|0{2}94)" R"7(0|1|2|4|5|6|7|8)" R"(-| |)" R"\d{7}$" ) return bool(re.search(__SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE...
108
"""simple docstring""" from __future__ import annotations from math import pi def a__ ( __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE , __SCREAMING_SNAKE_CASE ) -> dict[str, float]: if (inductance, frequency, reactance).count(0 ) != 1: raise ValueError("One an...
108
1
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor _a = logging.get_logger(__name__) class __lowerCamelCase ( _lowercase): """simple docstring""" def __init__( self , *UpperCA...
39
"""simple docstring""" def a__ ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE ): """simple docstring""" if exponent == 1: return base if exponent % 2 == 0: UpperCamelCase = _modexpt(_SCREAMING_SNAKE_CASE , exponent // 2 , _SC...
153
0
"""simple docstring""" import sys import turtle def __lowercase ( _UpperCamelCase, _UpperCamelCase ) ->tuple[float, float]: """simple docstring""" return (pa[0] + pa[0]) / 2, (pa[1] + pa[1]) / 2 def __lowercase ( _UpperCamelCase, _UpperCamelCase, ...
353
import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLMRobertaModel @require_sentencepiece @require_to...
173
0
"""simple docstring""" from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging __lowerCAmelCase : Union[str, Any] =logging.get_logger(__name__) __lowerCAmelCase : int ={ """huggingface/tim...
197
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available A = { '''configuration_luke''': ['''LUKE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''LukeConfig'''], '''tokenization_luke''': ['''Lu...
160
0
'''simple docstring''' from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def __snake_case( ) -> Optional[int]: snake_case__ : Dict = 9, 14 # noqa: F841 snake_case__ : List[Any] = [ [0, ...
355
'''simple docstring''' import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_available, ) from tran...
43
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_ch...
211
'''simple docstring''' from collections.abc import Generator from math import sin def lowerCAmelCase (__A): """simple docstring""" if len(__A) != 32: raise ValueError('''Input must be of length 32''') _a = b'''''' for i in [3, 2, 1, 0]: little_endian +=...
211
1
import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig...
28
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging.set_verbosity_info() __U...
28
1
"""simple docstring""" import functools import logging import os import sys import threading from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional import h...
108
"""simple docstring""" from typing import Any, Dict, List, Optional, Tuple, Union import torch from torch import nn from torch.utils.data import DistributedSampler, RandomSampler from transformers import PreTrainedModel, Trainer, logging from transformers.integrations import is_fairscale_available from tran...
108
1
import datasets _snake_case : Tuple = '\\n@InProceedings{conneau2018xnli,\n author = "Conneau, Alexis\n and Rinott, Ruty\n and Lample, Guillaume\n and Williams, Adina\n and Bowman, Samuel R.\n and Schwenk, Holg...
361
import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import DeiTImageProcessor, ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging ...
207
0
"""simple docstring""" def _SCREAMING_SNAKE_CASE (__lowerCAmelCase = 60_08_51_47_51_43 ) -> Tuple: '''simple docstring''' try: lowercase_ = int(__lowerCAmelCase ) except (TypeError, ValueError): raise TypeError("""Parameter n must be int or ca...
136
"""simple docstring""" from maths.prime_factors import prime_factors def __magic_name__ ( lowercase ): if not isinstance(lowercase , lowercase ): SCREAMING_SNAKE_CASE_: int =f'''Input value of [number={number}] must be an integer''' raise TypeErr...
173
0
'''simple docstring''' import bza import gzip import lzma import os import shutil import struct import tarfile import warnings import zipfile from abc import ABC, abstractmethod from pathlib import Path from typing import Dict, List, Optional, Type, Union from .. import config from .filelo...
179
'''simple docstring''' from ..utils import DummyObject, requires_backends class A ( metaclass=_a ): lowercase_ = ['torch', 'scipy'] def __init__( self : Tuple , *lowerCAmelCase_ : str , **lowerCAmelCase_ : Any ) -> ...
179
1
"""simple docstring""" import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils imp...
64
import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters __lowercase = (720, 1280) # Height, Width __lowercase = (0.4, 0.6) # if height or width lower than this scale, drop it. __lowercase = 1 / 100 __lowercase ...
43
0
'''simple docstring''' import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from f...
101
'''simple docstring''' from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def UpperCAmelCase__ ( UpperCAmelCase__, UpperCAmelCase__, UpperCAmelCase__, UpperCAmelCase__, ) -> list[float]: A_ , A_ = coeffici...
101
1
'''simple docstring''' import unittest from .lib import ( Matrix, Vector, axpy, square_zero_matrix, unit_basis_vector, zero_vector, ) class SCREAMING_SNAKE_CASE ( unittest.TestCase ): """simple docstring""" def A ( self : ...
28
'''simple docstring''' from io import BytesIO from typing import List, Union import requests from ..utils import add_end_docstrings, is_decord_available, is_torch_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_decord_available(): import numpy as ...
28
1
'''simple docstring''' import math import sys import cva import numpy as np def lowerCamelCase ( lowerCAmelCase : np.ndarray , lowerCAmelCase : float ): """simple docstring""" __magic_name__ : List[str] = math.sqrt(lowerCAmelCase ) __magic_name__ : O...
356
'''simple docstring''' lowerCAmelCase :Union[str, Any] = ''' # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers...
275
0
from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean A : Tuple = 0 A : Any = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [1, 0, 1, 0, 0,...
6
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ = ('''dense.weight''', '''attention.self.query''', ''...
207
0
"""simple docstring""" import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class __magic_name__ ( unittest.TestCase ): '''s...
168
"""simple docstring""" import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def a__ ( snake_case__ ) -> List[str]: lowerCamelCase = [ """decoder.version""", """decoder.output_projecti...
168
1
"""simple docstring""" import unittest from transformers import TrOCRConfig from transformers.testing_utils import is_torch_available, require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common impo...
179
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a_ = logging.get_logger(__name__) a_ = { """roberta-base""": """https://huggingface.co/roberta-base/r...
179
1
'''simple docstring''' class lowerCAmelCase__ : """simple docstring""" def __init__( self : List[Any] , __SCREAMING_SNAKE_CASE : list ) -> None: """simple docstring""" __SCREAMING_SNAKE_CASE = set_counts __SCREAMING_SNAKE_CASE = max(_...
355
'''simple docstring''' import unittest from transformers.testing_utils import CaptureStdout from transformers.tools.python_interpreter import evaluate def a__ ( a__ ): """simple docstring""" return x + 2 class lowerCAmelCase__ ( unittest.TestCase ): ""...
331
0
import heapq as hq import math from collections.abc import Iterator class lowercase : def __init__( self ,A__): lowercase = str(id_) lowercase = None lowercase = None lowercase = [] lower...
101
import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImageProcessor from diffusers.pipeli...
101
1
'''simple docstring''' import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class _UpperCAmelCase ( nn.Module ): a : int a : int ...
362
'''simple docstring''' import random def _lowerCAmelCase ( lowercase ) -> bool: __lowerCAmelCase = num - 1 __lowerCAmelCase = 0 while s % 2 == 0: __lowerCAmelCase = s // 2 t += 1 for _ in range(5 ): __lowerCAmelCase ...
46
0
"""simple docstring""" import os import sys import unittest SCREAMING_SNAKE_CASE__ = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, "utils")) import get_test_info # noqa: E402 from get_test_info import ( # noqa: E402 get...
46
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch, require_vision from transformers.utils im...
275
0
'''simple docstring''' from __future__ import annotations def a_ ( _UpperCAmelCase : list ,_UpperCAmelCase : int | None = None ,_UpperCAmelCase : int | None = None ) -> None: if start is None: __snake_case : Dict = 0 if end is...
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : Tuple = logging.get_logger(__name__) A__ : Optional[int] = {} class snake_case__ ( SCREAMING_SNAKE_CASE_ ): A__ = '''llama''' A__ = ['''p...
0
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import DebertaVaConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTe...
168
'''simple docstring''' import numpy as np class a : def __init__( self ) -> List[str]: _a = (0, 0) _a = None _a = 0 _a = 0 _a = 0 def __eq__( self , __magic_name__...
168
1
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__ = logging.get_logger(__name__) A__ = { '''sail/poolformer...
44
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, prepare_image_inputs if is_torch_available(): ...
44
1
from __future__ import annotations from cmath import sqrt def __lowerCamelCase ( UpperCAmelCase_ : int , UpperCAmelCase_ : int , UpperCAmelCase_ : int ): """simple docstring""" if a == 0: raise ValueError('''Coefficient \'a\' must not be zero.''' ...
94
'''simple docstring''' class _lowerCamelCase : # Public class to implement a graph '''simple docstring''' def __init__( self : List[Any] , _A : int , _A : int , _A : list[list[bool]] ) -> None: __magic_name__ : Tuple = row __...
331
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 = { 'andreasmadsen/effi...
363
from math import ceil def __UpperCamelCase ( lowercase__ : int = 1001 ) -> int: '''simple docstring''' lowerCAmelCase_ : List[str] = 1 for i in range(1 , int(ceil(n / 2.0 ) ) ): lowerCAmelCase_ : Optional[Any] = 2 ...
28
0