code
stringlengths
82
54.1k
code_codestyle
int64
0
699
style_context
stringlengths
111
35.6k
style_context_codestyle
int64
0
699
label
int64
0
1
'''simple docstring''' from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_torch_available, ) lowerCAmelCase__ = { '''configuration_speecht5''': [ '''SPEECHT5_PRETRAINED_CONFIG_ARCHIVE_MAP''',...
41
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_...
26
0
'''simple docstring''' import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_token...
42
'''simple docstring''' import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor __UpperCamelCase = logging.get_logger(__name__) class _A ( __lowercase ): def __init__( self : int , *__magic_name__ ...
26
0
import argparse import json import os import fairseq import torch from torch import nn from transformers import ( SpeechaTextaConfig, SpeechaTextaForCausalLM, SpeechaTextaTokenizer, SpeechEncoderDecoderConfig, SpeechEncoderDecoderModel, WavaVecaConfig, WavaVecaFeatureE...
43
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase ...
26
0
'''simple docstring''' import collections import os from typing import List, Optional, Tuple from transformers.utils import is_jieba_available, requires_backends if is_jieba_available(): import jieba from ...tokenization_utils import PreTrainedTokenizer from ...utils import logging UpperCAmelCase_ :...
44
'''simple docstring''' import argparse import os import re import packaging.version __UpperCamelCase = "examples/" __UpperCamelCase = { "examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init...
26
0
from __future__ import annotations UpperCamelCase = 8.988E9 # units = N * m^s * C^-2 def A ( lowercase__ : float , lowercase__ : float , lowercase__ : float , lowercase__ : float ) -> dict[str, float]: UpperCamelCase__ :Optional[int] = abs(chargea * chargea ) i...
45
'''simple docstring''' from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _A ( __lowercase ): def lowercase__ ( self : Any ) -> str: """simple docstring""" return [ ...
26
0
"""simple docstring""" _lowerCAmelCase : Any = '''Alexander Joslin''' import operator as op from .stack import Stack def lowerCamelCase_( _lowerCamelCase ) -> int: '''simple docstring''' _lowerCamelCase : int = {"*": op.mul, "/": op.truedi...
46
'''simple docstring''' import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from...
26
0
import math from numpy import inf from scipy.integrate import quad def UpperCAmelCase__ ( lowerCamelCase_ : float ): if num <= 0: raise ValueError('math domain error' ) return quad(lowerCamelCase_ , 0 , lowerCamelCase_ , args=(lowerCamelCase_...
47
'''simple docstring''' from __future__ import annotations __UpperCamelCase = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCas...
26
0
'''simple docstring''' from typing import Dict, List, Optional, Tuple, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, resize, to_ch...
48
'''simple docstring''' def _a ( _lowerCamelCase ) -> int: """simple docstring""" if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("""only integers accepted as input""" ) else: __snake_case : List[Any] ...
26
0
"""simple docstring""" def lowercase__ ( snake_case_ :list ): if not grid or not grid[0]: raise TypeError('''The grid does not contain the appropriate information''' ) for cell_n in range(1 , len(grid[0] ) ): grid[0][cell_n] += grid[0][cell_n - 1] __UpperCA...
49
'''simple docstring''' from __future__ import annotations import math def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ) -> int: """simple docstring""" if depth < 0: raise V...
26
0
'''simple docstring''' import unittest from transformers import is_tf_available from transformers.testing_utils import require_tf if is_tf_available(): import tensorflow as tf from tensorflow.python.eager import context from tensorflow.python.framework import ops from trans...
50
'''simple docstring''' from __future__ import annotations def _a ( _lowerCamelCase , _lowerCamelCase = None , _lowerCamelCase = None ) -> None: """simple docstring""" if start is None: __snake_case : Optional[Any] ...
26
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 #...
51
'''simple docstring''' import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow __UpperCamelCase = logging.getLogger() ...
26
0
"""simple docstring""" import unittest from knapsack import greedy_knapsack as kp class __lowercase ( unittest.TestCase ): '''simple docstring''' def _lowerCamelCase ( self ): __a : Optional[int] ...
52
'''simple docstring''' import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( ...
26
0
from __future__ import annotations from fractions import Fraction from math import gcd, sqrt def a_ ( lowerCAmelCase_ : int ): __lowerCAmelCase = int(number**0.5 ) return number == sq * sq def a_ ( lowerCAmelCase_ : int, lowerCAmelCase_ : ...
53
'''simple docstring''' import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home __UpperCamelCase = HUGGINGFACE_HUB_CACHE __UpperCamelCase = "config.json" __UpperCamelCase = "diffusion_pytorch_model.bin" __UpperCamelCase ...
26
0
def a__ ( lowercase__ , lowercase__ , lowercase__ ): '''simple docstring''' if len(lowercase__ ) != len(lowercase__ ): raise ValueError("The length of profit and weight must be same." ) if max_weight <= 0: raise ValueError("max_weight mu...
54
'''simple docstring''' import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, Mobile...
26
0
def UpperCAmelCase ( a_ ) -> int: """simple docstring""" __A = [] __A = set({"(", "[", "{"} ) __A = set({")", "]", "}"} ) __A = {"{": "}", "[": "]", "(": ")"} for i in range(len(a_ ) ): if s[i] in open_brackets...
55
'''simple docstring''' from sklearn.metrics import recall_score import datasets __UpperCamelCase = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is...
26
0
'''simple docstring''' import json import os import unittest from transformers import OpenAIGPTTokenizer, OpenAIGPTTokenizerFast from transformers.models.openai.tokenization_openai import VOCAB_FILES_NAMES from transformers.testing_utils import require_ftfy, require_spacy, require_tokenizers from ...test_token...
56
'''simple docstring''' from sklearn.metrics import matthews_corrcoef import datasets __UpperCamelCase = "\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass...
26
0
import os import sys import tempfile import unittest import unittest.mock as mock from pathlib import Path from huggingface_hub import HfFolder, delete_repo from huggingface_hub.file_download import http_get from requests.exceptions import HTTPError from transformers import ( AlbertToken...
57
'''simple docstring''' import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __UpperCamelC...
26
0
"""simple docstring""" from __future__ import annotations __lowerCAmelCase : Optional[Any] = '''#''' class _lowerCAmelCase : """simple docstring""" def __init__( self ) -> None: '''simple docstring...
58
'''simple docstring''' def _a ( _lowerCamelCase = 100 ) -> int: """simple docstring""" __snake_case : Any = n * (n + 1) * (2 * n + 1) / 6 __snake_case : List[Any] = (n * (n + 1) / 2) ** 2 return int(s...
26
0
import inspect import unittest from transformers import SegformerConfig, is_torch_available, is_vision_available from transformers.models.auto import get_values from transformers.testing_utils import require_torch, slow, torch_device from ...test_configuration_common import ConfigTester from ...test_modeling_co...
59
'''simple docstring''' from __future__ import annotations from typing import Any class _A : def __init__( self : str , __magic_name__ : int , __magic_name__ : int , __magic_name__ : float = 0 ) -> None: """simple d...
26
0
import math def lowerCamelCase_ ( _UpperCamelCase ) -> bool: """simple docstring""" if 1 < number < 4: # 2 and 3 are primes return True elif number < 2 or number % 2 == 0 or number % 3 == 0: # Negatives, 0, 1, all even numbers, all multiples of 3...
60
'''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 d...
26
0
from __future__ import annotations from collections import deque from collections.abc import Sequence from dataclasses import dataclass from typing import Any @dataclass class __lowerCamelCase : """simple docstring""" snake_case__ = 42 snake_case__ = None ...
61
'''simple docstring''' import cva import numpy as np class _A : def __init__( self : Any , __magic_name__ : float , __magic_name__ : int ) -> Optional[int]: """simple docstring""" if k in (0.04, 0.06): __snake_c...
26
0
from typing import Callable, Optional, Union from ...configuration_utils import PretrainedConfig from ...utils import logging snake_case = logging.get_logger(__name__) snake_case = { """microsoft/xprophetnet-large-wiki100-cased""": ( """https://huggingface.co/microsoft/xprophe...
62
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _A ( __lowercase ): lowercase__: Any = ['''image_processor''', '''tokenizer'''] lowercase__: Any = ''...
26
0
import numpy as np import torch import torch.nn as nn from transformers import CLIPConfig, CLIPVisionModelWithProjection, PreTrainedModel from ...utils import logging a : List[str] = logging.get_logger(__name__) class a ( lowercase__ ): """simple ...
63
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_...
26
0
import unittest from typing import Tuple import torch from diffusers.utils import floats_tensor, randn_tensor, torch_all_close, torch_device from diffusers.utils.testing_utils import require_torch @require_torch class _lowerCamelCase : @property def UpperCamelCase_ ( self ) -> Tup...
64
'''simple docstring''' import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor __UpperCamelCase = logging.get_logger(__name__) class _A ( __lowercase ): def __init__( self : int , *__magic_name__ ...
26
0
"""simple docstring""" import argparse import torch from transformers import GPTaConfig, GPTaModel, load_tf_weights_in_gpta from transformers.utils import CONFIG_NAME, WEIGHTS_NAME, logging logging.set_verbosity_info() def lowerCAmelCase ( __UpperCamelCase , __UpperCamelCase ...
65
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase ...
26
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices Uppe...
66
'''simple docstring''' import argparse import os import re import packaging.version __UpperCamelCase = "examples/" __UpperCamelCase = { "examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init...
26
0
import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor snake_case = logging.get_logger(__name__) class A_ ( UpperCAmelCase ): """simple docstring""" def __init__( self...
67
'''simple docstring''' from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _A ( __lowercase ): def lowercase__ ( self : Any ) -> str: """simple docstring""" return [ ...
26
0
import argparse import copy def lowercase__ ( A_: Tuple ) -> Dict: """simple docstring""" __UpperCAmelCase ={} with open(A_ ) as f: for line in f: if line.split()[0] not in dict_of_neighbours: ...
68
'''simple docstring''' import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from...
26
0
'''simple docstring''' def __UpperCAmelCase ( _UpperCAmelCase : str ) -> int: assert column_title.isupper() __snake_case = 0 __snake_case = len(_UpperCAmelCase ) - 1 __snake_case = 0 while index >= 0: __snake_case = (ord(column_title[index] ...
69
'''simple docstring''' from __future__ import annotations __UpperCamelCase = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCas...
26
0
import random import unittest import torch from diffusers import IFInpaintingSuperResolutionPipeline from diffusers.utils import floats_tensor from diffusers.utils.import_utils import is_xformers_available from diffusers.utils.testing_utils import skip_mps, torch_device from ..pipeline_params imp...
70
'''simple docstring''' def _a ( _lowerCamelCase ) -> int: """simple docstring""" if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("""only integers accepted as input""" ) else: __snake_case : List[Any] ...
26
0
'''simple docstring''' from abc import ABC, abstractmethod from typing import Optional, Union from .. import Dataset, DatasetDict, Features, IterableDataset, IterableDatasetDict, NamedSplit from ..utils.typing import NestedDataStructureLike, PathLike class _snake_case (__SCREAMING_SNAKE_CASE): ...
71
'''simple docstring''' from __future__ import annotations import math def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ) -> int: """simple docstring""" if depth < 0: raise V...
26
0
'''simple docstring''' def UpperCamelCase ( lowercase_ : str ) -> bool: '''simple docstring''' lowercase =0 for ch in input_str: lowercase =ord(lowercase_ ) lowercase =pow(2 , lowercase_ ) # If we already turned on bit for current character's...
72
'''simple docstring''' from __future__ import annotations def _a ( _lowerCamelCase , _lowerCamelCase = None , _lowerCamelCase = None ) -> None: """simple docstring""" if start is None: __snake_case : Optional[Any] ...
26
0
from collections import OrderedDict from typing import Mapping from packaging import version from ...configuration_utils import PretrainedConfig from ...onnx import OnnxConfig from ...utils import logging a_ : int = logging.get_logger(__name__) a_ : List[str] = { 'hustv...
73
'''simple docstring''' import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow __UpperCamelCase = logging.getLogger() ...
26
0
import html from ...feature_extraction_utils import BatchFeature, FeatureExtractionMixin from ...utils import is_bsa_available, logging, requires_backends if is_bsa_available(): import bsa from bsa import BeautifulSoup lowercase_ = logging.get_logger(__name__) class __UpperCamelCase ( l...
74
'''simple docstring''' import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( ...
26
0
'''simple docstring''' import json import os import subprocess import unittest from ast import literal_eval import pytest from parameterized import parameterized, parameterized_class from . import is_sagemaker_available if is_sagemaker_available(): from sagemaker import Session, TrainingJobAna...
75
'''simple docstring''' import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home __UpperCamelCase = HUGGINGFACE_HUB_CACHE __UpperCamelCase = "config.json" __UpperCamelCase = "diffusion_pytorch_model.bin" __UpperCamelCase ...
26
0
"""simple docstring""" import math def __UpperCAmelCase ( __UpperCamelCase , __UpperCamelCase = 0 , __UpperCamelCase = 0 ): __lowercase : List[Any] = end or len(__UpperCamelCase ) for i in range(__UpperCamelCase , __UpperCamelCase ): __l...
76
'''simple docstring''' import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, Mobile...
26
0
"""simple docstring""" import json import os import shutil import tempfile import unittest import numpy as np import pytest from transformers import CLIPTokenizer, CLIPTokenizerFast from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES from transformers.testing_utils import require_vision...
77
'''simple docstring''' from sklearn.metrics import recall_score import datasets __UpperCamelCase = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is...
26
0
'''simple docstring''' from __future__ import annotations from collections import namedtuple from dataclasses import dataclass @dataclass class __A : a__ : int a__ : TreeNode | None = None a__ : TreeNode | None = None SCREAMING_SNAKE_CASE_: Union[str, Any] =namedtu...
78
'''simple docstring''' from sklearn.metrics import matthews_corrcoef import datasets __UpperCamelCase = "\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass...
26
0
# 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 # # U...
79
'''simple docstring''' import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __UpperCamelC...
26
0
from math import isqrt, loga def snake_case ( lowerCamelCase ): '''simple docstring''' __lowercase = [True] * max_number for i in range(2 , isqrt(max_number - 1 ) + 1 ): if is_prime[i]: for j in range(i**2 , lowerCamelCase , lowerCamelCase ...
80
'''simple docstring''' def _a ( _lowerCamelCase = 100 ) -> int: """simple docstring""" __snake_case : Any = n * (n + 1) * (2 * n + 1) / 6 __snake_case : List[Any] = (n * (n + 1) / 2) ** 2 return int(s...
26
0
import unittest import numpy as np from transformers.testing_utils import require_torch, require_vision from transformers.utils import is_torch_available, is_vision_available from ...test_image_processing_common import ImageProcessingSavingTestMixin if is_torch_available(): import torch if is_vision_availab...
81
'''simple docstring''' from __future__ import annotations from typing import Any class _A : def __init__( self : str , __magic_name__ : int , __magic_name__ : int , __magic_name__ : float = 0 ) -> None: """simple d...
26
0
"""simple docstring""" import argparse import json from pathlib import Path import requests import torch from huggingface_hub import cached_download, hf_hub_download, hf_hub_url from PIL import Image from transformers import DetaConfig, DetaForObjectDetection, DetaImageProcessor, SwinConfi...
82
'''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 d...
26
0
"""simple docstring""" import copy from typing import Any, Dict, List, Optional, Union import numpy as np import torch from ...audio_utils import mel_filter_bank, spectrogram, window_function from ...feature_extraction_sequence_utils import SequenceFeatureExtractor from ...feature_extraction_utils import Ba...
83
'''simple docstring''' import cva import numpy as np class _A : def __init__( self : Any , __magic_name__ : float , __magic_name__ : int ) -> Optional[int]: """simple docstring""" if k in (0.04, 0.06): __snake_c...
26
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_tokenizers_available, is_torch_available, ) UpperCAmelCase = {'''configuration_reformer''': ['''REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ReformerConf...
84
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _A ( __lowercase ): lowercase__: Any = ['''image_processor''', '''tokenizer'''] lowercase__: Any = ''...
26
0
# # 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_node 2 --nnodes 1 torch-distributed-gpu-tes...
85
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_...
26
0
import argparse import logging import pickle import random import time import numpy as np from transformers import BertTokenizer, GPTaTokenizer, RobertaTokenizer logging.basicConfig( format='%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt='%m/%d/%Y %H:%M:%S', level=logging.INFO )...
86
'''simple docstring''' import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor __UpperCamelCase = logging.get_logger(__name__) class _A ( __lowercase ): def __init__( self : int , *__magic_name__ ...
26
0
from scipy.stats import spearmanr import datasets _lowerCamelCase : List[Any] = """ The Spearman rank-order correlation coefficient is a measure of the relationship between two datasets. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Posit...
87
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase ...
26
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCAmelCase = logging.get_logger(__name__) UpperCAmelCase = { """microsoft/markuplm-base""": """https://huggingface.co/microsoft/markuplm-base/resolve/main/config.json""", ...
88
'''simple docstring''' import argparse import os import re import packaging.version __UpperCamelCase = "examples/" __UpperCamelCase = { "examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init...
26
0
from typing import TYPE_CHECKING from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available SCREAMING_SNAKE_CASE : Optional[Any] = { "configuration_conditional_detr": [ "CONDITIONAL_DETR_PRETRAINED_CONFIG_ARCHIVE_MAP", "ConditionalDetr...
89
'''simple docstring''' from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _A ( __lowercase ): def lowercase__ ( self : Any ) -> str: """simple docstring""" return [ ...
26
0
'''simple docstring''' import pytest from datasets import Dataset, DatasetDict, Features, NamedSplit, Value from datasets.io.text import TextDatasetReader from ..utils import assert_arrow_memory_doesnt_increase, assert_arrow_memory_increases def _snake_case ( A , A ) -> ...
90
'''simple docstring''' import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from...
26
0
"""simple docstring""" from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, ) _lowercase = { '''configuration_electra''': ['''ELECTRA_PRETRAINED_CONF...
91
'''simple docstring''' from __future__ import annotations __UpperCamelCase = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCas...
26
0
'''simple docstring''' from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, convert_to_rgb, get_resize_output_image_size, normalize, rescale, ...
92
'''simple docstring''' def _a ( _lowerCamelCase ) -> int: """simple docstring""" if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("""only integers accepted as input""" ) else: __snake_case : List[Any] ...
26
0
"""simple docstring""" # DISCLAIMER: This file is strongly influenced by https://github.com/yang-song/score_sde_pytorch import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import...
93
'''simple docstring''' from __future__ import annotations import math def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ) -> int: """simple docstring""" if depth < 0: raise V...
26
0
'''simple docstring''' from typing import List from .keymap import KEYMAP, get_character def lowercase_ ( __A : str ) -> List[Any]: """simple docstring""" def decorator(__A : Tuple ): lowercase : List[Any] =getattr(__A , '''handle_...
94
'''simple docstring''' from __future__ import annotations def _a ( _lowerCamelCase , _lowerCamelCase = None , _lowerCamelCase = None ) -> None: """simple docstring""" if start is None: __snake_case : Optional[Any] ...
26
0
"""simple docstring""" import os import time import warnings from dataclasses import dataclass, field from enum import Enum from typing import List, Optional, Union import torch from filelock import FileLock from torch.utils.data import Dataset from ...tokenization_utils_base import PreTrainedTokenizerBase fro...
95
'''simple docstring''' import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow __UpperCamelCase = logging.getLogger() ...
26
0
"""simple docstring""" from dataclasses import dataclass from typing import Optional, Tuple import torch from torch import nn from transformers import RobertaPreTrainedModel, XLMRobertaConfig, XLMRobertaModel from transformers.utils import ModelOutput @dataclass class __A ...
96
'''simple docstring''' import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( ...
26
0
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_diffusion.modeling_roberta_series i...
97
'''simple docstring''' import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home __UpperCamelCase = HUGGINGFACE_HUB_CACHE __UpperCamelCase = "config.json" __UpperCamelCase = "diffusion_pytorch_model.bin" __UpperCamelCase ...
26
0
'''simple docstring''' import os from tempfile import TemporaryDirectory from unittest import TestCase import pytest from absl.testing import parameterized from datasets import config from datasets.arrow_reader import HF_GCP_BASE_URL from datasets.builder import DatasetBuilder from datasets.dataset_dict import...
98
'''simple docstring''' import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, Mobile...
26
0
from dataclasses import dataclass, field from typing import Tuple from ..utils import cached_property, is_torch_available, is_torch_tpu_available, logging, requires_backends from .benchmark_args_utils import BenchmarkArguments if is_torch_available(): import torch if is_torch_tpu_available(check_d...
99
'''simple docstring''' from sklearn.metrics import recall_score import datasets __UpperCamelCase = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is...
26
0
import functools def __snake_case ( lowerCAmelCase_ , lowerCAmelCase_ ) -> int: # Validation if not isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) or not all(isinstance(lowerCAmelCase_ , lowerCAmelCase_ ) for day in days ): raise ValueError('''The param...
100
'''simple docstring''' from sklearn.metrics import matthews_corrcoef import datasets __UpperCamelCase = "\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass...
26
0
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 sklearn # noqa: F401 # Here...
101
'''simple docstring''' import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __UpperCamelC...
26
0
"""simple docstring""" from __future__ import annotations from collections.abc import MutableSequence class lowercase__ : """simple docstring""" def __init__( self , _A , _A ): '''simple docstring''' ...
102
'''simple docstring''' def _a ( _lowerCamelCase = 100 ) -> int: """simple docstring""" __snake_case : Any = n * (n + 1) * (2 * n + 1) / 6 __snake_case : List[Any] = (n * (n + 1) / 2) ** 2 return int(s...
26
0
"""simple docstring""" from typing import Dict, List, Optional, Union import numpy as np from ...image_processing_utils import BaseImageProcessor, BatchFeature, get_size_dict from ...image_transforms import ( center_crop, get_resize_output_image_size, normalize, rescale, ...
103
'''simple docstring''' from __future__ import annotations from typing import Any class _A : def __init__( self : str , __magic_name__ : int , __magic_name__ : int , __magic_name__ : float = 0 ) -> None: """simple d...
26
0
"""simple docstring""" import logging import os from dataclasses import dataclass, field from functools import partial from pathlib import Path from tempfile import TemporaryDirectory from typing import List, Optional import faiss import torch from datasets import Features, Sequence, V...
104
'''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 d...
26
0
import argparse import torch from datasets import load_dataset from donut import DonutModel from transformers import ( DonutImageProcessor, DonutProcessor, DonutSwinConfig, DonutSwinModel, MBartConfig, MBartForCausalLM, VisionEncoderDecoderModel, XLMRobertaTokenizerFast, ) de...
105
'''simple docstring''' import cva import numpy as np class _A : def __init__( self : Any , __magic_name__ : float , __magic_name__ : int ) -> Optional[int]: """simple docstring""" if k in (0.04, 0.06): __snake_c...
26
0
import argparse import requests import torch from PIL import Image from transformers import CLIPProcessor, GroupViTConfig, GroupViTModel def lowerCamelCase_ ( lowerCAmelCase__ : List[str] ) -> Tuple: '''simple docstring''' if "img_encoder.pos_embed" in name: ...
106
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _A ( __lowercase ): lowercase__: Any = ['''image_processor''', '''tokenizer'''] lowercase__: Any = ''...
26
0
'''simple docstring''' from __future__ import annotations def _SCREAMING_SNAKE_CASE ( __snake_case : int ): _A = str(__snake_case ) return len(__snake_case ) == 9 and set(__snake_case ) == set('123456789' ) def _SCREAMING_SNAKE_CASE ( ): for base...
107
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_...
26
0
import copy from ...configuration_utils import PretrainedConfig from ...utils import logging __a: Any = logging.get_logger(__name__) class SCREAMING_SNAKE_CASE__ ( UpperCAmelCase ): '''simple docstring''' _lowerCamelCase = '''encoder-decoder''' _lowerCamelCase = Tru...
108
'''simple docstring''' import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor __UpperCamelCase = logging.get_logger(__name__) class _A ( __lowercase ): def __init__( self : int , *__magic_name__ ...
26
0
'''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_ANSWERING_MAPPIN...
109
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase ...
26
0
"""simple docstring""" import warnings from ...utils import logging from .image_processing_deit import DeiTImageProcessor UpperCamelCase__ = logging.get_logger(__name__) class a ( lowercase ): def __init__( self , *UpperCamelCase_ , **UpperCamelCase_ ): ...
110
'''simple docstring''' import argparse import os import re import packaging.version __UpperCamelCase = "examples/" __UpperCamelCase = { "examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init...
26
0
"""simple docstring""" import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_dense_index, ) import transform...
237
'''simple docstring''' from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _A ( __lowercase ): def lowercase__ ( self : Any ) -> str: """simple docstring""" return [ ...
26
0
"""simple docstring""" import unittest from pathlib import Path from shutil import copyfile from transformers import SPIECE_UNDERLINE, is_sentencepiece_available from transformers.models.speech_to_text import SpeechaTextTokenizer from transformers.models.speech_to_text.tokenization_speech_to_text import VOC...
227
'''simple docstring''' import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from...
26
0
import json from typing import 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 .tokenization_roberta import Ro...
79
'''simple docstring''' from __future__ import annotations __UpperCamelCase = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCas...
26
0
from __future__ import annotations class snake_case_ : '''simple docstring''' def __init__( self : Optional[int] , __magic_name__ : list[list[int]] ) -> str: lowerCamelCase_ : str = TypeError( "Mat...
488
'''simple docstring''' def _a ( _lowerCamelCase ) -> int: """simple docstring""" if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("""only integers accepted as input""" ) else: __snake_case : List[Any] ...
26
0
from __future__ import annotations def __SCREAMING_SNAKE_CASE ( a__ : Any ) -> None: create_state_space_tree(_lowerCamelCase ,[] ,0 ,[0 for i in range(len(_lowerCamelCase ) )] ) def __SCREAMING_SNAKE_CASE ( a__ : Tuple ,a__ : Union[str, ...
17
'''simple docstring''' from __future__ import annotations import math def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ) -> int: """simple docstring""" if depth < 0: raise V...
26
0
"""simple docstring""" import argparse import os import jax as jnp import numpy as onp import torch import torch.nn as nn from music_spectrogram_diffusion import inference from tax import checkpoints from diffusers import DDPMScheduler, OnnxRuntimeModel, SpectrogramDiffusionPipeline from diffuse...
361
'''simple docstring''' from __future__ import annotations def _a ( _lowerCamelCase , _lowerCamelCase = None , _lowerCamelCase = None ) -> None: """simple docstring""" if start is None: __snake_case : Optional[Any] ...
26
0
import unittest from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available from transformers.pipelines import pipeline from transformers.testing_utils import ( is_pipeline_test, nested_simplify, require_tf, require_torch, require_vision, slow, ...
70
'''simple docstring''' import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow __UpperCamelCase = logging.getLogger() ...
26
0
"""simple docstring""" import json import os import tempfile from transformers.testing_utils import check_json_file_has_correct_format class lowerCAmelCase__ : '''simple docstring''' __UpperCamelCase = None def _SCREAMING_SNAKE_CASE ( self : Any)...
512
'''simple docstring''' import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( ...
26
0
import json import multiprocessing import os import re from collections import defaultdict import torch from accelerate import Accelerator from accelerate.utils import set_seed from arguments import HumanEvalArguments from datasets import load_dataset, load_metric from torch.utils.data import Iterable...
475
'''simple docstring''' import os from huggingface_hub.constants import HUGGINGFACE_HUB_CACHE, hf_cache_home __UpperCamelCase = HUGGINGFACE_HUB_CACHE __UpperCamelCase = "config.json" __UpperCamelCase = "diffusion_pytorch_model.bin" __UpperCamelCase ...
26
0
import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from_submodules, ) from accelerate.test_util...
371
'''simple docstring''' import argparse import json import re from pathlib import Path import requests import torch from huggingface_hub import hf_hub_download from PIL import Image from transformers import ( MobileNetVaConfig, MobileNetVaForImageClassification, Mobile...
26
0
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.modeling_tf_auto i...
648
'''simple docstring''' from sklearn.metrics import recall_score import datasets __UpperCamelCase = "\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is...
26
0
"""simple docstring""" from typing import Optional from torch import nn from .transformer_ad import TransformeraDModel, TransformeraDModelOutput class snake_case_ ( nn.Module ): def __init__( self , a_ = 1_6 , a_ = 8_8 , a_ = None , a_ = 1 , a_ = 0.0 ...
237
'''simple docstring''' from sklearn.metrics import matthews_corrcoef import datasets __UpperCamelCase = "\nCompute the Matthews correlation coefficient (MCC)\n\nThe Matthews correlation coefficient is used in machine learning as a\nmeasure of the quality of binary and multiclass...
26
0
"""simple docstring""" import unittest from datasets import load_dataset from transformers import BloomTokenizerFast from transformers.testing_utils import require_tokenizers from ...test_tokenization_common import TokenizerTesterMixin @require_tokenizers class a__ ( __lowercase , ...
227
'''simple docstring''' import json import os from pathlib import Path import pytest from datasets.download.download_config import DownloadConfig from datasets.download.download_manager import DownloadManager from datasets.utils.file_utils import hash_url_to_filename __UpperCamelC...
26
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_flax_available, is_tf_available, is_tokenizers_available, is_torch_available, is_vision_available, ) SCREAMING_SNAKE_CASE__ : List[Any] = { ...
79
'''simple docstring''' def _a ( _lowerCamelCase = 100 ) -> int: """simple docstring""" __snake_case : Any = n * (n + 1) * (2 * n + 1) / 6 __snake_case : List[Any] = (n * (n + 1) / 2) ** 2 return int(s...
26
0
import importlib import sys from argparse import REMAINDER, ArgumentParser from pathlib import Path import torch_xla.distributed.xla_multiprocessing as xmp def __a ( ) -> Any: """simple docstring""" lowerCamelCase_ : Tuple = ArgumentParser( descr...
488
'''simple docstring''' from __future__ import annotations from typing import Any class _A : def __init__( self : str , __magic_name__ : int , __magic_name__ : int , __magic_name__ : float = 0 ) -> None: """simple d...
26
0
def __SCREAMING_SNAKE_CASE ( a__ : str ) -> int: __A : Any = len(_lowerCamelCase ) __A : Dict = len(matrix[0] ) __A : Tuple = min(_lowerCamelCase ,_lowerCamelCase ) for row in range(_lowerCamelCase ): # Check if diagonal elemen...
17
'''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 d...
26
0
"""simple docstring""" import math from dataclasses import dataclass from typing import Optional, Tuple, Union import torch from ..configuration_utils import ConfigMixin, register_to_config from ..utils import BaseOutput, randn_tensor from .scheduling_utils import SchedulerMixin, SchedulerOutput ...
361
'''simple docstring''' import cva import numpy as np class _A : def __init__( self : Any , __magic_name__ : float , __magic_name__ : int ) -> Optional[int]: """simple docstring""" if k in (0.04, 0.06): __snake_c...
26
0
def _SCREAMING_SNAKE_CASE ( lowercase : Optional[int] = 4_00_00_00 ): '''simple docstring''' lowerCamelCase_ = [0, 1] lowerCamelCase_ = 0 while fib[i] <= n: fib.append(fib[i] + fib[i + 1] ) if fib[i + 2]...
70
'''simple docstring''' import warnings from ...processing_utils import ProcessorMixin from ...tokenization_utils_base import BatchEncoding class _A ( __lowercase ): lowercase__: Any = ['''image_processor''', '''tokenizer'''] lowercase__: Any = ''...
26
0
"""simple docstring""" from jiwer import compute_measures import datasets UpperCAmelCase_ : int = """\\n@inproceedings{inproceedings,\n author = {Morris, Andrew and Maier, Viktoria and Green, Phil},\n year = {2004},\n month = {01},\n pages = {},\n title = {From WER and RIL ...
512
'''simple docstring''' import datasets import faiss import numpy as np import streamlit as st import torch from elasticsearch import Elasticsearch from elia_utils import ( embed_questions_for_retrieval, make_qa_sas_model, qa_sas_generate, query_es_index, query_qa_...
26
0
import numpy as np import qiskit def __UpperCAmelCase ( __A = 8 , __A = None ) -> str: '''simple docstring''' UpperCAmelCase__ = np.random.default_rng(seed=_lowerCamelCase ) # Roughly 25% of the qubits will contribute to...
475
'''simple docstring''' import warnings from ...utils import logging from .image_processing_owlvit import OwlViTImageProcessor __UpperCamelCase = logging.get_logger(__name__) class _A ( __lowercase ): def __init__( self : int , *__magic_name__ ...
26
0
from __future__ import annotations A : Optional[Any] = list[list[int]] # assigning initial values to the grid A : str = [ [3, 0, 6, 5, 0, 8, 4, 0, 0], [5, 2, 0, 0, 0, 0, 0, 0, 0], [0, 8, 7, 0, 0, 0, 0, 3, 1], [0, 0, 3, 0, 1, 0, 0, 8, 0], [9, 0, 0, 8, 6...
371
'''simple docstring''' import argparse import torch from transformers import BlenderbotConfig, BlenderbotForConditionalGeneration from transformers.utils import logging logging.set_verbosity_info() __UpperCamelCase = logging.get_logger(__name__) __UpperCamelCase ...
26
0
import numpy as np import pandas as pd from sklearn.preprocessing import Normalizer from sklearn.svm import SVR from statsmodels.tsa.statespace.sarimax import SARIMAX def _lowercase ( UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_ , UpperCAmelCase_): ...
648
'''simple docstring''' import argparse import os import re import packaging.version __UpperCamelCase = "examples/" __UpperCamelCase = { "examples": (re.compile(R"^check_min_version\(\"[^\"]+\"\)\s*$", re.MULTILINE), "check_min_version(\"VERSION\")\n"), "init...
26
0
"""simple docstring""" from __future__ import annotations from collections.abc import Iterator class snake_case_ : def __init__( self , a_ ): a_ : List[Any] = value a_ : Node | None = None a_ : Node | None = None class ...
237
'''simple docstring''' from unittest import TestCase from datasets import Sequence, Value from datasets.arrow_dataset import Dataset class _A ( __lowercase ): def lowercase__ ( self : Any ) -> str: """simple docstring""" return [ ...
26
0
"""simple docstring""" from ...configuration_utils import PretrainedConfig from ...utils import logging UpperCamelCase__ = logging.get_logger(__name__) UpperCamelCase__ = { '''edbeeching/decision-transformer-gym-hopper-medium''': ( '''https://huggingface.co/edbeeching/decision-...
227
'''simple docstring''' import inspect import unittest import torch import torch.nn as nn from accelerate.hooks import ( AlignDevicesHook, ModelHook, SequentialHook, add_hook_to_module, attach_align_device_hook, remove_hook_from_module, remove_hook_from...
26
0
import os import sys SCREAMING_SNAKE_CASE__ : str = os.path.join(os.path.dirname(__file__), """src""") sys.path.append(SRC_DIR) from transformers import ( AutoConfig, AutoModel, AutoModelForCausalLM, AutoModelForMaskedLM, AutoModelForQuestionAnswering, ...
79
'''simple docstring''' from __future__ import annotations __UpperCamelCase = [ [-1, 0], # left [0, -1], # down [1, 0], # right [0, 1], # up ] def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCas...
26
0
from typing import TYPE_CHECKING from ...utils import ( OptionalDependencyNotAvailable, _LazyModule, is_sentencepiece_available, is_speech_available, is_tf_available, is_torch_available, ) snake_case_ : Optional[Any] = { "configuration_speech_to_text": ["SPEECH_TO_TEXT_PRETRA...
488
'''simple docstring''' def _a ( _lowerCamelCase ) -> int: """simple docstring""" if not isinstance(_lowerCamelCase , _lowerCamelCase ): raise TypeError("""only integers accepted as input""" ) else: __snake_case : List[Any] ...
26
0
from pathlib import Path import fire from tqdm import tqdm def __SCREAMING_SNAKE_CASE ( a__ : List[Any]="ro" ,a__ : List[str]="en" ,a__ : Dict="wmt16" ,a__ : List[Any]=None ) -> None: try: import datasets except (ModuleNotFoundError, ImportError): raise Imp...
17
'''simple docstring''' from __future__ import annotations import math def _a ( _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase , _lowerCamelCase ) -> int: """simple docstring""" if depth < 0: raise V...
26
0
"""simple docstring""" import argparse import shutil from pathlib import Path from tqdm import tqdm from transformers import AutoTokenizer def __magic_name__ ( __snake_case : Optional[Any] , __snake_case : Dict , __snake_case : str , __snake_case ...
361
'''simple docstring''' from __future__ import annotations def _a ( _lowerCamelCase , _lowerCamelCase = None , _lowerCamelCase = None ) -> None: """simple docstring""" if start is None: __snake_case : Optional[Any] ...
26
0
import comet # From: unbabel-comet import torch import datasets lowerCamelCase : Optional[Any] = datasets.logging.get_logger(__name__) lowerCamelCase : int = "\\n@inproceedings{rei-EtAl:2020:WMT,\n author = {Rei, Ricardo and Stewart, Craig and...
70
'''simple docstring''' import doctest import logging import os import unittest from pathlib import Path from typing import List, Union import transformers from transformers.testing_utils import require_tf, require_torch, slow __UpperCamelCase = logging.getLogger() ...
26
0
"""simple docstring""" from sklearn.metrics import recall_score import datasets UpperCAmelCase_ : Tuple = """\nRecall is the fraction of the positive examples that were correctly labeled by the model as positive. It can be computed with the equation:\nRecall = TP / (TP + FN)\nWhere TP is ...
512
'''simple docstring''' import inspect from typing import Callable, List, Optional, Union import torch from transformers import ( CLIPImageProcessor, CLIPTextModel, CLIPTokenizer, WhisperForConditionalGeneration, WhisperProcessor, ) from diffusers import ( ...
26
0