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
"""simple docstring""" def UpperCamelCase_ ( lowerCAmelCase__ : bytes ) -> Optional[Any]: """simple docstring""" return "".join([hex(__lowerCamelCase )[2:].zfill(2 ).upper() for byte in list(__lowerCamelCase )] ) def UpperCa...
224
"""simple docstring""" from typing import Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import get_image_size, pad, rescale, to_channel_dimension_format from ...image_utils import ChannelDimension, ImageInput, make_list_of_...
238
0
"""simple docstring""" def lowerCAmelCase_ ( __A, __A, __A, __A ) -> List[str]: '''simple docstring''' UpperCAmelCase__ = [False] * len(__A ) UpperCAmelCase__ = [] queue.append(__A ) UpperCAmelCase__ ...
350
# 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...
143
0
"""simple docstring""" import sys import webbrowser import requests from bsa import BeautifulSoup from fake_useragent import UserAgent if __name__ == "__main__": print('Googling.....') lowercase__ = "https://www.google.com/search?q=" + " ".join(sys.argv[1:]) lowercase__ = requests.get(url, he...
290
'''simple docstring''' import warnings from functools import wraps from typing import Callable def UpperCamelCase_( snake_case : Callable ): '''simple docstring''' @wraps(snake_case ) def _inner_fn(*snake_case : Optional[int] , **snak...
85
0
"""simple docstring""" import unittest from transformers import is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from .test_pipelines_common ...
244
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCAmelCase__ = { '''configuration_timesformer''': ['''TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TimesformerConfig'''], } try: if...
244
1
'''simple docstring''' def __lowerCamelCase ( A__ , A__ ) -> str: """simple docstring""" if a < 0 or b < 0: raise ValueError('the value of both inputs must be positive' ) UpperCamelCase = str(bin(A__ ) )[2:] # remove the leading "0b"...
28
def SCREAMING_SNAKE_CASE ( lowercase_ ) -> Any: """simple docstring""" A__ = [0] * len(lowercase_ ) A__ = [] A__ = [1] * len(lowercase_ ) for values in graph.values(): for i in values: ...
14
0
'''simple docstring''' def SCREAMING_SNAKE_CASE_ (UpperCamelCase ) -> bool: lowerCamelCase__ : Union[str, Any] = [int(UpperCamelCase ) for i in ip_va_address.split(""".""" ) if i.isdigit()] return len(UpperCamelCase ) == 4 and all(0 <= int(UpperCamelC...
360
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import BertTokenizer, BertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testi...
129
0
def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase=False ) -> Union[str, Any]: if isinstance(_UpperCAmelCase , _UpperCAmelCase ) and isinstance(_UpperCAmelCase , _UpperCAmelCase ): lowerCamelCase__ : Tuple = len(set...
50
'''simple docstring''' def A__ ( UpperCAmelCase_ ): _UpperCamelCase : List[str] = abs(UpperCAmelCase_ ) _UpperCamelCase : int = 0 while n > 0: res += n % 1_0 n //= 1_0 return res def A__ ( UpperCAmelCase_ ): ...
83
0
'''simple docstring''' import copy import inspect import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import VideoMAEConfig from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, t...
356
'''simple docstring''' def snake_case_ (UpperCamelCase : str , UpperCamelCase : Any ): '''simple docstring''' return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def snake_case_ (UpperCamelCase : Any , UpperCamelCase : str=0 ):...
179
0
'''simple docstring''' import argparse import os import re UpperCamelCase = '''src/diffusers''' # Pattern that looks at the indentation in a line. UpperCamelCase = re.compile(R'''^(\s*)\S''') # Pattern that matches `"key":" and puts `key` in group 0. UpperCamelCase ...
319
import gc import random import unittest import numpy as np import torch from diffusers import ( DDIMScheduler, KandinskyVaaControlnetPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_numpy, slow, torch_de...
143
0
"""simple docstring""" import argparse import glob import logging import os import time from argparse import Namespace import numpy as np import torch from lightning_base import BaseTransformer, add_generic_args, generic_train from torch.utils.data import DataLoader, TensorDataset from transformers import glue_co...
350
"""simple docstring""" from manim import * class __A ( SCREAMING_SNAKE_CASE_ ): def __A ( self ): _lowerCAmelCase : Any = Rectangle(height=0.5 , width=0.5 ) _lowerCAmelCase : List[Any] = Rectangle(height=0.4_6 , width=0.4_6...
126
0
import collections import inspect import unittest from transformers import SwinvaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common import ConfigTeste...
244
from __future__ import annotations from typing import Generic, TypeVar lowerCamelCase_ = TypeVar('''T''') class __A( Generic[T] ): """simple docstring""" def __init__(self , SCREAMING_SNAKE_CASE_ ): UpperCamelCase__ = data UpperCamelCase__ = self ...
244
1
'''simple docstring''' from math import sqrt def a_ ( __snake_case : int ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == ...
6
'''simple docstring''' import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert_fast import BertTokenizerFast from .tokenization_dpr import D...
6
1
def SCREAMING_SNAKE_CASE__ ( _UpperCAmelCase, _UpperCAmelCase ) -> Dict: '''simple docstring''' lowerCAmelCase : Optional[Any] = len(lowerCamelCase_ ) + 1 lowerCAmelCase : List[str] = len(lowerCamelCase_ ) + 1 # dp is a 2d matrix where dp[i][j] denotes ...
138
import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def lowerCAmelCase__ ( lowerCamelCase_ : Any): '''simple docstring''' if "img_encoder.pos_embed" in name: lowerCAmelCase__ : Dict ...
129
0
'''simple docstring''' import collections import json import os import re from typing import TYPE_CHECKING, List, Optional, Tuple import numpy as np from ...tokenization_utils_fast import PreTrainedTokenizer from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational imp...
363
'''simple docstring''' lowerCAmelCase: Union[str, Any] = { 'meter': 'm', 'kilometer': 'km', 'megametre': 'Mm', 'gigametre': 'Gm', 'terametre': 'Tm', 'petametre': 'Pm', 'exametre': 'Em', 'zettametre': 'Zm', 'yottametre': 'Ym', } # Exponent of the factor(meter) low...
96
0
'''simple docstring''' from pathlib import Path import cva import numpy as np from matplotlib import pyplot as plt def _A (lowerCAmelCase__ :np.ndarray , lowerCAmelCase__ :np.ndarray , lowerCAmelCase__ :np.ndarray , lowerCAmelCase__ :int , lowerCAmelCase__ ...
168
"""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, DDPMScheduler, StableDiffusionUpscalePipeline, UNetaDConditionModel fr...
179
0
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class SCREAMING_SNAKE_CASE ( __a ): '''simple docstrin...
369
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) snake_case = { """configuration_encodec""": [ """ENCODEC_PRETRAINED_CONFIG_ARCHIVE_MAP""", """EncodecConfig""", ], """feature_extracti...
319
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available _A = {"""configuration_swin""": ["""SWIN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """SwinConfig""", """SwinOnnxConfig"""]} try: if not is_tor...
242
"""simple docstring""" from sklearn.metrics import recall_score import datasets lowerCAmelCase = """ Recall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation: Recall = TP / (TP + FN) Where TP is the true positiv...
126
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices __UpperCAmelCase = logging.get_logger(__name__) __UpperCAmelCase = { 'mi...
1
"""simple docstring""" from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def _snake_case ( lowercase__ : str = "laptop" ) -> DataFrame: '''simple docstring''' lowerCAmelCase_ :Dict ...
1
1
from math import sqrt def __lowerCAmelCase ( a__ ) -> bool: if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False # Al...
6
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) A : str = { 'configuration_blenderbot': [ 'BLENDERBOT_PRETRAINED_CONFIG_ARCHIVE_MAP', ...
6
1
import os from pathlib import Path import numpy as np import pytest from pack_dataset import pack_data_dir from parameterized import parameterized from save_len_file import save_len_file from torch.utils.data import DataLoader from transformers import AutoTokenizer from transformers.models.mbart.modeling_mbart ...
350
from math import cos, sin, sqrt, tau from audio_filters.iir_filter import IIRFilter def _lowercase ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase = 1 / sqrt(2 ) ) -> IIRFilter: lowerCamelCase =tau * frequency / samplerate lowerCamelCase =sin(_UpperCAmelCase ) ...
262
0
"""simple docstring""" import torch from transformers import AutoModel class UpperCAmelCase_ ( torch.nn.Module): def __init__( self , a="sayef/fsner-bert-base-uncased" ) -> Tuple: super(a , self ).__init__() lowercase__ : str = Au...
77
"""simple docstring""" import socket def _snake_case ( ): _lowerCamelCase : List[Any] = socket.socket(socket.AF_INET , socket.SOCK_STREAM ) _lowerCamelCase : Union[str, Any] = socket.gethostname() _lowerCamelCase : Li...
96
0
'''simple docstring''' import json import os import unittest from transformers import DebertaTokenizer, DebertaTokenizerFast from transformers.models.deberta.tokenization_deberta import VOCAB_FILES_NAMES from transformers.testing_utils import slow from ...test_tokenization_common import TokenizerTest...
366
'''simple docstring''' import argparse from collections import OrderedDict from pathlib import Path import torch from huggingface_hub import hf_hub_download from PIL import Image from torchvision.transforms import functional as F from transformers import DetrImageProcessor, TableTransformerConfig, Table...
67
0
"""simple docstring""" import random def a_ ( _lowerCAmelCase : int ): '''simple docstring''' lowercase__ : Optional[int] = num - 1 lowercase__ : Optional[int] = 0 while s % 2 == 0: lowercase__ : Optional[Any] = s //...
77
'''simple docstring''' import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasonin...
319
0
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__) __lowerCamelCase = { """faceboo...
10
import dataclasses import re import string from typing import Any, Dict, Iterator, List, Mapping, Optional, Sequence, Tuple import numpy as np from . import residue_constants __lowerCamelCase = Mapping[str, np.ndarray] __lowerCamelCase = Mapping[str, Any] # Is a nested dict. __lowerCamelC...
10
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices SCREAMING_SNAKE_CASE_: Union[str, Any] =logging.get_logger(__name__) SCREAMING_SNAKE_CASE_: List[st...
1
'''simple docstring''' from __future__ import annotations def lowerCAmelCase_ ( snake_case_ : list , snake_case_ : int | None = None , snake_case_ : int | None = None ) -> None: '''simple docstring''' if start is None: UpperCAmelCase_...
1
1
"""simple docstring""" from collections import namedtuple lowerCAmelCase_ = namedtuple('from_to', 'from_ to') lowerCAmelCase_ = { 'cubicmeter': from_to(1, 1), 'litre': from_to(0.0_0_1, 1_000), 'kilolitre': from_to(1, 1), 'gallon': from...
361
"""simple docstring""" from __future__ import annotations lowerCAmelCase_ = '#' class __A : '''simple docstring''' def __init__( self : str ) -> None: """simple docstring""" lowercase__ : dict...
302
0
"""simple docstring""" def _A ( lowercase ): """simple docstring""" if not isinstance(lowercase , lowercase ): a =f'''Input value of [number={number}] must be an integer''' raise TypeError(lowercase ) if number < 1: ...
81
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassifica...
262
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase_ = logging.get_logger(__name__) lowerCAmelCase_ = { 'google/vivit-b-16x2-kinetics400': ( 'https://huggingface.co/google...
302
"""simple docstring""" from typing import List, Optional, Tuple, Union import torch from torch import nn from torch.nn import CrossEntropyLoss from ... import AutoBackbone from ...modeling_outputs import SemanticSegmenterOutput from ...modeling_utils import PreTrainedModel from ...util...
302
1
import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class __snake_case ( UpperCamelCase_ ): _a = ['''image_processor''', '''tokenizer'''] _a = '''CLIPImageProcessor''' _a = ('''XLMRober...
103
'''simple docstring''' import re from filelock import FileLock try: import nltk __UpperCAmelCase =True except (ImportError, ModuleNotFoundError): __UpperCAmelCase =False if NLTK_AVAILABLE: with FileLock(".lock") as lock: nltk.download("punkt", quiet=True) def __lowerCAme...
67
0
import warnings from ...utils import is_sklearn_available, requires_backends if is_sklearn_available(): from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef lowercase_ = ( """This metric will be removed from the library...
269
import warnings from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase_ = logging.get_logger(__name__) lowercase_ = { """xlnet-base-cased""": """https://huggingface.co/xlnet-base-cased/resolve/main/config.json""", """xlnet-large-c...
269
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A = logging.get_logger(__name__) __A = { "facebook/data2vec-vision-base-ft":...
10
class _SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__(self : Optional[Any] , UpperCAmelCase_ : int) ->Optional[int]: '''simple docstring''' lowerCamelCase__: Any =n lowerCamelCase__: Tuple =[None] * self.n lowerCamelCase__: ...
10
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowercase : List[Any] = logging.get_logger(__name__) lowercase : Dict = { "google/fnet-base": "https://huggingface.co/google/fnet-base/resolve/main/config.json", "google/fnet-large": "https://...
171
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowercase : Union[str, Any] = { "configuration_mctct": ["MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP", "MCTCTConfig"], "feature_extraction_mctct": ["MCTCTFeatureExtractor"], "...
171
1
'''simple docstring''' from maths.prime_check import is_prime def a_ ( lowerCamelCase : int ): if not isinstance(lowerCamelCase , lowerCamelCase ): lowerCAmelCase = f'''Input value of [number={number}] must be an integer''' raise TypeError(lowerCamelCase ...
4
class SCREAMING_SNAKE_CASE : def __init__( self : List[Any] , __lowercase : Union[str, Any] ): '''simple docstring''' __a = val __a = None __a = None def UpperCamelCase_ ...
302
0
import unittest import torch from diffusers import DDIMScheduler, DDPMScheduler, UNetaDModel from diffusers.training_utils import set_seed from diffusers.utils.testing_utils import slow _SCREAMING_SNAKE_CASE = False class SCREAMING_SNAKE_CASE_ ( unittest.TestCase ): def UpperCAmelCase_...
353
from __future__ import annotations import pandas as pd def SCREAMING_SNAKE_CASE__ ( __a , __a , __a ): snake_case_ : Optional[Any] = [0] * no_of_processes snake_case_ : Tuple = [0] * no_of_processes # Copy the burst time into remaining_time[] ...
88
0
def lowerCAmelCase__ ( _SCREAMING_SNAKE_CASE : list ): """simple docstring""" if not grid or not grid[0]: raise TypeError("""The grid does not contain the appropriate information""" ) for cell_n in range(1 , len(grid[0] ) ): grid[0][cell_n] += grid[0][cel...
302
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) fr...
302
1
from __future__ import annotations from collections.abc import MutableSequence class lowerCamelCase : """simple docstring""" def __init__( self : Union[str, Any], _UpperCAmelCase : int, _UpperCAmelCase : MutableSequence[fl...
358
def _a ( SCREAMING_SNAKE_CASE__ : str ) -> str: '''simple docstring''' if not all(char in "01" for char in bin_string ): raise ValueError("Non-binary value was passed to the function" ) if not bin_string: raise V...
191
0
"""simple docstring""" import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import P...
269
"""simple docstring""" from collections import OrderedDict from typing import TYPE_CHECKING, Any, Mapping, Optional, Union from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxSeqaSeqConfigWithPast from ...utils import logging if TYPE_CHECKING: from ....
269
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available lowerCAmelCase :Union[str, Any] = { '''configuration_squeezebert''': [ '''SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP''', ...
275
'''simple docstring''' from typing import List, Optional, Union import torch from transformers import ( XLMRobertaTokenizer, ) from ...models import UNetaDConditionModel, VQModel from ...pipelines import DiffusionPipeline from ...pipelines.pipeline_utils import ImagePipelineOutput from ...schedulers import DD...
275
1
"""simple docstring""" from collections import deque def a__ ( lowerCAmelCase ) -> Tuple: UpperCAmelCase__ : str = len(lowerCAmelCase ) UpperCAmelCase__ : Dict = deque() UpperCAmelCase__ : Any = [False for _ in range(lowerCAmelCase )...
171
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) _A = { """configuration_owlvit""": [ ""...
171
1
"""simple docstring""" from __future__ import annotations import collections import pprint from pathlib import Path def __UpperCAmelCase ( snake_case_ : Tuple ) -> List[Any]: """simple docstring""" return "".join(sorted(__a ) ) def __UpperCAmelCase ...
350
"""simple docstring""" def __UpperCAmelCase ( snake_case_ : int , snake_case_ : list[int] , snake_case_ : int ) -> int: """simple docstring""" def count_of_possible_combinations(snake_case_ : int ) -> int: if target < 0: r...
317
0
'''simple docstring''' import inspect import unittest from transformers import MobileNetVaConfig from transformers.testing_utils import require_torch, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configura...
4
import unittest from transformers import ( MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TF_MODEL_FOR_SEQ_TO_SEQ_CAUSAL_LM_MAPPING, TextaTextGenerationPipeline, pipeline, ) from transformers.testing_utils import is_pipeline_test, require_tf, require_torch from transformers.utils import is_torch_av...
88
0
import os from datetime import datetime as dt from github import Github SCREAMING_SNAKE_CASE_ = [ 'good first issue', 'good second issue', 'good difficult issue', 'enhancement', 'new pipeline/model', 'new scheduler', 'wip', ] def __SCREAMING_SNAKE_CASE ( ) ...
189
import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = [ ['attention', 'attn'], ['enco...
189
1
def lowerCAmelCase_ ( snake_case_,snake_case_,snake_case_,snake_case_,snake_case_,snake_case_ ): if index == r: for j in range(snake_case_ ): print(data[j],end=""" """ ) print(""" """ ) return # When no more elements are the...
26
"""simple docstring""" from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_tokenizers_available, is_torch_available, is_vision_available from ...utils import OptionalDependencyNotAvailable lowerCamelCase_ = {"configuration_dpt": ["DPT_PRETRAINED_CONFIG_ARCHIVE_MAP", ...
191
0
"""simple docstring""" def SCREAMING_SNAKE_CASE_ ( snake_case : int )-> None: _lowerCamelCase = generate_pascal_triangle(snake_case ) for row_idx in range(snake_case ): # Print left spaces for _ in range(num_rows - row_idx - 1 ): ...
80
"""simple docstring""" import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer import RoF...
80
1
def _lowercase ( lowercase__ ): return "".join(chr(ord(lowercase__ ) - 3_2 ) if '''a''' <= char <= '''z''' else char for char in word ) if __name__ == "__main__": from doctest import testmod testmod()
275
from typing import Dict import numpy as np import torch from . import residue_constants as rc from .tensor_utils import tensor_tree_map, tree_map def _lowercase ( lowercase__ ): __lowerCAmelCase : str = [] __lowerCAmelCase : List[Any] = [] __lowe...
275
1
A__ = 256 # Modulus to hash a string A__ = 100_0003 def _lowerCAmelCase ( __lowerCAmelCase , __lowerCAmelCase ) -> bool: """simple docstring""" snake_case__ : str = len(__lowerCAmelCase ) snake_case__ : Optional[in...
44
import math import tensorflow as tf from packaging import version def _lowerCAmelCase ( __lowerCAmelCase ) -> Tuple: """simple docstring""" snake_case__ : List[str] = tf.convert_to_tensor(__lowerCAmelCase ) snake_case__ : Dict = ...
44
1
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Any = logging.get_logger(__name__) a__ : Tuple = { 'Salesforce/blip-vqa-base': 'https://huggingface.co/Salesf...
80
from ...processing_utils import ProcessorMixin class snake_case ( SCREAMING_SNAKE_CASE_ ): '''simple docstring''' snake_case_ : int = ["""image_processor""", """feature_extractor"""] snake_case_ : List[Any] = """T...
317
0
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, random_attention_mask from ...test...
207
from functools import lru_cache @lru_cache def a_ ( lowerCAmelCase_ : int ): if num < 0: raise ValueError('Number should not be negative.' ) return 1 if num in (0, 1) else num * factorial(num - 1 ) if __name__ == "__main__": import doctest doctest.testmod()
207
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase : str =logging.get_logger(__name__) lowerCamelCase : Optional[int] ={ '''google/realm-cc-news-pretrained-embedder''': ( '''https://huggingface.co/google/realm-cc-news-pr...
189
from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar lowerCamelCase : int =TypeVar('''T''') class __a ( Generic[T] ): _lowerCAmelCase : deque[T] # Cache store of keys _lowerCAmelCase ...
189
1
"""simple docstring""" from string import ascii_uppercase UpperCAmelCase__ = {str(ord(c) - 55): c for c in ascii_uppercase} def _UpperCAmelCase ( __lowerCamelCase : int , __lowerCamelCase : int ) -> str: if isinstance(__lowerCamelCase , __lowerCamelCase ): raise ...
40
"""simple docstring""" from __future__ import annotations import random import unittest from transformers import TransfoXLConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFMo...
40
1
'''simple docstring''' # Lint as: python3 import itertools import os import re a__ : int = re.compile(R'([A-Z]+)([A-Z][a-z])') a__ : str = re.compile(R'([a-z\d])([A-Z])') a__ : Tuple = re.compile(R'(?<!_)_(?!_)') a__ : Union[str, Any] = ...
80
'''simple docstring''' import os import sys import warnings from dataclasses import dataclass, field from io import BytesIO from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Union import numpy as np import pyarrow as pa from .. import config from ..download.streaming_download_manager im...
80
1
'''simple docstring''' from typing import Callable, List, Optional, Tuple, Union import torch from transformers import CLIPTextModel, CLIPTokenizer from ...configuration_utils import ConfigMixin, register_to_config from ...models import ModelMixin, TransformeraDModel, VQModel from ...schedulers import VQDiffusion...
364
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...schedulers import DDIMScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class UpperCAmelCase_ ( _SCREAMING_SNAKE_CASE ): '''simple docs...
229
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _a : List[Any] = logging.get_logger(__name__) _a : Union[str, Any] = { ...
44
"""simple docstring""" def SCREAMING_SNAKE_CASE ( _lowerCamelCase : int = 50 ) -> int: _lowerCAmelCase : int = [1] * (length + 1) for row_length in range(3 ,length + 1 ): for block_length in range(3 ,row_length + 1 ): for block_start in range(...
44
1
'''simple docstring''' def a ( __a , __a ) -> bool: '''simple docstring''' UpperCamelCase__ :List[Any] = len(__a ) UpperCamelCase__ :Any = [[False] * (required_sum + 1) for _ in range(arr_len + 1 )] # for each arr valu...
219
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import _LazyModule __snake_case = {'''tokenization_wav2vec2_phoneme''': ['''Wav2Vec2PhonemeCTCTokenizer''']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: import sys __snak...
219
1
import datetime import platform import subprocess from typing import Optional, Tuple, Union import numpy as np def a ( lowerCamelCase_ , lowerCamelCase_ ): '''simple docstring''' lowercase__ = F"""{sampling_rate}""" lowercase__ = '''1''' lowercase__ = ''...
207
import gc import unittest from transformers import CTRLConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTe...
207
1
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 DDIMSchedulerOutput from diffusers.schedulers.scheduling_ddp...
42
import json import os from pathlib import Path from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple, Union import sentencepiece from ...tokenization_utils import BatchEncoding, PreTrainedTokenizer from ...utils import logging __UpperCAmelCase = logging.get_logger(__name__)...
42
1
"""simple docstring""" import numpy as np from cva import destroyAllWindows, imread, imshow, waitKey class _A : """simple docstring""" def __init__( self : Optional[Any] , __UpperCAmelCase : Optional[Any] , __UpperCAmelCase ...
40
"""simple docstring""" def lowercase ( A_ , A_ )-> float: '''simple docstring''' if mass < 0: raise ValueError("The mass of a body cannot be negative" ) return 0.5 * mass * abs(A_ ) * abs(A_ ) if __name__ == "__main__": im...
40
1
'''simple docstring''' import tempfile import torch from diffusers import PNDMScheduler from .test_schedulers import SchedulerCommonTest class lowerCAmelCase_ ( UpperCAmelCase_ ): '''simple docstring''' UpperCamelCase_ : int = (PNDMSche...
334
'''simple docstring''' import argparse import torch from transformers import ( EncodecConfig, EncodecFeatureExtractor, EncodecModel, logging, ) # checkpoints downloaded from: # https://dl.fbaipublicfiles.com/encodec/v0/encodec_24khz-d7cc33bc.th # https://huggingface.co/f...
334
1
"""simple docstring""" import itertools from dataclasses import dataclass from typing import List, Optional import pyarrow as pa import pyarrow.parquet as pq import datasets from datasets.table import table_cast __A = datasets.utils.logging.get_logger(__name__) @dataclass class...
148
'''simple docstring''' from math import sqrt import numpy as np from sympy import symbols # Coefficient # Speed of light (m/s) _A : List[Any] = 299792458 # Symbols _A , _A , _A , _A : Union[str, Any] = symbols('''ct x y z''') ...
229
0
import copy from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Audio, ClassLabel, Features from .base import TaskTemplate @dataclass(frozen=_UpperCAmelCase ) class lowercase__ ( _UpperCAmelCase ): A__ : str =field(default="""audio-classific...
169
import unittest from diffusers import FlaxAutoencoderKL from diffusers.utils import is_flax_available from diffusers.utils.testing_utils import require_flax from .test_modeling_common_flax import FlaxModelTesterMixin if is_flax_available(): import jax @require_flax class lowercase__ ( _UpperCAm...
169
1
from ....configuration_utils import PretrainedConfig from ....utils import logging __lowerCamelCase : Union[str, Any] = logging.get_logger(__name__) __lowerCamelCase : Tuple = { '''CarlCochet/trajectory-transformer-halfcheetah-medium-v2''': ( '''https://huggingface.co/Carl...
219
import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () __lowerCamelCase : List[Any] = np.linspace(start=0, stop=75, num=75, endpoint=True, retstep=False) # Create two fuzzy sets by defining any membership function ...
219
1
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging __A : Optional[int] = logging.get_logger(__name__) __A : Optional[int] = ...
359
"""simple docstring""" import unittest from transformers import SqueezeBertConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import M...
27
0
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer lowercase : int = logging.get_logger(__nam...
42
'''simple docstring''' import tensorflow as tf from ...tf_utils import shape_list class __UpperCAmelCase ( tf.keras.layers.Layer ): def __init__( self , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_=1 , ...
42
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowercase : str = { """configuration_timesformer""": ["""TIMESFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TimesformerConfig"""], } try: if...
91
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging _lowercase : int = logging.get_logger(__name__) _lowercase : Optional[Any] = {"""openai-gpt""": """https://huggingface.co/openai-gpt/resolve/main/config.json...
91
1
def snake_case__ ( lowerCAmelCase_ ): """simple docstring""" SCREAMING_SNAKE_CASE =0 # if input_string is "aba" than new_input_string become "a|b|a" SCREAMING_SNAKE_CASE ='' SCREAMING_SNAKE_CASE ='' # append each character + "|" in...
334
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertTokenizer, AutoTokenizer,...
334
1
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, ) def _...
358
a_ = '\n# Transformers 설치 방법\n! pip install transformers datasets\n# 마지막 릴리스 대신 소스에서 설치하려면, 위 명령을 주석으로 바꾸고 아래 명령을 해제하세요.\n# ! pip install git+https://github.com/huggingface/transformers.git\n' a_ = [{'type': 'code', 'content': INSTALL_CONTENT}] a_ = { '{processor_class}': 'FakeProcessorClass', '{model...
50
0
def lowerCAmelCase ( _lowerCAmelCase : int ): """simple docstring""" if bit_count < 0: raise ValueError("The given input must be positive" ) # get the generated string sequence UpperCAmelCase__ = gray_code_sequence_string(_lowerCAmelCase ) # # convert the...
169
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCAmelCase : List[Any] = logging.get_logger(__name__) _lowerCAmelCase : List[str] = { "google/realm-cc-news-pretrained-embedder": ( "https://huggingface.co/google/realm-cc-news-pretr...
169
1
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class lowerCAmelCase : __lowerCamelCase = 42 __lowerCamelCase = None __lowerCamelCase = None _snake_case = namedtuple("""CoinsDistribResult""", """mov...
355
from __future__ import annotations def _A ( __magic_name__ , __magic_name__ ): lowercase__ = [] create_all_state(1 , __magic_name__ , __magic_name__ , [] , __magic_name__ ) return result def _A ( __magic_name__ , __magic_name__ , __magic_name__ , __magic_name__ , __...
201
0
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 lowerCAm...
212
'''simple docstring''' import torch from transformers import AutoModel class __UpperCamelCase ( torch.nn.Module ): def __init__( self , __a="sayef/fsner-bert-base-uncased" ): '''simple docstring''' super(__a , self ).__init__() __a ...
27
0
"""simple docstring""" from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class lowerCAmelCase__ : __a = 42 __a = 42 class lowerCAmelCase__ : ...
40
"""simple docstring""" from __future__ import annotations from random import random class lowerCAmelCase__ : def __init__( self : str , _lowerCamelCase : int | None = None ): _snake_case = value _snake_case = random(...
40
1
"""simple docstring""" # limitations under the License. # NOTE: This file is deprecated and will be removed in a future version. # It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works from .pipelines import DiffusionPipeline, ImagePipelineOutput # noqa: F401 from ...
91
"""simple docstring""" 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 UpperCAmelCase_ : Dict = logging.get_logger(__name__) UpperCAmelCase_ ...
91
1
from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase__ :Dict = logging.get_logger(__name__) lowerCAmelCase__ :List[str] = { '''facebook/s2t-wav2vec2-large-en-de''': ( '''https://huggingface.co/facebook/s2t-wav2vec2-large-...
357
import coval # From: git+https://github.com/ns-moosavi/coval.git # noqa: F401 from coval.conll import reader, util from coval.eval import evaluator import datasets lowerCAmelCase__ :Optional[Any] = datasets.logging.get_logger(__name__) lowerCAmelCase__ :str = '''\ @InProce...
185
0
"""simple docstring""" def __lowerCAmelCase ( lowercase : Tuple ) -> int: """simple docstring""" if n == 1 or not isinstance(_UpperCAmelCase , _UpperCAmelCase ): return 0 elif n == 2: return 1 else: snake_case : List[str] ...
203
import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def SCREAMING_SNAKE_CASE ( _UpperCAmelCase , _UpperCAmelCase=() , _UpperCAmelCase=None , _UpperCAmelCas...
50
0
"""simple docstring""" import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
53
"""simple docstring""" def lowercase__ ( _UpperCAmelCase ) -> int: '''simple docstring''' assert isinstance(_UpperCAmelCase , _UpperCAmelCase ), f'''The input value of [n={number}] is not an integer''' if number == 1: ret...
53
1
'''simple docstring''' import inspect import unittest from transformers import DPTConfig from transformers.file_utils import is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_vision, slow, torch_device from ...tes...
89
import logging import os from dataclasses import dataclass, field from typing import Dict, Optional import datasets import numpy as np import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, EvalPrediction, HfArgumentParser, PreTrainedTokenizer, ...
201
0
"""simple docstring""" import datasets from .evaluate import evaluate __snake_case : Optional[Any] = '\\n@inproceedings{Rajpurkar2016SQuAD10,\n title={SQuAD: 100, 000+ Questions for Machine Comprehension of Text},\n author={Pranav Rajpurkar and Jian Zhang and Konstantin L...
58
"""simple docstring""" import sys __snake_case : List[Any] = ( '73167176531330624919225119674426574742355349194934' '96983520312774506326239578318016984801869478851843' '85861560789112949495459501737958331952853208805511' '125406987471585238630507156932909632...
58
1
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) __lowercase = { """configuration_vision_encoder_decoder""": ["""V...
40
"""simple docstring""" import os import sys import unittest __lowercase = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, """utils""")) import check_dummies # noqa: E402 from check_dummies import crea...
40
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/LICENSE-2.0 #...
80
"""simple docstring""" import gc import unittest from diffusers import FlaxControlNetModel, FlaxStableDiffusionControlNetPipeline from diffusers.utils import is_flax_available, load_image, slow from diffusers.utils.testing_utils import require_flax if is_flax_available(): import jax import jax.nu...
80
1
"""simple docstring""" import argparse import torch from transformers import YosoConfig, YosoForMaskedLM def lowercase_ ( _snake_case ): if "model" in orig_key: SCREAMING_SNAKE_CASE__ : Union[str, Any] = orig_key.replace("""model.""" ,"""""" ...
25
'''simple docstring''' from copy import deepcopy from typing import Optional, Union import numpy as np from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, is_tf_available, is_torch_available if is_torch_available(): import ...
185
0
"""simple docstring""" import argparse from argparse import Namespace import torch from torch import nn from transformers import XGLMConfig, XGLMForCausalLM def a__ ( snake_case__ ) -> List[str]: lowerCamelCase = [ """decoder.version""", """decoder.output_projecti...
168
"""simple docstring""" import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debug.metrics as met ...
168
1
'''simple docstring''' import argparse import os import re import numpy as np import PIL import torch from timm import create_model from torch.optim.lr_scheduler import OneCycleLR from torch.utils.data import DataLoader, Dataset from torchvision.transforms import Compose, RandomResizedCrop, Resize, ToTensor fro...
53
'''simple docstring''' from __future__ import annotations from typing import Any class snake_case ( __lowerCamelCase ): """simple docstring""" pass class snake_case : """simple docstring""" def __init__( self : List[Any] , __A : ...
53
1
def snake_case_ ( snake_case = 1_00_00_00 ) -> int: lowercase__: Dict = limit + 1 lowercase__: Optional[Any] = [0] * limit for first_term in range(1 , snake_case ): for n in range(snake_case , ...
363
import json import os import shutil import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoConfig, BertConfig, GPTaConfig from transform...
288
0
'''simple docstring''' import argparse import json from collections import OrderedDict from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( SegformerConfig, SegformerForImageClassification, SegformerForSem...
58
'''simple docstring''' from typing import List from .keymap import KEYMAP, get_character def lowerCamelCase ( __lowerCamelCase : str ) ->Optional[int]: def decorator(__lowerCamelCase : int ): _SCREAMING_SNAKE_CASE = getattr(__lowerCamelCase , """ha...
58
1
from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance __lowerCamelCase : Union[str, Any] = 6_3_7_8_1_3_7.0 __lowerCamelCase : Optional[Any] = 6_3_5_6_7_5_2.3_1_4_2_4_5 __lowerCamelCase : Tuple = 637_8137 def A_ ( _lowerCA...
364
import unittest from transformers import AlbertTokenizer, AlbertTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from ...test_tokenization_common import TokenizerTesterMixin __lowerCamelCase : Dict = get_tests_dir("""fixtures/spiec...
140
0
'''simple docstring''' a__ : List[Any] = { 'Pillow': 'Pillow<10.0.0', 'accelerate': 'accelerate>=0.20.3', 'av': 'av==9.2.0', 'beautifulsoup4': 'beautifulsoup4', 'black': 'black~=23.1', 'codecarbon': 'codecarbon==1.2.0', 'cookiecutter': 'cookiecutter==1.7.3', '...
80
'''simple docstring''' def _UpperCamelCase ( __A ) -> int: '''simple docstring''' UpperCamelCase__ = 0 while num > 0: digit_sum += num % 10 num //= 10 return digit_sum def _UpperCamelCase ( __A = 100 ) ...
80
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase_ : Union[str, Any] = logging.get_logger(__name__) UpperCAmelCase_ : Optional[Any] = { "facebook/timesformer": "https://huggingface.co/facebook/timesformer/resolve/main/config.json...
198
from __future__ import annotations from random import random class UpperCamelCase : def __init__( self , UpperCAmelCase__ = None ): A__ = value A__ = random() A__ = None A__ = None def __repr__( self )...
198
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) a_ : Union[str, Any] = { "config...
168
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) a_ : Union[str, Any] = { "config...
168
1
'''simple docstring''' import os def a__ ( ): """simple docstring""" with open(os.path.dirname(a__ ) + """/p022_names.txt""" ) as file: __SCREAMING_SNAKE_CASE = str(file.readlines()[0] ) __SCREAMING_SNAKE_CASE = names.replace("...
356
'''simple docstring''' import os def a__ ( a__ = "input.txt" ): """simple docstring""" with open(os.path.join(os.path.dirname(a__ ) , a__ ) ) as input_file: __SCREAMING_SNAKE_CASE = [ [int(a__ ) for element in line.spli...
331
0
from __future__ import annotations import collections import pprint from pathlib import Path def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ ) -> str: return "".join(sorted(__lowerCamelCase ) ) def lowerCAmelCase__ ( SCREAMING_SNAKE_CASE_ ) -> list[str]: return word_by_sign...
212
"""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 _UpperCAmelCase ( __lowerCamelCase : str ) -> List[Any]: ret...
288
0
'''simple docstring''' 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 .toke...
91
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.ut...
91
1
from collections.abc import Callable from math import pi, sqrt from random import uniform from statistics import mean def A_ ( A__ ) -> Tuple: # A local function to see if a dot lands in the circle. def is_in_circle(A__ , A__ ) -> bool: a__ : List[str] = sqrt...
99
from typing import List, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging _UpperCAmelCase = logging.get_logger(__name__) _UpperCAmelCase = { """huggingface/time-series-transformer-tourism-monthly""": ( """https://huggingface.co/huggin...
140
0
def SCREAMING_SNAKE_CASE__ ( lowerCamelCase__ = 1_0_0 ) -> int: __lowerCamelCase : Any = n * (n + 1) * (2 * n + 1) / 6 __lowerCamelCase : Any = (n * (n + 1) / 2) ** 2 return int(square_of_sum - sum_of_squares ) if __name__ == "__main__": print(F"""{solution(...
368
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) a ={ """configuration_roformer""": ["""ROFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Ro...
113
0
'''simple docstring''' from ...processing_utils import ProcessorMixin class UpperCAmelCase ( a__ ): '''simple docstring''' SCREAMING_SNAKE_CASE = "SpeechT5FeatureExtractor" SCREAMING_SNAKE_CASE = "SpeechT5Tokenizer" def __init__( self , __lo...
198
'''simple docstring''' def __UpperCamelCase ( UpperCAmelCase ): lowercase__ : List[str] = 0 while num > 0: digit_sum += num % 10 num //= 10 return digit_sum def __UpperCamelCase ( UpperCAmelCase = 100 ): lowercase__ : Dict = 1 lowercase__ : Optional[in...
198
1
import string # frequency taken from https://en.wikipedia.org/wiki/Letter_frequency __lowerCamelCase : List[str] = { '''E''': 12.70, '''T''': 9.06, '''A''': 8.17, '''O''': 7.51, '''I''': 6.97, '''N''': 6.75, '''S''': 6.33, '''H''': 6.09, '''R''': 5.9...
357
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassificat...
204
0
import os from typing import Dict, List, Union import tensorflow as tf from keras_nlp.tokenizers import BytePairTokenizer from tensorflow_text import pad_model_inputs from .tokenization_gpta import GPTaTokenizer class _A ( tf.keras.layers.Layer): def __init__( self , _SCREAMING_SNAKE_CAS...
253
'''simple docstring''' def lowerCamelCase ( ): """simple docstring""" return 1 def lowerCamelCase ( lowerCAmelCase : int ): """simple docstring""" return 0 if x < 0 else two_pence(x - 2 ) + one_pence() def lowerCamelCase ( lowerCAmelCase : int ): """s...
331
0
"""simple docstring""" def snake_case__ ( SCREAMING_SNAKE_CASE_ : int ): '''simple docstring''' if n == 1 or not isinstance(SCREAMING_SNAKE_CASE_ , SCREAMING_SNAKE_CASE_ ): return 0 elif n == 2: return 1 else: lowercase__ ...
366
from __future__ import annotations import math def snake_case__ ( SCREAMING_SNAKE_CASE_ : int ): '''simple docstring''' if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, ...
216
0
"""simple docstring""" def _A (__a ) -> str: """simple docstring""" SCREAMING_SNAKE_CASE_ : Dict = 0 SCREAMING_SNAKE_CASE_ : Union[str, Any] = len(__a ) for i in range(n - 1 ): for j in range(i + 1 , __a ...
91
"""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
1
"""simple docstring""" from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class lowercase : _a = 4_2 _a = None _a = ...
369
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_processor impo...
343
0
from abc import ABC, abstractmethod from argparse import ArgumentParser class __snake_case ( UpperCamelCase_ ): @staticmethod @abstractmethod def UpperCAmelCase__ ( A_ : ArgumentParser): raise NotImplementedError() @abstractme...
103
"""simple docstring""" def lowercase (SCREAMING_SNAKE_CASE_ : int ) -> str: SCREAMING_SNAKE_CASE = int(SCREAMING_SNAKE_CASE_ ) if decimal in (0, 1): # Exit cases for the recursion return str(SCREAMING_SNAKE_CASE_ ) SCREAMING_SNAKE_CAS...
113
0
from __future__ import annotations def _UpperCAmelCase (UpperCamelCase_ : list[int] , UpperCamelCase_ : list[int] , UpperCamelCase_ : list[int] , UpperCamelCase_ : list[list[str]] , UpperCamelCase_ : int , ): '''simple docstring''' _lowerCAmelCase : List[st...
361
from __future__ import annotations from typing import Generic, TypeVar _lowerCamelCase : Dict = TypeVar("T") class __snake_case (Generic[T] ): def __init__( self : Dict , _UpperCAmelCase : T ) -> None: '''simple docstring''' _lowerCAmel...
159
0