code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, logging, ) logging.s...
700
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _lowerCAmelCase ( UpperCAmelCase_ ): '''simple docstring''' a_ : Union[str, Any] =["""image_processor""", """tokenizer"""] a_ : ...
669
0
'''simple docstring''' import os import shutil from pathlib import Path from typing import Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ..utils import ONNX_EXTERNAL_WEIGHTS_NAME, ONNX_WEIGHTS_NAME, is_onnx_available, logging if is_onnx_available(): import onnx...
701
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename lowerCAmelCase_ = """http://www.mocksite.com/file1.txt"...
669
0
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 lowerCAmelCase_ = Mapping[str, np.ndarray] lowerCAmelCase_ = Mapping[str, Any] # Is a nested dict. lowerCAmelCas...
702
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """roberta-base""": """https://huggingface...
669
0
from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import torch if is_tf_availab...
703
from random import randint, random def lowerCamelCase_ ( lowerCAmelCase: int , lowerCAmelCase: int , lowerCAmelCase: int , lowerCAmelCase: bool = False , lowerCAmelCase: bool = False , lowerCAmelCase: int = 5 , )-> list: _snake_case : Dict ...
669
0
from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionPipeline, ...
704
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 RealmTokenizer lowerCAmelCas...
669
0
import qiskit def lowerCamelCase_ ( lowerCAmelCase: int , lowerCAmelCase: int )-> qiskit.result.counts.Counts: _snake_case : Any = qiskit.Aer.get_backend('aer_simulator' ) # Create a Quantum Circuit acting on the q register _snake_case : Union[str, Any] ...
705
import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = {name: getattr(transformers, name + """Fast""") for name i...
669
0
import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def lowerCamelCase_ ( lowerCAmelCase: Dict )-> List[str]: _snake_case : str = [ 'decoder.version', 'decoder.output_projection.wei...
706
def lowerCamelCase_ ( lowerCAmelCase: bytes )-> str: return "".join([hex(lowerCAmelCase )[2:].zfill(2 ).upper() for byte in list(lowerCAmelCase )] ) def lowerCamelCase_ ( lowerCAmelCase: str )-> bytes: # Check data validity, following RFC3548 # https://www.ietf.org/rf...
669
0
import copy import json import os import tempfile from transformers import is_torch_available from .test_configuration_utils import config_common_kwargs class _lowerCAmelCase ( UpperCAmelCase_ ): '''simple docstring''' def __init__( self : Tuple , UpperCam...
707
import csv import tweepy # Twitter API credentials lowerCAmelCase_ = """""" lowerCAmelCase_ = """""" lowerCAmelCase_ = """""" lowerCAmelCase_ = """""" def lowerCamelCase_ ( lowerCAmelCase: str )-> None: # authorize twitter, initialize tweepy _snake_...
669
0
import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShard, SkipBatchSampler, SkipDataLoader, ...
708
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class _lowerCAmelCase : '''simple docstring''' a_ : Optional[Union[str, Path]] =None a_ : bool =False a_ : bool ...
669
0
import json import os import unittest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @requir...
709
import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils import require_keras_nlp, require_t...
669
0
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class _lowerCAmelCase ( unittest.TestCase ): '''simple docstring''' def UpperCamelCase_ ( self : Any ): '''sim...
710
def lowerCamelCase_ ( lowerCAmelCase: int )-> list: _snake_case : List[Any] = int(lowerCAmelCase ) if n_element < 1: _snake_case : int = ValueError('a should be a positive number' ) raise my_error _snake_case : Union[str, Any] ...
669
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) class _lowerCAmelCase ( UpperCAmelCase_ ): '''simple docstring''' a_ : Any ="""timm_backbone""" def __init__( self ...
711
import json import unittest import numpy as np from huggingface_hub import hf_hub_download 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, prep...
669
0
import importlib import shutil import threading import warnings from typing import List import fsspec import fsspec.asyn from . import compression from .hffilesystem import HfFileSystem lowerCAmelCase_ = importlib.util.find_spec("""s3fs""") is not None if _has_safs: from .safilesystem import Sa...
712
# 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 # # Unless required by app...
669
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase_ = {"""configuration_mbart""": ["""MBART_PRET...
713
# Function to print upper half of diamond (pyramid) def lowerCamelCase_ ( lowerCAmelCase: Optional[Any] )-> List[str]: for i in range(0 , lowerCAmelCase ): for _ in range(0 , n - i - 1 ): # printing spaces print(' ' , end='' ) for _ in range(0 ...
669
0
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename lowerCAmelCase_ = """http://www.mocksite.com/file1.txt"...
714
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """MIT/ast-finetuned-audioset-10-10-0.4593""": ( """https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/c...
669
0
import math from datetime import datetime, timedelta def lowerCamelCase_ ( lowerCAmelCase: int )-> datetime: _snake_case : Optional[Any] = year % 19 _snake_case : List[Any] = year % 4 _snake_case : Optional[Any] = year % 7 _snake_case : ...
715
import math import random from typing import Any from .hill_climbing import SearchProblem def lowerCamelCase_ ( lowerCAmelCase: Tuple , lowerCAmelCase: bool = True , lowerCAmelCase: float = math.inf , lowerCAmelCase: float = -math.inf , lowerCAmelCase: float = math....
669
0
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_available, is_vision_available fr...
716
from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .attention_processor imp...
669
0
'''simple docstring''' import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def lowerCamelCase_ ( lowerCAmelCase: Optional[int] )-> List[Any]: def wrapper(*lowerCAmelCase: Tuple , **lowerCAme...
717
def lowerCamelCase_ ( lowerCAmelCase: int )-> int: if not isinstance(lowerCAmelCase , lowerCAmelCase ): _snake_case : Union[str, Any] = F"""Input value of [number={number}] must be an integer""" raise TypeError(lowerCAmelCase ) if number < 1: _snake_...
669
0
import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformers from transformers...
718
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer lowerCAmelCase_ = {"""vocab_file""": """vocab.txt""", """tokenizer_file""": """tokenizer.json"""} ...
669
0
from collections import OrderedDict from typing import Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...feature_extraction_utils import FeatureExtractionMixin from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...tokenization_ut...
719
from __future__ import annotations from random import random class _lowerCAmelCase : '''simple docstring''' def __init__( self : Dict , UpperCamelCase : int | None = None ): '''simple docstring''' _snake_case : str = ...
669
0
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner import Split, ...
720
from functools import reduce lowerCAmelCase_ = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """66...
669
0
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class _lowerCAmelCase ( UpperCAmelCase_ ): '''simple docstring''' a_ : Union[str, Any] ="""Speech2TextFeatureExtractor""" a_ : Union[str, Any] ...
721
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowerCamelCase_ ( )-> Any: _snake_case : List[str] = { 'repo_name': ['test_repo1', 'test_repo2', 'test_repo3'], 'path': ['test_...
669
0
from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar lowerCAmelCase_ = TypeVar("""T""") class _lowerCAmelCase ( Generic[T] ): '''simple docstring''' a_ : deque[T] # Cache store of keys a_ : ...
700
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _lowerCAmelCase ( UpperCAmelCase_ ): '''simple docstring''' a_ : Union[str, Any] =["""image_processor""", """tokenizer"""] a_ : ...
669
0
'''simple docstring''' import csv import tweepy # Twitter API credentials lowerCAmelCase_ = """""" lowerCAmelCase_ = """""" lowerCAmelCase_ = """""" lowerCAmelCase_ = """""" def lowerCamelCase_ ( lowerCAmelCase: str )-> None: # authorize twitter,...
701
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename lowerCAmelCase_ = """http://www.mocksite.com/file1.txt"...
669
0
def lowerCamelCase_ ( lowerCAmelCase: int , lowerCAmelCase: int )-> float: return base * power(lowerCAmelCase , (exponent - 1) ) if exponent else 1 if __name__ == "__main__": print("""Raise base to the power of exponent using recursion...""") lowerCAmelCase_ ...
702
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """roberta-base""": """https://huggingface...
669
0
from torch import nn class _lowerCAmelCase ( nn.Module ): '''simple docstring''' def __init__( self : Union[str, Any] , UpperCamelCase : Optional[Any] , UpperCamelCase : Dict ): '''simple docstring''' super().__init__...
703
from random import randint, random def lowerCamelCase_ ( lowerCAmelCase: int , lowerCAmelCase: int , lowerCAmelCase: int , lowerCAmelCase: bool = False , lowerCAmelCase: bool = False , lowerCAmelCase: int = 5 , )-> list: _snake_case : Dict ...
669
0
import re import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class _lowerCAmelCase ( UpperCAmelCase_ ): '''simple docstring''' a_ : Dict =["""image_processor""", """tokenizer"""] a_ : Dict =...
704
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 RealmTokenizer lowerCAmelCas...
669
0
import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils import require_keras_nlp, require_t...
705
import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = {name: getattr(transformers, name + """Fast""") for name i...
669
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """SenseTime/deformable-detr""": """https://huggingface.co/sensetime/deformable-detr/resol...
706
def lowerCamelCase_ ( lowerCAmelCase: bytes )-> str: return "".join([hex(lowerCAmelCase )[2:].zfill(2 ).upper() for byte in list(lowerCAmelCase )] ) def lowerCamelCase_ ( lowerCAmelCase: str )-> bytes: # Check data validity, following RFC3548 # https://www.ietf.org/rf...
669
0
from __future__ import annotations def lowerCamelCase_ ( lowerCAmelCase: list )-> float: if not nums: raise ValueError('List is empty' ) return sum(lowerCAmelCase ) / len(lowerCAmelCase ) if __name__ == "__main__": import doctest doctest.testmod()
707
import csv import tweepy # Twitter API credentials lowerCAmelCase_ = """""" lowerCAmelCase_ = """""" lowerCAmelCase_ = """""" lowerCAmelCase_ = """""" def lowerCamelCase_ ( lowerCAmelCase: str )-> None: # authorize twitter, initialize tweepy _snake_...
669
0
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_numpy, slo...
708
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class _lowerCAmelCase : '''simple docstring''' a_ : Optional[Union[str, Path]] =None a_ : bool =False a_ : bool ...
669
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """google/m...
709
import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils import require_keras_nlp, require_t...
669
0
import copy import fnmatch import json import os import pickle as pkl import shutil import sys import tarfile import tempfile from collections import OrderedDict from contextlib import contextmanager from functools import partial from hashlib import shaaaa from io import BytesIO from pathlib import Path from url...
710
def lowerCamelCase_ ( lowerCAmelCase: int )-> list: _snake_case : List[Any] = int(lowerCAmelCase ) if n_element < 1: _snake_case : int = ValueError('a should be a positive number' ) raise my_error _snake_case : Union[str, Any] ...
669
0
def lowerCamelCase_ ( lowerCAmelCase: bytes )-> str: return "".join([hex(lowerCAmelCase )[2:].zfill(2 ).upper() for byte in list(lowerCAmelCase )] ) def lowerCamelCase_ ( lowerCAmelCase: str )-> bytes: # Check data validity, following RFC3548 # https://www.ietf.org/rfc/rfc3...
711
import json import unittest import numpy as np from huggingface_hub import hf_hub_download 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, prep...
669
0
import numpy as np class _lowerCAmelCase : '''simple docstring''' def __init__( self : Dict ): '''simple docstring''' _snake_case : Any = (0, 0) _snake_case : Any = None _snake_case : List[Any] ...
712
# 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 # # Unless required by app...
669
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase_ = { """configuration_mobilebert""": [ """MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP""", ...
713
# Function to print upper half of diamond (pyramid) def lowerCamelCase_ ( lowerCAmelCase: Optional[Any] )-> List[str]: for i in range(0 , lowerCAmelCase ): for _ in range(0 , n - i - 1 ): # printing spaces print(' ' , end='' ) for _ in range(0 ...
669
0
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 from transformers import Au...
714
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """MIT/ast-finetuned-audioset-10-10-0.4593""": ( """https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/c...
669
0
from collections.abc import Generator def lowerCamelCase_ ( )-> Generator[int, None, None]: _snake_case : Optional[Any] = 0, 1 while True: _snake_case : str = b, a + b yield b def lowerCamelCase_ ( lowerCAmelCase: int = 10_00 )-> int: _snak...
715
import math import random from typing import Any from .hill_climbing import SearchProblem def lowerCamelCase_ ( lowerCAmelCase: Tuple , lowerCAmelCase: bool = True , lowerCAmelCase: float = math.inf , lowerCAmelCase: float = -math.inf , lowerCAmelCase: float = math....
669
0
def lowerCamelCase_ ( lowerCAmelCase: float )-> float: return 10 - x * x def lowerCamelCase_ ( lowerCAmelCase: float , lowerCAmelCase: float )-> float: # Bolzano theory in order to find if there is a root between a and b if equation(lowerCAmelCase ) * equation(lowerCAmelCas...
716
from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .attention_processor imp...
669
0
'''simple docstring''' from math import ceil from typing import List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import BatchFeature, SequenceFeatureExtractor from ...utils import TensorType, logging ...
717
def lowerCamelCase_ ( lowerCAmelCase: int )-> int: if not isinstance(lowerCAmelCase , lowerCAmelCase ): _snake_case : Union[str, Any] = F"""Input value of [number={number}] must be an integer""" raise TypeError(lowerCAmelCase ) if number < 1: _snake_...
669
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase_ = { """configuration_electra""": ["""ELECTRA_PRETRAINED_CONFIG_ARCHIVE_M...
718
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer lowerCAmelCase_ = {"""vocab_file""": """vocab.txt""", """tokenizer_file""": """tokenizer.json"""} ...
669
0
import itertools import os import random import tempfile import unittest import numpy as np from datasets import load_dataset from transformers import is_speech_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.import_u...
719
from __future__ import annotations from random import random class _lowerCAmelCase : '''simple docstring''' def __init__( self : Dict , UpperCamelCase : int | None = None ): '''simple docstring''' _snake_case : str = ...
669
0
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from ...test_modeling_comm...
720
from functools import reduce lowerCAmelCase_ = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """66...
669
0
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu_available(check_device=...
721
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowerCamelCase_ ( )-> Any: _snake_case : List[str] = { 'repo_name': ['test_repo1', 'test_repo2', 'test_repo3'], 'path': ['test_...
669
0
def lowerCamelCase_ ( lowerCAmelCase: int = 50 )-> int: _snake_case : Any = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(row_length - tile_length + 1 ): ...
700
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _lowerCAmelCase ( UpperCAmelCase_ ): '''simple docstring''' a_ : Union[str, Any] =["""image_processor""", """tokenizer"""] a_ : ...
669
0
'''simple docstring''' import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class _lowerCAmelCase : '''simple docstring''' a_ : Optional[Union[str, Path]] =None a_ : bool =Fa...
701
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename lowerCAmelCase_ = """http://www.mocksite.com/file1.txt"...
669
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """bert-base-uncased""": """https://huggin...
702
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """roberta-base""": """https://huggingface...
669
0
def lowerCamelCase_ ( lowerCAmelCase: int , lowerCAmelCase: int )-> int: return int((input_a, input_a).count(1 ) != 0 ) def lowerCamelCase_ ( )-> None: assert or_gate(0 , 0 ) == 0 assert or_gate(0 , 1 ) == 1 assert or_gate(1 , 0 )...
703
from random import randint, random def lowerCamelCase_ ( lowerCAmelCase: int , lowerCAmelCase: int , lowerCAmelCase: int , lowerCAmelCase: bool = False , lowerCAmelCase: bool = False , lowerCAmelCase: int = 5 , )-> list: _snake_case : Dict ...
669
0
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, shard_checkpoint lowerCAmelCase_ ...
704
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 RealmTokenizer lowerCAmelCas...
669
0
import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py lowerCAmelCase_ = """src/transformers""" # This is to make sure the...
705
import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = {name: getattr(transformers, name + """Fast""") for name i...
669
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = ...
706
def lowerCamelCase_ ( lowerCAmelCase: bytes )-> str: return "".join([hex(lowerCAmelCase )[2:].zfill(2 ).upper() for byte in list(lowerCAmelCase )] ) def lowerCamelCase_ ( lowerCAmelCase: str )-> bytes: # Check data validity, following RFC3548 # https://www.ietf.org/rf...
669
0
import argparse import re from flax.traverse_util import flatten_dict, unflatten_dict from tax import checkpoints from transformers import SwitchTransformersConfig, SwitchTransformersForConditionalGeneration from transformers.modeling_flax_pytorch_utils import load_flax_weights_in_pytorch_model from transformer...
707
import csv import tweepy # Twitter API credentials lowerCAmelCase_ = """""" lowerCAmelCase_ = """""" lowerCAmelCase_ = """""" lowerCAmelCase_ = """""" def lowerCamelCase_ ( lowerCAmelCase: str )-> None: # authorize twitter, initialize tweepy _snake_...
669
0
import torch from diffusers import CMStochasticIterativeScheduler from .test_schedulers import SchedulerCommonTest class _lowerCAmelCase ( UpperCAmelCase_ ): '''simple docstring''' a_ : Optional[int] =(CMStochasticIterativeScheduler,) a_ : Any ...
708
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class _lowerCAmelCase : '''simple docstring''' a_ : Optional[Union[str, Path]] =None a_ : bool =False a_ : bool ...
669
0
import os try: from .build_directory_md import good_file_paths except ImportError: from build_directory_md import good_file_paths # type: ignore lowerCAmelCase_ = list(good_file_paths()) assert filepaths, "good_file_paths() failed!" lowerCAmelCase_ = [file for file in filepat...
709
import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils import require_keras_nlp, require_t...
669
0
import argparse import json from typing import List from ltp import LTP from transformers import BertTokenizer def lowerCamelCase_ ( lowerCAmelCase: Dict )-> Tuple: # This defines a "chinese character" as anything in the CJK Unicode block: # https://en.wikipedia.org/wiki/CJK_Unified_Ideogr...
710
def lowerCamelCase_ ( lowerCAmelCase: int )-> list: _snake_case : List[Any] = int(lowerCAmelCase ) if n_element < 1: _snake_case : int = ValueError('a should be a positive number' ) raise my_error _snake_case : Union[str, Any] ...
669
0
import os import random import sys from . import cryptomath_module as cryptomath from . import rabin_miller lowerCAmelCase_ = 3 def lowerCamelCase_ ( lowerCAmelCase: int )-> int: print('Generating primitive root of p' ) while True: _snake_case : int = random.rand...
711
import json import unittest import numpy as np from huggingface_hub import hf_hub_download 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, prep...
669
0
from ..utils import DummyObject, requires_backends class _lowerCAmelCase ( metaclass=UpperCAmelCase_ ): '''simple docstring''' a_ : List[str] =["""torch""", """transformers""", """onnx"""] def __init__( self : str , *UpperCamelCase ...
712
# 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 # # Unless required by app...
669
0
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_torch_available(): import...
713
# Function to print upper half of diamond (pyramid) def lowerCamelCase_ ( lowerCAmelCase: Optional[Any] )-> List[str]: for i in range(0 , lowerCAmelCase ): for _ in range(0 , n - i - 1 ): # printing spaces print(' ' , end='' ) for _ in range(0 ...
669
0
def lowerCamelCase_ ( lowerCAmelCase: str )-> list: if n_term == "": return [] _snake_case : list = [] for temp in range(int(lowerCAmelCase ) ): series.append(F"""1/{temp + 1}""" if series else '1' ) return series if __name__ == "__main__": lowerCAme...
714
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """MIT/ast-finetuned-audioset-10-10-0.4593""": ( """https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/c...
669
0
from __future__ import annotations from collections.abc import Generator import requests from bsa import BeautifulSoup lowerCAmelCase_ = """https://www.indeed.co.in/jobs?q=mobile+app+development&l=""" def lowerCamelCase_ ( lowerCAmelCase: str = "mumbai" )-> Generator[tuple[str, str], Non...
715
import math import random from typing import Any from .hill_climbing import SearchProblem def lowerCamelCase_ ( lowerCAmelCase: Tuple , lowerCAmelCase: bool = True , lowerCAmelCase: float = math.inf , lowerCAmelCase: float = -math.inf , lowerCAmelCase: float = math....
669
0
def lowerCamelCase_ ( lowerCAmelCase: int = 1_00 )-> int: _snake_case : str = n * (n + 1) * (2 * n + 1) / 6 _snake_case : int = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__main__": print(F"""{solution() = }""") ...
716
from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .attention_processor imp...
669
0
'''simple docstring''' import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = {name: getattr(transformers, n...
717
def lowerCamelCase_ ( lowerCAmelCase: int )-> int: if not isinstance(lowerCAmelCase , lowerCAmelCase ): _snake_case : Union[str, Any] = F"""Input value of [number={number}] must be an integer""" raise TypeError(lowerCAmelCase ) if number < 1: _snake_...
669
0
import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def lowerCamelCase_ ( lowerCAmelCase: str , lowerCAmelCase: str , **lowerCAmelCase: Tuple )-> str: _snake_case : List[str] = AutoConfig.from_pretrained(lowerCAmelCase , ...
718
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer lowerCAmelCase_ = {"""vocab_file""": """vocab.txt""", """tokenizer_file""": """tokenizer.json"""} ...
669
0
def lowerCamelCase_ ( lowerCAmelCase: float , lowerCAmelCase: float )-> float: if density <= 0: raise ValueError('Impossible fluid density' ) if bulk_modulus <= 0: raise ValueError('Impossible bulk modulus' ) return (bulk_modulus / density) ** 0.5 if __name__ == "__ma...
719
from __future__ import annotations from random import random class _lowerCAmelCase : '''simple docstring''' def __init__( self : Dict , UpperCamelCase : int | None = None ): '''simple docstring''' _snake_case : str = ...
669
0
from __future__ import annotations lowerCAmelCase_ = """Muhammad Umer Farooq""" lowerCAmelCase_ = """MIT""" lowerCAmelCase_ = """1.0.0""" lowerCAmelCase_ = """Muhammad Umer Farooq""" lowerCAmelCase_ = """contact@muhammadumerfarooq.me""" lowerCAmelCase_ ...
720
from functools import reduce lowerCAmelCase_ = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """66...
669
0
import math import flax.linen as nn import jax.numpy as jnp def lowerCamelCase_ ( lowerCAmelCase: jnp.ndarray , lowerCAmelCase: int , lowerCAmelCase: float = 1 , lowerCAmelCase: float = 1 , lowerCAmelCase: float = 1.0E4 , lowerCAmelCase: bool = False , ...
721
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowerCamelCase_ ( )-> Any: _snake_case : List[str] = { 'repo_name': ['test_repo1', 'test_repo2', 'test_repo3'], 'path': ['test_...
669
0
from PIL import Image def lowerCamelCase_ ( lowerCAmelCase: Image , lowerCAmelCase: float )-> Image: def brightness(lowerCAmelCase: int ) -> float: return 1_28 + level + (c - 1_28) if not -2_55.0 <= level <= 2_55.0: raise ValueError('level must be between -255.0 (black) an...
700
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _lowerCAmelCase ( UpperCAmelCase_ ): '''simple docstring''' a_ : Union[str, Any] =["""image_processor""", """tokenizer"""] a_ : ...
669
0
'''simple docstring''' # 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]'...
701
import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename lowerCAmelCase_ = """http://www.mocksite.com/file1.txt"...
669
0
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionAttendAndExcitePipeline, UNetaDConditionModel, ) from diffusers.utils import load_numpy, skip_mps, ...
702
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """roberta-base""": """https://huggingface...
669
0
import math import random from typing import Any from .hill_climbing import SearchProblem def lowerCamelCase_ ( lowerCAmelCase: Tuple , lowerCAmelCase: bool = True , lowerCAmelCase: float = math.inf , lowerCAmelCase: float = -math.inf , lowerCAmelCase: float = math....
703
from random import randint, random def lowerCamelCase_ ( lowerCAmelCase: int , lowerCAmelCase: int , lowerCAmelCase: int , lowerCAmelCase: bool = False , lowerCAmelCase: bool = False , lowerCAmelCase: int = 5 , )-> list: _snake_case : Dict ...
669
0
lowerCAmelCase_ = { """Pillow""": """Pillow""", """accelerate""": """accelerate>=0.11.0""", """compel""": """compel==0.1.8""", """black""": """black~=23.1""", """datasets""": """datasets""", """filelock""": """filelock""", """flax""": """flax>=0.4.1""", """hf-doc-builder...
704
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 RealmTokenizer lowerCAmelCas...
669
0
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from typing import Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import randn_tensor from .scheduling_utils import SchedulerMixin class lowe...
705
import argparse import os import transformers from .convert_slow_tokenizer import SLOW_TO_FAST_CONVERTERS from .utils import logging logging.set_verbosity_info() lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = {name: getattr(transformers, name + """Fast""") for name i...
669
0
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class _lowerCAmelCase : '''simple docstring''' a_ : int a_ : TreeNode | None =None a_ : TreeNode | None =None lower...
706
def lowerCamelCase_ ( lowerCAmelCase: bytes )-> str: return "".join([hex(lowerCAmelCase )[2:].zfill(2 ).upper() for byte in list(lowerCAmelCase )] ) def lowerCamelCase_ ( lowerCAmelCase: str )-> bytes: # Check data validity, following RFC3548 # https://www.ietf.org/rf...
669
0
import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate lowerCAmelCase_ = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow("""""", """|""", """|"""), ...
707
import csv import tweepy # Twitter API credentials lowerCAmelCase_ = """""" lowerCAmelCase_ = """""" lowerCAmelCase_ = """""" lowerCAmelCase_ = """""" def lowerCamelCase_ ( lowerCAmelCase: str )-> None: # authorize twitter, initialize tweepy _snake_...
669
0
import gc import unittest from parameterized import parameterized from diffusers import FlaxUNetaDConditionModel from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import load_hf_numpy, require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp ...
708
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class _lowerCAmelCase : '''simple docstring''' a_ : Optional[Union[str, Path]] =None a_ : bool =False a_ : bool ...
669
0
import collections import json import os import re from typing import TYPE_CHECKING, List, Optional, Tuple import numpy as np from ...tokenization_utils_fast import PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation lowerCA...
709
import unittest from pathlib import Path from tempfile import TemporaryDirectory from transformers import AutoConfig, TFGPTaLMHeadModel, is_keras_nlp_available, is_tf_available from transformers.models.gpta.tokenization_gpta import GPTaTokenizer from transformers.testing_utils import require_keras_nlp, require_t...
669
0
import unittest import numpy as np import timeout_decorator # noqa from transformers import BlenderbotConfig, is_flax_available from transformers.testing_utils import jax_device, require_flax, slow from ...generation.test_flax_utils import FlaxGenerationTesterMixin from ...test_modeling_flax_common import Fl...
710
def lowerCamelCase_ ( lowerCAmelCase: int )-> list: _snake_case : List[Any] = int(lowerCAmelCase ) if n_element < 1: _snake_case : int = ValueError('a should be a positive number' ) raise my_error _snake_case : Union[str, Any] ...
669
0
from __future__ import annotations import math def lowerCamelCase_ ( lowerCAmelCase: float , lowerCAmelCase: int )-> float: _snake_case : Tuple = u for i in range(1 , lowerCAmelCase ): _snake_case : Optional[int] = temp * (u - i) return ...
711
import json import unittest import numpy as np from huggingface_hub import hf_hub_download 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, prep...
669
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """andreasmadsen/efficient_mlm_m0.40""": (...
712
# 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 # # Unless required by app...
669
0
from abc import ABC, abstractmethod from argparse import ArgumentParser class _lowerCAmelCase ( UpperCAmelCase_ ): '''simple docstring''' @staticmethod @abstractmethod def UpperCamelCase_ ( UpperCamelCase : ArgumentParser ): '''simple docstring''' ...
713
# Function to print upper half of diamond (pyramid) def lowerCamelCase_ ( lowerCAmelCase: Optional[Any] )-> List[str]: for i in range(0 , lowerCAmelCase ): for _ in range(0 , n - i - 1 ): # printing spaces print(' ' , end='' ) for _ in range(0 ...
669
0
def lowerCamelCase_ ( lowerCAmelCase: int )-> list: _snake_case : List[Any] = int(lowerCAmelCase ) if n_element < 1: _snake_case : int = ValueError('a should be a positive number' ) raise my_error _snake_case : Union[str, Any] ...
714
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """MIT/ast-finetuned-audioset-10-10-0.4593""": ( """https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/c...
669
0
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """google/pegasus-large""": """https://huggingface.co/google/pegasus-large/resolve/main/config.json""", # See all PEGASUS models at http...
715
import math import random from typing import Any from .hill_climbing import SearchProblem def lowerCamelCase_ ( lowerCAmelCase: Tuple , lowerCAmelCase: bool = True , lowerCAmelCase: float = math.inf , lowerCAmelCase: float = -math.inf , lowerCAmelCase: float = math....
669
0
import contextlib import importlib import io import unittest import transformers # Try to import everything from transformers to ensure every object can be loaded. from transformers import * # noqa F406 from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, require_tf, require_torch from tran...
716
from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .attention_processor imp...
669
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """microsoft/trocr-base-handwritten""": ( """https://huggingface.co/microsoft/trocr-base-handwritten/...
717
def lowerCamelCase_ ( lowerCAmelCase: int )-> int: if not isinstance(lowerCAmelCase , lowerCAmelCase ): _snake_case : Union[str, Any] = F"""Input value of [number={number}] must be an integer""" raise TypeError(lowerCAmelCase ) if number < 1: _snake_...
669
0
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class _lowerCAmelCase ( UpperCAmelCase_ ): '''simple docst...
718
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer lowerCAmelCase_ = {"""vocab_file""": """vocab.txt""", """tokenizer_file""": """tokenizer.json"""} ...
669
0
from __future__ import annotations from collections.abc import Callable from typing import Generic, TypeVar lowerCAmelCase_ = TypeVar("""T""") lowerCAmelCase_ = TypeVar("""U""") class _lowerCAmelCase ( Generic[T, U] ): '''simple docstring''' def __init__( ...
719
from __future__ import annotations from random import random class _lowerCAmelCase : '''simple docstring''' def __init__( self : Dict , UpperCamelCase : int | None = None ): '''simple docstring''' _snake_case : str = ...
669
0
import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets lowerCAmelCase_ = """\ @article{hendrycksmath2021, title={Measuring Mathematical Problem Solving With the MATH Dataset}, author={Dan Hendrycks and Collin Burns and Saurav Kadavath and Akul Aror...
720
from functools import reduce lowerCAmelCase_ = ( """73167176531330624919225119674426574742355349194934""" """96983520312774506326239578318016984801869478851843""" """85861560789112949495459501737958331952853208805511""" """12540698747158523863050715693290963295227443043557""" """66...
669
0
from typing import Optional from torch import nn from .transformer_ad import TransformeraDModel, TransformeraDModelOutput class _lowerCAmelCase ( nn.Module ): '''simple docstring''' def __init__( self : Optional[int] , UpperCamelCase : int = 16 ...
721
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def lowerCamelCase_ ( )-> Any: _snake_case : List[str] = { 'repo_name': ['test_repo1', 'test_repo2', 'test_repo3'], 'path': ['test_...
669
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCamelCase_ : Union[str, Any] = { """configuration_altclip""": [ """ALTCLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """AltCLIPConfig""", ...
670
import warnings from ..trainer import Trainer from ..utils import logging lowerCamelCase_ : Dict = logging.get_logger(__name__) class _UpperCamelCase ( _A ): '''simple docstring''' def __init__( self : List[str] , snake_case_ : Tuple=None , **sn...
670
1
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice, ...
670
import argparse import numpy as np import torch from transformers import SpeechTaHifiGan, SpeechTaHifiGanConfig, logging logging.set_verbosity_info() lowerCamelCase_ : Optional[int] = logging.get_logger("""transformers.models.speecht5""") def A__ ( lowerCamelCase , lower...
670
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Optional[Any] = logging.get_logger(__name__) lowerCamelCase_ : Tuple = { """facebook/nllb-moe-54B""": """https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json""", } cla...
670
lowerCamelCase_ : Optional[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.git """ lowerCamelCase_ ...
670
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase_ : Optional[int] = logging.get_logger(__name__) lowerCamelCase_ : str = { """s-JoL/Open-Llama-V1""": """https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json""", } class ...
670
import cva import numpy as np class _UpperCamelCase : '''simple docstring''' def __init__( self : Dict , snake_case_ : float , snake_case_ : int ): if k in (0.04, 0.06): UpperCamelCase_: Union[str, Any] = k UpperCam...
670
1
import operator as op def A__ ( lowerCamelCase ) -> Optional[int]: UpperCamelCase_: Optional[int] = [] UpperCamelCase_: Optional[int] = lambda lowerCamelCase , lowerCamelCase : int(x / y ) # noqa: E731 integer division operation UpperCame...
670
import random def A__ ( lowerCamelCase , lowerCamelCase , lowerCamelCase = False ) -> dict: UpperCamelCase_: dict = {i: [] for i in range(lowerCamelCase )} # if probability is greater or equal than 1, then generate a complete graph if probability ...
670
1
import pyarrow.parquet as pq import pytest from datasets import Audio, Dataset, DatasetDict, Features, NamedSplit, Sequence, Value, config from datasets.features.image import Image from datasets.io.parquet import ParquetDatasetReader, ParquetDatasetWriter, get_writer_batch_size from ..utils import assert_arrow_memor...
670
import os import unittest from huggingface_hub.utils import are_progress_bars_disabled import transformers.models.bart.tokenization_bart from transformers import logging from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context from transformers.utils.logging import disable_progress_bar, enable_...
670
1
from manim import * class _UpperCamelCase ( _A ): '''simple docstring''' def lowerCAmelCase__ ( self : Union[str, Any] ): UpperCamelCase_: Tuple = Rectangle(height=0.5 , width=0.5 ) UpperCamelCase_: Dict = Rectangle(heigh...
670
import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home lowerCamelCase_ : Optional[int] = HUGGINGFACE_HUB_CACHE lowerCamelCase_ : List[str] = """config.json""" lowerCamelCase_ : Any = """diffusion_pytorch_model.bin""" lowerCamelCase_ : Un...
670
1
class _UpperCamelCase : '''simple docstring''' def __init__( self : List[str] , snake_case_ : int , snake_case_ : Optional[Any]=None , snake_case_ : List[str]=None ): UpperCamelCase_: List[Any] = data UpperCamelCase_: ...
670
import inspect import os import sys import unittest import accelerate from accelerate.test_utils import execute_subprocess_async, require_tpu class _UpperCamelCase ( unittest.TestCase ): '''simple docstring''' def lowerCAmelCase__ ( self : Optional[int] ): Up...
670
1
from collections import defaultdict class _UpperCamelCase : '''simple docstring''' def __init__( self : List[str] , snake_case_ : Optional[Any] , snake_case_ : List[str] ): UpperCamelCase_: Optional[Any] = total # total no of tasks (N) ...
670
import unittest from transformers import BarthezTokenizer, BarthezTokenizerFast, BatchEncoding from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers @require_sentencepiece @slow # see ht...
670
1
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 _UpperCamelCase ( _A ): '''simple docstring''' ...
670
def A__ ( lowerCamelCase , lowerCamelCase ) -> int: while second != 0: UpperCamelCase_: Optional[Any] = first & second first ^= second UpperCamelCase_: Any = c << 1 return first if __name__ == "__main__": import doctest ...
670
1
from __future__ import annotations from collections.abc import Sequence from typing import Literal def A__ ( lowerCamelCase , lowerCamelCase ) -> str | Literal[False]: UpperCamelCase_: Dict = list(lowerCamelCase ) UpperCamelCase_: int = list(lower...
670
import logging import os import sys from dataclasses import dataclass, field from itertools import chain from typing import Optional, Union import datasets import numpy as np import torch from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForMultipleChoice, ...
670
1
from math import pow, sqrt def A__ ( *lowerCamelCase ) -> bool: UpperCamelCase_: Tuple = len(lowerCamelCase ) > 0 and all(value > 0.0 for value in values ) return result def A__ ( lowerCamelCase , lowerCamelCase ) -> float | ...
670
import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_gpu, require_torch_multi_gpu, ) logging....
670
1