code
stringlengths
87
55.2k
code_codestyle
int64
0
349
style_context
stringlengths
135
49.1k
style_context_codestyle
int64
0
349
label
int64
0
1
'''simple docstring''' import numpy as np import skfuzzy as fuzz if __name__ == "__main__": # Create universe of discourse in Python using linspace () lowerCamelCase__ = np.linspace(start=0, stop=75, num=75, endpoint=True, retstep=False) # Create two fuzzy sets by defining an...
234
'''simple docstring''' import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel lowerCamelCase__ = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention....
234
1
'''simple docstring''' from copy import deepcopy class lowerCAmelCase__ : def __init__( self : Tuple , lowerCamelCase__ : list[int] | None = None , lowerCamelCase__ : int | None = None ) ->None: '''simple docstring''' ...
234
'''simple docstring''' import math def __lowerCAmelCase (__lowerCAmelCase ): return math.sqrt(__lowerCAmelCase ) * math.sqrt(__lowerCAmelCase ) == num def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : int = ...
234
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from tokenizers.pre_tokenizers import BertPreTokenizer, PreTokenizer from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_roformer...
234
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(...
234
1
'''simple docstring''' from typing import Union import fire import torch from tqdm import tqdm def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase = "cpu" , __lowerCAmelCase = None ): _UpperCAmelCase : List[Any] = torch.load(__l...
234
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCamelCase__ = {'UserAgent': UserAgent().random} def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAme...
234
1
'''simple docstring''' import os def __lowerCAmelCase (): with open(os.path.dirname(__lowerCAmelCase ) + "/p022_names.txt" ) as file: _UpperCAmelCase : str = str(file.readlines()[0] ) _UpperCAmelCase : Optional[int] = names...
234
'''simple docstring''' from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCamelCase__ = '\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Transl...
234
1
'''simple docstring''' import os from pathlib import Path from unittest.mock import patch import pytest import zstandard as zstd from datasets.download.download_config import DownloadConfig from datasets.utils.file_utils import ( OfflineModeIsEnabled, cached_path, fsspec_get, fs...
234
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lo...
234
1
'''simple docstring''' import math def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): if ( not isinstance(__lowerCAmelCase , (int, float) ) or power_factor < -1 or power_factor > 1 ): raise ValueError("power_fac...
234
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class lowerCAmelCase__ : def __init__( self : Union[str, Any] ) ->Union[str, Any]: '''simple docstring''' ...
234
1
'''simple docstring''' import pandas as pd from matplotlib import pyplot as plt from sklearn.linear_model import LinearRegression # Splitting the dataset into the Training set and Test set from sklearn.model_selection import train_test_split # Fitting Polynomial Regression to the dataset from sklea...
234
'''simple docstring''' 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....
234
1
'''simple docstring''' import json import multiprocessing as mp import re from collections import defaultdict from functools import partial from typing import Dict, List, Optional, Set, Tuple, Type from datasets import Dataset from datasketch import MinHash, MinHashLSH from dpu_utils.utils.iterator...
234
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lowerCAmelCase (__lowerCAmel...
234
1
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase = 600_851_475_143 ): try: _UpperCAmelCase : Dict = int(__lowerCAmelCase ) except (TypeError, ValueError): raise TypeError("Parameter n must be int or castable to int." ) if n <= 0: ...
234
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassi...
234
1
'''simple docstring''' import itertools from dataclasses import dataclass from typing import Any, Callable, Dict, List, Optional, Union import pandas as pd import pyarrow as pa import datasets import datasets.config from datasets.features.features import require_storage_cast from datasets.table i...
234
'''simple docstring''' import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
234
1
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): if mass < 0: raise ValueError("The mass of a body cannot be negative" ) return 0.5 * mass * abs(__lowerCAmelCase ) * abs(__lowerCAmelCase ) if __name__ == "__main__":...
234
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_...
234
1
'''simple docstring''' from ...configuration_utils import PretrainedConfig from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { 'microsoft/biogpt': 'https://huggingface.co/microsoft/biogpt/resolve/main/config.json', # See all BioGPT ...
234
'''simple docstring''' # # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_nod...
234
1
'''simple docstring''' from collections import Counter from pathlib import Path from typing import Optional, Tuple import yaml class lowerCAmelCase__ ( yaml.SafeLoader ): def lowerCAmelCase__ ( self : List[Any] , lowerCamelCase__ : int ) ...
234
'''simple docstring''' import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def __lowe...
234
1
'''simple docstring''' from __future__ import annotations import bisect def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase = 0 , __lowerCAmelCase = -1 ): if hi < 0: _UpperCAmelCase : Union[str, Any] ...
234
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) **...
234
1
'''simple docstring''' import unittest from transformers.models.xlm_prophetnet.tokenization_xlm_prophetnet import SPIECE_UNDERLINE, XLMProphetNetTokenizer from transformers.testing_utils import get_tests_dir, require_sentencepiece, slow from transformers.utils import cached_property from ...test_toke...
234
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { 'ut/deta': 'https://huggingface.co/ut/deta/resolve/main/conf...
234
1
'''simple docstring''' import operator as op lowerCamelCase__ = 'scaler.pt' lowerCamelCase__ = 'pytorch_model' lowerCamelCase__ = 'random_states' lowerCamelCase__ = 'optimizer' lowerCamelCase__ = 'scheduler' lowerCamelCase__ = 'pytorch_model.bin' lowerCamelCase_...
234
'''simple docstring''' def __lowerCAmelCase (): return [list(range(1_000 - i , -1_000 - i , -1 ) ) for i in range(1_000 )] lowerCamelCase__ = generate_large_matrix() lowerCamelCase__ = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [...
234
1
'''simple docstring''' import argparse import os from io import BytesIO from pathlib import Path import requests from clip_retrieval.clip_client import ClipClient from PIL import Image from tqdm import tqdm def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase...
234
'''simple docstring''' from __future__ import annotations lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'MIT' lowerCamelCase__ = '1.0.0' lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'contact@muhammadumerfarooq.me' lowerCamelCase__ = '...
234
1
'''simple docstring''' def __lowerCAmelCase (): return [list(range(1_000 - i , -1_000 - i , -1 ) ) for i in range(1_000 )] lowerCamelCase__ = generate_large_matrix() lowerCamelCase__ = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [...
234
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from tran...
234
1
'''simple docstring''' import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def __lowerCAmelCase (): _UpperCAmelCase : List[Any] = ArgumentParser( d...
234
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase = 50 ): _UpperCAmelCase : Tuple = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(...
234
1
'''simple docstring''' from pathlib import Path from typing import List from transformers import is_torch_available, is_vision_available from transformers.testing_utils import get_tests_dir, is_tool_test from transformers.tools.agent_types import AGENT_TYPE_MAPPING, AgentAudio, AgentImage, AgentText ...
234
'''simple docstring''' import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def...
234
1
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): _UpperCAmelCase : Tuple = len(__lowerCAmelCase ) print("The following activities are selected:" ) # The first activity is always selected _UpperCAmelCase ...
234
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer lowerCamelCase__ = logging.get_logger(__n...
234
1
'''simple docstring''' from __future__ import annotations lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'MIT' lowerCamelCase__ = '1.0.0' lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'contact@muhammadumerfarooq.me' lowerCamelCase__ = '...
234
'''simple docstring''' import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel lowerCamelCase__ = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention....
234
1
'''simple docstring''' # Copyright 2023 The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses...
234
'''simple docstring''' import math def __lowerCAmelCase (__lowerCAmelCase ): return math.sqrt(__lowerCAmelCase ) * math.sqrt(__lowerCAmelCase ) == num def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : int = ...
234
1
'''simple docstring''' from math import atan, cos, radians, sin, tan from .haversine_distance import haversine_distance lowerCamelCase__ = 6_378_137.0 lowerCamelCase__ = 6_356_752.314_245 lowerCamelCase__ = 6_378_137 def __lowerCAmelCase (__lowerCAmelCase ...
234
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(...
234
1
'''simple docstring''' import shutil import tempfile import unittest from unittest.mock import patch from transformers import ( DefaultFlowCallback, IntervalStrategy, PrinterCallback, ProgressCallback, Trainer, TrainerCallback, TrainingArguments, is_torch_availab...
234
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCamelCase__ = {'UserAgent': UserAgent().random} def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAme...
234
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available lowerCamelCase__ = {'configuration_ibert': ['IBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'IBertConfig', 'IBertOnnxConfig']} try: if not is_torch_avail...
234
'''simple docstring''' from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCamelCase__ = '\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Transl...
234
1
'''simple docstring''' import warnings from ...utils import logging from .image_processing_flava import FlavaImageProcessor lowerCamelCase__ = logging.get_logger(__name__) class lowerCAmelCase__ ( UpperCAmelCase__ ): def __init__( self : Optional[Any] , ...
234
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lo...
234
1
'''simple docstring''' import argparse import torch from transformers import ( SpeechTaConfig, SpeechTaFeatureExtractor, SpeechTaForSpeechToSpeech, SpeechTaForSpeechToText, SpeechTaForTextToSpeech, SpeechTaProcessor, SpeechTaTokenizer, logging, ) from transform...
234
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class lowerCAmelCase__ : def __init__( self : Union[str, Any] ) ->Union[str, Any]: '''simple docstring''' ...
234
1
'''simple docstring''' import argparse import requests import torch # pip3 install salesforce-lavis # I'm actually installing a slightly modified version: pip3 install git+https://github.com/nielsrogge/LAVIS.git@fix_lavis_float32 (there's also the fix_lavis branch) # also note: to convert Vicuna che...
234
'''simple docstring''' 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....
234
1
'''simple docstring''' import io import math from typing import Dict, Optional, Union import numpy as np from huggingface_hub import hf_hub_download from ...image_processing_utils import BaseImageProcessor, BatchFeature from ...image_transforms import convert_to_rgb, normalize, to_channel_dimension...
234
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lowerCAmelCase (__lowerCAmel...
234
1
'''simple docstring''' from manim import * class lowerCAmelCase__ ( UpperCAmelCase__ ): def lowerCAmelCase__ ( self : Tuple ) ->Any: '''simple docstring''' _UpperCAmelCase : Tuple = Rectangle(height=0.5...
234
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassi...
234
1
'''simple docstring''' import hashlib import unittest from typing import Dict import numpy as np from transformers import ( MODEL_FOR_MASK_GENERATION_MAPPING, TF_MODEL_FOR_MASK_GENERATION_MAPPING, is_vision_available, pipeline, ) from transformers.pipelines import MaskGeneration...
234
'''simple docstring''' import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
234
1
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): def get_matched_characters(__lowerCAmelCase , __lowerCAmelCase ) -> str: _UpperCAmelCase : List[Any] = [] _UpperCAmelCase : List[Any] = ...
234
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_...
234
1
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassi...
234
'''simple docstring''' # # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_nod...
234
1
'''simple docstring''' class lowerCAmelCase__ : def __init__( self : Tuple , lowerCamelCase__ : int , lowerCamelCase__ : Any ) ->Tuple: '''simple docstring''' _UpperCAmelCase : int = name _UpperCAm...
234
'''simple docstring''' import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def __lowe...
234
1
'''simple docstring''' import os import pytest from attr import dataclass lowerCamelCase__ = 'us-east-1' # defaults region @dataclass class lowerCAmelCase__ : lowerCAmelCase : str lowerCAmelCase : Any = "arn:aws:iam::558105141721:role/sagemaker...
234
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) **...
234
1
'''simple docstring''' lowerCamelCase__ = [sum(int(c, 10) ** 2 for c in i.__str__()) for i in range(100_000)] def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : str = 0 while number: # Increased Speed Slightly by checking every 5 digits...
234
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { 'ut/deta': 'https://huggingface.co/ut/deta/resolve/main/conf...
234
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_torch_available, ) lowerCamelCase__ = { 'configuration_resnet': ['RESNET_PRETRAINED_CONFIG_ARCHIVE_MA...
234
'''simple docstring''' def __lowerCAmelCase (): return [list(range(1_000 - i , -1_000 - i , -1 ) ) for i in range(1_000 )] lowerCamelCase__ = generate_large_matrix() lowerCamelCase__ = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [...
234
1
'''simple docstring''' import numpy as np def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ): _UpperCAmelCase : Optional[int] = int(np.ceil((x_end - xa) ...
234
'''simple docstring''' from __future__ import annotations lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'MIT' lowerCamelCase__ = '1.0.0' lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'contact@muhammadumerfarooq.me' lowerCamelCase__ = '...
234
1
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCamelCase__ = {'UserAgent': UserAgent().random} def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAme...
234
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from tran...
234
1
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ViTConfig, ViTForImageClassification, ViTImageProcessor, ViTModel from transformers.utils import logg...
234
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase = 50 ): _UpperCAmelCase : Tuple = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(...
234
1
'''simple docstring''' from numpy import exp, pi, sqrt def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase = 0.0 , __lowerCAmelCase = 1.0 ): return 1 / sqrt(2 * pi * sigma**2 ) * exp(-((x - mu) ** 2) / (2 * sigma**2) ) if __name__ == ...
234
'''simple docstring''' import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def...
234
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available lowerCamelCase__ = { 'configuration_tapas': ['TAPAS_PRETRAINED_CONFIG_ARCHIVE_MAP', 'TapasConfig'], 'tokenization_tapas': ['Tap...
234
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer lowerCamelCase__ = logging.get_logger(__n...
234
1
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class lowerCAmelCase__ : def __init__( self : Union[str, Any] ) ->Union[str, Any]: '''simple docstring''' ...
234
'''simple docstring''' import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel lowerCamelCase__ = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention....
234
1
'''simple docstring''' import faiss # noqa: F401 # Here to have a nice missing dependency error message early on import numpy # noqa: F401 # Here to have a nice missing dependency error message early on import requests # noqa: F401 # Here to have a nice missing dependency error message early on import ...
234
'''simple docstring''' import math def __lowerCAmelCase (__lowerCAmelCase ): return math.sqrt(__lowerCAmelCase ) * math.sqrt(__lowerCAmelCase ) == num def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : int = ...
234
1
'''simple docstring''' import gc import unittest import numpy as np import torch from transformers import CLIPTextConfig, CLIPTextModel, XLMRobertaTokenizer from diffusers import AltDiffusionPipeline, AutoencoderKL, DDIMScheduler, PNDMScheduler, UNetaDConditionModel from diffusers.pipelines.alt_dif...
234
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(...
234
1
'''simple docstring''' import os import unicodedata from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import SPIECE_UNDERLINE, logging lowerCamelCase__ ...
234
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCamelCase__ = {'UserAgent': UserAgent().random} def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAme...
234
1
'''simple docstring''' from typing import List, Optional import numpy as np from ...processing_utils import ProcessorMixin from ...utils import to_numpy class lowerCAmelCase__ ( UpperCAmelCase__ ): lowerCAmelCase : Union[str, Any] = "EncodecFeatureExtractor" l...
234
'''simple docstring''' from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCamelCase__ = '\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Transl...
234
1
'''simple docstring''' import json import os from functools import lru_cache from typing import List, Optional, Tuple import regex as re from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) low...
234
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lo...
234
1
'''simple docstring''' from typing import Dict import numpy as np import torch from . import residue_constants as rc from .tensor_utils import tensor_tree_map, tree_map def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : str = [] _UpperCAme...
234
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class lowerCAmelCase__ : def __init__( self : Union[str, Any] ) ->Union[str, Any]: '''simple docstring''' ...
234
1
'''simple docstring''' from __future__ import annotations from bisect import bisect_left from functools import total_ordering from heapq import merge @total_ordering class lowerCAmelCase__ ( UpperCAmelCase__ ): def __lt__( self : int , lowerCamelCase__ : ...
234
'''simple docstring''' 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....
234
1
'''simple docstring''' import unittest from transformers import EsmConfig, is_torch_available from transformers.testing_utils import TestCasePlus, require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_common import ModelTesterMixin, ids_tensor, ...
234
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lowerCAmelCase (__lowerCAmel...
234
1
'''simple docstring''' import argparse import logging import os import re import tensorflow as tf from transformers import ( AutoConfig, AutoTokenizer, DataCollatorForLanguageModeling, PushToHubCallback, TFAutoModelForMaskedLM, create_optimizer, ) lowerCamelCase__...
234
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassi...
234
1
'''simple docstring''' import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import MgpstrTokenizer from transformers.models.mgp_str.tokenization_mgp_str import VOCAB_FILES_NAMES from transformers.testing_utils import require_torch...
234
'''simple docstring''' import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
234
1
'''simple docstring''' from collections import defaultdict from math import ceil, sqrt def __lowerCAmelCase (__lowerCAmelCase = 1_000_000 , __lowerCAmelCase = 10 ): _UpperCAmelCase : defaultdict = defaultdict(__lowerCAmelCase ) for outer_...
234
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_...
234
1
'''simple docstring''' import contextlib import csv import json import os import sqlitea import tarfile import textwrap import zipfile import pyarrow as pa import pyarrow.parquet as pq import pytest import datasets import datasets.config @pytest.fixture(scope="session" ) de...
234
'''simple docstring''' # # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_nod...
234
1
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lowerCAmelCase (__lowerCAmel...
234
'''simple docstring''' import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def __lowe...
234
1
'''simple docstring''' # # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_nod...
234
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) **...
234
1
'''simple docstring''' import shutil import tempfile import unittest import numpy as np import pytest from transformers import is_speech_available, is_vision_available from transformers.testing_utils import require_torch if is_vision_available(): from transformers import TvltImageProces...
234
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { 'ut/deta': 'https://huggingface.co/ut/deta/resolve/main/conf...
234
1
'''simple docstring''' 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....
234
'''simple docstring''' def __lowerCAmelCase (): return [list(range(1_000 - i , -1_000 - i , -1 ) ) for i in range(1_000 )] lowerCamelCase__ = generate_large_matrix() lowerCamelCase__ = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [...
234
1
'''simple docstring''' from itertools import zip_longest import requests from bsa import BeautifulSoup from pandas import DataFrame def __lowerCAmelCase (__lowerCAmelCase = "laptop" ): _UpperCAmelCase : str = F"""https://www.amazon.in/laptop/s?k={product...
234
'''simple docstring''' from __future__ import annotations lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'MIT' lowerCamelCase__ = '1.0.0' lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'contact@muhammadumerfarooq.me' lowerCamelCase__ = '...
234
1
'''simple docstring''' from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Sequence, Value from .base import TaskTemplate @dataclass(frozen=UpperCAmelCase__ ) class lowerCAmelCase__ ( UpperCAmelCase__ ): # `task` is not a Clas...
234
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from tran...
234
1
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase ): # bit count represents no. of bits in the gray code if bit_count < 0: raise ValueError("The given input must be positive" ) # get the generated string sequence _UpperCAmelCase : Dict = ...
234
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase = 50 ): _UpperCAmelCase : Tuple = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(...
234
1
'''simple docstring''' import math def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : Tuple = 0 _UpperCAmelCase : Tuple = 0 while num > 0: _UpperCAmelCase : List[Any] = num % 8 _UpperCAmelCase : ...
234
'''simple docstring''' import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def...
234
1
'''simple docstring''' import os import sys import unittest lowerCamelCase__ = os.path.abspath(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))) sys.path.append(os.path.join(git_repo_path, 'utils')) import check_dummies # noqa: E402 from check_dummies import create_dummy_files, ...
234
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer lowerCamelCase__ = logging.get_logger(__n...
234
1
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { 'ut/deta': 'https://huggingface.co/ut/deta/resolve/main/conf...
234
'''simple docstring''' import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel lowerCamelCase__ = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention....
234
1
'''simple docstring''' import os import tempfile import unittest from pathlib import Path from transformers import AutoConfig, is_torch_available from transformers.testing_utils import require_torch, torch_device if is_torch_available(): from transformers import PyTorchBenchmark, PyTorchBe...
234
'''simple docstring''' import math def __lowerCAmelCase (__lowerCAmelCase ): return math.sqrt(__lowerCAmelCase ) * math.sqrt(__lowerCAmelCase ) == num def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : int = ...
234
1
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ....tokenization_utils_fast import PreTrainedTokenizerFast from ....utils import logging from .tokenization_retribert import RetriBertTokenizer lowerCamelCase__ = logging.ge...
234
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(...
234
1
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, ...
234
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCamelCase__ = {'UserAgent': UserAgent().random} def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAme...
234
1
'''simple docstring''' from __future__ import annotations def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase , __lowerCAmelCase ): if (voltage, current, resistance).count(0 ) != 1: raise ValueError("One and only one argument must be 0" ...
234
'''simple docstring''' from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCamelCase__ = '\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Transl...
234
1
'''simple docstring''' # Copyright 2023 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/LICE...
234
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lo...
234
1
'''simple docstring''' import unittest from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ) from...
234
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class lowerCAmelCase__ : def __init__( self : Union[str, Any] ) ->Union[str, Any]: '''simple docstring''' ...
234
1
'''simple docstring''' 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_AN...
234
'''simple docstring''' 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....
234
1
'''simple docstring''' import argparse import gc import json import os import shutil import warnings import torch from transformers import LlamaConfig, LlamaForCausalLM, LlamaTokenizer try: from transformers import LlamaTokenizerFast except ImportError as e: warnings.warn(e) ...
234
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lowerCAmelCase (__lowerCAmel...
234
1
'''simple docstring''' import argparse from collections import defaultdict import yaml lowerCamelCase__ = 'docs/source/en/_toctree.yml' def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : str = defaultdict(__lowerCAmelCase ) for...
234
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassi...
234
1
'''simple docstring''' from __future__ import annotations def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): if partitions <= 0: raise ValueError("partitions must be a positive number!" ) if partitions > number_of_bytes: raise ValueError...
234
'''simple docstring''' import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
234
1
'''simple docstring''' import requests from bsa import BeautifulSoup def __lowerCAmelCase (__lowerCAmelCase = "AAPL" ): _UpperCAmelCase : List[str] = F"""https://in.finance.yahoo.com/quote/{symbol}?s={symbol}""" _UpperCAmelCase : Optional[int] ...
234
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_...
234
1
'''simple docstring''' # Copyright 2023 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/LICE...
234
'''simple docstring''' # # This a `torch.distributed` diagnostics script that checks that all GPUs in the cluster (one or # many nodes) can talk to each other via nccl and allocate gpu memory. # # To run first adjust the number of processes and nodes: # # python -m torch.distributed.run --nproc_per_nod...
234
1
'''simple docstring''' import json import re from typing import TYPE_CHECKING, List, Optional, Tuple, Union import numpy as np from ...utils import is_tf_available, is_torch_available, logging if TYPE_CHECKING: if is_torch_available(): import torch if is_tf_available()...
234
'''simple docstring''' import argparse import json import os import torch from torch import nn from transformers import NllbMoeConfig, NllbMoeModel from transformers.modeling_utils import dtype_byte_size from transformers.utils import WEIGHTS_INDEX_NAME, WEIGHTS_NAME def __lowe...
234
1
'''simple docstring''' # Copyright 2021 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...
234
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): if density <= 0: raise ValueError("Impossible fluid density" ) if bulk_modulus <= 0: raise ValueError("Impossible bulk modulus" ) return (bulk_modulus / density) **...
234
1
'''simple docstring''' from sklearn.metrics import mean_squared_error import datasets lowerCamelCase__ = '\\n@article{scikit-learn,\n title={Scikit-learn: Machine Learning in {P}ython},\n author={Pedregosa, F. and Varoquaux, G. and Gramfort, A. and Michel, V.\n and Thirion, B. and Grise...
234
'''simple docstring''' import copy from ...configuration_utils import PretrainedConfig from ...utils import logging from ..auto import CONFIG_MAPPING lowerCamelCase__ = logging.get_logger(__name__) lowerCamelCase__ = { 'ut/deta': 'https://huggingface.co/ut/deta/resolve/main/conf...
234
1
'''simple docstring''' from dataclasses import dataclass, field from typing import ClassVar, Dict from ..features import Features, Value from .base import TaskTemplate @dataclass(frozen=UpperCAmelCase__ ) class lowerCAmelCase__ ( UpperCAmelCase__ ): lowerCAmelCase : str ...
234
'''simple docstring''' def __lowerCAmelCase (): return [list(range(1_000 - i , -1_000 - i , -1 ) ) for i in range(1_000 )] lowerCamelCase__ = generate_large_matrix() lowerCamelCase__ = ( [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [...
234
1
'''simple docstring''' import importlib import os import sys # This is required to make the module import works (when the python process is running from the root of the repo) sys.path.append('.') def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : int...
234
'''simple docstring''' from __future__ import annotations lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'MIT' lowerCamelCase__ = '1.0.0' lowerCamelCase__ = 'Muhammad Umer Farooq' lowerCamelCase__ = 'contact@muhammadumerfarooq.me' lowerCamelCase__ = '...
234
1
'''simple docstring''' from typing import List, Optional, Tuple, Union import torch from ...models import UNetaDModel from ...schedulers import ScoreSdeVeScheduler from ...utils import randn_tensor from ..pipeline_utils import DiffusionPipeline, ImagePipelineOutput class lowerCAmelCas...
234
'''simple docstring''' import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_url from PIL import Image from transformers import DPTConfig, DPTForDepthEstimation, DPTForSemanticSegmentation, DPTImageProcessor from tran...
234
1
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase ): if upper_limit < 0: raise ValueError("Limit for the Catalan sequence must be ≥ 0" ) _UpperCAmelCase : int = [0] * (upper_limit + 1) # Base case: C(0) = C(1) = 1 _UpperCAmelCase : ...
234
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase = 50 ): _UpperCAmelCase : Tuple = [[0] * 3 for _ in range(length + 1 )] for row_length in range(length + 1 ): for tile_length in range(2 , 5 ): for tile_start in range(...
234
1
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): _enforce_args(__lowerCAmelCase , __lowerCAmelCase ) if n == 0: return 0 _UpperCAmelCase : Any = float("-inf" ) for i in range(1 , n + ...
234
'''simple docstring''' import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def...
234
1
'''simple docstring''' import glob import os import random from string import ascii_lowercase, digits import cva lowerCamelCase__ = '' lowerCamelCase__ = '' lowerCamelCase__ = '' lowerCamelCase__ = 1 # (0 is vertical, 1 is horizontal) def __lowerCAmelCas...
234
'''simple docstring''' import json from typing import List, Optional, Tuple from tokenizers import normalizers from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import logging from .tokenization_bert import BertTokenizer lowerCamelCase__ = logging.get_logger(__n...
234
1
'''simple docstring''' import logging from pathlib import Path import numpy as np import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint from pytorch_lightning.utilities import rank_zero_only from utils_rag import save_json def...
234
'''simple docstring''' import argparse import re import torch from CLAP import create_model from transformers import AutoFeatureExtractor, ClapConfig, ClapModel lowerCamelCase__ = { 'text_branch': 'text_model', 'audio_branch': 'audio_model.audio_encoder', 'attn': 'attention....
234
1
'''simple docstring''' import numpy as np from transformers import Pipeline def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : Dict = np.max(__lowerCAmelCase , axis=-1 , keepdims=__lowerCAmelCase ) _UpperCAmelCase ...
234
'''simple docstring''' import math def __lowerCAmelCase (__lowerCAmelCase ): return math.sqrt(__lowerCAmelCase ) * math.sqrt(__lowerCAmelCase ) == num def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAmelCase : int = ...
234
1
'''simple docstring''' import argparse import os import re import torch from flax.traverse_util import flatten_dict from tax import checkpoints from transformers import ( AutoTokenizer, PixaStructConfig, PixaStructForConditionalGeneration, PixaStructImageProcessor, PixaStru...
234
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils import AddedToken from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(...
234
1
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase ): assert column_title.isupper() _UpperCAmelCase : Union[str, Any] = 0 _UpperCAmelCase : List[str] = len(__lowerCAmelCase ) - 1 _UpperCAmelCase : Tuple = 0 whi...
234
'''simple docstring''' from __future__ import annotations import json import requests from bsa import BeautifulSoup from fake_useragent import UserAgent lowerCamelCase__ = {'UserAgent': UserAgent().random} def __lowerCAmelCase (__lowerCAmelCase ): _UpperCAme...
234
1
'''simple docstring''' 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 ...
234
'''simple docstring''' from typing import Dict, List from nltk.translate import gleu_score import datasets from datasets import MetricInfo lowerCamelCase__ = '\\n@misc{wu2016googles,\n title={Google\'s Neural Machine Translation System: Bridging the Gap between Human and Machine Transl...
234
1
'''simple docstring''' import logging import os import random import sys from dataclasses import dataclass, field from typing import Optional import datasets import evaluate import numpy as np from datasets import load_dataset import transformers from transformers import ( AutoConfig, ...
234
'''simple docstring''' import os from shutil import copyfile from typing import Any, Dict, List, Optional, Tuple import sentencepiece as spm from ...tokenization_utils import AddedToken, PreTrainedTokenizer from ...utils import logging lowerCamelCase__ = logging.get_logger(__name__) lo...
234
1
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_...
234
'''simple docstring''' from collections import deque from math import floor from random import random from time import time class lowerCAmelCase__ : def __init__( self : Union[str, Any] ) ->Union[str, Any]: '''simple docstring''' ...
234
1
'''simple docstring''' import os from shutil import copyfile from typing import List, Optional, Tuple from ...tokenization_utils_fast import PreTrainedTokenizerFast from ...utils import is_sentencepiece_available, logging if is_sentencepiece_available(): from .tokenization_pegasus import Pe...
234
'''simple docstring''' 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....
234
1
'''simple docstring''' def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase ): return (pointa[0] - pointa[0]) ** 2 + (pointa[1] - pointa[1]) ** 2 def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase=0 ): return sorted(__lowe...
234
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def __lowerCAmelCase (__lowerCAmel...
234
1
'''simple docstring''' import os import sys import tempfile import torch from .state import AcceleratorState from .utils import PrecisionType, PrepareForLaunch, is_mps_available, patch_environment def __lowerCAmelCase (__lowerCAmelCase , __lowerCAmelCase=() , ...
234
'''simple docstring''' import argparse import re from pathlib import Path import requests import torch from PIL import Image from torchvision.transforms import CenterCrop, Compose, Normalize, Resize, ToTensor from transformers import ( EfficientFormerConfig, EfficientFormerForImageClassi...
234
1
'''simple docstring''' import os from pickle import UnpicklingError from typing import Dict, Tuple import jax import jax.numpy as jnp import numpy as np from flax.serialization import from_bytes from flax.traverse_util import flatten_dict, unflatten_dict import transformers from .utils import ...
234
'''simple docstring''' import warnings from diffusers import StableDiffusionImgaImgPipeline # noqa F401 warnings.warn( 'The `image_to_image.py` script is outdated. Please use directly `from diffusers import' ' StableDiffusionImg2ImgPipeline` instead.' )
234
1
'''simple docstring''' import warnings from pathlib import Path from typing import List, Tuple, Union import fire from torch import nn from transformers import AutoModelForSeqaSeqLM, AutoTokenizer, PreTrainedModel from transformers.utils import logging lowerCamelCase__ = logging.get_logg...
234
'''simple docstring''' import json import logging import os import sys from pathlib import Path import finetune_rag from transformers.file_utils import is_apex_available from transformers.testing_utils import ( TestCasePlus, execute_subprocess_async, require_ray, require_torch_...
234
1