code
stringlengths
81
54k
code_codestyle
int64
0
721
style_context
stringlengths
91
41.9k
style_context_codestyle
int64
0
699
label
int64
0
1
import argparse from collections import OrderedDict from pathlib import Path import torch from transformers import ( VisualBertConfig, VisualBertForMultipleChoice, VisualBertForPreTraining, VisualBertForQuestionAnswering, VisualBertForVisualReasoning, ) from transformers.utils import logging...
77
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class _A( nn.Module ): ...
77
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, CLIPTokenizer from diffusers import ( AutoencoderKL, DDIMScheduler, EulerAncestralDiscreteScheduler, LMSDiscreteScheduler, PNDMScheduler, StableDiffusionPanoramaPipeline, ...
77
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
77
1
import unittest import torch from torch import nn from diffusers.models.activations import get_activation class _A( unittest.TestCase ): """simple docstring""" def UpperCAmelCase_ ( self ): __A : Any = get_activation('swish' ) self.asse...
77
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging UpperCAmelCase : Dic...
77
1
import math def _SCREAMING_SNAKE_CASE ( a , a = 0 , a = 0 ) -> list: __A : Union[str, Any] = end or len(a ) for i in range(a , a ): __A : Union[str, Any] = i __A : List[Any] = ...
77
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor UpperCAmelCase : List[Any] = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" def __init__( self , *_A , **_A ): ...
77
1
from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast from ...utils import logging UpperCAmelCase : Optional[Any] ...
77
import glob import os import random from string import ascii_lowercase, digits import cva UpperCAmelCase : Dict = '''''' UpperCAmelCase : Union[str, Any] = '''''' UpperCAmelCase : Optional[int] = '''''' UpperCAmelCase : Union[str, Any] = 1 # (0 is vert...
77
1
import requests UpperCAmelCase : Dict = '''https://newsapi.org/v1/articles?source=bbc-news&sortBy=top&apiKey=''' def _SCREAMING_SNAKE_CASE ( a ) -> None: # fetching a list of articles in json format __A : Any = requests.get(_NEWS_API + bbc_...
77
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_common import ConfigTester fr...
77
1
def _SCREAMING_SNAKE_CASE ( a , a ) -> int: if len(a ) != len(a ): raise ValueError('String lengths must match!' ) __A : Tuple = 0 for chara, chara in zip(a , a ): if chara != chara: count ...
77
import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel UpperCAmelCase : str = HfApi() UpperCAmelCase : List[str] = {} # fmt: off UpperCAmelCase : Optional[Any] = torch.tensor([ -0.7515, -1.6883, 0.2420, 0.0300, 0.6347, 1...
77
1
import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet import VOCAB_FILES_NAMES, P...
77
import numpy as np from PIL import Image def _SCREAMING_SNAKE_CASE ( a , a , a ) -> np.ndarray: __A : Union[str, Any] = np.array(a ) if arr.shape[0] != arr.shape[1]: raise ValueError('The input array is not a square matrix' ...
77
1
import unittest from transformers import is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor f...
77
from __future__ import annotations from collections.abc import Callable def _SCREAMING_SNAKE_CASE ( a , a , a , a = 1_00 , ) -> float: __A : Any = x_start __A : List[str] = fnc(a ) __A : Optional[Any] ...
77
1
from __future__ import annotations UpperCAmelCase : Tuple = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] UpperCAmelCase : List[Any] = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def _SCREAMING_SNAKE_CASE ( a ) -> list[float...
77
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def _SCREAMING_SNAKE_CASE ( ) -> None: print('Making key files...' ) make_key_files('rsa' , 10_24 ) print(...
77
1
def _SCREAMING_SNAKE_CASE ( a , a , a , a , a , a ) -> List[Any]: if index == r: for j in range(a ): print(data[j] , end=' ' ) print(' ' ) return # When no more elements are there to p...
77
import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet import VOCAB_FILES_NAMES, P...
77
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_big_bird im...
77
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 : List[str] = logging.get_logger(__name__) UpperCAmelC...
77
1
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
77
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class _A( unittest.TestCase ): """simple docstring""" def UpperCAmelCase_ ( self ): debug_launcher(test_script.main ) de...
77
1
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a , a ) -> Optional[Any]: # Checks if the entire collection has been sorted if len(a ) <= 1 or n <= 1: return insert_next(a , n - 1 ) rec_insertion_sort(a , n - 1...
77
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
77
1
# coding=utf-8 # Copyright 2020 The HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
77
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, loggi...
77
1
def _SCREAMING_SNAKE_CASE ( ) -> int: return [ a * b * (10_00 - a - b) for a in range(1 , 9_99 ) for b in range(a , 9_99 ) if (a * a + b * b == (10_00 - a - b) ** 2) ][0] if __name__ == "__main__": print(F"""{solution() = ...
77
from abc import ABC, abstractmethod from argparse import ArgumentParser class _A( snake_case__ ): """simple docstring""" @staticmethod @abstractmethod def UpperCAmelCase_ ( _A ): raise NotImplementedError() @abstractmethod def UpperCAmelCas...
77
1
from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_channel_dimension_format, ) ...
77
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase : Optional[int] = {'''configuration_unispeech''': ['''UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''U...
77
1
import json import os import unittest from typing import Tuple from transformers import WavaVecaPhonemeCTCTokenizer from transformers.models.wavaveca.tokenization_wavaveca import VOCAB_FILES_NAMES from transformers.models.wavaveca_phoneme.tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizerOutput fro...
77
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import load_numpy, ...
77
1
# 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, an...
77
from __future__ import annotations import math def _SCREAMING_SNAKE_CASE ( a , a ) -> list: if len(a ) != 2 or len(a[0] ) != 2 or len(a ) != 2 or len(b[0] ) != 2: raise Exception('Matrices are not 2x2' ) __A : Optional[int] ...
77
1
import os import re import unicodedata from shutil import copyfile from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union import sentencepiece as spm from ...tokenization_utils import PreTrainedTokenizer from ...utils import is_torch_available, logging if is_torch_available(): import to...
77
def _SCREAMING_SNAKE_CASE ( a ) -> int: __A : List[str] = [] __A : Tuple = [] __A : Union[str, Any] = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, '-': 1, } # Priori...
77
1
def _SCREAMING_SNAKE_CASE ( a ) -> int: __A : List[Any] = [1] __A , __A , __A : Union[str, Any] = 0, 0, 0 __A : Optional[int] = ugly_nums[ia] * 2 __A : Any = ugly_nums[ia] * 3 ...
77
import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase : Tuple = { '''facebook/mask2former-swin-small-coco-instance''': ( '''https://huggingface.co/facebook/...
77
1
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
77
import copy 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 ..auto import CONFIG_MAPPING UpperCAmelCase : List[str] = logging.get_log...
77
1
def _SCREAMING_SNAKE_CASE ( a , a ) -> str: __A : int = len(a ) __A : int = len(a ) __A : int = ( first_str_length if first_str_length > second_str_length else second_str_length ) __A :...
77
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class _A( nn.Module ): ...
77
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tensorflow_text_available, is_torch_available UpperCAmelCase : List[str] = { '''configuration_ernie''': ['''ERNIE_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ErnieConfig''', '''ErnieOnnxConfig'''],...
77
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
77
1
import torch from transformers import CamembertForMaskedLM, CamembertTokenizer def _SCREAMING_SNAKE_CASE ( a , a , a , a=5 ) -> Dict: # Adapted from https://github.com/pytorch/fairseq/blob/master/fairseq/models/roberta/hub_interface.py assert masked_input...
77
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging UpperCAmelCase : Dic...
77
1
# Algorithm for the pigeonhole sorting def _SCREAMING_SNAKE_CASE ( a ) -> int: __A : Dict = min(a ) # min() finds the minimum value __A : str = max(a ) # max() finds the maximum value __A : str = max_...
77
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor UpperCAmelCase : List[Any] = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" def __init__( self , *_A , **_A ): ...
77
1
import requests from bsa import BeautifulSoup def _SCREAMING_SNAKE_CASE ( a = "AAPL" ) -> str: __A : int = F"""https://in.finance.yahoo.com/quote/{symbol}?s={symbol}""" __A : Any = BeautifulSoup(requests.get(a ).text , 'html.pa...
77
import glob import os import random from string import ascii_lowercase, digits import cva UpperCAmelCase : Dict = '''''' UpperCAmelCase : Union[str, Any] = '''''' UpperCAmelCase : Optional[int] = '''''' UpperCAmelCase : Union[str, Any] = 1 # (0 is vert...
77
1
import argparse from pathlib import Path import requests import torch from PIL import Image from transformers import ( RobertaTokenizer, TrOCRConfig, TrOCRForCausalLM, TrOCRProcessor, VisionEncoderDecoderModel, ViTConfig, ViTImageProcessor, ViTModel, ) from transformers.utils imp...
77
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_common import ConfigTester fr...
77
1
def _SCREAMING_SNAKE_CASE ( a , a ) -> int: while a != 0: __A , __A : str = b % a, a return b def _SCREAMING_SNAKE_CASE ( a , a ) -> int: if gcd(a , a ) != 1: __A : int ...
77
import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel UpperCAmelCase : str = HfApi() UpperCAmelCase : List[str] = {} # fmt: off UpperCAmelCase : Optional[Any] = torch.tensor([ -0.7515, -1.6883, 0.2420, 0.0300, 0.6347, 1...
77
1
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class _A( unittest.TestCase ): """simple docstring""" def UpperCAmelCase_ ( self ): debug_launcher(test_script.main ) de...
77
import numpy as np from PIL import Image def _SCREAMING_SNAKE_CASE ( a , a , a ) -> np.ndarray: __A : Union[str, Any] = np.array(a ) if arr.shape[0] != arr.shape[1]: raise ValueError('The input array is not a square matrix' ...
77
1
import numpy as np import pandas as pd from sklearn.preprocessing import MinMaxScaler from tensorflow.keras.layers import LSTM, Dense from tensorflow.keras.models import Sequential if __name__ == "__main__": UpperCAmelCase : str = pd.read_csv('''sample_data.csv''', header=None) UpperCAmelC...
77
from __future__ import annotations from collections.abc import Callable def _SCREAMING_SNAKE_CASE ( a , a , a , a = 1_00 , ) -> float: __A : Any = x_start __A : List[str] = fnc(a ) __A : Optional[Any] ...
77
1
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 classes from unilm.wavlm.WavL...
77
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def _SCREAMING_SNAKE_CASE ( ) -> None: print('Making key files...' ) make_key_files('rsa' , 10_24 ) print(...
77
1
from typing import TYPE_CHECKING from ...utils import _LazyModule UpperCAmelCase : List[str] = {'''tokenization_wav2vec2_phoneme''': ['''Wav2Vec2PhonemeCTCTokenizer''']} if TYPE_CHECKING: from .tokenization_wavaveca_phoneme import WavaVecaPhonemeCTCTokenizer else: import sys Upper...
77
import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet import VOCAB_FILES_NAMES, P...
77
1
import secrets from random import shuffle from string import ascii_letters, ascii_lowercase, ascii_uppercase, digits, punctuation def _SCREAMING_SNAKE_CASE ( a = 8 ) -> str: __A : Union[str, Any] = ascii_letters + digits + punctuation return "".join(secret...
77
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 : List[str] = logging.get_logger(__name__) UpperCAmelC...
77
1
import math import unittest from transformers import BioGptConfig, is_torch_available from transformers.testing_utils import require_torch, slow, torch_device from ...generation.test_utils import GenerationTesterMixin from ...test_configuration_common import ConfigTester from ...test_modeling_common import Mode...
77
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class _A( unittest.TestCase ): """simple docstring""" def UpperCAmelCase_ ( self ): debug_launcher(test_script.main ) de...
77
1
from __future__ import annotations import time UpperCAmelCase : Optional[int] = list[tuple[int, int]] UpperCAmelCase : str = [ [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, 0, 0, 0], ...
77
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
77
1
def _SCREAMING_SNAKE_CASE ( a , a ) -> str: __A : List[str] = '' for word_or_phrase in separated: if not isinstance(a , a ): raise Exception('join() accepts only strings to be joined' ) joined += word_or_ph...
77
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, loggi...
77
1
from ..utils import DummyObject, requires_backends class _A( metaclass=snake_case__ ): """simple docstring""" UpperCamelCase : Optional[Any] = ['''torch'''] def __init__( self , *_A , **_A ): requires_backends(self , ['torch'] ...
77
from abc import ABC, abstractmethod from argparse import ArgumentParser class _A( snake_case__ ): """simple docstring""" @staticmethod @abstractmethod def UpperCAmelCase_ ( _A ): raise NotImplementedError() @abstractmethod def UpperCAmelCas...
77
1
import warnings from typing import Dict, List, Optional, Tuple from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging UpperCAmelCase : Any = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" UpperCame...
77
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase : Optional[int] = {'''configuration_unispeech''': ['''UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''U...
77
1
import pytest UpperCAmelCase : int = '''__dummy_dataset1__''' UpperCAmelCase : Union[str, Any] = ''' import json import os import datasets REPO_URL = "https://huggingface.co/datasets/albertvillanova/tests-raw-jsonl/resolve/main/" URLS = {"train": REPO_URL + "wikiann-bn-train.js...
77
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import load_numpy, ...
77
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCAmelCase : Optional[int] = logging.get_logger(__name__) UpperCAmelCase : List[Any] = { '''...
77
from __future__ import annotations import math def _SCREAMING_SNAKE_CASE ( a , a ) -> list: if len(a ) != 2 or len(a[0] ) != 2 or len(a ) != 2 or len(b[0] ) != 2: raise Exception('Matrices are not 2x2' ) __A : Optional[int] ...
77
1
from typing import Any class _A: """simple docstring""" def __init__( self , _A ): __A : str = data __A : Union[str, Any] = None class _A: """simple docstring""" def __init__( self ): __A : Dict ...
77
def _SCREAMING_SNAKE_CASE ( a ) -> int: __A : List[str] = [] __A : Tuple = [] __A : Union[str, Any] = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, '-': 1, } # Priori...
77
1
UpperCAmelCase : str = '''Alexander Joslin''' import operator as op from .stack import Stack def _SCREAMING_SNAKE_CASE ( a ) -> int: __A : Tuple = {'*': op.mul, '/': op.truediv, '+': op.add, '-': op.sub} __A : Stack[int] = ...
77
import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase : Tuple = { '''facebook/mask2former-swin-small-coco-instance''': ( '''https://huggingface.co/facebook/...
77
1
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(): import t...
77
import copy 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 ..auto import CONFIG_MAPPING UpperCAmelCase : List[str] = logging.get_log...
77
1
import warnings from collections import OrderedDict from typing import Any, Mapping, Optional from ... import PreTrainedTokenizer from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast from ...onnx.utils import compute_effective_axis_dime...
77
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class _A( nn.Module ): ...
77
1
import warnings from typing import List, Optional, Tuple, Union import numpy as np import PIL import torch from ...models import UNetaDModel from ...schedulers import RePaintScheduler from ...utils import PIL_INTERPOLATION, logging, randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutpu...
77
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
77
1
from typing import Optional from torch import nn from .transformer_ad import TransformeraDModel, TransformeraDModelOutput class _A( nn.Module ): """simple docstring""" def __init__( self , _A = 16 , _A = 88 , _A = None , _A = 1 , _A = 0.0 , _A =...
77
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging UpperCAmelCase : Dic...
77
1
import os import time from dataclasses import dataclass, field from enum import Enum from typing import Dict, List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...models.auto.modeling_auto import MODEL_FOR_QUESTION_ANSWERING_MAPPING from ...tokenization_u...
77
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor UpperCAmelCase : List[Any] = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" def __init__( self , *_A , **_A ): ...
77
1
import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel UpperCAmelCase : str = HfApi() UpperCAmelCase : List[str] = {} # fmt: off UpperCAmelCase : Optional[Any] = torch.tensor([ -0.7515, -1.6883, 0.2420, 0.0300, 0.6347, 1...
77
import glob import os import random from string import ascii_lowercase, digits import cva UpperCAmelCase : Dict = '''''' UpperCAmelCase : Union[str, Any] = '''''' UpperCAmelCase : Optional[int] = '''''' UpperCAmelCase : Union[str, Any] = 1 # (0 is vert...
77
1
from ...configuration_utils import PretrainedConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices UpperCAmelCase : List[Any] = logging.get_logger(__name__) class _A( snake_case__ , snake_case__...
77
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_common import ConfigTester fr...
77
1
import os from shutil import copyfile from typing import List, Optional, Tuple from tokenizers import processors from ...tokenization_utils import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepie...
77
import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel UpperCAmelCase : str = HfApi() UpperCAmelCase : List[str] = {} # fmt: off UpperCAmelCase : Optional[Any] = torch.tensor([ -0.7515, -1.6883, 0.2420, 0.0300, 0.6347, 1...
77
1
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
77
import numpy as np from PIL import Image def _SCREAMING_SNAKE_CASE ( a , a , a ) -> np.ndarray: __A : Union[str, Any] = np.array(a ) if arr.shape[0] != arr.shape[1]: raise ValueError('The input array is not a square matrix' ...
77
1
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase : int = { '''configuration_time_series_transformer''': [ '''TIME_SERIES_TRANSFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''TimeSeriesTransformerC...
77
from __future__ import annotations from collections.abc import Callable def _SCREAMING_SNAKE_CASE ( a , a , a , a = 1_00 , ) -> float: __A : Any = x_start __A : List[str] = fnc(a ) __A : Optional[Any] ...
77
1
import glob import os import random from string import ascii_lowercase, digits import cva UpperCAmelCase : Dict = '''''' UpperCAmelCase : Union[str, Any] = '''''' UpperCAmelCase : Optional[int] = '''''' UpperCAmelCase : Union[str, Any] = 1 # (0 is vert...
77
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def _SCREAMING_SNAKE_CASE ( ) -> None: print('Making key files...' ) make_key_files('rsa' , 10_24 ) print(...
77
1
import shutil import tempfile import unittest from transformers import SPIECE_UNDERLINE, BatchEncoding, MBartTokenizer, MBartTokenizerFast, is_torch_available from transformers.testing_utils import ( get_tests_dir, nested_simplify, require_sentencepiece, require_tokenizers, require_torch, ) ...
77
import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet import VOCAB_FILES_NAMES, P...
77
1
def _SCREAMING_SNAKE_CASE ( a , a ) -> int: return number | (1 << position) def _SCREAMING_SNAKE_CASE ( a , a ) -> int: return number & ~(1 << position) def _SCREAMING_SNAKE_CASE ( a , a ) -> int: r...
77
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 : List[str] = logging.get_logger(__name__) UpperCAmelC...
77
1
import argparse import json import os from pathlib import Path import requests import torch from transformers import JukeboxConfig, JukeboxModel from transformers.utils import logging logging.set_verbosity_info() UpperCAmelCase : Tuple = logging.get_logger(__name__) UpperCAmelCase : List...
77
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class _A( unittest.TestCase ): """simple docstring""" def UpperCAmelCase_ ( self ): debug_launcher(test_script.main ) de...
77
1
import argparse import torch from torch import nn from transformers import MaMaaaConfig, MaMaaaForConditionalGeneration def _SCREAMING_SNAKE_CASE ( a ) -> List[str]: __A : Tuple = [ 'encoder.version', 'decoder.version', 'model.encod...
77
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
77
1
# This code is adapted from OpenAI's release # https://github.com/openai/human-eval/blob/master/human_eval/execution.py import contextlib import faulthandler import io import multiprocessing import os import platform import signal import tempfile def _SCREAMING_SNAKE_CASE ( a , a ...
77
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, loggi...
77
1
from __future__ import annotations def _SCREAMING_SNAKE_CASE ( a , a , a , a ) -> Optional[int]: # noqa: E741 while r - l > 1: __A : int = (l + r) // 2 if v[m] >= key: __A : str = m ...
77
from abc import ABC, abstractmethod from argparse import ArgumentParser class _A( snake_case__ ): """simple docstring""" @staticmethod @abstractmethod def UpperCAmelCase_ ( _A ): raise NotImplementedError() @abstractmethod def UpperCAmelCas...
77
1
from __future__ import annotations from collections.abc import Callable def _SCREAMING_SNAKE_CASE ( a , a , a , a = 1_00 , ) -> float: __A : Any = x_start __A : List[str] = fnc(a ) __A : Optional[Any] ...
77
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase : Optional[int] = {'''configuration_unispeech''': ['''UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''U...
77
1
import argparse import os from . import ( ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, BART_PRETRAINED_MODEL_ARCHIVE_LIST, BERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CAMEMBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, CTRL_PRETRAINED_CONFIG_ARCHIVE_MAP, DISTILBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, DPR_CONTEXT_EN...
77
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import load_numpy, ...
77
1
import unittest from transformers.testing_utils import require_bsa from transformers.utils import is_bsa_available from ...test_feature_extraction_common import FeatureExtractionSavingTestMixin if is_bsa_available(): from transformers import MarkupLMFeatureExtractor class _A( unittest.TestCase...
77
from __future__ import annotations import math def _SCREAMING_SNAKE_CASE ( a , a ) -> list: if len(a ) != 2 or len(a[0] ) != 2 or len(a ) != 2 or len(b[0] ) != 2: raise Exception('Matrices are not 2x2' ) __A : Optional[int] ...
77
1
import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_camembert i...
77
def _SCREAMING_SNAKE_CASE ( a ) -> int: __A : List[str] = [] __A : Tuple = [] __A : Union[str, Any] = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, '-': 1, } # Priori...
77
1
import logging import os import sys import warnings from dataclasses import dataclass, field from random import randint from typing import Optional import datasets import evaluate import numpy as np from datasets import DatasetDict, load_dataset import transformers from transformers import ( AutoConfig, ...
77
import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase : Tuple = { '''facebook/mask2former-swin-small-coco-instance''': ( '''https://huggingface.co/facebook/...
77
1
import sys def _SCREAMING_SNAKE_CASE ( a ) -> Dict: __A : List[Any] = len(a ) __A : int = [[0 for x in range(a )] for x in range(a )] __A : Any = [[0 for x in range(a )] for x in range(a )] ...
77
import copy 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 ..auto import CONFIG_MAPPING UpperCAmelCase : List[str] = logging.get_log...
77
1
import math def _SCREAMING_SNAKE_CASE ( a = 1_00 ) -> int: __A : Union[str, Any] = sum(i * i for i in range(1 , n + 1 ) ) __A : Optional[int] = int(math.pow(sum(range(1 , n + 1 ) ) , 2 ) ) ...
77
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class _A( nn.Module ): ...
77
1
import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from requests.exceptions import HTTPError from transformers import AutoImageProcessor, ViTImageProcessor from transformers.testing_utils import TOKEN, USER, get_test...
77
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
77
1
from __future__ import annotations UpperCAmelCase : int = [] def _SCREAMING_SNAKE_CASE ( a , a , a ) -> bool: for i in range(len(a ) ): if board[row][i] == 1: return False for i in range(len(a ) ): ...
77
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging UpperCAmelCase : Dic...
77
1
import gc import random import unittest import numpy as np import torch from PIL import Image from diffusers import ( DDIMScheduler, KandinskyVaaInpaintPipeline, KandinskyVaaPriorPipeline, UNetaDConditionModel, VQModel, ) from diffusers.utils import floats_tensor, load_image, load_numpy, slo...
77
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor UpperCAmelCase : List[Any] = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" def __init__( self , *_A , **_A ): ...
77
1
import inspect import os import unittest from pathlib import Path import torch import accelerate from accelerate.test_utils import execute_subprocess_async from accelerate.test_utils.testing import run_command class _A( unittest.TestCase ): """simple docstring""" UpperCamelCase :...
77
import glob import os import random from string import ascii_lowercase, digits import cva UpperCAmelCase : Dict = '''''' UpperCAmelCase : Union[str, Any] = '''''' UpperCAmelCase : Optional[int] = '''''' UpperCAmelCase : Union[str, Any] = 1 # (0 is vert...
77
1
import argparse from transformers import ( TapasConfig, TapasForMaskedLM, TapasForQuestionAnswering, TapasForSequenceClassification, TapasModel, TapasTokenizer, load_tf_weights_in_tapas, ) from transformers.utils import logging logging.set_verbosity_info() def _SCREAMING_...
77
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_common import ConfigTester fr...
77
1
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 OptionalDependencyNotAvailable: from ...
77
import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel UpperCAmelCase : str = HfApi() UpperCAmelCase : List[str] = {} # fmt: off UpperCAmelCase : Optional[Any] = torch.tensor([ -0.7515, -1.6883, 0.2420, 0.0300, 0.6347, 1...
77
1
import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_convbert import ConvBertTokenizer UpperCAmelCase : List[str] = logging.get_logger(__name__) Upp...
77
import numpy as np from PIL import Image def _SCREAMING_SNAKE_CASE ( a , a , a ) -> np.ndarray: __A : Union[str, Any] = np.array(a ) if arr.shape[0] != arr.shape[1]: raise ValueError('The input array is not a square matrix' ...
77
1
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 : List[str] = logging.get_logger(__name__) UpperCAmelC...
77
from __future__ import annotations from collections.abc import Callable def _SCREAMING_SNAKE_CASE ( a , a , a , a = 1_00 , ) -> float: __A : Any = x_start __A : List[str] = fnc(a ) __A : Optional[Any] ...
77
1
import unittest import numpy as np from transformers import is_flax_available from transformers.testing_utils import require_flax from ..test_modeling_flax_common import ids_tensor if is_flax_available(): import jax import jax.numpy as jnp from transformers.generation import ( FlaxForced...
77
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def _SCREAMING_SNAKE_CASE ( ) -> None: print('Making key files...' ) make_key_files('rsa' , 10_24 ) print(...
77
1
UpperCAmelCase : List[Any] = 0 # The first color of the flag. UpperCAmelCase : str = 1 # The second color of the flag. UpperCAmelCase : List[Any] = 2 # The third color of the flag. UpperCAmelCase : Optional[Any] = (red, white, blue) def _SC...
77
import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet import VOCAB_FILES_NAMES, P...
77
1
from __future__ import annotations import os import tempfile import unittest import numpy as np from huggingface_hub import hf_hub_download from transformers import is_tensorflow_text_available, is_tf_available from transformers.testing_utils import require_tensorflow_text, require_tf, slow from ..test_modeli...
77
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 : List[str] = logging.get_logger(__name__) UpperCAmelC...
77
1
import heapq as hq import math from collections.abc import Iterator class _A: """simple docstring""" def __init__( self , _A ): __A : Tuple = str(id_ ) __A : Optional[int] = None __A : List[str] = None ...
77
import unittest from accelerate import debug_launcher from accelerate.test_utils import require_cpu, test_ops, test_script @require_cpu class _A( unittest.TestCase ): """simple docstring""" def UpperCAmelCase_ ( self ): debug_launcher(test_script.main ) de...
77
1
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import load_numpy, ...
77
import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision from transformers.utils im...
77
1
import os from datetime import datetime as dt from github import Github UpperCAmelCase : List[Any] = [ '''good first issue''', '''good second issue''', '''good difficult issue''', '''enhancement''', '''new pipeline/model''', '''new scheduler''', '''wip''', ] de...
77
import argparse import json import os import fairseq import torch from fairseq.data import Dictionary from transformers import ( WavaVecaConformerConfig, WavaVecaConformerForCTC, WavaVecaConformerForPreTraining, WavaVecaCTCTokenizer, WavaVecaFeatureExtractor, WavaVecaProcessor, loggi...
77
1
import itertools import json import linecache import os import pickle import re import socket import string from collections import Counter from logging import getLogger from pathlib import Path from typing import Callable, Dict, Iterable, List import git import torch from torch.utils.data import Dataset from t...
77
from abc import ABC, abstractmethod from argparse import ArgumentParser class _A( snake_case__ ): """simple docstring""" @staticmethod @abstractmethod def UpperCAmelCase_ ( _A ): raise NotImplementedError() @abstractmethod def UpperCAmelCas...
77
1
from dataclasses import dataclass from typing import Dict, Optional, Union import torch import torch.nn.functional as F from torch import nn from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput from .attention import BasicTransformerBlock from .attention_processor imp...
77
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase : Optional[int] = {'''configuration_unispeech''': ['''UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''U...
77
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) UpperCAmelCase : Optional[int] = {'''configuration_unispeech''': ['''UNISPEECH_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''U...
77
import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModelWithProjection, CLIPTokenizer from diffusers import HeunDiscreteScheduler, PriorTransformer, ShapEPipeline from diffusers.pipelines.shap_e import ShapERenderer from diffusers.utils import load_numpy, ...
77
1
def _SCREAMING_SNAKE_CASE ( a ) -> bool: if p < 2: raise ValueError('p should not be less than 2!' ) elif p == 2: return True __A : List[Any] = 4 __A : Any = (1 << p) - 1 for _ in range(p - 2 ): ...
77
from __future__ import annotations import math def _SCREAMING_SNAKE_CASE ( a , a ) -> list: if len(a ) != 2 or len(a[0] ) != 2 or len(a ) != 2 or len(b[0] ) != 2: raise Exception('Matrices are not 2x2' ) __A : Optional[int] ...
77
1
def _SCREAMING_SNAKE_CASE ( a ) -> list: __A : Union[str, Any] = len(a ) for _ in range(a ): for i in range(_ % 2 , arr_size - 1 , 2 ): if arr[i + 1] < arr[i]: __A , __A : Tuple ...
77
def _SCREAMING_SNAKE_CASE ( a ) -> int: __A : List[str] = [] __A : Tuple = [] __A : Union[str, Any] = { '^': 3, '*': 2, '/': 2, '%': 2, '+': 1, '-': 1, } # Priori...
77
1
from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. UpperCAmelCase : str = 2_00 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst of that generation an...
77
import copy from typing import Dict, List, Optional from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING UpperCAmelCase : Tuple = { '''facebook/mask2former-swin-small-coco-instance''': ( '''https://huggingface.co/facebook/...
77
1
from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance UpperCAmelCase : Any = 6378137.0 UpperCAmelCase : str = 6356752.314245 UpperCAmelCase : Tuple = 6_37_81_37 def _SCREAMING_SNAKE_CASE ( a , a ...
77
import copy 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 ..auto import CONFIG_MAPPING UpperCAmelCase : List[str] = logging.get_log...
77
1
from __future__ import annotations UpperCAmelCase : int = list[list[int]] # assigning initial values to the grid UpperCAmelCase : Matrix = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0...
77
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class _A( nn.Module ): ...
77
1
import numpy as np from PIL import Image def _SCREAMING_SNAKE_CASE ( a , a , a ) -> np.ndarray: __A : Union[str, Any] = np.array(a ) if arr.shape[0] != arr.shape[1]: raise ValueError('The input array is not a square matrix' ...
77
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
77
1
# Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
77
from collections import OrderedDict from typing import Any, List, Mapping, Optional from ... import PreTrainedTokenizer, TensorType, is_torch_available from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfigWithPast, PatchingSpec from ...utils import logging UpperCAmelCase : Dic...
77
1
import os import unittest from tempfile import TemporaryDirectory import torch import torch.nn as nn from accelerate.utils import ( OffloadedWeightsLoader, extract_submodules_state_dict, load_offloaded_weight, offload_state_dict, offload_weight, ) class _A( nn.Module ): ...
77
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor UpperCAmelCase : List[Any] = logging.get_logger(__name__) class _A( snake_case__ ): """simple docstring""" def __init__( self , *_A , **_A ): ...
77
1
from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase : Union[str, Any] = logging.get_logger(__name__) UpperCAmelCase : List[Any] = { '''tanreinama/GPTSAN-2.8B-spout_is_uniform''': ( '''https://huggingface.co/tanreinama/GPTSAN-...
77
import glob import os import random from string import ascii_lowercase, digits import cva UpperCAmelCase : Dict = '''''' UpperCAmelCase : Union[str, Any] = '''''' UpperCAmelCase : Optional[int] = '''''' UpperCAmelCase : Union[str, Any] = 1 # (0 is vert...
77
1
from .imports import is_rich_available if is_rich_available(): from rich.traceback import install install(show_locals=False) else: raise ModuleNotFoundError('''To use the rich extension, install rich with `pip install rich`''')
77
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_common import ConfigTester fr...
77
1
import inspect import unittest from transformers import MobileViTVaConfig from transformers.testing_utils import require_torch, require_torch_multi_gpu, require_vision, slow, torch_device from transformers.utils import cached_property, is_torch_available, is_vision_available from ...test_configuration_common im...
77
import random import torch from huggingface_hub import HfApi from diffusers import UNetaDModel UpperCAmelCase : str = HfApi() UpperCAmelCase : List[str] = {} # fmt: off UpperCAmelCase : Optional[Any] = torch.tensor([ -0.7515, -1.6883, 0.2420, 0.0300, 0.6347, 1...
77
1
def _SCREAMING_SNAKE_CASE ( a ) -> float: __A : str = 0 while len(a ) > 1: __A : Optional[Any] = 0 # Consider two files with minimum cost to be merged for _ in range(2 ): __A : List[str] ...
77
import numpy as np from PIL import Image def _SCREAMING_SNAKE_CASE ( a , a , a ) -> np.ndarray: __A : Union[str, Any] = np.array(a ) if arr.shape[0] != arr.shape[1]: raise ValueError('The input array is not a square matrix' ...
77
1
def _SCREAMING_SNAKE_CASE ( a , a ) -> str: __A : list[list[str]] = [[] for _ in range(a )] __A : Optional[Any] = key - 1 if key <= 0: raise ValueError('Height of grid can\'t be 0 or negative' ) if key == 1 o...
77
from __future__ import annotations from collections.abc import Callable def _SCREAMING_SNAKE_CASE ( a , a , a , a = 1_00 , ) -> float: __A : Any = x_start __A : List[str] = fnc(a ) __A : Optional[Any] ...
77
1
from __future__ import annotations import math def _SCREAMING_SNAKE_CASE ( a , a ) -> list: if len(a ) != 2 or len(a[0] ) != 2 or len(a ) != 2 or len(b[0] ) != 2: raise Exception('Matrices are not 2x2' ) __A : Optional[int] ...
77
import os import random import sys from . import cryptomath_module as cryptoMath # noqa: N812 from . import rabin_miller as rabinMiller # noqa: N812 def _SCREAMING_SNAKE_CASE ( ) -> None: print('Making key files...' ) make_key_files('rsa' , 10_24 ) print(...
77
1
from typing import TYPE_CHECKING from ....utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available UpperCAmelCase : Tuple = {'''configuration_mmbt''': ['''MMBTConfig''']} try: if not is_torch_available(): raise OptionalDependencyNotAvailable() except OptionalDepe...
77
import os import unittest from transformers import BatchEncoding from transformers.models.bert.tokenization_bert import ( BasicTokenizer, WordpieceTokenizer, _is_control, _is_punctuation, _is_whitespace, ) from transformers.models.prophetnet.tokenization_prophetnet import VOCAB_FILES_NAMES, P...
77
1
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) UpperCAmelCase : Union[str, Any] = { '''configuration_owlvi...
77
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 : List[str] = logging.get_logger(__name__) UpperCAmelC...
77
1