python_code stringlengths 0 290k | repo_name stringclasses 30
values | file_path stringlengths 6 125 |
|---|---|---|
from pathlib import Path
import torch
from PIL import Image
from PIL.ImageOps import exif_transpose
from torch.utils.data import Dataset
from torchvision import transforms
class PromptDataset(Dataset):
"A simple dataset to prepare the prompts to generate class images on multiple GPUs."
def __init__(self, pr... | autotrain-advanced-main | src/autotrain/trainers/dreambooth/datasets.py |
autotrain-advanced-main | src/autotrain/trainers/dreambooth/__init__.py | |
import hashlib
import itertools
import os
from pathlib import Path
from typing import Dict
import torch
from diffusers import AutoencoderKL, DDPMScheduler, DiffusionPipeline, StableDiffusionXLPipeline, UNet2DConditionModel
from diffusers.utils.import_utils import is_xformers_available
from packaging import version
fro... | autotrain-advanced-main | src/autotrain/trainers/dreambooth/utils.py |
import itertools
import math
import os
import shutil
import torch
import torch.nn.functional as F
from diffusers import StableDiffusionXLPipeline
from diffusers.loaders import LoraLoaderMixin, text_encoder_lora_state_dict
from diffusers.optimization import get_scheduler
from huggingface_hub import create_repo, upload_... | autotrain-advanced-main | src/autotrain/trainers/dreambooth/trainer.py |
import argparse
import json
import os
import diffusers
import torch
import torch.nn.functional as F
import transformers
from accelerate import Accelerator
from accelerate.utils import ProjectConfiguration, set_seed
from diffusers import StableDiffusionXLPipeline
from diffusers.loaders import LoraLoaderMixin, text_enco... | autotrain-advanced-main | src/autotrain/trainers/dreambooth/__main__.py |
import os
from pydantic import BaseModel, Field
from autotrain import logger
class TextClassificationParams(BaseModel):
data_path: str = Field(None, title="Data path")
model: str = Field("bert-base-uncased", title="Model name")
lr: float = Field(5e-5, title="Learning rate")
epochs: int = Field(3, ti... | autotrain-advanced-main | src/autotrain/trainers/text_classification/params.py |
autotrain-advanced-main | src/autotrain/trainers/text_classification/__init__.py | |
import torch
class TextClassificationDataset:
def __init__(self, data, tokenizer, config):
self.data = data
self.tokenizer = tokenizer
self.config = config
self.text_column = self.config.text_column
self.target_column = self.config.target_column
def __len__(self):
... | autotrain-advanced-main | src/autotrain/trainers/text_classification/dataset.py |
import os
import numpy as np
import requests
from sklearn import metrics
BINARY_CLASSIFICATION_EVAL_METRICS = (
"eval_loss",
"eval_accuracy",
"eval_f1",
"eval_auc",
"eval_precision",
"eval_recall",
)
MULTI_CLASS_CLASSIFICATION_EVAL_METRICS = (
"eval_loss",
"eval_accuracy",
"eval_... | autotrain-advanced-main | src/autotrain/trainers/text_classification/utils.py |
import argparse
import json
import os
import pandas as pd
from accelerate.state import PartialState
from datasets import Dataset, load_dataset
from huggingface_hub import HfApi
from transformers import (
AutoConfig,
AutoModelForSequenceClassification,
AutoTokenizer,
EarlyStoppingCallback,
Trainer,
... | autotrain-advanced-main | src/autotrain/trainers/text_classification/__main__.py |
import os
from pydantic import BaseModel, Field
class ImageClassificationParams(BaseModel):
data_path: str = Field(None, title="Data path")
model_name: str = Field("bert-base-uncased", title="Model name")
lr: float = Field(5e-5, title="Learning rate")
epochs: int = Field(3, title="Number of training ... | autotrain-advanced-main | src/autotrain/trainers/image_classification/params.py |
autotrain-advanced-main | src/autotrain/trainers/image_classification/__init__.py | |
import numpy as np
import torch
class ImageClassificationDataset:
def __init__(self, data, transforms, config):
self.data = data
self.transforms = transforms
self.config = config
def __len__(self):
return len(self.data)
def __getitem__(self, item):
image = self.da... | autotrain-advanced-main | src/autotrain/trainers/image_classification/dataset.py |
import albumentations as A
import numpy as np
from sklearn import metrics
from autotrain.trainers.image_classification.dataset import ImageClassificationDataset
BINARY_CLASSIFICATION_EVAL_METRICS = (
"eval_loss",
"eval_accuracy",
"eval_f1",
"eval_auc",
"eval_precision",
"eval_recall",
)
MULT... | autotrain-advanced-main | src/autotrain/trainers/image_classification/utils.py |
import argparse
import json
from accelerate.state import PartialState
from datasets import load_dataset
from huggingface_hub import HfApi
from transformers import (
AutoConfig,
AutoImageProcessor,
AutoModelForImageClassification,
EarlyStoppingCallback,
Trainer,
TrainingArguments,
)
from autotr... | autotrain-advanced-main | src/autotrain/trainers/image_classification/__main__.py |
import os
from pydantic import BaseModel, Field
from autotrain import logger
class LLMTrainingParams(BaseModel):
model: str = Field("gpt2", title="Model name")
data_path: str = Field("data", title="Data path")
project_name: str = Field("Project Name", title="Output directory")
train_split: str = Fie... | autotrain-advanced-main | src/autotrain/trainers/clm/params.py |
autotrain-advanced-main | src/autotrain/trainers/clm/__init__.py | |
import os
from itertools import chain
import requests
import torch
from datasets import Dataset
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
from autotrain import logger
IGNORE_INDEX = -100
DEFAULT_PAD_TOKEN = "[PAD]"
DEFAULT_EOS_TOKEN = "</s>"
DEFAULT_BOS_TOKEN = "</s>"
D... | autotrain-advanced-main | src/autotrain/trainers/clm/utils.py |
import os
import torch
from peft import set_peft_model_state_dict
from transformers import TrainerCallback, TrainerControl, TrainerState, TrainingArguments
from transformers.trainer_utils import PREFIX_CHECKPOINT_DIR
class SavePeftModelCallback(TrainerCallback):
def on_save(
self,
args: TrainingA... | autotrain-advanced-main | src/autotrain/trainers/clm/callbacks.py |
import argparse
import json
import os
import sys
from functools import partial
import pandas as pd
import torch
from accelerate import Accelerator
from accelerate.state import PartialState
from datasets import Dataset, load_dataset
from huggingface_hub import HfApi
from peft import LoraConfig, get_peft_model, prepare_... | autotrain-advanced-main | src/autotrain/trainers/clm/__main__.py |
autotrain-advanced-main | src/autotrain/infer/__init__.py | |
from dataclasses import dataclass
from typing import Optional
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
@dataclass
class TextGenerationInference:
model_path: str = "gpt2"
use_int4: Optional[bool] = False
use_int8: Optional[bool] = False
temperature: O... | autotrain-advanced-main | src/autotrain/infer/text_generation.py |
autotrain-advanced-main | src/autotrain/apps/image_classification.py | |
from functools import partial
import gradio as gr
import pandas as pd
from autotrain.apps import common
from autotrain.apps import utils as app_utils
from autotrain.dataset import AutoTrainDataset
from autotrain.project import AutoTrainProject
ALLOWED_MODELS = [
"xgboost",
"random_forest",
"ridge",
... | autotrain-advanced-main | src/autotrain/apps/tabular.py |
autotrain-advanced-main | src/autotrain/apps/__init__.py | |
from functools import partial
import gradio as gr
import pandas as pd
from autotrain.apps import common
from autotrain.apps import utils as app_utils
from autotrain.dataset import AutoTrainDataset
from autotrain.project import AutoTrainProject
def start_training(
jobs_df,
model_choice,
training_data,
... | autotrain-advanced-main | src/autotrain/apps/llm.py |
from functools import partial
import gradio as gr
import pandas as pd
from autotrain.apps import common
from autotrain.apps import utils as app_utils
from autotrain.dataset import AutoTrainDataset
from autotrain.languages import SUPPORTED_LANGUAGES
from autotrain.project import AutoTrainProject
def start_training(
... | autotrain-advanced-main | src/autotrain/apps/text_classification.py |
import os
import gradio as gr
from autotrain import allowed_file_types
from autotrain.apps.utils import BACKEND_CHOICES, _login_user
from autotrain.utils import get_user_token
def user_validation():
user_token = os.environ.get("HF_TOKEN", "")
if len(user_token) == 0:
user_token = get_user_token()
... | autotrain-advanced-main | src/autotrain/apps/common.py |
import copy
import random
import string
import gradio as gr
import numpy as np
import pandas as pd
from huggingface_hub import list_models
from autotrain import logger
from autotrain.utils import user_authentication
THEME = "freddyaboulton/dracula_revamped"
BACKEND_CHOICES = {
"A10G Large": 3.15,
"A10G Sma... | autotrain-advanced-main | src/autotrain/apps/utils.py |
from functools import partial
import gradio as gr
import pandas as pd
from autotrain.apps import common
from autotrain.apps import utils as app_utils
from autotrain.dataset import AutoTrainDreamboothDataset
from autotrain.project import AutoTrainProject
ALLOWED_FILE_TYPES = ["png", "jpg", "jpeg"]
MODELS = [
"s... | autotrain-advanced-main | src/autotrain/apps/dreambooth.py |
import gradio as gr
from autotrain.apps import utils as app_utils
from autotrain.apps.dreambooth import main as dreambooth
from autotrain.apps.llm import main as llm
from autotrain.apps.tabular import main as tabular
from autotrain.apps.text_classification import main as text_classification
llm = llm()
text_classifi... | autotrain-advanced-main | src/autotrain/apps/main.py |
import os
import shutil
import uuid
from dataclasses import dataclass
from typing import Optional
import pandas as pd
from datasets import load_dataset
from sklearn.model_selection import train_test_split
from autotrain import logger
ALLOWED_EXTENSIONS = ("jpeg", "png", "jpg", "JPG", "JPEG", "PNG")
@dataclass
cla... | autotrain-advanced-main | src/autotrain/preprocessor/vision.py |
from dataclasses import dataclass
from typing import List, Optional
import pandas as pd
from datasets import Dataset
from sklearn.model_selection import train_test_split
RESERVED_COLUMNS = ["autotrain_id", "autotrain_label"]
@dataclass
class TabularBinaryClassificationPreprocessor:
train_data: pd.DataFrame
... | autotrain-advanced-main | src/autotrain/preprocessor/tabular.py |
autotrain-advanced-main | src/autotrain/preprocessor/__init__.py | |
from dataclasses import dataclass
from typing import Optional
import pandas as pd
from datasets import ClassLabel, Dataset
from sklearn.model_selection import train_test_split
RESERVED_COLUMNS = ["autotrain_text", "autotrain_label"]
LLM_RESERVED_COLUMNS = ["autotrain_prompt", "autotrain_context", "autotrain_response... | autotrain-advanced-main | src/autotrain/preprocessor/text.py |
import io
import json
from dataclasses import dataclass
from typing import Any, List
from huggingface_hub import HfApi, create_repo
from autotrain import logger
@dataclass
class DreamboothPreprocessor:
concept_images: List[Any]
concept_name: str
username: str
project_name: str
token: str
de... | autotrain-advanced-main | src/autotrain/preprocessor/dreambooth.py |
#!/usr/bin/env python
# coding=utf-8
# 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/LI... | blog-main | assets/62_pytorch_fsdp/run_clm_no_trainer.py |
import torch
import torch.nn as nn
from bitsandbytes.nn import Linear8bitLt
# Utility function
def get_model_memory_footprint(model):
r"""
Partially copied and inspired from: https://discuss.pytorch.org/t/gpu-memory-that-model-uses/56822/2
"""
return sum([param.nelement() * param.element_size() f... | blog-main | assets/96_hf_bitsandbytes_integration/example.py |
import functools
import time
from multiprocessing import pool
import ray
from ray_tpu import get_connection, start_ray
from bloom_inference.tpu_manager import TPUManager
tpu_name="bloom-tpu-v4-64"
region="us-central2-b"
ckpt = "bigscience/bloom"
t5x_path = "gs://bloom-jax-us-central2-b/bloom-176B-scan-t5x/checkpoi... | bloom-jax-inference-main | run.py |
import numpy as np
import jax
import jax.numpy as jnp
from flax.core.frozen_dict import freeze
from jax.experimental import PartitionSpec as P
from t5x.partitioning import PjitPartitioner
from t5x.train_state import InferenceState
from bloom_inference.modeling_bloom import FlaxBloomForCausalLM, BloomConfig
from trans... | bloom-jax-inference-main | sharding_example.py |
from setuptools import setup, find_packages
setup(
name='bloom_inference',
version='0.0.0',
packages=find_packages()
)
| bloom-jax-inference-main | setup.py |
import argparse
import time
import numpy as np
import jax
import jax.numpy as jnp
from jax.experimental import PartitionSpec as P
from t5x.partitioning import PjitPartitioner
from t5x.train_state import InferenceState
from t5x.checkpoints import Checkpointer
from bloom_inference.modeling_bloom import FlaxBloomForCau... | bloom-jax-inference-main | run_speed.py |
import functools
import os
import subprocess
import time
import glob
import requests
from fabric import Connection
@functools.lru_cache()
def get_bearer():
return subprocess.check_output("gcloud auth print-access-token", shell=True).decode("utf-8").strip()
@functools.lru_cache()
def get_project():
return s... | bloom-jax-inference-main | ray_tpu.py |
import numpy as np
import jax
import jax.numpy as jnp
from jax.experimental import PartitionSpec as P
from flax.core.frozen_dict import freeze
from t5x.partitioning import PjitPartitioner
from t5x.train_state import InferenceState
from t5x.checkpoints import Checkpointer
from bloom_inference.modeling_bloom import Fla... | bloom-jax-inference-main | checkpointer_example.py |
import os
import ray
import time
from queue import Queue
@ray.remote(resources={"tpu": 1})
# @ray.remote
class TPUHostWorker(object):
def __init__(
self,
ckpt="bigscience/bloom",
t5x_path="gs://bloom-jax-us-central2-b/bloom-176B-scan-t5x/checkpoint_0",
max_len=256,
max_inpu... | bloom-jax-inference-main | bloom_inference/host_worker.py |
bloom-jax-inference-main | bloom_inference/__init__.py | |
import warnings
import jax
import jax.numpy as jnp
from jax.experimental import PartitionSpec as P
from jax.experimental.compilation_cache import compilation_cache as cc
from t5x.partitioning import PjitPartitioner
from t5x.train_state import InferenceState
from t5x.checkpoints import Checkpointer
from transformers ... | bloom-jax-inference-main | bloom_inference/generator.py |
import time
import ray
import numpy as np
class TPUManager:
# @func_set_timeout(1200)
def __init__(
self,
node_count=8,
ckpt="bigscience/bloom",
t5x_path="gs://bloom-jax-us-central2-b/bloom-176B-scan-t5x/checkpoint_0",
max_len=256,
max_input_len=64,
model... | bloom-jax-inference-main | bloom_inference/tpu_manager.py |
# coding=utf-8
# Copyright 2021 The Google Flax Team Authors and The HuggingFace Inc. team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
... | bloom-jax-inference-main | bloom_inference/modeling_bloom/modeling_flax_utils.py |
# coding=utf-8
# Copyright 2021 The HuggingFace Inc. team
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable ... | bloom-jax-inference-main | bloom_inference/modeling_bloom/generation_flax_logits_process.py |
from .modeling_bloom import FlaxBloomForCausalLM
from .configuration_bloom import BloomConfig | bloom-jax-inference-main | bloom_inference/modeling_bloom/__init__.py |
# coding=utf-8
# Copyright 2022 the Big Science Workshop and 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/license... | bloom-jax-inference-main | bloom_inference/modeling_bloom/configuration_bloom.py |
# coding=utf-8
# Copyright 2021 The Google AI Flax Team Authors, and The HuggingFace Inc. team.
# Copyright (c) 2020, NVIDIA CORPORATION. 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 o... | bloom-jax-inference-main | bloom_inference/modeling_bloom/generation_flax_utils.py |
# coding=utf-8
# Copyright 2022 HuggingFace Inc. team and Bigscience Workshop. 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... | bloom-jax-inference-main | bloom_inference/modeling_bloom/modeling_bloom.py |
# Copyright 2022 The T5X Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... | bloom-jax-inference-main | bloom_inference/modeling_bloom/layers.py |
# Lint as: python3
""" HuggingFace/Datasets is an open library of datasets.
Note:
VERSION needs to be formatted following the MAJOR.MINOR.PATCH convention
(we need to follow this convention to be able to retrieve versioned scripts)
Simple check list for release from AllenNLP repo: https://github.com/allenai/al... | datasets-main | setup.py |
"""
Official evaluation script for ReCoRD v1.0.
(Some functions are adopted from the SQuAD evaluation script.)
"""
import argparse
import json
import re
import string
import sys
from collections import Counter
def normalize_answer(s):
"""Lower text and remove punctuation, articles and extra whitespace."""
... | datasets-main | metrics/super_glue/record_evaluation.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/super_glue/super_glue.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/indic_glue/indic_glue.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/bertscore/bertscore.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/glue/glue.py |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/code_eval/execute.py |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/code_eval/code_eval.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/coval/coval.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/seqeval/seqeval.py |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/sari/sari.py |
# Copyright 2021 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/spearmanr/spearmanr.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/xnli/xnli.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/meteor/meteor.py |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/competition_math/competition_math.py |
# Copyright 2021 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/matthews_correlation/matthews_correlation.py |
# coding=utf-8
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | datasets-main | metrics/mauve/mauve.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/cuad/cuad.py |
""" Official evaluation script for CUAD dataset. """
import argparse
import json
import re
import string
import sys
import numpy as np
IOU_THRESH = 0.5
def get_jaccard(prediction, ground_truth):
remove_tokens = [".", ",", ";", ":"]
for token in remove_tokens:
ground_truth = ground_truth.replace(t... | datasets-main | metrics/cuad/evaluate.py |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/wiki_split/wiki_split.py |
# Copyright 2021 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/cer/cer.py |
# Copyright 2021 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/cer/test_cer.py |
# Copyright 2022 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/mean_iou/mean_iou.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/sacrebleu/sacrebleu.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/google_bleu/google_bleu.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/bleu/bleu.py |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/accuracy/accuracy.py |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/recall/recall.py |
# Copyright 2022 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/xtreme_s/xtreme_s.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/comet/comet.py |
# Copyright 2021 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/ter/ter.py |
# Copyright 2022 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/perplexity/perplexity.py |
# Copyright 2021 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/pearsonr/pearsonr.py |
# Copyright 2022 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/mae/mae.py |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/roc_auc/roc_auc.py |
# Copyright 2022 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/mse/mse.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/squad_v2/squad_v2.py |
"""Official evaluation script for SQuAD version 2.0.
In addition to basic functionality, we also compute additional statistics and
plot precision-recall curves if an additional na_prob.json file is provided.
This file is expected to map question ID's to the model's predicted probability
that a question is unanswerable... | datasets-main | metrics/squad_v2/evaluate.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/squad/squad.py |
""" Official evaluation script for v1.1 of the SQuAD dataset. """
import argparse
import json
import re
import string
import sys
from collections import Counter
def normalize_answer(s):
"""Lower text and remove punctuation, articles and extra whitespace."""
def remove_articles(text):
return re.sub(r... | datasets-main | metrics/squad/evaluate.py |
# Copyright 2020 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/bleurt/bleurt.py |
# Copyright 2021 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/mahalanobis/mahalanobis.py |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/precision/precision.py |
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# 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.... | datasets-main | metrics/f1/f1.py |
# Copyright 2021 The HuggingFace Datasets Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | datasets-main | metrics/wer/wer.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.