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 argparse import datetime def _lowercase ( lowerCamelCase__ ) -> Tuple: """simple docstring""" __UpperCAmelCase : List[Any] = { "0": "Sunday", "1": "Monday", "2": "Tuesday", ...
168
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __lowercase ( UpperCAmelCase_ ): """simple docstring""" def _SCREAMING_SNAKE_CASE ( self : List[Any] , lowerCAmelCase__ ...
671
0
from __future__ import annotations def __lowercase ( lowerCamelCase : Union[str, Any] , lowerCamelCase : Union[str, Any] ): if partitions <= 0: raise ValueError('partitions must be a positive number!' ) if partitions > number_of_bytes: raise ValueError('partitions can not > number_of_b...
417
from __future__ import annotations from math import ceil, floor, sqrt def A_ ( _UpperCAmelCase = 2_00_00_00 ): SCREAMING_SNAKE_CASE_: list[int] = [0] SCREAMING_SNAKE_CASE_: int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ...
671
0
"""simple docstring""" from __future__ import annotations def lowercase_ ( _lowerCamelCase: int ) -> int: '''simple docstring''' __lowerCamelCase : Optional[Any] = 0.00 __lowerCamelCase : int = 0 for resistor in resistors: if resistor ...
646
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : Optional[int] = { """configuration_longformer""": [ """LONGFORMER_PRETRAINED_CONFIG_ARC...
671
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available _UpperCAmelCase : Tuple = { """configuration_chinese_clip""": [ """CHINESE_CLIP_PRETRAINED_CONFIG_ARCHIVE_MAP""", """ChineseCLIPConfig""...
668
import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# lowerCAmelCase : Optional[int] = [ # (stable-diffusion, HF Diffusers) ("""time_embed.0.weight""", """time_embedding.li...
671
0
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaControlnetImgaImgPipeline, KandinskyVaaPriorEmbaEmbPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floa...
121
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : int = logging.get_logger(__name__) lowerCAmelCase : Dict = { """microsoft/xprophetnet-large-wiki100-cased""": ( """https://huggingf...
671
0
import os import numpy import onnx def UpperCamelCase_( lowerCamelCase_ , lowerCamelCase_ ) -> Dict: _lowercase : Dict = a.name _lowercase : Optional[int] = b.name _lowercase : Tuple = "" _lowercase : Union[str, Any] ...
89
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, PILImageResampli...
671
0
from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassificati...
612
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer lowerCAmelCase : Optional[int] = logging.get_logger(__...
671
0
"""simple docstring""" import unittest from transformers import AutoTokenizer, NystromformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor...
610
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
import json import os import tempfile import unittest import unittest.mock as mock from pathlib import Path from requests.exceptions import HTTPError from transformers.utils import ( CONFIG_NAME, FLAX_WEIGHTS_NAME, TF2_WEIGHTS_NAME, TRANSFORMERS_CACHE, WEIGHTS_NAME, cached...
519
import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient lowerCAmelCase : List[Any] = WebClient(token=os.environ["""CI_SLACK_BOT_TOKEN"""]) def A_ ( _UpperCAmelCase ...
671
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_sentencepiece_available, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCamelCase__ : Optional[Any] = {"""configuration...
31
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Accelerator, Dis...
671
0
"""simple docstring""" import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def snake_case__ ( ) ->List[str]: """simple docstring""" __lowercase : List[Any] =...
575
from math import asin, atan, cos, radians, sin, sqrt, tan lowerCAmelCase : Union[str, Any] = 637_8137.0 lowerCAmelCase : int = 635_6752.31_4245 lowerCAmelCase : Union[str, Any] = 6378137 def A_ ( _UpperCAmelCase , _UpperCAmelCase , _Up...
671
0
'''simple docstring''' def _lowercase ( lowerCamelCase__ ) -> Union[str, Any]: """simple docstring""" if not isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise ValueError("Input must be an integer" ) if input_num <= 0: ...
168
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def A_ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): # Initialise PyTorch...
671
0
import os def __lowercase ( ): UpperCamelCase_ : Dict = os.path.join(os.path.dirname(_UpperCAmelCase ) , 'num.txt' ) with open(_UpperCAmelCase ) as file_hand: return str(sum(int(_UpperCAmelCase ) for line in file_hand ) )[:10] if __name__ == "__main__": prin...
417
import math def A_ ( _UpperCAmelCase ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False ...
671
0
"""simple docstring""" 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 ImageProcessin...
646
import re def A_ ( _UpperCAmelCase ): return [char.split() for char in re.split(R"[^ a-z A-Z 0-9 \s]" , str_ )] def A_ ( _UpperCAmelCase ): SCREAMING_SNAKE_CASE_: int = split_input(str_ ) return "".join( ...
671
0
import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class lowerCAmelCase_ ( UpperCAmelCase_ ): UpperCamelCas...
668
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING lowerCAmelCase : Union[str, Any] = logging.get_logger(__name__) class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
from .imports import is_tqdm_available if is_tqdm_available(): from tqdm.auto import tqdm as _tqdm from ..state import PartialState def _lowerCAmelCase ( __magic_name__ :Optional[int] = True , *__magic_name__ :Dict , **__magic_name__ :Any ): ...
121
import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class __lowercase ( unittest.TestCase ): """simple docstring""" def _SCREAMING_SNAKE_CASE ...
671
0
import gc import random import unittest import numpy as np import torch from PIL import Image from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, Sta...
89
from itertools import count def A_ ( _UpperCAmelCase = 50 ): SCREAMING_SNAKE_CASE_: Union[str, Any] = [1] * min_block_length for n in count(_UpperCAmelCase ): fill_count_functions.append(1 ) for block_length in range(_UpperCAmelC...
671
0
from __future__ import annotations from math import pi # Define the Reduced Planck Constant ℏ (H bar), speed of light C, value of # Pi and the function lowerCamelCase__ = 1.0_54_57_18_17E-34 # unit of ℏ : J * s lowerCamelCase__ = 3E8 # unit of c : m * s^-1 def __A(lowerCAmelCase , lowerCA...
612
def A_ ( _UpperCAmelCase ): if not isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError("only integers accepted as input" ) else: SCREAMING_SNAKE_CASE_: List[Any] = str(abs(_UpperCAmelCase ) ) ...
671
0
"""simple docstring""" import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format="""%(asctime)s - %(levelname)s - %(name)s - %(message)s""", datefmt="""%m/%d/%Y %H:%M:%S"""...
610
from __future__ import annotations from collections.abc import Iterator from typing import Any class __lowercase : """simple docstring""" def __init__( self : List[str] , lowerCAmelCase__ : Any): SCREAMING_SNAKE_CASE_: Any = data SCREAMING_SN...
671
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_image_inputs if is_torch_available(): ...
519
from collections import defaultdict from math import ceil, sqrt def A_ ( _UpperCAmelCase = 1_00_00_00 , _UpperCAmelCase = 10 ): SCREAMING_SNAKE_CASE_: defaultdict = defaultdict(_UpperCAmelCase ) for outer_width in range(3 , (t_limit // 4)...
671
0
from __future__ import annotations import unittest from transformers import RoFormerConfig, is_tf_available from transformers.testing_utils import require_tf, slow from ...test_configuration_common import ConfigTester from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask f...
31
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCAmelCase : str = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_xlm""": [""...
671
0
"""simple docstring""" from PIL import Image def snake_case__ ( _lowerCamelCase, _lowerCamelCase ) ->Union[str, Any]: """simple docstring""" __lowercase : Optional[int] = (2_59 * (level + 2_55)) / (2_55 * (2_59 - level)) def contrast(_lowerCamelCase ...
575
lowerCAmelCase : List[str] = { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], """G""": ["""C"""], } def A_ ( _Upp...
671
0
'''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, MusicgenForCondi...
168
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __lowercase ( UpperCAmelCase_ ): """simple docstring""" def _SCREAMING_SNAKE_CASE ( self : List[Any] , lowerCAmelCase__ ...
671
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available a_ = {} try: if not is_sentencepiece_available(): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAvailable: pass else: a_ = ["""MLuk...
417
from __future__ import annotations from math import ceil, floor, sqrt def A_ ( _UpperCAmelCase = 2_00_00_00 ): SCREAMING_SNAKE_CASE_: list[int] = [0] SCREAMING_SNAKE_CASE_: int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ...
671
0
"""simple docstring""" import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from transformers import Gradie...
646
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : Optional[int] = { """configuration_longformer""": [ """LONGFORMER_PRETRAINED_CONFIG_ARC...
671
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer _UpperCAmelCase : Tuple = logging.get_logger(__name__) _UpperCAmelCa...
668
import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# lowerCAmelCase : Optional[int] = [ # (stable-diffusion, HF Diffusers) ("""time_embed.0.weight""", """time_embedding.li...
671
0
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from .tokenization_lxmert import LxmertTokenizer _lowerCamelCase : Tuple = {"""vocab_file""": """vocab.txt""", """tokenizer_file"""...
121
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : int = logging.get_logger(__name__) lowerCAmelCase : Dict = { """microsoft/xprophetnet-large-wiki100-cased""": ( """https://huggingf...
671
0
import inspect import unittest from transformers import DecisionTransformerConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_commo...
89
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, PILImageResampli...
671
0
import math def __A(lowerCAmelCase ) -> str: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False # All primes nu...
612
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer lowerCAmelCase : Optional[int] = logging.get_logger(__...
671
0
"""simple docstring""" def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase ) -> List[Any]: """simple docstring""" if digit_amount > 0: return round(number - int(_UpperCAmelCase ) , _UpperCAmelCase ) return number - int(_UpperCAmelCase ) if __name__ == ...
610
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
def _UpperCAmelCase ( UpperCAmelCase : List[Any] ): """simple docstring""" __lowerCamelCase : set[int] = set() # To detect a back edge, keep track of vertices currently in the recursion stack __lowerCamelCase : set[int] = set() ...
519
import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient lowerCAmelCase : List[Any] = WebClient(token=os.environ["""CI_SLACK_BOT_TOKEN"""]) def A_ ( _UpperCAmelCase ...
671
0
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 lowerCamelCase__ : Any = logging.get_logger(__name__) lowerCamelCase__ : List[str] = R""" Args: ...
31
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Accelerator, Dis...
671
0
"""simple docstring""" def snake_case__ ( _lowerCamelCase, _lowerCamelCase ) ->int: """simple docstring""" __lowercase : Optional[int] = len(_UpperCAmelCase ) print("The following activities are selected:" ) # The first activity is always sel...
575
from math import asin, atan, cos, radians, sin, sqrt, tan lowerCAmelCase : Union[str, Any] = 637_8137.0 lowerCAmelCase : int = 635_6752.31_4245 lowerCAmelCase : Union[str, Any] = 6378137 def A_ ( _UpperCAmelCase , _UpperCAmelCase , _Up...
671
0
'''simple docstring''' import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow _a : Tuple = logging.getLogger() @unittest.skip...
168
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def A_ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): # Initialise PyTorch...
671
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available a_ = { """configuration_graphormer""": ["""GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GraphormerConfig"""], } try: if not is_torch_available(): ...
417
import math def A_ ( _UpperCAmelCase ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False ...
671
0
"""simple docstring""" import itertools import random import unittest import numpy as np from transformers import BatchFeature, SpeechTaFeatureExtractor from transformers.testing_utils import require_torch from transformers.utils.import_utils import is_torch_available from ...test_sequence_feature_extraction_co...
646
import re def A_ ( _UpperCAmelCase ): return [char.split() for char in re.split(R"[^ a-z A-Z 0-9 \s]" , str_ )] def A_ ( _UpperCAmelCase ): SCREAMING_SNAKE_CASE_: int = split_input(str_ ) return "".join( ...
671
0
import copy from dataclasses import dataclass from pathlib import Path from typing import Dict, Optional, Union @dataclass class lowerCAmelCase_ : UpperCamelCase_ :Optional[Union[str, Path]] = None UpperCamelCase_ :bool = False UpperCamelCase_ :bool = Fals...
668
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING lowerCAmelCase : Union[str, Any] = logging.get_logger(__name__) class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
import os def _lowerCAmelCase ( ): UpperCAmelCase_ = os.path.dirname(os.path.realpath(_UpperCAmelCase ) ) UpperCAmelCase_ = os.path.join(_UpperCAmelCase , '''triangle.txt''' ) with open(_UpperCAmelCase ) as f: UpperCAme...
121
import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class __lowercase ( unittest.TestCase ): """simple docstring""" def _SCREAMING_SNAKE_CASE ...
671
0
from math import sqrt def UpperCamelCase_( lowerCamelCase_ ) -> Optional[Any]: assert isinstance(_UpperCAmelCase , _UpperCAmelCase ) and ( number >= 0 ), "'number' must been an int and positive" _lowercase : Dict = True # 0 and 1 are none prim...
89
from itertools import count def A_ ( _UpperCAmelCase = 50 ): SCREAMING_SNAKE_CASE_: Union[str, Any] = [1] * min_block_length for n in count(_UpperCAmelCase ): fill_count_functions.append(1 ) for block_length in range(_UpperCAmelC...
671
0
import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class lowerCAmelCase__ ( unittest.TestCase ): def A_ ( self ) -> Optional[int]: ...
612
def A_ ( _UpperCAmelCase ): if not isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError("only integers accepted as input" ) else: SCREAMING_SNAKE_CASE_: List[Any] = str(abs(_UpperCAmelCase ) ) ...
671
0
"""simple docstring""" from math import ceil def __lowerCamelCase ( __UpperCamelCase , __UpperCamelCase ) -> Any: """simple docstring""" lowerCAmelCase_ : List[str] = list(range(0 , _UpperCAmelCase ) ) lowerCAmelCase_ : Optional[int] =...
610
from __future__ import annotations from collections.abc import Iterator from typing import Any class __lowercase : """simple docstring""" def __init__( self : List[str] , lowerCAmelCase__ : Any): SCREAMING_SNAKE_CASE_: Any = data SCREAMING_SN...
671
0
import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( AutoencoderKL, DDIMScheduler, Di...
519
from collections import defaultdict from math import ceil, sqrt def A_ ( _UpperCAmelCase = 1_00_00_00 , _UpperCAmelCase = 10 ): SCREAMING_SNAKE_CASE_: defaultdict = defaultdict(_UpperCAmelCase ) for outer_width in range(3 , (t_limit // 4)...
671
0
from typing import Dict, List, Optional, Tuple, Union import torch from ...models import AutoencoderKL, TransformeraDModel from ...schedulers import KarrasDiffusionSchedulers from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class lowerCamelCase_ ( U...
31
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCAmelCase : str = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_xlm""": [""...
671
0
"""simple docstring""" from __future__ import annotations __A : Any = tuple[int, int, int] __A : str = tuple[str, str, str] # used alphabet -------------------------- # from string.ascii_uppercase __A : Union[str, Any] = """ABCDEFGHIJKLMNOPQRSTUVWXYZ""" # ------------------------...
575
lowerCAmelCase : List[str] = { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], """G""": ["""C"""], } def A_ ( _Upp...
671
0
'''simple docstring''' import argparse import json import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import SegformerImageProcessor, SwinConfig, UperNetConfig, UperNetForSemanticSegmentation def _lowercase ( lowerCamelCase__ ...
168
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __lowercase ( UpperCAmelCase_ ): """simple docstring""" def _SCREAMING_SNAKE_CASE ( self : List[Any] , lowerCAmelCase__ ...
671
0
import os from typing import List, Optional, Union from ...image_processing_utils import BatchFeature from ...image_utils import ImageInput from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import Tensor...
417
from __future__ import annotations from math import ceil, floor, sqrt def A_ ( _UpperCAmelCase = 2_00_00_00 ): SCREAMING_SNAKE_CASE_: list[int] = [0] SCREAMING_SNAKE_CASE_: int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ...
671
0
"""simple docstring""" def lowercase_ ( _lowerCamelCase: Union[str, Any] ) -> Union[str, Any]: '''simple docstring''' __lowerCamelCase : Tuple = 0 __lowerCamelCase : List[str] = len(_UpperCAmelCase ) for i in range(n - 1 ): for j in...
646
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : Optional[int] = { """configuration_longformer""": [ """LONGFORMER_PRETRAINED_CONFIG_ARC...
671
0
# This script creates a super tiny model that is useful inside tests, when we just want to test that # the machinery works, without needing to the check the quality of the outcomes. # # This version creates a tiny model through reduction of a normal pre-trained model, but keeping the # full vocab, merges file, a...
668
import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# lowerCAmelCase : Optional[int] = [ # (stable-diffusion, HF Diffusers) ("""time_embed.0.weight""", """time_embedding.li...
671
0
from argparse import ArgumentParser from datasets.commands.convert import ConvertCommand from datasets.commands.dummy_data import DummyDataCommand from datasets.commands.env import EnvironmentCommand from datasets.commands.run_beam import RunBeamCommand from datasets.commands.test import TestCommand ...
121
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : int = logging.get_logger(__name__) lowerCAmelCase : Dict = { """microsoft/xprophetnet-large-wiki100-cased""": ( """https://huggingf...
671
0
import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, BatchEncoding, PreTrainedTokenizer from ...utils import logging SCREAMING_SNAKE_CASE : Optional[Any] = logging.get_logger(__name__) SCRE...
89
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, PILImageResampli...
671
0
# Lint as: python3 import itertools import os import re lowerCamelCase__ = re.compile(R"([A-Z]+)([A-Z][a-z])") lowerCamelCase__ = re.compile(R"([a-z\d])([A-Z])") lowerCamelCase__ = re.compile(R"(?<!_)_(?!_)") lowerCamelCase__ = re.compile(R"(_{2,})") lowerCamelCase__ = R"""^...
612
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer lowerCAmelCase : Optional[int] = logging.get_logger(__...
671
0
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
610
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
import gc import unittest import numpy as np import torch import torch.nn.functional as F from transformers import ( ClapTextConfig, ClapTextModelWithProjection, RobertaTokenizer, SpeechTaHifiGan, SpeechTaHifiGanConfig, ) from diffusers import ( AudioLDMPipeline, Auto...
519
import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient lowerCAmelCase : List[Any] = WebClient(token=os.environ["""CI_SLACK_BOT_TOKEN"""]) def A_ ( _UpperCAmelCase ...
671
0
import json import os import tempfile import transformers import datasets from utils import generate_example_dataset, get_duration lowerCamelCase__ : Tuple = 500_000 lowerCamelCase__ : Optional[Any] = os.path.split(__file__) lowerCamelCase__ : Dict = ...
31
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Accelerator, Dis...
671
0
"""simple docstring""" from transformers import BertTokenizerFast from .custom_tokenization import CustomTokenizer class lowerCAmelCase__ ( UpperCAmelCase_ ): """simple docstring""" __UpperCAmelCase : Tuple = CustomTokenizer pass
575
from math import asin, atan, cos, radians, sin, sqrt, tan lowerCAmelCase : Union[str, Any] = 637_8137.0 lowerCAmelCase : int = 635_6752.31_4245 lowerCAmelCase : Union[str, Any] = 6378137 def A_ ( _UpperCAmelCase , _UpperCAmelCase , _Up...
671
0
'''simple docstring''' import sacrebleu as scb from packaging import version from sacrebleu import TER import datasets _a : List[str] = """\ @inproceedings{snover-etal-2006-study, title = \"A Study of Translation Edit Rate with Targeted Human Annotation\", author = \"Snover, Matthe...
168
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def A_ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): # Initialise PyTorch...
671
0
import argparse import re from typing import Dict import torch from datasets import Audio, Dataset, load_dataset, load_metric from transformers import AutoFeatureExtractor, pipeline def __lowercase ( lowerCamelCase : str , lowerCamelCase : Optional[Any] ): UpperCamelCase_ : str = args...
417
import math def A_ ( _UpperCAmelCase ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False ...
671
0
"""simple docstring""" import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient __A = WebClient(token=os.environ['''CI_SLACK_BOT_TOKEN''']) def lowercase_ ( _lowerCamelCase: Tuple ...
646
import re def A_ ( _UpperCAmelCase ): return [char.split() for char in re.split(R"[^ a-z A-Z 0-9 \s]" , str_ )] def A_ ( _UpperCAmelCase ): SCREAMING_SNAKE_CASE_: int = split_input(str_ ) return "".join( ...
671
0
import warnings from ...utils import logging from .image_processing_beit import BeitImageProcessor _UpperCAmelCase : Tuple = logging.get_logger(__name__) class lowerCAmelCase_ ( UpperCAmelCase_ ): def __init__( self : Optional[Any] , *SCREAMING_SNAKE_CASE_ :...
668
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto.configuration_auto import CONFIG_MAPPING lowerCAmelCase : Union[str, Any] = logging.get_logger(__name__) class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets _lowerCamelCase : Union[str, Any] = """\ @inproceedings{popovic-2015-chrf, title = \"chr{F}: character n-gram {F}-score for automatic {MT} evaluation\", author = \"Popovi{\'c}, Maj...
121
import pickle import unittest import torch from accelerate import Accelerator from accelerate.state import AcceleratorState from accelerate.test_utils import require_cpu @require_cpu class __lowercase ( unittest.TestCase ): """simple docstring""" def _SCREAMING_SNAKE_CASE ...
671
0
import os import unittest from transformers.models.transfo_xl.tokenization_transfo_xl import VOCAB_FILES_NAMES, TransfoXLTokenizer from ...test_tokenization_common import TokenizerTesterMixin class _lowerCamelCase( UpperCAmelCase_, unittest.TestCase ): lowercase_ : str = ...
89
from itertools import count def A_ ( _UpperCAmelCase = 50 ): SCREAMING_SNAKE_CASE_: Union[str, Any] = [1] * min_block_length for n in count(_UpperCAmelCase ): fill_count_functions.append(1 ) for block_length in range(_UpperCAmelC...
671
0
import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import numpy as np import pytest from datasets.arrow_dataset import Dataset from datasets.search import ElasticSearchIndex, FaissIndex, MissingIndex from .utils import require_elasticsearch, require...
612
def A_ ( _UpperCAmelCase ): if not isinstance(_UpperCAmelCase , _UpperCAmelCase ): raise TypeError("only integers accepted as input" ) else: SCREAMING_SNAKE_CASE_: List[Any] = str(abs(_UpperCAmelCase ) ) ...
671
0
"""simple docstring""" # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
610
from __future__ import annotations from collections.abc import Iterator from typing import Any class __lowercase : """simple docstring""" def __init__( self : List[str] , lowerCAmelCase__ : Any): SCREAMING_SNAKE_CASE_: Any = data SCREAMING_SN...
671
0
import importlib import json import os import sys import tempfile import unittest from pathlib import Path import transformers import transformers.models.auto from transformers.models.auto.configuration_auto import CONFIG_MAPPING, AutoConfig from transformers.models.bert.configuration_bert import Bert...
519
from collections import defaultdict from math import ceil, sqrt def A_ ( _UpperCAmelCase = 1_00_00_00 , _UpperCAmelCase = 10 ): SCREAMING_SNAKE_CASE_: defaultdict = defaultdict(_UpperCAmelCase ) for outer_width in range(3 , (t_limit // 4)...
671
0
# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim from dataclasses import dataclass from typing import Optional, Tuple, Union import flax import jax import jax.numpy as jnp from ..configuration_utils import ConfigMixin, register_to_config from .scheduling_utils_flax import ( ...
31
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCAmelCase : str = { """configuration_xlm""": ["""XLM_PRETRAINED_CONFIG_ARCHIVE_MAP""", """XLMConfig""", """XLMOnnxConfig"""], """tokenization_xlm""": [""...
671
0
"""simple docstring""" from typing import TYPE_CHECKING from ...file_utils import _LazyModule, is_torch_available from ...utils import OptionalDependencyNotAvailable __A : Optional[int] = { """configuration_gpt_neox_japanese""": ["""GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTNe...
575
lowerCAmelCase : List[str] = { """A""": ["""B""", """C""", """E"""], """B""": ["""A""", """D""", """E"""], """C""": ["""A""", """F""", """G"""], """D""": ["""B"""], """E""": ["""A""", """B""", """D"""], """F""": ["""C"""], """G""": ["""C"""], } def A_ ( _Upp...
671
0
'''simple docstring''' import warnings from ...utils import logging from .image_processing_glpn import GLPNImageProcessor _a : Any = logging.get_logger(__name__) class __A (UpperCAmelCase_ ): def __init__( self , *UpperCamelCase_ , **Uppe...
168
from __future__ import annotations from math import pi from typing import Protocol import matplotlib.pyplot as plt import numpy as np class __lowercase ( UpperCAmelCase_ ): """simple docstring""" def _SCREAMING_SNAKE_CASE ( self : List[Any] , lowerCAmelCase__ ...
671
0
def __lowercase ( lowerCamelCase : str ): try: UpperCamelCase_ : int = float(_UpperCAmelCase ) except ValueError: raise ValueError('Please enter a valid number' ) UpperCamelCase_ : str = decimal - int(_UpperCAmelCase ) if fractional_part == 0: return int(_UpperCAmelC...
417
from __future__ import annotations from math import ceil, floor, sqrt def A_ ( _UpperCAmelCase = 2_00_00_00 ): SCREAMING_SNAKE_CASE_: list[int] = [0] SCREAMING_SNAKE_CASE_: int for idx in range(1 , ceil(sqrt(target * 2 ) * 1.1 ) ...
671
0
"""simple docstring""" import heapq import sys import numpy as np __A = tuple[int, int] class _snake_case : def __init__( self : Tuple ): __lowerCamelCase : str = [] __lowerCamelCase : str = set() def lowerCamelCase...
646
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_tokenizers_available, is_torch_available, ) lowerCAmelCase : Optional[int] = { """configuration_longformer""": [ """LONGFORMER_PRETRAINED_CONFIG_ARC...
671
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...
668
import argparse import os.path as osp import re import torch from safetensors.torch import load_file, save_file # =================# # UNet Conversion # # =================# lowerCAmelCase : Optional[int] = [ # (stable-diffusion, HF Diffusers) ("""time_embed.0.weight""", """time_embedding.li...
671
0
import math def _lowerCAmelCase ( __magic_name__ :str , __magic_name__ :str = 0 , __magic_name__ :List[str] = 0 ): UpperCAmelCase_ = end or len(_UpperCAmelCase ) for i in range(_UpperCAmelCase , _UpperCAmelCase ): UpperC...
121
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCAmelCase : int = logging.get_logger(__name__) lowerCAmelCase : Dict = { """microsoft/xprophetnet-large-wiki100-cased""": ( """https://huggingf...
671
0
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def UpperCamelCase_( lowerCamelCase_ , lowerCamelCase_ , lowerCamelCase_ ) -> Any: # Initialise ...
89
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 rescale, resize, to_channel_dimension_format from ...image_utils import ( ChannelDimension, ImageInput, PILImageResampli...
671
0
def __A(lowerCAmelCase ) -> List[Any]: """simple docstring""" _UpperCamelCase = set() # edges = list of graph's edges _UpperCamelCase = get_edges(_UpperCAmelCase ) # While there are still elements in edges list, take an arbitrary edge # (from_node, to_node) an...
612
import collections from typing import List, Optional, Union from ...tokenization_utils_base import BatchEncoding from ...utils import TensorType, add_end_docstrings, add_start_docstrings, logging from ..bert.tokenization_bert import BertTokenizer lowerCAmelCase : Optional[int] = logging.get_logger(__...
671
0
"""simple docstring""" import argparse import os import gluonnlp as nlp import mxnet as mx import numpy as np import torch from gluonnlp.base import get_home_dir from gluonnlp.model.bert import BERTEncoder from gluonnlp.model.utils import _load_vocab from gluonnlp.vocab import Vocab from packaging import versi...
610
from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __lowercase ( UpperCAmelCase_ ): """simple docstring""" ...
671
0
def _UpperCAmelCase ( UpperCAmelCase : Tuple=28_123 ): """simple docstring""" __lowerCamelCase : int = [1] * (limit + 1) for i in range(2 , int(limit**0.5 ) + 1 ): sum_divs[i * i] += i for k in range(i + 1 , ...
519
import collections import json import math import os import re import time from fnmatch import fnmatch from typing import Dict import requests from slack_sdk import WebClient lowerCAmelCase : List[Any] = WebClient(token=os.environ["""CI_SLACK_BOT_TOKEN"""]) def A_ ( _UpperCAmelCase ...
671
0
from __future__ import annotations from collections import deque from collections.abc import Iterator from dataclasses import dataclass @dataclass class lowerCamelCase_ : '''simple docstring''' lowercase_ = 42 lowercase_ = 42 class lowerCamelCas...
31
import argparse import os import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Accelerator, Dis...
671
0
"""simple docstring""" from manim import * class lowerCAmelCase__ ( UpperCAmelCase_ ): """simple docstring""" def snake_case ( self : Any ): __lowercase : Optional[Any] = Rectangle(height=0.5 , width=0.5 ) __lowerc...
575
from math import asin, atan, cos, radians, sin, sqrt, tan lowerCAmelCase : Union[str, Any] = 637_8137.0 lowerCAmelCase : int = 635_6752.31_4245 lowerCAmelCase : Union[str, Any] = 6378137 def A_ ( _UpperCAmelCase , _UpperCAmelCase , _Up...
671
0
'''simple docstring''' from collections import defaultdict from math import gcd def _lowercase ( lowerCamelCase__ = 150_0000 ) -> Tuple: """simple docstring""" __UpperCAmelCase : defaultdict = defaultdict(_UpperCAmelCase ) __Upp...
168
import argparse import torch from transformers import BertConfig, BertForPreTraining, load_tf_weights_in_bert from transformers.utils import logging logging.set_verbosity_info() def A_ ( _UpperCAmelCase , _UpperCAmelCase , _UpperCAmelCase ): # Initialise PyTorch...
671
0
import unittest from transformers import SqueezeBertConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, ran...
417
import math def A_ ( _UpperCAmelCase ): if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3 are not primes return False ...
671
0
"""simple docstring""" import argparse import json import logging import os import sys from unittest.mock import patch from transformers.testing_utils import TestCasePlus, get_gpu_count, slow __A = [ os.path.join(os.path.dirname(__file__), dirname) for dirname in [ """text-classification""",...
646
import re def A_ ( _UpperCAmelCase ): return [char.split() for char in re.split(R"[^ a-z A-Z 0-9 \s]" , str_ )] def A_ ( _UpperCAmelCase ): SCREAMING_SNAKE_CASE_: int = split_input(str_ ) return "".join( ...
671
0
'''simple docstring''' import requests __magic_name__ : int = """YOUR API KEY""" def snake_case_ ( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ = giphy_api_key ): '''simple docstring''' _snake_case = "+".join(query.split() ) _snake_case ...
672
'''simple docstring''' from torch import nn def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' if act_fn in ["swish", "silu"]: return nn.SiLU() elif act_fn == "mish": return nn.Mish() elif act_fn == "gelu": return nn.GELU() else: raise Value...
672
1
'''simple docstring''' import unittest from transformers import DebertaVaConfig, is_torch_available from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mod...
672
'''simple docstring''' from __future__ import annotations import time from math import sqrt # 1 for manhattan, 0 for euclidean __magic_name__ : Tuple = 0 __magic_name__ : Dict = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0,...
672
1
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary # Register SEW's fairseq modules from sew_asapp import tasks # noqa: F401 from transformers import ( SEWConfig, SEWForCTC, SEWModel, WavaVecaCTCTokenizer, WavaVec...
672
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __magic_name__ : int = { """configuration_nezha""": ["""NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP""", """NezhaConfig"""], } try: if...
672
1
'''simple docstring''' def snake_case_ ( SCREAMING_SNAKE_CASE__ = 1_00 ): '''simple docstring''' _snake_case = (n * (n + 1) // 2) ** 2 _snake_case = n * (n + 1) * (2 * n + 1) // 6 return sum_cubes - sum_squares if __name__ == "__main__": print(F'{solution() = }'...
672
'''simple docstring''' import string def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' _snake_case = "" for i in sequence: _snake_case = ord(SCREAMING_SNAKE_CASE__ ) if 65 <= extract <= 90: output += chr(1_55 - extract )...
672
1
'''simple docstring''' import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( UniSpeechConfig, UniSpeechForCTC, UniSpeechForPreTraining, WavaVecaFeatureExtractor, WavaVecaPhonemeCTCTokenizer, WavaVecaProcessor, ...
672
'''simple docstring''' import numpy as np def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' return 1 / (1 + np.exp(-vector )) def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' return vector * sigmoid(1.702 *...
672
1
'''simple docstring''' import argparse import torch # Step 1. clone https://github.com/microsoft/unilm # Step 2. git checkout to https://github.com/microsoft/unilm/commit/b94ec76c36f02fb2b0bf0dcb0b8554a2185173cd # Step 3. cd unilm # Step 4. ln -s $(realpath wavlm/modules.py) ./ # create simlink # import cla...
672
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAnalytics from sagemaker.hugg...
672
1
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, ...
672
'''simple docstring''' from transformers import DistilBertTokenizer, DistilBertTokenizerFast from transformers.testing_utils import require_tokenizers, slow from ..bert.test_tokenization_bert import BertTokenizationTest @require_tokenizers class __SCREAMING_SNAKE_CASE ( __UpperCamelCase ): ...
672
1
'''simple docstring''' import argparse import os import re import tensorflow as tf import torch from transformers import BertConfig, BertModel from transformers.utils import logging logging.set_verbosity_info() __magic_name__ : Optional[int] = logging.get_logger(__name__) def snake_case...
672
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_torch_available, ) __magic_name__ : Optional[int] = { """configuration_swiftformer""": [ """SWIFTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", ...
672
1
'''simple docstring''' from cva import destroyAllWindows, imread, imshow, waitKey def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' _snake_case , _snake_case = img.shape[0], img.shape[1] # converting each pixel's color to its negative for i in rang...
672
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import BeitConfig, BeitForImageClassification, BeitForMaskedImageModeling, BeitImageProcessor from transformers.image_ut...
672
1
'''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 from...
672
'''simple docstring''' import math def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' assert isinstance(SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ) and ( number >= 0 ), "'number' must been an int and positive" if 1 < number < 4: ...
672
1
'''simple docstring''' from collections.abc import Callable import numpy as np def snake_case_ ( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ): '''simple docstr...
672
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available __magic_name__ : Dict = { """configuration_pix2struct""": [ """PIX2STRUCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Pix2...
672
1
'''simple docstring''' from collections.abc import Sequence from queue import Queue class __SCREAMING_SNAKE_CASE : '''simple docstring''' def __init__( self , lowerCamelCase , lowerCamelCase , lowerCamelCase , lowerCamelCase=None , lowerCamelCase=None ): ...
672
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_ch...
672
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging __magic_name__ : List[str] = logging.get_logger(__name__) __magic_name__ : int = { """google/realm-cc-news-pretrained-embedder""": ( """https://huggingface.co/google/real...
672
'''simple docstring''' import baseaa def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' return baseaa.aaaencode(string.encode("utf-8" ) ) def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''simple docstring''' return baseaa....
672
1
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING __magic_name__ : Union[str, Any] = logging.get_logger(__name__) __magic_name__ : Optional[int] = { """ut/deta""": """https://huggin...
672
'''simple docstring''' 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 ( BnbQuantizationCon...
672
1
'''simple docstring''' from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __magic_name__ : int = { """configuration_mctct""": ["""MCTCT_PRETRAINED_CONFIG_ARCHIVE_MAP""", """MCTCTConfig"""], """feature_extraction_mctct""":...
672
'''simple docstring''' import os import tempfile from functools import partial from unittest import TestCase from unittest.mock import patch import datasets import datasets.config from .utils import require_beam class __SCREAMING_SNAKE_CASE ( datasets.BeamBasedBuilder ): '''simple d...
672
1
'''simple docstring''' import json import os from functools import lru_cache from typing import Dict, List, Optional, Tuple, Union import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...tokenization_utils_base import BatchEncoding, EncodedInput from ...utils import Paddi...
672
'''simple docstring''' import unittest import numpy as np import torch from diffusers import VersatileDiffusionImageVariationPipeline from diffusers.utils.testing_utils import load_image, require_torch_gpu, slow, torch_device __magic_name__ : Optional[int] = False class __SCREAMING_SNAKE_CA...
672
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available __magic_name__ : Optional[int] = { """configuration_graphormer""": ["""GRAPHORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Graphorm...
672
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def snake_case_ ( SCREAMING_SNAKE_CASE__ , S...
672
1
'''simple docstring''' from __future__ import annotations __magic_name__ : List[str] = list[tuple[int, int]] __magic_name__ : Union[str, Any] = [ [0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], # 0 are free path whereas 1's are obstacles [0, 0, 0, 0, 0, 0, 0], [0, 0, 1, 0...
672
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available __magic_name__ : Any = { """configuration_swinv2""": ["""SWINV2_PRETRAINED_CONFIG_ARCHIVE_MAP""", """Swinv2Config"""], } try: if not is_torch_availab...
672
1
'''simple docstring''' from __future__ import annotations from random import random from typing import Generic, TypeVar __magic_name__ : int = TypeVar("""KT""") __magic_name__ : Tuple = TypeVar("""VT""") class __SCREAMING_SNAKE_CASE ( Generic[KT, VT] ): '''simp...
672
'''simple docstring''' import math def snake_case_ ( SCREAMING_SNAKE_CASE__ , SCREAMING_SNAKE_CASE__ ): '''simple docstring''' return math.pow(SCREAMING_SNAKE_CASE__ , 2 ) - a def snake_case_ ( SCREAMING_SNAKE_CASE__ ): '''s...
672
1
'''simple docstring''' from ...utils import ( OptionalDependencyNotAvailable, is_torch_available, is_transformers_available, is_transformers_version, ) try: if not (is_transformers_available() and is_torch_available()): raise OptionalDependencyNotAvailable() except OptionalDependencyNotAva...
672
'''simple docstring''' import copy import os from typing import Union from ...configuration_utils import PretrainedConfig from ...utils import logging __magic_name__ : Optional[int] = logging.get_logger(__name__) __magic_name__ : Optional[int] = { """microsoft/git-base""": """http...
672
1