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 math import pow, sqrt def A_ ( *snake_case : float ) -> bool: '''simple docstring''' __UpperCamelCase = len(snake_case ) > 0 and all(value > 0.0 for value in values ) return result def A_ ( snake_case : ...
328
from __future__ import annotations from collections import deque class SCREAMING_SNAKE_CASE__ : """simple docstring""" def __init__( self , SCREAMING_SNAKE_CASE_ )-> int: '''simple docstring''' __UpperCamelCase = [] ...
328
1
from __future__ import annotations def _lowerCamelCase( lowercase__ , lowercase__ ) -> List[str]: '''simple docstring''' print(F'Vertex\tShortest Distance from vertex {src}' ) for i, d in enumerate(lowercase__ ): print(F'{i}\t\t{d}' ) def _lowerC...
304
def _lowerCamelCase( lowercase__ = 1_0_0_0 ) -> int: '''simple docstring''' __lowercase= 2**power __lowercase= str(lowercase__ ) __lowercase= list(lowercase__ ) __lowercase= 0 for i in list_num: sum_of_num += int(lowercase__ ) return sum_o...
304
1
"""simple docstring""" import argparse import logging import pickle from collections import Counter logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S""", level=logging.INFO ) UpperCAmelCase_ : Dict = logging.getLogger(__name__)...
91
"""simple docstring""" from __future__ import annotations class lowerCAmelCase__ : '''simple docstring''' def __init__( self : Any , lowercase_ : int = 0): '''simple docstring''' SCREAMING_SNAKE_CASE_ : List[Any] ...
91
1
"""simple docstring""" import unittest from transformers import PegasusTokenizer, PegasusTokenizerFast 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 Toke...
316
"""simple docstring""" # Note: if you intend to run this script make sure you look under scripts/fsmt/ # to locate the appropriate script to do the work correctly. There is a set of scripts to: # - download and prepare data and run the conversion script # - perform eval to get the best hparam into the config # -...
316
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _SCREAMING_SNAKE_CASE : Tuple = { "configuration_conditional_detr": [ "CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP"...
85
import math from datetime import datetime, timedelta def __A ( __lowerCamelCase ) -> datetime: a = year % 19 a = year % 4 a = year % 7 a = math.floor(year / 100 ) a = math.floor((13 + 8 * leap_...
228
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokeni...
88
import argparse import json import math import os import time import traceback import zipfile from collections import Counter import requests def SCREAMING_SNAKE_CASE__ ( __a , __a=None ): snake_case_ : Optional[int] = None if token is not None: snake_c...
88
1
# 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 checko...
257
import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def __lowercase ( a__ ) -> Tuple: __SCREAMING_SNAKE_CASE = [ 'encoder.version', 'decoder.version', 'model.encoder.version', ...
257
1
"""simple docstring""" # 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/...
11
"""simple docstring""" from __future__ import annotations def lowercase ( lowerCAmelCase__ : list[int] , lowerCAmelCase__ : list[int] , lowerCAmelCase__ : list[int] , lowerCAmelCase__ : list[list[str]] , lowerCAmelCase__ : int , ) -> None: __a ...
11
1
import mpmath # for roots of unity import numpy as np class A : def __init__(self : Union[str, Any] , __UpperCAmelCase : Any=None , __UpperCAmelCase : Optional[int]=None ) -> Dict: """simple docstring""" UpperCAm...
65
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer fro...
2
0
'''simple docstring''' 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...
96
'''simple docstring''' import re import string from collections import Counter import sacrebleu import sacremoses from packaging import version import datasets lowerCAmelCase: Dict = '\n@inproceedings{xu-etal-2016-optimizing,\n title = {Optimizing Statistical Machine Translation for Text Sim...
96
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices lowerCamelCase_ = logging.get_logger(__name__) class __A( __lowerCamelCase , __lowerCamelCase ): """simple ...
244
import unittest from transformers import DebertaVaTokenizer, DebertaVaTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin lowerCamelCase_ = get_tests_dir('''fixtures/spiece.model''...
244
1
import os from shutil import copyfile from typing import List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging __UpperCAmelCase : List[str] = logging.get_logger(__name__) __UpperCAmelCase : List[Any] = {"...
315
def a ( SCREAMING_SNAKE_CASE_ : str ): """simple docstring""" return "".join(chr(ord(SCREAMING_SNAKE_CASE_ ) - 3_2 ) if '''a''' <= char <= '''z''' else char for char in word ) if __name__ == "__main__": from doctest import testmod t...
315
1
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ = logging.get_logger(__name__) lowerCAmelCase__ = { 'huggingface/time-series-transformer-tourism-monthly': ( 'https://huggingface.co/huggingface/tim...
11
def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ ) -> list: if len(SCREAMING_SNAKE_CASE_ ) <= 1: return [tuple(SCREAMING_SNAKE_CASE_ )] lowerCAmelCase__ : Optional[Any] = [] def generate(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): ...
212
0
def _snake_case( SCREAMING_SNAKE_CASE__ : float , SCREAMING_SNAKE_CASE__ : float , SCREAMING_SNAKE_CASE__ : float , SCREAMING_SNAKE_CASE__ : float , SCREAMING_SNAKE_CASE__ : float , ) -> float: '''simple ...
357
import warnings from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis...
282
0
'''simple docstring''' from urllib.parse import quote import pytest from datasets.utils.hub import hf_hub_url @pytest.mark.parametrize('repo_id' , ['canonical_dataset_name', 'org-name/dataset-name'] ) @pytest.mark.parametrize('path' , ['filename.csv', 'filename with blanks.csv'] ) @pytest.mar...
42
import random from .binary_exp_mod import bin_exp_mod def _lowerCAmelCase ( __lowerCAmelCase , __lowerCAmelCase=1000 ) -> str: """simple docstring""" if n < 2: return False if n % 2 == 0: return n == 2 # this means n is odd ...
230
0
from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_herbert import HerbertTokenizer lowercase__ : str = logging.get_logger(__name__) lowercase__ : Optional[Any] = {"vocab_file": "vocab.js...
354
# Author: OMKAR PATHAK, Nwachukwu Chidiebere # Use a Python dictionary to construct the graph. from __future__ import annotations from pprint import pformat from typing import Generic, TypeVar lowercase__ : str = TypeVar("T") class a__ ( Generic[T] ): def __init__( self ...
180
0
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING _lowerCamelCase : Optional[int] = logging.get_logger(__name__) _lowerCamelCase : Optional[Any] = { "ut/deta": "http...
28
from __future__ import annotations from random import choice def __UpperCamelCase ( _A : str ) ->int: """simple docstring""" return choice(_A ) def __UpperCamelCase ( _A : list[int] , _A : int ) ->int: """simple docstring""" ...
154
0
'''simple docstring''' import os from collections.abc import Iterator def lowerCAmelCase_ ( snake_case_ : str = "." ) -> Iterator[str]: '''simple docstring''' for dir_path, dir_names, filenames in os.walk(snake_case_ ): UpperCAmelCase_ = [d for d in ...
358
'''simple docstring''' import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaF...
106
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : List[str] = { 'configuration_blenderbot_small': [ 'BLENDERBOT...
305
A : Union[str, Any] = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} A : List[Any] = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def UpperCamelCase ( __magic_name__ : dict[int, list[int]] , __magic_name__ : int , __magic_name__ ...
305
1
'''simple docstring''' import argparse import collections import torch from flax import traverse_util from tax import checkpoints from transformers import TaConfig, TaEncoderModel, TaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def UpperCamelCase ...
123
'''simple docstring''' __lowerCAmelCase : Dict ="\n# Installazione di Transformers\n! pip install transformers datasets\n# Per installare dalla fonte invece dell'ultima versione rilasciata, commenta il comando sopra e\n# rimuovi la modalità commento al comando seguente.\n# ! pip install git+https...
123
1
# 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 applic...
11
def _UpperCAmelCase (UpperCamelCase__ : str , UpperCamelCase__ : bool = False ): if not isinstance(UpperCamelCase__ , UpperCamelCase__ ): _A : Optional[Any] = f"Expected string as input, found {type(UpperCamelCase__ )}" ...
11
1
"""simple docstring""" _A = '''Alexander Joslin''' import operator as op from .stack import Stack def lowerCamelCase__ ( a__ : str ) -> int: UpperCamelCase_ = {"""*""": op.mul, """/""": op.truediv, """+""": op.add, """-""": op.sub} UpperCamelCase_...
368
from __future__ import annotations from typing import Any class lowercase_ : def __init__( self , __UpperCamelCase = 6 ): """simple docstring""" UpperCamelCase_ = None UpperCamelCase_ = None self.create_linked_list(__UpperCamelCa...
261
0
"""simple docstring""" import time from contextlib import contextmanager from pathlib import Path import pytest import requests from huggingface_hub.hf_api import HfApi, HfFolder __lowerCamelCase = "__DUMMY_TRANSFORMERS_USER__" __lowerCamelCase = "Dummy User" __lowerCamelCas...
221
"""simple docstring""" import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets __lowerCamelCase = "\\n@inproceedings{popovic-2015-chrf,\n title = \"chr{F}: character n-gram {F}-score for automatic {MT} evaluation\",\n author = \"Popovi{\'c}, M...
221
1
import json import os import unittest from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES, BioGptTokenizer from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTesterMixin class SCREAMING_SNAKE_CASE__ ( lowerCamelCase__ , unittest.TestC...
171
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 lowercase : Optional[int] = ...
171
1
import random from typing import Any def lowerCamelCase_ ( _a : list ): '''simple docstring''' for _ in range(len(_a ) ): UpperCAmelCase_ : Tuple = random.randint(0 , len(_a ) - 1 ) UpperCAmelCase_ : List[Any] = random.randint(0 ...
345
import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel from diffusers import DDIMScheduler, LDMPipeline, UNetaDModel, VQModel from diffusers.utils.testing_utils import enable_full_determinism, require_torch, slow, torch_device enable_full_determinism() clas...
345
1
'''simple docstring''' import argparse import logging import os import re import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, DataCollatorForLanguageModeling, PushToHubCallback, TFAutoModelForMaskedLM, create_optimizer, ) lowerCAmelCase :str = log...
275
'''simple docstring''' def lowerCamelCase ( lowerCAmelCase : str ): """simple docstring""" if not all(x.isalpha() for x in string ): raise ValueError('String must only contain alphabetic characters.' ) __magic_name__ : int = sorted(string.lower() ) return len(l...
275
1
'''simple docstring''' __lowerCamelCase = {} def UpperCAmelCase__ ( UpperCAmelCase__, UpperCAmelCase__, UpperCAmelCase__ ) -> int: # if we are absent twice, or late 3 consecutive days, # no further prize strings are possible if late == 3 or absent == 2: ...
162
'''simple docstring''' import argparse import datetime import json import time import warnings from logging import getLogger from pathlib import Path from typing import Dict, List import torch from tqdm import tqdm from transformers import AutoModelForSeqaSeqLM, AutoTokenizer from utils import calculate_bleu...
162
1
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import XLMRobertaTokenizerFast from diffusers import DDIMScheduler, KandinskyInpaintPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel from diffusers.pipelines.kandinsky.text_en...
353
def _a ( SCREAMING_SNAKE_CASE = 10_00 ): """simple docstring""" return sum(e for e in range(3 , SCREAMING_SNAKE_CASE ) if e % 3 == 0 or e % 5 == 0 ) if __name__ == "__main__": print(f"""{solution() = }""")
93
0
import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": UpperCamelCase = pd.read_csv('''sample_data.csv''', header=None) UpperCamelCas...
87
'''simple docstring''' import json import os import torch from diffusers import UNetaDModel os.makedirs('hub/hopper-medium-v2/unet/hor32', exist_ok=True) os.makedirs('hub/hopper-medium-v2/unet/hor128', exist_ok=True) os.makedirs('hub/hopper-medium-v2/value_function', exist_ok=True) ...
163
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) __magic_name__: List[str] = { "configuration_mobilebert": [ "MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_M...
138
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __magic_name__: List[Any] = { "configuration_conditional_detr": [ "CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP", "ConditionalDetrConfi...
138
1
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torc...
175
from transformers import HfArgumentParser, TensorFlowBenchmark, TensorFlowBenchmarkArguments def __lowercase ( ): UpperCamelCase_ : Optional[Any] = HfArgumentParser(lowerCamelCase ) UpperCamelCase_ : Tuple = parser.parse_args_into_dataclasses()[0] UpperCamelCase_ : ...
175
1
from functools import lru_cache def UpperCamelCase__ ( a_ ) -> set: """simple docstring""" __A = 2 __A = set() while i * i <= n: if n % i: i += 1 else: n //= i factors.add(__lowerCAmelCa...
350
# Copyright 2021 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 app...
124
0
import math import qiskit def __a ( SCREAMING_SNAKE_CASE = 1 , SCREAMING_SNAKE_CASE = 1 , SCREAMING_SNAKE_CASE = 1 ) -> qiskit.result.counts.Counts: '''simple docstring''' if ( isinstance(SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CAS...
333
def __a ( SCREAMING_SNAKE_CASE ) -> set: '''simple docstring''' __UpperCAmelCase = set() # edges = list of graph's edges __UpperCAmelCase = get_edges(SCREAMING_SNAKE_CASE ) # While there are still elements in edges list, take an arbitrary edg...
333
1
'''simple docstring''' from __future__ import annotations import os import tempfile import unittest from transformers import ConvBertConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFM...
355
'''simple docstring''' def UpperCAmelCase_ (__a : int = 1_0**1_2 ): """simple docstring""" _a : List[str] = 1 _a : Optional[int] = 0 _a : Any = 1 _a : List[str] = 1 while numerator <= 2 * min_total - 1: ...
5
0
from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class __a ( snake_case_ ): __lowercase : Union[str, Any] = """EncodecFeatureExtractor""" __lowercase : int = ("""T5Tokenizer...
196
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from .feature_extraction_utils import BatchFeature, FeatureExtractionMixin from .utils import PaddingStrategy, TensorType, is_tf_tensor, is_torch_tensor, logging, to_numpy SCREAMING_SNAKE_CASE__:List[Any] = log...
261
0
"""simple docstring""" import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets __A : Optional[int] = datasets.logging.get_logger(__name__) __A : Tuple = '''\ @inproceedings{bleurt, title={BLEURT: Learning Robust Met...
27
"""simple docstring""" from typing import Any class lowerCamelCase : def __init__( self , SCREAMING_SNAKE_CASE_ ): UpperCamelCase : Optional[int] = data UpperCamelCase : Optional[Any] = None def __repr__( self ):...
27
1
"""simple docstring""" 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, ) ...
171
"""simple docstring""" from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, flip_channel_order, get_resize_output_image_size, rescale, resize, ...
171
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { "roberta-base": "https://h...
332
'''simple docstring''' import os from typing import Optional import fsspec from fsspec.archive import AbstractArchiveFileSystem from fsspec.utils import DEFAULT_BLOCK_SIZE class lowerCamelCase ( __lowerCAmelCase ): snake_case_ = '''''' snake_case_ = ( None # pr...
332
1
# Lint as: python3 import os import re import urllib.parse from pathlib import Path from typing import Callable, List, Optional, Union from zipfile import ZipFile from ..utils.file_utils import cached_path, hf_github_url from ..utils.logging import get_logger from ..utils.version import Version SCREAMING_SNAKE_CASE...
15
import os from itertools import chain from random import randrange, shuffle import pytest from .sola import PokerHand lowerCAmelCase_ = ( '''4S 3H 2C 7S 5H''', '''9D 8H 2C 6S 7H''', '''2D 6D 9D TH 7D''', '''TC 8C 2S JH 6C''', '''JH 8S TH AH QH''', '''TS KS 5S 9S AC''', '''KD 6...
279
0
import argparse import requests import torch from PIL import Image from transformers import ViTMAEConfig, ViTMAEForPreTraining, ViTMAEImageProcessor def SCREAMING_SNAKE_CASE ( lowercase_ ) -> str: """simple docstring""" if "cls_token" in name: A__ = name...
350
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging _lowerCamelCase : Union[str, Any] = """▁""" _lowerCamelCase : Optional[Any] = ...
231
0
import sys def snake_case__ ( SCREAMING_SNAKE_CASE_ : List[Any] ): '''simple docstring''' lowercase__ : List[Any] = len(SCREAMING_SNAKE_CASE_ ) lowercase__ : Optional[int] = [[0 for x in range(SCREAMING_SNAKE_CASE_ )] for x in range(SCREAMING_SNA...
214
import logging import re import pytorch_quantization import pytorch_quantization.nn as quant_nn import torch from pytorch_quantization import calib from pytorch_quantization.tensor_quant import QuantDescriptor snake_case_ = logging.getLogger(__name__) snake_case_ = 50 # max width of layer names snake_cas...
214
1
import argparse 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 impor...
348
from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .attention...
348
1
from __future__ import annotations class a_ : """simple docstring""" def __init__( self , _lowerCamelCase , _lowerCamelCase ) ->int: SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE : Tuple = text, pattern SCREAMIN...
313
import csv import tweepy # Twitter API credentials a__ : Union[str, Any] = '''''' a__ : List[str] = '''''' a__ : Any = '''''' a__ : List[str] = '''''' def UpperCAmelCase_( a__ ): """simple docstring""" SCREAMING_SNAKE_CASE ...
313
1
import numpy as np def A ( _UpperCAmelCase : int , _UpperCAmelCase : Dict , _UpperCAmelCase : Optional[int] , _UpperCAmelCase : Dict , _UpperCAmelCase : Optional[Any] ) -> Optional[int]: ...
290
from __future__ import annotations import unittest from transformers import DebertaVaConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask f...
290
1
"""simple docstring""" import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient lowerCamelCase__ = WebClient(token=os.environ["""CI_SLACK_BOT_TOKEN"""]) def __lowerCAmelCase (_...
86
import unicodedata from dataclasses import dataclass from typing import Optional, Union import numpy as np from transformers.data.data_collator import DataCollatorMixin from transformers.file_utils import PaddingStrategy from transformers.tokenization_utils_base import PreTrainedTokenizerBase def _lowercas...
275
0
"""simple docstring""" def UpperCAmelCase ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase ) -> bool: return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(UpperCAmelCase ) ) def UpperCAmelCase ( UpperCAmelCase , Uppe...
312
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_out...
312
1
'''simple docstring''' import math import tensorflow as tf from packaging import version def __lowerCamelCase ( A__ ) -> Optional[int]: """simple docstring""" UpperCamelCase = tf.convert_to_tensor(A__ ) UpperCamelCase = 0.5 * (1.0 + ...
28
UpperCAmelCase__ = { '''A''': '''.-''', '''B''': '''-...''', '''C''': '''-.-.''', '''D''': '''-..''', '''E''': '''.''', '''F''': '''..-.''', '''G''': '''--.''', '''H''': '''....''', '''I''': '''..''', '''J''': '''.---''', '''K''': '''-.-''', '''L''': '''.-..''', '''M''': '''--''', '''N''': '''-.''',...
5
0
"""simple docstring""" import datasets a_ = "\\n@InProceedings{conneau2018xnli,\n author = \"Conneau, Alexis\n and Rinott, Ruty\n and Lample, Guillaume\n and Williams, Adina\n and Bowman, Samuel R.\n and Schw...
368
"""simple docstring""" from collections import namedtuple import requests from lxml import html # type: ignore a_ = namedtuple("covid_data", "cases deaths recovered") def a__ ( __lowercase = "https://www.worldometers.info/coronavirus/" ) -> covid_data: _...
163
0
'''simple docstring''' from json import JSONDecodeError # Workaround for requests.exceptions.JSONDecodeError import requests def lowerCamelCase (_SCREAMING_SNAKE_CASE : str = "isbn/0140328726" ): __a : List[str] = olid.strip().strip('/' ) # Remove leading/trailing...
27
'''simple docstring''' import inspect import os import unittest import torch import accelerate from accelerate import debug_launcher from accelerate.test_utils import ( execute_subprocess_async, require_cpu, require_huggingface_suite, require_multi_gpu, require_single_gpu, ) from accelerate....
27
1
from typing import Dict, Optional import numpy as np import datasets lowerCamelCase = ''' IoU is the area of overlap between the predicted segmentation and the ground truth divided by the area of union between the predicted segmentation and the ground truth. For binary (two classes) or multi-class segmenta...
362
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase = logging.get_logger(__name__) lowerCamelCase = { '''facebook/xlm-roberta-xl''': '''https://h...
211
0
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tok...
71
"""simple docstring""" import gc import random import unittest import numpy as np import torch from transformers import CLIPImageProcessor, CLIPVisionConfig, CLIPVisionModel from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEImgaImgPipeline from diffusers.pipelines.shap_e import ShapERenderer from ...
171
0
"""simple docstring""" import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow __A = False class _lowerCAmelCase ( unittest.TestCase ): """s...
254
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileViTConfig, MobileViTForImageClassification, MobileViTForSemanticSegmentation, MobileViT...
254
1
import unittest from knapsack import greedy_knapsack as kp class _snake_case ( unittest.TestCase ): '''simple docstring''' def A__ ( self: int ) -> Union[str, Any]: UpperCAmelCase_ : Union[str, Any] = [10, 20, 30, 40, 50, 60] UpperCAmelC...
345
import functools def lowerCamelCase__ ( __lowerCAmelCase : str , __lowerCAmelCase : str ): """simple docstring""" lowerCAmelCase_ = len(__lowerCAmelCase ) lowerCAmelCase_ = len(__lowerCAmelCase ) @functools.cache def min_distance(__lowerCAmelCase : ...
231
0
"""simple docstring""" import shutil import tempfile import unittest import numpy as np import pytest from transformers import is_speech_available, is_vision_available from transformers.testing_utils import require_torch if is_vision_available(): from transformers import TvltImageProcessor if is_speec...
271
"""simple docstring""" def _snake_case ( _snake_case : str ) -> str: '''simple docstring''' _A = '' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups d...
271
1
import argparse 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 Accelerator, Distr...
348
import os from argparse import ArgumentParser from typing import List import torch.utils.data from datasets import Dataset, IterableDataset from datasets.distributed import split_dataset_by_node __snake_case = 4 __snake_case = 3 class __snake_case ( lowerCamelCase__ ): pass d...
348
1
"""simple docstring""" import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline...
27
"""simple docstring""" import gc import unittest from diffusers import FlaxStableDiffusionInpaintPipeline 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.jax_util...
27
1
import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, AutoencoderKL, DDIMS...
253
import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, AutoencoderKL, DDIMS...
253
1
'''simple docstring''' def lowerCamelCase__ ( A : int , A : int ): '''simple docstring''' return int(input_a == input_a == 0 ) def lowerCamelCase__ ( ): '''simple docstring''' print('''Truth Table of NOR Gate:''' ...
354
'''simple docstring''' from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class UpperCamelCase__: __magic_name__ : int __magic_name__ : TreeNode | None = None __magic_name__ : TreeNode | None = None ...
91
0
def __snake_case ( __UpperCamelCase : list[int] ,__UpperCamelCase : list[int] ,__UpperCamelCase : int ): """simple docstring""" return not any( neighbour == 1 and colored_vertices[i] == color for i, neighbour in enumerate(__U...
312
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def __snake_case ( ): """simple docstring""" A_ = { "repo_name": ["test_repo1", "test_repo2", "test_repo3"], "...
312
1
import argparse import os import re import packaging.version __lowerCAmelCase = '''examples/''' __lowerCAmelCase = { '''examples''': (re.compile(r'''^check_min_version\("[^"]+"\)\s*$''', re.MULTILINE), '''check_min_version("VERSION")\n'''), '''init''': (re.compile(r'''^__versi...
368
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging __lowerCAmelCase = logging.get_logger(__name__) __lowerCAmelCase = '...
288
0
import warnings from ..trainer import Trainer from ..utils import logging __A : Union[str, Any] = logging.get_logger(__name__) class _SCREAMING_SNAKE_CASE ( a__): def __init__( self , _SCREAMING_SNAKE_CASE=None , **_SCREAMING_SNAKE_CASE )-> Optional[int]: ...
154
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __A =logging.get_logger(__name__) __A ={ 'google/pegasus-large': 'https://huggingface.co/google/pegasus-large/resolve/main/config.json', # See all PEGASUS models at https://huggingfa...
163
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase_ = { """configuration_xlm_roberta""": [ ...
353
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { """google/fnet-base""": """https://huggingface.co/google/fnet-base/resolve/main/config.json""", """google/fnet-large""": """https://hug...
260
0
import warnings from contextlib import contextmanager from ...processing_utils import ProcessorMixin class a ( lowercase__ ): """simple docstring""" a : str = 'Speech2TextFeatureExtractor' a : str = 'Speech2TextTokenizer' def ...
114
import argparse import io import requests import torch from omegaconf import OmegaConf from diffusers import AutoencoderKL from diffusers.pipelines.stable_diffusion.convert_from_ckpt import ( assign_to_checkpoint, conv_attn_to_linear, create_vae_diffusers_config, renew_vae_at...
114
1
"""simple docstring""" def lowercase ( A_ , A_ )-> List[str]: '''simple docstring''' if not (isinstance(_A , _A ) and isinstance(_A , _A )): raise ValueError("longest_common_substring() takes two strings for inputs" ) a : Opti...
353
"""simple docstring""" import warnings from ...utils import logging from .image_processing_dpt import DPTImageProcessor __lowercase = logging.get_logger(__name__) class _A ( _a ): """simple docstring""" def __init__( self : L...
226
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor _lowerCAmelCase :Any = logging.get_logger(__name__) class _UpperCAmelCase ( _UpperCAmelCase ): '''simple docstring''' def __init__( ...
263
from __future__ import annotations from cmath import sqrt def _a ( UpperCamelCase_ : int , UpperCamelCase_ : int , UpperCamelCase_ : int ) -> tuple[complex, complex]: """simple docstring""" if a == 0: raise ValueError("Coefficient...
340
0
import itertools import os import random import tempfile import unittest import numpy as np from transformers import TvltFeatureExtractor, is_datasets_available from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio from transformers.utils.import_utils import is...
350
__A = '''ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/''' def snake_case_(_UpperCamelCase ) -> bytes: """simple docstring""" if not isinstance(_UpperCamelCase , _UpperCamelCase ): _snake_case = F"""a bytes-like object is required, no...
278
0
'''simple docstring''' def UpperCAmelCase_ (__a : int ): """simple docstring""" if not isinstance(__a , __a ): raise TypeError('only integers accepted as input' ) else: _a : int = str(abs(__a ) ) _a : Any = [list(__a ) for char in range(len(__a ) )] ...
271
'''simple docstring''' from __future__ import annotations from random import choice def UpperCAmelCase_ (__a : str ): """simple docstring""" return choice(__a ) def UpperCAmelCase_ (__a : list[int] , __a : int ): """simple docstring""" _a ...
271
1
"""simple docstring""" def __lowerCamelCase ( a_ : str , a_ : str ) -> str: __SCREAMING_SNAKE_CASE :int = len(a_ ) __SCREAMING_SNAKE_CASE :int = len(a_ ) __SCREAMING_SNAKE_CASE :int = ( ...
239
"""simple docstring""" from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging lowerCamelCase_ = logging.get_logger(__name__) lowerCam...
239
1
'''simple docstring''' import argparse import os import re __lowercase : List[str] = 'src/transformers' # Pattern that looks at the indentation in a line. __lowercase : Any = re.compile(R'^(\s*)\S') # Pattern that matches `"key":" and puts `key` in group 0. __lowercase : str = ...
27
'''simple docstring''' # # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_node 2 --nnode...
27
1
import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for tests from os.path import join # noqa: this is just for tests from os.path import join as renamed_joi...
355
_UpperCAmelCase = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} _UpperCAmelCase = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def _SCREAMING_SNAKE_CASE ( SCREAMING_SNAKE_CASE :dict[int, list[int]] , SCREAMING_SNAKE_CASE :int , SCREAMING_SNAKE_CAS...
232
0
'''simple docstring''' 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 lowerCamelCase : Tuple =...
47
"""simple docstring""" import inspect import unittest import warnings from math import ceil, floor from transformers import LevitConfig from transformers.file_utils import cached_property, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_uti...
91
0
import argparse import pickle import numpy as np import torch from torch import nn from transformers import ReformerConfig, ReformerModelWithLMHead from transformers.utils import logging logging.set_verbosity_info() def _a ( UpperCAmelCase , UpperCAmelCase , UpperCAmelCase=None ) ...
265
import inspect from typing import Callable, List, Optional, Union import torch from transformers import CLIPImageProcessor, CLIPTextModel, CLIPTokenizer from diffusers import DiffusionPipeline from diffusers.models import AutoencoderKL, UNetaDConditionModel from diffusers.pipelines.stable_diffusion import Stabl...
265
1
'''simple docstring''' from ....configuration_utils import PretrainedConfig from ....utils import logging lowercase_ = logging.get_logger(__name__) # TODO: upload to AWS lowercase_ = { """yjernite/retribert-base-uncased""": ( """https://huggingface.co/yjernite/retribert-base-uncased/resolv...
58
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 _lowerCAmelCase : List[str] = logging.get_logger(__name__) _lowerCAmelCase : O...
300
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import timm import torch from huggingface_hub import hf_hub_download from PIL import Image from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transform...
154
"""simple docstring""" import unittest from transformers import SPIECE_UNDERLINE from transformers.models.speechta import SpeechTaTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.tokenization_utils import AddedToken from ...
154
1
'''simple docstring''' import warnings 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 lowerCamelCase : int = logging.get_logger(__name__) ...
2
from typing import List, Optional, Union import torch from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DDPMScheduler from ...utils import ( is_accelerate_available, is_accel...
236
0
'''simple docstring''' import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, rand...
367
'''simple docstring''' # Logistic Regression from scratch # In[62]: # In[63]: # importing all the required libraries import numpy as np from matplotlib import pyplot as plt from sklearn import datasets def a__ ( lowerCAmelCase__ ) -> List[Any]: return 1 / (1 + np.exp(-z ...
299
0
import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiec...
107
def __SCREAMING_SNAKE_CASE ( snake_case_ ): '''simple docstring''' _UpperCAmelCase = len(snake_case_ ) for i in range(snake_case_ ): for j in range(i + 1 , snake_case_ ): if numbers[j] < numbers[i]: ...
133
0
'''simple docstring''' import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def UpperCamelCase ( ): print("Making key files..." ) make_key_files("rsa" , 10_24 ) print("Key files...
357
'''simple docstring''' import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def UpperCamelCase ( ): print("Making key files..." ) make_key_files("rsa" , 10_24 ) print("Key files...
123
0
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_base import BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipe...
51
import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def __lowercase ( a__ ) -> Tuple: __SCREAMING_SNAKE_CASE = [ 'encoder.version', 'decoder.version', 'model.encoder.version', ...
257
0
"""simple docstring""" from math import sqrt import numpy as np from sympy import symbols # Coefficient # Speed of light (m/s) __A = 2_9979_2458 # Symbols __A = symbols('ct x y z') def _lowerCamelCase(__UpperCamelCase ) -> float: if velocity > c: raise ValueError("""S...
368
"""simple docstring""" import warnings from .generation import TFGenerationMixin class lowerCamelCase__ ( __magic_name__ ): '''simple docstring''' # warning at import time warnings.warn( '''Importing `TFGenerationMixin` from `src/transformers/generation_tf_uti...
341
0
def __UpperCamelCase ( _A ): lowerCAmelCase_ = [[0 for _ in range(_A )] for _ in range(m + 1 )] for i in range(m + 1 ): lowerCAmelCase_ = 1 for n in range(m + 1 ): for k in range(1 , _A ): memo[n][k] += memo[n][k - 1] ...
278
import os from typing import List, Optional, Union from ...tokenization_utils import PreTrainedTokenizer from ...tokenization_utils_base import AddedToken from ...utils import logging _lowerCamelCase : Optional[Any] = logging.get_logger(__name__) _lowerCamelCase : Dict = {"voca...
336
0
from ..utils import DummyObject, requires_backends class __UpperCAmelCase ( metaclass=lowerCamelCase__ ): UpperCamelCase = ["""onnx"""] def __init__( self : int, *__A : Optional[Any], **__A : Dict ): requires_backends(self, ['''on...
99
from ..utils import DummyObject, requires_backends class __UpperCAmelCase ( metaclass=lowerCamelCase__ ): UpperCamelCase = ["""onnx"""] def __init__( self : int, *__A : Optional[Any], **__A : Dict ): requires_backends(self, ['''on...
99
1
from typing import TYPE_CHECKING # rely on isort to merge the imports from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __a = { 'configuration_informer': [ 'INFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP', 'InformerConfig', ], } try: i...
30
"""simple docstring""" import datasets from .evaluate import evaluate _UpperCAmelCase = """\ @inproceedings{Rajpurkar2016SQuAD10, title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text}, author={Pranav Rajpurkar and Jian Zhang and Konstantin Lopyrev and Percy Liang}, booktitle={EMN...
173
0
import unittest import numpy as np def _UpperCAmelCase ( SCREAMING_SNAKE_CASE__ : np.ndarray , SCREAMING_SNAKE_CASE__ : np.ndarray , SCREAMING_SNAKE_CASE__ : np.ndarray , SCREAMING_SNAKE_CASE__ : np.ndarray | None = None , ): __UpperCamelCa...
117
import inspect import os import unittest from dataclasses import dataclass import torch from accelerate import Accelerator, DistributedDataParallelKwargs, GradScalerKwargs from accelerate.state import AcceleratorState from accelerate.test_utils import execute_subprocess_async, require_cuda, require_multi_gpu from ...
117
1
'''simple docstring''' from __future__ import annotations a : Tuple = """Muhammad Umer Farooq""" a : List[Any] = """MIT""" a : Tuple = """1.0.0""" a : Union[str, Any] = """Muhammad Umer Farooq""" a : Tuple = """contact@muhammadumerfarooq.me""" a ...
265
'''simple docstring''' from operator import delitem, getitem, setitem import pytest from data_structures.hashing.hash_map import HashMap def __lowerCamelCase ( _lowercase ) -> Optional[Any]: return getitem, k def __lowerCamelCase ( _lowercase , _lowercase ) ...
265
1
from .constants import ( MODEL_NAME, OPTIMIZER_NAME, RNG_STATE_NAME, SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, SCALER_NAME, SCHEDULER_NAME, TORCH_LAUNCH_PARAMS, WEIGHTS_INDEX_NAME, WEIGHTS_NAME, ) from .dataclasses import ( BnbQuantizationConfig, ...
347
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __UpperCamelCase : Optional[Any] = { "configuration_wav2vec2": ["WAV_2_VEC_2_PRETRAINED_CONFIG_ARCHIVE_MAP...
347
1
import argparse import gc import json import os import re import torch from huggingface_hub import hf_hub_download from transformers import AutoModelForCausalLM, AutoTokenizer, PreTrainedTokenizerFast, RwkvConfig from transformers.modeling_utils import WEIGHTS_INDEX_NAME, shard_checkpoint __A : Optional[A...
154
import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging __A : Any = logging.get_logger(__name__) __A : ...
154
1
import math def _A ( __magic_name__ ): lowercase__ = math.loga(math.sqrt(4 * positive_integer + 1 ) / 2 + 1 / 2 ) return exponent == int(__magic_name__ ) def _A ( __magic_name__ = 1 / 1_2345 ): lowercase__ = 0 lowercase__ = 0 lowercase__ ...
201
from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class lowerCAmelCase ( yaml.SafeLoader ): def UpperCAmelCase ( self :Optional[Any] , _lowercase :Any ): '''simple docstring''' lowercase__ ...
201
1
import importlib import inspect 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_config_docstrings.py _A : Optional[Any] = 'src/transformers' # This is to make sure the transformers module imported is t...
142
import inspect import unittest import numpy as np from transformers import BeitConfig from transformers.testing_utils import require_flax, require_vision, slow from transformers.utils import cached_property, is_flax_available, is_vision_available from ...test_configuration_common import ConfigTester from ...te...
142
1
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase = logging.get_logger(__name__) lowerCamelCase = { """weiweishi/roc-bert-base-zh""": """https://huggingface.co/weiweishi/roc-bert-base-zh/resolve...
241
"""simple docstring""" from maths.prime_check import is_prime def a__ ( lowerCAmelCase__ ): if not isinstance(lowerCAmelCase__ , lowerCAmelCase__ ): UpperCAmelCase_ = f"""Input value of [number={number}] must be an integer""" ...
241
1
"""simple docstring""" from __future__ import annotations from typing import TypedDict class lowercase__ ( snake_case__ ): _UpperCAmelCase :str _UpperCAmelCase :int def _snake_case ( lowerCamelCase__ : str ) -> list[str]: if not isinstance(lowerCamelCase__ ...
144
"""simple docstring""" import json import os from dataclasses import dataclass from functools import partial from typing import Callable import flax.linen as nn import jax import jax.numpy as jnp import joblib import optax import wandb from flax import jax_utils, struct, traverse_util from flax.serialization...
144
1
# Copyright (c) 2021-, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
335
import argparse import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( CLIPTokenizer, CLIPTokenizerFast, VideoMAEImageProcessor, XCLIPConfig, XCLIPModel, XCLIPProcessor, XCLIPTextConfig, XCLIPVisionConfig, ...
335
1
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_ne...
95
def _SCREAMING_SNAKE_CASE ( _lowerCamelCase : int , _lowerCamelCase : int) -> float: '''simple docstring''' return base * power(_lowerCamelCase , (exponent - 1)) if exponent else 1 if __name__ == "__main__": print('Raise base to the power of e...
232
0
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 TFModel...
304
from __future__ import annotations import numpy as np def _lowerCamelCase( lowercase__ ) -> str: '''simple docstring''' return np.maximum(0 , lowercase__ ) if __name__ == "__main__": print(np.array(relu([-1, 0, 5]))) # --> [0, 0, 5]
304
1
"""simple docstring""" import warnings from ...utils import logging from .image_processing_videomae import VideoMAEImageProcessor _lowercase : int = logging.get_logger(__name__) class _UpperCAmelCase ( _lowerCAmelCase ): def __init__( self : Union[str, Any...
332
"""simple docstring""" from typing import Dict from .base import GenericTensor, Pipeline class _UpperCAmelCase ( _lowerCAmelCase ): def a ( self : Tuple , _lowercase : Dict=None , _lowercase : str=None , _lowercase : Union[str, Any]=...
332
1
'''simple docstring''' def _A ( snake_case , snake_case ) -> int: while b: _lowercase , _lowercase : Optional[int] = b, a % b return a def _A ( snake_case , snake_case ) -> int: return a if b == 0 else euclidean_g...
199
'''simple docstring''' import argparse import random import joblib import numpy as np import torch from igf.igf import ( SecondaryLearner, collect_objective_set, compute_perplexity, generate_datasets, load_gpta, recopy_gpta, set_seed, train_secondary_learner, ) from torch.utils.data i...
199
1
'''simple docstring''' import logging import torch from torch import nn from torch.nn import CrossEntropyLoss, MSELoss from transformers.file_utils import add_start_docstrings, add_start_docstrings_to_model_forward from transformers.models.bert.modeling_bert import ( BERT_INPUTS_DOCSTRING, BERT_START_DOCS...
67
"""simple docstring""" from typing import Dict, Iterable, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, res...
246
0
from string import ascii_uppercase UpperCamelCase = {char: i for i, char in enumerate(ascii_uppercase)} UpperCamelCase = dict(enumerate(ascii_uppercase)) def __lowerCamelCase ( snake_case__ ,snake_case__ ): """simple docstring""" _SCRE...
357
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) UpperCamelCase = { '''configuration_layoutlmv3''': [ '''L...
125
0
'''simple docstring''' import os import unittest from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer from transformers.testing_utils import get_tests_dir from ...test_tokenization_common import TokenizerTesterMixin lowerCamelCase__ = get_tests_d...
234
'''simple docstring''' from typing import Optional, Tuple, Union import torch from einops import rearrange, reduce from diffusers import DDIMScheduler, DDPMScheduler, DiffusionPipeline, ImagePipelineOutput, UNetaDConditionModel from diffusers.schedulers.scheduling_ddim import DDIMSchedulerOut...
208
0
'''simple docstring''' from __future__ import annotations import unittest from transformers import AutoTokenizer, MBartConfig, is_tf_available from transformers.testing_utils import require_sentencepiece, require_tf, require_tokenizers, slow from transformers.utils import cached_property from ...
55
'''simple docstring''' def a_ ( lowerCamelCase : list[int] ): if not nums: # Makes sure that the list is not empty raise ValueError('List is empty' ) lowerCAmelCase = sum(lowerCamelCase ) / len(lowerCamelCase ) # Calculate the average return sum(...
55
1