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
def _lowerCAmelCase ( __magic_name__ :Tuple , __magic_name__ :Any ): UpperCAmelCase_ = 0 while b > 0: if b & 1: res += a a += a b >>= 1 return res def _lowerCAmelCase ( __magic_nam...
121
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :int ): UpperCAmelCase_ = [True] * limit UpperCAmelCase_ = False UpperCAmelCase_ = False UpperCAmelCase_ = True for i in range(3 , int(limit**0.5 + 1 ) ...
121
1
import argparse import os from pathlib import Path from typing import Dict import tensorflow as tf import torch from tqdm import tqdm from transformers import PegasusConfig, PegasusForConditionalGeneration, PegasusTokenizer from transformers.models.pegasus.configuration_pegasus import DEFAULTS, ...
121
import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) _lowerCamelCase : str = logging.getLogger(__name__) if __name__ ==...
121
1
import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) _lowerCamelCase : str = logging.getLogger(__name__) if __name__ ==...
121
import os from math import logaa def _lowerCAmelCase ( __magic_name__ :str = "base_exp.txt" ): UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) )...
121
1
from typing import Optional, Tuple, Union import flax import flax.linen as nn import jax import jax.numpy as jnp from flax.core.frozen_dict import FrozenDict from ..configuration_utils import ConfigMixin, flax_register_to_config from ..utils import BaseOutput from .embeddings_flax import FlaxTim...
121
import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap _lowerCamelCase : Any = 'Usage of script: script_name <size_of_canvas:int>' _lowerCamelCase : Dict = [0] * 100 + [1] * 10 random.shuffle(choice...
121
1
from typing import TYPE_CHECKING from ...utils import _LazyModule _lowerCamelCase : Optional[Any] = {'tokenization_bertweet': ['BertweetTokenizer']} if TYPE_CHECKING: from .tokenization_bertweet import BertweetTokenizer else: import sys _lowerCamelCase :...
121
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :list[int | str] ): create_state_space_tree(__magic_name__ , [] , 0 , [0 for i in range(len(__magic_name__ ) )] ) def _lowerCAmelCase ( ...
121
1
from __future__ import annotations _lowerCamelCase : str = [-10, -5, 0, 5, 5.1, 11, 13, 21, 3, 4, -21, -10, -5, -1, 0] _lowerCamelCase : Dict = [-5, 0, 5, 5.1, 11, 13, 21, -1, 4, -1, -10, -5, -1, 0, -1] def _lowerCAmelCase ( __magic_name__ :list[float...
121
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switchi...
121
1
from math import sqrt def _lowerCAmelCase ( __magic_name__ :int ): 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...
121
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration _lowerCamelCase : Union[str, Any] = { 'tiny.en': 'https://openaipublic.azu...
121
1
import logging import os import sys from dataclasses import dataclass, field from typing import Optional import numpy as np import torch from datasets import load_dataset from torchvision.transforms import Compose, Lambda, Normalize, RandomHorizontalFlip, RandomResizedCrop, ToTensor import tran...
121
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( __magic_name__ :Union[str, Any] , __magic_na...
121
1
import 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 ( MobileViTConfig, MobileViTForImageClassification, MobileViTForSemanticSegmentation, MobileViTImageProc...
121
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase : Dict = { 'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'], } try: ...
121
1
import os import shutil import tempfile from unittest import TestCase from unittest.mock import patch import numpy as np from datasets import Dataset from transformers.models.realm.configuration_realm import RealmConfig from transformers.models.realm.retrieval_realm import _REALM_BLOCK_RECORDS_F...
121
_lowerCamelCase : dict[tuple[int, int, int], int] = {} def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int , __magic_name__ :int ): # if we are absent twice, or late 3 consecutive days, # no further prize strings are possib...
121
1
from math import sqrt def _lowerCAmelCase ( __magic_name__ :int ): assert isinstance(__magic_name__ , __magic_name__ ) and ( number >= 0 ), "'number' must been an int and positive" UpperCAmelCase_ = True # 0 and 1 are none p...
121
import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.auto.modeli...
121
1
_lowerCamelCase : str = 'Tobias Carryer' from time import time class snake_case__ : '''simple docstring''' def __init__( self : Tuple , lowerCAmelCase_ : int , lowerCAmelCase_ : Any , lowerCAmelCase_...
121
import argparse import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Acceler...
121
1
def _lowerCAmelCase ( __magic_name__ :list ): if any(not isinstance(__magic_name__ , __magic_name__ ) or x < 0 for x in sequence ): raise TypeError('''Sequence must be list of non-negative integers''' ) for _ in range(len(__magic_name__ ...
121
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _lowerCamelCase : Optional[Any] = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_AR...
121
1
def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :float , __magic_name__ :float ): return round(float(moles / volume ) * nfactor ) def _lowerCAmelCase ( __magic_name__ :float , __magic_name__ :float , __mag...
121
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import ena...
121
1
import platform from argparse import ArgumentParser import huggingface_hub from .. import __version__ as version from ..utils import is_accelerate_available, is_torch_available, is_transformers_available, is_xformers_available from . import BaseDiffusersCLICommand def _lowerCAmelCa...
121
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space...
121
1
import math def _lowerCAmelCase ( __magic_name__ :int ): UpperCAmelCase_ = [] UpperCAmelCase_ = 2 UpperCAmelCase_ = int(math.sqrt(__magic_name__ ) ) # Size of every segment UpperCAmelCase_ = [True] * (end + 1) UpperCAmelCase_ ...
121
def _lowerCAmelCase ( __magic_name__ :list ): if any(not isinstance(__magic_name__ , __magic_name__ ) or x < 0 for x in sequence ): raise TypeError('''Sequence must be list of non-negative integers''' ) for _ in range(len(__magic_name__ ...
121
1
def _lowerCAmelCase ( __magic_name__ :str ): UpperCAmelCase_ = '''''' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def _lowerCAmelCase ( __magic_name_...
121
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def _lowerCAmelCase ( __magic_name__ :Optional[Any] ): UpperCAmelCase_ = os.path.join(args.tf_model_dir , '''parameters.jso...
121
1
import argparse from transformers import TaConfig, TaForConditionalGeneration, load_tf_weights_in_ta from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( __magic_name__ :str , __magic_name__ :Dict , __magic_name__ :Union[...
121
def _lowerCAmelCase ( __magic_name__ :list[list[int]] , __magic_name__ :int , __magic_name__ :int , __magic_name__ :set ): UpperCAmelCase_, UpperCAmelCase_ = len(__magic_name__ ), len(grid[0] ) if ( min(__magic_name__ , __ma...
121
1
def _lowerCAmelCase ( __magic_name__ :int ): return sum(i for i in range(1 , number // 2 + 1 ) if number % i == 0 ) == number if __name__ == "__main__": print('Program to check whether a number is a Perfect number or not...') _lowerCamelCase ...
121
import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask _lowerCamelCase : List[Any] = logging.getLogger(__name__) class snake_case__ ( __snake_case ): ...
121
1
from __future__ import annotations import math import random from collections.abc import Collection from typing import overload class snake_case__ : '''simple docstring''' def __init__( self : Optional[int] , lowerCAmelCase_ : C...
121
def _lowerCAmelCase ( __magic_name__ :str ): UpperCAmelCase_ = '''''' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def _lowerCAmelCase ( __magic_name_...
121
1
from __future__ import annotations import random # Maximum size of the population. Bigger could be faster but is more memory expensive. _lowerCamelCase : List[str] = 200 # Number of elements selected in every generation of evolution. The selection takes # place from best to worst of t...
121
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : str = { 'configuration_jukebox': [ 'JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP', 'JukeboxConfig', 'JukeboxPriorConfig', ...
121
1
from collections import OrderedDict from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging _lowerCamelCase : str = logging.get_logger(__name__) _lowerCamelCase : Optional[Any] = { ...
121
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class snake_case__ : '''simple docstring''' __A = 42 __A = None __A = None _lowerCamelCas...
121
1
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...
121
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :int ): UpperCAmelCase_ = [True] * limit UpperCAmelCase_ = False UpperCAmelCase_ = False UpperCAmelCase_ = True for i in range(3 , int(limit**0.5 + 1 ) ...
121
1
import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask _lowerCamelCase : List[Any] = logging.getLogger(__name__) class snake_case__ ( __snake_case ): ...
121
import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) _lowerCamelCase : str = logging.getLogger(__name__) if __name__ ==...
121
1
import inspect import re from hashlib import shaaaa from typing import Dict, List from .arrow import arrow from .audiofolder import audiofolder from .csv import csv from .imagefolder import imagefolder from .json import json from .pandas import pandas from .parquet import parquet from .sql impo...
121
import os from math import logaa def _lowerCAmelCase ( __magic_name__ :str = "base_exp.txt" ): UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) )...
121
1
import 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 ...
121
import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap _lowerCamelCase : Any = 'Usage of script: script_name <size_of_canvas:int>' _lowerCamelCase : Dict = [0] * 100 + [1] * 10 random.shuffle(choice...
121
1
from ...configuration_utils import PretrainedConfig from ...utils import logging _lowerCamelCase : Any = logging.get_logger(__name__) _lowerCamelCase : Any = { 'google/switch-base-8': 'https://huggingface.co/google/switch-base-8/blob/main/config.json', } class ...
121
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :list[int | str] ): create_state_space_tree(__magic_name__ , [] , 0 , [0 for i in range(len(__magic_name__ ) )] ) def _lowerCAmelCase ( ...
121
1
from collections import deque class snake_case__ : '''simple docstring''' def __init__( self : int , lowerCAmelCase_ : str , lowerCAmelCase_ : int , lowerCAmelCase_ : int ) -> None: Uppe...
121
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switchi...
121
1
def _lowerCAmelCase ( __magic_name__ :str ): UpperCAmelCase_ = len(__magic_name__ ) while cur > 1: # Find the maximum number in arr UpperCAmelCase_ = arr.index(max(arr[0:cur] ) ) # Reverse from 0 to mi UpperCAmel...
121
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration _lowerCamelCase : Union[str, Any] = { 'tiny.en': 'https://openaipublic.azu...
121
1
_lowerCamelCase : dict[tuple[int, int, int], int] = {} def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int , __magic_name__ :int ): # if we are absent twice, or late 3 consecutive days, # no further prize strings are possib...
121
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( __magic_name__ :Union[str, Any] , __magic_na...
121
1
import unittest from transformers import AlbertConfig, is_torch_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMix...
121
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase : Dict = { 'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'], } try: ...
121
1
import unittest from transformers import DebertaConfig, 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, i...
121
_lowerCamelCase : dict[tuple[int, int, int], int] = {} def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int , __magic_name__ :int ): # if we are absent twice, or late 3 consecutive days, # no further prize strings are possib...
121
1
_lowerCamelCase : str = {0: [2, 3], 1: [0], 2: [1], 3: [4], 4: []} _lowerCamelCase : Union[str, Any] = {0: [1, 2, 3], 1: [2], 2: [0], 3: [4], 4: [5], 5: [3]} def _lowerCAmelCase ( __magic_name__ :dict[int, list[int]] , __magic_name__ :int , ...
121
import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.auto.modeli...
121
1
import doctest import glob import importlib import inspect import os import re from contextlib import contextmanager from functools import wraps from unittest.mock import patch import numpy as np import pytest from absl.testing import parameterized import datasets from datasets import load_...
121
import argparse import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Acceler...
121
1
from ..utils import DummyObject, requires_backends class snake_case__ ( metaclass=__snake_case ): '''simple docstring''' __A = ['''onnx'''] def __init__( self : int , *lowerCAmelCase_ : List[str] , *...
121
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _lowerCamelCase : Optional[Any] = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_AR...
121
1
import warnings from ...utils import logging from .image_processing_layoutlmva import LayoutLMvaImageProcessor _lowerCamelCase : Tuple = logging.get_logger(__name__) class snake_case__ ( __snake_case ): '''simple docstring''' def _...
121
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import ena...
121
1
# Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless r...
121
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space...
121
1
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :list[int | str] ): create_state_space_tree(__magic_name__ , [] , 0 , [0 for i in range(len(__magic_name__ ) )] ) def _lowerCAmelCase ( ...
121
def _lowerCAmelCase ( __magic_name__ :list ): if any(not isinstance(__magic_name__ , __magic_name__ ) or x < 0 for x in sequence ): raise TypeError('''Sequence must be list of non-negative integers''' ) for _ in range(len(__magic_name__ ...
121
1
def _lowerCAmelCase ( __magic_name__ :str , __magic_name__ :str ): UpperCAmelCase_ = len(__magic_name__ ) UpperCAmelCase_ = len(__magic_name__ ) UpperCAmelCase_ = ( first_str_length if first_str_length > second_str_length else second_st...
121
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def _lowerCAmelCase ( __magic_name__ :Optional[Any] ): UpperCAmelCase_ = os.path.join(args.tf_model_dir , '''parameters.jso...
121
1
from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): from PIL import Image ...
121
def _lowerCAmelCase ( __magic_name__ :list[list[int]] , __magic_name__ :int , __magic_name__ :int , __magic_name__ :set ): UpperCAmelCase_, UpperCAmelCase_ = len(__magic_name__ ), len(grid[0] ) if ( min(__magic_name__ , __ma...
121
1
from math import sqrt def _lowerCAmelCase ( __magic_name__ :int = 1_0_0_0_0_0_0 ): UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 UpperCAmelCase_ = 42 while num_cuboids <= limit: max_cuboid_size += 1 for sum_shortest_sides in ran...
121
import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask _lowerCamelCase : List[Any] = logging.getLogger(__name__) class snake_case__ ( __snake_case ): ...
121
1
def _lowerCAmelCase ( __magic_name__ :str , __magic_name__ :str ): UpperCAmelCase_ = len(__magic_name__ ) UpperCAmelCase_ = [] for i in range(len(__magic_name__ ) - pat_len + 1 ): UpperCAmelCase_ = True for j in range(_...
121
def _lowerCAmelCase ( __magic_name__ :str ): UpperCAmelCase_ = '''''' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def _lowerCAmelCase ( __magic_name_...
121
1
import argparse import json import gdown import numpy as np import torch from huggingface_hub import hf_hub_download from transformers import ( VideoMAEConfig, VideoMAEForPreTraining, VideoMAEForVideoClassification, VideoMAEImageProcessor, ) def _lowerCAmelCas...
121
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : str = { 'configuration_jukebox': [ 'JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP', 'JukeboxConfig', 'JukeboxPriorConfig', ...
121
1
from math import factorial def _lowerCAmelCase ( __magic_name__ :int = 1_0_0 ): return sum(map(__magic_name__ , str(factorial(__magic_name__ ) ) ) ) if __name__ == "__main__": print(solution(int(input('Enter the Number: ').strip()))...
121
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class snake_case__ : '''simple docstring''' __A = 42 __A = None __A = None _lowerCamelCas...
121
1
import copy import os from collections import OrderedDict from typing import TYPE_CHECKING, Any, Dict, Mapping, Optional, Union if TYPE_CHECKING: from ...processing_utils import ProcessorMixin from ...utils import TensorType from ...configuration_utils import PretrainedConfig from .....
121
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :int ): UpperCAmelCase_ = [True] * limit UpperCAmelCase_ = False UpperCAmelCase_ = False UpperCAmelCase_ = True for i in range(3 , int(limit**0.5 + 1 ) ...
121
1
import argparse import collections import numpy as np import torch from flax import traverse_util from tax import checkpoints from transformers import MTaConfig, UMTaEncoderModel, UMTaForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() def ...
121
import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) _lowerCamelCase : str = logging.getLogger(__name__) if __name__ ==...
121
1
import math import time from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput, speed_metrics if is_torch_tpu_available(check_device=False): import torch_xla.core.xla_model as xm import torch_xla.debug.metrics as met class ...
121
import os from math import logaa def _lowerCAmelCase ( __magic_name__ :str = "base_exp.txt" ): UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) )...
121
1
import fire from utils import calculate_rouge, save_json def _lowerCAmelCase ( __magic_name__ :List[str] , __magic_name__ :int , __magic_name__ :Any=None , **__magic_name__ :Any ): UpperCAmelCase_ = [x.strip() for x in open(__magic_name__ ...
121
import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap _lowerCamelCase : Any = 'Usage of script: script_name <size_of_canvas:int>' _lowerCamelCase : Dict = [0] * 100 + [1] * 10 random.shuffle(choice...
121
1
import logging import sys from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import librosa import torch from datasets import DatasetDict, load_dataset from packaging import version from torch import nn from transformers import ( HfArgumentParser, ...
121
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :list[int | str] ): create_state_space_tree(__magic_name__ , [] , 0 , [0 for i in range(len(__magic_name__ ) )] ) def _lowerCAmelCase ( ...
121
1
from collections import UserDict from typing import List, Union from ..utils import ( add_end_docstrings, is_tf_available, is_torch_available, is_vision_available, logging, requires_backends, ) from .base import PIPELINE_INIT_ARGS, Pipeline if is_vision_available(): ...
121
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switchi...
121
1
import os def _lowerCAmelCase ( __magic_name__ :str = "input.txt" ): with open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) ) as input_file: UpperCAmelCase_ = [ [int(__magic_name__ ) for elemen...
121
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration _lowerCamelCase : Union[str, Any] = { 'tiny.en': 'https://openaipublic.azu...
121
1
from __future__ import annotations import inspect import unittest from transformers import ViTConfig from transformers.testing_utils import require_tf, require_vision, slow from transformers.utils import cached_property, is_tf_available, is_vision_available from ...test_configuration_common impo...
121
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( __magic_name__ :Union[str, Any] , __magic_na...
121
1
import 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_utils import...
121
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase : Dict = { 'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'], } try: ...
121
1
from .glue import GlueDataset, GlueDataTrainingArguments from .language_modeling import ( LineByLineTextDataset, LineByLineWithRefDataset, LineByLineWithSOPTextDataset, TextDataset, TextDatasetForNextSentencePrediction, ) from .squad import SquadDataset, SquadDataTrainingArgument...
121
_lowerCamelCase : dict[tuple[int, int, int], int] = {} def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int , __magic_name__ :int ): # if we are absent twice, or late 3 consecutive days, # no further prize strings are possib...
121
1
# This is the module that test_patching.py uses to test patch_submodule() import os # noqa: this is just for tests import os as renamed_os # noqa: this is just for tests from os import path # noqa: this is just for tests from os import path as renamed_path # noqa: this is just for tests from os.p...
121
import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.auto.modeli...
121
1
from typing import List, Optional, Union from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding, PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy from ...utils import TensorType class snake_case__ ( __snake_case ): ...
121
import argparse import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Acceler...
121
1
import unittest 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...
121
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _lowerCamelCase : Optional[Any] = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_AR...
121
1
import re import string import numpy as np import datasets _lowerCamelCase : Dict = '\nReturns the rate at which the input predicted strings exactly match their references, ignoring any strings input as part of the regexes_to_ignore list.\n' _lowerCamelCase : Tuple =...
121
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import ena...
121
1
# 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 # # Unl...
121
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space...
121
1
from collections import UserDict from typing import Union import numpy as np import requests from ..utils import ( add_end_docstrings, logging, ) from .audio_classification import ffmpeg_read from .base import PIPELINE_INIT_ARGS, Pipeline _lowerCamelCase : Dict = loggi...
121
def _lowerCAmelCase ( __magic_name__ :list ): if any(not isinstance(__magic_name__ , __magic_name__ ) or x < 0 for x in sequence ): raise TypeError('''Sequence must be list of non-negative integers''' ) for _ in range(len(__magic_name__ ...
121
1
import logging import os import quant_trainer import torch from torch.utils.data import DataLoader from transformers import Trainer, is_torch_tpu_available from transformers.trainer_utils import PredictionOutput SCREAMING_SNAKE_CASE__ : List[str] = logging.getLogger(__name__) if is_torch_tpu_avai...
0
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def _lowerCAmelCase ( __magic_name__ :Optional[Any] ): UpperCAmelCase_ = os.path.join(args.tf_model_dir , '''parameters.jso...
121
0
import argparse import os import re # All paths are set with the intent you should run this script from the root of the repo with the command # python utils/check_dummies.py __snake_case = '''src/diffusers''' # Matches is_xxx_available() __snake_case = re.compile(r'''is\_(...
1
def _lowerCAmelCase ( __magic_name__ :list[list[int]] , __magic_name__ :int , __magic_name__ :int , __magic_name__ :set ): UpperCAmelCase_, UpperCAmelCase_ = len(__magic_name__ ), len(grid[0] ) if ( min(__magic_name__ , __ma...
121
0
import functools import gc import inspect import torch from .imports import is_npu_available, is_xpu_available def SCREAMING_SNAKE_CASE_ ( *_snake_case :Optional[int] ) -> Optional[int]: if not isinstance(_snake_case , _snake_case ): _A = list(_snake_case ...
2
import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask _lowerCamelCase : List[Any] = logging.getLogger(__name__) class snake_case__ ( __snake_case ): ...
121
0
'''simple docstring''' from scipy.stats import pearsonr, spearmanr from sklearn.metrics import fa_score, matthews_corrcoef import datasets lowerCAmelCase : List[str] = '\\n@inproceedings{wang2019glue,\n title={{GLUE}: A Multi-Task Benchmark and Analysis Platform for Natural Language Unders...
3
def _lowerCAmelCase ( __magic_name__ :str ): UpperCAmelCase_ = '''''' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def _lowerCAmelCase ( __magic_name_...
121
0
"""simple docstring""" # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2....
4
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : str = { 'configuration_jukebox': [ 'JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP', 'JukeboxConfig', 'JukeboxPriorConfig', ...
121
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 # # U...
5
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class snake_case__ : '''simple docstring''' __A = 42 __A = None __A = None _lowerCamelCas...
121
0
_lowerCamelCase = {'a': ['c', 'b'], 'b': ['d', 'e'], 'c': [], 'd': [], 'e': []} _lowerCamelCase = ['a', 'b', 'c', 'd', 'e'] def SCREAMING_SNAKE_CASE__ ( UpperCamelCase__: str , UpperCamelCase__: Union[str, Any] , UpperCamelCase__: Optional[Any] ): ...
6
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :int ): UpperCAmelCase_ = [True] * limit UpperCAmelCase_ = False UpperCAmelCase_ = False UpperCAmelCase_ = True for i in range(3 , int(limit**0.5 + 1 ) ...
121
0
"""simple docstring""" import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers, processors from ...tokenization_utils_base import AddedToken, BatchEncoding from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokeniza...
7
import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) _lowerCamelCase : str = logging.getLogger(__name__) if __name__ ==...
121
0
'''simple docstring''' def _lowerCAmelCase ( __snake_case : int , __snake_case : list ) -> Union[str, Any]: _enforce_args(__snake_case , __snake_case ) if n == 0: return 0 __A : Any = float('-inf' ) for...
8
import os from math import logaa def _lowerCAmelCase ( __magic_name__ :str = "base_exp.txt" ): UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) )...
121
0
import sacrebleu as scb from packaging import version from sacrebleu import CHRF import datasets SCREAMING_SNAKE_CASE__ = '''\ @inproceedings{popovic-2015-chrf, title = "chr{F}: character n-gram {F}-score for automatic {MT} evaluation", author = "Popovi{\'c}, Maja", booktitle = "Proceedings of...
9
import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap _lowerCamelCase : Any = 'Usage of script: script_name <size_of_canvas:int>' _lowerCamelCase : Dict = [0] * 100 + [1] * 10 random.shuffle(choice...
121
0
from unittest import TestCase from datasets import Dataset from minhash_deduplication import deduplicate_dataset, make_duplicate_clusters def _snake_case ( ): _UpperCamelCase = { '''repo_name''': ['''test_repo1''', '''test_repo2''', '''test_repo3'''], '''path''': ['''test_1.py''...
10
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :list[int | str] ): create_state_space_tree(__magic_name__ , [] , 0 , [0 for i in range(len(__magic_name__ ) )] ) def _lowerCAmelCase ( ...
121
0
'''simple docstring''' import logging import os from typing import List, Tuple import numpy as np import psutil import torch import torch.distributed as dist from transformers import RagRetriever lowercase_ = logging.getLogger(__name__) class __A ( A ): '''simple docstring''' ...
11
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switchi...
121
0
import json from typing import TYPE_CHECKING, List, Optional, Tuple from tokenizers import pre_tokenizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging if TYPE_CHECKING: from transformers.pipelines.conversational import Conversation lowerCamelCase_...
12
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration _lowerCamelCase : Union[str, Any] = { 'tiny.en': 'https://openaipublic.azu...
121
0
'''simple docstring''' import unittest from transformers import ( MODEL_FOR_OBJECT_DETECTION_MAPPING, AutoFeatureExtractor, AutoModelForObjectDetection, ObjectDetectionPipeline, is_vision_available, pipeline, ) from transformers.testing_utils import ( is_pipeline_test, nested_simp...
13
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( __magic_name__ :Union[str, Any] , __magic_na...
121
0
import json import sys import tempfile import unittest from pathlib import Path import transformers from transformers import ( CONFIG_MAPPING, IMAGE_PROCESSOR_MAPPING, AutoConfig, AutoImageProcessor, CLIPConfig, CLIPImageProcessor, ) from transformers.testing_utils import DUM...
14
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase : Dict = { 'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'], } try: ...
121
0
import warnings from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401 warnings.warn( 'The `inpainting.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionInpaintPipeline` instead.' )
15
_lowerCamelCase : dict[tuple[int, int, int], int] = {} def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int , __magic_name__ :int ): # if we are absent twice, or late 3 consecutive days, # no further prize strings are possib...
121
0
from __future__ import annotations from math import pow, sqrt def __a ( A__ : float , A__ : float , A__ : float ): if (resistance, reactance, impedance).count(0 ) != 1: raise ValueError("One and only one argument must be 0" ) if resistance ...
16
import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.auto.modeli...
121
0
def __SCREAMING_SNAKE_CASE ( a__ : int ) -> list[int]: if num <= 0: raise ValueError("""Input must be a positive integer""" ) __A : Any = [True] * (num + 1) __A : Optional[int] = 2 while p * p <= num: if primes[p]: for i in range(p * p ,num + 1 ...
17
import argparse import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Acceler...
121
0
'''simple docstring''' from collections import defaultdict def __a(SCREAMING_SNAKE_CASE_ : str , SCREAMING_SNAKE_CASE_ : str ): '''simple docstring''' _lowerCAmelCase = first_str.lower().strip() _lowerCAmelCase = second_str.lower().str...
18
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available, is_vision_available, ) _lowerCamelCase : Optional[Any] = { 'configuration_mobilevit': ['MOBILEVIT_PRETRAINED_CONFIG_AR...
121
0
"""simple docstring""" def lowerCamelCase__ ( __snake_case, __snake_case ) -> int: """simple docstring""" return int(input_a == input_a == 0 ) def lowerCamelCase__ ( ) -> None: """simple docstring""" pr...
19
import gc import unittest import numpy as np import torch from diffusers import AutoencoderKL, DDIMScheduler, DiTPipeline, DPMSolverMultistepScheduler, TransformeraDModel from diffusers.utils import is_xformers_available, load_numpy, slow, torch_device from diffusers.utils.testing_utils import ena...
121
0
import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(lowercase__ ) , 'Tatoeba dir...
20
from .integrations import ( is_optuna_available, is_ray_available, is_sigopt_available, is_wandb_available, run_hp_search_optuna, run_hp_search_ray, run_hp_search_sigopt, run_hp_search_wandb, ) from .trainer_utils import ( HPSearchBackend, default_hp_space...
121
0
import unittest import numpy as np from transformers import RoFormerConfig, is_flax_available from transformers.testing_utils import require_flax, slow from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask if is_flax_available(): import jax.num...
21
def _lowerCAmelCase ( __magic_name__ :list ): if any(not isinstance(__magic_name__ , __magic_name__ ) or x < 0 for x in sequence ): raise TypeError('''Sequence must be list of non-negative integers''' ) for _ in range(len(__magic_name__ ...
121
0
'''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() excep...
22
import argparse import json import os from collections import OrderedDict import numpy as np import tensorflow as tf import torch def _lowerCAmelCase ( __magic_name__ :Optional[Any] ): UpperCAmelCase_ = os.path.join(args.tf_model_dir , '''parameters.jso...
121
0
import json import pathlib import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision, slow from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin, prepare_im...
23
def _lowerCAmelCase ( __magic_name__ :list[list[int]] , __magic_name__ :int , __magic_name__ :int , __magic_name__ :set ): UpperCAmelCase_, UpperCAmelCase_ = len(__magic_name__ ), len(grid[0] ) if ( min(__magic_name__ , __ma...
121
0
'''simple docstring''' import sys UpperCAmelCase_ : int = ( '''73167176531330624919225119674426574742355349194934''' '''96983520312774506326239578318016984801869478851843''' '''85861560789112949495459501737958331952853208805511''' '''1254069874715852386305071569329096329522744304355...
24
import logging import os from typing import List, TextIO, Union from conllu import parse_incr from utils_ner import InputExample, Split, TokenClassificationTask _lowerCamelCase : List[Any] = logging.getLogger(__name__) class snake_case__ ( __snake_case ): ...
121
0
def lowerCamelCase__ ( _a): if not isinstance(_a , _a): raise ValueError("multiplicative_persistence() only accepts integral values") if num < 0: raise ValueError("multiplicative_persistence() does not accept negative values") SCREAMING_SNAKE_CASE : int = 0 SCREAMING_SNAKE_C...
25
def _lowerCAmelCase ( __magic_name__ :str ): UpperCAmelCase_ = '''''' for ch in key: if ch == " " or ch not in key_no_dups and ch.isalpha(): key_no_dups += ch return key_no_dups def _lowerCAmelCase ( __magic_name_...
121
0
'''simple docstring''' import numpy class _A : def __init__( self : Any , __magic_name__ : numpy.ndarray , __magic_name__ : numpy.ndarray ) -> None: """simple docstring""" __snake_case : Optional[int] ...
26
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available _lowerCamelCase : str = { 'configuration_jukebox': [ 'JUKEBOX_PRETRAINED_CONFIG_ARCHIVE_MAP', 'JukeboxConfig', 'JukeboxPriorConfig', ...
121
0
import warnings from ...utils import logging from .image_processing_mobilevit import MobileViTImageProcessor __A : str = logging.get_logger(__name__) class lowerCamelCase( __snake_case ): '''simple docstring''' def __init__( self , ...
27
from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class snake_case__ : '''simple docstring''' __A = 42 __A = None __A = None _lowerCamelCas...
121
0
'''simple docstring''' from collections import defaultdict from graphs.minimum_spanning_tree_prims import prisms_algorithm as mst def lowercase__( ): """simple docstring""" SCREAMING_SNAKE_CASE , SCREAMING_SNAKE_CASE : str = 9, 14 ...
28
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :int ): UpperCAmelCase_ = [True] * limit UpperCAmelCase_ = False UpperCAmelCase_ = False UpperCAmelCase_ = True for i in range(3 , int(limit**0.5 + 1 ) ...
121
0
"""simple docstring""" def lowercase ( lowerCAmelCase__ ,lowerCAmelCase__ ): if number < 0 or shift_amount < 0: raise ValueError('''both inputs must be positive integers''' ) lowerCamelCase_ = str(bin(lowerCAmelCase__ ) ) binary_number += "0" * shift_amount return bi...
29
import argparse import logging import pickle from collections import Counter logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO ) _lowerCamelCase : str = logging.getLogger(__name__) if __name__ ==...
121
0
import os from bleurt import score # From: git+https://github.com/google-research/bleurt.git import datasets __a = datasets.logging.get_logger(__name__) __a = '\\n@inproceedings{bleurt,\n title={BLEURT: Learning Robust Metrics for Text Generation},\n author={Thibault Sellam a...
30
import os from math import logaa def _lowerCAmelCase ( __magic_name__ :str = "base_exp.txt" ): UpperCAmelCase_ = 0 UpperCAmelCase_ = 0 for i, line in enumerate(open(os.path.join(os.path.dirname(__magic_name__ ) , __magic_name__ ) )...
121
0
from __future__ import annotations from collections.abc import Generator def UpperCAmelCase_ ( ) -> Generator[int, None, None]: SCREAMING_SNAKE_CASE_ = {} SCREAMING_SNAKE_CASE_ = 2 while True: SCREAMING_SNAKE_CASE_ = factor_map.pop(__Uppe...
31
import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap _lowerCamelCase : Any = 'Usage of script: script_name <size_of_canvas:int>' _lowerCamelCase : Dict = [0] * 100 + [1] * 10 random.shuffle(choice...
121
0
import os import tempfile import unittest from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter from transformers.testing_utils import slow from transformers.utils import cached_property @unittest.skipUnless(os.path.exists(A__ ) , """Tatoeba directory does...
32
from __future__ import annotations def _lowerCAmelCase ( __magic_name__ :list[int | str] ): create_state_space_tree(__magic_name__ , [] , 0 , [0 for i in range(len(__magic_name__ ) )] ) def _lowerCAmelCase ( ...
121
0
from typing import Mapping from ...configuration_utils import PretrainedConfig from ...onnx import OnnxSeqaSeqConfigWithPast from ...utils import logging lowerCamelCase__ : str = logging.get_logger(__name__) lowerCamelCase__ : Optional[int] = { """...
33
# tests directory-specific settings - this file is run automatically # by pytest before any tests are run import sys import warnings from os.path import abspath, dirname, join # allow having multiple repository checkouts and not needing to remember to rerun # 'pip install -e .[dev]' when switchi...
121
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging SCREAMING_SNAKE_CASE_ = logging.get_logger(__name__) SCREAMING_SNAKE_CASE_ = { 'tiiuae/falcon-40b': 'https://huggingface.co/tiiuae/falcon-40b/resolve/main/config.json', 't...
34
import argparse import hashlib import os import urllib import warnings import torch from torch import nn from tqdm import tqdm from transformers import WhisperConfig, WhisperForConditionalGeneration _lowerCamelCase : Union[str, Any] = { 'tiny.en': 'https://openaipublic.azu...
121
0
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() a_ :str = logging.get_logger(__name__) a_ :Optional[int] = 'https://openaipubl...
35
import argparse import torch from transformers import MobileBertConfig, MobileBertForPreTraining, load_tf_weights_in_mobilebert from transformers.utils import logging logging.set_verbosity_info() def _lowerCAmelCase ( __magic_name__ :Union[str, Any] , __magic_na...
121
0
from manim import * class _A ( snake_case ): '''simple docstring''' def snake_case_ ( self ): '''simple docstring''' snake_case : Any = Rectangle(height=0.5 ,width=0.5 ) snake_case : Tuple = Rectangle(height=0.46 ,widt...
36
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available _lowerCamelCase : Dict = { 'configuration_bloom': ['BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'BloomConfig', 'BloomOnnxConfig'], } try: ...
121
0
def UpperCamelCase_ ( __a , __a ) -> int: return x if y == 0 else greatest_common_divisor(__a , x % y ) def UpperCamelCase_ ( __a , __a ) -> int: return (x * y) // greatest_common_divisor(__a , __a ) def UpperCamelCase_ ( __a = 20 )...
37
_lowerCamelCase : dict[tuple[int, int, int], int] = {} def _lowerCAmelCase ( __magic_name__ :int , __magic_name__ :int , __magic_name__ :int ): # if we are absent twice, or late 3 consecutive days, # no further prize strings are possib...
121
0
'''simple docstring''' import tempfile import torch from diffusers import ( DEISMultistepScheduler, DPMSolverMultistepScheduler, DPMSolverSinglestepScheduler, UniPCMultistepScheduler, ) from .test_schedulers import SchedulerCommonTest class __snake_case ( __SCREAMING_SNAKE_CASE ...
38
import enum import warnings from ..tokenization_utils import TruncationStrategy from ..utils import add_end_docstrings, is_tf_available, is_torch_available, logging from .base import PIPELINE_INIT_ARGS, Pipeline if is_tf_available(): import tensorflow as tf from ..models.auto.modeli...
121
0
import unittest from transformers import DonutProcessor lowerCAmelCase_ = '''naver-clova-ix/donut-base''' class snake_case_ ( unittest.TestCase ): '''simple docstring''' def snake_case__( self : Union[str, Any] ) ->Any: ...
39
import argparse import evaluate import torch from datasets import load_dataset from torch.optim import AdamW from torch.utils.data import DataLoader from transformers import AutoModelForSequenceClassification, AutoTokenizer, get_linear_schedule_with_warmup, set_seed from accelerate import Acceler...
121
0