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 |
|---|---|---|---|---|
"""simple docstring"""
import unittest
from transformers import RoFormerTokenizer, RoFormerTokenizerFast
from transformers.testing_utils import require_rjieba, require_tokenizers
from ...test_tokenization_common import TokenizerTesterMixin
@require_rjieba
@require_tokenizers
class lowe... | 196 |
'''simple docstring'''
import os
from dataclasses import dataclass, field
from io import BytesIO
from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union
import numpy as np
import pyarrow as pa
from .. import config
from ..download.streaming_download_manager import xopen, xsplitext
from ..table i... | 120 | 0 |
import json
import logging
import math
import os
import sys
from dataclasses import dataclass, field
from typing import Optional
from datasets import Dataset, load_dataset
import transformers
from transformers import (
CONFIG_MAPPING,
MODEL_FOR_MASKED_LM_MAPPING,
AutoConfig,
A... | 144 |
'''simple docstring'''
import functools
import operator
from ...configuration_utils import PretrainedConfig
from ...utils import logging
UpperCAmelCase_ : Any = logging.get_logger(__name__)
UpperCAmelCase_ : Any = {
"asapp/sew-tiny-100k": "https://huggingface.co/asapp/sew-... | 120 | 0 |
def a ( a ) ->Any: # noqa: E741
'''simple docstring'''
SCREAMING_SNAKE_CASE = len(a )
SCREAMING_SNAKE_CASE = 0
SCREAMING_SNAKE_CASE = [0] * n
SCREAMING_SNAKE_CASE = [False] * n
SCREAMING_SNAKE_CASE = [False] * n
def dfs(a , ... | 201 |
'''simple docstring'''
import unittest
from transformers import AlbertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import Mod... | 120 | 0 |
'''simple docstring'''
import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple
import sentencepiece as spm
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging
A__ : Optional[Any] =logging.get_lo... | 207 |
'''simple docstring'''
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding
class a ( snake_case__ ):
'''simple docstring'''
__lowerCAmelCase : Optional[int] = """ClapFeatureExtractor"""
__lowerCAmelCase : str = (... | 120 | 0 |
def snake_case (__lowercase ) -> Tuple:
'''simple docstring'''
return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number
if __name__ == "__main__":
print('Program to check whether a number is a Perfect number or not...')
__SCREAMING_SNAKE_CASE : O... | 670 |
'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging
UpperCAmelCase_ : Dict = logging.get_logger(__name__)
UpperCAmelCase_ : List[str] = {
"uclanlp/visualbert-vqa": "https://huggingface.co/uclanlp/visualbert-vqa/resolve/mai... | 120 | 0 |
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
__snake_case = logging.get_logger(__name__)
__snake_case = ... | 1 |
'''simple docstring'''
from __future__ import annotations
from collections import namedtuple
from dataclasses import dataclass
@dataclass
class a :
'''simple docstring'''
__lowerCAmelCase : int
__lowerCAmelCase : TreeNode | None = None
__lowerCAmelCase : TreeNode | ... | 120 | 0 |
from math import isqrt
def __lowerCAmelCase ( A ):
UpperCAmelCase_ = [True] * max_number
for i in range(2 , isqrt(max_number - 1 ) + 1 ):
if is_prime[i]:
for j in range(i**2 , A , A ):
UpperCAmelCase_ = False
return [i for i ... | 162 |
'''simple docstring'''
import warnings
from collections import OrderedDict
from typing import Mapping
from packaging import version
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
UpperCAmelCase_ : int = logging.get_logger(__name... | 120 | 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 transforme... | 617 |
'''simple docstring'''
import mpmath # for roots of unity
import numpy as np
class a :
'''simple docstring'''
def __init__( self , lowerCamelCase_=None , lowerCamelCase_=None ) -> Tuple:
# Input as list
_a : Optional[int] = list(poly_a or [0] ... | 120 | 0 |
'''simple docstring'''
import inspect
import unittest
from transformers import SegformerConfig, is_torch_available, is_vision_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, slow, torch_device
from ...test_configuration_common import ConfigTe... | 404 |
'''simple docstring'''
from math import cos, sin, sqrt, tau
from audio_filters.iir_filter import IIRFilter
def UpperCAmelCase_ ( A , A , A = 1 / sqrt(2 ) ):
'''simple docstring'''
_a : List[Any] = tau * frequency / samplerate
_a : Tuple = sin(A )
... | 120 | 0 |
"""simple docstring"""
from __future__ import annotations
import numpy as np
def a_ ( lowercase__ :Any ):
__lowerCamelCase = np.shape(lowercase__ )
if rows != columns:
__lowerCamelCase = (
'\'table\' has to be of square sha... | 281 |
'''simple docstring'''
import unittest
from parameterized import parameterized
from transformers import LlamaConfig, is_torch_available, set_seed
from transformers.testing_utils import require_torch, slow, torch_device
from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_commo... | 120 | 0 |
'''simple docstring'''
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_torch_available
__a: Union[str, Any] = {
"configuration_longt5": ["LONGT5_PRETRAINED_CONFIG_ARCHIVE_MAP", "LongT5Config", "LongT5OnnxConfig"],
}
try:
if not... | 152 |
'''simple docstring'''
import json
import logging
import math
import os
import sys
from dataclasses import dataclass, field
from typing import Optional
from datasets import Dataset, load_dataset
import transformers
from transformers import (
CONFIG_MAPPING,
MODEL_FOR_MASKED_LM_MAPPING,
AutoConfig,
... | 120 | 0 |
"""simple docstring"""
def A ( snake_case__ , snake_case__ , snake_case__ ):
'''simple docstring'''
def count_of_possible_combinations(snake_case__ ) -> int:
if target < 0:
return 0
if target == 0:
return 1
return s... | 196 |
'''simple docstring'''
import argparse
import requests
import torch
# pip3 install salesforce-lavis
# I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis_float32 (there's also the fix_lavis branch)
# also note: to convert Vicuna checkpoints, w... | 120 | 0 |
from dataclasses import dataclass
from typing import Optional, Tuple
import torch
from torch import nn
from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel
from transformers.utils import ModelOutput
@dataclass
class a ( snake_case__ ):
'''simple d... | 144 |
'''simple docstring'''
from ..utils import DummyObject, requires_backends
class a ( metaclass=snake_case__ ):
'''simple docstring'''
__lowerCAmelCase : Union[str, Any] = ["""note_seq"""]
def __init__( self , *lowerCamelCase_ , **lowerCamelCase_ ) ... | 120 | 0 |
from dataclasses import dataclass
from typing import List, Optional, Union
import numpy as np
import PIL
from ...utils import BaseOutput, OptionalDependencyNotAvailable, is_torch_available, is_transformers_available
from .timesteps import (
fastaa_timesteps,
smartaa_timesteps,
smartaa_timesteps,
smar... | 201 |
'''simple docstring'''
from __future__ import annotations
import unittest
import numpy as np
from transformers import OPTConfig, is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, slow
from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common... | 120 | 0 |
'''simple docstring'''
def UpperCamelCase__ ( lowerCAmelCase ):
"""simple docstring"""
if not isinstance(lowerCAmelCase , lowerCAmelCase ):
raise ValueError("""check_bouncy() accepts only integer arguments""" )
_lowerCAmelC... | 207 |
'''simple docstring'''
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer
UpperCAmelCase_ : Optional[Any] = {"vocab_file": "vocab.txt", "tokeniz... | 120 | 0 |
from typing import List
from .keymap import KEYMAP, get_character
def snake_case (__lowercase ) -> Dict:
'''simple docstring'''
def decorator(__lowercase ):
_snake_case : str = getattr(__lowercase , "handle_key" , [] )
handle += [key]
... | 670 |
'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging
UpperCAmelCase_ : Optional[int] = logging.get_logger(__name__)
UpperCAmelCase_ : List[str] = {
"google/vivit-b-16x2-kinetics400": (
"https://huggingface.co/google... | 120 | 0 |
import json
import os
import tempfile
from transformers.testing_utils import check_json_file_has_correct_format
class __lowerCamelCase :
_lowercase = None
def snake_case_ ( self: Tuple ):
'''simple docstring'''
... | 1 |
'''simple docstring'''
import warnings
from ...utils import logging
from .image_processing_perceiver import PerceiverImageProcessor
UpperCAmelCase_ : Tuple = logging.get_logger(__name__)
class a ( snake_case__ ):
'''simple docstring'''
def __init__( self , *low... | 120 | 0 |
import string
import numpy
def __lowerCAmelCase ( A , A ):
return b if a == 0 else greatest_common_divisor(b % a , A )
class __UpperCamelCase :
SCREAMING_SNAKE_CASE__ = string.ascii_uppercase + string.digits
# This cipher takes alphanumerics into account
# i.e.... | 162 |
'''simple docstring'''
import argparse
import os
import shutil
import torch
from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer
def UpperCAmelCase_ ( A ):
'''simple docstring'''
_a : Dict = args.pruning_method
_a : Optional[Any] ... | 120 | 0 |
"""simple docstring"""
import inspect
import unittest
import numpy as np
from tests.test_modeling_common import floats_tensor
from transformers import MaskaFormerConfig, is_torch_available, is_vision_available
from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_visio... | 617 |
'''simple docstring'''
import requests
from bsa import BeautifulSoup
def UpperCAmelCase_ ( A = "https://www.worldometers.info/coronavirus" ):
'''simple docstring'''
_a : Union[str, Any] = BeautifulSoup(requests.get(A ).text , 'html.parser' )
_a : int ... | 120 | 0 |
'''simple docstring'''
from ..utils import DummyObject, requires_backends
class UpperCAmelCase ( metaclass=snake_case__):
"""simple docstring"""
lowerCAmelCase_ = ["""torch""", """transformers""", """onnx"""]
def __init__( self : str , *Upper... | 404 |
'''simple docstring'''
import argparse
from torch import nn
# transformers_old should correspond to branch `save_old_prophetnet_model_structure` here
# original prophetnet_checkpoints are saved under `patrickvonplaten/..._old` respectively
from transformers_old.modeling_prophetnet import (
ProphetNetForCon... | 120 | 0 |
"""simple docstring"""
import glob
import os
import random
from string import ascii_lowercase, digits
import cva
import numpy as np
# Parrameters
__magic_name__ : List[str] = (7_2_0, 1_2_8_0) # Height, Width
__magic_name__ : Union[str, Any] = (0.4, 0.6) # if height or ... | 281 |
'''simple docstring'''
def UpperCAmelCase_ ( A , A ):
'''simple docstring'''
return "\n".join(
f'''{number} * {i} = {number * i}''' for i in range(1 , number_of_terms + 1 ) )
if __name__ == "__main__":
print(multiplication_table(number=5, number_of_terms=10))
| 120 | 0 |
'''simple docstring'''
import numpy as np
def __UpperCamelCase ( UpperCAmelCase ):
return 1 / (1 + np.exp(-vector ))
if __name__ == "__main__":
import doctest
doctest.testmod()
| 152 |
'''simple docstring'''
import inspect
import os
import unittest
from dataclasses import dataclass
import torch
from accelerate import Accelerator, DistributedDataParallelKwargs, GradScalerKwargs
from accelerate.state import AcceleratorState
from accelerate.test_utils import execute_subprocess_async, require_cu... | 120 | 0 |
"""simple docstring"""
from __future__ import annotations
import unittest
import numpy as np
from transformers import OPTConfig, is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, slow
from ...test_configuration_common import ConfigTester
from ...test_mo... | 196 |
'''simple docstring'''
import os
from dataclasses import dataclass, field
from io import BytesIO
from typing import TYPE_CHECKING, Any, ClassVar, Dict, Optional, Union
import numpy as np
import pyarrow as pa
from .. import config
from ..download.streaming_download_manager import xopen, xsplitext
from ..table i... | 120 | 0 |
from math import pi
def SCREAMING_SNAKE_CASE ( __UpperCamelCase : str , __UpperCamelCase : Union[str, Any] ) -> Optional[int]:
return 2 * pi * radius * (angle / 360)
if __name__ == "__main__":
print(arc_length(90, 10))
| 144 |
'''simple docstring'''
import functools
import operator
from ...configuration_utils import PretrainedConfig
from ...utils import logging
UpperCAmelCase_ : Any = logging.get_logger(__name__)
UpperCAmelCase_ : Any = {
"asapp/sew-tiny-100k": "https://huggingface.co/asapp/sew-... | 120 | 0 |
import itertools
from dataclasses import dataclass
from typing import Any, Callable, Dict, List, Optional, Union
import pandas as pd
import pyarrow as pa
import datasets
import datasets.config
from datasets.features.features import require_storage_cast
from datasets.table import table_cast
from datasets.utils.py_uti... | 201 |
'''simple docstring'''
import unittest
from transformers import AlbertConfig, is_torch_available
from transformers.models.auto import get_values
from transformers.testing_utils import require_torch, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import Mod... | 120 | 0 |
'''simple docstring'''
from typing import Union
from ..utils import add_end_docstrings, is_torch_available, is_vision_available, logging
from .base import PIPELINE_INIT_ARGS, Pipeline
if is_vision_available():
from PIL import Image
from ..image_utils import load_image
... | 207 |
'''simple docstring'''
from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding
class a ( snake_case__ ):
'''simple docstring'''
__lowerCAmelCase : Optional[int] = """ClapFeatureExtractor"""
__lowerCAmelCase : str = (... | 120 | 0 |
from math import factorial
def snake_case (__lowercase = 20 ) -> int:
'''simple docstring'''
_snake_case : Any = 2 * n # middle entry of odd rows starting at row 3 is the solution for n = 1,
# 2, 3,...
_snake_case : int = n // 2
return int(factorial... | 670 |
'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging
UpperCAmelCase_ : Dict = logging.get_logger(__name__)
UpperCAmelCase_ : List[str] = {
"uclanlp/visualbert-vqa": "https://huggingface.co/uclanlp/visualbert-vqa/resolve/mai... | 120 | 0 |
import argparse
import json
from pathlib import Path
import requests
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from transformers import (
SwiftFormerConfig,
SwiftFormerForImageClassification,
ViTImageProcessor,
)
from transformers.utils import loggi... | 1 |
'''simple docstring'''
from __future__ import annotations
from collections import namedtuple
from dataclasses import dataclass
@dataclass
class a :
'''simple docstring'''
__lowerCAmelCase : int
__lowerCAmelCase : TreeNode | None = None
__lowerCAmelCase : TreeNode | ... | 120 | 0 |
from __future__ import annotations
import copy
import tempfile
import unittest
from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available
from transformers.testing_utils import (
DUMMY_UNKNOWN_IDENTIFIER,
SMALL_MODEL_IDENTIFIER,
RequestCounter,
... | 162 |
'''simple docstring'''
import warnings
from collections import OrderedDict
from typing import Mapping
from packaging import version
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging
UpperCAmelCase_ : int = logging.get_logger(__name... | 120 | 0 |
"""simple docstring"""
import argparse
import json
import os
from collections import OrderedDict
import numpy as np
import tensorflow as tf
import torch
def _A ( _a : Optional[Any] ):
"""simple docstring"""
A = os.path.join(args.tf_model_dir ... | 617 |
'''simple docstring'''
import mpmath # for roots of unity
import numpy as np
class a :
'''simple docstring'''
def __init__( self , lowerCamelCase_=None , lowerCamelCase_=None ) -> Tuple:
# Input as list
_a : Optional[int] = list(poly_a or [0] ... | 120 | 0 |
'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__lowerCamelCase : Optional[int] = logging.get_logger(__name__)
__lowerCamelCase : List[str] = {
"google/vivit-b-16x2-kinetics400": (
"https://huggingface.co/google/vivit-b-16x2... | 404 |
'''simple docstring'''
from math import cos, sin, sqrt, tau
from audio_filters.iir_filter import IIRFilter
def UpperCAmelCase_ ( A , A , A = 1 / sqrt(2 ) ):
'''simple docstring'''
_a : List[Any] = tau * frequency / samplerate
_a : Tuple = sin(A )
... | 120 | 0 |
"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging
__magic_name__ : Union[str, Any] = logging.get_logger(__name__)
__magic_name__ : Union[str, Any] = {
"weiweishi/roc-bert-base-zh": "https://huggingface.co/weiweishi/... | 281 |
'''simple docstring'''
import unittest
from parameterized import parameterized
from transformers import LlamaConfig, is_torch_available, set_seed
from transformers.testing_utils import require_torch, slow, torch_device
from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_commo... | 120 | 0 |
'''simple docstring'''
import re
import string
from collections import Counter
import sacrebleu
import sacremoses
from packaging import version
import datasets
__a: Union[str, Any] = "\n@inproceedings{xu-etal-2016-optimizing,\n title = {Optimizing Statistical Machine Translation for Text Simplification... | 152 |
'''simple docstring'''
import json
import logging
import math
import os
import sys
from dataclasses import dataclass, field
from typing import Optional
from datasets import Dataset, load_dataset
import transformers
from transformers import (
CONFIG_MAPPING,
MODEL_FOR_MASKED_LM_MAPPING,
AutoConfig,
... | 120 | 0 |
"""simple docstring"""
def A ( snake_case__ ):
'''simple docstring'''
return credit_card_number.startswith(("""34""", """35""", """37""", """4""", """5""", """6""") )
def A ( snake_case__ ):
'''simple docstring'''
SCREAMING_SN... | 196 |
'''simple docstring'''
import argparse
import requests
import torch
# pip3 install salesforce-lavis
# I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis_float32 (there's also the fix_lavis branch)
# also note: to convert Vicuna checkpoints, w... | 120 | 0 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
_lowerCamelCase = {
"configuration_squeezebert": [
"SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP",
"SqueezeBertConfig",
... | 144 |
'''simple docstring'''
from ..utils import DummyObject, requires_backends
class a ( metaclass=snake_case__ ):
'''simple docstring'''
__lowerCAmelCase : Union[str, Any] = ["""note_seq"""]
def __init__( self , *lowerCamelCase_ , **lowerCamelCase_ ) ... | 120 | 0 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available
__lowerCAmelCase = {
"configuration_bridgetower": [
"BRIDGETOWER_PRETRAINED_CONFIG_ARCHIVE_MAP",
"BridgeTowerConfig",
"BridgeTowerTextCo... | 201 |
'''simple docstring'''
from __future__ import annotations
import unittest
import numpy as np
from transformers import OPTConfig, is_tf_available
from transformers.testing_utils import require_sentencepiece, require_tf, slow
from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common... | 120 | 0 |
'''simple docstring'''
from functools import lru_cache
def UpperCamelCase__ ( lowerCAmelCase ):
"""simple docstring"""
_lowerCAmelCase = 2
_lowerCAmelCase = set()
while i * i <= n:
if n % i:
i += ... | 207 |
'''simple docstring'''
import json
from typing import List, Optional, Tuple
from tokenizers import normalizers
from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_lxmert import LxmertTokenizer
UpperCAmelCase_ : Optional[Any] = {"vocab_file": "vocab.txt", "tokeniz... | 120 | 0 |
import argparse
import glob
import logging
import os
import sys
import time
from collections import defaultdict
from pathlib import Path
from typing import Dict, List, Tuple
import numpy as np
import pytorch_lightning as pl
import torch
from callbacks import SeqaSeqLoggingCallback, get_checkpoint_callback, get_early_s... | 670 |
'''simple docstring'''
from ...configuration_utils import PretrainedConfig
from ...utils import logging
UpperCAmelCase_ : Optional[int] = logging.get_logger(__name__)
UpperCAmelCase_ : List[str] = {
"google/vivit-b-16x2-kinetics400": (
"https://huggingface.co/google... | 120 | 0 |
def _A ( _lowercase = "The quick brown fox jumps over the lazy dog" , ) -> Tuple:
"""simple docstring"""
__UpperCamelCase = set()
# Replace all the whitespace in our sentence
__UpperCamelCase = input_str.replace(' ' , '' )
for alpha in input_str:
... | 1 |
'''simple docstring'''
import warnings
from ...utils import logging
from .image_processing_perceiver import PerceiverImageProcessor
UpperCAmelCase_ : Tuple = logging.get_logger(__name__)
class a ( snake_case__ ):
'''simple docstring'''
def __init__( self , *low... | 120 | 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
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices
_a: i... | 162 |
'''simple docstring'''
import argparse
import os
import shutil
import torch
from emmental.modules import MagnitudeBinarizer, ThresholdBinarizer, TopKBinarizer
def UpperCAmelCase_ ( A ):
'''simple docstring'''
_a : Dict = args.pruning_method
_a : Optional[Any] ... | 120 | 0 |
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_dim... | 121 |
import argparse
import json
import os
from collections import OrderedDict
import numpy as np
import tensorflow as tf
import torch
def _lowerCAmelCase ( __magic_name__ :Optional[Any] ):
UpperCAmelCase_ = os.path.join(args.tf_model_dir , '''parameters.jso... | 121 | 1 |
import os
from math import logaa
def _lowerCAmelCase ( __magic_name__ :str = "base_exp.txt" ):
UpperCAmelCase_ = 0
UpperCAmelCase_ = 0
for i, line in enumerate(open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) )... | 121 |
def _lowerCAmelCase ( __magic_name__ :list[list[int]] , __magic_name__ :int , __magic_name__ :int , __magic_name__ :set ):
UpperCAmelCase_, UpperCAmelCase_ = len(__magic_name__ ), len(grid[0] )
if (
min(__magic_name__ , __ma... | 121 | 1 |
import os
import unittest
from transformers.models.bartpho.tokenization_bartpho import VOCAB_FILES_NAMES, BartphoTokenizer
from transformers.testing_utils import get_tests_dir
from ...test_tokenization_common import TokenizerTesterMixin
_lowerCamelCase : Tuple = get_tests_dir('fixt... | 121 |
import logging
import os
from typing import List, TextIO, Union
from conllu import parse_incr
from utils_ner import InputExample, Split, TokenClassificationTask
_lowerCamelCase : List[Any] = logging.getLogger(__name__)
class snake_case__ ( __snake_case ):
... | 121 | 1 |
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 snake_case__ ( __snake_case ):
'''simple docstring... | 121 |
def _lowerCAmelCase ( __magic_name__ :str ):
UpperCAmelCase_ = ''''''
for ch in key:
if ch == " " or ch not in key_no_dups and ch.isalpha():
key_no_dups += ch
return key_no_dups
def _lowerCAmelCase ( __magic_name_... | 121 | 1 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_flax_available,
is_tf_available,
is_torch_available,
is_vision_available,
)
_lowerCamelCase : List[str] = {'configuration_vit': ['VIT_PRETRAINED_CONFIG_... | 121 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
_lowerCamelCase : str = {
'configuration_jukebox': [
'JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP',
'JukeboxConfig',
'JukeboxPriorConfig',
... | 121 | 1 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
_lowerCamelCase : Dict = {
'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'],
}
try:
... | 121 |
from __future__ import annotations
from collections import namedtuple
from dataclasses import dataclass
@dataclass
class snake_case__ :
'''simple docstring'''
__A = 42
__A = None
__A = None
_lowerCamelCas... | 121 | 1 |
def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int ):
if a < 0 or b < 0:
raise ValueError('''the value of both inputs must be positive''' )
UpperCAmelCase_ = str(bin(__magic_name__ ) )[2:] # remove the leading "0b"
Upp... | 121 |
from __future__ import annotations
def _lowerCAmelCase ( __magic_name__ :int ):
UpperCAmelCase_ = [True] * limit
UpperCAmelCase_ = False
UpperCAmelCase_ = False
UpperCAmelCase_ = True
for i in range(3 , int(limit**0.5 + 1 ) ... | 121 | 1 |
from ...configuration_utils import PretrainedConfig
from ...utils import logging
_lowerCamelCase : Any = logging.get_logger(__name__)
_lowerCamelCase : List[str] = {
'facebook/xglm-564M': 'https://huggingface.co/facebook/xglm-564M/resolve/main/config.json',
# See... | 121 |
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
)
_lowerCamelCase : str = logging.getLogger(__name__)
if __name__ ==... | 121 | 1 |
import json
import unittest
import numpy as np
from huggingface_hub import hf_hub_download
from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available
from ...test_image_processing_common import ImageProcessingSaving... | 121 |
import os
from math import logaa
def _lowerCAmelCase ( __magic_name__ :str = "base_exp.txt" ):
UpperCAmelCase_ = 0
UpperCAmelCase_ = 0
for i, line in enumerate(open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) )... | 121 | 1 |
import inspect
import unittest
from transformers import BitConfig
from transformers.testing_utils import require_torch, require_vision, slow, torch_device
from transformers.utils import cached_property, is_torch_available, is_vision_available
from ...test_backbone_common import BackboneTesterMixin
... | 121 |
import random
import sys
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import ListedColormap
_lowerCamelCase : Any = 'Usage of script: script_name <size_of_canvas:int>'
_lowerCamelCase : Dict = [0] * 100 + [1] * 10
random.shuffle(choice... | 121 | 1 |
def _lowerCAmelCase ( __magic_name__ :int ):
if length <= 0 or not isinstance(__magic_name__ , __magic_name__ ):
raise ValueError('''Length must be a positive integer.''' )
return [n * (2 * n - 1) for n in range(__magic_name__ )]
if __... | 121 |
from __future__ import annotations
def _lowerCAmelCase ( __magic_name__ :list[int | str] ):
create_state_space_tree(__magic_name__ , [] , 0 , [0 for i in range(len(__magic_name__ ) )] )
def _lowerCAmelCase ( ... | 121 | 1 |
import unittest
from transformers import (
MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
Pipeline,
ZeroShotClassificationPipeline,
pipeline,
)
from transformers.testing_utils import is_pipeline_test, nested_simplify, require_tf, requir... | 121 |
# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run
import sys
import warnings
from os.path import abspath, dirname, join
# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switchi... | 121 | 1 |
import unittest
import numpy as np
from transformers import RoFormerConfig, 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.num... | 121 |
import argparse
import hashlib
import os
import urllib
import warnings
import torch
from torch import nn
from tqdm import tqdm
from transformers import WhisperConfig, WhisperForConditionalGeneration
_lowerCamelCase : Union[str, Any] = {
'tiny.en': 'https://openaipublic.azu... | 121 | 1 |
import math
def _lowerCAmelCase ( __magic_name__ :int ):
return math.sqrt(__magic_name__ ) * math.sqrt(__magic_name__ ) == num
def _lowerCAmelCase ( __magic_name__ :int ):
UpperCAmelCase_ = 0
UpperCAmelCase_ = n
... | 121 |
import argparse
import torch
from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert
from transformers.utils import logging
logging.set_verbosity_info()
def _lowerCAmelCase ( __magic_name__ :Union[str, Any] , __magic_na... | 121 | 1 |
import inspect
import unittest
from transformers import MobileViTConfig
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 ConfigTes... | 121 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
_lowerCamelCase : Dict = {
'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'],
}
try:
... | 121 | 1 |
from .constants import (
MODEL_NAME,
OPTIMIZER_NAME,
RNG_STATE_NAME,
SAFE_WEIGHTS_INDEX_NAME,
SAFE_WEIGHTS_NAME,
SCALER_NAME,
SCHEDULER_NAME,
TORCH_LAUNCH_PARAMS,
WEIGHTS_INDEX_NAME,
WEIGHTS_NAME,
)
from .dataclasses import (
BnbQuantizationConfig,
... | 121 |
_lowerCamelCase : dict[tuple[int, int, int], int] = {}
def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int , __magic_name__ :int ):
# if we are absent twice, or late 3 consecutive days,
# no further prize strings are possib... | 121 | 1 |
import copy
from typing import Dict, List, Optional
from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ..auto import CONFIG_MAPPING
_lowerCamelCase : str = {
'facebook/mask2former-swin-small-coco-instance': (
'https://huggingface.co/fa... | 121 |
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.modeli... | 121 | 1 |
def _lowerCAmelCase ( __magic_name__ :Any ):
UpperCAmelCase_ = 0
UpperCAmelCase_ = len(__magic_name__ )
for i in range(n - 1 ):
for j in range(i + 1 , __magic_name__ ):
if arr[i] > arr[j]:
num_... | 121 |
import argparse
import evaluate
import torch
from datasets import load_dataset
from torch.optim import AdamW
from torch.utils.data import DataLoader
from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed
from accelerate import Acceler... | 121 | 1 |
def _lowerCAmelCase ( __magic_name__ :int = 1_0 , __magic_name__ :int = 1_0_0_0 , __magic_name__ :bool = True ):
assert (
isinstance(__magic_name__ , __magic_name__ )
and isinstance(__magic_name__ , __magic_name__ )
... | 121 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_torch_available,
is_vision_available,
)
_lowerCamelCase : Optional[Any] = {
'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_AR... | 121 | 1 |
import json
import os
import shutil
import tempfile
from unittest import TestCase
from transformers import BartTokenizer, BartTokenizerFast, DPRQuestionEncoderTokenizer, DPRQuestionEncoderTokenizerFast
from transformers.models.bart.configuration_bart import BartConfig
from transformers.models.bert.... | 121 |
import gc
import unittest
import numpy as np
import torch
from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel
from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device
from diffusers.utils.testing_utils import ena... | 121 | 1 |
from math import loga
def _lowerCAmelCase ( __magic_name__ :int ):
if a < 0:
raise ValueError('''Input value must be a positive integer''' )
elif isinstance(__magic_name__ , __magic_name__ ):
raise TypeError('''Input value mu... | 121 |
from .integrations import (
is_optuna_available,
is_ray_available,
is_sigopt_available,
is_wandb_available,
run_hp_search_optuna,
run_hp_search_ray,
run_hp_search_sigopt,
run_hp_search_wandb,
)
from .trainer_utils import (
HPSearchBackend,
default_hp_space... | 121 | 1 |
import os
from argparse import ArgumentParser
from typing import List
import torch.utils.data
from datasets import Dataset, IterableDataset
from datasets.distributed import split_dataset_by_node
_lowerCamelCase : Optional[Any] = 4
_lowerCamelCase : List[Any] = 3
c... | 121 |
def _lowerCAmelCase ( __magic_name__ :list ):
if any(not isinstance(__magic_name__ , __magic_name__ ) or x < 0 for x in sequence ):
raise TypeError('''Sequence must be list of non-negative integers''' )
for _ in range(len(__magic_name__ ... | 121 | 1 |
import contextlib
from multiprocessing import Pool, RLock
from tqdm.auto import tqdm
from ..utils import experimental, logging
_lowerCamelCase : str = logging.get_logger(__name__)
class snake_case__ :
'''simple docstring'''
__A = ... | 121 |
import argparse
import json
import os
from collections import OrderedDict
import numpy as np
import tensorflow as tf
import torch
def _lowerCAmelCase ( __magic_name__ :Optional[Any] ):
UpperCAmelCase_ = os.path.join(args.tf_model_dir , '''parameters.jso... | 121 | 1 |
from . import (
albert,
align,
altclip,
audio_spectrogram_transformer,
auto,
autoformer,
bark,
bart,
barthez,
bartpho,
beit,
bert,
bert_generation,
bert_japanese,
bertweet,
big_bird,
bigbird_pegasus,
biogpt,
bit,
... | 121 |
def _lowerCAmelCase ( __magic_name__ :list[list[int]] , __magic_name__ :int , __magic_name__ :int , __magic_name__ :set ):
UpperCAmelCase_, UpperCAmelCase_ = len(__magic_name__ ), len(grid[0] )
if (
min(__magic_name__ , __ma... | 121 | 1 |
import json
import os
import pickle
import shutil
import tempfile
from unittest import TestCase
from unittest.mock import patch
import numpy as np
from datasets import Dataset
from transformers import is_faiss_available
from transformers.models.bart.configuration_bart import BartConfig
from t... | 121 |
import logging
import os
from typing import List, TextIO, Union
from conllu import parse_incr
from utils_ner import InputExample, Split, TokenClassificationTask
_lowerCamelCase : List[Any] = logging.getLogger(__name__)
class snake_case__ ( __snake_case ):
... | 121 | 1 |
from __future__ import annotations
import math
def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int , __magic_name__ :bool , __magic_name__ :list[int] , __magic_name__ :float ):
if depth < 0:
raise ValueError('''Dep... | 121 |
def _lowerCAmelCase ( __magic_name__ :str ):
UpperCAmelCase_ = ''''''
for ch in key:
if ch == " " or ch not in key_no_dups and ch.isalpha():
key_no_dups += ch
return key_no_dups
def _lowerCAmelCase ( __magic_name_... | 121 | 1 |
# flake8: noqa
# Lint as: python3
from typing import Dict, List, Optional, Type
from .. import config
from ..utils import logging
from .formatting import (
ArrowFormatter,
CustomFormatter,
Formatter,
PandasFormatter,
PythonFormatter,
TensorFormatter,
format_table,... | 121 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
_lowerCamelCase : str = {
'configuration_jukebox': [
'JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP',
'JukeboxConfig',
'JukeboxPriorConfig',
... | 121 | 1 |
import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple
import sentencepiece as spm
from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging
_lowerCamelCase : Optional[Any] = logging.get_logger(__name__)
_lowerCamelCas... | 121 |
from __future__ import annotations
from collections import namedtuple
from dataclasses import dataclass
@dataclass
class snake_case__ :
'''simple docstring'''
__A = 42
__A = None
__A = None
_lowerCamelCas... | 121 | 1 |
def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int ):
if a < 0 or b < 0:
raise ValueError('''the value of both inputs must be positive''' )
UpperCAmelCase_ = str(bin(__magic_name__ ) )[2:] # remove the leading "0b"
Upper... | 121 |
from __future__ import annotations
def _lowerCAmelCase ( __magic_name__ :int ):
UpperCAmelCase_ = [True] * limit
UpperCAmelCase_ = False
UpperCAmelCase_ = False
UpperCAmelCase_ = True
for i in range(3 , int(limit**0.5 + 1 ) ... | 121 | 1 |
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_torch... | 121 |
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
)
_lowerCamelCase : str = logging.getLogger(__name__)
if __name__ ==... | 121 | 1 |
import argparse
import json
from pathlib import Path
import requests
import timm
import torch
from huggingface_hub import hf_hub_download
from PIL import Image
from timm.data import resolve_data_config
from timm.data.transforms_factory import create_transform
from transformers import (
Bi... | 121 |
import os
from math import logaa
def _lowerCAmelCase ( __magic_name__ :str = "base_exp.txt" ):
UpperCAmelCase_ = 0
UpperCAmelCase_ = 0
for i, line in enumerate(open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) )... | 121 | 1 |
from __future__ import annotations
from collections import namedtuple
from dataclasses import dataclass
@dataclass
class snake_case__ :
'''simple docstring'''
__A = 42
__A = None
__A = None
_lowerCamelCas... | 121 |
import random
import sys
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import ListedColormap
_lowerCamelCase : Any = 'Usage of script: script_name <size_of_canvas:int>'
_lowerCamelCase : Dict = [0] * 100 + [1] * 10
random.shuffle(choice... | 121 | 1 |
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_available
from d... | 121 |
from __future__ import annotations
def _lowerCAmelCase ( __magic_name__ :list[int | str] ):
create_state_space_tree(__magic_name__ , [] , 0 , [0 for i in range(len(__magic_name__ ) )] )
def _lowerCAmelCase ( ... | 121 | 1 |
def _lowerCAmelCase ( __magic_name__ :int = 1_0_0_0 ):
UpperCAmelCase_ = 3
UpperCAmelCase_ = 0
while a < n:
if a % 3 == 0 or a % 5 == 0:
result += a
elif a % 1_5 == 0:
result -= a
a += 1
return ... | 121 |
# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run
import sys
import warnings
from os.path import abspath, dirname, join
# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switchi... | 121 | 1 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
_lowerCamelCase : Tuple = {
'configuration_blip_2': [
'BLIP_2_PRETRAINED_CONFIG_ARCHIVE_MAP',
'Blip2Config',
'Blip2QFormerConfig',
... | 121 |
import argparse
import hashlib
import os
import urllib
import warnings
import torch
from torch import nn
from tqdm import tqdm
from transformers import WhisperConfig, WhisperForConditionalGeneration
_lowerCamelCase : Union[str, Any] = {
'tiny.en': 'https://openaipublic.azu... | 121 | 1 |
import shutil
import tempfile
import unittest
from unittest.mock import patch
from transformers import (
DefaultFlowCallback,
IntervalStrategy,
PrinterCallback,
ProgressCallback,
Trainer,
TrainerCallback,
TrainingArguments,
is_torch_available,
)
from transform... | 121 |
import argparse
import torch
from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert
from transformers.utils import logging
logging.set_verbosity_info()
def _lowerCAmelCase ( __magic_name__ :Union[str, Any] , __magic_na... | 121 | 1 |
import logging
import os
from dataclasses import dataclass
from typing import List, Optional, Union
import tqdm
from filelock import FileLock
from transformers import (
BartTokenizer,
BartTokenizerFast,
DataProcessor,
PreTrainedTokenizer,
RobertaTokenizer,
RobertaToke... | 121 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
_lowerCamelCase : Dict = {
'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'],
}
try:
... | 121 | 1 |
def _lowerCAmelCase ( ):
UpperCAmelCase_ = [3_1, 2_8, 3_1, 3_0, 3_1, 3_0, 3_1, 3_1, 3_0, 3_1, 3_0, 3_1]
UpperCAmelCase_ = 6
UpperCAmelCase_ = 1
UpperCAmelCase_ = 1_9_0_1
UpperCAmelCase_ = 0
while year < 2_0_0_1:
day += 7
... | 121 |
_lowerCamelCase : dict[tuple[int, int, int], int] = {}
def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int , __magic_name__ :int ):
# if we are absent twice, or late 3 consecutive days,
# no further prize strings are possib... | 121 | 1 |
from datetime import datetime
import requests
def _lowerCAmelCase ( __magic_name__ :str ):
UpperCAmelCase_ = '''https://downloadgram.net/wp-json/wppress/video-downloader/video?url='''
UpperCAmelCase_ = requests.get(base_url + url ).json()[0]['''urls'''... | 121 |
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.modeli... | 121 | 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
_lowerCamelCase : int = logging.get_logger(__name__)
_lowerCamelCase ... | 121 |
import argparse
import evaluate
import torch
from datasets import load_dataset
from torch.optim import AdamW
from torch.utils.data import DataLoader
from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed
from accelerate import Acceler... | 121 | 1 |
import unittest
from typing import Dict, List, Optional, Union
import numpy as np
from transformers.testing_utils import require_torch, require_vision
from transformers.utils import is_torch_available, is_vision_available
from ...test_image_processing_common import ImageProcessingSavingTestMixin,... | 121 |
from typing import TYPE_CHECKING
from ...utils import (
OptionalDependencyNotAvailable,
_LazyModule,
is_tf_available,
is_torch_available,
is_vision_available,
)
_lowerCamelCase : Optional[Any] = {
'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_AR... | 121 | 1 |
import os
from shutil import copyfile
from typing import Any, Dict, List, Optional, Tuple
import sentencepiece as spm
from ...tokenization_utils import AddedToken, PreTrainedTokenizer
from ...utils import logging
_lowerCamelCase : Any = logging.get_logger(__name__)
_lowerCamelC... | 121 |
import gc
import unittest
import numpy as np
import torch
from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel
from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device
from diffusers.utils.testing_utils import ena... | 121 | 1 |
import gc
import random
import unittest
import numpy as np
import torch
from PIL import Image
from transformers import XLMRobertaTokenizerFast
from diffusers import DDIMScheduler, KandinskyImgaImgPipeline, KandinskyPriorPipeline, UNetaDConditionModel, VQModel
from diffusers.pipelines.kandinsky.t... | 121 |
from .integrations import (
is_optuna_available,
is_ray_available,
is_sigopt_available,
is_wandb_available,
run_hp_search_optuna,
run_hp_search_ray,
run_hp_search_sigopt,
run_hp_search_wandb,
)
from .trainer_utils import (
HPSearchBackend,
default_hp_space... | 121 | 1 |
import os
import tempfile
import unittest
from transformers import FlaubertConfig, is_torch_available
from transformers.testing_utils import require_torch, require_torch_gpu, slow, torch_device
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMix... | 121 |
def _lowerCAmelCase ( __magic_name__ :list ):
if any(not isinstance(__magic_name__ , __magic_name__ ) or x < 0 for x in sequence ):
raise TypeError('''Sequence must be list of non-negative integers''' )
for _ in range(len(__magic_name__ ... | 121 | 1 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available
_lowerCamelCase : Optional[int] = {}
try:
if not is_sentencepiece_available():
raise OptionalDependencyNotAvailable()
except OptionalDepende... | 121 |
import argparse
import json
import os
from collections import OrderedDict
import numpy as np
import tensorflow as tf
import torch
def _lowerCAmelCase ( __magic_name__ :Optional[Any] ):
UpperCAmelCase_ = os.path.join(args.tf_model_dir , '''parameters.jso... | 121 | 1 |
def _lowerCAmelCase ( __magic_name__ :Optional[Any] ):
UpperCAmelCase_, UpperCAmelCase_ = [], []
while len(__magic_name__ ) > 1:
UpperCAmelCase_, UpperCAmelCase_ = min(__magic_name__ ), max(__magic_name__ )
start.append(__magic_name... | 121 |
def _lowerCAmelCase ( __magic_name__ :list[list[int]] , __magic_name__ :int , __magic_name__ :int , __magic_name__ :set ):
UpperCAmelCase_, UpperCAmelCase_ = len(__magic_name__ ), len(grid[0] )
if (
min(__magic_name__ , __ma... | 121 | 1 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available
_lowerCamelCase : Dict = {
'configuration_ctrl': ['CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP', 'CTRLConfig'],
'tokenization_ctrl': ['CTRLTokenizer'],... | 121 |
import logging
import os
from typing import List, TextIO, Union
from conllu import parse_incr
from utils_ner import InputExample, Split, TokenClassificationTask
_lowerCamelCase : List[Any] = logging.getLogger(__name__)
class snake_case__ ( __snake_case ):
... | 121 | 1 |
def _lowerCAmelCase ( __magic_name__ :list , __magic_name__ :list , __magic_name__ :int ):
UpperCAmelCase_ = len(__magic_name__ )
UpperCAmelCase_ = [[0] * n for i in range(__magic_name__ )]
for i in range(__magic_name__ ):
Up... | 121 |
def _lowerCAmelCase ( __magic_name__ :str ):
UpperCAmelCase_ = ''''''
for ch in key:
if ch == " " or ch not in key_no_dups and ch.isalpha():
key_no_dups += ch
return key_no_dups
def _lowerCAmelCase ( __magic_name_... | 121 | 1 |
import subprocess
import sys
from transformers import BertConfig, BertModel, BertTokenizer, pipeline
from transformers.testing_utils import TestCasePlus, require_torch
class snake_case__ ( __snake_case ):
'''simple docstring'''
@require_torch
... | 121 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available
_lowerCamelCase : str = {
'configuration_jukebox': [
'JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP',
'JukeboxConfig',
'JukeboxPriorConfig',
... | 121 | 1 |
import copy
import re
class snake_case__ :
'''simple docstring'''
__A = '''hp'''
__A = {}
__A = None
@classmethod
def UpperCamelCase ( cls : Optional[int] , lower... | 121 |
from __future__ import annotations
from collections import namedtuple
from dataclasses import dataclass
@dataclass
class snake_case__ :
'''simple docstring'''
__A = 42
__A = None
__A = None
_lowerCamelCas... | 121 | 1 |
from __future__ import annotations
_lowerCamelCase : Optional[Any] = '#'
class snake_case__ :
'''simple docstring'''
def __init__( self : Dict ) -> None:
UpperCAmelCase_ = {}
def UpperCame... | 121 |
from __future__ import annotations
def _lowerCAmelCase ( __magic_name__ :int ):
UpperCAmelCase_ = [True] * limit
UpperCAmelCase_ = False
UpperCAmelCase_ = False
UpperCAmelCase_ = True
for i in range(3 , int(limit**0.5 + 1 ) ... | 121 | 1 |
def _lowerCAmelCase ( __magic_name__ :str ):
return " ".join(input_str.split()[::-1] )
if __name__ == "__main__":
import doctest
doctest.testmod()
| 121 |
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
)
_lowerCamelCase : str = logging.getLogger(__name__)
if __name__ ==... | 121 | 1 |
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 import Conv... | 121 |
import os
from math import logaa
def _lowerCAmelCase ( __magic_name__ :str = "base_exp.txt" ):
UpperCAmelCase_ = 0
UpperCAmelCase_ = 0
for i, line in enumerate(open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) )... | 121 | 1 |
import argparse
import evaluate
import torch
from datasets import load_dataset
from torch.optim import AdamW
from torch.utils.data import DataLoader
from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed
from accelerate import Acceler... | 121 |
import random
import sys
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.colors import ListedColormap
_lowerCamelCase : Any = 'Usage of script: script_name <size_of_canvas:int>'
_lowerCamelCase : Dict = [0] * 100 + [1] * 10
random.shuffle(choice... | 121 | 1 |
_lowerCamelCase : Any = 9.80665
def _lowerCAmelCase ( __magic_name__ :float , __magic_name__ :float , __magic_name__ :float = g ):
if fluid_density <= 0:
raise ValueError('''Impossible fluid density''' )
if volume < 0:
... | 121 |
from __future__ import annotations
def _lowerCAmelCase ( __magic_name__ :list[int | str] ):
create_state_space_tree(__magic_name__ , [] , 0 , [0 for i in range(len(__magic_name__ ) )] )
def _lowerCAmelCase ( ... | 121 | 1 |
import os
import sys
import tempfile
import torch
from .state import AcceleratorState
from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment
def _lowerCAmelCase ( __magic_name__ :Dict , __magic_name__ :Dict=() , __magic_name_... | 121 |
# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run
import sys
import warnings
from os.path import abspath, dirname, join
# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switchi... | 121 | 1 |
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.modeli... | 121 |
import argparse
import hashlib
import os
import urllib
import warnings
import torch
from torch import nn
from tqdm import tqdm
from transformers import WhisperConfig, WhisperForConditionalGeneration
_lowerCamelCase : Union[str, Any] = {
'tiny.en': 'https://openaipublic.azu... | 121 | 1 |
# Copyright 2021 The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | 121 |
import argparse
import torch
from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert
from transformers.utils import logging
logging.set_verbosity_info()
def _lowerCAmelCase ( __magic_name__ :Union[str, Any] , __magic_na... | 121 | 1 |
# using dfs for finding eulerian path traversal
def _lowerCAmelCase ( __magic_name__ :Any , __magic_name__ :Tuple , __magic_name__ :Tuple , __magic_name__ :Dict=None ):
UpperCAmelCase_ = (path or []) + [u]
for v in graph[u]:
if vi... | 121 |
from typing import TYPE_CHECKING
from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available
_lowerCamelCase : Dict = {
'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'],
}
try:
... | 121 | 1 |
import pytest
from datasets import inspect_metric, list_metrics, load_metric
@pytest.fixture
def _lowerCAmelCase ( __magic_name__ :List[str] ):
monkeypatch.setattr('''datasets.utils.deprecation_utils._emitted_deprecation_warnings''' , set() )
... | 121 |
_lowerCamelCase : dict[tuple[int, int, int], int] = {}
def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int , __magic_name__ :int ):
# if we are absent twice, or late 3 consecutive days,
# no further prize strings are possib... | 121 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.