mirror of
https://github.com/facebookresearch/fairseq.git
synced 2024-08-17 04:20:36 +03:00
fix imports referencing moved metrics.py file (#4840)
* fix imports referencing moved metrics.py file * Make representation computation branchless in TransformerEncoderBase (#4818) Summary: We want to make the computation branchless here because fairseq code may be exported and traced for deployment purposes, and tracing mechanisms can break the correctness for a captured program if it's dependent on input data. In this diff we try to rewrite the code to remove one branch so that tracer can proceed here and preserve the correct semantics of the model. Test Plan: CI Reviewers: Subscribers: Tasks: Tags: * Fix Torchscript typing in transformer_encoder.py (#4847) * Add Generative Spoken Dialogue Language Modeling (#4879) * Update deprecated torch.qr in glow.py example (#4685) torch.qr is deprecated for a long time and is being removed by https://github.com/pytorch/pytorch/pull/70989. This PR makes the example compatible with new and old PyTorch versions. * Emotion Conversion Paper Open Source (#4895) * data2vec v2.0 (#4903) data2v2c 2.0 Co-authored-by: Arun Babu <arbabu@fb.com> Co-authored-by: Wei-Ning Hsu <wnhsu@csail.mit.edu> * remove missing config entries when loading task from checkpoint (#4905) * make apex optional (#4906) * Add file to generate manifests for stop dataset. (#4891) * Update STOP dataset README to include proper link. (#4892) * Update README.md (#4893) * using foreach to reduce kernel (#4904) * using foreach to reduce kernel * set reproducibility to looser threshold * revert optimzer * update * update * update * update * update * update * update Co-authored-by: juntengjia <juntengjia@fb.com> * Update README.md to add data2vec blog post (#4913) * Update README.md * Update config to fix circleci failure (#4949) https://app.circleci.com/pipelines/github/fairinternal/fairseq-py/12635/workflows/3befbae2-79c4-458d-9fc4-aad4484183b4/jobs/26767 * Generative Spoken Dialogue Language Modeling Paper Open Source (#4957) * wav2vec2_laser (#4968) * ASR BLEU tool copied from ust branch into main (#4914) * Add transcript option for asr-bleu (#4981) --------- Co-authored-by: zhxchen17 <zhxchen17@outlook.com> Co-authored-by: zhxchen17 <zhxchen17@fb.com> Co-authored-by: Nguyen Tu Anh <nguyentuanh208@gmail.com> Co-authored-by: Sergii Dymchenko <kit1980@gmail.com> Co-authored-by: Felix Kreuk <felixkreuk@gmail.com> Co-authored-by: Alexei Baevski <alexei.b@gmail.com> Co-authored-by: padentomasello <pdtomasello@gmail.com> Co-authored-by: Junteng Jia <juntengjia@hotmail.com> Co-authored-by: juntengjia <juntengjia@fb.com> Co-authored-by: arbabu123 <arbabu@fb.com> Co-authored-by: dianaml0 <82468439+dianaml0@users.noreply.github.com> Co-authored-by: Pierre Andrews <mortimer@fb.com> Co-authored-by: Ilia Kulikov <kulikov@cs.nyu.edu> Co-authored-by: Xutai Ma <xutaima@gmail.com>
This commit is contained in:
parent
ad0e69cd99
commit
0338cdc309
@ -8,7 +8,7 @@ TODO (huxu): a general fairseq criterion for all your pre-defined losses.
|
||||
"""
|
||||
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq import metrics
|
||||
from fairseq.logging import metrics
|
||||
|
||||
|
||||
@register_criterion("mmloss")
|
||||
|
@ -7,7 +7,8 @@ import math
|
||||
from dataclasses import dataclass
|
||||
|
||||
import torch.nn.functional as F
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import register_criterion
|
||||
from fairseq.criterions.cross_entropy import CrossEntropyCriterion
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
|
@ -9,7 +9,8 @@ from dataclasses import dataclass, field
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.dataclass import ChoiceEnum, FairseqDataclass
|
||||
|
||||
|
@ -12,7 +12,7 @@ import os
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
from fairseq import metrics
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.data import (
|
||||
ConcatDataset,
|
||||
ConcatSentencesDataset,
|
||||
|
@ -7,7 +7,8 @@ import math
|
||||
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.criterions.label_smoothed_cross_entropy import label_smoothed_nll_loss
|
||||
|
||||
|
@ -5,7 +5,8 @@ import logging
|
||||
import math
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.criterions.ctc import CtcCriterion, CtcCriterionConfig
|
||||
from fairseq.criterions.label_smoothed_cross_entropy import (
|
||||
|
@ -6,9 +6,10 @@ import math
|
||||
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
from fairseq import utils
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.criterions.label_smoothed_cross_entropy import label_smoothed_nll_loss
|
||||
from fairseq import metrics, utils
|
||||
from fairseq.logging import metrics
|
||||
|
||||
|
||||
@register_criterion("guided_label_smoothed_cross_entropy_with_accuracy")
|
||||
|
@ -7,7 +7,8 @@ from dataclasses import dataclass, field
|
||||
import torch
|
||||
from omegaconf import II
|
||||
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.dataclass import ChoiceEnum
|
||||
from fairseq.tasks import register_task
|
||||
from fairseq.tasks.translation import TranslationConfig, TranslationTask
|
||||
|
@ -7,7 +7,8 @@ import math
|
||||
from dataclasses import dataclass
|
||||
|
||||
import torch.nn.functional as F
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
from fairseq.dataclass.constants import DDP_BACKEND_CHOICES
|
||||
|
@ -7,7 +7,8 @@ import math
|
||||
from dataclasses import dataclass
|
||||
|
||||
import torch.nn.functional as F
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
from omegaconf import II
|
||||
|
@ -12,7 +12,9 @@ from typing import Optional
|
||||
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
from fairseq import metrics, utils
|
||||
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
from fairseq.data.data_utils import post_process
|
||||
|
@ -6,7 +6,8 @@
|
||||
import inspect
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
from fairseq.dataclass.utils import gen_parser_from_dataclass
|
||||
from torch.nn.modules.loss import _Loss
|
||||
|
@ -11,7 +11,8 @@ from dataclasses import dataclass, field
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
from fairseq.data.data_utils import lengths_to_mask
|
||||
|
@ -10,7 +10,8 @@ from typing import List, Optional
|
||||
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
|
||||
|
@ -7,7 +7,8 @@ import math
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
import torch
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
from omegaconf import II
|
||||
|
@ -5,7 +5,8 @@
|
||||
|
||||
from dataclasses import dataclass, field
|
||||
import torch
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import register_criterion
|
||||
from fairseq.criterions.label_smoothed_cross_entropy import (
|
||||
LabelSmoothedCrossEntropyCriterion,
|
||||
|
@ -5,7 +5,8 @@
|
||||
|
||||
import math
|
||||
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import register_criterion
|
||||
|
||||
from .label_smoothed_cross_entropy import (
|
||||
|
@ -9,7 +9,8 @@ from dataclasses import dataclass, field
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import register_criterion
|
||||
from fairseq.criterions.label_smoothed_cross_entropy import (
|
||||
LabelSmoothedCrossEntropyCriterion,
|
||||
|
@ -8,7 +8,8 @@ from dataclasses import dataclass, field
|
||||
|
||||
import torch
|
||||
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import register_criterion
|
||||
from fairseq.criterions.label_smoothed_cross_entropy import (
|
||||
LabelSmoothedCrossEntropyCriterion,
|
||||
|
@ -7,7 +7,8 @@ import math
|
||||
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
|
||||
|
||||
|
@ -8,7 +8,8 @@ import math
|
||||
from omegaconf import II
|
||||
|
||||
import torch
|
||||
from fairseq import metrics, modules, utils
|
||||
from fairseq import modules, utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
|
||||
|
@ -9,7 +9,8 @@ from typing import Dict, List
|
||||
|
||||
import torch
|
||||
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
from fairseq.logging.meters import safe_round
|
||||
|
@ -7,7 +7,8 @@ import math
|
||||
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
from torch import Tensor
|
||||
|
@ -14,7 +14,7 @@ from sklearn.metrics import f1_score
|
||||
from sklearn.metrics import matthews_corrcoef as _matthews_corrcoef
|
||||
from scipy.stats import pearsonr, spearmanr
|
||||
|
||||
from fairseq import metrics
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
from fairseq.logging.meters import safe_round
|
||||
|
@ -7,7 +7,8 @@ import math
|
||||
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
|
||||
|
||||
|
@ -9,7 +9,8 @@ from collections import OrderedDict
|
||||
|
||||
import torch
|
||||
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import register_criterion
|
||||
from fairseq.criterions.ctc import CtcCriterion
|
||||
from fairseq.criterions.label_smoothed_cross_entropy_with_rdrop import (
|
||||
|
@ -7,7 +7,7 @@ import torch
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
import torch.nn.functional as F
|
||||
from fairseq import metrics
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.tasks import FairseqTask
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
|
@ -14,7 +14,8 @@ import torch
|
||||
import torch.nn.functional as F
|
||||
from omegaconf import II
|
||||
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.data.data_utils import lengths_to_mask
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
|
@ -9,7 +9,8 @@ from typing import List, Optional
|
||||
|
||||
import torch
|
||||
import torch.nn.functional as F
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
from fairseq.logging.meters import safe_round
|
||||
|
@ -5,7 +5,8 @@
|
||||
|
||||
import math
|
||||
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.criterions import FairseqCriterion, register_criterion
|
||||
|
||||
|
||||
|
@ -10,7 +10,8 @@ from argparse import Namespace
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import torch
|
||||
from fairseq import metrics, search, tokenizer, utils
|
||||
from fairseq import search, tokenizer, utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.data import Dictionary, FairseqDataset, data_utils, encoders, iterators
|
||||
from fairseq.dataclass import FairseqDataclass
|
||||
from fairseq.dataclass.utils import gen_parser_from_dataclass
|
||||
|
@ -10,7 +10,8 @@ from collections import OrderedDict
|
||||
from argparse import ArgumentError
|
||||
|
||||
import torch
|
||||
from fairseq import metrics, options, utils
|
||||
from fairseq import options, utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.data import (
|
||||
Dictionary,
|
||||
LanguagePairDataset,
|
||||
|
@ -20,7 +20,8 @@ import torch.nn as nn
|
||||
import torch.nn.functional as F
|
||||
|
||||
import fairseq
|
||||
from fairseq import metrics, options, utils
|
||||
from fairseq import options, utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.data import (
|
||||
FairseqDataset,
|
||||
LanguagePairDataset,
|
||||
|
@ -13,7 +13,8 @@ from argparse import Namespace
|
||||
from omegaconf import II
|
||||
|
||||
import numpy as np
|
||||
from fairseq import metrics, utils
|
||||
from fairseq import utils
|
||||
from fairseq.logging import metrics
|
||||
from fairseq.data import (
|
||||
AppendTokenDataset,
|
||||
ConcatDataset,
|
||||
|
@ -6,7 +6,7 @@
|
||||
import unittest
|
||||
import uuid
|
||||
|
||||
from fairseq import metrics
|
||||
from fairseq.logging import metrics
|
||||
|
||||
|
||||
class TestMetrics(unittest.TestCase):
|
||||
|
Loading…
Reference in New Issue
Block a user