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
import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class lowerCamelCase( __snake_case ...
27
'''simple docstring''' # Copyright 2023 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
525
0
from __future__ import annotations def A__ ( SCREAMING_SNAKE_CASE__) -> int: if not nums: return 0 __snake_case: List[str] = nums[0] __snake_case: List[str] = 0 for num in nums[1:]: __snake_case: List[Any] = ( max_excluding + nu...
707
import argparse import torch from safetensors.torch import load_file from diffusers import StableDiffusionPipeline def A__ ( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__) ...
155
0
import pytest from datasets import inspect_metric, list_metrics, load_metric @pytest.fixture def UpperCAmelCase__ (UpperCamelCase_ ): """simple docstring""" monkeypatch.setattr('''datasets.utils.deprecation_utils._emitted_deprecation_warnings''' ,set() ) @p...
550
'''simple docstring''' import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( 'The `inpainting.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionInpaintPipeline` instead.' )
620
0
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import SegformerImageProcessor, SwinConfig, UperNetConfig, UperNetForSemanticSegmentation def a ( lowerCamelCase__ ): '''simple...
686
'''simple docstring''' import pytest lowerCamelCase :Optional[Any] = '''__dummy_dataset1__''' lowerCamelCase :List[Any] = ''' import json import os import datasets REPO_URL = "https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/" URLS = ...
686
1
"""simple docstring""" import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow...
465
from ...configuration_utils import PretrainedConfig from ...utils import logging __magic_name__ = logging.get_logger(__name__) class lowerCAmelCase__ ( __lowerCamelCase ): """simple docstring""" __UpperCAmelCase : Optional[int] = '''tim...
250
0
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { """google/realm-cc-news-pretrained-embedder""": ( """https://huggingface.co/google/realm-cc-news-pretrained-embedder/res...
716
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): import torch ...
131
0
import math from enum import Enum from typing import Optional, Union from torch.optim import Optimizer from torch.optim.lr_scheduler import LambdaLR from .utils import logging snake_case : Optional[int] = logging.get_logger(__name__) class _snake_case ( snake_case__ ): SC...
445
'''simple docstring''' import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCS...
244
0
'''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_convbert import ConvBertTokenizer _lowercase : Optional[Any] = logging.get_lo...
720
'''simple docstring''' from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowercase = logging.get_logger(__name__) _lowercase = { """sail/poo...
427
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available a = { """configuration_gpt_neo""": ["""GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTNeoConfig""", """GPTNeoOnnxConfig"""], } try: if not i...
687
import collections import inspect import unittest from transformers import FocalNetConfig 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 Backb...
687
1
'''simple docstring''' from __future__ import annotations from fractions import Fraction def __lowerCamelCase ( _UpperCamelCase : int , _UpperCamelCase : int ): '''simple docstring''' return ( num != den and num % 10 == den // 10 and (num // 10) / (den % 10) ==...
43
'''simple docstring''' import re def __lowerCamelCase ( _UpperCamelCase : str ): '''simple docstring''' return [char.split() for char in re.split(R'''[^ a-z A-Z 0-9 \s]''' , str_ )] def __lowerCamelCase ( _UpperCamelCase : str ): '''simple d...
43
1
from __future__ import annotations import numpy as np from numpy import floataa from numpy.typing import NDArray def lowercase_ ( _UpperCamelCase , _UpperCamelCase , _UpperCamelCase , _UpperCamelCase , ): '''simple docstring''' __lowercase , __...
639
'''simple docstring''' from __future__ import annotations from collections.abc import Callable from typing import Any, Generic, TypeVar lowercase_ = TypeVar("""T""") class a_ ( Generic[T] ): '''simple docstring''' def __init__( self , A , A ) ...
314
0
"""simple docstring""" import os def _lowerCamelCase( ): __a = os.path.dirname(os.path.realpath(a ) ) __a = os.path.join(a , "triangle.txt" ) with open(a ) as f: __a = f.readlines() __a = [] ...
67
"""simple docstring""" import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class snake_case__ ( snake_case_ ): def a__ ( self , lowerCamelCase ): with open(lowerCamelCase , encoding="utf-8" ) as input_file: ...
67
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available snake_case = { """configuration_jukebox""": [ """JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP""", """JukeboxConfig""", """JukeboxPriorConfig""", """Jukeb...
62
'''simple docstring''' from math import isqrt, loga def __UpperCamelCase ( lowercase_ : int ): """simple docstring""" a_ = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: ...
536
0
def lowerCamelCase( a__): if len(a__) <= 1: return [tuple(a__)] _SCREAMING_SNAKE_CASE =[] def generate(a__ ,a__): if k == 1: res.append(tuple(arr[:])) return generate(k - 1 ,a__) for i in range(k - 1): if k % 2 == 0: # ...
191
import string from math import logaa def lowerCamelCase( a__ ,a__): _SCREAMING_SNAKE_CASE =document.translate( str.maketrans('''''' ,'''''' ,string.punctuation)).replace('''\n''' ,'''''') _SCREAMING_SNAKE_CASE =document_without_punctuation.split(''' ''') # word tokenization ...
191
1
'''simple docstring''' import random import unittest from torch.utils.data import BatchSampler, DataLoader, IterableDataset from accelerate import Accelerator from accelerate.data_loader import ( BatchSamplerShard, DataLoaderDispatcher, DataLoaderShard, IterableDatasetShar...
90
import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, PLBartTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ) from ...test_tokenization_common impor...
336
0
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start_docstring...
701
def _UpperCAmelCase (UpperCamelCase_ : int ): '''simple docstring''' _lowerCAmelCase : int = n ** (1 / 3) return (val * val * val) == n if __name__ == "__main__": print(perfect_cube(2_7)) print(perfect_cube(4))
196
0
def _a ( __UpperCamelCase : int = 50 ): lowerCAmelCase__ : int = [1] * (length + 1) for row_length in range(length + 1 ): for tile_length in range(2 ,5 ): for tile_start in range(row_length - tile_length + 1 ): ways_number[row_length] +=...
233
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging A__ : Dict = logging.get_logger(__name__) A__ : Optional[Any] = { """facebook/xmod-base""": """https://h...
233
1
from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_available(): ...
700
# # 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_node 2 --nnodes 1 torch-distributed-gpu-te...
405
0
import re from filelock import FileLock try: import nltk __lowerCamelCase : List[str] = True except (ImportError, ModuleNotFoundError): __lowerCamelCase : int = False if NLTK_AVAILABLE: with FileLock(".lock") as lock: nltk.download("punkt", quiet=True) def lowerCamelCase_(...
323
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_tf_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_tf_available(): import tensorflow as tf __A = logging.get_logger(__name__) @dataclass class ...
68
0
'''simple docstring''' from __future__ import annotations import string from itertools import cycle, product from pathlib import Path snake_case_ = ( string.ascii_letters + string.digits + string.punctuation + string.whitespace ) snake_case_ = [ord(letter) for letter in string.ascii_lowercase]...
537
'''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 ...test_tokenizat...
537
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) _a : Tuple = { 'configuration_convbert': ['CONVBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
598
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available __snake_case = { '''configuration_gpt_neo''': ['''GPT_NEO_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''GPTNeoConfig''', '''GPTNeoOnnxConfig'''], } try: ...
189
0
from typing import List, Optional, Union import numpy as np import PIL import torch from PIL import Image from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils im...
597
import argparse import dataclasses import json import logging import os import shutil from typing import List, Optional import datasets from accelerate import Accelerator from datasets import load_dataset from finetuning import finetune from tqdm.auto import tqdm import transformers from transformers import AutoConf...
597
1
def A__ ( lowercase: str, lowercase: str ) -> bool: A : Optional[Any] =len(lowercase ) A : str =len(lowercase ) A : Any =[[False for _ in range(m + 1 )] for _ in range(n + 1 )] A : List[Any] =True ...
305
def A__ ( lowercase: str ) -> str: if not all(char in '01' for char in bin_string ): raise ValueError('Non-binary value was passed to the function' ) if not bin_string: raise ValueError('Empty string was passed to the function' ) A...
305
1
import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class lowerCamelCase_ ( ...
717
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModel, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import AutoencoderKL, DDIMScheduler, DDPMScheduler, StableUnCLI...
452
0
import functools import logging import os import sys import threading from logging import ( CRITICAL, # NOQA DEBUG, # NOQA ERROR, # NOQA FATAL, # NOQA INFO, # NOQA NOTSET, # NOQA WARN, # NOQA WARNING, # NOQA ) from typing import Optional import huggingface_hub.utils as hf_hub_...
164
from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging snake_case_ = logging.get_logger(__name__) snake_case_ = { '''google/umt5-small''': '''https://huggingface.co/google/umt5-small/reso...
164
1
"""simple docstring""" from __future__ import annotations def A ( snake_case__ , snake_case__ = None , snake_case__ = None ): '''simple docstring''' if start is None: SCREAMING_SNAKE_CASE__ = 0 if end is None: SCREAMING_SNAKE_CASE...
616
"""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 A_ : Optional[int] = logging.get_logger...
616
1
import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import SegformerImageProcessor, SwinConfig, UperNetConfig, UperNetForSemanticSegmentation def snake_case__ ( SCREAMING_SNAKE_CASE_ : List[str] ...
164
from __future__ import annotations from typing import Any class SCREAMING_SNAKE_CASE__ : def __init__( self , a = 6): lowercase__ : Node | None = None lowercase__ : Node | None = None self.create_linked_list(a) def snake_case_ ( self , a)...
164
1
from cva import destroyAllWindows, imread, imshow, waitKey def A ( lowercase ) -> str: '''simple docstring''' UpperCamelCase , UpperCamelCase = img.shape[0], img.shape[1] # converting each pixel's color to its negative for i in range(lowercase ): for j in range(lower...
3
from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets _UpperCAmelCase : Any = "\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding},\n author={Wang, Alex and ...
3
1
import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from transformers.utils import ...
183
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
1
import inspect import unittest from datasets import load_dataset from packaging import version from transformers import BeitConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformer...
647
from __future__ import annotations from collections.abc import Iterator from typing import Generic, TypeVar _lowerCamelCase : Optional[Any] = TypeVar('''T''') class lowercase ( Generic[T] ): def __init__( self : Any , _UpperCamelCase : T ...
647
1
from sklearn.metrics import fa_score import datasets A : Dict = ''' The F1 score is the harmonic mean of the precision and recall. It can be computed with the equation: F1 = 2 * (precision * recall) / (precision + recall) ''' A : Tuple = ''' Args: predictions (`list` of `int`): Predict...
287
from sklearn.metrics import mean_squared_error import datasets A : List[Any] = '''\ @article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. and Thirion, B. and Grisel, O. and Blondel, M. and Prettenhofe...
287
1
"""simple docstring""" import inspect import re from transformers.utils import direct_transformers_import # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_config_docstrings.py UpperCamelCase_ = 'src/transformers' # This...
720
"""simple docstring""" from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import pyarrow as pa if TYPE_CHECKING: from .features import FeatureType @dataclass class snake_case : a_ : List[str] a_ : Optional[s...
210
0
from ...configuration_utils import PretrainedConfig from ...utils import logging a__ = logging.get_logger(__name__) a__ = { '''funnel-transformer/small''': '''https://huggingface.co/funnel-transformer/small/resolve/main/config.json''', '''funnel-transformer/small-b...
14
'''simple docstring''' import socket def __snake_case ( ): snake_case_ = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) snake_case_ = socket.gethostname() snake_case_ = 12_312 sock.connect((host, port) ) sock.send(b"Hello server!" ) with ope...
508
0
import torch from diffusers import DPMSolverSDEScheduler from diffusers.utils import torch_device from diffusers.utils.testing_utils import require_torchsde from .test_schedulers import SchedulerCommonTest @require_torchsde class __snake_case ( snake_case__ ): """simple docstring""" UpperCame...
683
class __snake_case : """simple docstring""" def __init__( self : Optional[int] ,lowerCAmelCase__ : str = "" ,lowerCAmelCase__ : bool = False ) -> None: '''simple docstring''' lowerCAmelCase_ : dict[str, RadixNode] = {} ...
683
1
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from ...test_mo...
39
from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, slow from ..t...
39
1
import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from_submodules, ) from accelerate.test_utils import require...
450
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase_ ( A ): '''simple docstring''' a__ = ['''image_processor''', '''tokenizer'''] a__ = '''ViTImageProcessor'''...
450
1
import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING SCREAMING_SNAKE_CASE :Optional[Any] = { """facebook/mask2former-swin-small-coco-instance""": ( """https://huggingf...
628
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) SCREAMING_SNAKE_CASE :Optional[int] = { """configuration_rembert""": ...
628
1
import os def lowerCamelCase__ ( ) -> Union[str, Any]: '''simple docstring''' with open(os.path.dirname(UpperCamelCase__ ) + '/p022_names.txt' ) as file: _snake_case = str(file.readlines()[0] ) _snake_case = names.repla...
541
import json import os import shutil import tempfile import unittest from multiprocessing import get_context from pathlib import Path import datasets import numpy as np from datasets import load_dataset from parameterized import parameterized from transformers import AutoProcessor from transformers.models.wavave...
541
1
import os import tempfile import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch if is_torch_available(): import torch from torch import nn from transformers import ( Adafactor, AdamW, ...
47
import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import version fr...
47
1
"""simple docstring""" # this script reports modified .py files under the desired list of top-level sub-dirs passed as a list of arguments, e.g.: # python ./utils/get_modified_files.py utils src tests examples # # it uses git to find the forking point and which files were modified - i.e. files...
404
"""simple docstring""" def snake_case ( lowerCAmelCase_ ) -> None: _snake_case = generate_pascal_triangle(lowerCAmelCase_ ) for row_idx in range(lowerCAmelCase_ ): # Print left spaces for _ in range(num_rows - row_idx - 1 ): print(end=''' ''' ) # P...
404
1
import os # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_doctest_list.py _UpperCamelCase : Optional[int] ='.' if __name__ == "__main__": _UpperCamelCase : List[str] =os.path.join(REPO_PATH, 'uti...
206
import warnings warnings.warn( 'memory_utils has been reorganized to utils.memory. Import `find_executable_batchsize` from the main `__init__`: ' '`from accelerate import find_executable_batch_size` to avoid this warning.', FutureWarning, )
206
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging a : List[str] = logging.get_logger(__name__) a : Optional[Any] = { """caidas/swin2sr-classicalsr-x2-64""": ( """https://huggingface.co/caidas/swin2sr...
672
'''simple docstring''' from sklearn.metrics import mean_squared_error import datasets a : Union[str, Any] = """\ @article{scikit-learn, title={Scikit-learn: Machine Learning in {P}ython}, author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V. and Thirion, B. ...
672
1
def lowerCAmelCase_ ( lowerCamelCase , lowerCamelCase ): print("""\nThe shortest path matrix using Floyd Warshall algorithm\n""" ) for i in range(lowerCamelCase ): for j in range(lowerCamelCase ): if dist[i][j] != float("""inf""" ): print(int(dist[...
21
'''simple docstring''' import os def __UpperCAmelCase ( SCREAMING_SNAKE_CASE__: str = "matrix.txt" ) -> int: """simple docstring""" with open(os.path.join(os.path.dirname(SCREAMING_SNAKE_CASE__ ), SCREAMING_SNAKE_CASE__ ) ) as in_file: ...
448
0
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class SC...
703
'''simple docstring''' from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=A__ ) class SCREAMING_SNAKE_CASE( A__ ): """simple docstring""" ...
528
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from dif...
238
"""simple docstring""" import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup lowerCamelCase__ : List[str] = { '''User-Agent''': '''Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36''' ''' (KHTML, like Ge...
238
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tensorflow_text_available, is_tf_available, is_tokenizers_available, is_torch_available, ) snake_case ...
404
"""simple docstring""" def snake_case ( ) -> Tuple: _snake_case = 0 for i in range(1 , 1001 ): total += i**i return str(lowerCAmelCase_ )[-10:] if __name__ == "__main__": print(solution())
404
1
'''simple docstring''' import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test...
42
"""simple docstring""" import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def _A ( __lowercase , __lowercase=None ): """simple docstring""" lowerCamelCase__ = No...
129
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) snake_case = { 'configuration_perceiver': ['PERCEIVER_PRETRAINED_CONFI...
406
"""simple docstring""" import unittest from transformers import BertGenerationTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin sna...
406
1
"""simple docstring""" import requests from bsa import BeautifulSoup def __magic_name__ ( __snake_case : str = "https://www.worldometers.info/coronavirus" ) -> dict: lowercase : str = BeautifulSoup(requests.get(__snake_case ).text , "h...
361
"""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 _A : str = False try...
361
1
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class _lowerCAmelCase : '''simple docstring''' a_ : int a_ : TreeNode | None =None a_ : TreeNode | None =None lower...
669
def lowerCamelCase_ ( lowerCAmelCase: bytes )-> str: return "".join([hex(lowerCAmelCase )[2:].zfill(2 ).upper() for byte in list(lowerCAmelCase )] ) def lowerCamelCase_ ( lowerCAmelCase: str )-> bytes: # Check data validity, following RFC3548 # https://www.ietf.org/rf...
669
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow if is_tf_available(): import numpy as np import tensorflow as tf from t...
334
'''simple docstring''' __A : List[Any] = { 0: '0', 1: '1', 2: '2', 3: '3', 4: '4', 5: '5', 6: '6', 7: '7', 8: '8', 9: '9', 10: 'a', 11: 'b', 12: 'c', 13: 'd', 14: 'e', 15: 'f', } def UpperCAmelCase ( lowerCamelCase_ :float ...
334
1
def __UpperCamelCase ( _A : Any ) ->Any: """simple docstring""" assert isinstance(UpperCamelCase__ , UpperCamelCase__ ), f'The input value of [n={number}] is not an integer' if number == 1: return 2 elif number < 1: lowerCame...
719
from collections import namedtuple import requests from lxml import html # type: ignore __A : Dict = namedtuple('covid_data', 'cases deaths recovered') def __UpperCamelCase ( _A : str = "https://www.worldometers.info/coronavirus/" ) ->covid_data: """simple docstrin...
75
0
'''simple docstring''' 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.t...
28
'''simple docstring''' from typing import Dict from .base import GenericTensor, Pipeline class _a ( SCREAMING_SNAKE_CASE ): '''simple docstring''' def UpperCamelCase_ ( self, A=None, A=None, A=None, ...
28
1
def lowerCAmelCase__ ( UpperCamelCase_ : Optional[int] , UpperCamelCase_ : List[str] , UpperCamelCase_ : List[Any] , UpperCamelCase_ : str )-> int: if height >= 1: move_tower(height - 1 , UpperCamelCase_ , UpperCamelCase_ , ...
526
import argparse import os # New Code # import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import A...
526
1
from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...utils import add_start_docstrings, add_start_docstrings...
175
import tempfile import unittest from transformers import TaConfig, is_torch_available from transformers.testing_utils import ( require_sentencepiece, require_tokenizers, require_torch, slow, torch_device, ) from ...generation.test_utils import GenerationTesterMixin from ...test_modeling_common...
175
1
import argparse import json import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( VideoMAEConfig, VideoMAEForPreTraining, VideoMAEForVideoClassification, VideoMAEImageProcessor, ) def A(__a: str ): lowerCAmelCase_ = ...
701
import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class __magic_name__ (__lowercase ): lowerCamelCase__ = '''''' lowerCamelCase__ = ( None # protocol passed in prefix to the ur...
226
0
"""simple docstring""" from torch import nn def UpperCAmelCase ( _lowercase : List[Any] ) -> str: """simple docstring""" if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU() els...
552
"""simple docstring""" import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def UpperCAmelCase ( _lowercase : Union[str, Any] ) -> Union[str, Any]: """simple docstring""" lowerCAmelCa...
552
1
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @require_torch class...
664
from __future__ import annotations def UpperCAmelCase__ ( _SCREAMING_SNAKE_CASE : list )->list: if len(_SCREAMING_SNAKE_CASE ) == 0: return [] _lowerCAmelCase , _lowerCAmelCase = min(_SCREAMING_SNAKE_CASE ), max(_SCREAMING_SNAKE_CASE ) _lowerCAmelCase ...
664
1
"""simple docstring""" from math import isqrt, loga def UpperCamelCase ( SCREAMING_SNAKE_CASE_ ) ->list[int]: _lowerCamelCase : Dict = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 ...
434
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available, ) SCREAMING_SNAKE_CASE__ : Dict ={ 'configuration_perceiver': ['PERCEIVER_PRE...
434
1
"""simple docstring""" import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configura...
24
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowercase = logging.get_logger(__name__) low...
24
1
"""simple docstring""" import numpy as np from transformers import BatchFeature from transformers.testing_utils import require_tf, require_torch from .test_feature_extraction_common import FeatureExtractionSavingTestMixin class _UpperCAmelCase ( _lowerCAmelCase ): # to overwrit...
49
"""simple docstring""" class lowerCAmelCase__ : '''simple docstring''' def __init__( self : int , lowercase_ : List[str] , lowercase_ : str , lowercase_ : Tuple): '''simple docstring''' SCREAMING_SNAKE_CASE_ : Optional...
512
0
import uuid from typing import Any, Dict, List, Optional, Union from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf if is_torch_available(): import torch __magic_name__ = ...
714
"""simple docstring""" __magic_name__ = "\n# Installazione di Transformers\n! pip install transformers datasets\n# Per installare dalla fonte invece dell'ultima versione rilasciata, commenta il comando sopra e\n# rimuovi la modalità commento al comando seguente.\n# ! pip install git+https://github.com/huggingf...
248
0
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaImgaImgPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_numpy, slow, tor...
85
def _a ( lowercase__ : int = 60_08_51_47_51_43 ): '''simple docstring''' try: SCREAMING_SNAKE_CASE__ : Dict = int(lowercase__ ) except (TypeError, ValueError): raise TypeError('Parameter n must be int or castable to int.' ) if n <= 0: ...
85
1
'''simple docstring''' import os import zipfile import pytest from datasets.utils.extract import ( BzipaExtractor, Extractor, GzipExtractor, LzaExtractor, SevenZipExtractor, TarExtractor, XzExtractor, ZipExtractor, ZstdExtractor, ) from .utils...
338
'''simple docstring''' def _lowerCAmelCase ( __snake_case : Union[str, Any] , __snake_case : Tuple ) -> Union[str, Any]: __A : Tuple = [0 for i in range(r + 1 )] # nc0 = 1 __A : Dict = 1 for i in range(1 , ...
338
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available, is_vision_available, ) lowerCamelCase = {"""configuration_beit""": ["""BEIT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """...
474
'''simple docstring''' from collections.abc import Sequence def _A ( _lowerCAmelCase = None ): """simple docstring""" if nums is None or not nums: raise ValueError('Input sequence should not be empty' ) __lowercase =nums[0] for i ...
474
1
import json import logging import math import os import sys from dataclasses import dataclass, field from typing import Optional from datasets import Dataset, load_dataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_FOR_MASKED_LM_MAPPING, AutoConfig, AutoModelForMaskedLM, ...
546
import unittest from typing import Tuple import torch from diffusers.utils import floats_tensor, randn_tensor, torch_all_close, torch_device from diffusers.utils.testing_utils import require_torch @require_torch class _UpperCamelCase : """simple docstring""" @property def _U...
546
1
"""simple docstring""" def __lowerCAmelCase ( lowercase : dict ) -> set: """simple docstring""" snake_case : int = set() # edges = list of graph's edges snake_case : Optional[Any] = get_edges(a_ ) # While there are still elements ...
178
'''simple docstring''' def snake_case ( a_ : list[int] , a_ : list[int] ) -> tuple[float, float]: """simple docstring""" if not len(a_ ) == len(a_ ) == 3: raise ValueError("""Please enter a valid equation.""" ) if equatio...
208
0
import argparse import json import logging import os import shutil import sys import tempfile import unittest from unittest import mock import torch from accelerate.utils import write_basic_config from transformers.testing_utils import TestCasePlus, get_gpu_count, run_command, slow, torch_device from transformers.uti...
702
from abc import ABC, abstractmethod from argparse import ArgumentParser class lowerCamelCase__ ( UpperCAmelCase ): @staticmethod @abstractmethod def SCREAMING_SNAKE_CASE__ ( lowercase__ : ArgumentParser ): raise NotImplementedError() @abstractmethod...
225
0
"""simple docstring""" UpperCamelCase_ : Tuple = ''' # Installazione di Transformers ! pip install transformers datasets # Per installare dalla fonte invece dell\'ultima versione rilasciata, commenta il comando sopra e # rimuovi la modalità commento al comando seguente. # ! pip install git+h...
115
"""simple docstring""" import importlib import math import os from dataclasses import dataclass from enum import Enum from typing import Any, Dict, Optional, Tuple, Union import flax import jax.numpy as jnp from ..utils import BaseOutput __lowerCAmelCase : Tuple ...
58
0
'''simple docstring''' import inspect import unittest from transformers import RegNetConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...test_configuration_common imp...
720
'''simple docstring''' import json import os from typing import Dict, List, Optional, Tuple import regex as re from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging lowerCAmelCase__ : List[str] = logging.get_logger(__name__) lowerCAmelCase__ : Dict = { ...
329
0
'''simple docstring''' import unittest import numpy as np import torch from diffusers import PNDMPipeline, PNDMScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class SCREA...
442
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import BatchEncoding, MarianTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import is_sentencepiece_ava...
442
1
import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor UpperCAmelCase__ : Dict = logging.get_logger(__name__) class __lowercase ( lowerCamelCase__ ): def __init__( self , *low...
711
import numpy as np def A ( snake_case__ : np.ndarray ) -> np.ndarray: '''simple docstring''' return 1 / (1 + np.exp(-vector )) def A ( snake_case__ : np.ndarray ) -> np.ndarray: '''simple docstring''' return vector * sigmoid(s...
676
0
'''simple docstring''' import math import numpy as np import qiskit from qiskit import Aer, ClassicalRegister, QuantumCircuit, QuantumRegister, execute def _UpperCamelCase (_lowerCamelCase : int = 3 )-> qiskit.result.counts.Counts: '''simple docstring''' if isinstance...
24
'''simple docstring''' import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import...
24
1
"""simple docstring""" def __lowercase ( _a , _a ): if digit_amount > 0: return round(number - int(_a ) , _a ) return number - int(_a ) if __name__ == "__main__": print(decimal_isolate(1.53, 0)) print(decimal_isolate(35.345, 1)) print(decimal_isolate(...
711
"""simple docstring""" from statistics import mean, stdev def __lowercase ( _a , _a = 3 ): snake_case_ : Optional[int] = min(_a ) snake_case_ : str = max(_a ) # normalize data return [round((x - x_min) / (x_max - x_min) , _a ) for x in data...
485
0
import argparse import collections import json from pathlib import Path import requests import torch import yaml from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTImageProcessor, MobileViTVaConfig, MobileViTVaForImageClassification, MobileViTVaF...
87
"""simple docstring""" 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_pyaz...
338
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase : Any = { "configuration_jukebox": [ "JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP", "JukeboxConfig", "JukeboxPriorConfig", ...
121
"""simple docstring""" from __future__ import annotations import math def __a ( _lowercase , _lowercase , _lowercase , _lowercase , _lowercase ): """simple docstring""" if depth < 0: raise ValueError('''Depth cannot be less than 0''' ) ...
121
1
import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( 'The `inpainting.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionInpaintPipeline` instead.' )
556
def lowerCAmelCase_ (lowerCAmelCase__: list ): """simple docstring""" if len(lowerCAmelCase__ ) <= 1: return [tuple(lowerCAmelCase__ )] UpperCAmelCase_: List[Any] = [] def generate(lowerCAmelCase__: int , lowerCAmelCase__: list ): if...
556
1
import flax.linen as nn import jax.numpy as jnp from .attention_flax import FlaxTransformeraDModel from .resnet_flax import FlaxDownsampleaD, FlaxResnetBlockaD, FlaxUpsampleaD class A__ ( nn.Module ): '''simple docstring''' snake_case__ = 42 ...
410
from __future__ import annotations __magic_name__ : str = [] def lowercase__ ( _UpperCamelCase , _UpperCamelCase , _UpperCamelCase) -> bool: """simple docstring""" for i in range(len(_UpperCamelCase)): if board[row]...
410
1
import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBenchmarkArguments @require_torch class sn...
85
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, valid_ima...
85
1
'''simple docstring''' import copy import unittest from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTe...
700
def lowerCamelCase_ ( lowerCAmelCase__ : list ) -> int: '''simple docstring''' if not grid or not grid[0]: raise TypeError('The grid does not contain the appropriate information' ) for cell_n in range(1 , len(grid[0] ) ): ...
224
0
from __future__ import annotations import typing from collections.abc import Iterable import numpy as np lowerCAmelCase : List[Any] = typing.Union[Iterable[float], Iterable[int], np.ndarray] # noqa: UP007 lowerCAmelCase : int = typing.Union[np.floataa, int, float] # noqa: UP007 ...
671
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_format, ) fr...
662
0
from dataclasses import dataclass from typing import Optional, Tuple import torch from torch import nn from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel from transformers.utils import ModelOutput @dataclass class lowerCamelCase ( _lowerCamelCase ): '''simple...
501
import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class lowerCamelCase ( unittest.TestCase ): '''simple docstring''' Upper...
501
1
"""simple docstring""" from jiwer import compute_measures import datasets A_ = """\ @inproceedings{inproceedings, author = {Morris, Andrew and Maier, Viktoria and Green, Phil}, year = {2004}, month = {01}, pages = {}, title = {From WER and RIL to MER and WIL: improved evaluation ...
29
import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoFeatureExtractor, WavaVecaFeatureExtractor from transformers.testing_utils import TO...
1
0
"""simple docstring""" import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_se...
625
"""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, ) _lowercase : Optional[Any] = { "conf...
625
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available UpperCamelCase_ = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDepende...
92
'''simple docstring''' import tempfile import unittest from pathlib import Path from shutil import copyfile from transformers import MaMaaaTokenizer, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require...
92
1
"""simple docstring""" import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from ...
24
"""simple docstring""" import inspect import unittest from math import floor from transformers import CvtConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_vision, slow, torch_device ...
24
1
def lowercase ( SCREAMING_SNAKE_CASE__ : list , SCREAMING_SNAKE_CASE__ : int = 0 ) -> list: _snake_case : Optional[Any] = length or len(SCREAMING_SNAKE_CASE__ ) _snake_case : Any = False for i in range(length - 1 ...
477
from argparse import ArgumentParser from ..pipelines import Pipeline, PipelineDataFormat, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand a__ = logging.get_logger(__name__) # pylint: disable=invalid-name def lowercase ( SCREA...
477
1
import argparse import os import torch from transformers.utils import WEIGHTS_NAME _lowerCamelCase =["small", "medium", "large"] _lowerCamelCase ="lm_head.decoder.weight" _lowerCamelCase ="lm_head.weight" def snake_case__ ( lowerCAmelCase_, lowerCAmelCase_ ): ...
252
from ...processing_utils import ProcessorMixin class a_ ( lowerCamelCase_ ): """simple docstring""" __UpperCAmelCase = ['image_processor', 'feature_extractor'] __UpperCAmelCase = 'TvltImageProcessor' __UpperCAmelCase = 'TvltFeatureExtractor' def __i...
252
1
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logging logging.set...
506
import math from datetime import datetime, timedelta def UpperCamelCase_ ( __a ) -> datetime: a__ : Union[str, Any] = year % 19 a__ : List[str] = year % 4 a__ : str = year % 7 a__ : Any = math.floor(year / 100 ) a__ : List[str] = m...
37
0
from __future__ import annotations import math _lowerCamelCase : int = '2020.9.26' _lowerCamelCase : int = 'xcodz-dot, cclaus, dhruvmanila' def _lowerCAmelCase ( __magic_name__ :float , __magic_name__ :float , __magic_name__ :float , ...
407
def _lowerCAmelCase ( __magic_name__ :int = 1_0_0 ): UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 for i in range(1 , n + 1 ): sum_of_squares += i**2 sum_of_ints += i return sum_of_ints**2 - sum_of_squares if __name__ == "__main__": ...
407
1
from __future__ import annotations from collections.abc import Iterator from typing import Any class _lowerCamelCase : def __init__( self , lowerCAmelCase ) -> Optional[int]: SCREAMING_SNAKE_CASE__: Any= data SCREAMING_SNAKE_CASE__: Node | None= None class _lowerCamel...
64
from math import factorial def A__ ( snake_case_ : int , snake_case_ : int ): # If either of the conditions are true, the function is being asked # to calculate a factorial of a negative number, which is not possible if n < k or k < 0: raise ValueError('''Please enter positiv...
64
1
import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import load_metric from .utils import...
700
def UpperCamelCase ( lowerCAmelCase__ , lowerCAmelCase__ ): '''simple docstring''' return int((input_a, input_a).count(0 ) == 0 ) def UpperCamelCase ( ): '''simple docstring''' assert and_gate(0 , 0 ) == 0 assert and_gate(0 , 1 ) == 0 assert and_...
633
0
'''simple docstring''' from collections import defaultdict from math import ceil, sqrt def __lowerCAmelCase ( UpperCamelCase__ = 1_00_00_00 , UpperCamelCase__ = 10 ) -> int: __lowerCamelCase = defaultdict(UpperCamelCase__ ) for outer_width in range...
546
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) __UpperCAmelCase ={ "configuration_mobilebert": [ "MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_M...
546
1
'''simple docstring''' import argparse import json import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, ...
720
'''simple docstring''' import PIL.Image import PIL.ImageOps from packaging import version from PIL import Image if version.parse(version.parse(PIL.__version__).base_version) >= version.parse("9.1.0"): A_ = { "linear": PIL.Image.Resampling.BILINEAR, "bilinear": PIL...
465
0
import os import pytest from attr import dataclass lowercase_ : Optional[Any] = 'us-east-1' # defaults region @dataclass class _lowerCamelCase : __a = 42 __a = "arn:aws:iam::558105141721:role/sagemaker_execution_role" __a = { "task_name": "mnli", ...
64
def A__ ( snake_case_ : float , snake_case_ : float ): if density <= 0: raise ValueError('''Impossible fluid density''' ) if bulk_modulus <= 0: raise ValueError('''Impossible bulk modulus''' ) return (bulk_modulus / density) ** 0.5 if __name__ == "__main__": import do...
64
1
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( ConditionalDetrConfig, ConditionalDetrForObjectDetection, Condit...
426
'''simple docstring''' import json import os from dataclasses import dataclass from functools import partial from typing import Callable import flax.linen as nn import jax import jax.numpy as jnp import joblib import optax import wandb from flax import jax_utils, struct, traverse_util from flax.serialization i...
426
1
"""simple docstring""" import qiskit def UpperCAmelCase ( _lowercase : int = 2 ) -> qiskit.result.counts.Counts: """simple docstring""" lowerCAmelCase_ = qubits # Using Aer's simulator lowerCAmelCase_ = qiskit.Aer.get_backend('''aer_s...
552
"""simple docstring""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor_pool as _descriptor_pool from google.protobuf import symbol_database as _symbol_database from google.protobuf.internal import builder as _builder # @@protoc_insertion_point(imports) ...
552
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available SCREAMING_SNAKE_CASE__:List[Any] = { """configuration_m2m_100""": ["""M2M_100_PRETRAINED_CONFIG_ARCHIVE_MAP""", """M2M100Config""", """M2M100OnnxConfig"""], """token...
708
"""simple docstring""" import re from pathlib import Path from unittest import TestCase import pytest @pytest.mark.integration class snake_case__ ( snake_case_ ): def a__ ( self , lowerCamelCase ): with open(lowerCamelCase , encoding="utf-8" ) as input_file: ...
67
0
"""simple docstring""" UpperCAmelCase__ = {str(digit): digit**5 for digit in range(1_0)} def __UpperCAmelCase ( lowercase ): """simple docstring""" return sum(DIGITS_FIFTH_POWER[digit] for digit in str(lowercase ) ) def __UpperCAmelCase ( ): """s...
277
"""simple docstring""" from __future__ import annotations import pandas as pd def __UpperCAmelCase ( lowercase ,lowercase ,lowercase ): """simple docstring""" _UpperCAmelCase = [0] * no_of_processes _UpperCAmelCase = [0] * no_of_processes # Copy the burst time in...
277
1
"""simple docstring""" from __future__ import annotations from math import ceil, floor, sqrt def _snake_case ( lowercase__ = 2000000 ): _lowerCamelCase : list[int] = [0] _lowerCamelCase : int for idx in range(1 , ceil(sqrt(ta...
492
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import torch from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available @dataclass class lowerCAmelCase__ ...
492
1