code
stringlengths
82
53.2k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
"""simple docstring""" # This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keeping the # full ...
690
"""simple docstring""" import os import sys UpperCamelCase : Optional[int] = os.path.join(os.path.dirname(__file__), "src") sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, ...
690
1
def a_ (_lowerCAmelCase : list[int] )-> float: if not nums: # Makes sure that the list is not empty raise ValueError("""List is empty""" ) snake_case: Tuple = sum(_lowerCAmelCase ) / len(_lowerCAmelCase ) # Calculate the average return sum(abs(...
164
from __future__ import annotations def a_ (_lowerCAmelCase : int )-> list[int]: snake_case: List[str] = 2 snake_case: Dict = [] while i * i <= n: if n % i: i += 1 else: n //= i factors.append(_lowerCA...
164
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase : Any = { """configuration_clap""": [ """CLAP_PRETRAINED_MODEL_ARCHIVE_LIST""", """ClapAudioCo...
444
'''simple docstring''' from __future__ import annotations from math import gcd def lowercase (_A , _A = 2 , _A = 1 , _A = 3 , ): """simple docstring""" if num < 2: raise ValueError('The input value cann...
444
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) A = {"""configuration_beit""": ["""BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """BeitConfig""", "...
487
"""simple docstring""" from ...processing_utils import ProcessorMixin class a__ ( __magic_name__ ): lowercase_ = ["image_processor", "feature_extractor"] lowercase_ = "TvltImageProcessor" lowercase_ = "TvltFeatureExtractor" def __init__( self : Tuple , Up...
487
1
import os def UpperCAmelCase_ ( __UpperCAmelCase : str ) -> List[str]: SCREAMING_SNAKE_CASE_ = len(grid[0] ) SCREAMING_SNAKE_CASE_ = len(__UpperCAmelCase ) SCREAMING_SNAKE_CASE_ = 0 SCREAMING_SNAKE_CASE_ = 0 SCRE...
31
from __future__ import annotations from collections.abc import Iterator class lowerCamelCase_ : '''simple docstring''' def __init__( self : Union[str, Any] , _lowerCAmelCase : int ): SCREAMING_SNAKE_CASE_ = value SCREAMING_SNAKE_CASE_ ...
31
1
'''simple docstring''' from math import isclose, sqrt def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase , UpperCamelCase ) -> tuple[float, float, float]: lowerCamelCase__ : str = point_y / 4 / point_x lowerCamelCase_...
631
'''simple docstring''' from statistics import mean import numpy as np def SCREAMING_SNAKE_CASE_ (UpperCamelCase , UpperCamelCase , UpperCamelCase , UpperCamelCase ) -> list: lowerCamelCase__ : Optional[int] = 0 # ...
631
1
"""simple docstring""" from __future__ import annotations def A_ ( snake_case__ , snake_case__ = None , snake_case__ = None ) -> None: if start is None: _UpperCamelCase :Tuple = 0 if end is None: _UpperCamelCase :List[str] = ...
355
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mvp imp...
355
1
from math import sqrt def _UpperCamelCase ( lowerCAmelCase_ = 1_0_0_0_0_0_0 ) ->int: UpperCAmelCase = 0 UpperCAmelCase = 0 UpperCAmelCase = 42 while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_sides in range(2 , ...
627
from __future__ import annotations def _UpperCamelCase ( lowerCAmelCase_ ) ->None: create_state_space_tree(lowerCAmelCase_ , [] , 0 , [0 for i in range(len(lowerCAmelCase_ ) )] ) def _UpperCamelCase ( lowerCAmelCase_ , lowerCAmelCase_ , lowerCAm...
627
1
'''simple docstring''' from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. _SCREAMING_SNAKE_CASE = 2_00 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst...
18
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig snake_case = logging.get_logger(__name__) snake_case = { "Intel/dpt-large": "https://huggingface.co/Intel/dpt-large/resolve/main/config.json", # See all DPT models at http...
424
0
"""simple docstring""" from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline A__ : Any = logging.get_log...
272
"""simple docstring""" # Copyright (c) 2021-, NVIDIA CORPORATION. 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...
272
1
import re def a_ ( lowerCAmelCase_ : str ): return [char.split() for char in re.split(R'[^ a-z A-Z 0-9 \s]', str_ )] def a_ ( lowerCAmelCase_ : str ): __lowerCAmelCase = split_input(str_ ) return "".join( [''.join([char.c...
53
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTimestepEmbedding, ...
315
0
"""simple docstring""" from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_sta...
703
"""simple docstring""" from __future__ import annotations def lowerCamelCase__ ( _lowerCamelCase : float , _lowerCamelCase : float , _lowerCamelCase : float ) -> float: if days_between_payments <= 0: raise ValueError('days_between_payments m...
137
0
'''simple docstring''' from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerate...
199
'''simple docstring''' from math import factorial SCREAMING_SNAKE_CASE = {str(digit): factorial(digit) for digit in range(1_0)} def snake_case_ ( lowercase__ ): if not isinstance(lowercase__ , lowercase__ ): raise TypeError("Parameter number must be int" ) if number <...
199
1
"""simple docstring""" def snake_case__ ( _snake_case : str , _snake_case : str ): """simple docstring""" def get_matched_characters(_snake_case : str , _snake_case : str ) -> str: UpperCamelCase__ = [] ...
712
"""simple docstring""" import gc import random import unittest import numpy as np import torch from diffusers import DDIMScheduler, KandinskyVaaPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel from diffusers.utils import floats_tensor, load_numpy, slow, torch_device from diffuser...
304
0
import json import os import shutil import warnings from argparse import ArgumentParser, Namespace from pathlib import Path from typing import List from ..utils import logging from . import BaseTransformersCLICommand try: from cookiecutter.main import cookiecutter UpperCAmelCase__ : List[str] ...
410
import inspect import unittest from transformers import ConvNextConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_backbone_common import BackboneTesterMixin from ...test_...
463
0
import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class A ( __lowercase ): _snake_case =(IPNDMScheduler,) _snake_case =(('''num_inference_steps''', 50),) def lowerCA...
550
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_ut...
550
1
import os from distutils.util import strtobool def __magic_name__ ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> int: for e in env_keys: _lowercase : List[Any] = int(os.environ.get(SCREAMING_SNAKE_CASE , -1 ) ) if...
66
from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class lowerCAmelCase_ ( __snake_case ): _UpperCamelCase : str = ["image_processor", "tokenizer"] _UpperCamelCase : Union[str, Any] = "AutoImageProcesso...
66
1
"""simple docstring""" from statistics import mean, stdev def lowercase_ ( _snake_case ,_snake_case = 3 ): SCREAMING_SNAKE_CASE__ : Any = min(_snake_case ) SCREAMING_SNAKE_CASE__ : int = max(_snake_case ) # normalize data return [round((x -...
545
"""simple docstring""" import argparse import glob import logging import os import sys import time from collections import defaultdict from pathlib import Path from typing import Dict, List, Tuple import numpy as np import pytorch_lightning as pl import torch from callbacks import SeqaSeqLoggin...
545
1
from typing import Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_available(): from ..models....
663
'''simple docstring''' import unittest from transformers import ( MODEL_FOR_OBJECT_DETECTION_MAPPING, AutoFeatureExtractor, AutoModelForObjectDetection, ObjectDetectionPipeline, is_vision_available, pipeline, ) from transformers.testing_utils import ( is_pipeli...
459
0
import torch from torch import nn from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class lowerCAmelCase_ ( lowerCamelCase__ , lowerCamelCase__ ): '''simple docstring''' @register_to_config def __init__( self , *, _UpperCAmelCase = 4 ,...
715
import copy import re class lowerCAmelCase_ : '''simple docstring''' __snake_case = "hp" __snake_case = {} __snake_case = None @classmethod def UpperCamelCase__ ( cls , _UpperCAmelCase , _UpperCAmelCase ): snake_case_ = prefix snake_case_ = d...
531
0
def __magic_name__ ( SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE ) -> tuple[float, float]: # Check if the input is valid if not len(SCREAMING_SNAKE_CASE ) == len(SCREAMING_SNAKE_CASE ) == 3: raise ValueError('Please enter a valid equation.' ) i...
66
"""simple docstring""" import timeit import numpy as np import datasets from datasets.arrow_writer import ArrowWriter from datasets.features.features import _ArrayXD def lowercase ( lowerCAmelCase__ ): def wrapper(*lowerCAmelCase__ ,**lowerCAmelCase__ ): lowerCamelCase_ = timeit...
29
0
"""simple docstring""" import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup __A : Dict = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" " (KHTML, like Gecko) Chrome/70.0.3538.10...
95
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __A : Optional[int] = logging.get_logger(__name__) __A : Optional[...
95
1
from __future__ import annotations import bisect def a__ ( __UpperCamelCase , __UpperCamelCase , __UpperCamelCase = 0 , __UpperCamelCase = -1 ): if hi < 0: SCREAMING_SNAKE_CASE_ = len(__UpperCamelCase ) while lo < hi: SCREAMING_SNAKE_CASE_ = lo + (hi -...
140
import argparse import math import traceback import dateutil.parser as date_parser import requests def a__ ( __UpperCamelCase ): SCREAMING_SNAKE_CASE_ = {} SCREAMING_SNAKE_CASE_ = job["started_at"] SCREAMING_SNAKE_CASE_ = job["completed_at"] SCREAMING_SNAKE_CASE_ = date...
140
1
from __future__ import annotations from math import pi def _lowercase ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ) -> List[str]: if (inductance, frequency, reactance).count(0 ) != 1: raise ValueError("""One and only one argument must be 0...
718
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase__ : str ={'''configuration_fnet''': ['''FNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FNe...
269
0
from ...configuration_utils import PretrainedConfig from ...utils import logging __a : Any = logging.get_logger(__name__) __a : Any = { "tiiuae/falcon-40b": "https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json", "tiiuae/falcon-7b": "https://huggingface.co/tiiuae...
637
def _SCREAMING_SNAKE_CASE ( __lowercase : List[Any] ) -> Any: """simple docstring""" stooge(__lowercase , 0 , len(__lowercase ) - 1 ) return arr def _SCREAMING_SNAKE_CASE ( __lowercase : str , __lowercase : Dict...
637
1
from __future__ import annotations from random import choice def lowerCAmelCase (__UpperCamelCase : Optional[Any] ): """simple docstring""" return choice(__UpperCamelCase ) def lowerCAmelCase (__UpperCamelCase : list[int] , __UpperCamelCase ...
716
"""simple docstring""" import json import os import unittest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin ...
296
0
def lowercase ( __A : str , __A : str ) -> int: '''simple docstring''' if len(__A ) != len(__A ): raise ValueError("""String lengths must match!""" ) snake_case : List[Any] = 0 for chara, chara in zip(__A , __A ): if chara != ...
36
'''simple docstring''' from __future__ import annotations def __UpperCAmelCase ( lowerCamelCase_) -> bool: return len(set(lowerCamelCase_)) == len(lowerCamelCase_) if __name__ == "__main__": import doctest doctest.testmod()
596
0
'''simple docstring''' from typing import Dict, List, Optional, Tuple, Union import torch from ...models import AutoencoderKL, TransformeraDModel from ...schedulers import KarrasDiffusionSchedulers from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput ...
707
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _a : Optional[Any] = logging.get_logger(__name__) ...
10
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available lowerCAmelCase_ = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass else: lowerCAmelCas...
60
"""simple docstring""" import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import ( require_accelerate, require_torch, require_torch_gpu, require_vision, slow, torch_device, ) from transformers.utils import cached_property, is_torch_ava...
512
0
'''simple docstring''' import os import re import warnings from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer if TYPE_CHECKING: from ...tokenization_utils_base import TextInp...
715
'''simple docstring''' def __snake_case( _lowerCAmelCase ) -> list: snake_case__ : List[str] = int(_lowerCAmelCase ) if n_element < 1: snake_case__ : List[Any] = ValueError("""a should be a positive number""" ) raise my_error ...
301
0
def lowerCamelCase_ ( _lowercase ) -> int: # noqa: E741 __A : Dict = len(_lowercase ) __A : Tuple = 0 __A : int = [0] * n __A : int = [False] * n __A : Union[str, Any] = [False] * n def dfs(_...
520
import io import json import unittest from parameterized import parameterized from transformers import FSMTForConditionalGeneration, FSMTTokenizer from transformers.testing_utils import get_tests_dir, require_torch, slow, torch_device from utils import calculate_bleu UpperCamelCase = get_te...
520
1
import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class UpperCamelCase ( __lowerCamelCase ): a__ :Any = (IPNDMScheduler,) a__ :Union[str, Any] = (('''num_inference_steps''', 50),) ...
706
class UpperCamelCase : def __init__(self , __UpperCamelCase ) -> None: UpperCamelCase_ : Tuple = len(__UpperCamelCase ) UpperCamelCase_ : List[str] = [0] * len_array if len_array > 0: UpperCamelCase_...
138
0
'''simple docstring''' from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers import He...
640
'''simple docstring''' def __magic_name__ ( __UpperCAmelCase, __UpperCAmelCase ) -> int: '''simple docstring''' return int((input_a, input_a).count(0 ) == 0 ) def __magic_name__ ( ) -> None: '''simple docstring''' assert and_...
640
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin,...
13
'''simple docstring''' def __magic_name__ ( __UpperCAmelCase = 1 , __UpperCAmelCase = 1000 ) -> int: '''simple docstring''' __SCREAMING_SNAKE_CASE = 1 __SCREAMING_SNAKE_CASE = 0 for divide_by_number in range(__UpperCAm...
13
1
"""simple docstring""" from __future__ import annotations import os from collections.abc import Mapping lowercase_ : Any = tuple[int, int] class UpperCamelCase : def __init__( self , snake_case__ , snake_case__ ): """simple docstring""" _...
572
"""simple docstring""" from sklearn.metrics import matthews_corrcoef import datasets lowercase_ : Tuple = ''' Compute the Matthews correlation coefficient (MCC) The Matthews correlation coefficient is used in machine learning as a measure of the quality of binary and multiclass classif...
572
1
'''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, TrainingJobAnalytics ...
27
'''simple docstring''' from __future__ import annotations import math def lowerCamelCase ( lowerCamelCase : int): if num <= 0: A_ : List[Any] = F'{num}: Invalid input, please enter a positive integer.' raise ValueError(lowerCamelCase) ...
27
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { "uclanlp/visualbert-vqa": "https://huggingface.co/uclanlp/visualbert-vqa/resolve/main/config.json", "uclanlp/visualbert-vqa-pre": "https:/...
611
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase_ = logging.get_logger(__name__) UpperCamelCase_ = { "microsoft/wavlm-base": "https://huggingface.co/microsoft/wavlm-base/resolve/main/config.json", # See al...
611
1
'''simple docstring''' from abc import ABC, abstractmethod from argparse import ArgumentParser class a__ ( a__ ): '''simple docstring''' @staticmethod @abstractmethod def __SCREAMING_SNAKE_CASE ( lowerCamelC...
98
'''simple docstring''' import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transforme...
98
1
'''simple docstring''' import unittest from transformers import is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, require_torch, slow if is_flax_available(): import optax from flax.training.common_utils import onehot from tr...
94
'''simple docstring''' import collections import gzip import os import urllib import numpy from tensorflow.python.framework import dtypes, random_seed from tensorflow.python.platform import gfile from tensorflow.python.util.deprecation import deprecated __a: Tuple = collections.namedtuple("""_Datasets""", [...
152
0
'''simple docstring''' # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config...
704
import argparse from copy import deepcopy import numpy as np from datasets import ClassLabel, DatasetDict, load_dataset from evaluate import load from transformers import ( AutoModelForSequenceClassification, AutoTokenizer, DataCollatorWithPadding, Trainer, TrainerCallback, TrainingArgum...
421
0
'''simple docstring''' import argparse import torch from transformers import ( WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaForAudioFrameClassification, WavaVecaForSequenceClassification, WavaVecaForXVector, logging, ) logging.set_verbosity_info() UpperCAmelCase_ : List[An...
24
'''simple docstring''' import json from typing import Dict, List, Optional, Tuple, Union from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding, EncodedInput from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import PaddingS...
24
1
'''simple docstring''' import unittest import numpy as np def A_ ( SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ = None , ) ->np.ndarray: lowercase_ = np.shape(SCREAMING_SNAKE_CASE_ ) lowercase_ = np.shape(SCREAMING_SNAKE_CASE_...
603
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_d...
603
1
"""simple docstring""" import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration lowerCamelCase__ = 50_0000 lowerCamelCase__ , lowerCamelCase__ = os.path.split(__file__) lowerCamelCase__ = os.path.join(RESULTS_BASEP...
624
"""simple docstring""" import numpy as np def lowercase__ ( lowercase_ ,lowercase_ ,lowercase_ = 1e-12 ,lowercase_ = 100 ,) -> tuple[float, np.ndarray]: """simple docstring""" assert np.shape(lowercase_ )[0] == np.shape(lowercase_ )[1] # Ensure pr...
624
1
'''simple docstring''' import builtins import sys from ...utils.imports import _is_package_available from . import cursor, input from .helpers import Direction, clear_line, forceWrite, linebreak, move_cursor, reset_cursor, writeColor from .keymap import KEYMAP _lowerCAmelCase = False try: _lowerCAmel...
160
'''simple docstring''' import random import unittest import torch from diffusers import IFImgaImgSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_p...
160
1
from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common import C...
648
import unittest from transformers import BertGenerationConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import...
648
1
"""simple docstring""" import enum import shutil import sys UpperCAmelCase , UpperCAmelCase = shutil.get_terminal_size() UpperCAmelCase = {"""UP""": """A""", """DOWN""": """B""", """RIGHT""": """C""", """LEFT""": """D"""} class UpperCAmelCase_ ( enum.Enum): snake_case__...
342
"""simple docstring""" from typing import Tuple, Union from ...modeling_outputs import BackboneOutput from ...modeling_utils import PreTrainedModel from ...utils import is_timm_available, is_torch_available, requires_backends from ...utils.backbone_utils import BackboneMixin from .configuration_timm_backbone import T...
342
1
'''simple docstring''' import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin from .feature_extraction_wavaveca import WavaVecaFeatureExtractor from .tokenization_wavaveca import WavaVecaCTCTokenizer class __snake_case ( __SCREAMING_SNAKE_CASE )...
38
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowercase_ = { """configuration_falcon""": ["""FALCON_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FalconConfig"""], } try: if not is_torch_available(): raise OptionalDe...
74
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 __lowerCAmelCase (_UpperCam...
549
"""simple docstring""" from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class ...
549
1
'''simple docstring''' import unittest from transformers import ( MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING, Pipeline, ZeroShotClassificationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, nested_simplify, requ...
531
"""simple docstring""" import inspect import re from hashlib import shaaaa from typing import Dict, List from .arrow import arrow from .audiofolder import audiofolder from .csv import csv from .imagefolder import imagefolder from .json import json from .pandas import pandas from .parquet import parquet from .sql i...
506
0
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __lowerCamelCase :Any = { 'configuration_mctct': ['MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MCTCTConfig'], 'feature_extraction_mctct': ['MCTCTFeatureExtra...
701
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) __lowerCamelCase :List[str] = { 'configura...
42
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available snake_case_ = { '''configuration_pix2struct''': [ '''PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''Pix2StructConfig''', '''Pix2StructT...
164
from typing import Optional import numpy as np import torch from torch import nn from transformers import GPTaConfig, GPTaLMHeadModel from transformers.modeling_utils import ModuleUtilsMixin from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin class SCREAMING_SNAKE_...
164
1
'''simple docstring''' from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor lowerCamelCas...
265
'''simple docstring''' from typing import List, Optional, Tuple, Union import PIL import torch from torchvision import transforms from diffusers.pipeline_utils import DiffusionPipeline, ImagePipelineOutput from diffusers.schedulers import DDIMScheduler from diffusers.utils import randn_tensor lowerCamelCas...
265
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { 'google/switch-base-8': 'https://huggingface.co/google/switch-base-8/blob/main/config.json', } class _A ( _lowerCamelCa...
217
def UpperCamelCase_( _A :Union[str, Any] )-> List[str]: UpperCamelCase__ = [0] * len(_A ) UpperCamelCase__ = [] UpperCamelCase__ = [] UpperCamelCase__ = 0 for values in graph.values(): for i in values: indegree[i] += 1 for...
551
0
import os from itertools import chain from random import randrange, shuffle import pytest from .sola import PokerHand SCREAMING_SNAKE_CASE_ = ( """4S 3H 2C 7S 5H""", """9D 8H 2C 6S 7H""", """2D 6D 9D TH 7D""", """TC 8C 2S JH 6C""", """JH 8S TH AH QH""", """TS K...
116
import inspect import unittest from transformers import DecisionTransformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...te...
116
1
"""simple docstring""" _lowerCAmelCase : Any = '''Alexander Joslin''' import operator as op from .stack import Stack def lowerCamelCase_( _lowerCamelCase ) -> int: '''simple docstring''' _lowerCamelCase : int = {"*": op.mul, "/": op.truedi...
46
from typing import Optional from urllib.parse import quote import huggingface_hub as hfh from packaging import version def UpperCAmelCase_ (_lowerCAmelCase : str , _lowerCAmelCase : str , _lowerCAmelCase : Optional[str] = None ): if version.parse(hfh.__version__ ).release < versio...
327
0
"""simple docstring""" from abc import ABC, abstractmethod from typing import Optional, Union from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit from ..utils.typing import NestedDataStructureLike, PathLike class A__ ( _lowerCamelCase): def __init__( s...
721
"""simple docstring""" def __lowerCAmelCase (_UpperCamelCase ): if n_term == "": return [] __lowerCAmelCase : list = [] for temp in range(int(_UpperCamelCase ) ): series.append(F"1/{temp + 1}" if series else '1' ) return series if __name__ == "__main__": lowerCamelCase__ ...
549
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) lowerCAmelCase_ = { '''configuration_gpt_bigcode''': ['''GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTBigCodeConfig'''], } try: if not...
39
import warnings from ...utils import logging from .image_processing_chinese_clip import ChineseCLIPImageProcessor lowerCAmelCase_ = logging.get_logger(__name__) class snake_case_ ( __A ): '''simple docstring''' def __init__( self : Dic...
39
1
import heapq def _snake_case ( __snake_case ): _UpperCamelCase = [] # for each node and his adjacency list add them and the rank of the node to queue # using heapq module the queue will be filled like a Priority Queue # heapq works with a min priority queue, so I used -1*len(v) to b...
707
import logging import os import sys from dataclasses import dataclass, field from typing import Optional from seqaseq_trainer import SeqaSeqTrainer from seqaseq_training_args import SeqaSeqTrainingArguments import transformers from transformers import ( AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer, ...
71
0
from cva import destroyAllWindows, imread, imshow, waitKey def A_ ( a ): """simple docstring""" SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ : Tuple = img.shape[0], img.shape[1] # converting each pixel's color to its negative for i in range(a ): ...
511
from ...processing_utils import ProcessorMixin class _A ( __magic_name__): SCREAMING_SNAKE_CASE : Dict = '''SpeechT5FeatureExtractor''' SCREAMING_SNAKE_CASE : Optional[Any] = '''SpeechT5Tokenizer''' def __init__( self , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CA...
511
1
class a__ : def __init__( self : Union[str, Any] , lowerCamelCase_ : Optional[int] ): a_ : Optional[int] = arr.split(""",""" ) def UpperCAmelCase( self : List[Any] ): a_ : Union[str, Any] ...
713
import numpy as np __lowerCamelCase = [ ['''a''', '''b''', '''c''', '''d''', '''e'''], ['''f''', '''g''', '''h''', '''i''', '''k'''], ['''l''', '''m''', '''n''', '''o''', '''p'''], ['''q''', '''r''', '''s''', '''t''', '''u'''], ['''v''', '''w''', '''x''', '''y''', '''z'''], ] class ...
478
0
'''simple docstring''' from __future__ import annotations def lowerCamelCase (_SCREAMING_SNAKE_CASE : list ): if not nums: raise ValueError('List is empty' ) return sum(_SCREAMING_SNAKE_CASE ) / len(_SCREAMING_SNAKE_CASE ) if __name__ == "__main__": import doctest doctes...
476
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) __lowercase : List[str] = { 'configuration_convnext': ['CONVNEXT_PRETRAINED_CONFIG_ARCHIVE...
476
1
'''simple docstring''' from scipy.stats import spearmanr import datasets UpperCAmelCase : str = '\nThe Spearman rank-order correlation coefficient is a measure of the\nrelationship between two datasets. Like other correlation coefficients,\nthis one varies between -1 and +1 with 0 implying no corr...
714
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase : int = { 'configuration_pegasus_x': ['PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP', 'PegasusXConfig'], } try: if not is_torch_available()...
47
0
import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from transformers import GradientAccumulator,...
411
"""simple docstring""" import gc import unittest import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DDPMScheduler, PriorTransformer, StableUnCLIPPipeline, ...
49
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase = logging.get_logger(__name__) _lowercase = { """bigcode/gpt_bigcode-santacoder""": """https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json""", } ...
162
'''simple docstring''' from typing import TYPE_CHECKING from ..utils import _LazyModule _lowercase = { """config""": [ """EXTERNAL_DATA_FORMAT_SIZE_LIMIT""", """OnnxConfig""", """OnnxConfigWithPast""", """OnnxSeq2SeqConfigWithPast""", """PatchingSpec""", ...
162
1
import math def __magic_name__ ( lowercase_ ) -> Optional[int]: '''simple docstring''' UpperCamelCase = 0 UpperCamelCase = 0 while num > 0: UpperCamelCase = num % 8 UpperCamelCase = octal + (remainder...
606
import heapq as hq import math from collections.abc import Iterator class _UpperCAmelCase : """simple docstring""" def __init__( self : str, lowerCamelCase : List[Any] ): '''simple docstring''' lowercase__ = str(id_ ) lowercase__ = ...
183
0
"""simple docstring""" import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def lowercase__ ( snake_case_ :bytes , snake_case_ :int ): __UpperCAmelCase = F'''{sampling_rate}''' __UpperCAmelCase =...
717
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : List[Any] = logging.get_logger(__name__) _lowercase : Tuple = { 'microsoft/cvt-13': 'https://huggingface.co/microsoft/cvt-13/resolve/main/config...
397
0
from __future__ import annotations import unittest from transformers import AutoTokenizer, PegasusConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...test_configuration_comm...
360
def lowerCamelCase__ ( ): '''simple docstring''' UpperCAmelCase_ : Dict = 0 for i in range(1 , 1001 ): total += i**i return str(_lowercase )[-10:] if __name__ == "__main__": print(solution())
30
0
'''simple docstring''' from __future__ import annotations def __magic_name__( _A , _A = None , _A = None , _A = False , ): '''simple docstring''' UpperCamelCase__ = cipher_alphabet or [chr(_A ) for i in range(97 , 123 )]...
265
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PILIma...
265
1
import tempfile import numpy as np import torch from transformers import AutoTokenizer, TaEncoderModel from diffusers import DDPMScheduler, UNetaDConditionModel from diffusers.models.attention_processor import AttnAddedKVProcessor from diffusers.pipelines.deepfloyd_if import IFWatermarker from diffusers.utils.t...
202
import baseaa import io import json import os from copy import deepcopy from ..optimizer import AcceleratedOptimizer from ..scheduler import AcceleratedScheduler class a : def __init__( self , _lowerCAmelCase ): """simple docstring""" if isinstance(_lowerCAmel...
202
1
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_i...
700
"""simple docstring""" import argparse import requests import torch from PIL import Image from transformers import ViTMAEConfig, ViTMAEForPreTraining, ViTMAEImageProcessor def UpperCamelCase_ ( SCREAMING_SNAKE_CASE_ ): if "cls_token" in name: SCREAMING_SNAKE_CASE ...
406
0
def A_ ( a ): """simple docstring""" SCREAMING_SNAKE_CASE_ : Optional[int] = '' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def A_ ( a ): """simple docstring""" ...
511
import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": lowerCAmelCase : Optional[int] = argparse.ArgumentParser( description=( 'Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transfer Learned'...
511
1
"""simple docstring""" from ....configuration_utils import PretrainedConfig from ....utils import logging UpperCAmelCase_ : Dict = logging.get_logger(__name__) UpperCAmelCase_ : Tuple = { """speechbrain/m-ctc-t-large""": """https://huggingface.co/speechbrain/m-ctc...
700
"""simple docstring""" from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def _A () -> Union[str, Any]: """simple docstring""" SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ : Tuple = 9, 14 # noqa: F841 ...
176
0
'''simple docstring''' from __future__ import annotations from math import pi def _snake_case ( A , A , A ) -> dict[str, float]: if (inductance, frequency, reactance).count(0 ) != 1: raise ValueError('''One and only one argument must...
90
"""simple docstring""" import argparse import requests import torch from PIL import Image from transformers import SwinConfig, SwinForMaskedImageModeling, ViTImageProcessor def __snake_case ( SCREAMING_SNAKE_CASE__ : List[Any] ) -> List[Any]: '''simple docstring''' _UpperCA...
289
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _snake_case = { "configuration_time_series_transformer": [ "TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP", "TimeSeriesTransformerConfig", ], } try: ...
54
import json import os import shutil import tempfile from unittest import TestCase from transformers import BartTokenizer, BartTokenizerFast, DPRQuestionEncoderTokenizer, DPRQuestionEncoderTokenizerFast from transformers.models.bart.configuration_bart import BartConfig from transformers.models.bert.tokenization_be...
54
1
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...
249
# DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor fr...
249
1
def _lowercase ( ) -> Optional[Any]: '''simple docstring''' SCREAMING_SNAKE_CASE__ = 0 for i in range(1 , 1001 ): total += i**i return str(UpperCamelCase_ )[-10:] if __name__ == "__main__": print(solution())
400
from ...configuration_utils import PretrainedConfig from ...utils import logging __snake_case = logging.get_logger(__name__) __snake_case = { """s-JoL/Open-Llama-V1""": """https://huggingface.co/s-JoL/Open-Llama-V1/blob/main/config.json""", } class lowercase__ ( _UpperCAm...
400
1
"""simple docstring""" 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: Tupl...
607
def a__ ( snake_case__ : Tuple ): # noqa: E741 _UpperCAmelCase : Dict = len(snake_case__ ) _UpperCAmelCase : Tuple = 0 _UpperCAmelCase : Union[str, Any] = [0] * n _UpperCAmelCase : Union[str, Any] = [False] * n _U...
643
0
'''simple docstring''' from __future__ import annotations from random import random class _a : '''simple docstring''' def __init__( self, A = None ): '''simple docstring''' ...
717
'''simple docstring''' import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_...
508
0
import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency lowercase__ : str = { "E": 12.70, "T": 9.06, "A": 8.17, "O": 7.51, "I": 6.97, "N": 6.75, "S": 6.33, "H": 6.09, "R": 5.99, "D": 4.25, "L": 4.03, "...
376
"""simple docstring""" import unittest import numpy as np import torch from diffusers import KarrasVePipeline, KarrasVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class ...
259
0
from typing import List, Union import numpy as np from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image from ..image_utils import load_image if is_torch_av...
611
import collections import inspect import unittest from typing import Dict, List, Tuple from transformers import MaskFormerSwinConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, torch_device from transformers.utils import is_torch_available from ...test_backbone_common import B...
611
1
# A Bipartite Graph is a graph whose vertices can be divided into two independent sets, # U and V such that every edge (u, v) either connects a vertex from U to V or a vertex # from V to U. In other words, for every edge (u, v), either u belongs to U and v to V, # or u belongs to V and v to U. We can also say tha...
60
import unittest import numpy as np from datasets import load_dataset from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if ...
60
1
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_f...
586
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { "google/bigbird-roberta-base": "https://huggingface.c...
586
1
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def _lowercase ( __lowerCamelCase : Dataset ,__lowerCamelCase : Dict[str, str] ) -> Opt...
344
import argparse import json import os import re import torch from transformers import BloomConfig, BloomModel from transformers.file_utils import CONFIG_NAME, WEIGHTS_NAME from transformers.utils import logging logging.set_verbosity_info() _SCREAMING_SNAKE_CASE : str = [ """word_embeddings...
344
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging snake_case__ : List[Any] = logging.get_logger(__name__) snake_case_...
618
import unittest from transformers.testing_utils import require_bsa from transformers.utils import is_bsa_available from ...test_feature_extraction_common import FeatureExtractionSavingTestMixin if is_bsa_available(): from transformers import MarkupLMFeatureExtractor class _a ...
618
1
"""simple docstring""" import gc import tempfile import unittest import numpy as np import torch from diffusers import VersatileDiffusionPipeline from diffusers.utils.testing_utils import load_image, nightly, require_torch_gpu, torch_device snake_case : Optional[int] = False ...
545
'''simple docstring''' from math import isqrt def __lowercase (_SCREAMING_SNAKE_CASE :int ): return all(number % divisor != 0 for divisor in range(2 , isqrt(_SCREAMING_SNAKE_CASE ) + 1 ) ) def __lowercase (_SCREAMING_SNAKE_CASE :int = 10**6 ): SC...
507
0
'''simple docstring''' from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets __a = '\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding},\n author={Wang, Ale...
257
'''simple docstring''' def __UpperCAmelCase ( ): return 1 def __UpperCAmelCase ( a_: int ): return 0 if x < 0 else two_pence(x - 2 ) + one_pence() def __UpperCAmelCase ( a_: int ): return 0 if x < 0 else five_pence(x - 5 ) + two_p...
257
1
import webbrowser from sys import argv from urllib.parse import parse_qs, quote import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": lowerCAmelCase__ : Optional[int] ='%20'.join(argv[1:]) if len(argv) > 1 else quote(str(input('S...
101
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _A = { 'configuration_squeezebert': [ 'SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'SqueezeBertConf...
159
0
import math A = 1_0 A = 7 A = BALLS_PER_COLOUR * NUM_COLOURS def lowerCamelCase ( UpperCamelCase : Tuple = 20 ) -> str: _lowerCamelCase = math.comb(UpperCamelCase , UpperCamelCase ) _lowerCamelCase = math.comb(NUM_BA...
711
import unittest from transformers import MPNetConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, random_attention_mask from ...test_pipeline_m...
234
0
snake_case : Union[str, Any] = 8.31_44_62 # Unit - J mol-1 K-1 def SCREAMING_SNAKE_CASE ( UpperCAmelCase__ ,UpperCAmelCase__ ,UpperCAmelCase__ ): """simple docstring""" if moles < 0 or kelvin < 0 or volume < 0: raise ValueError('Invalid inputs. Enter ...
605
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple, Union import torch import torch.nn as nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, apply_forward_hook from .modeling_utils import ModelMixin from .vae import Decoder...
142
0
'''simple docstring''' from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseModelOutputWithNoAttention...
717
'''simple docstring''' import importlib import os import sys # This is required to make the module import works (when the python process is running from the root of the repo) sys.path.append(""".""") def SCREAMING_SNAKE_CASE__ ( snake_case : Dict ) -> Optional[Any]: ...
610
0
"""simple docstring""" from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __SCREAMING_SNAKE_CASE = {'configuration_van': ['VAN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'VanConfig']} try: if not is_torch_available(): ...
357
'''simple docstring''' import os import pickle import unittest from transformers import AutoTokenizer from transformers.models.bert.tokenization_bert import BertTokenizer from transformers.models.bert_japanese.tokenization_bert_japanese import ( VOCAB_FILES_NAMES, BertJapaneseTokenizer, ...
442
0
import os def lowerCamelCase__ (_UpperCAmelCase = "matrix.txt"): with open(os.path.join(os.path.dirname(_UpperCAmelCase) , _UpperCAmelCase)) as in_file: SCREAMING_SNAKE_CASE = in_file.read() SCREAMING_SNAKE_CASE = [[int(_UpperCAmelCase) for cell in row.split(',')] ...
444
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, ...
444
1
__lowercase : List[Any] ="""Alexander Joslin""" import operator as op from .stack import Stack def a__ ( lowercase__ ): '''simple docstring''' UpperCAmelCase_ ={"*": op.mul, "/": op.truediv, "+": op.add, "-": op.sub} UpperCAme...
54
'''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 MaskGenerationPipeline from ...
446
0
import os import tempfile import unittest import numpy as np from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax, slow if is_flax_available(): import jax import jax.numpy as jnp from flax.jax_utils import replicate from flax.training.common_utils import sh...
649
import logging import os import threading import time try: import warnings except ImportError: lowerCamelCase : Any = None try: import msvcrt except ImportError: lowerCamelCase : str = None try: import fcntl except ImportError: lowerCamelCase : Optional[Any] = ...
649
1
import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def __lowerCAmelCase ( __lowerCamelCase : str , __lowerCamelCase : int , __lowerCamelCase : Optional[Any] , __lowerCamelCase : Optional[...
354
"""simple docstring""" import numpy as np from nltk.translate import meteor_score import datasets from datasets.config import importlib_metadata, version A: Union[str, Any] = version.parse(importlib_metadata.version("nltk")) if NLTK_VERSION >= version.Version("3.6.4"): from nltk import word_...
160
0
'''simple docstring''' import os import re 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__ : Any = logging.get_logger(__name__...
329
'''simple docstring''' lowerCAmelCase__ : Any = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] lowerCAmelCase__ : int = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] lowerCAmelCase__ : List[Any] = { 0: "Sunday", 1: "Monday", 2: "Tuesday", 3: "Wednesday", 4: "Thursday", 5: "F...
329
1
import flax.linen as nn import jax import jax.numpy as jnp class __snake_case ( nn.Module ): """simple docstring""" __SCREAMING_SNAKE_CASE = 42 __SCREAMING_SNAKE_CASE = jnp.floataa def a ( self ) -> Union[s...
268
import sys from typing import Tuple import numpy as np import torch from PIL import Image from torch import nn from transformers.image_utils import PILImageResampling from utils import img_tensorize class __snake_case : """simple docstring""" def __init__( self ...
268
1
"""simple docstring""" import argparse import tensorflow as tf import torch from transformers import BertConfig, BertForMaskedLM from transformers.models.bert.modeling_bert import ( BertIntermediate, BertLayer, BertOutput, BertPooler, BertSelfAttention, BertSelfOutput, ) from transform...
222
"""simple docstring""" import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property fr...
222
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices SCREAMING_SNAKE_CASE = logging.get_logger(__name__) SCREAMING_SNAKE_CASE = { "microsoft/focalnet-tiny": "https...
579
import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS_CACHE, WEIGHTS_NAME, cached_file, get_fi...
579
1
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, FEATURE_EXTRACTOR_MAPPING, AutoConfig, AutoFeatureExtractor, WavaVecaConfig, WavaVecaFeatureExtractor, ) from transformers.testing_utils import D...
703
__a: List[Any] = tuple[float, float, float] __a: Optional[int] = tuple[float, float, float] def _SCREAMING_SNAKE_CASE ( __snake_case , __snake_case ) -> Vectorad: _UpperCAmelCase = end_pointa[0] - end_pointa[0] _UpperCAmelCase = ...
402
0