code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
"""simple docstring""" from typing import Any, Callable, Dict, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DiffusionPipeline, LMSDiscreteScheduler, PNDMScheduler, StableDi...
66
'''simple docstring''' import os import unittest from transformers import FunnelTokenizer, FunnelTokenizerFast from transformers.models.funnel.tokenization_funnel import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin ...
75
0
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import add_start_docstrings UpperCAmelCase = R""" [`RagConfig`] stores the configuration of a *RagModel*. Configuration objects inherit from [`PretrainedConfig`] and can be used to control the mo...
141
'''simple docstring''' import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStructProcessor, ...
75
0
import argparse import os import numpy as np import tensorflow as tf import torch from transformers import BertModel def A_ ( _lowerCAmelCase , _lowerCAmelCase , _lowerCAmelCase ) -> str: UpperCamelCase : str = ("dense.weight", "attention.self.query", "attentio...
52
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, ...
75
0
def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def a ( lowerCamelCase_ , lowerCamelCase_=0 ): '''simple docstring''' return sorted(__snake_case , key=lambda l...
207
'''simple docstring''' from __future__ import annotations def a_ ( __snake_case : str , __snake_case : list[str] | None = None , __snake_case : dict[str, float] | None = None , __snake_case : bool = False , ) -> tup...
75
0
from datetime import datetime as dt import os from github import Github _UpperCamelCase = [ """good first issue""", """good second issue""", """good difficult issue""", """feature request""", """new model""", """wip""", ] def _lowercase ( ): __lowerCAmelCase : ...
275
'''simple docstring''' import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import ...
75
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available a_ = { """configuration_data2vec_audio""": ["""DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Data2VecAudioConfig"""], """configuration_data2vec_text""": ...
340
'''simple docstring''' a_ : Any = [ 9_99, 8_00, 7_99, 6_00, 5_99, 5_00, 4_00, 3_99, 3_77, 3_55, 3_33, 3_11, 2_88, 2_66, 2_44, 2_22, 2_00, 1_99, 1_77, 1_55, 1_33, 1_11, 88, 66, 44, 22,...
75
0
'''simple docstring''' import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel A__ : Dict =HfApi() A__ : Tuple ={} # fmt: off A__ : Union[str, Any] =torch.tensor([ -0.7_515, -1.6_883, 0.2_420, 0.0_300, 0....
70
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) a_ : Union[str, Any] = { """configuration_funnel""": ["""FUNNEL_PRETRAIN...
75
0
"""simple docstring""" import unittest import numpy as np import torch from diffusers import ScoreSdeVePipeline, ScoreSdeVeScheduler, UNetaDModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() class __magic_name__ ...
291
'''simple docstring''' 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 ...
75
0
"""simple docstring""" from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL import torch from transformers import CLIPImageProcessor, CLIPVisionModel from ...models import PriorTransformer from ...pipelines import DiffusionPipeline from ...schedulers impo...
150
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteSchedule...
75
0
"""simple docstring""" import json import os import re import shutil import tempfile import unittest from typing import Tuple from transformers import AddedToken, BatchEncoding, PerceiverTokenizer from transformers.utils import cached_property, is_tf_available, is_torch_available fro...
96
'''simple docstring''' from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixi...
75
0
"""simple docstring""" from typing import Tuple, Union from ...modeling_outputs import BackboneOutput from ...modeling_utils import PreTrainedModel from ...utils import is_timm_available, is_torch_available, requires_backends from ...utils.backbone_utils import BackboneMixin from .configuration_timm_backbone import...
347
'''simple docstring''' import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelin...
75
0
"""simple docstring""" __a = """2.13.1""" import platform import pyarrow from packaging import version if version.parse(platform.python_version()) < version.parse("3.7"): raise ImportWarning( "To use `datasets`, Python>=3.7 is required, and the current version of Python doesn't match thi...
66
'''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 a_ : Optional[int] = logging.get_logger(__name__) a_ : Optional[int] ...
75
0
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available UpperCAmelCase = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenizati...
141
'''simple docstring''' from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Dict = logging.get_logger(__name__) a_ : Any = { """snap-research/efficientformer-l1-300""": ( """https://huggingf...
75
0
import pytest from datasets import inspect_metric, list_metrics, load_metric @pytest.fixture def A_ ( _lowerCAmelCase ) -> int: monkeypatch.setattr("datasets.utils.deprecation_utils._emitted_deprecation_warnings" , set() ) @pytest.fixture def A_ ( _lowerCAmelCase ...
52
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin if is_spe...
75
0
from __future__ import annotations import math def a ( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' if depth < 0: raise ValueError('''Depth cannot be less than 0''' ) if not scores: ...
207
'''simple docstring''' def a_ ( __snake_case : Any , __snake_case : List[str] ) -> str: """simple docstring""" lowerCamelCase_ ='''''' for i in table: res += inp[i - 1] return res def a_ ( ...
75
0
from typing import Any class __lowercase : def __init__( self , A_ ) ->str: '''simple docstring''' __lowerCAmelCase : Any = data __lowerCAmelCase : Dict = None def __repr__( self ) ->Any: ...
275
'''simple docstring''' import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_t...
75
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..bit import BitConfig a_ = logging.get_logger(__name__) a_ = { """Intel/dpt-large""": """https://huggingface.co/Intel/dpt-large/resolve/main/config.json""", # See all DPT models at https...
340
'''simple docstring''' import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, Ada...
75
0
'''simple docstring''' import re import tempfile from pathlib import Path import pytest import yaml from datasets.utils.readme import ReadMe # @pytest.fixture # def example_yaml_structure(): A__ : List[str] =yaml.safe_load( '''\ name: \"\" allow_empty: false all...
70
'''simple docstring''' import copy import os import cva import numpy as np from matplotlib import pyplot as plt class __UpperCamelCase : def __init__( self ): """simple docstring""" lowerCamelCase_ ='''''' lowerCamelCase_ ...
75
0
"""simple docstring""" def a__ ( snake_case__ ) -> bool: if not isinstance(__snake_case , __snake_case ): raise ValueError("""Input series is not valid, valid series - [2, 4, 6]""" ) if len(__snake_case ) == 0: raise ValueError("""Input list must be a non emp...
291
'''simple docstring''' from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline a_ : Any = lo...
75
0
"""simple docstring""" import itertools import math def lowerCAmelCase__ ( _UpperCamelCase : int ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or ...
150
'''simple docstring''' import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speech_to_text import VOCAB...
75
0
"""simple docstring""" def _snake_case ( lowercase__ ): if not nums: # Makes sure that the list is not empty raise ValueError('List is empty' ) _lowerCamelCase : int = sum(__snake_case ) / len(__snake_case ) # Calculate the average return sum(...
96
'''simple docstring''' import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis_float32 (there's also the fix_lavis branch) # also note: to convert Vicuna checkpoints,...
75
0
"""simple docstring""" import inspect import re from hashlib import shaaaa from typing import Dict, List from .arrow import arrow from .audiofolder import audiofolder from .csv import csv from .imagefolder import imagefolder from .json import json from .pandas import pandas from .parquet import parquet from .sql im...
347
'''simple docstring''' from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __UpperCamelCase ( lowerCamelCase__ ): def lowercase__ ( self, lowerCAmelCase ): """si...
75
0
"""simple docstring""" from __future__ import annotations from decimal import Decimal from math import * # noqa: F403 from sympy import diff def A_ ( _lowercase, _lowercase, _lowercase = 10**-10 ): '''simple docstring''' snake_case_ :List[str] = a while True: ...
66
'''simple docstring''' import os import unittest from transformers import FunnelTokenizer, FunnelTokenizerFast from transformers.models.funnel.tokenization_funnel import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin ...
75
0
'''simple docstring''' import io import os import unicodedata from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = """▁...
141
'''simple docstring''' import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStructProcessor, ...
75
0
import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_trust_remote_code from ...f...
52
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, ...
75
0
import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor A__ : Any = logging.get_logger(__name__) class _UpperCAmelCase ( lowerCamelCase__ ): """simple docstring""" def __init__( self : Optional[int], *lowerCamelCase ...
207
'''simple docstring''' from __future__ import annotations def a_ ( __snake_case : str , __snake_case : list[str] | None = None , __snake_case : dict[str, float] | None = None , __snake_case : bool = False , ) -> tup...
75
0
import argparse import logging import os from datetime import datetime import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, RandomSampler, TensorDataset from tqdm import tqdm from transformers import GPTaLMHeadModel _UpperCamelCase = logging.getLogger(__name__) ...
275
'''simple docstring''' import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import ...
75
0
import argparse import glob import importlib.util import os import re import black from doc_builder.style_doc import style_docstrings_in_code # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py a_ = """src/diffusers""...
340
'''simple docstring''' a_ : Any = [ 9_99, 8_00, 7_99, 6_00, 5_99, 5_00, 4_00, 3_99, 3_77, 3_55, 3_33, 3_11, 2_88, 2_66, 2_44, 2_22, 2_00, 1_99, 1_77, 1_55, 1_33, 1_11, 88, 66, 44, 22,...
75
0
'''simple docstring''' from datetime import datetime import requests from bsa import BeautifulSoup if __name__ == "__main__": A__ : List[str] =input('''Enter image url: ''').strip() print(F"""Downloading image from {url} ...""") A__ : Tuple =Beaut...
70
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) a_ : Union[str, Any] = { """configuration_funnel""": ["""FUNNEL_PRETRAIN...
75
0
"""simple docstring""" from __future__ import annotations lowerCAmelCase : Any = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def a__ ( snake_case__ , snake_case__ , snake_case__ , snake_case__ , snake_case__ ...
291
'''simple docstring''' 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 ...
75
0
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( ...
150
'''simple docstring''' import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteSchedule...
75
0
"""simple docstring""" from collections.abc import Callable import numpy as np def _snake_case ( lowercase__ , lowercase__ , lowercase__ , lowercase__ , lowercase__ ): _lowerCamelCase : Optional[int] = int(np.ceil((...
96
'''simple docstring''' from __future__ import annotations import unittest from transformers import XGLMConfig, XGLMTokenizer, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixi...
75
0
"""simple docstring""" from sympy import diff, lambdify, symbols from sympy.functions import * # noqa: F403 def _a ( _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE , _SCREAMING_SNAKE_CASE = "x" , _SCREAMING_SNAKE_CASE = 10**-10 , _SCREAMING_SNAKE_CASE = 1 , ) -> complex: ...
347
'''simple docstring''' import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelin...
75
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, re...
66
'''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 a_ : Optional[int] = logging.get_logger(__name__) a_ : Optional[int] ...
75
0
'''simple docstring''' import torch from diffusers import DiffusionPipeline class lowerCAmelCase ( lowerCamelCase__ ): def __init__( self : int , __lowercase : Optional[int] , __lowercase : Any ): """simple docstring""" ...
141
'''simple docstring''' from typing import List from ...configuration_utils import PretrainedConfig from ...utils import logging a_ : Dict = logging.get_logger(__name__) a_ : Any = { """snap-research/efficientformer-l1-300""": ( """https://huggingf...
75
0
import os import warnings from typing import List, Optional from ...tokenization_utils_base import BatchEncoding from ...utils import logging from .configuration_rag import RagConfig __lowerCamelCase : Tuple = logging.get_logger(__name__) class A__ : def __init__( self ...
52
'''simple docstring''' import itertools import random import unittest import numpy as np from transformers import is_speech_available from transformers.testing_utils import require_torch, require_torchaudio from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin if is_spe...
75
0
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging A__ : Any = logging.get_logger(__name__) A__ : Optional[Any] = { """huggingface/time-series-transformer-tourism-monthly""": ( """https://huggingface.co/huggingfa...
207
'''simple docstring''' def a_ ( __snake_case : Any , __snake_case : List[str] ) -> str: """simple docstring""" lowerCamelCase_ ='''''' for i in table: res += inp[i - 1] return res def a_ ( ...
75
0
from dataclasses import dataclass from typing import List, Optional, Union import numpy as np import PIL from PIL import Image from ...utils import ( BaseOutput, OptionalDependencyNotAvailable, is_flax_available, is_k_diffusion_available, is_k_diffusion_version, is_onnx_available, is_tor...
275
'''simple docstring''' import importlib import json import os from collections import OrderedDict from typing import Dict, Optional, Union # Build the list of all feature extractors from ...configuration_utils import PretrainedConfig from ...dynamic_module_utils import get_class_from_dynamic_module, resolve_t...
75
0
import os import time import numpy as np import onnxruntime as ort a_ = """1""" a_ = """0""" a_ = """1""" a_ = ort.SessionOptions() a_ = ort.GraphOptimizationLevel.ORT_DISABLE_ALL print('''Create inference session...''') a_ = ["""TensorrtExecutionProvider""", "...
340
'''simple docstring''' import argparse import csv import logging import os import random import numpy as np import torch from torch.utils.data import DataLoader, RandomSampler, SequentialSampler, TensorDataset from tqdm import tqdm, trange from transformers import ( CONFIG_NAME, WEIGHTS_NAME, Ada...
75
0
'''simple docstring''' 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 transforme...
70
'''simple docstring''' import copy import os import cva import numpy as np from matplotlib import pyplot as plt class __UpperCamelCase : def __init__( self ): """simple docstring""" lowerCamelCase_ ='''''' lowerCamelCase_ ...
75
0
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor a_ = logging.get_logger(__name__) class _UpperCamelCase ( __A ): '''simple docstring''' def __init__( self : List[str] , *a : Any , **...
76
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 DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils import logging logging.set_...
76
1
import os def lowerCamelCase__ ( ): with open(os.path.dirname(_a) + "/p022_names.txt") as file: SCREAMING_SNAKE_CASE : List[str] = str(file.readlines()[0]) SCREAMING_SNAKE_CASE : List[Any] = names.replace("\"" , "").split(",") names.sort() SCREAMING_SNAKE_...
76
import os def lowerCamelCase__ ( ): with open(os.path.dirname(_a) + "/p022_names.txt") as file: SCREAMING_SNAKE_CASE : List[str] = str(file.readlines()[0]) SCREAMING_SNAKE_CASE : List[Any] = names.replace("\"" , "").split(",") names.sort() SCREAMING_SNAKE_...
76
1
import argparse import os import shutil from pathlib import Path import onnx import torch from packaging import version from torch.onnx import export from diffusers import OnnxRuntimeModel, OnnxStableDiffusionPipeline, StableDiffusionPipeline a_ = version.parse(version.parse(torch.__version__).base_version)...
76
from collections.abc import Callable import numpy as np def lowerCamelCase__ ( _a , _a , _a , _a , _a): SCREAMING_SNAKE_CASE : Dict = int(np.ceil((x_end - xa) / step_size)) SCREAMING_SNAKE_CASE : Tuple = np.zeros((n + 1,)) SCREAMING_SNAKE_CASE...
76
1
from __future__ import annotations class _UpperCamelCase : '''simple docstring''' def __init__( self : Optional[Any] , a : int = 0 ) -> Optional[Any]: """simple docstring""" SCREAMING_SNAKE_CASE : List[str] = key def ...
76
def lowerCamelCase__ ( _a , _a): return int((input_a, input_a).count(1) != 0) def lowerCamelCase__ ( ): assert or_gate(0 , 0) == 0 assert or_gate(0 , 1) == 1 assert or_gate(1 , 0) == 1 assert or_gate(1 , 1) == 1 if __name__ == "__main__": print(...
76
1
a_ = {str(digit): digit**5 for digit in range(10)} def lowerCamelCase__ ( _a): return sum(DIGITS_FIFTH_POWER[digit] for digit in str(_a)) def lowerCamelCase__ ( ): return sum( number for number in range(1000 , 1000000) if number == digits_fifth_powers_sum...
76
a_ = 8.314_4598 def lowerCamelCase__ ( _a , _a): if temperature < 0: raise Exception("Temperature cannot be less than 0 K") if molar_mass <= 0: raise Exception("Molar mass cannot be less than or equal to 0 kg/mol") else: return (3 * UNIVERSAL_GAS_CONSTANT * temperature / molar_ma...
76
1
import math from typing import List, Optional, Tuple, Union import numpy as np import torch from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils import SchedulerMixin, SchedulerOutput class _UpperCamelCase ( __A , __A ): '''simple docstring''' ...
76
a_ = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } def lowerCamelCase__ ( _a , _a , _a): SCREAMING_SNAKE_CASE : int = set() # keep track of all the paths to...
76
1
# 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 by ap...
76
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 tensorflow as tf from transformers import AutoTokenizer, TFAutoModelForSeqaSeqLM ...
76
1
import gc import random import unittest import numpy as np import torch from transformers import ( CLIPImageProcessor, CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer, CLIPVisionConfig, CLIPVisionModelWithProjection, ) from diffusers import ( DiffusionPipeline, UnCLIPImage...
76
from math import factorial def lowerCamelCase__ ( _a , _a , _a): if successes > trials: raise ValueError("successes must be lower or equal to trials") if trials < 0 or successes < 0: raise ValueError("the function is defined for non-negative integers") if not isinstance(_a , ...
76
1
from __future__ import annotations def lowerCamelCase__ ( _a , _a): # Checks if the entire collection has been sorted if len(_a) <= 1 or n <= 1: return insert_next(_a , n - 1) rec_insertion_sort(_a , n - 1) def lowerCamelCase__ ( _a , _a): # Checks ord...
76
from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class _UpperCamelCase ( __A ): '''simple docstring''' lowerCamelCase__ =CustomTokenizer pass
76
1
a_ = { 'Pillow': 'Pillow', 'accelerate': 'accelerate>=0.11.0', 'compel': 'compel==0.1.8', 'black': 'black~=23.1', 'datasets': 'datasets', 'filelock': 'filelock', 'flax': 'flax>=0.4.1', 'hf-doc-builder': 'hf-doc-builder>=0.3.0', 'huggingface-hub': 'huggingface-hub>=0.13.2', ...
76
import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex a_ = logging.getLogger(__name__) class _UpperCamelCase : '''simple docstring''' def __init__( self : Any...
76
1
import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING from ...tokenization_utils...
76
from typing import Any class _UpperCamelCase : '''simple docstring''' def __init__( self : Dict , a : Any ) -> Any: """simple docstring""" SCREAMING_SNAKE_CASE : int = data SCREAMING_SNAKE_CASE : int = None ...
76
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a_ = { 'configuration_time_series_transformer': [ 'TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TimeSeriesTransformerConfig', ], } try: if not is_torch...
76
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger a_ = get_logger(__name__) class _UpperCamelCase ( enum.Enum ): '''simple docstring''' lowerCamelCase__ ='all_checks' lowerCamelCase__...
76
1
import os from collections.abc import Iterator def lowerCamelCase__ ( _a = "."): for dir_path, dir_names, filenames in os.walk(_a): SCREAMING_SNAKE_CASE : Dict = [d for d in dir_names if d != "scripts" and d[0] not in "._"] for filename in filenames: if filename == "__init__.py...
76
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCamelCase__ ( _a , _a): # Load checkpoint SCREAMING_SNAKE_CA...
76
1
import time from dataclasses import dataclass from multiprocessing import Pool from unittest import TestCase from unittest.mock import patch import multiprocess import numpy as np import pytest from datasets.utils.py_utils import ( NestedDataStructure, asdict, iflatmap_unordered, map_nested, tem...
76
def lowerCamelCase__ ( _a , _a): _validate_point(_a) _validate_point(_a) if len(_a) != len(_a): raise ValueError("Both points must be in the same n-dimensional space") return float(sum(abs(a - b) for a, b in zip(_a , _a))) def lowerCamelCase__ ( _a): if point: if...
76
1
from typing import Any class _UpperCamelCase : '''simple docstring''' def __init__( self : Dict , a : Any ) -> Any: """simple docstring""" SCREAMING_SNAKE_CASE : int = data SCREAMING_SNAKE_CASE : int = None ...
76
from ...configuration_utils import PretrainedConfig from ...utils import logging a_ = logging.get_logger(__name__) a_ = { 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at https://huggingface.co/models?filter=vit_msn ...
76
1
import importlib import inspect import json import os import re import shutil import sys from pathlib import Path from typing import Dict, Optional, Union from urllib import request from huggingface_hub import HfFolder, cached_download, hf_hub_download, model_info from packaging import version from .. import __vers...
76
import baseaa def lowerCamelCase__ ( _a): return baseaa.aaaencode(string.encode("utf-8")) def lowerCamelCase__ ( _a): return baseaa.aaadecode(_a).decode("utf-8") if __name__ == "__main__": import doctest doctest.testmod()
76
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) a_ = { 'configuration_gpt_bigcode': ['GPT_BIGCODE_PRETRAINED_CONFIG_ARCHIVE_MAP', 'GPTBigCodeConfig'], } try: if not is_torch_available(): raise OptionalDepende...
76
from datetime import datetime as dt import os from github import Github a_ = [ 'good first issue', 'good second issue', 'good difficult issue', 'feature request', 'new model', 'wip', ] def lowerCamelCase__ ( ): SCREAMING_SNAKE_CASE : int = Github(os.en...
76
1
import comet # From: unbabel-comet import torch import datasets a_ = datasets.logging.get_logger(__name__) a_ = '\\n@inproceedings{rei-EtAl:2020:WMT,\n author = {Rei, Ricardo and Stewart, Craig and Farinha, Ana C and Lavie, Alon},\n title = {Unbabel\'s Participation in the WMT20 Metr...
76
from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_res...
76
1
import warnings from typing import List, Optional, Union from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class _UpperCamel...
76
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 a_ = logging.get_logger(__name__) a_ = {'vocab_file': 'vocab.txt'} ...
76
1
from __future__ import annotations def lowerCamelCase__ ( _a = 4): SCREAMING_SNAKE_CASE : Optional[Any] = abs(_a) or 4 return [[1 + x + y * row_size for x in range(_a)] for y in range(_a)] def lowerCamelCase__ ( _a): return reverse_row(transpose(_a)) # OR.. transpo...
76
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching between checkout...
76
1
import copy from typing import Any, Dict, List, Optional, Union import numpy as np from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeature from ...utils import TensorType, ...
76
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 ...
76
1
def lowerCamelCase__ ( _a): SCREAMING_SNAKE_CASE : str = 0 # if input_string is "aba" than new_input_string become "a|b|a" SCREAMING_SNAKE_CASE : Any = "" SCREAMING_SNAKE_CASE : Any = "" # append each character + "|" in new_string for range(0, length...
76
import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def lowerCamelCase__ ( _a): SCREAMING_SNAKE_CASE : int = {} SCREAMING_SNAKE_CASE : Any = token...
76
1
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_torch, slow, ) from tra...
76
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 DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils import logging logging.set_...
76
1
from __future__ import annotations import math import numpy as np from numpy.linalg import norm def lowerCamelCase__ ( _a , _a): return math.sqrt(sum(pow(a - b , 2) for a, b in zip(_a , _a))) def lowerCamelCase__ ( _a , _a): if dataset.ndim != value_array...
76
import os def lowerCamelCase__ ( ): with open(os.path.dirname(_a) + "/p022_names.txt") as file: SCREAMING_SNAKE_CASE : List[str] = str(file.readlines()[0]) SCREAMING_SNAKE_CASE : List[Any] = names.replace("\"" , "").split(",") names.sort() SCREAMING_SNAKE_...
76
1
import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from tax import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffusers.pipelines.spectrogram_diffusion import S...
76
from collections.abc import Callable import numpy as np def lowerCamelCase__ ( _a , _a , _a , _a , _a): SCREAMING_SNAKE_CASE : Dict = int(np.ceil((x_end - xa) / step_size)) SCREAMING_SNAKE_CASE : Tuple = np.zeros((n + 1,)) SCREAMING_SNAKE_CASE...
76
1
from timeit import timeit a_ = { 'MALAYALAM': True, 'String': False, 'rotor': True, 'level': True, 'A': True, 'BB': True, 'ABC': False, 'amanaplanacanalpanama': True, # "a man a plan a canal panama" } # Ensure our test data is valid assert all((key == key[::-1]) is value for ke...
76
def lowerCamelCase__ ( _a , _a): return int((input_a, input_a).count(1) != 0) def lowerCamelCase__ ( ): assert or_gate(0 , 0) == 0 assert or_gate(0 , 1) == 1 assert or_gate(1 , 0) == 1 assert or_gate(1 , 1) == 1 if __name__ == "__main__": print(...
76
1
from __future__ import annotations class _UpperCamelCase : '''simple docstring''' def __init__( self : Tuple , a : str , a : str ) -> Any: """simple docstring""" SCREAMING_SNAKE_CASE ,SCREAMING_SNAKE_CASE : str...
76
a_ = 8.314_4598 def lowerCamelCase__ ( _a , _a): if temperature < 0: raise Exception("Temperature cannot be less than 0 K") if molar_mass <= 0: raise Exception("Molar mass cannot be less than or equal to 0 kg/mol") else: return (3 * UNIVERSAL_GAS_CONSTANT * temperature / molar_ma...
76
1
from collections import Counter from timeit import timeit def lowerCamelCase__ ( _a = "" , ): return sum(c % 2 for c in Counter(input_str.replace(" " , "").lower()).values()) < 2 def lowerCamelCase__ ( _a = ""): if len(_a) == 0: return True SCREAMING_SNAKE_CASE ...
76
a_ = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } def lowerCamelCase__ ( _a , _a , _a): SCREAMING_SNAKE_CASE : int = set() # keep track of all the paths to...
76
1
a_ = { 'a': 'AAAAA', 'b': 'AAAAB', 'c': 'AAABA', 'd': 'AAABB', 'e': 'AABAA', 'f': 'AABAB', 'g': 'AABBA', 'h': 'AABBB', 'i': 'ABAAA', 'j': 'BBBAA', 'k': 'ABAAB', 'l': 'ABABA', 'm': 'ABABB', 'n': 'ABBAA', 'o': 'ABBAB', 'p': 'ABBBA', 'q': 'ABBBB',...
76
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 tensorflow as tf from transformers import AutoTokenizer, TFAutoModelForSeqaSeqLM ...
76
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available a_ = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass else: a_ = ['BartphoTokenize...
76
from math import factorial def lowerCamelCase__ ( _a , _a , _a): if successes > trials: raise ValueError("successes must be lower or equal to trials") if trials < 0 or successes < 0: raise ValueError("the function is defined for non-negative integers") if not isinstance(_a , ...
76
1
from __future__ import annotations import unittest from transformers import MobileBertConfig, is_tf_available from transformers.models.auto import get_values from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelT...
76
from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class _UpperCamelCase ( __A ): '''simple docstring''' lowerCamelCase__ =CustomTokenizer pass
76
1
def lowerCamelCase__ ( _a): SCREAMING_SNAKE_CASE : Optional[int] = len(_a) for i in range(1 , _a): SCREAMING_SNAKE_CASE : Optional[int] = collection[i] SCREAMING_SNAKE_CASE : Dict = 0 SCREAMING_SNAKE_CASE : Tuple = i - 1 whil...
76
import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex a_ = logging.getLogger(__name__) class _UpperCamelCase : '''simple docstring''' def __init__( self : Any...
76
1
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_seed from accelerate import Acce...
76
from typing import Any class _UpperCamelCase : '''simple docstring''' def __init__( self : Dict , a : Any ) -> Any: """simple docstring""" SCREAMING_SNAKE_CASE : int = data SCREAMING_SNAKE_CASE : int = None ...
76
1
a_ = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } def lowerCamelCase__ ( _a , _a , _a): SCREAMING_SNAKE_CASE : int = set() # keep track of all the paths to...
76
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger a_ = get_logger(__name__) class _UpperCamelCase ( enum.Enum ): '''simple docstring''' lowerCamelCase__ ='all_checks' lowerCamelCase__...
76
1
import argparse import json from pathlib import Path import torch import torchaudio from datasets import load_dataset from huggingface_hub import hf_hub_download from transformers import ASTConfig, ASTFeatureExtractor, ASTForAudioClassification from transformers.utils import logging logging.set_verbosity_info() a...
76
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCamelCase__ ( _a , _a): # Load checkpoint SCREAMING_SNAKE_CA...
76
1
class _UpperCamelCase : '''simple docstring''' def __init__( self : List[Any] ) -> Optional[Any]: """simple docstring""" SCREAMING_SNAKE_CASE : List[Any] = 0 SCREAMING_SNAKE_CASE : Any = 0 SCREAMING_SNAKE_CASE : Optional...
76
def lowerCamelCase__ ( _a , _a): _validate_point(_a) _validate_point(_a) if len(_a) != len(_a): raise ValueError("Both points must be in the same n-dimensional space") return float(sum(abs(a - b) for a, b in zip(_a , _a))) def lowerCamelCase__ ( _a): if point: if...
76
1
import unittest from transformers import BigBirdTokenizer, BigBirdTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, require_torch, slow from transformers.utils import cached_property from ...test_tokenization_common import TokenizerTesterMixin a_ = ...
76
from ...configuration_utils import PretrainedConfig from ...utils import logging a_ = logging.get_logger(__name__) a_ = { 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at https://huggingface.co/models?filter=vit_msn ...
76
1
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, AutoModelWithLMHead, A...
76
import baseaa def lowerCamelCase__ ( _a): return baseaa.aaaencode(string.encode("utf-8")) def lowerCamelCase__ ( _a): return baseaa.aaadecode(_a).decode("utf-8") if __name__ == "__main__": import doctest doctest.testmod()
76
1
import math from typing import Callable, List, Optional, Union import numpy as np import PIL import torch from PIL import Image from transformers import CLIPTextModel, CLIPTokenizer from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_u...
76
from datetime import datetime as dt import os from github import Github a_ = [ 'good first issue', 'good second issue', 'good difficult issue', 'feature request', 'new model', 'wip', ] def lowerCamelCase__ ( ): SCREAMING_SNAKE_CASE : int = Github(os.en...
76
1
import argparse import logging import os import sys import numpy as np import onnxruntime import torch from bart_onnx.generation_onnx import BARTBeamSearchGenerator from bart_onnx.reduce_onnx_size import remove_dup_initializers import transformers from transformers import BartForConditionalGeneration, BartTokenizer...
76
from typing import Dict, List, Optional, Union import numpy as np from transformers.utils import is_vision_available from transformers.utils.generic import TensorType from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_res...
76
1
from typing import Any, Dict, List, Union from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging, requires_backends from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from ..image_utils import load_image if is_torch_available(): import torch from ...
76
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 a_ = logging.get_logger(__name__) a_ = {'vocab_file': 'vocab.txt'} ...
76
1
from collections.abc import Sequence def lowerCamelCase__ ( _a , _a = False): if not arr: return 0 SCREAMING_SNAKE_CASE : int = 0 if allow_empty_subarrays else float("-inf") SCREAMING_SNAKE_CASE : Optional[int] = 0.0 for num in arr: SCREAMING_SNAKE_CASE ...
76
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switching between checkout...
76
1
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available a_ = {'configuration_mmbt': ['MMBTConfig']} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass else: a_ ...
76
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 ...
76
1
import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor a_ = logging.get_logger(__name__) class _UpperCamelCase ( __A ): '''simple docstring''' def __init__( self : Dict , *a : Dict , **a ...
76
import multiprocessing import time from arguments import PretokenizationArguments from datasets import load_dataset from transformers import AutoTokenizer, HfArgumentParser def lowerCamelCase__ ( _a): SCREAMING_SNAKE_CASE : int = {} SCREAMING_SNAKE_CASE : Any = token...
76
1
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartaaTokenizer, MBartaaTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ...
76
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 DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils import logging logging.set_...
76
1
import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask a_ = logging.getLogger(__name__) class _UpperCamelCase ( __A ): '''simple docstring''' def __init__( self ...
76
import os def lowerCamelCase__ ( ): with open(os.path.dirname(_a) + "/p022_names.txt") as file: SCREAMING_SNAKE_CASE : List[str] = str(file.readlines()[0]) SCREAMING_SNAKE_CASE : List[Any] = names.replace("\"" , "").split(",") names.sort() SCREAMING_SNAKE_...
76
1
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() a_ = logging.get_logger(__name__) a_ = 'https://openaipublic.azureedge.net/jukebox/mode...
76
from collections.abc import Callable import numpy as np def lowerCamelCase__ ( _a , _a , _a , _a , _a): SCREAMING_SNAKE_CASE : Dict = int(np.ceil((x_end - xa) / step_size)) SCREAMING_SNAKE_CASE : Tuple = np.zeros((n + 1,)) SCREAMING_SNAKE_CASE...
76
1
def lowerCamelCase__ ( _a , _a , _a): return round(float(moles / volume) * nfactor) def lowerCamelCase__ ( _a , _a , _a): return round(float((moles * 0.0821 * temperature) / (volume))) def lowerCamelCase__ ( _a , _a , _a): return...
76
def lowerCamelCase__ ( _a , _a): return int((input_a, input_a).count(1) != 0) def lowerCamelCase__ ( ): assert or_gate(0 , 0) == 0 assert or_gate(0 , 1) == 1 assert or_gate(1 , 0) == 1 assert or_gate(1 , 1) == 1 if __name__ == "__main__": print(...
76
1
import math_equivalence # From: git+https://github.com/hendrycks/math.git import datasets a_ = '\\n@article{hendrycksmath2021,\n title={Measuring Mathematical Problem Solving With the MATH Dataset},\n author={Dan Hendrycks\n and Collin Burns\n and Saurav Kadavath\n and Akul Arora\n and Steven ...
76
a_ = 8.314_4598 def lowerCamelCase__ ( _a , _a): if temperature < 0: raise Exception("Temperature cannot be less than 0 K") if molar_mass <= 0: raise Exception("Molar mass cannot be less than or equal to 0 kg/mol") else: return (3 * UNIVERSAL_GAS_CONSTANT * temperature / molar_ma...
76
1
import unittest import numpy as np from transformers.testing_utils import require_flax, require_tf, require_torch from transformers.utils import ( expand_dims, flatten_dict, is_flax_available, is_tf_available, is_torch_available, reshape, squeeze, transpose, ) if is_flax_available(...
76
a_ = { 'A': ['B', 'C', 'E'], 'B': ['A', 'D', 'E'], 'C': ['A', 'F', 'G'], 'D': ['B'], 'E': ['A', 'B', 'D'], 'F': ['C'], 'G': ['C'], } def lowerCamelCase__ ( _a , _a , _a): SCREAMING_SNAKE_CASE : int = set() # keep track of all the paths to...
76
1
import requests def lowerCamelCase__ ( _a , _a): SCREAMING_SNAKE_CASE : Dict = {"Content-Type": "application/json"} SCREAMING_SNAKE_CASE : Optional[int] = requests.post(_a , json={"text": message_body} , headers=_a) if response.status_code != 200: ...
76
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 tensorflow as tf from transformers import AutoTokenizer, TFAutoModelForSeqaSeqLM ...
76
1
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 a_ = logging.get_logger(__name__) a_ = {'vocab_file': 'vocab.txt'} ...
76
from math import factorial def lowerCamelCase__ ( _a , _a , _a): if successes > trials: raise ValueError("successes must be lower or equal to trials") if trials < 0 or successes < 0: raise ValueError("the function is defined for non-negative integers") if not isinstance(_a , ...
76
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available a_ = {'configuration_speech_encoder_decoder': ['SpeechEncoderDecoderConfig']} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except Opti...
76
from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class _UpperCamelCase ( __A ): '''simple docstring''' lowerCamelCase__ =CustomTokenizer pass
76
1
from __future__ import annotations def lowerCamelCase__ ( _a , _a , _a): if days_between_payments <= 0: raise ValueError("days_between_payments must be > 0") if daily_interest_rate < 0: raise ValueError("daily_interest_rate must be >= 0") if principal <= 0: raise ValueError("prin...
76
import logging import random import ray from transformers import RagConfig, RagRetriever, RagTokenizer from transformers.models.rag.retrieval_rag import CustomHFIndex a_ = logging.getLogger(__name__) class _UpperCamelCase : '''simple docstring''' def __init__( self : Any...
76
1
from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...onnx.utils import compute_effective_axis_dimension from ...utils import logging if TYPE_CHECKING: ...
76
from typing import Any class _UpperCamelCase : '''simple docstring''' def __init__( self : Dict , a : Any ) -> Any: """simple docstring""" SCREAMING_SNAKE_CASE : int = data SCREAMING_SNAKE_CASE : int = None ...
76
1
def lowerCamelCase__ ( _a , _a): return int(input_a == input_a == 0) def lowerCamelCase__ ( ): print("Truth Table of NOR Gate:") print("| Input 1 | Input 2 | Output |") print(f"| 0 | 0 | {nor_gate(0 , 0)} |") print(f"| 0 | 1 ...
76
import enum import os from hashlib import shaaaa from typing import Optional from .. import config from .logging import get_logger a_ = get_logger(__name__) class _UpperCamelCase ( enum.Enum ): '''simple docstring''' lowerCamelCase__ ='all_checks' lowerCamelCase__...
76
1
from typing import List import datasets from datasets.tasks import AudioClassification from ..folder_based_builder import folder_based_builder a_ = datasets.utils.logging.get_logger(__name__) class _UpperCamelCase ( folder_based_builder.FolderBasedBuilderConfig ): '''simple docstri...
76
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCamelCase__ ( _a , _a): # Load checkpoint SCREAMING_SNAKE_CA...
76
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, StableDiffusionSAGPipeline, UNetaDConditionModel, ) from diffusers.utils import slow, torch_device from diffusers.util...
76
def lowerCamelCase__ ( _a , _a): _validate_point(_a) _validate_point(_a) if len(_a) != len(_a): raise ValueError("Both points must be in the same n-dimensional space") return float(sum(abs(a - b) for a, b in zip(_a , _a))) def lowerCamelCase__ ( _a): if point: if...
76
1
import argparse import json import numpy import torch from transformers.models.xlm.tokenization_xlm import VOCAB_FILES_NAMES from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCamelCase__ ( _a , _a): # Load checkpoint SCREAMING_SNAKE_CA...
76
from ...configuration_utils import PretrainedConfig from ...utils import logging a_ = logging.get_logger(__name__) a_ = { 'sayakpaul/vit-msn-base': 'https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json', # See all ViT MSN models at https://huggingface.co/models?filter=vit_msn ...
76
1
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 DetrConfig, DetrForObjectDetection, DetrForSegmentation, DetrImageProcessor, ResNetConfig from transformers.utils import logging logging.set_...
76
import baseaa def lowerCamelCase__ ( _a): return baseaa.aaaencode(string.encode("utf-8")) def lowerCamelCase__ ( _a): return baseaa.aaadecode(_a).decode("utf-8") if __name__ == "__main__": import doctest doctest.testmod()
76
1