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
"""simple docstring""" import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase_ : Dict = { 'facebook/mask2former-swin-small-coco-instance': ( 'https://...
286
"""simple docstring""" import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset ...
286
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Optional[Any] = logging.get_logger(__name__) lowerCamelCase_ : List[str] = { 'facebook/timesformer': 'https://huggingface.co/facebook/timesformer...
286
"""simple docstring""" 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 timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ...
286
1
"""simple docstring""" from __future__ import annotations def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" if len(_UpperCAmelCase ) == 0: return False A_ : Union[str, Any] = len(_UpperCAmelCase ) // 2 if ...
286
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" if isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(_UpperCAmelCase , _UpperCAmelCas...
286
1
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase = False ): """simple docstring""" if not isinstance(_UpperCAmelCase , _UpperCAmelCase ): A_ : List[Any] = f"""Expected string as input, found {type(_UpperCAmelCase ...
286
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCamelCase_ : int = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDepend...
286
1
"""simple docstring""" import os import time import pytest from datasets.utils.filelock import FileLock, Timeout def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : Union[str, Any] = FileLock(str(tmpdir / 'foo.lock' ) ) A_ : ...
286
"""simple docstring""" import os # Precomputes a list of the 100 first triangular numbers lowerCamelCase_ : List[str] = [int(0.5 * n * (n + 1)) for n in range(1, 1_01)] def UpperCAmelCase__ ( ): """simple docstring""" A_ : Union[str, Any] = os...
286
1
"""simple docstring""" import argparse import OmegaConf import torch from diffusers import DDIMScheduler, LDMPipeline, UNetLDMModel, VQModel def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : Union[str, ...
286
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : List[str] = {'configuration_xln...
286
1
"""simple docstring""" import tempfile import unittest import numpy as np from diffusers import ( DDIMScheduler, DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionPipeline, PNDMScheduler, ) from diffuser...
286
"""simple docstring""" import torch from diffusers import DiffusionPipeline class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , snake_case_ , snake_case_ ): """simple docstring""" super().__init__() se...
286
1
"""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...
286
"""simple docstring""" from heapq import heappop, heappush import numpy as np def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ): """simple docstring""" A_ , A_ : List[str] = grid.shape ...
286
1
"""simple docstring""" import inspect import os import torch from transformers import AutoModel from transformers.testing_utils import mockenv_context from transformers.trainer_utils import set_seed import accelerate from accelerate.accelerator import Accelerator from accelerate.state import AcceleratorStat...
286
"""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_ : Optional[Any] = { 'huggingface/informe...
286
1
"""simple docstring""" from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' lowercase_ : List[str] = CustomTokenizer pass
286
"""simple docstring""" import os def UpperCAmelCase__ ( ): """simple docstring""" A_ : Any = os.path.join(os.path.dirname(_UpperCAmelCase ) , 'num.txt' ) with open(_UpperCAmelCase ) as file_hand: return str(sum(int(_UpperCAmelCase ) for...
286
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Dict = logging.get_logger(__name__) lowerCamelCase_ : Optional[int] = { 'google/pegasus-large': 'https://huggingface.co/google/pegasus-large/reso...
286
"""simple docstring""" import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger lowerCamelCase_ : Dict = get_logger(__name__) lowerCamelCase_ : List[str] = r'\n Args:\n ...
286
1
"""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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, I...
286
"""simple docstring""" import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging lowerCamelCase_ : Tuple = logging.get_logger(__name__) def UpperCAmelCase__ ( _UpperCAmelCase ...
286
1
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" return int((input_a, input_a).count(1 ) != 0 ) def UpperCAmelCase__ ( ): """simple docstring""" assert or_gate(0 , 0 ) == 0...
286
"""simple docstring""" from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' lowercase_ : List[str] = CustomTokenizer pass
286
1
"""simple docstring""" import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCamelCase_ : Dict = logging.get_logger(__name__) lowerCamelCase_ ...
286
"""simple docstring""" from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils impor...
286
1
"""simple docstring""" from ..utils import DummyObject, requires_backends class _UpperCAmelCase ( metaclass=UpperCAmelCase__ ): '''simple docstring''' lowercase_ : Tuple = ["""flax""", """transformers"""] def __init__( self , *snake_case_ , **snake_...
286
"""simple docstring""" import copy import random from transformers import CLIPTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *snake_case_ , **snake_case_ ): """simple docstring""" super().__init_...
286
1
"""simple docstring""" from tempfile import TemporaryDirectory from unittest import TestCase from unittest.mock import MagicMock, patch from transformers import AutoModel, TFAutoModel from transformers.onnx import FeaturesManager from transformers.testing_utils import SMALL_MODEL_IDENTIFIER, require_tf, requ...
286
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : List[str] = hex_num.strip() if not hex_num: raise ValueError('No value was passed to the function' ) A_ : Any = hex_num[0] == '-' if is_ne...
286
1
"""simple docstring""" import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger lowerCamelCase_ : Dict = get_logger(__name__) lowerCamelCase_ : List[str] = r'\n Args:\n ...
286
"""simple docstring""" import qiskit def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : Tuple = qiskit.Aer.get_backend('aer_simulator' ) A_ : str = qiskit.QuantumCircuit(4 , 2 ) # enc...
286
1
"""simple docstring""" from __future__ import annotations lowerCamelCase_ : Tuple = [True] * 1_00_00_01 lowerCamelCase_ : str = 2 while i * i <= 1_00_00_00: if seive[i]: for j in range(i * i, 1_00_00_01, i): lowerCamelCase_ : str = False...
286
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ : str = logging.get_logger(__name__) lowerCamelCase_ : Any =...
286
1
"""simple docstring""" import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class _UpperCAmelCase ( UpperCAmelCase_...
286
"""simple docstring""" import warnings 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 _UpperCAmelCase ( U...
286
1
"""simple docstring""" 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 lowerCamelCase_ : Any = get_...
286
"""simple docstring""" from copy import deepcopy class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ = None , snake_case_ = None ): """simple docstring""" if arr is None and size is not None: A_ : Union[st...
286
1
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class _UpperCAmelCase ( UpperCAmelCase__ , UpperCAmelCase__ ): '''simple docstring...
286
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class _UpperCAmelCase ( UpperCAmelCase__ , UpperCAmelCase__ ): '''simple docstring...
286
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowerCamelCase_ : List[str] = logging.get_logger(__name__) class _UpperCAmelCase ( ...
286
"""simple docstring""" from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration lowerCamelCase_ : Any = HfArgumentParser(InitializationArguments) lowerCamelCase_ : Union[str, Any] ...
286
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase_ : Any = {'configuration_sew': ['SEW_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SEWConfig']} try: if not is_torch_available(): raise ...
286
"""simple docstring""" import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset ...
286
1
"""simple docstring""" import argparse import re import numpy as np import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SamConfig, SamImageProcessor, SamModel, SamProcessor, SamVisionConfig, ) lowerCamelCase_ : ...
286
"""simple docstring""" 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 timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ...
286
1
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ : str = logging.get_logger(__name__) lowerCamelCase_ : List[Any] ...
286
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" if isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(_UpperCAmelCase , _UpperCAmelCas...
286
1
"""simple docstring""" import os from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager import xopen, xsplitext from ..tabl...
286
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCamelCase_ : int = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDepend...
286
1
"""simple docstring""" 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 timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ...
286
"""simple docstring""" import os # Precomputes a list of the 100 first triangular numbers lowerCamelCase_ : List[str] = [int(0.5 * n * (n + 1)) for n in range(1, 1_01)] def UpperCAmelCase__ ( ): """simple docstring""" A_ : Union[str, Any] = os...
286
1
"""simple docstring""" lowerCamelCase_ : str = 'Tobias Carryer' from time import time class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ , snake_case_ , snake_case_ , snake_case_=int(time() ) ): # noq...
286
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : List[str] = {'configuration_xln...
286
1
"""simple docstring""" import inspect import unittest from transformers import ViTHybridConfig from transformers.testing_utils import require_accelerate, require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_con...
286
"""simple docstring""" import torch from diffusers import DiffusionPipeline class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , snake_case_ , snake_case_ ): """simple docstring""" super().__init__() se...
286
1
"""simple docstring""" from copy import deepcopy class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ = None , snake_case_ = None ): """simple docstring""" if arr is None and size is not None: A_ : Union[st...
286
"""simple docstring""" from heapq import heappop, heappush import numpy as np def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ): """simple docstring""" A_ , A_ : List[str] = grid.shape ...
286
1
"""simple docstring""" import torch from diffusers import DiffusionPipeline class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , snake_case_ , snake_case_ ): """simple docstring""" super().__init__() se...
286
"""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_ : Optional[Any] = { 'huggingface/informe...
286
1
"""simple docstring""" import os # Precomputes a list of the 100 first triangular numbers lowerCamelCase_ : List[str] = [int(0.5 * n * (n + 1)) for n in range(1, 1_01)] def UpperCAmelCase__ ( ): """simple docstring""" A_ : Union[str, Any] = os...
286
"""simple docstring""" import os def UpperCAmelCase__ ( ): """simple docstring""" A_ : Any = os.path.join(os.path.dirname(_UpperCAmelCase ) , 'num.txt' ) with open(_UpperCAmelCase ) as file_hand: return str(sum(int(_UpperCAmelCase ) for...
286
1
"""simple docstring""" import sys lowerCamelCase_ : Any = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' ...
286
"""simple docstring""" import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger lowerCamelCase_ : Dict = get_logger(__name__) lowerCamelCase_ : List[str] = r'\n Args:\n ...
286
1
"""simple docstring""" from datetime import datetime import matplotlib.pyplot as plt import torch def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" for param in module.parameters(): A_ : List[str] = False def UpperCAmelCase__ ...
286
"""simple docstring""" import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging lowerCamelCase_ : Tuple = logging.get_logger(__name__) def UpperCAmelCase__ ( _UpperCAmelCase ...
286
1
"""simple docstring""" import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Any = logging.get_logger(__name__) lowerCamelCase_ : Optional[Any] = { 'facebook/wav2vec2-base-960h': 'https://...
286
"""simple docstring""" from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' lowercase_ : List[str] = CustomTokenizer pass
286
1
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_video_inputs if is_torc...
286
"""simple docstring""" from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils impor...
286
1
"""simple docstring""" import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ):...
286
"""simple docstring""" import copy import random from transformers import CLIPTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *snake_case_ , **snake_case_ ): """simple docstring""" super().__init_...
286
1
"""simple docstring""" lowerCamelCase_ : Optional[Any] = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" if not isinstance(_UpperCAmelCase , _UpperCAmelCase ): A...
286
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : List[str] = hex_num.strip() if not hex_num: raise ValueError('No value was passed to the function' ) A_ : Any = hex_num[0] == '-' if is_ne...
286
1
"""simple docstring""" from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils impor...
286
"""simple docstring""" import qiskit def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : Tuple = qiskit.Aer.get_backend('aer_simulator' ) A_ : str = qiskit.QuantumCircuit(4 , 2 ) # enc...
286
1
"""simple docstring""" import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller lowerCamelCase_ : Tuple = 3 def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" print('Generating primitive roo...
286
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ : str = logging.get_logger(__name__) lowerCamelCase_ : Any =...
286
1
"""simple docstring""" from __future__ import annotations from collections.abc import Callable def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase = 100 , ): """simple docstring""" A_ : int = x_start A_...
286
"""simple docstring""" import warnings 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 _UpperCAmelCase ( U...
286
1
"""simple docstring""" import os def UpperCAmelCase__ ( ): """simple docstring""" A_ : Any = os.path.join(os.path.dirname(_UpperCAmelCase ) , 'num.txt' ) with open(_UpperCAmelCase ) as file_hand: return str(sum(int(_UpperCAmelCase ) for...
286
"""simple docstring""" from copy import deepcopy class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ = None , snake_case_ = None ): """simple docstring""" if arr is None and size is not None: A_ : Union[st...
286
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase_ : Dict = { 'configuration_time_series_transformer': [ 'TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', '...
286
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class _UpperCAmelCase ( UpperCAmelCase__ , UpperCAmelCase__ ): '''simple docstring...
286
1
"""simple docstring""" from heapq import heappop, heappush import numpy as np def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ): """simple docstring""" A_ , A_ : List[str] = grid.shape ...
286
"""simple docstring""" from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration lowerCamelCase_ : Any = HfArgumentParser(InitializationArguments) lowerCamelCase_ : Union[str, Any] ...
286
1
"""simple docstring""" import unittest from transformers import XLMConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common...
286
"""simple docstring""" import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset ...
286
1
"""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, ...
286
"""simple docstring""" 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 timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ...
286
1
"""simple docstring""" import argparse import torch from transformers import ( UniSpeechSatConfig, UniSpeechSatForAudioFrameClassification, UniSpeechSatForSequenceClassification, UniSpeechSatForXVector, WavaVecaFeatureExtractor, logging, ) logging.set_verbosity_info() lowerCamelCas...
286
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" if isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(_UpperCAmelCase , _UpperCAmelCas...
286
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : Tuple = { 'configuration_deberta': ['DEBERTA_PRETRAINED_CON...
286
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCamelCase_ : int = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDepend...
286
1
"""simple docstring""" import pickle import numpy as np from matplotlib import pyplot as plt class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ , snake_case_ , snake_case_ , snake_case_ , snake_case_ , s...
286
"""simple docstring""" import os # Precomputes a list of the 100 first triangular numbers lowerCamelCase_ : List[str] = [int(0.5 * n * (n + 1)) for n in range(1, 1_01)] def UpperCAmelCase__ ( ): """simple docstring""" A_ : Union[str, Any] = os...
286
1
"""simple docstring""" import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_diffusion.mo...
286
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : List[str] = {'configuration_xln...
286
1
"""simple docstring""" import os import pickle import unittest from transformers import AutoTokenizer from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.models.bert_japanese.tokenization_bert_japanese import ( VOCAB_FILES_NAMES, BertJapaneseTokenizer, Character...
286
"""simple docstring""" import torch from diffusers import DiffusionPipeline class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , snake_case_ , snake_case_ ): """simple docstring""" super().__init__() se...
286
1
"""simple docstring""" from functools import lru_cache def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : Tuple = 2 A_ : List[Any] = set() while i * i <= n: if n % i: i += 1 else: n //= i fact...
286
"""simple docstring""" from heapq import heappop, heappush import numpy as np def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ): """simple docstring""" A_ , A_ : List[str] = grid.shape ...
286
1
"""simple docstring""" import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse('9.1.0'): lowerCamelCase_ : Optional[int] = { 'linear': PIL.Image.Resampling.BILINEAR, ...
286
"""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_ : Optional[Any] = { 'huggingface/informe...
286
1
"""simple docstring""" import torch import torch.nn as nn from transformers.modeling_utils import ModuleUtilsMixin from transformers.models.ta.modeling_ta import TaBlock, TaConfig, TaLayerNorm from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class _UpperCA...
286
"""simple docstring""" import os def UpperCAmelCase__ ( ): """simple docstring""" A_ : Any = os.path.join(os.path.dirname(_UpperCAmelCase ) , 'num.txt' ) with open(_UpperCAmelCase ) as file_hand: return str(sum(int(_UpperCAmelCase ) for...
286
1
"""simple docstring""" from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image ...
286
"""simple docstring""" import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger lowerCamelCase_ : Dict = get_logger(__name__) lowerCamelCase_ : List[str] = r'\n Args:\n ...
286
1
"""simple docstring""" import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py lowerCamelCase_ : List[str] = '.' if __name__ == "__main__": lowerCamelCase_ : Tuple = os.p...
286
"""simple docstring""" import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging lowerCamelCase_ : Tuple = logging.get_logger(__name__) def UpperCAmelCase__ ( _UpperCAmelCase ...
286
1
"""simple docstring""" import inspect import unittest from transformers import BitConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import Backbo...
286
"""simple docstring""" from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' lowercase_ : List[str] = CustomTokenizer pass
286
1
"""simple docstring""" lowerCamelCase_ : str = 'Input must be a string of 8 numbers plus letter' lowerCamelCase_ : List[Any] = 'TRWAGMYFPDXBNJZSQVHLCKE' def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" if not isinstance(_Up...
286
"""simple docstring""" from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils impor...
286
1
"""simple docstring""" from collections.abc import Generator def UpperCAmelCase__ ( ): """simple docstring""" A_ , A_ : Tuple = 0, 1 while True: A_ , A_ : Union[str, Any] = b, a + b yield b def UpperCAm...
286
"""simple docstring""" import copy import random from transformers import CLIPTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *snake_case_ , **snake_case_ ): """simple docstring""" super().__init_...
286
1
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" if not nums: # Makes sure that the list is not empty raise ValueError('List is empty' ) A_ : List[str] = sum(_UpperCAmelCase ) / len(_UpperCAmelCase ) # C...
286
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : List[str] = hex_num.strip() if not hex_num: raise ValueError('No value was passed to the function' ) A_ : Any = hex_num[0] == '-' if is_ne...
286
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCamelCase_ : Any = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDepende...
286
"""simple docstring""" import qiskit def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : Tuple = qiskit.Aer.get_backend('aer_simulator' ) A_ : str = qiskit.QuantumCircuit(4 , 2 ) # enc...
286
1
"""simple docstring""" import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( Albe...
286
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ : str = logging.get_logger(__name__) lowerCamelCase_ : Any =...
286
1
"""simple docstring""" from __future__ import annotations from random import random from typing import Generic, TypeVar lowerCamelCase_ : List[Any] = TypeVar('KT') lowerCamelCase_ : Tuple = TypeVar('VT') class _UpperCAmelCase ( Generic[KT, VT] ): '''simple ...
286
"""simple docstring""" import warnings 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 _UpperCAmelCase ( U...
286
1
"""simple docstring""" import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Optional[Any] = logging.get_logger(__name__) lowerCamelCase_ : List[str] = { 'xlnet-base-cased': 'https://huggingface.co/xlnet-b...
286
"""simple docstring""" from copy import deepcopy class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ = None , snake_case_ = None ): """simple docstring""" if arr is None and size is not None: A_ : Union[st...
286
1
"""simple docstring""" from __future__ import annotations class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ = 0 ): """simple docstring""" A_ : List[str] = key def lowerCamelCase_ ( self , ...
286
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class _UpperCAmelCase ( UpperCAmelCase__ , UpperCAmelCase__ ): '''simple docstring...
286
1
"""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_c...
286
"""simple docstring""" from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration lowerCamelCase_ : Any = HfArgumentParser(InitializationArguments) lowerCamelCase_ : Union[str, Any] ...
286
1
"""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 import IFWaterma...
286
"""simple docstring""" import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset ...
286
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Optional[int] = logging.get_logger(__name__) lowerCamelCase_ : Tuple = { 'RWKV/rwkv-4-169m-pile': 'https://huggingface.co/RWKV/rwkv-4-169m-pile/r...
286
"""simple docstring""" 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 timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ...
286
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCamelCase_ : int = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDepend...
286
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" if isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(_UpperCAmelCase , _UpperCAmelCas...
286
1
"""simple docstring""" import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset ...
286
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCamelCase_ : int = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDepend...
286
1
"""simple docstring""" lowerCamelCase_ : List[Any] = 0 # The first color of the flag. lowerCamelCase_ : str = 1 # The second color of the flag. lowerCamelCase_ : str = 2 # The third color of the flag. lowerCamelCase_ : Tuple = (red, wh...
286
"""simple docstring""" import os # Precomputes a list of the 100 first triangular numbers lowerCamelCase_ : List[str] = [int(0.5 * n * (n + 1)) for n in range(1, 1_01)] def UpperCAmelCase__ ( ): """simple docstring""" A_ : Union[str, Any] = os...
286
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 transformers.ut...
286
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : List[str] = {'configuration_xln...
286
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase_ : Any = { 'configuration_instructblip': [ 'INSTRUCTBLIP_PRETRAINED_CONFIG_ARCHIVE_MAP', 'InstructBlipConfig', ...
286
"""simple docstring""" import torch from diffusers import DiffusionPipeline class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , snake_case_ , snake_case_ ): """simple docstring""" super().__init__() se...
286
1
"""simple docstring""" import argparse import json import os import fairseq import torch from fairseq.data import Dictionary # Register SEW's fairseq modules from sew_asapp import tasks # noqa: F401 from transformers import ( SEWConfig, SEWForCTC, SEWModel, WavaVecaCTCTokenizer, WavaVe...
286
"""simple docstring""" from heapq import heappop, heappush import numpy as np def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ): """simple docstring""" A_ , A_ : List[str] = grid.shape ...
286
1
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENS...
286
"""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_ : Optional[Any] = { 'huggingface/informe...
286
1
"""simple docstring""" from __future__ import annotations def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : Dict = 0 A_ : List[str] = len(_UpperCAmelCase ) - 1 while i < j: if nums[i] + ...
286
"""simple docstring""" import os def UpperCAmelCase__ ( ): """simple docstring""" A_ : Any = os.path.join(os.path.dirname(_UpperCAmelCase ) , 'num.txt' ) with open(_UpperCAmelCase ) as file_hand: return str(sum(int(_UpperCAmelCase ) for...
286
1
"""simple docstring""" import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device lowerCamelCase_ : Dict = False class _UpperCAmelCase ( un...
286
"""simple docstring""" import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger lowerCamelCase_ : Dict = get_logger(__name__) lowerCamelCase_ : List[str] = r'\n Args:\n ...
286
1
"""simple docstring""" import unittest from transformers import GPTSwaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin lowerCamelCase_ : List[Any] = get_tests_dir('...
286
"""simple docstring""" import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging lowerCamelCase_ : Tuple = logging.get_logger(__name__) def UpperCAmelCase__ ( _UpperCAmelCase ...
286
1
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" assert column_title.isupper() A_ : Optional[int] = 0 A_ : Union[str, Any] = len(_UpperCAmelCase ) - 1 A_ : Optional[int] = 0 whi...
286
"""simple docstring""" from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' lowercase_ : List[str] = CustomTokenizer pass
286
1
"""simple docstring""" import os from tempfile import TemporaryDirectory from unittest import TestCase import pytest from absl.testing import parameterized from datasets import config from datasets.arrow_reader import HF_GCP_BASE_URL from datasets.builder import DatasetBuilder from datasets.dataset_dict imp...
286
"""simple docstring""" from typing import Dict import numpy as np from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline, PipelineException if is_tf_available(): import tensorflow as tf from ..tf_utils impor...
286
1
"""simple docstring""" import copy import inspect import unittest from transformers import AutoBackbone from transformers.configuration_utils import PretrainedConfig from transformers.testing_utils import require_timm, require_torch, torch_device from transformers.utils.import_utils import is_torch_available...
286
"""simple docstring""" import copy import random from transformers import CLIPTokenizer class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , *snake_case_ , **snake_case_ ): """simple docstring""" super().__init_...
286
1
"""simple docstring""" import random def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : int = num - 1 A_ : List[str] = 0 while s % 2 == 0: A_ : Any = s // 2 t += 1 for _ in range(5 ): ...
286
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" A_ : List[str] = hex_num.strip() if not hex_num: raise ValueError('No value was passed to the function' ) A_ : Any = hex_num[0] == '-' if is_ne...
286
1
"""simple docstring""" from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class _UpperCAmelCase : '''simple docstring''' pass
286
"""simple docstring""" import qiskit def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" A_ : Tuple = qiskit.Aer.get_backend('aer_simulator' ) A_ : str = qiskit.QuantumCircuit(4 , 2 ) # enc...
286
1
"""simple docstring""" 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 GPT...
286
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ : str = logging.get_logger(__name__) lowerCamelCase_ : Any =...
286
1
"""simple docstring""" import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common i...
286
"""simple docstring""" import warnings 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 _UpperCAmelCase ( U...
286
1
"""simple docstring""" import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mod...
286
"""simple docstring""" from copy import deepcopy class _UpperCAmelCase : '''simple docstring''' def __init__( self , snake_case_ = None , snake_case_ = None ): """simple docstring""" if arr is None and size is not None: A_ : Union[st...
286
1
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): """simple docstring""" return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(_UpperCAmelCase ) ) def ...
286
"""simple docstring""" from typing import Optional, Union import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models.modeling_utils import ModelMixin class _UpperCAmelCase ( UpperCAmelCase__ , UpperCAmelCase__ ): '''simple docstring...
286
1
"""simple docstring""" import os import unittest from transformers.models.phobert.tokenization_phobert import VOCAB_FILES_NAMES, PhobertTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _UpperCAmelCase ( UpperCAmelCase__ , unittest.TestCase ): '''simple docstrin...
286
"""simple docstring""" from arguments import InitializationArguments from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, HfArgumentParser # Configuration lowerCamelCase_ : Any = HfArgumentParser(InitializationArguments) lowerCamelCase_ : Union[str, Any] ...
286
1
"""simple docstring""" import unittest from dataclasses import dataclass import pytest from accelerate.commands.config.config_args import SageMakerConfig from accelerate.utils import ComputeEnvironment from accelerate.utils.launch import _convert_nargs_to_dict @dataclass class _UpperCAmelCase ( UpperCA...
286
"""simple docstring""" import gzip import hashlib import json import multiprocessing import os import re import shutil import time from pathlib import Path import numpy as np from arguments import PreprocessingArguments from datasets import load_dataset from minhash_deduplication import deduplicate_dataset ...
286
1
"""simple docstring""" import collections import inspect import unittest from transformers import SwinvaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configu...
286
"""simple docstring""" 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 timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transformers import ...
286
1
"""simple docstring""" import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @req...
286
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" if isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError('\'float\' object cannot be interpreted as an integer' ) if isinstance(_UpperCAmelCase , _UpperCAmelCas...
286
1
"""simple docstring""" def UpperCAmelCase__ ( _UpperCAmelCase ): """simple docstring""" try: A_ : List[Any] = float(_UpperCAmelCase ) except ValueError: raise ValueError('Please enter a valid number' ) A_ : int = decimal - int...
286
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCamelCase_ : int = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDepend...
286
1
"""simple docstring""" from math import log from scipy.constants import Boltzmann, physical_constants lowerCamelCase_ : List[Any] = 3_00 # TEMPERATURE (unit = K) def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ): """simple d...
286
"""simple docstring""" import os # Precomputes a list of the 100 first triangular numbers lowerCamelCase_ : List[str] = [int(0.5 * n * (n + 1)) for n in range(1, 1_01)] def UpperCAmelCase__ ( ): """simple docstring""" A_ : Union[str, Any] = os...
286
1
"""simple docstring""" from __future__ import annotations import math lowerCamelCase_ : str = '2020.9.26' lowerCamelCase_ : Union[str, Any] = 'xcodz-dot, cclaus, dhruvmanila' def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCas...
286
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase_ : List[str] = {'configuration_xln...
286
1
"""simple docstring""" from __future__ import annotations import unittest from transformers import is_tf_available, is_torch_available from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow if is_tf_available(): from transformers import ( ...
286
"""simple docstring""" import torch from diffusers import DiffusionPipeline class _UpperCAmelCase ( UpperCAmelCase__ ): '''simple docstring''' def __init__( self , snake_case_ , snake_case_ ): """simple docstring""" super().__init__() se...
286
1
"""simple docstring""" lowerCamelCase_ : Optional[int] = '\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/t...
286
"""simple docstring""" from heapq import heappop, heappush import numpy as np def UpperCAmelCase__ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase , ): """simple docstring""" A_ , A_ : List[str] = grid.shape ...
286
1
"""simple docstring""" # A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and ...
286
"""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_ : Optional[Any] = { 'huggingface/informe...
286
1
"""simple docstring""" import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCamelCase_ : Union[str, Any] = logging.get_logger(__name__...
286
"""simple docstring""" import os def UpperCAmelCase__ ( ): """simple docstring""" A_ : Any = os.path.join(os.path.dirname(_UpperCAmelCase ) , 'num.txt' ) with open(_UpperCAmelCase ) as file_hand: return str(sum(int(_UpperCAmelCase ) for...
286
1
"""simple docstring""" import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import...
286
"""simple docstring""" import inspect import jax import jax.lax as lax import jax.numpy as jnp from ..utils import add_start_docstrings from ..utils.logging import get_logger lowerCamelCase_ : Dict = get_logger(__name__) lowerCamelCase_ : List[str] = r'\n Args:\n ...
286
1
"""simple docstring""" from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class ...
286
"""simple docstring""" import re import jax.numpy as jnp from flax.traverse_util import flatten_dict, unflatten_dict from jax.random import PRNGKey from ..utils import logging lowerCamelCase_ : Tuple = logging.get_logger(__name__) def UpperCAmelCase__ ( _UpperCAmelCase ...
286
1