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
from __future__ import annotations from math import ceil, floor, sqrt def __snake_case ( _UpperCAmelCase = 2000000 ): __a = [0] __a = 42 for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ): triangle_numbers.append(triangle_numbers[-1] +...
49
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) **...
234
0
'''simple docstring''' from typing import TYPE_CHECKING import torch from ..models.auto import AutoModelForVisualQuestionAnswering, AutoProcessor from ..utils import requires_backends from .base import PipelineTool if TYPE_CHECKING: from PIL import Image class a__( UpperCAmelCase__ ): ...
297
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { 'ut/deta': 'https://huggingface.co/ut/deta/resolve/main/conf...
234
0
from __future__ import annotations def UpperCamelCase( __UpperCamelCase : Union[str, Any] ,__UpperCamelCase : Any ): if len(__lowerCAmelCase ) == 0: return False lowerCAmelCase_ : List[str] = len(__lowerCAmelCase ) // 2 if a_list[midpoint] == item: return True i...
103
'''simple docstring''' def __lowerCAmelCase (): return [list(range(1_000 - i , -1_000 - i , -1 ) ) for i in range(1_000 )] lowerCamelCase__ = generate_large_matrix() lowerCamelCase__ = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [...
234
0
import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING from ...tokenization_utils...
76
'''simple docstring''' from __future__ import annotations lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'MIT' lowerCamelCase__ = '1.0.0' lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'contact@muhammadumerfarooq.me' lowerCamelCase__ = '...
234
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCamelCase_ = { "configuration_tapas": ["TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP", "TapasConfig"], "tokenization_ta...
251
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from tran...
234
0
'''simple docstring''' import os from distutils.util import strtobool def lowercase_ ( lowerCAmelCase__ : Any , lowerCAmelCase__ : Optional[Any] ): """simple docstring""" for e in env_keys: __UpperCAmelCase : Tuple = int(os.environ....
254
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase = 50 ): _UpperCAmelCase : Tuple = [[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(...
234
0
import torch from accelerate import PartialState from accelerate.utils.operations import broadcast, gather, gather_object, pad_across_processes, reduce def lowerCamelCase__ ( a__ : str ) -> List[str]: return (torch.arange(state.num_processes ) + 1.0 + (state.num_processes * state.proces...
122
'''simple docstring''' import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def...
234
0
class A__ : def __init__( self : Tuple , _UpperCAmelCase : int , _UpperCAmelCase : Any ) -> Tuple: """simple docstring""" __lowercase = name __lowercase = val def __str__( self : str ) -> Option...
325
'''simple docstring''' 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(__n...
234
0
"""simple docstring""" import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def UpperCa...
224
'''simple docstring''' import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel lowerCamelCase__ = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention....
234
0
from typing import Dict import numpy as np import torch from . import residue_constants as rc from .tensor_utils import tensor_tree_map, tree_map def SCREAMING_SNAKE_CASE ( lowercase_ ) -> Tuple: """simple docstring""" A__ = [] A__ = [] ...
14
'''simple docstring''' import math def __lowerCAmelCase (__lowerCAmelCase ): return math.sqrt(__lowerCAmelCase ) * math.sqrt(__lowerCAmelCase ) == num def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : int = ...
234
0
'''simple docstring''' from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar UpperCamelCase__: str = TypeVar("T") class SCREAMING_SNAKE_CASE( Generic[T] ): """simple docstring""" ...
23
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(...
234
0
from manim import * class _A ( UpperCAmelCase__ ): def _lowerCamelCase ( self : Tuple): '''simple docstring''' __a = Rectangle(height=0.5 , width=0.5) __a = Rectangle(height=0.25 , width=0.25) ...
49
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCamelCase__ = {'UserAgent': UserAgent().random} def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAme...
234
0
'''simple docstring''' def lowerCamelCase__ ( _A ): if p < 2: raise ValueError('p should not be less than 2!' ) elif p == 2: return True a : Optional[Any] = 4 a : Union[str, Any] = (1 << p) - 1 for _ in range(p - 2 ): a ...
297
'''simple docstring''' from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCamelCase__ = '\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Transl...
234
0
import argparse import logging import os import re import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, DataCollatorForLanguageModeling, PushToHubCallback, TFAutoModelForMaskedLM, create_optimizer, ) A__ : Dict = logging.getLogger(__name__) A__ : ...
103
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lo...
234
0
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available a_ = { 'configuration_vivit': ['VIVIT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'VivitConfig'], } try: if not is_vision_available(): ...
76
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class lowerCAmelCase__ : def __init__( self : Union[str, Any] ) ->Union[str, Any]: '''simple docstring''' ...
234
0
'''simple docstring''' import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speech_to_tex...
251
'''simple docstring''' import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path....
234
0
'''simple docstring''' import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( '''The `image_to_image.py` script is outdated. Please use directly `from diffusers import''' ''' StableDiffusionImg2ImgPipeline` instead.''' )
254
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lowerCAmelCase (__lowerCAmel...
234
0
from __future__ import annotations import math def lowerCamelCase__ ( a__ : str ) -> List[Any]: if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers,...
122
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassi...
234
0
import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common import ANY if is_vi...
325
'''simple docstring''' import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
234
0
"""simple docstring""" import math import unittest def UpperCamelCase_ ( lowerCAmelCase__ : Optional[Any] ) -> Union[str, Any]: """simple docstring""" assert isinstance(__lowerCAmelCase , __lowerCAmelCase ) and ( number >= 0 ),...
224
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_...
234
0
import os import sys import unittest _lowerCamelCase : List[Any] = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, create_dummy_...
14
'''simple docstring''' # # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_nod...
234
0
'''simple docstring''' def snake_case_ ( _lowerCAmelCase : Any ) -> List[str]: if upper_limit < 0: raise ValueError('''Limit for the Catalan sequence must be ≥ 0''' ) UpperCAmelCase : int = [0] * (upper_limit + 1) # Ba...
23
'''simple docstring''' import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def __lowe...
234
0
def __snake_case ( _UpperCAmelCase = 600851475143 ): try: __a = int(__lowerCAmelCase ) except (TypeError, ValueError): raise TypeError('''Parameter n must be int or castable to int.''' ) if n <= 0: raise ValueError('''Parameter n must be greater th...
49
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) **...
234
0
'''simple docstring''' def lowerCamelCase__ ( _A = "The quick brown fox jumps over the lazy dog" , ): a : Any = set() # Replace all the whitespace in our sentence a : List[Any] = input_str.replace(' ' , '' ) for alpha in input_str: i...
297
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { 'ut/deta': 'https://huggingface.co/ut/deta/resolve/main/conf...
234
0
from __future__ import annotations def UpperCamelCase( __UpperCamelCase : Optional[Any] ): lowerCAmelCase_ : int = [True] * limit lowerCAmelCase_ : List[str] = False lowerCAmelCase_ : Dict = False lowerCAmelCase_ : int = True for i in r...
103
'''simple docstring''' def __lowerCAmelCase (): return [list(range(1_000 - i , -1_000 - i , -1 ) ) for i in range(1_000 )] lowerCamelCase__ = generate_large_matrix() lowerCamelCase__ = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [...
234
0
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class _UpperCamelCase ( UpperCAmelCase__ ): '''simple docstri...
76
'''simple docstring''' from __future__ import annotations lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'MIT' lowerCamelCase__ = '1.0.0' lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'contact@muhammadumerfarooq.me' lowerCamelCase__ = '...
234
0
'''simple docstring''' import os import re import sys import traceback import warnings from pathlib import Path from typing import Dict, Optional, Union from uuid import uuida from huggingface_hub import HfFolder, ModelCard, ModelCardData, hf_hub_download, whoami from huggingface_hub.file_do...
251
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from tran...
234
0
'''simple docstring''' import json import os import unittest from transformers.models.roc_bert.tokenization_roc_bert import ( VOCAB_FILES_NAMES, RoCBertBasicTokenizer, RoCBertTokenizer, RoCBertWordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from tra...
254
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase = 50 ): _UpperCAmelCase : Tuple = [[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(...
234
0
from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent _A = {'''UserAgent''': UserAgent().random} def lowerCamelCase__ ( a__ : int ) -> str: UpperCamelCase_ = script.contents[0] Upper...
122
'''simple docstring''' import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def...
234
0
import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassificationWithTeacher, EfficientFormerImag...
325
'''simple docstring''' 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(__n...
234
0
"""simple docstring""" def UpperCamelCase_ ( lowerCAmelCase__ : Tuple ) -> str: """simple docstring""" assert column_title.isupper() lowerCAmelCase_ : Union[str, Any] = 0 lowerCAmelCase_ : List[str] = len(__lowerCAmelCase...
224
'''simple docstring''' import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel lowerCamelCase__ = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention....
234
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 : Optional[Any] = {"""configuration_mbar...
14
'''simple docstring''' import math def __lowerCAmelCase (__lowerCAmelCase ): return math.sqrt(__lowerCAmelCase ) * math.sqrt(__lowerCAmelCase ) == num def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : int = ...
234
0
'''simple docstring''' from ..utils import DummyObject, requires_backends class SCREAMING_SNAKE_CASE( metaclass=UpperCAmelCase__ ): """simple docstring""" lowerCamelCase__ = ["flax", "transformers"] def __init__( self : ...
23
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(...
234
0
import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __snake_case ( _UpperCAmelCase , _UpperCAmelCase ): assert isinstance(...
49
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCamelCase__ = {'UserAgent': UserAgent().random} def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAme...
234
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowerCAmelCase: int = logging.get_logger(__name__) lowerCAmelCase: int ...
297
'''simple docstring''' from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCamelCase__ = '\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Transl...
234
0
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging A__ : List[Any] = logging.get_logger(__name__) A...
103
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lo...
234
0
import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import evaluate import numpy as np from datasets import load_dataset import transformers from transformers import ( AutoConfig, AutoModelForSequenceClassification, AutoT...
76
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class lowerCAmelCase__ : def __init__( self : Union[str, Any] ) ->Union[str, Any]: '''simple docstring''' ...
234
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_tr...
251
'''simple docstring''' import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path....
234
0
'''simple docstring''' from __future__ import annotations import typing from collections.abc import Iterable import numpy as np _UpperCamelCase = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 _UpperCamelCase = typing.Union[np.floataa, int, float] # noqa: UP00...
254
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lowerCAmelCase (__lowerCAmel...
234
0
import datasets _A = '''\\n@InProceedings{conneau2018xnli,\n author = "Conneau, Alexis\n and Rinott, Ruty\n and Lample, Guillaume\n and Williams, Adina\n and Bowman, Samuel R.\n and Schwenk, Holger\n and Stoyano...
122
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassi...
234
0
from collections import OrderedDict from ...utils import logging from .auto_factory import _BaseAutoModelClass, _LazyAutoMapping, auto_class_update from .configuration_auto import CONFIG_MAPPING_NAMES SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE__ = OrderedDict( ...
325
'''simple docstring''' import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
234
0
"""simple docstring""" import numpy # List of input, output pairs lowercase__ : List[str] = ( ((5, 2, 3), 1_5), ((6, 5, 9), 2_5), ((1_1, 1_2, 1_3), 4_1), ((1, 1, 1), 8), ((1_1, 1_2, 1_3), 4_1), ) lowercase__ : Optional[int] = (((5_1_5, 2_2,...
224
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_...
234
0
import math def SCREAMING_SNAKE_CASE ( lowercase_ ) -> Union[str, Any]: """simple docstring""" return math.sqrt(__lowerCAmelCase ) * math.sqrt(__lowerCAmelCase ) == num def SCREAMING_SNAKE_CASE ( lowercase_ ) -> Optional[int]: ...
14
'''simple docstring''' # # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_nod...
234
0
'''simple docstring''' from ...utils import is_note_seq_available, is_transformers_available, is_torch_available from ...utils import OptionalDependencyNotAvailable try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() ...
23
'''simple docstring''' import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def __lowe...
234
0
import os import zipfile import pytest from datasets.utils.extract import ( BzipaExtractor, Extractor, GzipExtractor, LzaExtractor, SevenZipExtractor, TarExtractor, XzExtractor, ZipExtractor, ZstdExtractor, ) from .utils import require_lza, require_pyazr, require_zstandard ...
49
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) **...
234
0
'''simple docstring''' def lowerCamelCase__ ( _A = 1000 ): a : List[Any] = -1 a : Union[str, Any] = 0 for a in range(1 , n // 3 ): # Solving the two equations a**2+b**2=c**2 and a+b+c=N eliminating c a : str = (...
297
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { 'ut/deta': 'https://huggingface.co/ut/deta/resolve/main/conf...
234
0
import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def UpperCamelCase( __UpperCamelCase : List[str] ,__UpperCamelCase : List[Any] ,__UpperCamelCase : Union[str, Any] ,__UpperCamelCase : Dict ,__UpperCamelCase ...
103
'''simple docstring''' def __lowerCAmelCase (): return [list(range(1_000 - i , -1_000 - i , -1 ) ) for i in range(1_000 )] lowerCamelCase__ = generate_large_matrix() lowerCamelCase__ = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [...
234
0
import math def lowerCamelCase__ ( _a): SCREAMING_SNAKE_CASE : Tuple = 0 SCREAMING_SNAKE_CASE : Tuple = 0 while num > 0: SCREAMING_SNAKE_CASE : List[Any] = num % 8 SCREAMING_SNAKE_CASE : Optional[int] = octal + (remainder * math.floor...
76
'''simple docstring''' from __future__ import annotations lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'MIT' lowerCamelCase__ = '1.0.0' lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'contact@muhammadumerfarooq.me' lowerCamelCase__ = '...
234
0
'''simple docstring''' def lowercase__( __UpperCamelCase: List[Any] ,__UpperCamelCase: Tuple ): """simple docstring""" return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def lowercase__( __UpperCamelCase: str ,__UpperCamelCase: Any...
251
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from tran...
234
0
'''simple docstring''' from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCamelCase = logging.get_logger(__name__) _UpperCamelCase = { '''microsoft/xprophetnet-large-wiki100-cased''': ( '''h...
254
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase = 50 ): _UpperCAmelCase : Tuple = [[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(...
234
0
import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from transformers.utils import logging logging.set...
122
'''simple docstring''' import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def...
234
0
from collections import deque from math import floor from random import random from time import time class A__ : def __init__( self : Union[str, Any] ) -> Union[str, Any]: """simple docstring""" __lowercase = {} def a__ ( self : Dict ...
325
'''simple docstring''' 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(__n...
234
0
"""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 T...
224
'''simple docstring''' import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel lowerCamelCase__ = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention....
234
0
import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer _lowerCamelCase : Dict ...
14
'''simple docstring''' import math def __lowerCAmelCase (__lowerCAmelCase ): return math.sqrt(__lowerCAmelCase ) * math.sqrt(__lowerCAmelCase ) == num def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : int = ...
234
0
'''simple docstring''' import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () UpperCamelCase__: int = np.linspace(start=0, stop=75, num=75, endpoint=True, retstep=False) # Create two fuzzy...
23
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(...
234
0
from __future__ import annotations import math from collections import Counter from string import ascii_lowercase def __snake_case ( _UpperCAmelCase ): __a = analyze_text(__lowerCAmelCase ) __a = list(''' ''' + ascii_lowercase ) # what is our total sum...
49
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCamelCase__ = {'UserAgent': UserAgent().random} def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAme...
234
0
'''simple docstring''' import numpy as np from transformers import Pipeline def lowerCamelCase__ ( _A ): a : Dict = np.max(__lowerCAmelCase , axis=-1 , keepdims=__lowerCAmelCase ) a : Optional[Any] = np.exp(outputs - maxes ) return s...
297
'''simple docstring''' from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCamelCase__ = '\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Transl...
234
0
from binascii import hexlify from hashlib import shaaaa from os import urandom # RFC 3526 - More Modular Exponential (MODP) Diffie-Hellman groups for # Internet Key Exchange (IKE) https://tools.ietf.org/html/rfc3526 A__ : List[str] = { # 1536-bit 5: { '''prime''': int( '''...
103
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lo...
234
0
import requests from bsa import BeautifulSoup def lowerCamelCase__ ( _a = "AAPL"): SCREAMING_SNAKE_CASE : List[str] = f"https://in.finance.yahoo.com/quote/{symbol}?s={symbol}" SCREAMING_SNAKE_CASE : Optional[int] = BeautifulSoup(requests.get(__lowerCAmelCase).text ...
76
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class lowerCAmelCase__ : def __init__( self : Union[str, Any] ) ->Union[str, Any]: '''simple docstring''' ...
234
0
'''simple docstring''' import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...tes...
251
'''simple docstring''' import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path....
234
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCamelCase = logging.get_logger(__name__) _UpperCamelCase = { '''edbeeching/decision-transformer-gym-hopper-medium''': ( '''https://huggingface.co/edbeeching/decisio...
254
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lowerCAmelCase (__lowerCAmel...
234
0
def lowerCamelCase__ ( a__ : str ) -> List[Any]: # bit count represents no. of bits in the gray code if bit_count < 0: raise ValueError("""The given input must be positive""" ) # get the generated string sequence UpperCamelCase_ = gray_code_s...
122
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassi...
234
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer import RoFormerTokenizer from .tokenizat...
325
'''simple docstring''' import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
234
0
"""simple docstring""" import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging lowercase__ : List[str] ...
224
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_...
234
0
from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def SCREAMING_SNAKE_CASE ( lowercase_ = "laptop" ) -> str: """simple docstring""" A__ = f"""https://www.amazon.in/laptop/s?k={product}""" A__ ...
14
'''simple docstring''' # # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_nod...
234
0
'''simple docstring''' import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def snake_case_ ( _lowerCAmelCase : List[str] , _lowerCAmelCase :...
23
'''simple docstring''' import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def __lowe...
234
0
import torch def __snake_case ( ): if torch.cuda.is_available(): __a = torch.cuda.device_count() else: __a = 0 print(f'Successfully ran on {num_gpus} GPUs' ) if __name__ == "__main__": main()
49
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) **...
234
0
'''simple docstring''' def lowerCamelCase__ ( _A , _A ): _enforce_args(__lowerCAmelCase , __lowerCAmelCase ) if n == 0: return 0 a : Any = float('-inf' ) for i in range(1 , n + 1 ): a : str = max( __lowerCAmelCa...
297
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { 'ut/deta': 'https://huggingface.co/ut/deta/resolve/main/conf...
234
0
def UpperCamelCase( __UpperCamelCase : int = 10**12 ): lowerCAmelCase_ : int = 1 lowerCAmelCase_ : Union[str, Any] = 0 lowerCAmelCase_ : Tuple = 1 lowerCAmelCase_ : List[Any] = 1 while numerator <= 2 * min_total - 1: prev_numerator +...
103
'''simple docstring''' def __lowerCAmelCase (): return [list(range(1_000 - i , -1_000 - i , -1 ) ) for i in range(1_000 )] lowerCamelCase__ = generate_large_matrix() lowerCamelCase__ = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [...
234
0
def lowerCamelCase__ ( _a , _a): def get_matched_characters(_a , _a) -> str: SCREAMING_SNAKE_CASE : List[Any] = [] SCREAMING_SNAKE_CASE : List[Any] = min(len(_stra) , len(_stra)) // 2 for i, l in enumerate(_stra): SCREAMING_SNAKE_CASE : ...
76
'''simple docstring''' from __future__ import annotations lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'MIT' lowerCamelCase__ = '1.0.0' lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'contact@muhammadumerfarooq.me' lowerCamelCase__ = '...
234
0
'''simple docstring''' import argparse import torch from torch import nn from transformers import MBartConfig, MBartForConditionalGeneration def lowercase__( __UpperCamelCase: Tuple ): """simple docstring""" SCREAMING_SNAKE_CASE : Tuple = [ ...
251
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from tran...
234
0
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers import is_speech_available, is_vision_available from transformers.testing_utils import require_torch if is_vision_available(): from transformers import TvltImageProcessor...
254
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase = 50 ): _UpperCAmelCase : Tuple = [[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(...
234
0
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class lowercase_ ( UpperCAmelCase__ ): A__ : Any = DistilBertTokenizer A_...
122
'''simple docstring''' import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def...
234
0
def __SCREAMING_SNAKE_CASE ( ) -> Dict: return [list(range(1000 - i , -1000 - i , -1 ) ) for i in range(1000 )] SCREAMING_SNAKE_CASE__ = generate_large_matrix() SCREAMING_SNAKE_CASE__ = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [-1, -1, -2, ...
325
'''simple docstring''' 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(__n...
234
0
"""simple docstring""" lowercase__ : Optional[int] = [sum(int(c, 1_0) ** 2 for c in i.__str__()) for i in range(1_0_0_0_0_0)] def UpperCamelCase_ ( lowerCAmelCase__ : Any ) -> Any: """simple docstring""" lowerCAmelCase_ : str ...
224
'''simple docstring''' import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel lowerCamelCase__ = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention....
234
0
from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_images, to_numpy_array, vali...
14
'''simple docstring''' import math def __lowerCAmelCase (__lowerCAmelCase ): return math.sqrt(__lowerCAmelCase ) * math.sqrt(__lowerCAmelCase ) == num def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : int = ...
234
0
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_a...
23
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(...
234
0
class _A : def __init__( self : str , __SCREAMING_SNAKE_CASE : List[str] , __SCREAMING_SNAKE_CASE : Dict , __SCREAMING_SNAKE_CASE : int): '''simple docstring''' __a = None __a =...
49
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCamelCase__ = {'UserAgent': UserAgent().random} def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAme...
234
0
'''simple docstring''' from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_...
297
'''simple docstring''' from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCamelCase__ = '\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Transl...
234
0
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 A__ : List[str] = logging.get_logger(__name__) A__ : Union[str, Any] = '''▁''' A__...
103
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lo...
234
0
def lowerCamelCase__ ( _a , _a): SCREAMING_SNAKE_CASE : Tuple = len(__lowerCAmelCase) print("The following activities are selected:") # The first activity is always selected SCREAMING_SNAKE_CASE : Union[str, Any] = 0 print(__lowerCAmelCase , end=",") #...
76
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class lowerCAmelCase__ : def __init__( self : Union[str, Any] ) ->Union[str, Any]: '''simple docstring''' ...
234
0
'''simple docstring''' import os import pytest from transformers.dynamic_module_utils import get_imports UpperCamelCase_ = "\nimport os\n" UpperCamelCase_ = "\ndef foo():\n import os\n return False\n" UpperCamelCase_ = "\ndef foo():\n def ba...
251
'''simple docstring''' import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path....
234
0
'''simple docstring''' import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings.warn(e) ...
254
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lowerCAmelCase (__lowerCAmel...
234
0
import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def lowerCamelCase__ ( a__ : str ) -> Optional[Any]: def wrapper(*a__ : str , **a__ : Tuple ): UpperCamelCas...
122
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassi...
234
0
from typing import TYPE_CHECKING from ....utils import _LazyModule SCREAMING_SNAKE_CASE__ = {"""tokenization_tapex""": ["""TapexTokenizer"""]} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys SCREAMING_SNAKE_CASE__ = _LazyModule(__name__, ...
325
'''simple docstring''' import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
234
0
"""simple docstring""" import cva import numpy as np class UpperCamelCase__ : """simple docstring""" def __init__( self : Tuple , SCREAMING_SNAKE_CASE_ : float , SCREAMING_SNAKE_CASE_ : int ): ...
224
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_...
234
0
from PIL import Image def SCREAMING_SNAKE_CASE ( lowercase_ , lowercase_ ) -> Union[str, Any]: """simple docstring""" def brightness(lowercase_ ) -> float: return 128 + level + (c - 128) if not -255.0 <= level <= 255.0: rais...
14
'''simple docstring''' # # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_nod...
234
0
'''simple docstring''' import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import Mask...
23
'''simple docstring''' import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def __lowe...
234
0
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def __snake_case ( ): __a = ArgumentParser( description=( '''PyTorch TPU distributed training launch helper ...
49
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) **...
234
0
'''simple docstring''' from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, ChunkPipeline if is_vision_available(): from PIL import Image from ..image_utils impo...
297
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { 'ut/deta': 'https://huggingface.co/ut/deta/resolve/main/conf...
234
0
from sklearn.metrics import mean_squared_error import datasets A__ : List[str] = '''\\n@article{scikit-learn,\n title={Scikit-learn: Machine Learning in {P}ython},\n author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.\n and Thirion, B. and Grisel, O. and Blondel, M. and P...
103
'''simple docstring''' def __lowerCAmelCase (): return [list(range(1_000 - i , -1_000 - i , -1 ) ) for i in range(1_000 )] lowerCamelCase__ = generate_large_matrix() lowerCamelCase__ = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [...
234
0
import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension_format, to_pil_image from ...image_util...
76
'''simple docstring''' from __future__ import annotations lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'MIT' lowerCamelCase__ = '1.0.0' lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'contact@muhammadumerfarooq.me' lowerCamelCase__ = '...
234
0
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, ...
251
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from tran...
234
0
'''simple docstring''' import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils imp...
254
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase = 50 ): _UpperCAmelCase : Tuple = [[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(...
234
0
import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table import table_cast from datasets.utils.py_uti...
122
'''simple docstring''' import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def...
234
0
import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor SCREAMING_SNAKE_CASE__ = logging.get_logger(__name__) class A__ ( UpperCAmelCase__ ): def __init__( self : Optional[Any] , *_UpperCAmelCase : Optional[int] , **_UpperCAm...
325
'''simple docstring''' 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(__n...
234
0
"""simple docstring""" import inspect import unittest from transformers import YolosConfig 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...
224
'''simple docstring''' import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel lowerCamelCase__ = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention....
234
0
from typing import List, Optional, Union import numpy as np from ....audio_utils import mel_filter_bank, optimal_fft_length, spectrogram, window_function from ....feature_extraction_sequence_utils import SequenceFeatureExtractor from ....feature_extraction_utils import BatchFeature from ....file_utils import Pad...
14
'''simple docstring''' import math def __lowerCAmelCase (__lowerCAmelCase ): return math.sqrt(__lowerCAmelCase ) * math.sqrt(__lowerCAmelCase ) == num def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : int = ...
234
0
'''simple docstring''' import re from ..models.auto import AutoProcessor from ..models.vision_encoder_decoder import VisionEncoderDecoderModel from ..utils import is_vision_available from .base import PipelineTool if is_vision_available(): from PIL import Image class SCREAM...
23
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(...
234
0
import torch from diffusers import DDPMScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase_ ( __lowercase ): """simple docstring""" UpperCAmelCase__ : List[Any] = (DDPMScheduler,) def __lowercase ( sel...
235
from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class UpperCAmelCase_ : """simple docstring""" pass
235
1