code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
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__) ...
32
"""simple docstring""" import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import Generatio...
682
0
import re def a ( lowerCamelCase_ ): '''simple docstring''' lowercase__ = re.compile(r'''^(\+91[\-\s]?)?[0]?(91)?[789]\d{9}$''' ) if match := re.search(lowerCAmelCase_ , lowerCAmelCase_ ): return match.string == phone return False i...
183
"""simple docstring""" import os def UpperCAmelCase__ (): '''simple docstring''' with open(os.path.dirname(lowerCAmelCase_ ) + "/p022_names.txt" ) as file: __SCREAMING_SNAKE_CASE = str(file.readlines()[0] ) __SCREAMING_SNAKE_CASE = names.replace...
682
0
'''simple docstring''' import logging import torch from accelerate import Accelerator from arguments import EvaluationArguments from datasets import load_dataset from torch.utils.data import IterableDataset from torch.utils.data.dataloader import DataLoader from transformers import AutoModelForCausalLM, AutoToke...
78
"""simple docstring""" import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def UpperCAmelCase__ (lowerCAmelCase_ , lowerCAmelCase_ , lowerCAmelCase_ ): ...
682
0
import contextlib import os import sqlitea import pytest from datasets import Dataset, Features, Value from datasets.io.sql import SqlDatasetReader, SqlDatasetWriter from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases, require_sqlalchemy def Upp...
455
"""simple docstring""" import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.auto.mo...
682
0
from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline _lowerCAmelCase: Union[str, Any] = logging.get_lo...
20
"""simple docstring""" import gc import unittest import torch from parameterized import parameterized from diffusers import AutoencoderKL from diffusers.utils import floats_tensor, load_hf_numpy, require_torch_gpu, slow, torch_all_close, torch_device from diffusers.utils.import_utils import is_xformers_avai...
682
0
from ... import PretrainedConfig lowercase_ = { '''sijunhe/nezha-cn-base''': '''https://huggingface.co/sijunhe/nezha-cn-base/resolve/main/config.json''', } class _UpperCamelCase ( lowerCamelCase__ ): '''simple docstring''' _A = NEZHA_PRETRAINED_CONFIG_ARCH...
562
"""simple docstring""" import math import unittest from transformers import BioGptConfig, 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_...
682
0
from ...configuration_utils import PretrainedConfig UpperCamelCase = { '''google/tapas-base-finetuned-sqa''': ( '''https://huggingface.co/google/tapas-base-finetuned-sqa/resolve/main/config.json''' ), '''google/tapas-base-finetuned-wtq''': ( '''https://huggingface.co/googl...
45
"""simple docstring""" import os import pytest from attr import dataclass a__ : int = '''us-east-1''' # defaults region @dataclass class UpperCamelCase_ : """simple docstring""" snake_case__ : str snake_case__ : Optional[Any] = "arn:a...
682
0
"""simple docstring""" from argparse import ArgumentParser, Namespace from typing import Any, List, Optional from ..pipelines import Pipeline, get_supported_tasks, pipeline from ..utils import logging from . import BaseTransformersCLICommand try: from fastapi import Body, FastAPI, HTTPException from fast...
624
"""simple docstring""" import warnings from ..trainer import Trainer from ..utils import logging a__ : Any = logging.get_logger(__name__) class UpperCamelCase_ ( UpperCamelCase): """simple docstring""" def __init__( self : Any , UpperCAmelCa...
682
0
"""simple docstring""" import unittest import numpy as np from transformers.testing_utils import require_pytesseract, require_torch from transformers.utils import is_pytesseract_available, is_torch_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is...
636
"""simple docstring""" def UpperCAmelCase__ (lowerCAmelCase_ ): '''simple docstring''' if collection == []: return [] # get some information about the collection __SCREAMING_SNAKE_CASE = len(lowerCAmelCase_ ) __SCREAMING_SNAKE_CASE = max(lowerC...
682
0
'''simple docstring''' import unittest from transformers import AutoTokenizer, is_flax_available from transformers.testing_utils import require_flax, require_sentencepiece, require_tokenizers, slow if is_flax_available(): import jax.numpy as jnp from transformers import FlaxXLM...
28
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available a__ : Tuple = { '''configuration_rag''': ['''RagConfig'''], '''retrieval_rag''': ['''RagRetriever'''], '''tokenization_...
682
0
"""simple docstring""" import argparse import re import requests import torch # git clone https://github.com/salesforce/BLIP.git from models.blip import blip_decoder from models.blip_itm import blip_itm from models.blip_vqa import blip_vqa from PIL import Image from torchvision import transforms from torchvi...
46
"""simple docstring""" from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a__ : List[str] = logging.get_logger(__name__) a__ : str = { '''xlm-...
682
0
from __future__ import annotations import math def A__ ( SCREAMING_SNAKE_CASE_ : Optional[int] ) -> Any: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negative...
32
"""simple docstring""" import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStructProcessor, ...
682
0
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.testing_utils import require_vision from transformers.utils i...
183
"""simple docstring""" import argparse import os # New Code # import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_s...
682
0
'''simple docstring''' import requests SCREAMING_SNAKE_CASE_: List[str] ='''''' # <-- Put your OpenWeatherMap appid here! SCREAMING_SNAKE_CASE_: str ='''https://api.openweathermap.org/data/2.5/''' def lowerCAmelCase_ ( snake_case_ : Optional[int] = "Chicago" , snake_case_ ...
78
"""simple docstring""" from typing import Optional, Tuple, Union import tensorflow as tf from ...activations_tf import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward from ...modeling_tf_outputs import ( TFBaseModelOutputWithNoAtte...
682
0
import collections import gzip import os import urllib import numpy from tensorflow.python.framework import dtypes, random_seed from tensorflow.python.platform import gfile from tensorflow.python.util.deprecation import deprecated lowerCamelCase__ = collections.namedtuple("""_Datasets...
455
"""simple docstring""" def UpperCAmelCase__ (lowerCAmelCase_ ): '''simple docstring''' if edge <= 0 or not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ): raise ValueError("Length must be a positive." ) return 3 * ((25 + 10 * (5 ** (1 / 2))) ** (1 / 2)) * (edge**2) ...
682
0
import unittest from transformers import is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device if is_torch_available(): from transformers import AutoModelForSeqaSeqLM, AutoTokenizer @require_torch @require_sentencepiece @require...
20
"""simple docstring""" import time import warnings from abc import ABC from copy import deepcopy from typing import Optional import torch from ..utils import add_start_docstrings, logging a__ : Union[str, Any] = logging.get_logger(__name__) a__ : Optional[int] = r''' ...
682
0
import numpy as np import torch from torch.utils.data import Dataset from utils import logger class _UpperCamelCase ( lowerCamelCase__ ): '''simple docstring''' def __init__( self : int , SCREAMING_SNAKE_CASE_ : Any , SCREAMING_SNAKE_CASE_ : Opt...
562
"""simple docstring""" import json import os import unittest from transformers.models.roc_bert.tokenization_roc_bert import ( VOCAB_FILES_NAMES, RoCBertBasicTokenizer, RoCBertTokenizer, RoCBertWordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.te...
682
0
import numpy as np from cva import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filteraD, imread, imshow, waitKey def A ( lowercase__ : int , lowercase__ : Tuple , lowercase__ : Optional[int] , lowercase__ : Any , lowercase__ : Union[str, Any] , lowercase__ : int ) -> str: if (ksize % 2)...
45
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging a__ : Union[str, Any] = logging.get_logger(__name__) a__ : Optional[int] = { '''google/vivit-b-16x2-kinetics400''': ( '''https://huggingface.co/google/vivi...
682
0
"""simple docstring""" import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics fro...
624
"""simple docstring""" import numpy as np from transformers import Pipeline def UpperCAmelCase__ (lowerCAmelCase_ ): '''simple docstring''' __SCREAMING_SNAKE_CASE = np.max(lowerCAmelCase_ , axis=-1 , keepdims=lowerCAmelCase_ ) __SCREAMING_SNAKE_CASE = ...
682
0
"""simple docstring""" import os import tempfile import unittest from transformers import NezhaConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device from ...generation.test_utils import GenerationTest...
636
"""simple docstring""" import importlib import os import sys # This is required to make the module import works (when the python process is running from the root of the repo) sys.path.append('''.''') def UpperCAmelCase__ (lowerCAmelCase_ ): '''simple docstring''' __SCREAMING_SNAKE_C...
682
0
'''simple docstring''' import collections import tempfile import unittest import numpy as np from transformers.testing_utils import ( is_pt_flax_cross_test, require_flax, require_torch, require_vision, slow, torch_device, ) from transformers.utils import is_flax_available, is_torch_available...
683
'''simple docstring''' _UpperCAmelCase : str = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : str = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : List[str] = { 0: """Sunday""", 1: """Monday""", 2: """Tuesday""", 3: """Wednesday""", 4: """Thursday""", 5:...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,UpperCamelCase ) -> Union[str, Any]: if height >= 1: move_tower(height - 1 ,UpperCamelCase ,UpperCamelCase ,UpperCamelCase ) move_disk(UpperCamelCase ,UpperCa...
683
'''simple docstring''' import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, s...
683
1
'''simple docstring''' class UpperCAmelCase : """simple docstring""" def __init__( self , _snake_case ) -> None: _UpperCamelCase : Optional[int] = set_counts _UpperCamelCase : Optional[int] = max(_snake_case ) _UpperCamelCase : ...
683
'''simple docstring''' # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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 # # Unle...
683
1
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) _UpperCAmelCase : Optional[int] = pytest.mark.integration @pytest.mark.para...
683
'''simple docstring''' import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def ...
683
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCAmelCase : List[Any] = {"""configuration_vit_msn""": ["""VIT_MSN_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ViTMSNConfig"""]} try: if not is_torch_available(): r...
683
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil _UpperCAmelCase : int = 100 _UpperCAmelCase : List[Any] = set(range(3, NUM_PRIMES, 2)) primes.add(2) _UpperCAmelCase : int for prime in range(3, ceil(NUM_PRIMES**0.5), 2): if prime no...
683
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_poolformer import PoolFormerImageProcessor _UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) class UpperCAmelCase ( a_ ): """simple docstring""" def __init__( self ...
683
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformer...
683
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase : Dict = logging.get_logger(__name__) _UpperCAmelCase : Any = { """kssteven/iber...
683
'''simple docstring''' from collections.abc import Iterable from typing import Any class UpperCAmelCase : """simple docstring""" def __init__( self , _snake_case = None ) -> Optional[int]: _UpperCamelCase : int = value _UpperCamelCase : Node | ...
683
1
'''simple docstring''' from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class UpperCAmelCase ( a_ ): """simple docstring""" A__ : Tuple = 'EncodecFeatureExtractor' A__ : str = ('T5Tokeni...
683
'''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 ...feature_extraction_utils i...
683
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available _UpperCAmelCase : Tuple = { """configuration_longt5""": ["""LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LongT5Config""", """LongT5OnnxConfig"""...
683
'''simple docstring''' import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": _UpperCAmelCase : Tuple = argparse.ArgumentParser( description=( """Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transf...
683
1
'''simple docstring''' from typing import List, Optional, Union import numpy as np import PIL.Image from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, PILImageResam...
683
'''simple docstring''' import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( Fla...
683
1
'''simple docstring''' import numpy as np from PIL import Image def snake_case__ ( UpperCamelCase ,UpperCamelCase ,UpperCamelCase ) -> np.ndarray: _UpperCamelCase : Any = np.array(UpperCamelCase ) if arr.shape[0] != arr.shape[1]: raise ValueError('''The ...
683
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) _UpperCAmelCase : Optional[int] = pytest.mark.integration @pytest.mark.para...
683
1
'''simple docstring''' from math import sqrt def snake_case__ ( UpperCamelCase ) -> int: _UpperCamelCase : List[str] = 0 for i in range(1 ,int(sqrt(UpperCamelCase ) + 1 ) ): if n % i == 0 and i != sqrt(UpperCamelCase ): total += i + n // ...
683
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device fr...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> bool: _UpperCamelCase : Optional[Any] = (1 + 24 * n) ** 0.5 return ((1 + root) / 6) % 1 == 0 def snake_case__ ( UpperCamelCase = 50_00 ) -> int: _UpperCamelCase : Dict = [(i *...
683
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available _UpperCAmelCase : Tuple = { """configuration_longt5""": ["""LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LongT5Config""", """LongT5OnnxConfig"""...
683
1
'''simple docstring''' import os import unittest from transformers import LxmertTokenizer, LxmertTokenizerFast from transformers.models.bert.tokenization_bert import VOCAB_FILES_NAMES from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tok...
683
'''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_distilbert import DistilBertTokenizer _UpperCAmelCase : Optional[int] = logging.get_...
683
1
'''simple docstring''' import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, DPMSolverMultistepScheduler, TextToVideoSDPipeline, UNetaDConditionModel, ) from diffusers.utils impo...
683
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> list: _UpperCamelCase : Any = False while is_sorted is False: # Until all the indices are traversed keep looping _UpperCamelCase : List[str] = True for i in range(0 ,len(UpperCamelCase ...
683
1
'''simple docstring''' from collections import defaultdict def snake_case__ ( UpperCamelCase ,UpperCamelCase ) -> bool: _UpperCamelCase : str = first_str.lower().strip() _UpperCamelCase : Dict = second_str.lower().strip() # Remove whitespace _UpperC...
683
'''simple docstring''' 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_att...
683
1
'''simple docstring''' from collections.abc import Iterable from typing import Any class UpperCAmelCase : """simple docstring""" def __init__( self , _snake_case = None ) -> Optional[int]: _UpperCamelCase : int = value _UpperCamelCase : Node | ...
683
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase ( a_ ): """simple docstring""" A__ : str = ['image_processor', 'tokenizer'] A__ : Dict = 'CLIPImageProcessor...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ,UpperCamelCase ) -> Tuple: _UpperCamelCase : Optional[Any] = '''''' for i in table: res += inp[i - 1] return res def snake_case__ ( UpperCamelCase ) -> List[Any]: return data[1:] + d...
683
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters _UpperCAmelCase : Union[str, Any] = (720, 1280) # Height, Width _UpperCAmelCase : str = (0.4, 0.6) # if height or width lower than this scale, drop it. ...
683
1
'''simple docstring''' import argparse from pathlib import Path from typing import Dict, OrderedDict, Tuple import torch from audiocraft.models import MusicGen from transformers import ( AutoFeatureExtractor, AutoTokenizer, EncodecModel, MusicgenDecoderConfig, MusicgenForConditionalGeneration, ...
683
'''simple docstring''' from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class UpperCA...
683
1
'''simple docstring''' from collections import defaultdict class UpperCAmelCase : """simple docstring""" def __init__( self , _snake_case , _snake_case ) -> Optional[Any]: _UpperCamelCase : Optional[Any] = total # total no of tasks (N) # DP tab...
683
'''simple docstring''' # Copyright 2022 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 # # Unl...
683
1
'''simple docstring''' import argparse import json import os import re import shutil import torch from transformers import BioGptConfig, BioGptForCausalLM from transformers.models.biogpt.tokenization_biogpt import VOCAB_FILES_NAMES from transformers.tokenization_utils_base import TOKENIZER_CONFIG_FILE from transfor...
683
'''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 timm import create_model from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transforme...
683
1
'''simple docstring''' from __future__ import annotations import unittest from transformers import FunnelConfig, is_tf_available from transformers.testing_utils import require_tf from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_atte...
683
'''simple docstring''' _UpperCAmelCase : Any = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100000)] def snake_case__ ( UpperCamelCase ) -> int: _UpperCamelCase : Any = 0 while number: # Increased Speed Slightly by checking every 5 digits together....
683
1
'''simple docstring''' from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class UpperCA...
683
'''simple docstring''' _UpperCAmelCase : str = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : str = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : List[str] = { 0: """Sunday""", 1: """Monday""", 2: """Tuesday""", 3: """Wednesday""", 4: """Thursday""", 5:...
683
1
'''simple docstring''' import unittest import numpy as np from transformers import BertConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, floats_tensor, ids_tensor, random_attention_mask if is_flax_available(): from ...
683
'''simple docstring''' import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, s...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,UpperCamelCase ) -> bool: # 1. Validate that path exists between current and next vertices if graph[path[curr_ind - 1]][next_ver] == 0: return False # 2. Validate that next vertex i...
683
'''simple docstring''' # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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 # # Unle...
683
1
'''simple docstring''' from graphs.minimum_spanning_tree_kruskal import kruskal def snake_case__ ( ) -> Any: _UpperCamelCase : Optional[int] = 9 _UpperCamelCase : str = [ [0, 1, 4], [0, 7, 8], [1, 2, 8], [7, 8, 7], [7, 6, 1], [2...
683
'''simple docstring''' import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def ...
683
1
'''simple docstring''' from __future__ import annotations def snake_case__ ( UpperCamelCase ,UpperCamelCase ,UpperCamelCase ,) -> tuple: if (electron_conc, hole_conc, intrinsic_conc).count(0 ) != 1: raise ValueError('''You cannot supply more or less than 2 values''' ...
683
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil _UpperCAmelCase : int = 100 _UpperCAmelCase : List[Any] = set(range(3, NUM_PRIMES, 2)) primes.add(2) _UpperCAmelCase : int for prime in range(3, ceil(NUM_PRIMES**0.5), 2): if prime no...
683
1
'''simple docstring''' import argparse import fairseq import torch from torch import nn from transformers import ( MBartaaTokenizer, MBartConfig, MBartForCausalLM, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureExtractor, WavaVecaModel, logg...
683
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformer...
683
1
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import DanceDiffusionPipeline, IPNDMScheduler, UNetaDModel from diffusers.utils import slow, torch_device from diffusers.utils.testing_utils import enable_full_determinism, require_torch_gpu, skip_mps from ..pipeline_pa...
683
'''simple docstring''' from collections.abc import Iterable from typing import Any class UpperCAmelCase : """simple docstring""" def __init__( self , _snake_case = None ) -> Optional[int]: _UpperCamelCase : int = value _UpperCamelCase : Node | ...
683
1
'''simple docstring''' import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_tokenizati...
683
'''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 ...feature_extraction_utils i...
683
1
'''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_retribert import RetriBertTokenizer _UpperCAmelCase : List[str] = logging.get_logg...
683
'''simple docstring''' import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": _UpperCAmelCase : Tuple = argparse.ArgumentParser( description=( """Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transf...
683
1
'''simple docstring''' import random import unittest import numpy as np import torch from diffusers import ( DPMSolverMultistepScheduler, EulerAncestralDiscreteScheduler, EulerDiscreteScheduler, LMSDiscreteScheduler, OnnxStableDiffusionUpscalePipeline, PNDMScheduler, ) from diffusers.utils i...
683
'''simple docstring''' import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( Fla...
683
1
'''simple docstring''' 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, ) if is_sentencepiece_available(): from ..ta.tokeniza...
683
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) _UpperCAmelCase : Optional[int] = pytest.mark.integration @pytest.mark.para...
683
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCAmelCase : str = { """configuration_swinv2""": ["""SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Swinv2Config"""], } try: if not is_torch_available(): r...
683
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device fr...
683
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices _UpperCAmelCase : List[Any] = logging.get_logger(__name__) _UpperCAmelCase : List[str] = { ...
683
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available _UpperCAmelCase : Tuple = { """configuration_longt5""": ["""LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LongT5Config""", """LongT5OnnxConfig"""...
683
1
'''simple docstring''' from copy import deepcopy class UpperCAmelCase : """simple docstring""" def __init__( self , _snake_case = None , _snake_case = None ) -> None: if arr is None and size is not None: _UpperCamelCase : Optional[int] = size ...
683
'''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_distilbert import DistilBertTokenizer _UpperCAmelCase : Optional[int] = logging.get_...
683
1
'''simple docstring''' from math import pow, sqrt def snake_case__ ( *UpperCamelCase ) -> bool: _UpperCamelCase : Optional[Any] = len(UpperCamelCase ) > 0 and all(value > 0.0 for value in values ) return result def snake_case__ ( UpperCamelCase ...
683
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> list: _UpperCamelCase : Any = False while is_sorted is False: # Until all the indices are traversed keep looping _UpperCamelCase : List[str] = True for i in range(0 ,len(UpperCamelCase ...
683
1
'''simple docstring''' import numpy as np def snake_case__ ( UpperCamelCase ,UpperCamelCase ,UpperCamelCase = 1e-12 ,UpperCamelCase = 1_00 ,) -> tuple[float, np.ndarray]: assert np.shape(UpperCamelCase )[0] == np.shape(UpperCamelCase )[1] # Ensure proper dimensi...
683
'''simple docstring''' 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_att...
683
1
'''simple docstring''' from collections.abc import Sequence def snake_case__ ( UpperCamelCase ,UpperCamelCase = False ) -> float: if not arr: return 0 _UpperCamelCase : Optional[int] = 0 if allow_empty_subarrays else float('''-inf''' ) _UpperCamelCase ...
683
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase ( a_ ): """simple docstring""" A__ : str = ['image_processor', 'tokenizer'] A__ : Dict = 'CLIPImageProcessor...
683
1
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class UpperCAmelCase ( a_ ): ...
683
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters _UpperCAmelCase : Union[str, Any] = (720, 1280) # Height, Width _UpperCAmelCase : str = (0.4, 0.6) # if height or width lower than this scale, drop it. ...
683
1
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging _UpperCAmelCase : int = logging.get_logger(__name__) _UpperCAmelCase : ...
683
'''simple docstring''' from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class UpperCA...
683
1
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil _UpperCAmelCase : int = 100 _UpperCAmelCase : List[Any] = set(range(3, NUM_PRIMES, 2)) primes.add(2) _UpperCAmelCase : int for prime in range(3, ceil(NUM_PRIMES**0.5), 2): if prime no...
683
'''simple docstring''' # Copyright 2022 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 # # Unl...
683
1
'''simple docstring''' from __future__ import annotations from collections import namedtuple def snake_case__ ( UpperCamelCase ,UpperCamelCase ,UpperCamelCase ) -> tuple: _UpperCamelCase : Tuple = namedtuple('''result''' ,'''name value''' ) if (voltage...
683
'''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 timm import create_model from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transforme...
683
1
'''simple docstring''' import gc import random import unittest import numpy as np import torch from transformers import XLMRobertaTokenizer from diffusers import ( AltDiffusionImgaImgPipeline, AutoencoderKL, PNDMScheduler, UNetaDConditionModel, ) from diffusers.image_processor import VaeImageProcess...
683
'''simple docstring''' _UpperCAmelCase : Any = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100000)] def snake_case__ ( UpperCamelCase ) -> int: _UpperCamelCase : Any = 0 while number: # Increased Speed Slightly by checking every 5 digits together....
683
1
'''simple docstring''' from manim import * class UpperCAmelCase ( a_ ): """simple docstring""" def _lowercase ( self ) -> str: _UpperCamelCase : str = Rectangle(height=0.5 , width=0.5 ) _UpperCamelCase : int = Rectangle(height=0....
683
'''simple docstring''' _UpperCAmelCase : str = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : str = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : List[str] = { 0: """Sunday""", 1: """Monday""", 2: """Tuesday""", 3: """Wednesday""", 4: """Thursday""", 5:...
683
1
'''simple docstring''' from typing import Dict, Optional import numpy as np import datasets _UpperCAmelCase : Dict = """ 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 ...
683
'''simple docstring''' import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, s...
683
1
'''simple docstring''' import os import jsonlines import numpy as np from tqdm import tqdm _UpperCAmelCase : Tuple = 2048 _UpperCAmelCase : int = 4096 _UpperCAmelCase : Dict = 42 _UpperCAmelCase : str = os.environ.pop("""PROCESS_TRAIN""", """false""") _UpperCAmelCase : List[str] ...
683
'''simple docstring''' # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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 # # Unle...
683
1
'''simple docstring''' from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _UpperCAmelCase : Any = logging.get_logger(__name__) _UpperCAmelCase : Optional[int] = { """Yitu...
683
'''simple docstring''' import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def ...
683
1
'''simple docstring''' from __future__ import annotations def snake_case__ ( UpperCamelCase ,UpperCamelCase ) -> int: if len(UpperCamelCase ) < k or k < 0: raise ValueError('''Invalid Input''' ) _UpperCamelCase : Tuple = sum(array[:k] ) for i in r...
683
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil _UpperCAmelCase : int = 100 _UpperCAmelCase : List[Any] = set(range(3, NUM_PRIMES, 2)) primes.add(2) _UpperCAmelCase : int for prime in range(3, ceil(NUM_PRIMES**0.5), 2): if prime no...
683
1
'''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_distilbert import DistilBertTokenizer _UpperCAmelCase : Optional[int] = logging.get_...
683
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformer...
683
1
'''simple docstring''' import math import torch from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from .attention_processor import Attention from .embeddings import get_timestep_embedding from .modeling_utils import ModelMixin class UpperCAmelCase ( a_ , a_ )...
683
'''simple docstring''' from collections.abc import Iterable from typing import Any class UpperCAmelCase : """simple docstring""" def __init__( self , _snake_case = None ) -> Optional[int]: _UpperCamelCase : int = value _UpperCamelCase : Node | ...
683
1
'''simple docstring''' import math def snake_case__ ( UpperCamelCase ,UpperCamelCase ) -> float: return math.pow(UpperCamelCase ,2 ) - a def snake_case__ ( UpperCamelCase ) -> float: return 2 * x def snake_case__ ( UpperCamelCa...
683
'''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 ...feature_extraction_utils i...
683
1
'''simple docstring''' from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class UpperCAmelCase ( a_ ): """simple docstring""" def _lowercase ( self , _snake_case ) -> float: ret...
683
'''simple docstring''' import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": _UpperCAmelCase : Tuple = argparse.ArgumentParser( description=( """Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transf...
683
1
'''simple docstring''' from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=a_ ) class UpperCAmelCase ( a_ ): """simple docstring""" A__ : str = field(default='summa...
683
'''simple docstring''' import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( Fla...
683
1
'''simple docstring''' _UpperCAmelCase : Dict = { 0: """0""", 1: """1""", 2: """2""", 3: """3""", 4: """4""", 5: """5""", 6: """6""", 7: """7""", 8: """8""", 9: """9""", 10: """a""", 11: """b""", 12: """c""", 13: """d""", 14: """e""", 15: """f"""...
683
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) _UpperCAmelCase : Optional[int] = pytest.mark.integration @pytest.mark.para...
683
1
'''simple docstring''' from typing import Optional import torch import torch.utils.checkpoint from torch import Tensor, nn from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss from ...activations import ACTaFN from ...file_utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstri...
683
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device fr...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> int: _UpperCamelCase : int = len(UpperCamelCase ) _UpperCamelCase : Optional[Any] = len(matrix[0] ) _UpperCamelCase : str = min(UpperCamelCase ,UpperCamelCase ) for ...
683
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available _UpperCAmelCase : Tuple = { """configuration_longt5""": ["""LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LongT5Config""", """LongT5OnnxConfig"""...
683
1
'''simple docstring''' import argparse import json import os from tensorflow.core.protobuf.saved_model_pba import SavedModel # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_copies.py _UpperCAmelCase : Optional[Any] = """.""" # ...
683
'''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_distilbert import DistilBertTokenizer _UpperCAmelCase : Optional[int] = logging.get_...
683
1
'''simple docstring''' import unittest from transformers import BigBirdConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax from transformers.models...
683
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> list: _UpperCamelCase : Any = False while is_sorted is False: # Until all the indices are traversed keep looping _UpperCamelCase : List[str] = True for i in range(0 ,len(UpperCamelCase ...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ,UpperCamelCase ) -> List[Any]: # "extended trapezoidal rule" # int(f) = dx/2 * (f1 + 2f2 + ... + fn) _UpperCamelCase : Optional[Any] = (boundary[1] - boundary[0]) / steps _UpperCamelCase : Optional[int] ...
683
'''simple docstring''' 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_att...
683
1
'''simple docstring''' import fire from transformers import AutoConfig, AutoModelForSeqaSeqLM, AutoTokenizer def snake_case__ ( UpperCamelCase ,UpperCamelCase ,**UpperCamelCase ) -> int: _UpperCamelCase : Tuple = AutoConfig.from_pretrained(UpperCamelCase ,**U...
683
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class UpperCAmelCase ( a_ ): """simple docstring""" A__ : str = ['image_processor', 'tokenizer'] A__ : Dict = 'CLIPImageProcessor...
683
1
'''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 .tokeniza...
683
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva import numpy as np # Parrameters _UpperCAmelCase : Union[str, Any] = (720, 1280) # Height, Width _UpperCAmelCase : str = (0.4, 0.6) # if height or width lower than this scale, drop it. ...
683
1
'''simple docstring''' import functools def snake_case__ ( UpperCamelCase ,UpperCamelCase ) -> int: _UpperCamelCase : List[str] = len(UpperCamelCase ) _UpperCamelCase : str = len(UpperCamelCase ) @functools.cache def min_distance(UpperCame...
683
'''simple docstring''' from transformers import BertTokenizer, EncoderDecoderModel, SeqaSeqTrainer, SeqaSeqTrainingArguments from transformers.testing_utils import TestCasePlus, require_torch, slow from transformers.utils import is_datasets_available if is_datasets_available(): import datasets class UpperCA...
683
1
'''simple docstring''' import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import BatchFeatu...
683
'''simple docstring''' # Copyright 2022 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 # # Unl...
683
1
'''simple docstring''' import itertools import string from collections.abc import Generator, Iterable def snake_case__ ( UpperCamelCase ,UpperCamelCase ) -> Generator[tuple[str, ...], None, None]: _UpperCamelCase : int = iter(UpperCamelCase ) while True: _Upp...
683
'''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 timm import create_model from timm.data import resolve_data_config from timm.data.transforms_factory import create_transform from transforme...
683
1
'''simple docstring''' import pickle import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, XGLMTokenizer, XGLMTokenizerFast from transformers.testing_utils import get_tests_dir, require_sentencepiece, require_tokenizers, slow from transformers.utils import cached_property from ......
683
'''simple docstring''' _UpperCAmelCase : Any = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100000)] def snake_case__ ( UpperCamelCase ) -> int: _UpperCamelCase : Any = 0 while number: # Increased Speed Slightly by checking every 5 digits together....
683
1
'''simple docstring''' # 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 # ...
683
'''simple docstring''' _UpperCAmelCase : str = [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : str = [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5] _UpperCAmelCase : List[str] = { 0: """Sunday""", 1: """Monday""", 2: """Tuesday""", 3: """Wednesday""", 4: """Thursday""", 5:...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ,UpperCamelCase ) -> bool: return numa ^ numa < 0 if __name__ == "__main__": import doctest doctest.testmod()
683
'''simple docstring''' import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, s...
683
1
'''simple docstring''' import tempfile import torch from diffusers import IPNDMScheduler from .test_schedulers import SchedulerCommonTest class UpperCAmelCase ( a_ ): """simple docstring""" A__ : Dict = (IPNDMScheduler,) A__ : List[str] = (('num_inference_steps', 50...
683
'''simple docstring''' # coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # 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 # # Unle...
683
1
'''simple docstring''' def snake_case__ ( UpperCamelCase ) -> int: _UpperCamelCase : int = 0 while num > 0: digit_sum += num % 10 num //= 10 return digit_sum def snake_case__ ( UpperCamelCase = 1_00 ) -> int: _UpperCamelCase : Any ...
683
'''simple docstring''' import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def ...
683
1
'''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 .tokeniza...
683
'''simple docstring''' from __future__ import annotations from functools import lru_cache from math import ceil _UpperCAmelCase : int = 100 _UpperCAmelCase : List[Any] = set(range(3, NUM_PRIMES, 2)) primes.add(2) _UpperCAmelCase : int for prime in range(3, ceil(NUM_PRIMES**0.5), 2): if prime no...
683
1
'''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.utils ...
683
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transformer...
683
1
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _UpperCAmelCase : str = {"""configuration_mmbt""": ["""MMBTConfig"""]} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDe...
683
'''simple docstring''' from collections.abc import Iterable from typing import Any class UpperCAmelCase : """simple docstring""" def __init__( self , _snake_case = None ) -> Optional[int]: _UpperCamelCase : int = value _UpperCamelCase : Node | ...
683
1
'''simple docstring''' import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( Fla...
683
'''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 ...feature_extraction_utils i...
683
1
'''simple docstring''' from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText if is_torch_av...
683
'''simple docstring''' import argparse import torch from transformers import GPTaLMHeadModel, RobertaForMaskedLM if __name__ == "__main__": _UpperCAmelCase : Tuple = argparse.ArgumentParser( description=( """Extraction some layers of the full RobertaForMaskedLM or GPT2LMHeadModel for Transf...
683
1
'''simple docstring''' import json import os from typing import Optional import numpy as np from ...feature_extraction_utils import BatchFeature from ...processing_utils import ProcessorMixin from ...utils import logging from ...utils.hub import get_file_from_repo from ..auto import AutoTokenizer _UpperCAmelCase ...
683
'''simple docstring''' import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( Fla...
683
1
'''simple docstring''' import datasets from .nmt_bleu import compute_bleu # From: https://github.com/tensorflow/nmt/blob/master/nmt/scripts/bleu.py _UpperCAmelCase : Union[str, Any] = """\ @INPROCEEDINGS{Papineni02bleu:a, author = {Kishore Papineni and Salim Roukos and Todd Ward and Wei-jing Zhu}, ...
683
'''simple docstring''' import os import pytest from datasets import ( get_dataset_config_info, get_dataset_config_names, get_dataset_infos, get_dataset_split_names, inspect_dataset, inspect_metric, ) _UpperCAmelCase : Optional[int] = pytest.mark.integration @pytest.mark.para...
683
1
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent _UpperCAmelCase : Union[str, Any] = {"""UserAgent""": UserAgent().random} def snake_case__ ( UpperCamelCase ) -> dict: _Upper...
683
'''simple docstring''' import gc import unittest import numpy as np import torch from diffusers import ( AudioDiffusionPipeline, AutoencoderKL, DDIMScheduler, DDPMScheduler, DiffusionPipeline, Mel, UNetaDConditionModel, UNetaDModel, ) from diffusers.utils import slow, torch_device fr...
683
1
'''simple docstring''' _UpperCAmelCase : str = """ # Transformers installation ! pip install transformers datasets # To install from source instead of the last release, comment the command above and uncomment the following one. # ! pip install git+https://github.com/huggingface/transformers.git """ _UpperCAm...
683
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available _UpperCAmelCase : Tuple = { """configuration_longt5""": ["""LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP""", """LongT5Config""", """LongT5OnnxConfig"""...
683
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bart import Ba...
683
'''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_distilbert import DistilBertTokenizer _UpperCAmelCase : Optional[int] = logging.get_...
683
1