code
stringlengths
86
54.5k
code_codestyle
int64
0
371
style_context
stringlengths
87
49.2k
style_context_codestyle
int64
0
349
label
int64
0
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'facebook/xglm-564M': 'https://huggingface.co/facebook/xglm-564M/resolve/main/config.json', # See all XGLM ...
360
def snake_case ( snake_case__ :str , snake_case__ :str) -> list: _A = len(snake_case__) _A = [] for i in range(len(snake_case__) - pat_len + 1): _A = True for j in range(snake_case__): ...
81
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
361
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class a ( __lowerCAmelCase ): """simple docstring""" def __init__( self , *lowerCAmelC...
81
0
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config f...
362
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 HeunDiscreteScheduler...
81
0
import copy 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 from ..auto import CONFIG_MAPPING _SCREAMING_SNAKE_CASE = logging.get_...
363
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = {'configuration_vit_msn': ['VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMSNConfig']} try: if not is_torch_available(): raise OptionalDep...
81
0
import logging import os import sys from dataclasses import dataclass, field from importlib import import_module from typing import Dict, List, Optional, Tuple import numpy as np from seqeval.metrics import accuracy_score, fa_score, precision_score, recall_score from torch import nn from utils_ner import Spl...
364
from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fastapi.routing impor...
81
0
from math import log from scipy.constants import Boltzmann, physical_constants _snake_case = 300 # TEMPERATURE (unit = K) def snake_case ( snake_case__ :float , snake_case__ :float , snake_case__ :float , ) -> float: ...
365
import colorsys from PIL import Image # type: ignore def snake_case ( snake_case__ :float , snake_case__ :float , snake_case__ :int) -> float: _A = x _A = y for step in range(snake_case__): # noqa: B007 ...
81
0
import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...tes...
366
def snake_case ( snake_case__ :int , snake_case__ :int) -> str: return "\n".join( F'''{number} * {i} = {number * i}''' for i in range(1 , number_of_terms + 1)) if __name__ == "__main__": print(multiplication_table(number=5, number_of_terms=10)) ...
81
0
import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import TimesformerConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import c...
367
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 = [ 'word_embeddi...
81
0
import warnings from ...utils import logging from .image_processing_yolos import YolosImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class a ( __lowerCAmelCase ): """simple docstring""" def __init__( self , *lowerCAmelCase_ , **lowerCAmel...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE = {'configuration_fnet': ['FNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FNetCo...
81
0
import torch from diffusers import DDIMParallelScheduler from .test_schedulers import SchedulerCommonTest class a ( __lowerCAmelCase ): """simple docstring""" lowerCamelCase :int = (DDIMParallelScheduler,) lowerCamelCase :Any = (('''eta''', 0.0), ('''num_inf...
369
# 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...
81
0
import math def snake_case ( snake_case__ :int) -> bool: if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are...
370
from collections.abc import Sequence def snake_case ( snake_case__ :Sequence[float] , snake_case__ :bool = False) -> float: if not arr: return 0 _A = 0 if allow_empty_subarrays else float("""-inf""") _A = 0....
81
0
from scipy.stats import pearsonr import datasets _SCREAMING_SNAKE_CASE = '\nPearson correlation coefficient and p-value for testing non-correlation.\nThe Pearson correlation coefficient measures the linear relationship between two datasets. The calculation of the p-value relies on the assumptio...
371
def snake_case ( ) -> Any: for n in range(1 , 1_000_000): yield n * (n + 1) // 2 def snake_case ( snake_case__ :Dict) -> Optional[Any]: _A = 1 _A = 2 while i * i <= n: _A ...
81
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) _SCREAMING_SNAKE_CASE = { 'configuration_speech_to_text': ['SPEECH_TO_...
350
import requests from bsa import BeautifulSoup def snake_case ( snake_case__ :str = "AAPL") -> str: _A = F'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}''' _A = BeautifulSoup(requests.get(snake_case__).text , """html.parser"""...
81
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available _SCREAMING_SNAKE_CASE = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except Opti...
351
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class a ( __lowerCAmelCase ): """simple docstring""" lowerCamelCase :int = (UnCLIPScheduler,) def UpperCAmelCase ( self , **lo...
81
0
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 _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CAS...
352
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def snake_case ( ) -> List[Any]: _A = ArgumentParser( description=( """PyTorch TPU...
81
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_mobilebert import MobileBertTokenizer _SCREAMING_SNAKE_CASE = logging.get_logger(__name__)...
353
import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate _SCREAMING_SNAKE_CASE = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow('', '|', '|...
81
0
import unittest from datasets import load_dataset from transformers.pipelines import pipeline from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow @is_pipeline_test @require_torch class a ( unittest.TestCase ): """simple d...
354
import cva import numpy as np class a : """simple docstring""" def __init__( self , lowerCAmelCase_ , lowerCAmelCase_ ) -> Any: if k in (0.04, 0.06): _A = k _A = window_size else: ...
81
0
import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class a ( __lowerCAmelCase , unittest.TestCase ): """simple docstring""" ...
355
def snake_case ( snake_case__ :str) -> int: _A = hex_num.strip() if not hex_num: raise ValueError("""No value was passed to the function""") _A = hex_num[0] == """-""" if is_negative: _A = hex_num[1:]...
81
0
"""simple docstring""" import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all image processors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, res...
356
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
81
0
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 i...
357
import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup _SCREAMING_SNAKE_CASE = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' ' (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.195...
81
0
"""simple docstring""" _SCREAMING_SNAKE_CASE = [ 'DownloadConfig', 'DownloadManager', 'DownloadMode', 'StreamingDownloadManager', ] from .download_config import DownloadConfig from .download_manager import DownloadManager, DownloadMode from .streaming_download_manager...
358
from math import isqrt def snake_case ( snake_case__ :int) -> list[int]: _A = [True] * max_number for i in range(2 , isqrt(max_number - 1) + 1): if is_prime[i]: for j in range(i**2 , snake_case__ ...
81
0
def snake_case ( snake_case__ :int = 50) -> int: _A = [1] * (length + 1) for row_length in range(3 , length + 1): for block_length in range(3 , row_length + 1): for block_start in range(row_length - block_length):...
359
import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import CLIPModel, CLIPTokenizerF...
81
0
import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py _SCREAMING_SNAKE_CASE = 'src/diffusers' # Matches is_xxx_available() _SCREAMING_SNAKE_CASE = re.com...
360
def snake_case ( snake_case__ :str , snake_case__ :str) -> list: _A = len(snake_case__) _A = [] for i in range(len(snake_case__) - pat_len + 1): _A = True for j in range(snake_case__): ...
81
0
def snake_case ( snake_case__ :int = 1_000) -> int: _A = 2**power _A = 0 while n: _A , _A = r + n % 10, n // 10 return r if __name__ == "__main__": print(solution(int(str(input()).strip())))
361
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class a ( __lowerCAmelCase ): """simple docstring""" def __init__( self , *lowerCAmelC...
81
0
"""simple docstring""" def snake_case ( snake_case__ :Optional[Any]) -> List[Any]: if not head: return True # split the list to two parts _A , _A = head.next, head while fast and fast.next: _A = fas...
362
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 HeunDiscreteScheduler...
81
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'google/pegasus-large': 'https://huggingface.co/google/pegasus-large/resolve/main/config.json', # See all P...
363
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = {'configuration_vit_msn': ['VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMSNConfig']} try: if not is_torch_available(): raise OptionalDep...
81
0
import cva import numpy as np class a : """simple docstring""" def __init__( self , lowerCAmelCase_ , lowerCAmelCase_ ) -> Any: if k in (0.04, 0.06): _A = k _A = window_size else: ...
364
from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fastapi.routing impor...
81
0
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class a ( __lowerCAmelCase ): """simple docstring""" lowerCamelCase :List[str] = ['''image_processor''', '''tokenizer'''] lowerCamelC...
365
import colorsys from PIL import Image # type: ignore def snake_case ( snake_case__ :float , snake_case__ :float , snake_case__ :int) -> float: _A = x _A = y for step in range(snake_case__): # noqa: B007 ...
81
0
def snake_case ( snake_case__ :str , snake_case__ :str = " ") -> list: _A = [] _A = 0 for index, char in enumerate(snake_case__): if char == separator: split_words.append(string[last_index:index]) ...
366
def snake_case ( snake_case__ :int , snake_case__ :int) -> str: return "\n".join( F'''{number} * {i} = {number * i}''' for i in range(1 , number_of_terms + 1)) if __name__ == "__main__": print(multiplication_table(number=5, number_of_terms=10)) ...
81
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_ut...
367
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 = [ 'word_embeddi...
81
0
def snake_case ( snake_case__ :int , snake_case__ :int) -> str: if b == 0: return 1 if (b % 2) == 0: return actual_power(snake_case__ , int(b / 2)) * actual_power(snake_case__ , int(b / 2)) else: return...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE = {'configuration_fnet': ['FNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FNetCo...
81
0
# limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401 from .utils import deprecate deprecate(...
369
# 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...
81
0
from __future__ import absolute_import, division, print_function, unicode_literals from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers import RobertaConfig from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models....
370
from collections.abc import Sequence def snake_case ( snake_case__ :Sequence[float] , snake_case__ :bool = False) -> float: if not arr: return 0 _A = 0 if allow_empty_subarrays else float("""-inf""") _A = 0....
81
0
from diffusers.utils.testing_utils import require_onnxruntime @require_onnxruntime class a : """simple docstring""" pass
371
def snake_case ( ) -> Any: for n in range(1 , 1_000_000): yield n * (n + 1) // 2 def snake_case ( snake_case__ :Dict) -> Optional[Any]: _A = 1 _A = 2 while i * i <= n: _A ...
81
0
def snake_case ( snake_case__ :int) -> int: _A = 0 while num > 0: digit_sum += num % 10 num //= 10 return digit_sum def snake_case ( snake_case__ :int = 100) -> int: _A = 1 ...
350
import requests from bsa import BeautifulSoup def snake_case ( snake_case__ :str = "AAPL") -> str: _A = F'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}''' _A = BeautifulSoup(requests.get(snake_case__).text , """html.parser"""...
81
0
"""simple docstring""" import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup _SCREAMING_SNAKE_CASE = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' ' (KHTML, like Gecko) Chrome/70.0.35...
351
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class a ( __lowerCAmelCase ): """simple docstring""" lowerCamelCase :int = (UnCLIPScheduler,) def UpperCAmelCase ( self , **lo...
81
0
def snake_case ( ): return 1 def snake_case ( snake_case__ :int): return 0 if x < 0 else two_pence(x - 2) + one_pence() def snake_case ( snake_case__ :int): return 0 if x < 0 else five_pence(x - 5) + two_pence(snake_case__) def snak...
352
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def snake_case ( ) -> List[Any]: _A = ArgumentParser( description=( """PyTorch TPU...
81
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) _SCREAMING_SNAKE_CASE = { 'configuration_gpt_bigcode': ['GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTBigCodeConfig'], } try: if not is_tor...
353
import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate _SCREAMING_SNAKE_CASE = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow('', '|', '|...
81
0
import os from collections import namedtuple import pytest from datasets import ClassLabel, Features, Sequence, Value from datasets.commands.test import TestCommand from datasets.info import DatasetInfo, DatasetInfosDict _SCREAMING_SNAKE_CASE = namedtuple( '_TestCommandArgs...
354
import cva import numpy as np class a : """simple docstring""" def __init__( self , lowerCAmelCase_ , lowerCAmelCase_ ) -> Any: if k in (0.04, 0.06): _A = k _A = window_size else: ...
81
0
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class a : """simple docstring""" lowerCamelCase :int lowerCamelCase :Node | None ...
355
def snake_case ( snake_case__ :str) -> int: _A = hex_num.strip() if not hex_num: raise ValueError("""No value was passed to the function""") _A = hex_num[0] == """-""" if is_negative: _A = hex_num[1:]...
81
0
"""simple docstring""" import os from typing import Any, Callable, Dict, List, Optional, Tuple, Union import torch from torch import nn from ...models.controlnet import ControlNetModel, ControlNetOutput from ...models.modeling_utils import ModelMixin from ...utils import logging _SCREAMING_SNAKE...
356
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
81
0
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 _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CAS...
357
import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup _SCREAMING_SNAKE_CASE = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' ' (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.195...
81
0
"""simple docstring""" def snake_case ( snake_case__ :int = 200) -> int: _A = [1, 2, 5, 10, 20, 50, 100, 200] _A = [0] * (pence + 1) _A = 1 # base case: 1 way to make 0 pence for coin in coins: for i in ra...
358
from math import isqrt def snake_case ( snake_case__ :int) -> list[int]: _A = [True] * max_number for i in range(2 , isqrt(max_number - 1) + 1): if is_prime[i]: for j in range(i**2 , snake_case__ ...
81
0
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by a...
359
import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import CLIPModel, CLIPTokenizerF...
81
0
_SCREAMING_SNAKE_CASE = '\n# Transformers installation\n! pip install transformers datasets\n# To install from source instead of the last release, comment the command above and uncomment the following one.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' _SCREAMING_SNAKE_CASE ...
360
def snake_case ( snake_case__ :str , snake_case__ :str) -> list: _A = len(snake_case__) _A = [] for i in range(len(snake_case__) - pat_len + 1): _A = True for j in range(snake_case__): ...
81
0
import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...models.auto.modeling_auto import MODEL_FOR_CAUSAL_LM_MAPPING_NAMES from ...utils import logging from ..auto import CONFIG_MAPPING _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) ...
361
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class a ( __lowerCAmelCase ): """simple docstring""" def __init__( self , *lowerCAmelC...
81
0
"""simple docstring""" def snake_case ( snake_case__ :str) -> list: if n_term == "": return [] _A = [] for temp in range(int(snake_case__)): series.append(F'''1/{temp + 1}''' if series else """1""") return series ...
362
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 HeunDiscreteScheduler...
81
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'microsoft/cvt-13': 'https://huggingface.co/microsoft/cvt-13/resolve/main/config.json', # See all Cvt model...
363
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = {'configuration_vit_msn': ['VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMSNConfig']} try: if not is_torch_available(): raise OptionalDep...
81
0
import inspect import unittest from transformers import RegNetConfig, is_flax_available from transformers.testing_utils import require_flax, slow from transformers.utils import cached_property, is_vision_available from ...test_configuration_common import ConfigTester from ...test_modeling_flax_common import F...
364
from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fastapi.routing impor...
81
0
import hashlib import unittest from transformers import MODEL_FOR_DEPTH_ESTIMATION_MAPPING, is_torch_available, is_vision_available from transformers.pipelines import DepthEstimationPipeline, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, requi...
365
import colorsys from PIL import Image # type: ignore def snake_case ( snake_case__ :float , snake_case__ :float , snake_case__ :int) -> float: _A = x _A = y for step in range(snake_case__): # noqa: B007 ...
81
0
from bisect import bisect from itertools import accumulate def snake_case ( snake_case__ :Optional[int] , snake_case__ :str , snake_case__ :List[Any] , snake_case__ :Optional[Any]) -> Optional[Any]: _A = sorted(zip(snake_...
366
def snake_case ( snake_case__ :int , snake_case__ :int) -> str: return "\n".join( F'''{number} * {i} = {number * i}''' for i in range(1 , number_of_terms + 1)) if __name__ == "__main__": print(multiplication_table(number=5, number_of_terms=10)) ...
81
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _SCREAMING_SNAKE_CASE = { 'configuration_data2vec_audio': ['DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP', 'Data2VecAudioConfig'], 'configuration_data2vec_te...
367
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 = [ 'word_embeddi...
81
0
import math import random def snake_case ( snake_case__ :float , snake_case__ :bool = False) -> float: if deriv: return value * (1 - value) return 1 / (1 + math.exp(-value)) # Initial Value _SCREAMING_SNAKE_CASE = 0.02 def ...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE = {'configuration_fnet': ['FNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FNetCo...
81
0
from ....configuration_utils import PretrainedConfig from ....utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'CarlCochet/trajectory-transformer-halfcheetah-medium-v2': ( 'https://huggingface.co/CarlCochet/trajectory-tr...
369
# 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...
81
0
import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.numpy as jnp from flax...
370
from collections.abc import Sequence def snake_case ( snake_case__ :Sequence[float] , snake_case__ :bool = False) -> float: if not arr: return 0 _A = 0 if allow_empty_subarrays else float("""-inf""") _A = 0....
81
0
import argparse import os import re import packaging.version _SCREAMING_SNAKE_CASE = 'examples/' _SCREAMING_SNAKE_CASE = { 'examples': (re.compile(R'^check_min_version\("[^"]+"\)\s*$', re.MULTILINE), 'check_min_version("VERSION")\n'), 'init': (re.compile(R'^__versi...
371
def snake_case ( ) -> Any: for n in range(1 , 1_000_000): yield n * (n + 1) // 2 def snake_case ( snake_case__ :Dict) -> Optional[Any]: _A = 1 _A = 2 while i * i <= n: _A ...
81
0
# # 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-g...
350
import requests from bsa import BeautifulSoup def snake_case ( snake_case__ :str = "AAPL") -> str: _A = F'''https://in.finance.yahoo.com/quote/{symbol}?s={symbol}''' _A = BeautifulSoup(requests.get(snake_case__).text , """html.parser"""...
81
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'google/realm-cc-news-pretrained-embedder': ( 'https://huggingface.co/g...
351
import torch from diffusers import UnCLIPScheduler from .test_schedulers import SchedulerCommonTest class a ( __lowerCAmelCase ): """simple docstring""" lowerCamelCase :int = (UnCLIPScheduler,) def UpperCAmelCase ( self , **lo...
81
0
from math import factorial def snake_case ( snake_case__ :int = 100): return sum(int(snake_case__) for x in str(factorial(snake_case__))) if __name__ == "__main__": print(solution(int(input('Enter the Number: ').strip())))
352
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def snake_case ( ) -> List[Any]: _A = ArgumentParser( description=( """PyTorch TPU...
81
0
import sys _SCREAMING_SNAKE_CASE = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '12540698747158523863050715693290963295227443043557' '6689664895044524452316173...
353
import json import os from datetime import date from pathlib import Path from tabulate import DataRow, TableFormat, tabulate _SCREAMING_SNAKE_CASE = TableFormat( lineabove=None, linebelowheader=None, linebetweenrows=None, linebelow=None, headerrow=DataRow('', '|', '|...
81
0
import functools import operator from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'asapp/sew-d-tiny-100k': 'https://huggingface.co/asapp/sew-d-tiny...
354
import cva import numpy as np class a : """simple docstring""" def __init__( self , lowerCAmelCase_ , lowerCAmelCase_ ) -> Any: if k in (0.04, 0.06): _A = k _A = window_size else: ...
81
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = {'configuration_vit_msn': ['VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMSNConfig']} try: if not is_torch_available(): raise OptionalDep...
355
def snake_case ( snake_case__ :str) -> int: _A = hex_num.strip() if not hex_num: raise ValueError("""No value was passed to the function""") _A = hex_num[0] == """-""" if is_negative: _A = hex_num[1:]...
81
0
"""simple docstring""" import argparse from transformers import CLIPImageProcessor, CLIPVisionModelWithProjection from diffusers import UnCLIPImageVariationPipeline, UnCLIPPipeline if __name__ == "__main__": _SCREAMING_SNAKE_CASE = argparse.ArgumentParser() parser.add_ar...
356
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
81
0
import unittest from transformers import SPIECE_UNDERLINE, XLNetTokenizer, XLNetTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin _SCREAMING_SNAKE_CASE = get_tests_...
357
import json import os import re import sys import urllib.request import requests from bsa import BeautifulSoup _SCREAMING_SNAKE_CASE = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36' ' (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36 Edge/18.195...
81
0
"""simple docstring""" import random import timeit from functools import wraps from typing import Callable, Optional from ..configuration_utils import PretrainedConfig from ..models.auto.modeling_tf_auto import TF_MODEL_MAPPING, TF_MODEL_WITH_LM_HEAD_MAPPING from ..utils import is_pyanvml_available, is...
358
from math import isqrt def snake_case ( snake_case__ :int) -> list[int]: _A = [True] * max_number for i in range(2 , isqrt(max_number - 1) + 1): if is_prime[i]: for j in range(i**2 , snake_case__ ...
81
0
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
359
import os from glob import glob import imageio import torch import torchvision import wandb from img_processing import custom_to_pil, loop_post_process, preprocess, preprocess_vqgan from loaders import load_vqgan from PIL import Image from torch import nn from transformers import CLIPModel, CLIPTokenizerF...
81
0
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def snake_case ( ) -> List[Any]: _A = ArgumentParser( description=( """PyTorch TPU...
360
def snake_case ( snake_case__ :str , snake_case__ :str) -> list: _A = len(snake_case__) _A = [] for i in range(len(snake_case__) - pat_len + 1): _A = True for j in range(snake_case__): ...
81
0
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { 'configuration_trajectory_transformer': [ 'TRAJECTORY_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TrajectoryTransformerConfig'...
361
import warnings from ...utils import logging from .image_processing_clip import CLIPImageProcessor _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) class a ( __lowerCAmelCase ): """simple docstring""" def __init__( self , *lowerCAmelC...
81
0
"""simple docstring""" def snake_case ( snake_case__ :int , snake_case__ :int) -> int: return int(input_a == input_a == 0) def snake_case ( ) -> None: print("""Truth Table of NOR Gate:""") print("""| Input 1 | Input 2 ...
362
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 HeunDiscreteScheduler...
81
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = { 'configuration_table_transformer': [ 'TABLE_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TableTransformerConfig', 'Tabl...
363
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _SCREAMING_SNAKE_CASE = {'configuration_vit_msn': ['VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP', 'ViTMSNConfig']} try: if not is_torch_available(): raise OptionalDep...
81
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'abeja/gpt-neox-japanese-2.7b': 'https://huggingface.co/abeja/gpt-neox-japanese-2.7b/resolve/main/config.json', ...
364
from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fastapi.routing impor...
81
0
from PIL import Image def snake_case ( snake_case__ :Image , snake_case__ :int) -> Image: _A = (259 * (level + 255)) / (255 * (259 - level)) def contrast(snake_case__ :int) -> int: return int(128 + factor * (c - 128)) ...
365
import colorsys from PIL import Image # type: ignore def snake_case ( snake_case__ :float , snake_case__ :float , snake_case__ :int) -> float: _A = x _A = y for step in range(snake_case__): # noqa: B007 ...
81
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'SenseTime/deformable-detr': 'https://huggingface.co/senseti...
366
def snake_case ( snake_case__ :int , snake_case__ :int) -> str: return "\n".join( F'''{number} * {i} = {number * i}''' for i in range(1 , number_of_terms + 1)) if __name__ == "__main__": print(multiplication_table(number=5, number_of_terms=10)) ...
81
0
from math import isqrt def snake_case ( snake_case__ :int) -> list[int]: _A = [True] * max_number for i in range(2 , isqrt(max_number - 1) + 1): if is_prime[i]: for j in range(i**2 , snake_case__ , snake...
367
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 = [ 'word_embeddi...
81
0
from ...configuration_utils import PretrainedConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'facebook/nllb-moe-54B': 'https://huggingface.co/facebook/nllb-moe-54b/resolve/main/config.json', } class a ...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) _SCREAMING_SNAKE_CASE = {'configuration_fnet': ['FNET_PRETRAINED_CONFIG_ARCHIVE_MAP', 'FNetCo...
81
0
from typing import Any class a : """simple docstring""" def __init__( self , lowerCAmelCase_ ) -> Union[str, Any]: _A = data _A = None class a : """simple docstring""" def __init__( self ) -> int: _...
369
# 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...
81
0
from __future__ import annotations import math from collections.abc import Callable def snake_case ( snake_case__ :Callable[[int | float], int | float] , snake_case__ :int | float , snake_case__ :int | float , snake_case__ :int = 100 , ) ...
370
from collections.abc import Sequence def snake_case ( snake_case__ :Sequence[float] , snake_case__ :bool = False) -> float: if not arr: return 0 _A = 0 if allow_empty_subarrays else float("""-inf""") _A = 0....
81
0
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _SCREAMING_SNAKE_CASE = logging.get_logger(__name__) _SCREAMING_SNAKE_CASE = { 'distilbert-b...
371
def snake_case ( ) -> Any: for n in range(1 , 1_000_000): yield n * (n + 1) // 2 def snake_case ( snake_case__ :Dict) -> Optional[Any]: _A = 1 _A = 2 while i * i <= n: _A ...
81
0
from __future__ import annotations import math a : Dict = '2020.9.26' a : Optional[Any] = 'xcodz-dot, cclaus, dhruvmanila' def lowerCAmelCase_ (lowerCAmelCase__: float , lowerCAmelCase__: float , lowerCAmelCase__: float ...
82
a : Tuple = 'Tobias Carryer' from time import time class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_=int(time() ) ) -> List[Any]: # noqa: B008 UpperCAmelCase_: List[str]...
82
1
import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging a : str = logging.get_logger(__name__) class _a ( _lowerCAmelCase ): A = ...
82
import logging import math import os from dataclasses import dataclass, field from glob import glob from typing import Optional from torch.utils.data import ConcatDataset import transformers from transformers import ( CONFIG_MAPPING, MODEL_WITH_LM_HEAD_MAPPING, AutoConfig, AutoMo...
82
1
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, ) a : Any = { 'configuration_clip': [ ...
82
def lowerCAmelCase_ (lowerCAmelCase__: int , lowerCAmelCase__: float , lowerCAmelCase__: float ): """simple docstring""" return round(float(moles / volume ) * nfactor ) def lowerCAmelCase_ (lowerCAmelCase__: f...
82
1
from ....configuration_utils import PretrainedConfig from ....utils import logging a : Any = logging.get_logger(__name__) a : Dict = { 'speechbrain/m-ctc-t-large': 'https://huggingface.co/speechbrain/m-ctc-t-large/resolve/main/config.json', # See all M-CTC-T mo...
82
import math from dataclasses import dataclass from typing import Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin @dataclass...
82
1
from __future__ import annotations import collections import tempfile import unittest import numpy as np from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import is_tf_available, is_vision_available from ...test_modeling_tf_common import floats_tensor...
82
from __future__ import annotations import inspect import unittest from math import floor import numpy as np from transformers import CvtConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available...
82
1
import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils import require_...
82
import importlib import os import fsspec import pytest from fsspec import register_implementation from fsspec.registry import _registry as _fsspec_registry from datasets.filesystems import COMPRESSION_FILESYSTEMS, HfFileSystem, extract_path_from_uri, is_remote_filesystem from .utils import require_...
82
1
import re from typing import Callable, List, Optional, Union import tensorflow as tf try: from tensorflow.keras.optimizers.legacy import Adam except ImportError: from tensorflow.keras.optimizers import Adam class _a ( tf.keras.optimizers.schedules.LearningRateSchedule ...
82
import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel a : Optional[int] = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention.self', 'se...
82
1
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets a : Dict = datasets.logging.get_logger(__name__) a : Any = '\\n@InProceedings{moosavi2019minimum,\n ...
82
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_electra import ElectraTokenizer a : List[str] = {'vocab_file': 'vocab.txt', 'tokenizer_file': 'tokenizer.json'} ...
82
1
# 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.0 # # Unless requi...
82
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets a : Dict = datasets.logging.get_logger(__name__) a : Any = '\\n@InProceedings{moosavi2019minimum,\n ...
82
1
from __future__ import annotations from collections.abc import MutableSequence class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_ ) -> None: if len(SCREAMING_SNAKE_CASE_ ) != degree + 1: raise ValueError( """The nu...
82
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...
82
1
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device f...
82
import math from typing import Optional import numpy as np from ...configuration_utils import PretrainedConfig from ...utils import logging a : Tuple = logging.get_logger(__name__) a : Optional[Any] = { 'facebook/encodec_24khz': 'https://huggingface.co/facebo...
82
1
from collections.abc import Sequence def lowerCAmelCase_ (lowerCAmelCase__: Sequence[float] , lowerCAmelCase__: bool = False ): """simple docstring""" if not arr: return 0 UpperCAmelCase_: Optional[Any] = 0 if allo...
82
import unittest from parameterized import parameterized from transformers import OpenLlamaConfig, is_torch_available, set_seed from transformers.testing_utils import require_torch, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigT...
82
1
def lowerCAmelCase_ (lowerCAmelCase__: List[str] , lowerCAmelCase__: Union[str, Any] ): """simple docstring""" UpperCAmelCase_: str = [1] for i in range(2 , lowerCAmelCase__ ): factorials.append(factorials[-1] * i ...
82
from __future__ import annotations def lowerCAmelCase_ (lowerCAmelCase__: list[float] ): """simple docstring""" UpperCAmelCase_: Union[str, Any] = 0.00 UpperCAmelCase_: List[str] = 0 for resistor in resistors: ...
82
1
def lowerCAmelCase_ (lowerCAmelCase__: list , lowerCAmelCase__: list , lowerCAmelCase__: int , lowerCAmelCase__: int , lowerCAmelCase__: int ): """simple docstring""" if index == number_of_items: return 0 UpperCAmelC...
82
import argparse import os import torch from transformers import ( XLNetConfig, XLNetForQuestionAnswering, XLNetForSequenceClassification, XLNetLMHeadModel, load_tf_weights_in_xlnet, ) from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging a : str ...
82
1
from ...configuration_utils import PretrainedConfig from ...utils import logging a : Tuple = logging.get_logger(__name__) a : Tuple = { 'facebook/dpr-ctx_encoder-single-nq-base': ( 'https://huggingface.co/facebook/dpr-ctx_encoder-single-nq-base/resolve/main...
82
from typing import TYPE_CHECKING from ....utils import _LazyModule a : Tuple = {'tokenization_tapex': ['TapexTokenizer']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys a : List[Any] = _LazyModule(__name__, globals()['_...
82
1
from __future__ import annotations import unittest import numpy as np from transformers import BlipTextConfig from transformers.testing_utils import require_tf, slow from transformers.utils import is_tf_available from ...test_configuration_common import ConfigTester from ...test_modeling_tf_commo...
82
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, require_tf, require_to...
82
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available a : List[str] = { 'configuration_xlm': ['XLM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'XLMConfig', 'XLMOnnxConfig'], 'tokenization_xlm': ['XLMTokenizer'...
82
import argparse from collections import OrderedDict from pathlib import Path import requests import torch from PIL import Image from transformers import GLPNConfig, GLPNForDepthEstimation, GLPNImageProcessor from transformers.utils import logging logging.set_verbosity_info() a : List[...
82
1
import numpy as np def lowerCAmelCase_ (lowerCAmelCase__: Optional[int] , lowerCAmelCase__: Any , lowerCAmelCase__: Dict , lowerCAmelCase__: Tuple , lowerCAmelCase__: Optional[Any] ): """simple docstring""" Upper...
82
from __future__ import annotations def lowerCAmelCase_ (lowerCAmelCase__: list[int | float] , lowerCAmelCase__: int , lowerCAmelCase__: int ): """simple docstring""" if len(lowerCAmelCase__ ) == 0: raise ValueError("""fin...
82
1
def lowerCAmelCase_ (lowerCAmelCase__: int , lowerCAmelCase__: int ): """simple docstring""" while second != 0: UpperCAmelCase_: Tuple = first & second first ^= second UpperCAmelCase_: int = c << 1 r...
82
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_squeezebert import SqueezeBertTokenizer a : Optional[Any] = logging.get_logger(__na...
82
1
import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(_lowerCAmelCase ...
82
import inspect import unittest import numpy as np from tests.test_modeling_common import floats_tensor from transformers import MaskaFormerConfig, is_torch_available, is_vision_available from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device f...
82
1
from typing import TYPE_CHECKING from ....utils import _LazyModule a : Tuple = {'tokenization_tapex': ['TapexTokenizer']} if TYPE_CHECKING: from .tokenization_tapex import TapexTokenizer else: import sys a : List[Any] = _LazyModule(__name__, globals()['_...
82
from collections import defaultdict class _a : def __init__(self, SCREAMING_SNAKE_CASE_, SCREAMING_SNAKE_CASE_ ) -> List[str]: UpperCAmelCase_: Optional[int] = total # total no of tasks (N) # DP table will have a dimension of (2^M)*N ...
82
1
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, requir...
82
import unittest from transformers import load_tool from .test_tools_common import ToolTesterMixin class _a ( unittest.TestCase , _lowerCAmelCase ): def __snake_case (self ) -> Optional[int]: UpperCAmelCase_: Optional[int] = l...
82
1