SYMBOL INDEX (9202 symbols across 872 files) FILE: examples/MMPT/locallaunch.py class JobLauncher (line 14) | class JobLauncher(object): method __init__ (line 19) | def __init__(self, yaml_file): method __call__ (line 31) | def __call__(self, job_type=None, dryrun=False): class Pipeline (line 40) | class Pipeline(object): method __init__ (line 43) | def __init__(self, fn): method __getitem__ (line 78) | def __getitem__(self, idx): method __len__ (line 84) | def __len__(self): method _save_configs (line 87) | def _save_configs(self, configs_to_save: dict): method _overwrite_task (line 95) | def _overwrite_task(self, job_config): function main (line 125) | def main(args): FILE: examples/MMPT/mmpt/datasets/fairseqmmdataset.py class FairseqMMDataset (line 16) | class FairseqMMDataset(FairseqDataset): method __init__ (line 21) | def __init__(self, mmdataset): method set_epoch (line 26) | def set_epoch(self, epoch, **unused): method __getitem__ (line 30) | def __getitem__(self, idx): method __len__ (line 34) | def __len__(self): method collater (line 37) | def collater(self, samples): method size (line 51) | def size(self, index): method num_tokens (line 55) | def num_tokens(self, index): FILE: examples/MMPT/mmpt/datasets/mmdataset.py class MMDataset (line 16) | class MMDataset(Dataset): method __init__ (line 30) | def __init__( method __len__ (line 43) | def __len__(self): method __getitem__ (line 46) | def __getitem__(self, idx): method collater (line 57) | def collater(self, samples): method print_example (line 79) | def print_example(self, output): FILE: examples/MMPT/mmpt/evaluators/evaluator.py class Evaluator (line 13) | class Evaluator(object): method __init__ (line 20) | def __init__(self, config, eval_dataloader=None): method __call__ (line 31) | def __call__(self): method evaluate (line 48) | def evaluate(self, model, eval_dataloader=None, output_file="merged"): FILE: examples/MMPT/mmpt/evaluators/metric.py class Metric (line 10) | class Metric(object): method __init__ (line 11) | def __init__(self, config, metric_names): method best_metric (line 14) | def best_metric(self, metric): method save_metrics (line 17) | def save_metrics(self, fn, metrics): method print_computed_metrics (line 21) | def print_computed_metrics(self, metrics): class RetrievalMetric (line 25) | class RetrievalMetric(Metric): method __init__ (line 33) | def __init__(self, config, metric_names=["R1", "R5", "R10", "MR"]): method compute_metrics (line 37) | def compute_metrics(self, outputs, texts, **kwargs): method print_computed_metrics (line 60) | def print_computed_metrics(self, metrics): class DiDeMoMetric (line 74) | class DiDeMoMetric(Metric): method __init__ (line 82) | def __init__(self, config, metric_names=["rank1", "rank5", "miou"]): method compute_metrics (line 85) | def compute_metrics(self, outputs, targets, **kwargs): method print_computed_metrics (line 95) | def print_computed_metrics(self, metrics): method _iou (line 109) | def _iou(self, pred, gt): method _rank (line 114) | def _rank(self, pred, gt): method _eval_predictions (line 117) | def _eval_predictions(self, segments, data): class NLGMetric (line 145) | class NLGMetric(Metric): method __init__ (line 146) | def __init__( method compute_metrics (line 159) | def compute_metrics(self, outputs, targets, **kwargs): method print_computed_metrics (line 163) | def print_computed_metrics(self, metrics): class QAMetric (line 179) | class QAMetric(Metric): method __init__ (line 180) | def __init__( method compute_metrics (line 187) | def compute_metrics(self, outputs, targets, **kwargs): method print_computed_metrics (line 191) | def print_computed_metrics(self, metrics): class COINActionSegmentationMetric (line 195) | class COINActionSegmentationMetric(Metric): method __init__ (line 205) | def __init__(self, config, metric_name=["frame_acc"]): method compute_metrics (line 208) | def compute_metrics(self, outputs, targets): method print_computed_metrics (line 215) | def print_computed_metrics(self, metrics): class CrossTaskMetric (line 220) | class CrossTaskMetric(Metric): method __init__ (line 221) | def __init__(self, config, metric_names=["recall"]): method compute_metrics (line 224) | def compute_metrics(self, outputs, targets, **kwargs): method print_computed_metrics (line 237) | def print_computed_metrics(self, metrics): method _get_recalls (line 244) | def _get_recalls(self, Y_true, Y_pred): class ActionRecognitionMetric (line 262) | class ActionRecognitionMetric(Metric): method __init__ (line 263) | def __init__( method compute_metrics (line 270) | def compute_metrics(self, outputs, targets, splits, **kwargs): method print_computed_metrics (line 305) | def print_computed_metrics(self, metrics): FILE: examples/MMPT/mmpt/evaluators/predictor.py class Predictor (line 16) | class Predictor(object): method __init__ (line 21) | def __init__(self, config): method __call__ (line 27) | def __call__(self, outputs): method predict_loop (line 31) | def predict_loop(self, model, eval_dataloader, output_file=None): method finalize (line 44) | def finalize(self, output_file): method to_ctx (line 47) | def to_ctx(self, data, ctx=0, dtype=None): class NLGPredictor (line 59) | class NLGPredictor(Predictor): method __init__ (line 62) | def __init__(self, config): method predict_loop (line 72) | def predict_loop(self, model, eval_dataloader, output_file=None): method __call__ (line 84) | def __call__(self, data, model, outputs): method finalize (line 104) | def finalize(self, outputs, output_file=None): class RetrievalPredictor (line 112) | class RetrievalPredictor(Predictor): method __init__ (line 114) | def __init__(self, config): method predict_loop (line 120) | def predict_loop( method __call__ (line 153) | def __call__(self, sample, full_scores): method finalize (line 157) | def finalize(self, full_scores, texts, output_file=None): method _get_pooled_outputs (line 163) | def _get_pooled_outputs(self, outputs): method _append_scores (line 169) | def _append_scores(self, scores, full_scores): method _aggregate_scores (line 177) | def _aggregate_scores(self, scores): class QAPredictor (line 186) | class QAPredictor(Predictor): method __init__ (line 188) | def __init__(self, config): method predict_loop (line 192) | def predict_loop(self, model, eval_dataloader, output_file="qa.npy"): method __call__ (line 215) | def __call__(self, sample): method finalize (line 223) | def finalize(self, output_file=None): method _append_scores (line 229) | def _append_scores(self, scores, answers, full_scores): method _aggregate_scores (line 236) | def _aggregate_scores(self, scores): class CrossTaskPredictor (line 245) | class CrossTaskPredictor(Predictor): method __init__ (line 250) | def __init__(self, config): method predict_loop (line 258) | def predict_loop(self, model, eval_dataloader, output_file="result.pkl"): method __call__ (line 273) | def __call__(self, sample, model, Y_pred, Y_true): method finalize (line 316) | def finalize(self, Y_pred, Y_true, output_file=None): method _read_assignment (line 326) | def _read_assignment(self, T, K, path): class COINPredictor (line 350) | class COINPredictor(Predictor): method __init__ (line 354) | def __init__(self, config): method predict_loop (line 360) | def predict_loop(self, model, eval_dataloader, output_file="result.pkl"): method __call__ (line 375) | def __call__(self, sample, model, Y_pred, Y_true): method _merge_windows (line 383) | def _merge_windows(self, sample, output): method finalize (line 410) | def finalize(self, Y_pred, Y_true, output_file=None): class COINZSPredictor (line 429) | class COINZSPredictor(COINPredictor): method __init__ (line 434) | def __init__(self, config): method predict_loop (line 438) | def predict_loop(self, model, eval_dataloader, output_file="result.pkl"): method reshape_subsample (line 465) | def reshape_subsample(self, sample): method flat_subsample (line 471) | def flat_subsample(self, tensor): method __call__ (line 476) | def __call__(self, sample, label_hidden_states, model, lbd, Y_pred, Y_... method finalize (line 495) | def finalize(self, Y_pred, Y_true, output_file=None): class DiDeMoPredictor (line 514) | class DiDeMoPredictor(Predictor): method __init__ (line 518) | def __init__(self, config): method predict_loop (line 524) | def predict_loop(self, model, eval_dataloader, output_file="didemo.npy"): method __call__ (line 555) | def __call__(self, sample): method finalize (line 587) | def finalize(self, output_file=None): method _aggregate_scores (line 593) | def _aggregate_scores(self, scores): FILE: examples/MMPT/mmpt/losses/fairseqmmloss.py class MMCriterion (line 15) | class MMCriterion(FairseqCriterion): method __init__ (line 16) | def __init__(self, task): method forward (line 21) | def forward(self, model, sample): method reduce_metrics (line 48) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 57) | def logging_outputs_can_be_summed() -> bool: FILE: examples/MMPT/mmpt/losses/loss.py class Loss (line 8) | class Loss(object): method __call__ (line 9) | def __call__(self, *args, **kwargs): class DummyLoss (line 14) | class DummyLoss(Loss): method __init__ (line 15) | def __init__(self): method __call__ (line 18) | def __call__(self, logits, targets, **kwargs): class DummyK400Loss (line 22) | class DummyK400Loss(Loss): method __init__ (line 24) | def __init__(self): method __call__ (line 27) | def __call__(self, logits, targets, **kwargs): class CrossEntropy (line 32) | class CrossEntropy(Loss): method __init__ (line 33) | def __init__(self): method __call__ (line 36) | def __call__(self, logits, targets, **kwargs): class ArgmaxCrossEntropy (line 40) | class ArgmaxCrossEntropy(Loss): method __init__ (line 41) | def __init__(self): method __call__ (line 44) | def __call__(self, logits, targets, **kwargs): class BCE (line 48) | class BCE(Loss): method __init__ (line 49) | def __init__(self): method __call__ (line 52) | def __call__(self, logits, targets, **kwargs): class NLGLoss (line 57) | class NLGLoss(Loss): method __init__ (line 58) | def __init__(self): method __call__ (line 61) | def __call__(self, logits, text_label, **kwargs): class MSE (line 66) | class MSE(Loss): method __init__ (line 67) | def __init__(self): method __call__ (line 70) | def __call__(self, logits, targets, **kwargs): class L1 (line 74) | class L1(Loss): method __init__ (line 75) | def __init__(self): method __call__ (line 78) | def __call__(self, logits, targets, **kwargs): class SmoothL1 (line 82) | class SmoothL1(Loss): method __init__ (line 83) | def __init__(self): method __call__ (line 86) | def __call__(self, logits, targets, **kwargs): FILE: examples/MMPT/mmpt/losses/nce.py class NCE (line 17) | class NCE(Loss): method __init__ (line 18) | def __init__(self): method __call__ (line 22) | def __call__(self, align_scores, **kargs): class T2VContraLoss (line 42) | class T2VContraLoss(Loss): method __init__ (line 45) | def __init__(self): method __call__ (line 49) | def __call__(self, pooled_video, pooled_text, **kargs): class V2TContraLoss (line 59) | class V2TContraLoss(Loss): method __init__ (line 62) | def __init__(self): method __call__ (line 66) | def __call__(self, pooled_video, pooled_text, **kargs): class MMContraLoss (line 76) | class MMContraLoss(Loss): method __init__ (line 77) | def __init__(self): method __call__ (line 80) | def __call__(self, pooled_video, pooled_text, **kwargs): class MTM (line 93) | class MTM(Loss): method __init__ (line 96) | def __init__(self): method __call__ (line 99) | def __call__( class MFMMLM (line 129) | class MFMMLM(Loss): method __init__ (line 132) | def __init__(self): method __call__ (line 135) | def __call__( FILE: examples/MMPT/mmpt/models/fairseqmmmodel.py class FairseqMMModel (line 14) | class FairseqMMModel(BaseFairseqModel): method build_model (line 18) | def build_model(cls, args, task): method __init__ (line 21) | def __init__(self, mmmodel): method forward (line 25) | def forward(self, *args, **kwargs): method upgrade_state_dict_named (line 28) | def upgrade_state_dict_named(self, state_dict, name): function mmarch (line 50) | def mmarch(args): FILE: examples/MMPT/mmpt/models/mmfusion.py class MMPTModel (line 31) | class MMPTModel(nn.Module): method from_pretrained (line 35) | def from_pretrained(cls, config, checkpoint="checkpoint_best.pt"): method __init__ (line 60) | def __init__(self, config, model, video_encoder, **kwargs): method forward (line 66) | def forward(self, video_frames, caps, cmasks, return_score=False): class MMFusion (line 92) | class MMFusion(nn.Module): method __init__ (line 96) | def __init__(self, config, **kwargs): method forward (line 137) | def forward( method _mm_on_the_fly (line 149) | def _mm_on_the_fly( method _mm_attention_mask (line 180) | def _mm_attention_mask(self, cmasks, vmasks): method _make_iso_mask (line 212) | def _make_iso_mask(self, batch_size, cmasks, vmasks): method _pooling_vt_layer (line 258) | def _pooling_vt_layer( class MMFusionMFMMLM (line 297) | class MMFusionMFMMLM(MMFusion): method forward (line 299) | def forward( class MMFusionMTM (line 351) | class MMFusionMTM(MMFusionMFMMLM): method __init__ (line 352) | def __init__(self, config, **kwargs): class MMFusionShare (line 366) | class MMFusionShare(MMFusion): method forward (line 370) | def forward( method forward_video (line 398) | def forward_video( method forward_text (line 455) | def forward_text( class MMFusionSeparate (line 514) | class MMFusionSeparate(MMFusionShare): method forward_video (line 515) | def forward_video( method forward_text (line 572) | def forward_text( class MMFusionJoint (line 624) | class MMFusionJoint(MMFusion): method forward (line 627) | def forward( class MMFusionActionSegmentation (line 663) | class MMFusionActionSegmentation(MMFusion): method forward (line 667) | def forward( class MMFusionActionLocalization (line 705) | class MMFusionActionLocalization(MMFusion): method __init__ (line 708) | def __init__(self, config, **kwargs): method forward (line 716) | def forward( class MMFusionSeparateActionSegmentation (line 791) | class MMFusionSeparateActionSegmentation(MMFusionSeparate): method forward (line 793) | def forward( class MMFusionSeparateActionLocalization (line 817) | class MMFusionSeparateActionLocalization(MMFusionSeparate): method __init__ (line 818) | def __init__(self, config, **kwargs): method forward (line 826) | def forward( class MMFusionShareActionLocalization (line 873) | class MMFusionShareActionLocalization(MMFusionShare): method __init__ (line 874) | def __init__(self, config, **kwargs): method forward (line 882) | def forward( FILE: examples/MMPT/mmpt/models/mmfusionnlg.py class MMFusionNLG (line 43) | class MMFusionNLG(MMFusion): method __init__ (line 44) | def __init__(self, config, **kwargs): method forward (line 57) | def forward( method generate (line 82) | def generate( class MMBertForNLG (line 113) | class MMBertForNLG(BertPreTrainedModel): method __init__ (line 114) | def __init__(self, config): method get_output_embeddings (line 124) | def get_output_embeddings(self): method forward (line 127) | def forward( method prepare_inputs_for_generation (line 192) | def prepare_inputs_for_generation( method generate (line 220) | def generate( method _generate_beam_search (line 639) | def _generate_beam_search( method _generate_no_beam_search (line 899) | def _generate_no_beam_search( FILE: examples/MMPT/mmpt/models/transformermodel.py class MMBertForJoint (line 36) | class MMBertForJoint(BertPreTrainedModel): method __init__ (line 39) | def __init__(self, config): method forward (line 45) | def forward( class MMBertForTokenClassification (line 83) | class MMBertForTokenClassification(BertPreTrainedModel): method __init__ (line 87) | def __init__(self, config): method forward (line 96) | def forward( class MMBertForEncoder (line 136) | class MMBertForEncoder(BertPreTrainedModel): method __init__ (line 138) | def __init__(self, config): method forward (line 144) | def forward( class MMBertForMFMMLM (line 181) | class MMBertForMFMMLM(BertPreTrainedModel): method __init__ (line 183) | def __init__(self, config): method get_output_embeddings (line 191) | def get_output_embeddings(self): method forward (line 194) | def forward( class BertMFMMLMPredictionHead (line 282) | class BertMFMMLMPredictionHead(nn.Module): method __init__ (line 283) | def __init__(self, config): method forward (line 297) | def forward( class MFMMLMHead (line 325) | class MFMMLMHead(nn.Module): method __init__ (line 326) | def __init__(self, config): method forward (line 330) | def forward( class MMBertForMTM (line 346) | class MMBertForMTM(MMBertForMFMMLM): method __init__ (line 347) | def __init__(self, config): class BertMTMPredictionHead (line 356) | class BertMTMPredictionHead(nn.Module): method __init__ (line 357) | def __init__(self, config): method forward (line 363) | def forward( class MTMHead (line 406) | class MTMHead(nn.Module): method __init__ (line 407) | def __init__(self, config): method forward (line 411) | def forward( class MMBertModel (line 427) | class MMBertModel(BertModel): method __init__ (line 430) | def __init__(self, config, add_pooling_layer=True): method forward (line 437) | def forward( method get_extended_attention_mask (line 631) | def get_extended_attention_mask(self, attention_mask, input_shape, dev... class MultiLayerAttentionMaskBertEncoder (line 670) | class MultiLayerAttentionMaskBertEncoder(BertEncoder): method forward (line 674) | def forward( FILE: examples/MMPT/mmpt/modules/mm.py class VideoTokenMLP (line 32) | class VideoTokenMLP(nn.Module): method __init__ (line 33) | def __init__(self, config): method forward (line 41) | def forward(self, hidden_states): class MMBertEmbeddings (line 49) | class MMBertEmbeddings(BertEmbeddings): method __init__ (line 50) | def __init__(self, config): method forward (line 60) | def forward( class AlignHead (line 136) | class AlignHead(nn.Module): method __init__ (line 139) | def __init__(self, config): method forward (line 143) | def forward(self, dropout_pooled_output): FILE: examples/MMPT/mmpt/modules/retri.py class VectorRetriever (line 20) | class VectorRetriever(object): method __init__ (line 27) | def __init__(self, hidden_size, cent, db_type, examples_per_cent_to_tr... method make_direct_maps (line 45) | def make_direct_maps(self): method __len__ (line 48) | def __len__(self): method save (line 51) | def save(self, out_dir): method load (line 65) | def load(self, out_dir): method add (line 72) | def add(self, hidden_states, video_ids, last=False): method finalize_training (line 95) | def finalize_training(self): method search (line 107) | def search( method search_by_video_ids (line 139) | def search_by_video_ids( class VectorRetrieverDM (line 187) | class VectorRetrieverDM(VectorRetriever): method __init__ (line 195) | def __init__( method make_direct_maps (line 206) | def make_direct_maps(self): method search (line 210) | def search( method search_by_video_ids (line 244) | def search_by_video_ids( class MMVectorRetriever (line 291) | class MMVectorRetriever(VectorRetrieverDM): method __init__ (line 297) | def __init__(self, hidden_size, cent, db_type, examples_per_cent_to_tr... method __len__ (line 307) | def __len__(self): method make_direct_maps (line 311) | def make_direct_maps(self): method save (line 315) | def save(self, out_dir): method load (line 334) | def load(self, out_dir): method add (line 345) | def add(self, hidden_states, video_ids): method get_clips_by_video_id (line 376) | def get_clips_by_video_id(self, video_id): method search (line 383) | def search( FILE: examples/MMPT/mmpt/modules/vectorpool.py class VectorPool (line 12) | class VectorPool(object): method __init__ (line 17) | def __init__(self, config): method __call__ (line 23) | def __call__(self, sample, **kwargs): method build_retriver (line 26) | def build_retriver( method __repr__ (line 40) | def __repr__(self): class VideoVectorPool (line 49) | class VideoVectorPool(VectorPool): method __init__ (line 53) | def __init__(self, config): method __call__ (line 57) | def __call__(self, sample, subsampling, **kwargs): class DistributedVectorPool (line 78) | class DistributedVectorPool(VectorPool): method __init__ (line 82) | def __init__(self, config): method build_retriver (line 91) | def build_retriver( method load (line 122) | def load(self, local_rank): method save (line 137) | def save(self): class DistributedVideoVectorPool (line 164) | class DistributedVideoVectorPool(DistributedVectorPool): method __call__ (line 168) | def __call__(self, sample, subsampling, **kwargs): class TextClipVectorPool (line 189) | class TextClipVectorPool(VectorPool): method __init__ (line 190) | def __init__(self, config): method __call__ (line 197) | def __call__(self, sample, **kwargs): class MMClipVectorPool (line 212) | class MMClipVectorPool(VectorPool): method __init__ (line 216) | def __init__(self, out_dir): method __call__ (line 221) | def __call__(self, sample, **kwargs): FILE: examples/MMPT/mmpt/processors/dedupprocessor.py class CaptionDedupProcessor (line 14) | class CaptionDedupProcessor(object): method __init__ (line 38) | def __init__(self, pkl_file): method __call__ (line 49) | def __call__(self): method single (line 58) | def single(self, video_id): method finalize (line 74) | def finalize(self, tgt_fn): method save_stat (line 78) | def save_stat(self, video_id, caption): method print_stat (line 106) | def print_stat(self): method _dedup (line 119) | def _dedup(self, caption): function convert_to_pickle (line 221) | def convert_to_pickle(src_fn, tgt_fn): FILE: examples/MMPT/mmpt/processors/dsprocessor.py class DSAligner (line 31) | class DSAligner(Aligner): method __call__ (line 36) | def __call__(self, video_id, video_feature, text_feature, wps=0.7): class NLGTextProcessor (line 66) | class NLGTextProcessor(TextProcessor): method __call__ (line 70) | def __call__(self, text_id): class DSNLGAligner (line 74) | class DSNLGAligner(DSAligner): method __init__ (line 76) | def __init__(self, config): method __call__ (line 89) | def __call__(self, video_id, video_feature, text_feature): class MSRVTTMetaProcessor (line 120) | class MSRVTTMetaProcessor(MetaProcessor): method __init__ (line 125) | def __init__(self, config): method __len__ (line 146) | def __len__(self): method __getitem__ (line 149) | def __getitem__(self, idx): class MSRVTTTextProcessor (line 160) | class MSRVTTTextProcessor(TextProcessor): method __init__ (line 166) | def __init__(self, config): method __call__ (line 176) | def __call__(self, text_id): class MSRVTTNLGTextProcessor (line 186) | class MSRVTTNLGTextProcessor(MSRVTTTextProcessor): method __call__ (line 188) | def __call__(self, text_id): class MSRVTTQAMetaProcessor (line 198) | class MSRVTTQAMetaProcessor(MetaProcessor): method __init__ (line 204) | def __init__(self, config): method __len__ (line 221) | def __len__(self): method __getitem__ (line 224) | def __getitem__(self, idx): class MSRVTTQATextProcessor (line 228) | class MSRVTTQATextProcessor(TextProcessor): method __call__ (line 233) | def __call__(self, text_ans): class MSRVTTQAAligner (line 240) | class MSRVTTQAAligner(DSAligner): method __call__ (line 246) | def __call__(self, video_id, video_feature, text_feature, wps=0.7): class YoucookMetaProcessor (line 266) | class YoucookMetaProcessor(MetaProcessor): method __init__ (line 279) | def __init__(self, config): method __getitem__ (line 312) | def __getitem__(self, idx): class YoucookVideoProcessor (line 330) | class YoucookVideoProcessor(VideoProcessor): method __call__ (line 333) | def __call__(self, video_fn): class YoucookNLGMetaProcessor (line 339) | class YoucookNLGMetaProcessor(MetaProcessor): method __init__ (line 344) | def __init__(self, config): method __getitem__ (line 372) | def __getitem__(self, idx): class CrossTaskMetaProcessor (line 378) | class CrossTaskMetaProcessor(MetaProcessor): method __init__ (line 379) | def __init__(self, config): method __getitem__ (line 436) | def __getitem__(self, idx): method __len__ (line 443) | def __len__(self): method _random_split (line 446) | def _random_split(self, task_vids, test_tasks, n_train): method _get_vids (line 459) | def _get_vids(self, path, vfeat_dir, annotation_path): method _read_task_info (line 484) | def _read_task_info(self, path): method _get_A (line 506) | def _get_A(self, task_steps, share="words"): class CrossTaskVideoProcessor (line 546) | class CrossTaskVideoProcessor(VideoProcessor): method __call__ (line 547) | def __call__(self, video_fn): class CrossTaskTextProcessor (line 554) | class CrossTaskTextProcessor(TextProcessor): method __call__ (line 555) | def __call__(self, text_id): class CrossTaskAligner (line 565) | class CrossTaskAligner(Aligner): method __init__ (line 569) | def __init__(self, config): method __call__ (line 575) | def __call__(self, video_id, video_feature, text_feature): method _read_assignment (line 635) | def _read_assignment(self, T, K, path): class MetaTextBinarizer (line 661) | class MetaTextBinarizer(Aligner): method __call__ (line 662) | def __call__(self, text_feature): class COINActionSegmentationMetaProcessor (line 676) | class COINActionSegmentationMetaProcessor(MetaProcessor): method __init__ (line 683) | def __init__(self, config): method meta_text_labels (line 718) | def meta_text_labels(self, config): method __getitem__ (line 736) | def __getitem__(self, idx): class COINActionSegmentationTextProcessor (line 740) | class COINActionSegmentationTextProcessor(TextProcessor): method __call__ (line 741) | def __call__(self, text_label): class COINActionSegmentationAligner (line 745) | class COINActionSegmentationAligner(Aligner): method __init__ (line 746) | def __init__(self, config): method __call__ (line 751) | def __call__(self, video_id, video_feature, text_feature): class DiDeMoMetaProcessor (line 808) | class DiDeMoMetaProcessor(MetaProcessor): method __init__ (line 812) | def __init__(self, config): method __len__ (line 825) | def __len__(self): method __getitem__ (line 828) | def __getitem__(self, idx): class DiDeMoTextProcessor (line 832) | class DiDeMoTextProcessor(TextProcessor): method __call__ (line 837) | def __call__(self, text): class DiDeMoAligner (line 841) | class DiDeMoAligner(DSAligner): method __call__ (line 846) | def __call__(self, video_id, video_feature, text_feature): FILE: examples/MMPT/mmpt/processors/how2processor.py class How2MetaProcessor (line 39) | class How2MetaProcessor(MetaProcessor): method __init__ (line 40) | def __init__(self, config): method __getitem__ (line 46) | def __getitem__(self, idx): class ShardedHow2MetaProcessor (line 51) | class ShardedHow2MetaProcessor(How2MetaProcessor): method __init__ (line 52) | def __init__(self, config): method _init_shard (line 58) | def _init_shard(self): method __getitem__ (line 80) | def __getitem__(self, idx): class ShardedVideoProcessor (line 87) | class ShardedVideoProcessor(Processor): method __init__ (line 92) | def __init__(self, config): method __call__ (line 96) | def __call__(self, video_id): class ShardedTextProcessor (line 119) | class ShardedTextProcessor(Processor): method __init__ (line 120) | def __init__(self, config): method __call__ (line 124) | def __call__(self, video_id): class FixedLenAligner (line 147) | class FixedLenAligner(Aligner): method __init__ (line 165) | def __init__(self, config): method _get_text_maxlen (line 182) | def _get_text_maxlen(self): method __call__ (line 186) | def __call__(self, video_id, video_feature, text_feature): method sampling (line 216) | def sampling( class VariedLenAligner (line 269) | class VariedLenAligner(FixedLenAligner): method __init__ (line 270) | def __init__(self, config): method _get_text_maxlen (line 275) | def _get_text_maxlen(self): class StartClipAligner (line 279) | class StartClipAligner(VariedLenAligner): method sampling (line 280) | def sampling( class OverlappedAligner (line 292) | class OverlappedAligner(VariedLenAligner): method __init__ (line 295) | def __init__(self, config): method _get_video_maxlen (line 302) | def _get_video_maxlen(self): method sampling (line 306) | def sampling( class MFMMLMAligner (line 361) | class MFMMLMAligner(FixedLenAligner): method __init__ (line 366) | def __init__(self, config): method __call__ (line 385) | def __call__(self, video_id, video_feature, text_feature): method sampling (line 413) | def sampling( class FrameMaskingProcessor (line 452) | class FrameMaskingProcessor(Processor): method __init__ (line 453) | def __init__(self, config): method __call__ (line 458) | def __call__(self, vmasks, modality_masking=None, vfeats=None): class TextGenerationProcessor (line 487) | class TextGenerationProcessor(Processor): method __init__ (line 488) | def __init__(self, tokenizer): method __call__ (line 492) | def __call__(self, inputs): class TextMaskingProcessor (line 507) | class TextMaskingProcessor(Processor): method __init__ (line 508) | def __init__(self, config): method __call__ (line 522) | def __call__( method mask_input (line 602) | def mask_input(self, inputs, special_tokens_mask=None): method get_special_tokens_mask (line 636) | def get_special_tokens_mask( class TextClipSamplingProcessor (line 664) | class TextClipSamplingProcessor(Processor): method __init__ (line 665) | def __init__(self, max_text_len, keep_prob=1.0): method __call__ (line 670) | def __call__( class VideoClipSamplingProcessor (line 738) | class VideoClipSamplingProcessor(Processor): method __call__ (line 739) | def __call__(self, video_len, max_video_len, center): class How2MILNCEAligner (line 762) | class How2MILNCEAligner(FixedLenAligner): method __init__ (line 765) | def __init__(self, config): method sampling (line 773) | def sampling( method _get_video (line 807) | def _get_video(self, video_feature, start, end): method _get_text (line 812) | def _get_text(self, cap): method _find_nearest_candidates (line 831) | def _find_nearest_candidates(self, caption, ind): class PKLJSONStrTextProcessor (line 853) | class PKLJSONStrTextProcessor(TextProcessor): method __init__ (line 859) | def __init__(self, config, max_clip_text_len=96): method __call__ (line 870) | def __call__(self, video_id): FILE: examples/MMPT/mmpt/processors/how2retriprocessor.py class ShardedHow2VideoRetriMetaProcessor (line 15) | class ShardedHow2VideoRetriMetaProcessor(ShardedHow2MetaProcessor): method __init__ (line 16) | def __init__(self, config): method __len__ (line 24) | def __len__(self): method set_candidates (line 27) | def set_candidates(self, cands): method __getitem__ (line 33) | def __getitem__(self, idx): class ShardedVideoRetriVideoProcessor (line 43) | class ShardedVideoRetriVideoProcessor(ShardedVideoProcessor): method __call__ (line 47) | def __call__(self, sharded_video_idxs): class ShardedVideoRetriTextProcessor (line 56) | class ShardedVideoRetriTextProcessor(ShardedTextProcessor): method __call__ (line 60) | def __call__(self, sharded_video_idxs): class VideoRetriAligner (line 69) | class VideoRetriAligner(VariedLenAligner): method __call__ (line 71) | def __call__(self, sharded_video_idxs, video_features, text_features): class VideoRetriOverlappedAligner (line 86) | class VideoRetriOverlappedAligner(OverlappedAligner): method __call__ (line 88) | def __call__(self, sharded_video_idxs, video_features, text_features): FILE: examples/MMPT/mmpt/processors/models/s3dg.py class InceptionBlock (line 30) | class InceptionBlock(nn.Module): method __init__ (line 31) | def __init__( method forward (line 64) | def forward(self, input): class SelfGating (line 82) | class SelfGating(nn.Module): method __init__ (line 83) | def __init__(self, input_dim): method forward (line 87) | def forward(self, input_tensor): class STConv3D (line 96) | class STConv3D(nn.Module): method __init__ (line 97) | def __init__( method forward (line 149) | def forward(self, input): class MaxPool3dTFPadding (line 156) | class MaxPool3dTFPadding(th.nn.Module): method __init__ (line 157) | def __init__(self, kernel_size, stride=None, padding="SAME"): method _get_padding_shape (line 165) | def _get_padding_shape(self, filter_shape, stride): method forward (line 183) | def forward(self, inp): class Sentence_Embedding (line 189) | class Sentence_Embedding(nn.Module): method __init__ (line 190) | def __init__( method _zero_pad_tensor_token (line 209) | def _zero_pad_tensor_token(self, tensor, size): method _split_text (line 216) | def _split_text(self, sentence): method _words_to_token (line 220) | def _words_to_token(self, words): method _words_to_ids (line 230) | def _words_to_ids(self, x): method forward (line 234) | def forward(self, x): class S3D (line 243) | class S3D(nn.Module): method __init__ (line 244) | def __init__(self, dict_path, num_classes=512, gating=True, space_to_d... method _space_to_depth (line 301) | def _space_to_depth(self, input): method forward (line 310) | def forward(self, inputs): FILE: examples/MMPT/mmpt/processors/processor.py class Processor (line 8) | class Processor(object): method __call__ (line 13) | def __call__(self, **kwargs): class MetaProcessor (line 17) | class MetaProcessor(Processor): method __init__ (line 24) | def __init__(self, config): method __len__ (line 27) | def __len__(self): method __getitem__ (line 30) | def __getitem__(self, idx): method _get_split_path (line 33) | def _get_split_path(self, config): class TextProcessor (line 44) | class TextProcessor(Processor): method __init__ (line 53) | def __init__(self, config): method __call__ (line 61) | def __call__(self, text_id): class VideoProcessor (line 66) | class VideoProcessor(Processor): method __init__ (line 71) | def __init__(self, config): method __call__ (line 74) | def __call__(self, video_fn): class Aligner (line 83) | class Aligner(object): method __init__ (line 87) | def __init__(self, config): method __call__ (line 101) | def __call__(self, video_id, video_feature, text_feature): method _build_video_seq (line 104) | def _build_video_seq(self, video_feature, video_clips=None): method _build_text_seq (line 138) | def _build_text_seq(self, text_feature, text_clip_indexs=None): method batch_post_processing (line 165) | def batch_post_processing(self, batch, video_feature): class MMAttentionMask2DProcessor (line 169) | class MMAttentionMask2DProcessor(Processor): method __call__ (line 173) | def __call__(self, vmask, cmask, mtype): method _build_mm_mask (line 181) | def _build_mm_mask(self, vmask, cmask): method _build_videogeneration_mask (line 185) | def _build_videogeneration_mask(self, vmask, cmask): method _build_textgeneration_mask (line 233) | def _build_textgeneration_mask(self, vmask, cmask): FILE: examples/MMPT/mmpt/tasks/fairseqmmtask.py class FairseqMMTask (line 20) | class FairseqMMTask(LegacyFairseqTask): method add_args (line 22) | def add_args(parser): method setup_task (line 32) | def setup_task(cls, args, **kwargs): method __init__ (line 35) | def __init__(self, args): method load_dataset (line 43) | def load_dataset(self, split, **kwargs): method get_batch_iterator (line 54) | def get_batch_iterator( method source_dictionary (line 99) | def source_dictionary(self): method target_dictionary (line 103) | def target_dictionary(self): FILE: examples/MMPT/mmpt/tasks/milncetask.py class MILNCETask (line 11) | class MILNCETask(Task): method reshape_subsample (line 12) | def reshape_subsample(self, sample): FILE: examples/MMPT/mmpt/tasks/retritask.py class RetriTask (line 28) | class RetriTask(Task): method reshape_subsample (line 31) | def reshape_subsample(self, sample): method flat_subsample (line 37) | def flat_subsample(self, tensor): method build_dataloader (line 42) | def build_dataloader(self): method retrive_candidates (line 73) | def retrive_candidates(self, epoch, dataloader=None): class VideoRetriTask (line 105) | class VideoRetriTask(RetriTask): method reshape_subsample (line 108) | def reshape_subsample(self, sample): method flat_subsample (line 119) | def flat_subsample(self, tensor): method _retri_predict (line 124) | def _retri_predict(self, epoch, dataloader): method _retri_sync (line 139) | def _retri_sync(self, epoch, out_dir): class VideoPredictor (line 154) | class VideoPredictor(Predictor): method __init__ (line 155) | def __init__(self, config): method predict_loop (line 159) | def predict_loop( method __call__ (line 174) | def __call__(self, sample, model, **kwargs): method finalize (line 195) | def finalize(self): class VideoRetriPredictor (line 202) | class VideoRetriPredictor(Predictor): method __init__ (line 208) | def __init__(self, config): method predict_loop (line 215) | def predict_loop( method finalize (line 247) | def finalize(self, batched_videos, epoch): FILE: examples/MMPT/mmpt/tasks/task.py class Task (line 14) | class Task(object): method config_task (line 20) | def config_task(cls, config): method __init__ (line 32) | def __init__(self, config): method build_dataset (line 42) | def build_dataset(self): method build_model (line 96) | def build_model(self, checkpoint=None): method load_checkpoint (line 104) | def load_checkpoint(self, checkpoint): method _trim_state_dict (line 115) | def _trim_state_dict(self, state_dict): method build_loss (line 133) | def build_loss(self): method flat_subsample (line 139) | def flat_subsample(self, tensor): method reshape_subsample (line 150) | def reshape_subsample(self, sample): method __call__ (line 161) | def __call__(self, model, sample): method build_dataloader (line 182) | def build_dataloader(self): FILE: examples/MMPT/mmpt/tasks/vlmtask.py class VLMTask (line 10) | class VLMTask(Task): method flat_subsample (line 17) | def flat_subsample(self, tensor): FILE: examples/MMPT/mmpt/utils/__init__.py function set_seed (line 13) | def set_seed(seed=43211): function get_world_size (line 23) | def get_world_size(): function get_local_rank (line 31) | def get_local_rank(): function print_on_rank0 (line 36) | def print_on_rank0(func): class RetriMeter (line 42) | class RetriMeter(object): method __init__ (line 46) | def __init__(self, freq=1024): method __call__ (line 52) | def __call__(self, data): method __repr__ (line 66) | def __repr__(self): FILE: examples/MMPT/mmpt/utils/load_config.py function load_config (line 10) | def load_config(args=None, config_file=None, overwrite_fairseq=False): function recursive_config (line 55) | def recursive_config(config_path): function suffix_rundir (line 66) | def suffix_rundir(save_dir, run_dir): function overwrite_dir (line 76) | def overwrite_dir(config, replace, basedir): FILE: examples/MMPT/mmpt/utils/shardedtensor.py class ShardedTensor (line 10) | class ShardedTensor(object): method __init__ (line 11) | def __init__(self, data, starts): method from_list (line 20) | def from_list(xs): method __getitem__ (line 29) | def __getitem__(self, i): method __len__ (line 32) | def __len__(self): method lengths (line 35) | def lengths(self): method save (line 38) | def save(self, path): method load (line 43) | def load(path, mmap_mode=None): FILE: examples/MMPT/mmpt_cli/localjob.py class BaseJob (line 10) | class BaseJob(object): method __init__ (line 11) | def __init__(self, yaml_file, dryrun=False): method submit (line 16) | def submit(self, **kwargs): method _normalize_cmd (line 19) | def _normalize_cmd(self, cmd_list): class LocalJob (line 26) | class LocalJob(BaseJob): method __init__ (line 49) | def __init__(self, yaml_file, job_type=None, dryrun=False): method submit (line 61) | def submit(self): class JobStatus (line 91) | class JobStatus(object): method __init__ (line 92) | def __init__(self, job_id): method __repr__ (line 95) | def __repr__(self): method __str__ (line 98) | def __str__(self): method done (line 101) | def done(self): method running (line 104) | def running(self): method result (line 107) | def result(self): method stderr (line 113) | def stderr(self): method stdout (line 116) | def stdout(self): FILE: examples/MMPT/mmpt_cli/predict.py function get_dataloader (line 22) | def get_dataloader(config): function main (line 53) | def main(args): FILE: examples/MMPT/scripts/text_token_extractor/pretokenization.py class TokenizerDataset (line 16) | class TokenizerDataset(Dataset): method __init__ (line 17) | def __init__(self, config): method __getitem__ (line 21) | def __getitem__(self, idx): method __len__ (line 25) | def __len__(self): function numpify (line 29) | def numpify(shard_idx, video_ids, captions, target_dir, split, prefix, m... function sharding (line 57) | def sharding(config, out_file): function tokenize (line 76) | def tokenize(config, out_file): function main (line 91) | def main(args): FILE: examples/MMPT/scripts/video_feature_extractor/model.py class GlobalAvgPool (line 8) | class GlobalAvgPool(nn.Module): method __init__ (line 9) | def __init__(self): method forward (line 12) | def forward(self, x): function get_model (line 16) | def get_model(args): FILE: examples/MMPT/scripts/video_feature_extractor/pathbuilder.py class PathBuilder (line 17) | class PathBuilder(object): method build (line 19) | def build(cls, video_dirs, feature_dir, ext, shards=0, split=None): FILE: examples/MMPT/scripts/video_feature_extractor/preprocessing.py class Normalize (line 6) | class Normalize(object): method __init__ (line 8) | def __init__(self, mean, std): method __call__ (line 12) | def __call__(self, tensor): class Preprocessing (line 16) | class Preprocessing(object): method __init__ (line 18) | def __init__(self, type): method _zero_pad (line 27) | def _zero_pad(self, tensor, size): method __call__ (line 35) | def __call__(self, tensor): FILE: examples/MMPT/scripts/video_feature_extractor/random_sequence_shuffler.py class RandomSequenceSampler (line 8) | class RandomSequenceSampler(Sampler): method __init__ (line 10) | def __init__(self, n_sample, seq_len): method _pad_ind (line 14) | def _pad_ind(self, ind): method __iter__ (line 19) | def __iter__(self): method __len__ (line 28) | def __len__(self): FILE: examples/MMPT/scripts/video_feature_extractor/shard_feature.py class Shard (line 12) | class Shard(object): method __init__ (line 13) | def __init__( method __call__ (line 31) | def __call__(self, split="train"): FILE: examples/MMPT/scripts/video_feature_extractor/videoreader.py class VideoLoader (line 14) | class VideoLoader(Dataset): method __init__ (line 16) | def __init__( method __len__ (line 38) | def __len__(self): method _get_video_dim (line 41) | def _get_video_dim(self, video_path): method _get_video_info (line 49) | def _get_video_info(self, video_path): method _get_output_dim (line 55) | def _get_output_dim(self, h, w): method __getitem__ (line 63) | def __getitem__(self, idx): method _decode (line 68) | def _decode(self, output_file, video_path): method _run (line 101) | def _run(self, cmd, output_file): class VideoVerifier (line 113) | class VideoVerifier(VideoLoader): method __getitem__ (line 114) | def __getitem__(self, idx): class VideoCompressor (line 123) | class VideoCompressor(VideoLoader): method __init__ (line 124) | def __init__( method _run (line 145) | def _run(self, cmd, output_file): class VideoDownloader (line 154) | class VideoDownloader(VideoCompressor): method __getitem__ (line 156) | def __getitem__(self, idx): class AvKeyframeVideoCompressor (line 170) | class AvKeyframeVideoCompressor(VideoLoader): method __init__ (line 174) | def __init__( method _get_video_dim (line 187) | def _get_video_dim(self, video_fn): method _get_output_dim (line 195) | def _get_output_dim(self, height, width): method __getitem__ (line 204) | def __getitem__(self, idx): FILE: examples/adaptive_span/adagrad_with_grad_clip.py class FairseqAdagradWithGradClip (line 12) | class FairseqAdagradWithGradClip(LegacyFairseqOptimizer): method __init__ (line 13) | def __init__(self, args, params): method add_args (line 18) | def add_args(parser): method optimizer_config (line 28) | def optimizer_config(self): method supports_flat_params (line 42) | def supports_flat_params(self): function _clip_grad (line 46) | def _clip_grad(clr, grad, group_grad_clip): class AdagradWithGradClip (line 54) | class AdagradWithGradClip(Adagrad): method __init__ (line 57) | def __init__( method step (line 77) | def step(self, closure=None): FILE: examples/adaptive_span/adaptive_span_attention.py class AdaptiveMask (line 12) | class AdaptiveMask(nn.Module): method __init__ (line 24) | def __init__(self, max_size, ramp_size, init_val=0, shape=(1,)): method forward (line 32) | def forward(self, x): method get_current_max_size (line 42) | def get_current_max_size(self, include_ramp=True): method get_current_avg_size (line 49) | def get_current_avg_size(self, include_ramp=True): method clamp_param (line 58) | def clamp_param(self): class AdaptiveSpan (line 63) | class AdaptiveSpan(nn.Module): method __init__ (line 75) | def __init__( method forward (line 102) | def forward(self, attn, normalize=True): method get_trim_len (line 116) | def get_trim_len(self): method trim_memory (line 124) | def trim_memory(self, query, key, value, key_pe): method get_cache_size (line 142) | def get_cache_size(self): method get_loss (line 149) | def get_loss(self): method get_current_max_span (line 153) | def get_current_max_span(self): method get_current_avg_span (line 156) | def get_current_avg_span(self): method clamp_param (line 159) | def clamp_param(self): FILE: examples/adaptive_span/adaptive_span_loss.py class AdaptiveSpanCriterionConfig (line 19) | class AdaptiveSpanCriterionConfig(FairseqDataclass): class AdaptiveSpanCriterion (line 24) | class AdaptiveSpanCriterion(CrossEntropyCriterion): method __init__ (line 25) | def __init__(self, task, sentence_avg): method forward (line 28) | def forward(self, model, sample, reduce=True): method compute_loss (line 58) | def compute_loss(self, model, net_output, sample, reduce=True): method reduce_metrics (line 66) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 101) | def logging_outputs_can_be_summed() -> bool: FILE: examples/adaptive_span/adaptive_span_model.py function _skew (line 21) | def _skew(X, pad_value): function _unskew (line 32) | def _unskew(X): class SeqAttention (line 44) | class SeqAttention(nn.Module): method __init__ (line 50) | def __init__(self, d_model, n_head, attn_span, dropout, adapt_span_lay... method forward (line 62) | def forward(self, query, key, value, key_pe): method get_cache_size (line 90) | def get_cache_size(self): class MultiHeadSeqAttention (line 94) | class MultiHeadSeqAttention(nn.Module): method __init__ (line 95) | def __init__(self, d_model, n_head, **kargs): method head_reshape (line 110) | def head_reshape(self, x): method forward (line 118) | def forward(self, query, key, value, key_pe): class FeedForwardLayer (line 139) | class FeedForwardLayer(nn.Module): method __init__ (line 140) | def __init__(self, d_model, d_inner, dropout, **kargs): method forward (line 148) | def forward(self, h): class TransformerSeqLayer (line 155) | class TransformerSeqLayer(nn.Module): method __init__ (line 156) | def __init__(self, d_model, **kargs): method forward (line 163) | def forward(self, h, h_cache, key_pe): method get_cache_size (line 176) | def get_cache_size(self): class TransformerSeq (line 180) | class TransformerSeq(nn.Module): method __init__ (line 181) | def __init__( method forward (line 218) | def forward(self, x, h_cache, target=None): method get_aux_loss (line 245) | def get_aux_loss(self): method get_current_max_span (line 251) | def get_current_max_span(self): method get_current_avg_span (line 259) | def get_current_avg_span(self): FILE: examples/adaptive_span/adaptive_span_model_wrapper.py class AdaptiveSpanSmallConfig (line 24) | class AdaptiveSpanSmallConfig(FairseqDataclass): class AdaptiveSpanTransformer (line 41) | class AdaptiveSpanTransformer(FairseqLanguageModel): method build_model (line 43) | def build_model(cls, cfg: AdaptiveSpanSmallConfig, task): method get_aux_loss (line 46) | def get_aux_loss(self): method get_current_max_span (line 49) | def get_current_max_span(self): method get_current_avg_span (line 52) | def get_current_avg_span(self): class AdaptiveSpanDecoder (line 56) | class AdaptiveSpanDecoder(FairseqIncrementalDecoder): method __init__ (line 57) | def __init__(self, cfg, task): method forward (line 81) | def forward( method max_positions (line 104) | def max_positions(self): method init_hid_cache (line 107) | def init_hid_cache(self, batch_sz): method get_aux_loss (line 121) | def get_aux_loss(self): method get_current_max_span (line 124) | def get_current_max_span(self): method get_current_avg_span (line 127) | def get_current_avg_span(self): method reorder_incremental_state (line 130) | def reorder_incremental_state( FILE: examples/attention_head_selection/src/data/speech_to_text_dataset_with_domain.py class SpeechToTextDatasetItemWithDomain (line 29) | class SpeechToTextDatasetItemWithDomain(SpeechToTextDatasetItem): class SpeechToTextDatasetWithDomain (line 35) | class SpeechToTextDatasetWithDomain(SpeechToTextDataset): method __init__ (line 37) | def __init__( method __getitem__ (line 73) | def __getitem__(self, index: int) -> SpeechToTextDatasetItemWithDomain: method collater (line 86) | def collater( class SpeechToTextDatasetCreatorWithDomain (line 105) | class SpeechToTextDatasetCreatorWithDomain(SpeechToTextDatasetCreator): method _from_list (line 112) | def _from_list( method _load_samples_from_tsv (line 159) | def _load_samples_from_tsv( method _from_tsv (line 183) | def _from_tsv( method from_tsv (line 208) | def from_tsv( FILE: examples/attention_head_selection/src/loss/attention_head_selection.py class HeadSelectionLoss (line 12) | class HeadSelectionLoss(_Loss): method __init__ (line 14) | def __init__(self, args): method forward (line 19) | def forward(self, head_samples, sample_sizes, prior=0.5, eps=1e-7): FILE: examples/attention_head_selection/src/models/head_selection_s2t_transformer.py class HeadSelectionS2TTransformerModel (line 31) | class HeadSelectionS2TTransformerModel(S2TTransformerModel): method __init__ (line 35) | def __init__(self, encoder, decoder): method add_args (line 39) | def add_args(parser): method build_encoder (line 80) | def build_encoder(cls, args): method build_decoder (line 99) | def build_decoder(cls, args, task, embed_tokens): class HeadSelectionS2TTransformerEncoder (line 106) | class HeadSelectionS2TTransformerEncoder(S2TTransformerEncoder): method __init__ (line 108) | def __init__(self, args): method set_task_ids (line 122) | def set_task_ids(self, task_ids): method _forward (line 125) | def _forward(self, src_tokens, src_lengths, return_all_hiddens=False): class HeadSelectionTransformerDecoderScriptable (line 130) | class HeadSelectionTransformerDecoderScriptable(HeadSelectionTransformer... method extract_features (line 131) | def extract_features( function base_architecture (line 153) | def base_architecture(args): function head_selection_s2t_transformer_s (line 164) | def head_selection_s2t_transformer_s(args): FILE: examples/attention_head_selection/src/models/head_selection_transformer.py class HeadSelectionTransformerModel (line 25) | class HeadSelectionTransformerModel(TransformerModel): method __init__ (line 26) | def __init__(self, args, encoder, decoder): method add_args (line 30) | def add_args(parser): method build_encoder (line 71) | def build_encoder(cls, args, src_dict, embed_tokens): method build_decoder (line 80) | def build_decoder(cls, args, tgt_dict, embed_tokens): class HeadSelectionTransformerEncoder (line 89) | class HeadSelectionTransformerEncoder(TransformerEncoder): method __init__ (line 91) | def __init__(self, args, dictionary, embed_tokens): method set_task_ids (line 111) | def set_task_ids(self, task_ids): method build_encoder_layer (line 114) | def build_encoder_layer(self, args, layer_idx=None): method forward (line 121) | def forward( class HeadSelectionTransformerDecoder (line 132) | class HeadSelectionTransformerDecoder(TransformerDecoder): method __init__ (line 134) | def __init__( method set_task_ids (line 177) | def set_task_ids(self, task_ids): method build_head_selection_decoder_layer (line 180) | def build_head_selection_decoder_layer(self, args, no_encoder_attn=Fal... method forward (line 189) | def forward( FILE: examples/attention_head_selection/src/modules/attn_head_selector.py class AttnHeadSelector (line 9) | class AttnHeadSelector(nn.Module): method __init__ (line 13) | def __init__( method gumbel_sample (line 36) | def gumbel_sample(self, logits, tau=1.0): method subset_select (line 43) | def subset_select(self, y_soft, topk, dim=-1): method group_selet (line 48) | def group_selet(self, y_soft, topk, dim=-1): method head_select (line 57) | def head_select(self, task_ids=None): method forward (line 77) | def forward(self, layer_idx): FILE: examples/attention_head_selection/src/modules/head_selection_transformer_layer.py class HeadSelectionTransformerEncoderLayer (line 11) | class HeadSelectionTransformerEncoderLayer(TransformerEncoderLayer): method __init__ (line 13) | def __init__(self, args, layer_idx, attn_head_selector=None): method build_self_attention_selection (line 20) | def build_self_attention_selection(self, embed_dim, args, attn_head_se... class HeadSelectionTransformerDecoderLayer (line 34) | class HeadSelectionTransformerDecoderLayer(TransformerDecoderLayer): method __init__ (line 36) | def __init__( method build_self_attention_selection (line 61) | def build_self_attention_selection( method build_encoder_attention_selection (line 79) | def build_encoder_attention_selection(self, embed_dim, args, enc_attn_... FILE: examples/attention_head_selection/src/modules/multihead_attention_selection.py class MultiheadAttentionSelection (line 17) | class MultiheadAttentionSelection(MultiheadAttention): method __init__ (line 19) | def __init__( method forward (line 71) | def forward( FILE: examples/attention_head_selection/src/modules/multihead_functional.py function _scaled_dot_product_attention (line 19) | def _scaled_dot_product_attention( function _in_projection (line 59) | def _in_projection( function multi_head_attention_forward (line 73) | def multi_head_attention_forward( FILE: examples/attention_head_selection/src/speech_to_text_head_selection.py class SpeechToTextHeadSelectionTask (line 16) | class SpeechToTextHeadSelectionTask(SpeechToTextTask): method add_args (line 19) | def add_args(cls, parser): method __init__ (line 34) | def __init__(self, args, tgt_dict): method map_task_to_id (line 43) | def map_task_to_id(self, train_subset): method load_dataset (line 65) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method build_model (line 85) | def build_model(self, args): method get_sample_sizes (line 90) | def get_sample_sizes(self, sample, task_ids, num_tasks): method train_step (line 102) | def train_step( method valid_step (line 149) | def valid_step(self, sample, model, criterion): method inference_step (line 164) | def inference_step( FILE: examples/audio_nlp/nlu/generate_manifests.py function get_insl_frame (line 5) | def get_insl_frame(parse): function sequencify_utterance (line 22) | def sequencify_utterance(utterance): function generate_fairseq_manifests (line 30) | def generate_fairseq_manifests(manifest, output_path, audio_root=None): function main (line 64) | def main(args): FILE: examples/backtranslation/deduplicate_lines.py function get_hashes_and_lines (line 14) | def get_hashes_and_lines(raw_line): function main (line 19) | def main(): FILE: examples/backtranslation/extract_bt_data.py function main (line 13) | def main(): FILE: examples/bart/summarize.py function generate (line 15) | def generate(bart, infile, outfile="bart_hypo.txt", bsz=32, n_obs=None, ... function main (line 43) | def main(): FILE: examples/byte_level_bpe/get_bitext.py function _convert_xml (line 26) | def _convert_xml(in_path: str, out_path: str): function _convert_train (line 37) | def _convert_train(in_path: str, out_path: str): function _get_bytes (line 46) | def _get_bytes(in_path: str, out_path: str): function _get_chars (line 52) | def _get_chars(in_path: str, out_path: str): function pretokenize (line 58) | def pretokenize(in_path: str, out_path: str, src: str, tgt: str): function _convert_to_bchar (line 80) | def _convert_to_bchar(in_path_prefix: str, src: str, tgt: str, out_path:... function _get_bpe (line 88) | def _get_bpe(in_path: str, model_prefix: str, vocab_size: int): function _apply_bbpe (line 101) | def _apply_bbpe(model_path: str, in_path: str, out_path: str): function _apply_bpe (line 110) | def _apply_bpe(model_path: str, in_path: str, out_path: str): function _concat_files (line 119) | def _concat_files(in_paths: List[str], out_path: str): function preprocess_iwslt17 (line 127) | def preprocess_iwslt17( function main (line 213) | def main(): FILE: examples/byte_level_bpe/gru_transformer.py class GRUTransformerModel (line 18) | class GRUTransformerModel(TransformerModel): method build_encoder (line 20) | def build_encoder(cls, args, src_dict, embed_tokens): class GRUTransformerEncoder (line 24) | class GRUTransformerEncoder(TransformerEncoder): method __init__ (line 25) | def __init__(self, args, dictionary, embed_tokens): method forward_embedding (line 34) | def forward_embedding(self, src_tokens): function gru_transformer_base_architecture (line 53) | def gru_transformer_base_architecture(args): function gru_transformer_big (line 98) | def gru_transformer_big(args): FILE: examples/constrained_decoding/normalize.py function main (line 13) | def main(args): FILE: examples/constrained_decoding/tok.py function main (line 13) | def main(args): FILE: examples/criss/mining/mine.py function call (line 22) | def call(cmd): function get_batches (line 27) | def get_batches(directory, lang, prefix="all_avg_pool"): function load_batch (line 39) | def load_batch(emb_file, dim): function knnGPU_sharded (line 47) | def knnGPU_sharded(x_batches_f, y_batches_f, dim, k, direction="x2y"): function score (line 93) | def score(sim, fwd_mean, bwd_mean, margin): function score_candidates (line 97) | def score_candidates( function load_text (line 109) | def load_text(files): FILE: examples/criss/save_encoder.py function get_avg_pool (line 17) | def get_avg_pool( function main (line 43) | def main(args): function cli_main (line 200) | def cli_main(): FILE: examples/criss/sentence_retrieval/encoder_analysis.py function compute_dist (line 15) | def compute_dist(source_embs, target_embs, k=5, return_sim_mat=False): function load_embeddings (line 35) | def load_embeddings(directory, LANGS): function compute_accuracy (line 58) | def compute_accuracy(directory, LANGS): FILE: examples/data2vec/data/add_class_target_dataset.py class AddClassTargetDataset (line 11) | class AddClassTargetDataset(BaseWrapperDataset): method __init__ (line 12) | def __init__( method __getitem__ (line 33) | def __getitem__(self, index): method collater (line 51) | def collater(self, samples): FILE: examples/data2vec/data/image_dataset.py class ImageDataset (line 24) | class ImageDataset(FairseqDataset, VisionDataset): method __init__ (line 25) | def __init__( method __getitem__ (line 71) | def __getitem__(self, index): method __len__ (line 92) | def __len__(self): method collater (line 95) | def collater(self, samples): method num_tokens (line 113) | def num_tokens(self, index): method size (line 116) | def size(self, index): method ordered_indices (line 119) | def ordered_indices(self): FILE: examples/data2vec/data/mae_finetuning_image_dataset.py function build_transform (line 27) | def build_transform(is_train, input_size, color_jitter, aa, reprob, remo... class MaeFinetuningImageDataset (line 66) | class MaeFinetuningImageDataset(FairseqDataset): method __init__ (line 67) | def __init__( method __getitem__ (line 96) | def __getitem__(self, index): method __len__ (line 100) | def __len__(self): method collater (line 103) | def collater(self, samples): method num_tokens (line 121) | def num_tokens(self, index): method size (line 124) | def size(self, index): method ordered_indices (line 127) | def ordered_indices(self): FILE: examples/data2vec/data/mae_image_dataset.py function load (line 29) | def load(path, loader, cache): function caching_loader (line 56) | def caching_loader(cache_root: str, loader): class RandomResizedCropAndInterpolationWithTwoPic (line 70) | class RandomResizedCropAndInterpolationWithTwoPic: method __init__ (line 85) | def __init__( method _pil_interp (line 123) | def _pil_interp(self, method): method get_params (line 137) | def get_params(img, scale, ratio): method __call__ (line 179) | def __call__(self, img): class MaeImageDataset (line 204) | class MaeImageDataset(FairseqDataset): method __init__ (line 205) | def __init__( method __getitem__ (line 328) | def __getitem__(self, index): method __len__ (line 374) | def __len__(self): method collater (line 377) | def collater(self, samples): method num_tokens (line 400) | def num_tokens(self, index): method size (line 403) | def size(self, index): method sizes (line 407) | def sizes(self): method ordered_indices (line 410) | def ordered_indices(self): FILE: examples/data2vec/data/modality.py class Modality (line 11) | class Modality(Enum): FILE: examples/data2vec/data/path_dataset.py class PathDataset (line 15) | class PathDataset(VisionDataset): method __init__ (line 16) | def __init__( method __len__ (line 49) | def __len__(self) -> int: method __getitem__ (line 52) | def __getitem__(self, idx) -> Tuple[np.ndarray, np.ndarray]: FILE: examples/data2vec/fb_convert_beit_cp.py function get_parser (line 23) | def get_parser(): function update_checkpoint (line 37) | def update_checkpoint(model_dict, prefix, is_nested): function main (line 81) | def main(): FILE: examples/data2vec/models/audio_classification.py class AudioClassificationConfig (line 33) | class AudioClassificationConfig(FairseqDataclass): class AudioClassificationModel (line 190) | class AudioClassificationModel(BaseFairseqModel): method __init__ (line 191) | def __init__(self, cfg: AudioClassificationConfig, num_classes): method upgrade_state_dict_named (line 310) | def upgrade_state_dict_named(self, state_dict, name): method build_model (line 315) | def build_model(cls, cfg: AudioClassificationConfig, task: FairseqTask): method load_model_weights (line 322) | def load_model_weights(self, state, model, cfg): method set_num_updates (line 355) | def set_num_updates(self, num_updates): method compute_gain (line 360) | def compute_gain(self, sound, fs=16_000, min_db=-80.0, mode="A_weighti... method compute_gain_torch (line 405) | def compute_gain_torch(self, sound, fs=16_000, min_db=-80.0, mode="A_w... method forward (line 458) | def forward(self, source, padding_mask, label=None, **kwargs): FILE: examples/data2vec/models/data2vec2.py class D2vModalitiesConfig (line 56) | class D2vModalitiesConfig(FairseqDataclass): class Data2VecMultiConfig (line 63) | class Data2VecMultiConfig(FairseqDataclass): class Data2VecMultiModel (line 151) | class Data2VecMultiModel(BaseFairseqModel): method make_modality_encoder (line 152) | def make_modality_encoder( method __init__ (line 183) | def __init__(self, cfg: Data2VecMultiConfig, modalities, skip_ema=Fals... method _init_weights (line 272) | def _init_weights(self, m): method make_ema_teacher (line 292) | def make_ema_teacher(self, ema_decay): method make_target_model (line 308) | def make_target_model(self): method set_num_updates (line 332) | def set_num_updates(self, num_updates): method state_dict (line 358) | def state_dict(self, destination=None, prefix="", keep_vars=False): method _load_from_state_dict (line 366) | def _load_from_state_dict(self, state_dict, prefix, *args, **kwargs): method build_model (line 378) | def build_model(cls, cfg: Data2VecMultiConfig, task=None): method forward (line 394) | def forward( method forward_decoder (line 691) | def forward_decoder( method d2v_loss (line 703) | def d2v_loss(self, x, y): method make_targets (line 721) | def make_targets(self, y, num_layers): method compute_var (line 767) | def compute_var(y): method extract_features (line 783) | def extract_features( method remove_pretraining_modules (line 796) | def remove_pretraining_modules(self, modality=None, keep_decoder=False): FILE: examples/data2vec/models/data2vec_audio.py class Data2VecAudioConfig (line 37) | class Data2VecAudioConfig(Wav2Vec2Config): function get_annealed_rate (line 87) | def get_annealed_rate(start, end, curr_step, total_steps): class Data2VecAudioModel (line 94) | class Data2VecAudioModel(BaseFairseqModel): method __init__ (line 95) | def __init__(self, cfg: Data2VecAudioConfig): method make_ema_teacher (line 149) | def make_ema_teacher(self): method set_num_updates (line 166) | def set_num_updates(self, num_updates): method state_dict (line 189) | def state_dict(self, destination=None, prefix="", keep_vars=False): method _load_from_state_dict (line 197) | def _load_from_state_dict(self, state_dict, prefix, *args, **kwargs): method build_model (line 206) | def build_model(cls, cfg: Data2VecAudioConfig, task=None): method apply_mask (line 211) | def apply_mask( method _get_feat_extract_output_lengths (line 281) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method forward (line 298) | def forward( method compute_var (line 503) | def compute_var(y): method extract_features (line 519) | def extract_features( method remove_pretraining_modules (line 531) | def remove_pretraining_modules(self, last_layer=None): FILE: examples/data2vec/models/data2vec_image_classification.py class Data2VecImageClassificationConfig (line 30) | class Data2VecImageClassificationConfig(FairseqDataclass): class Data2VecImageClassificationModel (line 45) | class Data2VecImageClassificationModel(BaseFairseqModel): method __init__ (line 46) | def __init__(self, cfg: Data2VecImageClassificationConfig): method load_model_weights (line 95) | def load_model_weights(self, state, model, cfg): method build_model (line 101) | def build_model(cls, cfg: Data2VecImageClassificationConfig, task=None): method forward (line 106) | def forward( FILE: examples/data2vec/models/data2vec_text.py class Data2VecTextConfig (line 32) | class Data2VecTextConfig(FairseqDataclass): function get_annealed_rate (line 77) | def get_annealed_rate(start, end, curr_step, total_steps): class Data2VecTextModel (line 84) | class Data2VecTextModel(FairseqEncoderModel): method __init__ (line 85) | def __init__(self, cfg: Data2VecTextConfig, encoder): method build_model (line 95) | def build_model(cls, cfg, task): method forward (line 102) | def forward( method get_normalized_probs (line 127) | def get_normalized_probs(self, net_output, log_probs, sample=None): method register_classification_head (line 135) | def register_classification_head( method supported_targets (line 158) | def supported_targets(self): method upgrade_state_dict_named (line 161) | def upgrade_state_dict_named(self, state_dict, name): method remove_pretraining_modules (line 265) | def remove_pretraining_modules(self, last_layer=None): class Data2VecTextEncoder (line 280) | class Data2VecTextEncoder(FairseqEncoder): method __init__ (line 281) | def __init__(self, cfg: Data2VecTextConfig, dictionary, task_data): method build_embedding (line 314) | def build_embedding(self, vocab_size, embedding_dim, padding_idx): method build_encoder (line 317) | def build_encoder(self, cfg, dictionary, embed_tokens): method build_lm_head (line 322) | def build_lm_head(self, embed_dim, output_dim, activation_fn, weight): method make_ema_teacher (line 325) | def make_ema_teacher(self): method set_num_updates (line 352) | def set_num_updates(self, num_updates): method state_dict (line 373) | def state_dict(self, destination=None, prefix="", keep_vars=False): method _load_from_state_dict (line 379) | def _load_from_state_dict(self, state_dict, prefix, *args, **kwargs): method forward (line 387) | def forward( method extract_features (line 498) | def extract_features(self, src_tokens, return_all_hiddens=False, **kwa... method output_layer (line 512) | def output_layer(self, features, masked_tokens=None, **unused): method max_positions (line 515) | def max_positions(self): FILE: examples/data2vec/models/data2vec_text_classification.py class Data2VecTextClassificationConfig (line 33) | class Data2VecTextClassificationConfig(FairseqDataclass): class Data2VecTextClassificationModel (line 49) | class Data2VecTextClassificationModel(BaseFairseqModel): method __init__ (line 50) | def __init__(self, cfg: Data2VecTextClassificationConfig): method load_model_weights (line 79) | def load_model_weights(self, state, model, cfg): method build_model (line 91) | def build_model(cls, cfg: Data2VecTextClassificationConfig, task=None): method register_classification_head (line 96) | def register_classification_head( method forward (line 122) | def forward( FILE: examples/data2vec/models/data2vec_vision.py class Data2VecVisionConfig (line 33) | class Data2VecVisionConfig(FairseqDataclass): function get_annealed_rate (line 91) | def get_annealed_rate(start, end, curr_step, total_steps): class Data2VecVisionModel (line 98) | class Data2VecVisionModel(BaseFairseqModel): method __init__ (line 99) | def __init__(self, cfg: Data2VecVisionConfig): method make_ema_teacher (line 137) | def make_ema_teacher(self): method set_num_updates (line 147) | def set_num_updates(self, num_updates): method state_dict (line 170) | def state_dict(self, destination=None, prefix="", keep_vars=False): method _load_from_state_dict (line 178) | def _load_from_state_dict(self, state_dict, prefix, *args, **kwargs): method build_model (line 187) | def build_model(cls, cfg: Data2VecVisionConfig, task=None): method make_mask (line 192) | def make_mask(self, bsz, num_masks, min_masks, max_masks): method forward (line 240) | def forward( method compute_var (line 349) | def compute_var(y): method remove_pretraining_modules (line 365) | def remove_pretraining_modules(self, last_layer=None): class PatchEmbed (line 376) | class PatchEmbed(nn.Module): method __init__ (line 379) | def __init__(self, img_size=224, patch_size=16, in_chans=3, embed_dim=... method forward (line 395) | def forward(self, x): class Attention (line 401) | class Attention(nn.Module): method __init__ (line 402) | def __init__( method forward (line 471) | def forward(self, x, rel_pos_bias=None): class RelativePositionBias (line 520) | class RelativePositionBias(nn.Module): method __init__ (line 521) | def __init__(self, window_size, num_heads): method forward (line 555) | def forward(self): class DropPath (line 571) | class DropPath(nn.Module): method __init__ (line 574) | def __init__(self, drop_prob=None): method forward (line 578) | def forward(self, x): method extra_repr (line 590) | def extra_repr(self) -> str: class Block (line 594) | class Block(nn.Module): method __init__ (line 595) | def __init__( method forward (line 638) | def forward(self, x, rel_pos_bias=None): class TransformerEncoder (line 653) | class TransformerEncoder(nn.Module): method __init__ (line 654) | def __init__(self, cfg: Data2VecVisionConfig, patch_shape): method init_weights (line 685) | def init_weights(self, m): method fix_init_weight (line 699) | def fix_init_weight(self): method extract_features (line 707) | def extract_features(self, x, layer_results): method forward (line 721) | def forward(self, x, layer_results=None): FILE: examples/data2vec/models/mae.py class MaeConfig (line 36) | class MaeConfig(FairseqDataclass): function modify_relative_position_bias (line 75) | def modify_relative_position_bias(orig_bias, bsz, mask): class AltBlock (line 103) | class AltBlock(nn.Module): method __init__ (line 104) | def __init__( method forward (line 172) | def forward(self, x, rel_pos_bias=None, pos_mask=None): class AltAttention (line 203) | class AltAttention(nn.Module): method __init__ (line 204) | def __init__( method forward (line 274) | def forward(self, x, rel_pos_bias=None, pos_mask=None): class RelativePositionBias (line 324) | class RelativePositionBias(nn.Module): method __init__ (line 325) | def __init__(self, window_size, num_heads): method forward (line 359) | def forward(self): function get_2d_sincos_pos_embed (line 370) | def get_2d_sincos_pos_embed(embed_dim, grid_size, cls_token=False): function get_2d_sincos_pos_embed_from_grid (line 388) | def get_2d_sincos_pos_embed_from_grid(embed_dim, grid): function get_1d_sincos_pos_embed_from_grid (line 399) | def get_1d_sincos_pos_embed_from_grid(embed_dim, pos): function interpolate_pos_embed (line 420) | def interpolate_pos_embed(model, checkpoint_model): class MaeModel (line 454) | class MaeModel(BaseFairseqModel): method __init__ (line 455) | def __init__(self, cfg: MaeConfig): method initialize_weights (line 611) | def initialize_weights(self): method _init_weights (line 645) | def _init_weights(self, m): method patchify (line 655) | def patchify(self, imgs): method unpatchify (line 669) | def unpatchify(self, x): method random_masking (line 683) | def random_masking(self, x, mask_ratio): method build_model (line 713) | def build_model(cls, cfg: MaeConfig, task=None): method forward_encoder (line 718) | def forward_encoder(self, x, mask_ratio): method forward_decoder (line 749) | def forward_decoder(self, x, ids_restore): method forward_loss (line 786) | def forward_loss(self, imgs, pred, mask): method forward (line 804) | def forward(self, imgs, predictions_only=False): method remove_pretraining_modules (line 821) | def remove_pretraining_modules(self): FILE: examples/data2vec/models/mae_image_classification.py class PredictionMode (line 33) | class PredictionMode(Enum): class MaeImageClassificationConfig (line 40) | class MaeImageClassificationConfig(FairseqDataclass): function get_layer_id_for_vit (line 80) | def get_layer_id_for_vit(name, num_layers): class MaeImageClassificationModel (line 98) | class MaeImageClassificationModel(BaseFairseqModel): method __init__ (line 99) | def __init__(self, cfg: MaeImageClassificationConfig): method build_model (line 305) | def build_model(cls, cfg: MaeImageClassificationConfig, task=None): method forward (line 310) | def forward( method model_forward (line 370) | def model_forward(self, imgs): FILE: examples/data2vec/models/modalities/audio.py class D2vAudioConfig (line 25) | class D2vAudioConfig(D2vModalityConfig): class AudioEncoder (line 50) | class AudioEncoder(ModalitySpecificEncoder): method __init__ (line 54) | def __init__( method convert_padding_mask (line 142) | def convert_padding_mask(self, x, padding_mask): method reset_parameters (line 186) | def reset_parameters(self): FILE: examples/data2vec/models/modalities/base.py class D2vModalityConfig (line 27) | class D2vModalityConfig: class ModalitySpecificEncoder (line 75) | class ModalitySpecificEncoder(nn.Module): method __init__ (line 76) | def __init__( method upgrade_state_dict_named (line 148) | def upgrade_state_dict_named(self, state_dict, name): method convert_padding_mask (line 155) | def convert_padding_mask(self, x, padding_mask): method decoder_input (line 158) | def decoder_input(self, x, mask_info: MaskInfo): method local_features (line 190) | def local_features(self, features): method contextualized_features (line 205) | def contextualized_features( method forward (line 332) | def forward( method reset_parameters (line 353) | def reset_parameters(self): method compute_mask (line 356) | def compute_mask( method make_maskinfo (line 413) | def make_maskinfo(self, x, mask, shape=None): method apply_mask (line 443) | def apply_mask(self, x, mask_info): method remove_pretraining_modules (line 473) | def remove_pretraining_modules(self, keep_decoder=False): function get_annealed_rate (line 478) | def get_annealed_rate(start, end, curr_step, total_steps): function random_masking (line 487) | def random_masking(x, mask_ratio, mask_seed: Optional[MaskSeed]): function gather_unmasked (line 523) | def gather_unmasked(x: torch.Tensor, mask_info: MaskInfo) -> torch.Tensor: function gather_unmasked_mask (line 531) | def gather_unmasked_mask(x: torch.Tensor, mask_info: MaskInfo) -> torch.... function get_alibi (line 539) | def get_alibi( function get_alibi_bias (line 608) | def get_alibi_bias( function _learned_alibi_bias (line 646) | def _learned_alibi_bias( function masked_alibi (line 667) | def masked_alibi(alibi_bias, mask_info): FILE: examples/data2vec/models/modalities/images.py class D2vImageConfig (line 33) | class D2vImageConfig(D2vModalityConfig): class ImageEncoder (line 50) | class ImageEncoder(ModalitySpecificEncoder): method __init__ (line 54) | def __init__( method reset_parameters (line 159) | def reset_parameters(self): method patchify (line 165) | def patchify(self, imgs): method unpatchify (line 179) | def unpatchify(self, x): method compute_mask (line 193) | def compute_mask( method decoder_input (line 234) | def decoder_input(self, x, mask_info): FILE: examples/data2vec/models/modalities/modules.py class D2vDecoderConfig (line 20) | class D2vDecoderConfig: class FixedPositionalEncoder (line 35) | class FixedPositionalEncoder(nn.Module): method __init__ (line 36) | def __init__(self, pos_embed): method forward (line 40) | def forward(self, x, padding_mask): class TextFeatPositionalEncoder (line 44) | class TextFeatPositionalEncoder(nn.Module): method __init__ (line 50) | def __init__(self, pos_encoder): method forward (line 54) | def forward(self, x, padding_mask): class BlockEncoder (line 60) | class BlockEncoder(nn.Module): method __init__ (line 61) | def __init__(self, blocks, norm_layer, layer_norm_first, layerdrop, dr... method forward (line 69) | def forward(self, x, padding_mask, alibi_bias, alibi_scale): class DecoderBase (line 97) | class DecoderBase(nn.Module): method __init__ (line 100) | def __init__(self, cfg: D2vDecoderConfig): method reset_parameters (line 105) | def reset_parameters(self): method add_residual (line 110) | def add_residual(self, x, residual, i, mask_info): class Decoder1d (line 123) | class Decoder1d(DecoderBase): method __init__ (line 124) | def __init__(self, cfg: D2vDecoderConfig, input_dim): method forward (line 165) | def forward(self, x, mask_info): class Decoder2d (line 181) | class Decoder2d(DecoderBase): method __init__ (line 182) | def __init__(self, cfg: D2vDecoderConfig, input_dim, h_size, w_size): method forward (line 215) | def forward(self, x, mask_info): class TransformerDecoder (line 232) | class TransformerDecoder(nn.Module): method __init__ (line 235) | def __init__(self, cfg: D2vDecoderConfig, input_dim, encoder): method reset_parameters (line 246) | def reset_parameters(self): method forward (line 251) | def forward(self, x, mask_info): class AltBlock (line 258) | class AltBlock(nn.Module): method __init__ (line 259) | def __init__( method forward (line 306) | def forward(self, x, padding_mask=None, alibi_bias=None): class AltAttention (line 326) | class AltAttention(nn.Module): method __init__ (line 327) | def __init__( method forward (line 354) | def forward(self, x, padding_mask=None, alibi_bias=None): class EncDecAttention (line 399) | class EncDecAttention(nn.Module): method __init__ (line 400) | def __init__( method forward (line 429) | def forward(self, q, kv, padding_mask=None, alibi_bias=None): class EncDecBlock (line 479) | class EncDecBlock(nn.Module): method __init__ (line 480) | def __init__( method forward (line 529) | def forward(self, q, kv, padding_mask=None, alibi_bias=None): class EncDecTransformerDecoder (line 546) | class EncDecTransformerDecoder(nn.Module): method __init__ (line 547) | def __init__(self, cfg: D2vDecoderConfig, input_dim): method reset_parameters (line 578) | def reset_parameters(self): method forward (line 583) | def forward(self, x, kv): FILE: examples/data2vec/models/modalities/text.py class D2vTextConfig (line 22) | class D2vTextConfig(D2vModalityConfig): class TextEncoder (line 33) | class TextEncoder(ModalitySpecificEncoder): method __init__ (line 37) | def __init__( method reset_parameters (line 95) | def reset_parameters(self): method convert_padding_mask (line 98) | def convert_padding_mask(self, x, padding_mask): class TextLocalEncoder (line 118) | class TextLocalEncoder(nn.Module): method __init__ (line 119) | def __init__( method forward (line 153) | def forward(self, src_tokens): FILE: examples/data2vec/models/utils.py function get_alibi (line 4) | def get_alibi( function masked_alibi (line 44) | def masked_alibi(alibi_bias, mask_indices, orig_B, orig_T): FILE: examples/data2vec/scripts/convert_audioset_labels.py function get_parser (line 11) | def get_parser(): function main (line 23) | def main(): FILE: examples/data2vec/scripts/text/glue_lr.py function get_best_stat_str (line 21) | def get_best_stat_str(task_vals, show_subdir): function get_all_stat_str (line 46) | def get_all_stat_str(task_vals): function get_tabular_stat_str (line 54) | def get_tabular_stat_str(task_vals): function main (line 78) | def main(): FILE: examples/data2vec/scripts/text/unprocess_data.py function load_dictionary (line 7) | def load_dictionary(dict_path): function load_dataset (line 10) | def load_dataset(split_path, src_dict): function load_bpe (line 20) | def load_bpe(enc_path): function detokenize (line 26) | def detokenize(tokens, src_dict, idx2bpe): function _main (line 32) | def _main(src_root, src_dict_path, src_bpe_path, src_splits, tgt_root, t... function main_pt (line 47) | def main_pt(): function main_ft (line 71) | def main_ft(): FILE: examples/data2vec/scripts/text/valids.py function main (line 34) | def main(args, print_output): FILE: examples/data2vec/tasks/audio_classification.py class AudioClassificationConfig (line 28) | class AudioClassificationConfig(AudioPretrainingConfig): class AudioClassificationTask (line 34) | class AudioClassificationTask(AudioPretrainingTask): method __init__ (line 39) | def __init__( method load_labels (line 47) | def load_labels(self): method labels (line 62) | def labels(self): method load_dataset (line 65) | def load_dataset( method calculate_stats (line 95) | def calculate_stats(self, output, target): method valid_step (line 143) | def valid_step(self, sample, model, criterion): method reduce_metrics (line 147) | def reduce_metrics(self, logging_outputs, criterion): FILE: examples/data2vec/tasks/image_classification.py class ImageClassificationConfig (line 37) | class ImageClassificationConfig(ImagePretrainingConfig): class ImageClassificationTask (line 42) | class ImageClassificationTask(ImagePretrainingTask): method setup_task (line 47) | def setup_task(cls, cfg: ImageClassificationConfig, **kwargs): method load_dataset (line 50) | def load_dataset(self, split: str, task_cfg: FairseqDataclass = None, ... method build_model (line 108) | def build_model(self, model_cfg: FairseqDataclass, from_checkpoint=Fal... method reduce_metrics (line 118) | def reduce_metrics(self, logging_outputs, criterion): FILE: examples/data2vec/tasks/image_pretraining.py class ImagePretrainingConfig (line 44) | class ImagePretrainingConfig(FairseqDataclass): class ImagePretrainingTask (line 52) | class ImagePretrainingTask(FairseqTask): method setup_task (line 58) | def setup_task(cls, cfg: ImagePretrainingConfig, **kwargs): method load_dataset (line 67) | def load_dataset(self, split: str, task_cfg: FairseqDataclass = None, ... method source_dictionary (line 101) | def source_dictionary(self): method target_dictionary (line 105) | def target_dictionary(self): method max_positions (line 108) | def max_positions(self): FILE: examples/data2vec/tasks/mae_image_classification.py class MaeImageClassificationConfig (line 30) | class MaeImageClassificationConfig(FairseqDataclass): class MaeImageClassificationTask (line 39) | class MaeImageClassificationTask(FairseqTask): method setup_task (line 45) | def setup_task(cls, cfg: MaeImageClassificationConfig, **kwargs): method load_dataset (line 54) | def load_dataset(self, split: str, task_cfg: FairseqDataclass = None, ... method build_model (line 67) | def build_model(self, model_cfg: FairseqDataclass, from_checkpoint=Fal... method reduce_metrics (line 77) | def reduce_metrics(self, logging_outputs, criterion): method source_dictionary (line 91) | def source_dictionary(self): method target_dictionary (line 95) | def target_dictionary(self): method max_positions (line 98) | def max_positions(self): FILE: examples/data2vec/tasks/mae_image_pretraining.py class ImageMaskingConfig (line 29) | class ImageMaskingConfig: class MaeImagePretrainingConfig (line 42) | class MaeImagePretrainingConfig(FairseqDataclass): class MaeImagePretrainingTask (line 63) | class MaeImagePretrainingTask(FairseqTask): method setup_task (line 69) | def setup_task(cls, cfg: MaeImagePretrainingConfig, **kwargs): method load_dataset (line 78) | def load_dataset(self, split: str, task_cfg: FairseqDataclass = None, ... method source_dictionary (line 110) | def source_dictionary(self): method target_dictionary (line 114) | def target_dictionary(self): method max_positions (line 117) | def max_positions(self): FILE: examples/data2vec/tasks/multimodal.py class MultimodalPretrainingConfig (line 30) | class MultimodalPretrainingConfig(FairseqDataclass): class MultimodalPretrainingTask (line 47) | class MultimodalPretrainingTask(FairseqTask): method __init__ (line 52) | def __init__(self, cfg: MultimodalPretrainingConfig): method setup_task (line 65) | def setup_task(cls, cfg: MultimodalPretrainingConfig, **kwargs): method load_dataset (line 74) | def load_dataset(self, split: str, task_cfg: FairseqDataclass = None, ... method supported_modalities (line 100) | def supported_modalities(self): method get_batch_iterator (line 111) | def get_batch_iterator( method source_dictionary (line 156) | def source_dictionary(self): method target_dictionary (line 160) | def target_dictionary(self): method max_positions (line 163) | def max_positions(self): FILE: examples/discriminative_reranking_nmt/criterions/discriminative_reranking_criterion.py class KLDivergenceRerankingCriterionConfig (line 23) | class KLDivergenceRerankingCriterionConfig(FairseqDataclass): class KLDivergenceRerankingCriterion (line 43) | class KLDivergenceRerankingCriterion(FairseqCriterion): method __init__ (line 44) | def __init__( method forward (line 52) | def forward(self, model, sample, reduce=True): method compute_kl_loss (line 106) | def compute_kl_loss(self, logits, target): method reduce_metrics (line 121) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 133) | def logging_outputs_can_be_summed() -> bool: FILE: examples/discriminative_reranking_nmt/drnmt_rerank.py function init_loaded_scores (line 33) | def init_loaded_scores(mt_scores, model_scores, hyp, ref): function parse_fairseq_gen (line 41) | def parse_fairseq_gen(filename, task): function read_target (line 70) | def read_target(filename): function make_batches (line 76) | def make_batches(args, src, hyp, task, max_positions, encode_fn): function decode_rerank_scores (line 113) | def decode_rerank_scores(args): function get_score (line 174) | def get_score(mt_s, md_s, w1, lp, tgt_len): function get_best_hyps (line 178) | def get_best_hyps(mt_scores, md_scores, hypos, fw_weight, lenpen, beam): function eval_metric (line 199) | def eval_metric(args, hypos, ref): function score_target_hypo (line 208) | def score_target_hypo(args, fw_weight, lp): function print_result (line 224) | def print_result(best_scores, best_hypos, output_file): function main (line 229) | def main(args): function cli_main (line 309) | def cli_main(): FILE: examples/discriminative_reranking_nmt/models/discriminative_reranking_model.py function update_init_roberta_model_state (line 28) | def update_init_roberta_model_state(state): class BaseRanker (line 49) | class BaseRanker(nn.Module): method __init__ (line 50) | def __init__(self, args, task): method forward (line 56) | def forward(self, src_tokens): method get_segment_labels (line 59) | def get_segment_labels(self, src_tokens): method get_positions (line 69) | def get_positions(self, src_tokens, segment_labels): class BertRanker (line 96) | class BertRanker(BaseRanker): method __init__ (line 97) | def __init__(self, args, task): method forward (line 224) | def forward(self, src_tokens, src_lengths): method sentence_forward (line 237) | def sentence_forward(self, encoder_out, src_tokens=None, sentence_rep=... method joint_forward (line 263) | def joint_forward(self, x): method classification_forward (line 273) | def classification_forward(self, x): class DiscriminativeNMTRerankerConfig (line 279) | class DiscriminativeNMTRerankerConfig(FairseqDataclass): class DiscriminativeNMTReranker (line 342) | class DiscriminativeNMTReranker(BaseFairseqModel): method build_model (line 344) | def build_model(cls, args, task): method __init__ (line 348) | def __init__(self, args, model): method forward (line 355) | def forward(self, src_tokens, src_lengths, **kwargs): method sentence_forward (line 358) | def sentence_forward(self, encoder_out, src_tokens): method joint_forward (line 361) | def joint_forward(self, x): method classification_forward (line 364) | def classification_forward(self, x): FILE: examples/discriminative_reranking_nmt/scripts/prep_data.py function read_text_file (line 11) | def read_text_file(filename): function get_bleu (line 18) | def get_bleu(in_sent, target_sent): function get_ter (line 26) | def get_ter(in_sent, target_sent): function init (line 32) | def init(sp_model): function process (line 38) | def process(source_sent, target_sent, hypo_sent, metric): function main (line 50) | def main(args): FILE: examples/discriminative_reranking_nmt/tasks/discriminative_reranking_task.py class DiscriminativeRerankingNMTConfig (line 45) | class DiscriminativeRerankingNMTConfig(FairseqDataclass): class RerankerScorer (line 77) | class RerankerScorer(object): method __init__ (line 80) | def __init__(self, args, mt_beam): method generate (line 84) | def generate(self, models, sample, **kwargs): class DiscriminativeRerankingNMTTask (line 114) | class DiscriminativeRerankingNMTTask(FairseqTask): method __init__ (line 122) | def __init__(self, cfg: DiscriminativeRerankingNMTConfig, data_diction... method load_dictionary (line 130) | def load_dictionary(cls, cfg, filename): method setup_task (line 138) | def setup_task(cls, cfg: DiscriminativeRerankingNMTConfig, **kwargs): method load_dataset (line 149) | def load_dataset(self, split, epoch=0, combine=False, **kwargs): method build_dataset_for_inference (line 291) | def build_dataset_for_inference(self, src_tokens, src_lengths, **kwargs): method build_model (line 341) | def build_model(self, cfg: FairseqDataclass, from_checkpoint: bool = F... method build_generator (line 344) | def build_generator(self, args): method max_positions (line 347) | def max_positions(self): method source_dictionary (line 351) | def source_dictionary(self): method target_dictionary (line 355) | def target_dictionary(self): method create_dummy_batch (line 358) | def create_dummy_batch(self, device): method train_step (line 376) | def train_step( method valid_step (line 386) | def valid_step(self, sample, model, criterion): method reduce_metrics (line 437) | def reduce_metrics(self, logging_outputs, criterion): FILE: examples/emotion_conversion/emotion_models/duration_predictor.py function save_ckpt (line 16) | def save_ckpt(model, path, model_class): function load_ckpt (line 25) | def load_ckpt(path): class Collator (line 36) | class Collator: method __init__ (line 37) | def __init__(self, padding_idx): method __call__ (line 40) | def __call__(self, batch): class Predictor (line 50) | class Predictor(nn.Module): method __init__ (line 51) | def __init__(self, n_tokens, emb_dim): method inflate_input (line 60) | def inflate_input(self, batch): class CnnPredictor (line 80) | class CnnPredictor(Predictor): method __init__ (line 81) | def __init__(self, n_tokens, emb_dim, channels, kernel, output_dim, dr... method forward (line 103) | def forward(self, x): function l2_log_loss (line 111) | def l2_log_loss(input, target): class DurationDataset (line 119) | class DurationDataset(Dataset): method __init__ (line 120) | def __init__(self, tsv_path, km_path, substring=""): method __len__ (line 135) | def __len__(self): method __getitem__ (line 138) | def __getitem__(self, i): function train (line 160) | def train(cfg): function train_epoch (line 188) | def train_epoch(model, loader, criterion, optimizer, device): function valid_epoch (line 209) | def valid_epoch(model, loader, criterion, device): function main (line 237) | def main(cfg): FILE: examples/emotion_conversion/emotion_models/pitch_predictor.py function quantize_f0 (line 29) | def quantize_f0(speaker_to_f0, nbins, normalize, log): function save_ckpt (line 59) | def save_ckpt(model, path, model_class, f0_min, f0_max, f0_bins, speaker... function load_ckpt (line 72) | def load_ckpt(path): function freq2bin (line 86) | def freq2bin(f0, f0_min, f0_max, bins): function bin2freq (line 94) | def bin2freq(x, f0_min, f0_max, bins, mode): function load_wav (line 108) | def load_wav(full_path): function l1_loss (line 113) | def l1_loss(input, target): function l2_loss (line 117) | def l2_loss(input, target): class Collator (line 121) | class Collator: method __init__ (line 122) | def __init__(self, padding_idx): method __call__ (line 125) | def __call__(self, batch): class CnnPredictor (line 147) | class CnnPredictor(nn.Module): method __init__ (line 148) | def __init__( method forward (line 213) | def forward(self, x, gst=None): method setup_f0_stats (line 243) | def setup_f0_stats(self, f0_min, f0_max, f0_bins, speaker_stats): method inference (line 250) | def inference(self, x, spk_id=None, gst=None): class PitchDataset (line 276) | class PitchDataset(Dataset): method __init__ (line 277) | def __init__( method __len__ (line 332) | def __len__(self): method _load_f0 (line 335) | def _load_f0(self, tsv_line): method _preprocess_f0 (line 342) | def _preprocess_f0(self, f0, spk): method _compute_f0_minmax (line 364) | def _compute_f0_minmax(self): method _compute_f0_stats (line 374) | def _compute_f0_stats(self): method __getitem__ (line 386) | def __getitem__(self, i): function train (line 412) | def train(cfg): function run_epoch (line 489) | def run_epoch(model, loader, optimizer, device, cfg, mode): function main (line 543) | def main(cfg): FILE: examples/emotion_conversion/emotion_models/utils.py class Stat (line 4) | class Stat: method __init__ (line 5) | def __init__(self, keep_raw=False): method update (line 15) | def update(self, new_x): method mean (line 29) | def mean(self): method std (line 33) | def std(self): method mean_log (line 37) | def mean_log(self): method std_log (line 41) | def std_log(self): method n_frms (line 45) | def n_frms(self): method n_utts (line 49) | def n_utts(self): method raw_data (line 53) | def raw_data(self): class F0Stat (line 58) | class F0Stat(Stat): method update (line 59) | def update(self, new_x): class Accuracy (line 65) | class Accuracy: method __init__ (line 66) | def __init__(self): method update (line 69) | def update(self, yhat, y): method acc (line 73) | def acc(self, tol): FILE: examples/emotion_conversion/fairseq_models/__init__.py class MultilingualTransformerModelFromMbart (line 25) | class MultilingualTransformerModelFromMbart(MultilingualTransformerModel): method build_model (line 27) | def build_model(cls, args, task): method load_state_dict (line 150) | def load_state_dict(self, state_dict, strict=True, model_cfg=None): function transformer_small (line 202) | def transformer_small(args): function multilingual_small (line 217) | def multilingual_small(args): FILE: examples/emotion_conversion/preprocess/build_hifigan_manifest.py function main (line 5) | def main(): FILE: examples/emotion_conversion/preprocess/build_translation_manifests.py function get_fname (line 17) | def get_fname(s): function get_emotion (line 20) | def get_emotion(s): function get_utt_id (line 23) | def get_utt_id(s): function dedup (line 26) | def dedup(seq): function remove_under_k (line 44) | def remove_under_k(seq, k): function call (line 57) | def call(cmd): function denoising_preprocess (line 62) | def denoising_preprocess(path, lang, dict): function translation_preprocess (line 78) | def translation_preprocess(path, src_lang, trg_lang, dict, only_train=Fa... function load_tsv_km (line 98) | def load_tsv_km(tsv_path, km_path): function main (line 107) | def main(): FILE: examples/emotion_conversion/preprocess/create_core_manifest.py function verify_dict_size (line 17) | def verify_dict_size(km, dict): function verify_files_exist (line 26) | def verify_files_exist(l): function run_cmd (line 34) | def run_cmd(cmd, print_output=True): function main (line 44) | def main(): FILE: examples/emotion_conversion/preprocess/extract_f0.py function extract_f0 (line 24) | def extract_f0(tsv_line): function main (line 51) | def main(): FILE: examples/emotion_conversion/preprocess/split_emov_km_tsv_by_uttid.py function train_val_test_split (line 12) | def train_val_test_split(tsv_lines, km_lines, valid_percent, test_percen... FILE: examples/emotion_conversion/synthesize.py class AttrDict (line 36) | class AttrDict(dict): method __init__ (line 37) | def __init__(self, *args, **kwargs): function parse_generation_file (line 42) | def parse_generation_file(fname): function get_code_to_fname (line 87) | def get_code_to_fname(manifest, tokens): function code_to_str (line 117) | def code_to_str(s): function get_praat_f0 (line 122) | def get_praat_f0(audio, rate=16000, interp=False): function generate_from_code (line 141) | def generate_from_code(generator, h, code, spkr=None, f0=None, gst=None,... function synth (line 160) | def synth(argv, interactive=False): FILE: examples/fast_noisy_channel/noisy_channel_beam_search.py class NoisyChannelBeamSearch (line 10) | class NoisyChannelBeamSearch(Search): method __init__ (line 12) | def __init__(self, tgt_dict): method _init_buffers (line 17) | def _init_buffers(self, t): method combine_fw_bw (line 26) | def combine_fw_bw(self, combine_method, fw_cum, bw, step): method step (line 35) | def step(self, step, fw_lprobs, scores, bw_lprobs, lm_lprobs, combine_... FILE: examples/fast_noisy_channel/noisy_channel_sequence_generator.py class NoisyChannelSequenceGenerator (line 19) | class NoisyChannelSequenceGenerator(object): method __init__ (line 20) | def __init__( method generate (line 135) | def generate( function get_lm_scores (line 767) | def get_lm_scores(model, input_tokens, incremental_states, cand_tokens, ... function make_dict2dict (line 779) | def make_dict2dict(old_dict, new_dict): function dict2dict (line 786) | def dict2dict(tokens, dict2dict_map): function reorder_tokens (line 797) | def reorder_tokens(tokens, lengths, eos): function reorder_all_tokens (line 802) | def reorder_all_tokens(tokens, lengths, eos): function normalized_scores_with_batch_vocab (line 808) | def normalized_scores_with_batch_vocab( FILE: examples/fast_noisy_channel/noisy_channel_translation.py class NoisyChannelTranslation (line 15) | class NoisyChannelTranslation(TranslationTask): method add_args (line 21) | def add_args(parser): method build_generator (line 50) | def build_generator( FILE: examples/hubert/measure_teacher_quality.py function comp_purity (line 13) | def comp_purity(p_xy, axis): function comp_entropy (line 21) | def comp_entropy(p): function comp_norm_mutual_info (line 25) | def comp_norm_mutual_info(p_xy): function pad (line 35) | def pad(labs, n): function comp_avg_seg_dur (line 41) | def comp_avg_seg_dur(labs_list): function comp_joint_prob (line 54) | def comp_joint_prob(uid2refs, uid2hyps): function read_phn (line 87) | def read_phn(tsv_path, rm_stress=True): function read_lab (line 99) | def read_lab(tsv_path, lab_path, pad_len=0, upsample=1): function main_lab_lab (line 112) | def main_lab_lab( function main_phn_lab (line 140) | def main_phn_lab( function _main (line 166) | def _main(uid2refs, uid2hyps, verbose): FILE: examples/hubert/simple_kmeans/dump_hubert_feature.py class HubertFeatureReader (line 28) | class HubertFeatureReader(object): method __init__ (line 29) | def __init__(self, ckpt_path, layer, max_chunk=1600000): method read_audio (line 42) | def read_audio(self, path, ref_len=None): method get_feats (line 51) | def get_feats(self, path, ref_len=None): function main (line 72) | def main(tsv_dir, split, ckpt_path, layer, nshard, rank, feat_dir, max_c... FILE: examples/hubert/simple_kmeans/dump_hubert_feature_s2t.py class HubertFeatureReaderS2T (line 27) | class HubertFeatureReaderS2T(HubertFeatureReader): method read_audio (line 28) | def read_audio(self, path, ref_len=None): function get_path_iterator (line 40) | def get_path_iterator(root, tsv, nshard, rank, audio_col_name): function main (line 61) | def main( FILE: examples/hubert/simple_kmeans/dump_km_label.py class ApplyKmeans (line 25) | class ApplyKmeans(object): method __init__ (line 26) | def __init__(self, km_path): method __call__ (line 37) | def __call__(self, x): function get_feat_iterator (line 54) | def get_feat_iterator(feat_dir, split, nshard, rank): function dump_label (line 70) | def dump_label(feat_dir, split, km_path, nshard, rank, lab_dir): FILE: examples/hubert/simple_kmeans/dump_mfcc_feature.py class MfccFeatureReader (line 26) | class MfccFeatureReader(object): method __init__ (line 27) | def __init__(self, sample_rate): method read_audio (line 30) | def read_audio(self, path, ref_len=None): method get_feats (line 36) | def get_feats(self, path, ref_len=None): function main (line 55) | def main(tsv_dir, split, nshard, rank, feat_dir, sample_rate): FILE: examples/hubert/simple_kmeans/dump_w2v2_feature.py class Wav2Vec2FeatureReader (line 27) | class Wav2Vec2FeatureReader(object): method __init__ (line 28) | def __init__(self, ckpt_path, layer, max_chunk=1600000): method read_audio (line 42) | def read_audio(self, path, ref_len=None): method get_feats (line 52) | def get_feats(self, path, ref_len=None): function main (line 74) | def main(tsv_dir, split, ckpt_path, layer, nshard, rank, feat_dir, max_c... FILE: examples/hubert/simple_kmeans/feature_utils.py function get_shard_range (line 23) | def get_shard_range(tot, nshard, rank): function get_path_iterator (line 35) | def get_path_iterator(tsv, nshard, rank): function dump_feature (line 48) | def dump_feature(reader, generator, num, split, nshard, rank, feat_dir): FILE: examples/hubert/simple_kmeans/learn_kmeans.py function get_km_model (line 24) | def get_km_model( function load_feature_shard (line 49) | def load_feature_shard(feat_dir, split, nshard, rank, percent): function load_feature (line 74) | def load_feature(feat_dir, split, nshard, seed, percent): function learn_kmeans (line 87) | def learn_kmeans( FILE: examples/hubert/update_ckpt.py function update_state (line 13) | def update_state(state): FILE: examples/laser/laser_src/laser_lstm.py class LSTMModel (line 22) | class LSTMModel(FairseqEncoderDecoderModel): method __init__ (line 23) | def __init__(self, encoder, decoder): method forward (line 26) | def forward( method add_args (line 44) | def add_args(parser): method build_model (line 147) | def build_model(cls, args, task): class LSTMEncoder (line 202) | class LSTMEncoder(FairseqEncoder): method __init__ (line 205) | def __init__( method forward (line 249) | def forward(self, src_tokens, src_lengths, dataset_name): method reorder_encoder_out (line 323) | def reorder_encoder_out(self, encoder_out_dict, new_order): method max_positions (line 336) | def max_positions(self): class LSTMDecoder (line 341) | class LSTMDecoder(FairseqIncrementalDecoder): method __init__ (line 344) | def __init__( method forward (line 400) | def forward( method reorder_incremental_state (line 510) | def reorder_incremental_state(self, incremental_state, new_order): method max_positions (line 526) | def max_positions(self): function Embedding (line 531) | def Embedding(num_embeddings, embedding_dim, padding_idx): function LSTM (line 538) | def LSTM(input_size, hidden_size, **kwargs): function LSTMCell (line 546) | def LSTMCell(input_size, hidden_size, **kwargs): function Linear (line 554) | def Linear(in_features, out_features, bias=True, dropout=0): function base_architecture (line 564) | def base_architecture(args): FILE: examples/laser/laser_src/laser_task.py class LaserTask (line 33) | class LaserTask(LegacyFairseqTask): method add_args (line 35) | def add_args(parser): method __init__ (line 82) | def __init__(self, args, config, src_dictionary, tgt_dictionary, num_t... method setup_task (line 90) | def setup_task(cls, args, **kwargs): method build_model (line 115) | def build_model(self, args, from_checkpoint=False): method dataset (line 119) | def dataset(self, split): method load_dataset (line 124) | def load_dataset(self, split, epoch=1, **kwargs): method source_dictionary (line 263) | def source_dictionary(self): method target_dictionary (line 267) | def target_dictionary(self): method get_batch_iterator (line 270) | def get_batch_iterator( FILE: examples/laser/laser_src/laser_transformer.py class LaserTransformerModel (line 34) | class LaserTransformerModel(FairseqEncoderDecoderModel): method __init__ (line 40) | def __init__(self, encoder, decoder): method forward (line 43) | def forward( method add_args (line 59) | def add_args(parser): method build_model (line 70) | def build_model(cls, args, task): class LaserTransformerEncoder (line 104) | class LaserTransformerEncoder(TransformerEncoder): method __init__ (line 105) | def __init__(self, *args, **kwargs): method forward (line 108) | def forward(self, src_tokens, *args, **kwargs): method reorder_encoder_out (line 127) | def reorder_encoder_out(self, encoder_out: Dict[str, List[Tensor]], ne... class LaserTransformerDecoder (line 141) | class LaserTransformerDecoder(TransformerDecoder): method __init__ (line 142) | def __init__(self, args, dictionary, *kargs, **kwargs): method build_decoder_layer (line 169) | def build_decoder_layer(self, args, no_encoder_attn=False): method extract_features (line 179) | def extract_features( method forward (line 307) | def forward( function base_laser_transformer_architecture (line 352) | def base_laser_transformer_architecture(args): FILE: examples/laser/laser_src/multitask_data_utils.py class MultiItr (line 13) | class MultiItr(object): method __init__ (line 14) | def __init__(self, itr): method __len__ (line 18) | def __len__(self): method __iter__ (line 21) | def __iter__(self): method __next__ (line 24) | def __next__(self): class MultidatasetEpochBatchIterator (line 31) | class MultidatasetEpochBatchIterator(iterators.EpochBatchIterating): method __init__ (line 34) | def __init__( method __len__ (line 65) | def __len__(self): method next_epoch_itr (line 68) | def next_epoch_itr(self, shuffle=True, fix_batches_to_gpus=False): method end_of_epoch (line 79) | def end_of_epoch(self): method next_epoch_idx (line 83) | def next_epoch_idx(self): method iterations_in_epoch (line 93) | def iterations_in_epoch(self): method state_dict (line 96) | def state_dict(self): method load_state_dict (line 102) | def load_state_dict(self, state_dict): class MultitaskDatasetWrapper (line 108) | class MultitaskDatasetWrapper(BaseWrapperDataset): method __init__ (line 111) | def __init__(self, dataset, target_language_id, sample=1.0, name=""): method collater (line 117) | def collater(self, *args, **kwargs): method num_tokens (line 124) | def num_tokens(self, *args, **kwargs): method ordered_indices (line 127) | def ordered_indices(self, *args, **kwargs): method size (line 134) | def size(self, index: int): method supports_prefetch (line 138) | def supports_prefetch(self): method prefetch (line 142) | def prefetch(self, indices): FILE: examples/latent_depth/latent_depth_src/loss/latent_depth.py class LatentLayersKLLoss (line 12) | class LatentLayersKLLoss(_Loss): method __init__ (line 13) | def __init__(self, args): method forward (line 17) | def forward(self, layer_samples, lang_idx, update_num, sample_size): class LatentLayersSparsityLoss (line 48) | class LatentLayersSparsityLoss(_Loss): method __init__ (line 49) | def __init__(self, args): method is_valid (line 53) | def is_valid(self, update_num): method forward (line 58) | def forward(self, layer_samples_list, update_num, sample_size): FILE: examples/latent_depth/latent_depth_src/models/latent_multilingual_transformer.py class LatentMultilingualTransformerModel (line 19) | class LatentMultilingualTransformerModel(MultilingualTransformerModel): method add_args (line 26) | def add_args(parser): method _get_module_class (line 42) | def _get_module_class(cls, is_encoder, args, lang_dict, embed_tokens, ... function latent_multilingual_architecture (line 62) | def latent_multilingual_architecture(args): FILE: examples/latent_depth/latent_depth_src/models/latent_transformer.py class LatentTransformerEncoder (line 17) | class LatentTransformerEncoder(TransformerEncoder): method __init__ (line 22) | def __init__(self, args, dictionary, embed_tokens, num_logits=1): method set_lang_idx (line 37) | def set_lang_idx(self, lang_idx): method _build_encoder_layer (line 40) | def _build_encoder_layer(self, args, idx=None): method forward (line 43) | def forward(self, src_tokens, src_lengths, return_all_hiddens: bool = ... class LatentTransformerEncoderLayer (line 48) | class LatentTransformerEncoderLayer(TransformerEncoderLayer): method __init__ (line 60) | def __init__(self, args, idx, layer_select=None): method residual_connection (line 65) | def residual_connection(self, x, residual): class LatentTransformerDecoder (line 69) | class LatentTransformerDecoder(TransformerDecoder): method __init__ (line 74) | def __init__( method set_lang_idx (line 96) | def set_lang_idx(self, lang_idx): method _build_decoder_layer (line 99) | def _build_decoder_layer(self, args, no_encoder_attn=False, idx=None): method forward (line 104) | def forward( class LatentTransformerDecoderLayer (line 127) | class LatentTransformerDecoderLayer(TransformerDecoderLayer): method __init__ (line 142) | def __init__( method residual_connection (line 155) | def residual_connection(self, x, residual): FILE: examples/latent_depth/latent_depth_src/modules/latent_layers.py class LayerSelect (line 10) | class LayerSelect(nn.Module): method __init__ (line 15) | def __init__(self, num_layers, num_logits, soft_select=False, sampling... method sample (line 26) | def sample(self, logit_idx): method forward (line 45) | def forward(self, i): method _gumbel_sigmoid (line 49) | def _gumbel_sigmoid( FILE: examples/latent_depth/latent_depth_src/multilingual_translation_latent_depth.py class MultilingualTranslationTaskLatentDepth (line 14) | class MultilingualTranslationTaskLatentDepth(MultilingualTranslationTask): method add_args (line 22) | def add_args(parser): method __init__ (line 42) | def __init__(self, args, dicts, training): method _per_lang_pair_train_loss (line 61) | def _per_lang_pair_train_loss( method train_step (line 116) | def train_step( method _per_lang_pair_valid_loss (line 145) | def _per_lang_pair_valid_loss(self, lang_pair, model, criterion, sample): method inference_step (line 158) | def inference_step( method encoder_latent_layer (line 176) | def encoder_latent_layer(self): method decoder_latent_layer (line 183) | def decoder_latent_layer(self): method src_lang_idx_dict (line 190) | def src_lang_idx_dict(self): method tgt_lang_idx_dict (line 194) | def tgt_lang_idx_dict(self): FILE: examples/linformer/linformer_src/models/linformer_roberta.py class LinformerModel (line 30) | class LinformerModel(RobertaModel): method add_args (line 32) | def add_args(parser): method build_model (line 56) | def build_model(cls, args, task): class LinformerEncoder (line 69) | class LinformerEncoder(RobertaEncoder): method __init__ (line 72) | def __init__(self, args, dictionary): method build_encoder (line 76) | def build_encoder(self, args, dictionary, embed_tokens): method upgrade_state_dict_named (line 81) | def upgrade_state_dict_named(self, state_dict, name): function base_architecture (line 104) | def base_architecture(args): function linformer_roberta_base_architecture (line 113) | def linformer_roberta_base_architecture(args): function linformer_roberta_large_architecture (line 118) | def linformer_roberta_large_architecture(args): FILE: examples/linformer/linformer_src/modules/linformer_sentence_encoder.py class LinformerTransformerEncoder (line 14) | class LinformerTransformerEncoder(TransformerEncoder): method __init__ (line 38) | def __init__(self, args, dictionary, embed_tokens): method build_encoder_layer (line 42) | def build_encoder_layer(self, args): FILE: examples/linformer/linformer_src/modules/linformer_sentence_encoder_layer.py class LinformerTransformerEncoderLayer (line 13) | class LinformerTransformerEncoderLayer(TransformerEncoderLayer): method __init__ (line 19) | def __init__(self, args, shared_compress_layer): method build_self_attention (line 27) | def build_self_attention(self, embed_dim, args): method upgrade_state_dict_named (line 42) | def upgrade_state_dict_named(self, state_dict, name): FILE: examples/linformer/linformer_src/modules/multihead_linear_attention.py class MultiheadLinearAttention (line 19) | class MultiheadLinearAttention(nn.Module): method __init__ (line 27) | def __init__( method prepare_for_onnx_export_ (line 115) | def prepare_for_onnx_export_(self): method reset_parameters (line 118) | def reset_parameters(self): method forward (line 152) | def forward( method _append_prev_key_padding_mask (line 375) | def _append_prev_key_padding_mask( method reorder_incremental_state (line 413) | def reorder_incremental_state( method _get_input_buffer (line 432) | def _get_input_buffer( method _set_input_buffer (line 442) | def _set_input_buffer( method apply_sparse_mask (line 449) | def apply_sparse_mask(attn_weights, tgt_len: int, src_len: int, bsz: i... method upgrade_state_dict_named (line 452) | def upgrade_state_dict_named(self, state_dict, name): FILE: examples/m2m_100/process_data/clean_histogram.py function read_hist (line 17) | def read_hist(f): FILE: examples/m2m_100/process_data/dedup_data.py function main (line 10) | def main(args): function existing_data (line 27) | def existing_data(): function dedup (line 34) | def dedup(language_pair, data, verbose=True, output=True): FILE: examples/m2m_100/process_data/remove_too_much_punc.py function len_no_punc (line 5) | def len_no_punc(s, punc): function filter_overpunc (line 8) | def filter_overpunc(len_npunc, len_sen): function main (line 11) | def main(args): FILE: examples/megatron_11b/detok.py function main (line 13) | def main(): FILE: examples/mms/asr/infer/mms_infer.py function parser (line 16) | def parser(): function reorder_decode (line 25) | def reorder_decode(hypos): function process (line 34) | def process(args): FILE: examples/mms/data_prep/align_and_segment.py function generate_emissions (line 23) | def generate_emissions(model, audio_file): function get_alignments (line 67) | def get_alignments( function main (line 102) | def main(args): FILE: examples/mms/data_prep/align_utils.py function normalize_uroman (line 13) | def normalize_uroman(text): function get_uroman_tokens (line 20) | def get_uroman_tokens(norm_transcripts, uroman_root_dir, iso = None): class Segment (line 48) | class Segment: method __repr__ (line 53) | def __repr__(self): method length (line 57) | def length(self): function merge_repeats (line 61) | def merge_repeats(path, idx_to_token_map): function time_to_frame (line 72) | def time_to_frame(time): function load_model_dict (line 79) | def load_model_dict(): function get_spans (line 137) | def get_spans(tokens, segments): FILE: examples/mms/data_prep/text_normalization.py function text_normalize (line 8) | def text_normalize(text, iso_code, lower_case=True, remove_numbers=True,... FILE: examples/mms/lid/infer.py function subset_manifest (line 14) | def subset_manifest(infer_manifest, veri_pair): function wrap_target_dataset (line 36) | def wrap_target_dataset(infer_manifest, dataset, task): function resample_data (line 56) | def resample_data(source, padding_mask, n_sample, max_sample_len): function resample_sample (line 83) | def resample_sample(sample, n_sample, max_sample_len): function dict_to_nparr (line 99) | def dict_to_nparr(dd): FILE: examples/mms/lid_rerank/mms-zs/uromanize.py function norm_uroman (line 16) | def norm_uroman(text): function uromanize (line 23) | def uromanize(words): function convert_sent (line 41) | def convert_sent(txt, char_lang=False): FILE: examples/mms/lid_rerank/mms/run_single_lang.py function reorder_decode (line 12) | def reorder_decode(hypos): FILE: examples/mms/lid_rerank/nllb/infer.py function fix_code (line 18) | def fix_code(x): FILE: examples/mms/lid_rerank/rerank/rerank.py function select (line 19) | def select(w, feats, ref_lid, nbest_lid, ref_asr, nbest_asr, n=10, exclu... FILE: examples/mms/lid_rerank/rerank/tune_coefficients.py function compute (line 11) | def compute(w, feats, ref_lid, nbest_lid, ref_asr, nbest_asr, n=10, excl... FILE: examples/mms/tts/infer.py class TextMapper (line 25) | class TextMapper(object): method __init__ (line 26) | def __init__(self, vocab_file): method text_to_sequence (line 32) | def text_to_sequence(self, text, cleaner_names): method uromanize (line 47) | def uromanize(self, text, uroman_pl): method get_text (line 65) | def get_text(self, text, hps): method filter_oov (line 72) | def filter_oov(self, text, lang=None): method preprocess_char (line 79) | def preprocess_char(self, text, lang=None): function generate (line 88) | def generate(): FILE: examples/multilingual/data_scripts/binarize.py function call_output (line 10) | def call_output(cmd): function call (line 16) | def call(cmd): function get_data_size (line 48) | def get_data_size(raw): function encode_spm (line 53) | def encode_spm(model, direction, prefix='', splits=['train', 'test', 'va... function binarize_ (line 68) | def binarize_( function binarize (line 117) | def binarize( function load_langs (line 161) | def load_langs(path): FILE: examples/multilingual/data_scripts/check_iswlt_test_data.py function run_eval_bleu (line 20) | def run_eval_bleu(cmd): function check_data_test_bleu (line 32) | def check_data_test_bleu(raw_folder, data_lang_pairs): FILE: examples/multilingual/data_scripts/check_self_overlaps.py function get_directions (line 19) | def get_directions(folder): function diff_list (line 24) | def diff_list(lhs, rhs): function check_diff (line 27) | def check_diff( function main (line 64) | def main(): FILE: examples/multilingual/data_scripts/check_valid_test_overlaps.py function load_langs (line 19) | def load_langs(path): function load_sentences (line 26) | def load_sentences(raw_data, split, direction): function swap_direction (line 35) | def swap_direction(d): function get_all_test_data (line 39) | def get_all_test_data(raw_data, directions, split='test'): function check_train_sentences (line 57) | def check_train_sentences(src_path, tgt_path, direction, all_test_data, ... function check_train_all (line 83) | def check_train_all(raw_data, directions, all_test_data): function main (line 102) | def main(): FILE: examples/multilingual/data_scripts/dedup_all.py function main (line 21) | def main(): FILE: examples/multilingual/data_scripts/download_ted_and_extract.py function call (line 35) | def call(cmd): class MultiLingualAlignedCorpusReader (line 39) | class MultiLingualAlignedCorpusReader(object): method __init__ (line 43) | def __init__(self, corpus_path, delimiter='\t', method read_data (line 71) | def read_data(self, file_loc_): method filter_text (line 82) | def filter_text(self, dict_): method read_file (line 107) | def read_file(self, split_type, data_type): method save_file (line 110) | def save_file(self, path_, split_type, data_type, lang): method add_target_token (line 118) | def add_target_token(self, list_, lang_id): method read_from_single_file (line 125) | def read_from_single_file(self, path_, s_lang, t_lang): method read_aligned_corpus (line 139) | def read_aligned_corpus(self, split_type='train'): function read_langs (line 169) | def read_langs(corpus_path): function extra_english (line 177) | def extra_english(corpus_path, split): function tok_file_name (line 191) | def tok_file_name(filename, lang): function de_tok (line 197) | def de_tok(tok_file, lang): function extra_bitex (line 207) | def extra_bitex( function bar_custom (line 255) | def bar_custom(current, total, width=80): function download_and_extract (line 259) | def download_and_extract(download_to, extract_to): FILE: examples/multilingual/data_scripts/download_wmt19_and_before.py class DLDataset (line 38) | class DLDataset(NamedTuple): function bar_custom (line 49) | def bar_custom(current, total, width=80): function get_downloaded_file (line 52) | def get_downloaded_file(dl_folder, url): function download_parts_and_combine (line 61) | def download_parts_and_combine(dl_folder, urls, filename): function download_a_url (line 79) | def download_a_url(dl_folder, url): function download_files (line 93) | def download_files(dl_folder, urls, completed_urls={}): function check_need_manual_downalod (line 100) | def check_need_manual_downalod(dl_folder, to_manually_download_urls): function download_dataset (line 114) | def download_dataset(to_folder, dl_dataset, completed_urls={}): function call (line 121) | def call(cmd, debug=False): function get_extract_name (line 127) | def get_extract_name(file_path): function extract_file (line 131) | def extract_file(downloaded_file, extract_folder, get_extract_name=get_e... function extract_all_files (line 160) | def extract_all_files( function my_glob (line 175) | def my_glob(folder): function sgm2raw (line 181) | def sgm2raw(sgm, debug): function tmx2raw (line 190) | def tmx2raw(tmx, debug): function cut_wikitles (line 206) | def cut_wikitles(wiki_file, debug): function cut_tsv (line 230) | def cut_tsv(file, debug): function convert_file_if_needed (line 250) | def convert_file_if_needed(file, debug): function convert_files_if_needed (line 267) | def convert_files_if_needed(extracted_foldrs, my_glob=my_glob, debug=Fal... function match_patt (line 273) | def match_patt(file_path, file_pattern, src, tgt, lang): function match_patts (line 276) | def match_patts(file_path, file_patterns, src, tgt, lang): function extracted_glob (line 290) | def extracted_glob(extracted_folder, file_patterns, src, tgt, lang): function all_extracted_files (line 316) | def all_extracted_files(split, src, tgt, extracted_folders, split_urls): function concat_files (line 327) | def concat_files(split, src, tgt, extracted_folders, split_urls, path_pa... function lid_filter (line 358) | def lid_filter(split, src, tgt, from_folder, to_folder, debug=False): function concat_into_splits (line 372) | def concat_into_splits(dl_dataset, src, tgt, extracted_folders, to_folde... function download_multi (line 394) | def download_multi(dl_folder, extract_folder, urls, num_processes=8, deb... function run_eval_bleu (line 402) | def run_eval_bleu(cmd): function check_wmt_test_bleu (line 414) | def check_wmt_test_bleu(raw_folder, wmt_lang_pairs): function download_and_extract (line 437) | def download_and_extract( function download_czang16 (line 479) | def download_czang16(download_to, username=None): function download_czeng17_script (line 496) | def download_czeng17_script(download_to, extract_folder, debug=False): function convert2czeng17 (line 508) | def convert2czeng17(file, debug): function extract_czeng17 (line 521) | def extract_czeng17(extract_folder, debug=False): function work_on_wmt (line 839) | def work_on_wmt(directions, wmt_data): FILE: examples/multilingual/data_scripts/remove_valid_test_in_train.py function load_langs (line 12) | def load_langs(path): function load_sentences (line 19) | def load_sentences(raw_data, split, direction): function swap_direction (line 28) | def swap_direction(d): function get_all_test_data (line 32) | def get_all_test_data(raw_data, directions, split='test'): function check_train_sentences (line 49) | def check_train_sentences(raw_data, direction, all_test_data, mess_up_tr... function check_train_all (line 72) | def check_train_all(raw_data, directions, all_test_data): function count_train_in_other_set (line 80) | def count_train_in_other_set(mess_up_train): function train_size_if_remove_in_otherset (line 87) | def train_size_if_remove_in_otherset(data_sizes, mess_up_train): function remove_messed_up_sentences (line 95) | def remove_messed_up_sentences(raw_data, direction, mess_up_train, mess_... function merge_valid_test_messup (line 132) | def merge_valid_test_messup(mess_up_train_valid, mess_up_train_test): function check_train_pairs (line 145) | def check_train_pairs(raw_data, direction, all_test_data, mess_up_train=... function load_pairs (line 164) | def load_pairs(raw_data, split, direction): function get_messed_up_test_pairs (line 178) | def get_messed_up_test_pairs(split, directions): FILE: examples/multilingual/data_scripts/utils/dedup.py function deup (line 9) | def deup(src_file, tgt_file, src_file_out, tgt_file_out): function main (line 26) | def main(): FILE: examples/multilingual/data_scripts/utils/fasttext_multi_filter.py function init (line 18) | def init(model_path): function pred (line 22) | def pred(lines): function main (line 25) | def main(): FILE: examples/noisychannel/rerank.py function score_target_hypo (line 23) | def score_target_hypo( function match_target_hypo (line 168) | def match_target_hypo(args, target_outfile, hypo_outfile): function load_score_files (line 230) | def load_score_files(args): function rerank (line 362) | def rerank(args): function cli_main (line 421) | def cli_main(): FILE: examples/noisychannel/rerank_generate.py function gen_and_reprocess_nbest (line 21) | def gen_and_reprocess_nbest(args): function cli_main (line 390) | def cli_main(): FILE: examples/noisychannel/rerank_options.py function get_reranking_parser (line 9) | def get_reranking_parser(default_task="translation"): function get_tuning_parser (line 15) | def get_tuning_parser(default_task="translation"): function add_reranking_args (line 22) | def add_reranking_args(parser): function add_tuning_args (line 110) | def add_tuning_args(parser): FILE: examples/noisychannel/rerank_score_bw.py function score_bw (line 15) | def score_bw(args): function cli_main (line 136) | def cli_main(): FILE: examples/noisychannel/rerank_score_lm.py function score_lm (line 13) | def score_lm(args): function cli_main (line 74) | def cli_main(): FILE: examples/noisychannel/rerank_tune.py function random_search (line 15) | def random_search(args): function cli_main (line 94) | def cli_main(): FILE: examples/noisychannel/rerank_utils.py function reprocess (line 16) | def reprocess(fle): function reprocess_nbest (line 75) | def reprocess_nbest(fle): function write_reprocessed (line 124) | def write_reprocessed( function calc_length_from_frac (line 196) | def calc_length_from_frac(bpe_sentence, prefix_frac, bpe_symbol): function get_prefix (line 207) | def get_prefix(sentence, prefix_len): function get_prefix_no_bpe (line 216) | def get_prefix_no_bpe(sentence, bpe_symbol, prefix_len): function get_prefix_from_len (line 223) | def get_prefix_from_len(sentence, bpe_symbol, prefix_len): function get_num_bpe_tokens_from_len (line 234) | def get_num_bpe_tokens_from_len(sentence, bpe_symbol, prefix_len): function make_right_to_left (line 241) | def make_right_to_left(line): function remove_bpe (line 248) | def remove_bpe(line, bpe_symbol): function remove_bpe_dict (line 254) | def remove_bpe_dict(pred_dict, bpe_symbol): function parse_bleu_scoring (line 265) | def parse_bleu_scoring(line): function get_full_from_prefix (line 272) | def get_full_from_prefix(hypo_prefix, hypos): function get_score (line 283) | def get_score( class BitextOutput (line 325) | class BitextOutput(object): method __init__ (line 326) | def __init__( class BitextOutputFromGen (line 411) | class BitextOutputFromGen(object): method __init__ (line 412) | def __init__( function get_score_from_pos (line 482) | def get_score_from_pos( class LMOutput (line 510) | class LMOutput(object): method __init__ (line 511) | def __init__( function parse_lm (line 540) | def parse_lm(input_file, prefix_len=None, bpe_symbol=None, target_prefix... function get_directories (line 585) | def get_directories( function lm_scoring (line 652) | def lm_scoring( function rescore_file_name (line 829) | def rescore_file_name( FILE: examples/operators/alignment_train_cpu.cpp function exclusiveCumprod (line 15) | void exclusiveCumprod( function clamp (line 55) | void clamp( function alignmentTrainCPUImpl (line 80) | void alignmentTrainCPUImpl( function alignmentTrainCPU (line 135) | void alignmentTrainCPU( function PYBIND11_MODULE (line 159) | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { FILE: examples/operators/alignment_train_cuda.cpp function alignmentTrainCUDA (line 14) | void alignmentTrainCUDA( function PYBIND11_MODULE (line 24) | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { FILE: examples/paraphraser/paraphrase.py function main (line 15) | def main(): FILE: examples/pointer_generator/pointer_generator_src/transformer_pg.py class TransformerPointerGeneratorModel (line 28) | class TransformerPointerGeneratorModel(TransformerModel): method add_args (line 48) | def add_args(parser): method build_model (line 70) | def build_model(cls, args, task): method build_encoder (line 141) | def build_encoder(cls, args, src_dict, embed_tokens): method build_decoder (line 145) | def build_decoder(cls, args, tgt_dict, embed_tokens): class TransformerPointerGeneratorEncoder (line 149) | class TransformerPointerGeneratorEncoder(TransformerEncoder): method forward (line 157) | def forward( class TransformerPointerGeneratorDecoder (line 215) | class TransformerPointerGeneratorDecoder(TransformerDecoder): method __init__ (line 227) | def __init__(self, args, dictionary, embed_tokens): method forward (line 253) | def forward( method output_layer (line 312) | def output_layer( method get_normalized_probs (line 364) | def get_normalized_probs( class Embedding (line 380) | class Embedding(nn.Embedding): method __init__ (line 418) | def __init__( method forward (line 431) | def forward(self, input): function transformer_pointer_generator (line 444) | def transformer_pointer_generator(args): function transformer_pointer_generator_iwslt_de_en (line 455) | def transformer_pointer_generator_iwslt_de_en(args): function transformer_pointer_generator_wmt_en_de (line 470) | def transformer_pointer_generator_wmt_en_de(args): function transformer_pointer_generator_vaswani_wmt_en_de_big (line 480) | def transformer_pointer_generator_vaswani_wmt_en_de_big(args): function transformer_pointer_generator_vaswani_wmt_en_fr_big (line 496) | def transformer_pointer_generator_vaswani_wmt_en_fr_big(args): function transformer_pointer_generator_wmt_en_de_big (line 504) | def transformer_pointer_generator_wmt_en_de_big(args): function transformer_pointer_generator_wmt_en_de_big_t2t (line 513) | def transformer_pointer_generator_wmt_en_de_big_t2t(args): FILE: examples/pointer_generator/postprocess.py class OOVIndexError (line 12) | class OOVIndexError(IndexError): method __init__ (line 13) | def __init__(self, pos, source_seq, target_seq): function replace_oovs (line 26) | def replace_oovs(source_in, target_in, target_out): function main (line 50) | def main(): FILE: examples/pointer_generator/preprocess.py function replace_oovs (line 11) | def replace_oovs(source_in, target_in, vocabulary, source_out, target_out): function main (line 53) | def main(): FILE: examples/roberta/commonsense_qa/commonsense_qa_task.py class CommonsenseQATask (line 28) | class CommonsenseQATask(LegacyFairseqTask): method add_args (line 32) | def add_args(parser): method __init__ (line 45) | def __init__(self, args, vocab): method load_dictionary (line 53) | def load_dictionary(cls, filename): method setup_task (line 64) | def setup_task(cls, args, **kwargs): method load_dataset (line 75) | def load_dataset( method build_model (line 172) | def build_model(self, args, from_checkpoint=False): method source_dictionary (line 185) | def source_dictionary(self): method target_dictionary (line 189) | def target_dictionary(self): FILE: examples/roberta/multiprocessing_bpe_encoder.py function main (line 17) | def main(): class MultiprocessingEncoder (line 91) | class MultiprocessingEncoder(object): method __init__ (line 92) | def __init__(self, args): method initializer (line 95) | def initializer(self): method encode (line 99) | def encode(self, line): method decode (line 104) | def decode(self, tokens): method encode_lines (line 108) | def encode_lines(self, lines): method decode_lines (line 121) | def decode_lines(self, lines): FILE: examples/roberta/preprocess_RACE.py class InputExample (line 14) | class InputExample: method __init__ (line 15) | def __init__(self, paragraph, qa_list, label): function get_examples (line 21) | def get_examples(data_dir, set_type): function main (line 60) | def main(): FILE: examples/roberta/wsc/wsc_criterion.py class WSCCriterion (line 16) | class WSCCriterion(LegacyFairseqCriterion): method __init__ (line 17) | def __init__(self, args, task): method __del__ (line 26) | def __del__(self): method add_args (line 31) | def add_args(parser): method get_masked_input (line 44) | def get_masked_input(self, tokens, mask): method get_lprobs (line 49) | def get_lprobs(self, model, tokens, mask): method get_loss (line 57) | def get_loss(self, query_lprobs, cand_lprobs): method forward (line 70) | def forward(self, model, sample, reduce=True): method aggregate_logging_outputs (line 118) | def aggregate_logging_outputs(logging_outputs): class WinograndeCriterion (line 141) | class WinograndeCriterion(WSCCriterion): method forward (line 142) | def forward(self, model, sample, reduce=True): FILE: examples/roberta/wsc/wsc_task.py class WSCTask (line 32) | class WSCTask(LegacyFairseqTask): method add_args (line 36) | def add_args(parser): method __init__ (line 48) | def __init__(self, args, vocab): method load_dictionary (line 65) | def load_dictionary(cls, filename): method setup_task (line 76) | def setup_task(cls, args, **kwargs): method binarize (line 85) | def binarize(self, s: str, append_eos: bool = False): method binarize_with_mask (line 99) | def binarize_with_mask(self, txt, prefix, suffix, leading_space, trail... method load_dataset (line 110) | def load_dataset( method build_dataset_for_inference (line 225) | def build_dataset_for_inference(self, sample_json): method disambiguate_pronoun (line 235) | def disambiguate_pronoun(self, model, sentence, use_cuda=False): method source_dictionary (line 273) | def source_dictionary(self): method target_dictionary (line 277) | def target_dictionary(self): class WinograndeTask (line 282) | class WinograndeTask(WSCTask): method setup_task (line 289) | def setup_task(cls, args, **kwargs): method load_dataset (line 298) | def load_dataset( FILE: examples/roberta/wsc/wsc_utils.py function convert_sentence_to_json (line 10) | def convert_sentence_to_json(sentence): function extended_noun_chunks (line 36) | def extended_noun_chunks(sentence): function find_token (line 52) | def find_token(sentence, start_pos): function find_span (line 61) | def find_span(sentence, search_text, start=0): function get_detokenizer (line 77) | def get_detokenizer(): function get_spacy_nlp (line 85) | def get_spacy_nlp(): function jsonl_iterator (line 92) | def jsonl_iterator(input_fname, positive_only=False, ngram_order=3, eval... function winogrande_jsonl_iterator (line 195) | def winogrande_jsonl_iterator(input_fname, eval=False): function filter_noun_chunks (line 215) | def filter_noun_chunks( FILE: examples/rxf/rxf_src/label_smoothed_cross_entropy_r3f.py class LabelSmoothedCrossEntropyR3FCriterion (line 17) | class LabelSmoothedCrossEntropyR3FCriterion(FairseqCriterion): method __init__ (line 18) | def __init__( method add_args (line 39) | def add_args(parser): method _get_symm_kl (line 53) | def _get_symm_kl(self, noised_logits, input_logits): method forward (line 71) | def forward(self, model, sample, reduce=True): method compute_loss (line 118) | def compute_loss(self, model, net_output, sample, reduce=True): method reduce_metrics (line 132) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 152) | def logging_outputs_can_be_summed() -> bool: FILE: examples/rxf/rxf_src/sentence_prediction_r3f.py class SentencePredictionR3F (line 15) | class SentencePredictionR3F(FairseqCriterion): method __init__ (line 16) | def __init__( method add_args (line 43) | def add_args(parser): method _get_symm_kl (line 58) | def _get_symm_kl(self, noised_logits, input_logits): method forward (line 76) | def forward(self, model, sample, reduce=True): method aggregate_logging_outputs (line 149) | def aggregate_logging_outputs(logging_outputs): FILE: examples/simultaneous_translation/eval/agents/simul_t2t_enja.py class SimulTransTextAgentJA (line 22) | class SimulTransTextAgentJA(TextAgent): method __init__ (line 27) | def __init__(self, args): method initialize_states (line 43) | def initialize_states(self, states): method to_device (line 47) | def to_device(self, tensor): method load_model_vocab (line 53) | def load_model_vocab(self, args): method add_args (line 84) | def add_args(parser): method build_word_splitter (line 103) | def build_word_splitter(self, args): method segment_to_units (line 112) | def segment_to_units(self, segment, states): method update_model_encoder (line 116) | def update_model_encoder(self, states): method update_states_read (line 140) | def update_states_read(self, states): method units_to_segment (line 144) | def units_to_segment(self, units, states): method policy (line 167) | def policy(self, states): method predict (line 211) | def predict(self, states): FILE: examples/simultaneous_translation/models/convtransformer_simul_trans.py class SimulConvTransformerModel (line 29) | class SimulConvTransformerModel(ConvTransformerModel): method add_args (line 40) | def add_args(parser): method build_decoder (line 50) | def build_decoder(cls, args, task, embed_tokens): function convtransformer_simul_trans_espnet (line 69) | def convtransformer_simul_trans_espnet(args): class AugmentedMemoryConvTransformerModel (line 75) | class AugmentedMemoryConvTransformerModel(SimulConvTransformerModel): method build_encoder (line 77) | def build_encoder(cls, args): function augmented_memory_convtransformer_espnet (line 91) | def augmented_memory_convtransformer_espnet(args): class ConvTransformerEmformerEncoder (line 102) | class ConvTransformerEmformerEncoder(ConvTransformerEncoder): method __init__ (line 103) | def __init__(self, args): method forward (line 131) | def forward(self, src_tokens, src_lengths): method conv_layer_stride (line 149) | def conv_layer_stride(args): class ConvtransformerEmformer (line 155) | class ConvtransformerEmformer(SimulConvTransformerModel): method add_args (line 157) | def add_args(parser): method build_encoder (line 190) | def build_encoder(cls, args): function convtransformer_emformer_base (line 203) | def convtransformer_emformer_base(args): FILE: examples/simultaneous_translation/models/transformer_monotonic_attention.py class TransformerUnidirectionalModel (line 47) | class TransformerUnidirectionalModel(TransformerModel): method build_encoder (line 49) | def build_encoder(cls, args, src_dict, embed_tokens): class TransformerModelSimulTrans (line 54) | class TransformerModelSimulTrans(TransformerModel): method build_encoder (line 56) | def build_encoder(cls, args, src_dict, embed_tokens): method build_decoder (line 60) | def build_decoder(cls, args, tgt_dict, embed_tokens): class TransformerMonotonicEncoder (line 64) | class TransformerMonotonicEncoder(TransformerEncoder): method __init__ (line 65) | def __init__(self, args, dictionary, embed_tokens): class TransformerMonotonicDecoder (line 78) | class TransformerMonotonicDecoder(TransformerDecoder): method __init__ (line 91) | def __init__(self, args, dictionary, embed_tokens, no_encoder_attn=Fal... method set_num_updates (line 105) | def set_num_updates(self, num_updates): method pre_attention (line 108) | def pre_attention( method post_attention (line 155) | def post_attention(self, x): method clean_cache (line 167) | def clean_cache( method extract_features (line 185) | def extract_features( function base_monotonic_architecture (line 264) | def base_monotonic_architecture(args): function transformer_monotonic_iwslt_de_en (line 272) | def transformer_monotonic_iwslt_de_en(args): function transformer_monotonic_vaswani_wmt_en_de_big (line 281) | def transformer_monotonic_vaswani_wmt_en_de_big(args): function transformer_monotonic_vaswani_wmt_en_fr_big (line 288) | def transformer_monotonic_vaswani_wmt_en_fr_big(args): function transformer_unidirectional_iwslt_de_en (line 295) | def transformer_unidirectional_iwslt_de_en(args): function monotonic_tiny_architecture (line 300) | def monotonic_tiny_architecture(args): FILE: examples/simultaneous_translation/modules/fixed_pre_decision.py function fixed_pooling_monotonic_attention (line 17) | def fixed_pooling_monotonic_attention(monotonic_attention): class WaitKAttentionFixedStride (line 177) | class WaitKAttentionFixedStride: class MonotonicAttentionFixedStride (line 183) | class MonotonicAttentionFixedStride: class MonotonicInfiniteLookbackAttentionFixedStride (line 189) | class MonotonicInfiniteLookbackAttentionFixedStride: FILE: examples/simultaneous_translation/modules/monotonic_multihead_attention.py class MonotonicAttention (line 29) | class MonotonicAttention(MultiheadAttention): method __init__ (line 36) | def __init__(self, args): method add_args (line 67) | def add_args(parser): method energy_from_qk (line 90) | def energy_from_qk( method p_choose_from_qk (line 134) | def p_choose_from_qk(self, query, key, key_padding_mask, incremental_s... method p_choose (line 151) | def p_choose(self, query, key, key_padding_mask, incremental_states=No... method monotonic_attention_process_infer (line 154) | def monotonic_attention_process_infer( method monotonic_attention_process_train (line 272) | def monotonic_attention_process_train( method forward (line 325) | def forward( method _get_monotonic_buffer (line 402) | def _get_monotonic_buffer(self, incremental_state: Optional[Dict[str, ... method _set_monotonic_buffer (line 413) | def _set_monotonic_buffer(self, incremental_state: Optional[Dict[str, ... class MonotonicInfiniteLookbackAttention (line 422) | class MonotonicInfiniteLookbackAttention( method __init__ (line 425) | def __init__(self, args): method init_soft_attention (line 430) | def init_soft_attention(self): class WaitKAttention (line 451) | class WaitKAttention( method __init__ (line 459) | def __init__(self, args): method add_args (line 470) | def add_args(parser): method p_choose_from_qk (line 480) | def p_choose_from_qk( class ChunkwiseAttention (line 503) | class ChunkwiseAttention( method __init__ (line 506) | def __init__(self, args): method add_args (line 512) | def add_args(parser): FILE: examples/simultaneous_translation/modules/monotonic_transformer_layer.py class TransformerMonotonicEncoderLayer (line 16) | class TransformerMonotonicEncoderLayer(TransformerEncoderLayer): method forward (line 17) | def forward(self, x, encoder_padding_mask): class TransformerMonotonicDecoderLayer (line 24) | class TransformerMonotonicDecoderLayer(TransformerDecoderLayer): method __init__ (line 25) | def __init__(self, args): method prune_incremental_state (line 31) | def prune_incremental_state( method forward (line 48) | def forward( FILE: examples/simultaneous_translation/tests/test_alignment_train.py class AlignmentTrainTest (line 15) | class AlignmentTrainTest(TestCase): method _test_custom_alignment_train_ref (line 16) | def _test_custom_alignment_train_ref(self, p_choose, eps): method _test_custom_alignment_train_impl (line 48) | def _test_custom_alignment_train_impl(self, p_choose, alpha, eps): method test_alignment_train (line 63) | def test_alignment_train(self, bsz, tgt_len, src_len, device): FILE: examples/simultaneous_translation/tests/test_text_models.py function generate_config (line 28) | def generate_config(overrides_kv): function make_sample_with_padding (line 35) | def make_sample_with_padding(longer_src=False) -> Dict[str, Any]: function build_transformer_monotonic_attention (line 71) | def build_transformer_monotonic_attention(**extra_args: Any): function expected_alignment_formula (line 98) | def expected_alignment_formula( function mass_perservation_formula (line 156) | def mass_perservation_formula(alpha, left_padding=False, padding_mask=No... function expected_soft_attention_formula (line 186) | def expected_soft_attention_formula( class MonotonicAttentionTestAbstractClass (line 227) | class MonotonicAttentionTestAbstractClass(object): method test_forward (line 228) | def test_forward(self): method test_p_choose (line 234) | def test_p_choose(self): method test_expected_alignment (line 242) | def test_expected_alignment(self): class HardMonotonicAttentionTestCase (line 265) | class HardMonotonicAttentionTestCase( method setUp (line 269) | def setUp(self): class InfiniteLookbackTestCase (line 275) | class InfiniteLookbackTestCase( method setUp (line 279) | def setUp(self): method test_fp16_for_long_input (line 289) | def test_fp16_for_long_input(self): method test_expected_attention (line 304) | def test_expected_attention(self): class ChunkwiswTestCase (line 345) | class ChunkwiswTestCase( method setUp (line 348) | def setUp(self): class WaitkTestCase (line 359) | class WaitkTestCase(InfiniteLookbackTestCase): method setUp (line 360) | def setUp(self): method check_waitk (line 370) | def check_waitk(self, p_choose, lagging, padding_mask): method test_waitk_p_choose (line 381) | def test_waitk_p_choose(self): FILE: examples/simultaneous_translation/utils/functions.py function prob_check (line 9) | def prob_check(tensor, eps=1e-10): function exclusive_cumprod (line 20) | def exclusive_cumprod(tensor, dim: int, eps: float = 1e-10): function safe_cumprod (line 48) | def safe_cumprod(tensor, dim: int, eps: float = 1e-10): function moving_sum (line 69) | def moving_sum(x, start_idx: int, end_idx: int): FILE: examples/simultaneous_translation/utils/monotonic_attention.py function expected_alignment_from_p_choose (line 12) | def expected_alignment_from_p_choose( function expected_soft_attention (line 62) | def expected_soft_attention( function mass_preservation (line 137) | def mass_preservation( FILE: examples/simultaneous_translation/utils/p_choose_strategy.py function waitk_p_choose (line 6) | def waitk_p_choose( function learnable_p_choose (line 102) | def learnable_p_choose( FILE: examples/speech_recognition/criterions/ASG_loss.py class ASGCriterion (line 15) | class ASGCriterion(FairseqCriterion): method add_args (line 17) | def add_args(parser): method __init__ (line 40) | def __init__( method build_criterion (line 74) | def build_criterion(cls, args, task): method linseg_step (line 84) | def linseg_step(self): method replace_eos_with_silence (line 98) | def replace_eos_with_silence(self, tgt): method forward (line 106) | def forward(self, model, sample, reduce=True): method aggregate_logging_outputs (line 158) | def aggregate_logging_outputs(logging_outputs): FILE: examples/speech_recognition/criterions/cross_entropy_acc.py class CrossEntropyWithAccCriterion (line 18) | class CrossEntropyWithAccCriterion(FairseqCriterion): method __init__ (line 19) | def __init__(self, task, sentence_avg): method compute_loss (line 23) | def compute_loss(self, model, net_output, target, reduction, log_probs): method get_logging_output (line 46) | def get_logging_output(self, sample, target, lprobs, loss): method forward (line 69) | def forward(self, model, sample, reduction="sum", log_probs=True): method aggregate_logging_outputs (line 103) | def aggregate_logging_outputs(logging_outputs): FILE: examples/speech_recognition/data/asr_dataset.py class AsrDataset (line 15) | class AsrDataset(FairseqDataset): method __init__ (line 33) | def __init__( method __getitem__ (line 74) | def __getitem__(self, index): method __len__ (line 94) | def __len__(self): method collater (line 97) | def collater(self, samples): method num_tokens (line 108) | def num_tokens(self, index): method size (line 111) | def size(self, index): method ordered_indices (line 119) | def ordered_indices(self): FILE: examples/speech_recognition/data/collaters.py class Seq2SeqCollater (line 21) | class Seq2SeqCollater(object): method __init__ (line 29) | def __init__( method _collate_frames (line 43) | def _collate_frames(self, frames): method collate (line 60) | def collate(self, samples): FILE: examples/speech_recognition/data/data_utils.py function calc_mean_invstddev (line 9) | def calc_mean_invstddev(feature): function apply_mv_norm (line 21) | def apply_mv_norm(features): function lengths_to_encoder_padding_mask (line 31) | def lengths_to_encoder_padding_mask(lengths, batch_first=False): function encoder_padding_mask_to_lengths (line 67) | def encoder_padding_mask_to_lengths( FILE: examples/speech_recognition/data/replabels.py function replabel_symbol (line 13) | def replabel_symbol(i): function pack_replabels (line 21) | def pack_replabels(tokens, dictionary, max_reps): function unpack_replabels (line 49) | def unpack_replabels(tokens, dictionary, max_reps): FILE: examples/speech_recognition/datasets/asr_prep_json.py function process_sample (line 24) | def process_sample(aud_path, lable, utt_id, sp, tgt_dict): function main (line 43) | def main(): FILE: examples/speech_recognition/infer.py function add_asr_eval_argument (line 31) | def add_asr_eval_argument(parser): function check_args (line 89) | def check_args(args): function get_dataset_itr (line 100) | def get_dataset_itr(args, task, models): function process_predictions (line 115) | def process_predictions( function prepare_result_files (line 158) | def prepare_result_files(args): function optimize_models (line 181) | def optimize_models(args, use_cuda, models): function apply_half (line 194) | def apply_half(t): class ExistingEmissionsDecoder (line 200) | class ExistingEmissionsDecoder(object): method __init__ (line 201) | def __init__(self, decoder, emissions): method generate (line 205) | def generate(self, models, sample, **unused): function main (line 216) | def main(args, task=None, model_state=None): function make_parser (line 423) | def make_parser(): function cli_main (line 429) | def cli_main(): FILE: examples/speech_recognition/kaldi/add-self-loop-simple.cc function int32 (line 22) | int32 AddSelfLoopsSimple(fst::StdVectorFst* fst) { function print_usage (line 67) | void print_usage() { function main (line 73) | int main(int argc, char** argv) { FILE: examples/speech_recognition/kaldi/kaldi_decoder.py class KaldiDecoderConfig (line 26) | class KaldiDecoderConfig(FairseqDataclass): class KaldiDecoder (line 50) | class KaldiDecoder(object): method __init__ (line 51) | def __init__( method generate (line 127) | def generate(self, models, sample, **unused): method get_emissions (line 137) | def get_emissions(self, models, encoder_input): method decode_one (line 177) | def decode_one(self, logits, padding): method decode (line 233) | def decode(self, emissions, padding): FILE: examples/speech_recognition/kaldi/kaldi_initializer.py class KaldiInitializerConfig (line 30) | class KaldiInitializerConfig(FairseqDataclass): function create_units (line 42) | def create_units(fst_dir: Path, in_labels: str, vocab: Dictionary) -> Path: function create_lexicon (line 58) | def create_lexicon( function create_G (line 132) | def create_G( function create_L (line 154) | def create_L( function create_LG (line 230) | def create_LG( function create_H (line 290) | def create_H( function create_HLGa (line 430) | def create_HLGa( function create_HLa (line 493) | def create_HLa( function create_HLG (line 556) | def create_HLG( function initalize_kaldi (line 612) | def initalize_kaldi(cfg: KaldiInitializerConfig) -> Path: function cli_main (line 673) | def cli_main(cfg: KaldiInitializerConfig) -> None: FILE: examples/speech_recognition/models/vggtransformer.py class VGGTransformerModel (line 31) | class VGGTransformerModel(FairseqEncoderDecoderModel): method __init__ (line 37) | def __init__(self, encoder, decoder): method add_args (line 41) | def add_args(parser): method build_encoder (line 124) | def build_encoder(cls, args, task): method build_decoder (line 134) | def build_decoder(cls, args, task): method build_model (line 144) | def build_model(cls, args, task): method get_normalized_probs (line 154) | def get_normalized_probs(self, net_output, log_probs, sample=None): function prepare_transformer_encoder_params (line 176) | def prepare_transformer_encoder_params( function prepare_transformer_decoder_params (line 196) | def prepare_transformer_decoder_params( class VGGTransformerEncoder (line 217) | class VGGTransformerEncoder(FairseqEncoder): method __init__ (line 220) | def __init__( method forward (line 328) | def forward(self, src_tokens, src_lengths, **kwargs): method infer_conv_output_dim (line 391) | def infer_conv_output_dim(self, in_channels, input_dim): method validate_transformer_config (line 401) | def validate_transformer_config(self, transformer_config): method parse_transformer_context (line 412) | def parse_transformer_context(self, transformer_context): method parse_transformer_sampling (line 446) | def parse_transformer_sampling(self, transformer_sampling, num_layers): method slice (line 484) | def slice(self, embedding, padding_mask, attn_mask, sampling_factor): method lengths_to_attn_mask (line 498) | def lengths_to_attn_mask(self, input_lengths, subsampling_factor=1): method reorder_encoder_out (line 550) | def reorder_encoder_out(self, encoder_out, new_order): class TransformerDecoder (line 561) | class TransformerDecoder(FairseqIncrementalDecoder): method __init__ (line 575) | def __init__( method forward (line 629) | def forward(self, prev_output_tokens, encoder_out=None, incremental_st... method buffered_future_mask (line 700) | def buffered_future_mask(self, tensor): method _transpose_if_training (line 716) | def _transpose_if_training(self, x, incremental_state): method _transpose_if_inference (line 721) | def _transpose_if_inference(self, x, incremental_state): class VGGTransformerEncoderModel (line 728) | class VGGTransformerEncoderModel(FairseqEncoderModel): method __init__ (line 729) | def __init__(self, encoder): method add_args (line 733) | def add_args(parser): method build_model (line 794) | def build_model(cls, args, task): method get_normalized_probs (line 809) | def get_normalized_probs(self, net_output, log_probs, sample=None): class VGGTransformerEncoderOnly (line 819) | class VGGTransformerEncoderOnly(VGGTransformerEncoder): method __init__ (line 820) | def __init__( method forward (line 842) | def forward(self, src_tokens, src_lengths, **kwargs): method max_positions (line 858) | def max_positions(self): function Embedding (line 863) | def Embedding(num_embeddings, embedding_dim, padding_idx): function Linear (line 870) | def Linear(in_features, out_features, bias=True, dropout=0): function LinearizedConv1d (line 879) | def LinearizedConv1d(in_channels, out_channels, kernel_size, dropout=0, ... function LayerNorm (line 888) | def LayerNorm(embedding_dim): function base_architecture (line 894) | def base_architecture(args): function vggtransformer_1 (line 913) | def vggtransformer_1(args): function vggtransformer_2 (line 934) | def vggtransformer_2(args): function vggtransformer_base (line 955) | def vggtransformer_base(args): function base_architecture_enconly (line 992) | def base_architecture_enconly(args): function vggtransformer_enc_1 (line 1007) | def vggtransformer_enc_1(args): FILE: examples/speech_recognition/models/w2l_conv_glu_enc.py class W2lConvGluEncoderModel (line 44) | class W2lConvGluEncoderModel(FairseqEncoderModel): method __init__ (line 45) | def __init__(self, encoder): method add_args (line 49) | def add_args(parser): method build_model (line 74) | def build_model(cls, args, task): method get_normalized_probs (line 85) | def get_normalized_probs(self, net_output, log_probs, sample=None): class W2lConvGluEncoder (line 91) | class W2lConvGluEncoder(FairseqEncoder): method __init__ (line 92) | def __init__( method forward (line 123) | def forward(self, src_tokens, src_lengths, **kwargs): method reorder_encoder_out (line 159) | def reorder_encoder_out(self, encoder_out, new_order): method max_positions (line 168) | def max_positions(self): function w2l_conv_glu_enc (line 174) | def w2l_conv_glu_enc(args): FILE: examples/speech_recognition/new/decoders/base_decoder.py class BaseDecoder (line 14) | class BaseDecoder: method __init__ (line 15) | def __init__(self, tgt_dict: Dictionary) -> None: method generate (line 31) | def generate( method get_emissions (line 40) | def get_emissions( method get_tokens (line 53) | def get_tokens(self, idxs: torch.IntTensor) -> torch.LongTensor: method decode (line 58) | def decode( FILE: examples/speech_recognition/new/decoders/decoder.py function Decoder (line 16) | def Decoder( FILE: examples/speech_recognition/new/decoders/decoder_config.py class DecoderConfig (line 19) | class DecoderConfig(FairseqDataclass): class FlashlightDecoderConfig (line 27) | class FlashlightDecoderConfig(FairseqDataclass): FILE: examples/speech_recognition/new/decoders/flashlight_decoder.py class KenLMDecoder (line 54) | class KenLMDecoder(BaseDecoder): method __init__ (line 55) | def __init__(self, cfg: FlashlightDecoderConfig, tgt_dict: Dictionary)... method get_timesteps (line 123) | def get_timesteps(self, token_idxs: List[int]) -> List[int]: method decode (line 144) | def decode( class FairseqLM (line 181) | class FairseqLM(LM): method __init__ (line 182) | def __init__(self, dictionary: Dictionary, model: FairseqModel) -> None: method start (line 200) | def start(self, start_with_nothing: bool) -> LMState: method score (line 217) | def score( method finish (line 297) | def finish(self, state: LMState) -> Tuple[LMState, int]: method empty_cache (line 306) | def empty_cache(self) -> None: class FairseqLMDecoder (line 312) | class FairseqLMDecoder(BaseDecoder): method __init__ (line 313) | def __init__(self, cfg: FlashlightDecoderConfig, tgt_dict: Dictionary)... method decode (line 405) | def decode( FILE: examples/speech_recognition/new/decoders/viterbi_decoder.py class ViterbiDecoder (line 15) | class ViterbiDecoder(BaseDecoder): method decode (line 16) | def decode( FILE: examples/speech_recognition/new/infer.py class DecodingConfig (line 52) | class DecodingConfig(DecoderConfig, FlashlightDecoderConfig): class InferConfig (line 66) | class InferConfig(FairseqDataclass): function reset_logging (line 82) | def reset_logging(): class InferenceProcessor (line 97) | class InferenceProcessor: method __init__ (line 100) | def __init__(self, cfg: InferConfig) -> None: method __enter__ (line 151) | def __enter__(self) -> "InferenceProcessor": method __exit__ (line 160) | def __exit__(self, *exc) -> bool: method __iter__ (line 169) | def __iter__(self) -> Any: method log (line 179) | def log(self, *args, **kwargs): method print (line 182) | def print(self, *args, **kwargs): method get_res_file (line 185) | def get_res_file(self, fname: str) -> None: method merge_shards (line 191) | def merge_shards(self) -> None: method optimize_model (line 223) | def optimize_model(self, model: FairseqModel) -> None: method load_model_ensemble (line 230) | def load_model_ensemble(self) -> Tuple[List[FairseqModel], FairseqData... method get_dataset_itr (line 244) | def get_dataset_itr(self, disable_iterator_cache: bool = False) -> None: method build_progress_bar (line 260) | def build_progress_bar( method data_parallel_world_size (line 277) | def data_parallel_world_size(self): method data_parallel_rank (line 283) | def data_parallel_rank(self): method process_sentence (line 288) | def process_sentence( method process_sample (line 330) | def process_sample(self, sample: Dict[str, Any]) -> None: method log_generation_time (line 357) | def log_generation_time(self) -> None: function parse_wer (line 369) | def parse_wer(wer_file: Path) -> float: function get_wer_file (line 374) | def get_wer_file(cfg: InferConfig) -> Path: function main (line 388) | def main(cfg: InferConfig) -> float: function hydra_main (line 444) | def hydra_main(cfg: InferConfig) -> Union[float, Tuple[float, Optional[f... function cli_main (line 479) | def cli_main() -> None: FILE: examples/speech_recognition/tasks/speech_recognition.py function get_asr_dataset_from_json (line 18) | def get_asr_dataset_from_json(data_json_path, tgt_dict): class SpeechRecognitionTask (line 69) | class SpeechRecognitionTask(LegacyFairseqTask): method add_args (line 75) | def add_args(parser): method __init__ (line 96) | def __init__(self, args, tgt_dict): method setup_task (line 101) | def setup_task(cls, args, **kwargs): method load_dataset (line 117) | def load_dataset(self, split, combine=False, **kwargs): method build_generator (line 126) | def build_generator(self, models, args, **unused): method target_dictionary (line 144) | def target_dictionary(self): method source_dictionary (line 150) | def source_dictionary(self): method max_positions (line 155) | def max_positions(self): FILE: examples/speech_recognition/utils/wer_utils.py class Code (line 24) | class Code(Enum): class Token (line 31) | class Token(object): method __init__ (line 32) | def __init__(self, lbl="", st=np.nan, en=np.nan): class AlignmentResult (line 39) | class AlignmentResult(object): method __init__ (line 40) | def __init__(self, refs, hyps, codes, score): function coordinate_to_offset (line 47) | def coordinate_to_offset(row, col, ncols): function offset_to_row (line 51) | def offset_to_row(offset, ncols): function offset_to_col (line 55) | def offset_to_col(offset, ncols): function trimWhitespace (line 59) | def trimWhitespace(str): function str2toks (line 63) | def str2toks(str): class EditDistance (line 71) | class EditDistance(object): method __init__ (line 72) | def __init__(self, time_mediated): method cost (line 80) | def cost(self, ref, hyp, code): method get_result (line 98) | def get_result(self, refs, hyps): method align (line 141) | def align(self, refs, hyps): class WERTransformer (line 205) | class WERTransformer(object): method __init__ (line 206) | def __init__(self, hyp_str, ref_str, verbose=True): method process (line 221) | def process(self, input): # std::vector&& input method report_result (line 294) | def report_result(self): method wer (line 320) | def wer(self): method stats (line 331) | def stats(self): function calc_wer (line 354) | def calc_wer(hyp_str, ref_str): function calc_wer_stats (line 359) | def calc_wer_stats(hyp_str, ref_str): function get_wer_alignment_codes (line 364) | def get_wer_alignment_codes(hyp_str, ref_str): function merge_counts (line 373) | def merge_counts(x, y): FILE: examples/speech_recognition/w2l_decoder.py class W2lDecoder (line 49) | class W2lDecoder(object): method __init__ (line 50) | def __init__(self, args, tgt_dict): method generate (line 70) | def generate(self, models, sample, **unused): method get_emissions (line 80) | def get_emissions(self, models, encoder_input): method get_tokens (line 90) | def get_tokens(self, idxs): class W2lViterbiDecoder (line 97) | class W2lViterbiDecoder(W2lDecoder): method __init__ (line 98) | def __init__(self, args, tgt_dict): method decode (line 101) | def decode(self, emissions): class W2lKenLMDecoder (line 125) | class W2lKenLMDecoder(W2lDecoder): method __init__ (line 126) | def __init__(self, args, tgt_dict): method get_timesteps (line 198) | def get_timesteps(self, token_idxs: List[int]) -> List[int]: method decode (line 219) | def decode(self, emissions): class FairseqLM (line 246) | class FairseqLM(LM): method __init__ (line 247) | def __init__(self, dictionary, model): method start (line 263) | def start(self, start_with_nothing): method score (line 280) | def score(self, state: LMState, token_index: int, no_cache: bool = Fal... method finish (line 356) | def finish(self, state: LMState): method empty_cache (line 366) | def empty_cache(self): class W2lFairseqLMDecoder (line 372) | class W2lFairseqLMDecoder(W2lDecoder): method __init__ (line 373) | def __init__(self, args, tgt_dict): method decode (line 462) | def decode(self, emissions): FILE: examples/speech_synthesis/data_utils.py function trim_or_pad_to_target_length (line 26) | def trim_or_pad_to_target_length( function extract_logmel_spectrogram (line 46) | def extract_logmel_spectrogram( function extract_pitch (line 79) | def extract_pitch( function extract_energy (line 137) | def extract_energy( function get_global_cmvn (line 190) | def get_global_cmvn(feature_root: Path, output_path: Optional[Path] = No... function ipa_phonemize (line 223) | def ipa_phonemize(text, lang="en-us", use_g2p=False): class ForceAlignmentInfo (line 249) | class ForceAlignmentInfo(object): function get_mfa_alignment_by_sample_id (line 256) | def get_mfa_alignment_by_sample_id( function get_mfa_alignment (line 299) | def get_mfa_alignment( function get_unit_alignment (line 310) | def get_unit_alignment( function get_feature_value_min_max (line 333) | def get_feature_value_min_max(feature_paths: List[str]): FILE: examples/speech_synthesis/evaluation/eval_asr.py function preprocess_text (line 17) | def preprocess_text(text): function prepare_w2v_data (line 23) | def prepare_w2v_data( function run_asr (line 44) | def run_asr(asr_dir, split, w2v_ckpt, w2v_label, res_dir): function compute_error_rate (line 61) | def compute_error_rate(hyp_wrd_path, ref_wrd_path, unit="word"): function main (line 82) | def main(args): FILE: examples/speech_synthesis/evaluation/eval_f0.py function difference_function (line 22) | def difference_function(x, n, tau_max): function cumulative_mean_normalized_difference_function (line 49) | def cumulative_mean_normalized_difference_function(df, n): function get_pitch (line 64) | def get_pitch(cmdf, tau_min, tau_max, harmo_th=0.1): function compute_yin (line 87) | def compute_yin(sig, sr, w_len=512, w_step=256, f0_min=100, f0_max=500, function extract_f0 (line 145) | def extract_f0(samples): function eval_f0_error (line 171) | def eval_f0_error(samples, distortion_fn): function eval_gross_pitch_error (line 194) | def eval_gross_pitch_error(samples): function eval_voicing_decision_error (line 198) | def eval_voicing_decision_error(samples): function eval_f0_frame_error (line 202) | def eval_f0_frame_error(samples): function print_results (line 206) | def print_results(results, show_bin): function main (line 236) | def main(eval_f0, gpe, vde, ffe, show_bin): FILE: examples/speech_synthesis/evaluation/eval_sp.py function load_eval_spec (line 24) | def load_eval_spec(path): function eval_distortion (line 31) | def eval_distortion(samples, distortion_fn, device="cuda"): function eval_mel_cepstral_distortion (line 61) | def eval_mel_cepstral_distortion(samples, device="cuda"): function eval_mel_spectral_distortion (line 65) | def eval_mel_spectral_distortion(samples, device="cuda"): function print_results (line 69) | def print_results(results, show_bin): function main (line 109) | def main(eval_spec, mcd, msd, show_bin): FILE: examples/speech_synthesis/evaluation/get_eval_manifest.py function main (line 11) | def main(args): FILE: examples/speech_synthesis/generate_waveform.py function make_parser (line 28) | def make_parser(): function postprocess_results (line 44) | def postprocess_results( function dump_result (line 67) | def dump_result( function main (line 126) | def main(args): function cli_main (line 185) | def cli_main(): FILE: examples/speech_synthesis/preprocessing/denoise_and_vad_audio.py function generate_tmp_filename (line 37) | def generate_tmp_filename(extension="txt"): function convert_sr (line 42) | def convert_sr(inpath, sr, output_path=None): function apply_vad (line 50) | def apply_vad(vad, inpath): function write (line 73) | def write(wav, filename, sr=16_000): function process (line 80) | def process(args): function main (line 174) | def main(): FILE: examples/speech_synthesis/preprocessing/denoiser/demucs.py class BLSTM (line 19) | class BLSTM(nn.Module): method __init__ (line 20) | def __init__(self, dim, layers=2, bi=True): method forward (line 30) | def forward(self, x, hidden=None): function rescale_conv (line 37) | def rescale_conv(conv, reference): function rescale_module (line 45) | def rescale_module(module, reference): class Demucs (line 51) | class Demucs(nn.Module): method __init__ (line 75) | def __init__(self, method valid_length (line 136) | def valid_length(self, length): method total_stride (line 155) | def total_stride(self): method forward (line 158) | def forward(self, mix): function fast_conv (line 197) | def fast_conv(conv, x): class DemucsStreamer (line 218) | class DemucsStreamer: method __init__ (line 235) | def __init__(self, demucs, method reset_time_per_frame (line 268) | def reset_time_per_frame(self): method time_per_frame (line 273) | def time_per_frame(self): method flush (line 276) | def flush(self): method feed (line 288) | def feed(self, wav): method _separate_frame (line 355) | def _separate_frame(self, frame): function test (line 426) | def test(): FILE: examples/speech_synthesis/preprocessing/denoiser/pretrained.py function _demucs (line 22) | def _demucs(pretrained, url, **kwargs): function dns48 (line 30) | def dns48(pretrained=True): function dns64 (line 34) | def dns64(pretrained=True): function master64 (line 38) | def master64(pretrained=True): function add_model_flags (line 42) | def add_model_flags(parser): function get_model (line 61) | def get_model(args): FILE: examples/speech_synthesis/preprocessing/denoiser/resample.py function sinc (line 14) | def sinc(t): function kernel_upsample2 (line 23) | def kernel_upsample2(zeros=56): function upsample2 (line 35) | def upsample2(x, zeros=56): function kernel_downsample2 (line 51) | def kernel_downsample2(zeros=56): function downsample2 (line 63) | def downsample2(x, zeros=56): FILE: examples/speech_synthesis/preprocessing/denoiser/utils.py function capture_init (line 19) | def capture_init(init): function deserialize_model (line 33) | def deserialize_model(package, strict=False): function copy_state (line 52) | def copy_state(state): function serialize_model (line 56) | def serialize_model(model): function swap_state (line 63) | def swap_state(model, state): function pull_metric (line 80) | def pull_metric(history, name): class LogProgress (line 88) | class LogProgress: method __init__ (line 101) | def __init__(self, method update (line 115) | def update(self, **infos): method __iter__ (line 118) | def __iter__(self): method __next__ (line 125) | def __next__(self): method _log (line 139) | def _log(self): function colorize (line 154) | def colorize(text, color): function bold (line 163) | def bold(text): function cal_snr (line 170) | def cal_snr(lbl, est): FILE: examples/speech_synthesis/preprocessing/get_common_voice_audio_manifest.py function get_top_n (line 25) | def get_top_n( function get_splits (line 45) | def get_splits( function convert_to_wav (line 77) | def convert_to_wav(root: Path, filenames: List[str], target_sr=16_000): function process (line 92) | def process(args): function main (line 128) | def main(): FILE: examples/speech_synthesis/preprocessing/get_feature_manifest.py function process (line 36) | def process(args): function main (line 233) | def main(): FILE: examples/speech_synthesis/preprocessing/get_ljspeech_audio_manifest.py function process (line 23) | def process(args): function main (line 60) | def main(): FILE: examples/speech_synthesis/preprocessing/get_speaker_embedding.py function extract_embedding (line 22) | def extract_embedding(audio_path, embedder): function process (line 35) | def process(args): function main (line 74) | def main(): FILE: examples/speech_synthesis/preprocessing/get_vctk_audio_manifest.py function normalize_text (line 25) | def normalize_text(text): function process (line 29) | def process(args): function main (line 66) | def main(): FILE: examples/speech_synthesis/preprocessing/speaker_embedder/__init__.py function set_requires_grad (line 26) | def set_requires_grad(nets, requires_grad=False): class LinearNorm (line 41) | class LinearNorm(nn.Module): method __init__ (line 42) | def __init__(self, hp): method forward (line 46) | def forward(self, x): class SpeechEmbedder (line 50) | class SpeechEmbedder(nn.Module): method __init__ (line 51) | def __init__(self, hp): method forward (line 60) | def forward(self, mel): class SpkrEmbedder (line 75) | class SpkrEmbedder(nn.Module): method __init__ (line 78) | def __init__( method get_mel (line 110) | def get_mel(self, y): method forward (line 123) | def forward(self, inputs): FILE: examples/speech_synthesis/preprocessing/vad/__init__.py function read_wave (line 26) | def read_wave(path): function write_wave (line 41) | def write_wave(path, audio, sample_rate): class Frame (line 52) | class Frame(object): method __init__ (line 54) | def __init__(self, bytes, timestamp, duration): function frame_generator (line 60) | def frame_generator(frame_duration_ms, audio, sample_rate): function vad_collector (line 76) | def vad_collector(sample_rate, frame_duration_ms, function main (line 145) | def main(args): FILE: examples/speech_synthesis/utils.py function batch_mel_spectral_distortion (line 16) | def batch_mel_spectral_distortion( function _same_t_in_true_and_est (line 39) | def _same_t_in_true_and_est(func): function gross_pitch_error (line 55) | def gross_pitch_error(true_t, true_f, est_t, est_f): function _gross_pitch_error_frames (line 69) | def _gross_pitch_error_frames(true_t, true_f, est_t, est_f, eps=1e-8): function _true_voiced_frames (line 76) | def _true_voiced_frames(true_t, true_f, est_t, est_f): function _voicing_decision_error_frames (line 80) | def _voicing_decision_error_frames(true_t, true_f, est_t, est_f): function f0_frame_error (line 85) | def f0_frame_error(true_t, true_f, est_t, est_f): function voicing_decision_error (line 97) | def voicing_decision_error(true_t, true_f, est_t, est_f): FILE: examples/speech_text_joint_to_text/criterions/multi_modality_compound.py class SpeechTextPreTrainCompoundCriterionConfig (line 23) | class SpeechTextPreTrainCompoundCriterionConfig( class SpeechTextPreTrainCompoundCriterion (line 43) | class SpeechTextPreTrainCompoundCriterion(FairseqCriterion): method __init__ (line 44) | def __init__( method forward (line 65) | def forward(self, model, sample, reduce=True): method logging_outputs_can_be_summed (line 84) | def logging_outputs_can_be_summed() -> bool: method mode2value (line 93) | def mode2value(mode): # make the logging_outputs_can_be_summed = True method value2mode (line 101) | def value2mode(value): method reduce_metrics (line 109) | def reduce_metrics(logging_outputs) -> None: FILE: examples/speech_text_joint_to_text/criterions/multi_modality_cross_entropy.py class SpeechTextPreTrainCrossEntCriterion (line 20) | class SpeechTextPreTrainCrossEntCriterion(LabelSmoothedCrossEntropyCrite... method __init__ (line 21) | def __init__(self, task, sentence_avg, label_smoothing, report_accurac... method forward (line 26) | def forward(self, model, sample, reduce=True): method get_lprobs_and_target (line 44) | def get_lprobs_and_target(self, model, net_output, sample): method compute_loss (line 57) | def compute_loss(self, model, net_output, sample, reduce=True): FILE: examples/speech_text_joint_to_text/criterions/text_guide_cross_entropy_acc.py class GuidedCrossEntAccCriterion (line 16) | class GuidedCrossEntAccCriterion(FairseqCriterion): method __init__ (line 17) | def __init__( method add_args (line 44) | def add_args(parser): method forward (line 60) | def forward(self, model, sample, reduce=True): method compute_loss_and_acc (line 103) | def compute_loss_and_acc(self, model, lprobs, target, reduction='sum'): method guide_loss_and_acc (line 117) | def guide_loss_and_acc(self, model, lprobs, lprobs_teacher, target, re... method get_logging_output (line 140) | def get_logging_output( method aggregate_logging_outputs (line 180) | def aggregate_logging_outputs(logging_outputs): method reduce_metrics (line 218) | def reduce_metrics(cls, logging_outputs): FILE: examples/speech_text_joint_to_text/data/pair_denoising_dataset.py class LanguagePairDenoisingDataset (line 18) | class LanguagePairDenoisingDataset(LanguagePairDataset): method __init__ (line 19) | def __init__( method can_reuse_epoch_itr_across_epochs (line 123) | def can_reuse_epoch_itr_across_epochs(self): method set_epoch (line 126) | def set_epoch(self, epoch, **unused): method __getitem__ (line 129) | def __getitem__(self, index): method word_starts (line 177) | def word_starts(self, source): method add_whole_word_mask (line 186) | def add_whole_word_mask(self, source, p): method add_insertion_noise (line 297) | def add_insertion_noise(self, tokens, p): FILE: examples/speech_text_joint_to_text/models/joint_speech_text_pretrain_transformer.py class SpeechTextPreTrainEncoder (line 35) | class SpeechTextPreTrainEncoder(MultiModalityEncoder): method __init__ (line 36) | def __init__( method update_transformer_encoder_cfg (line 51) | def update_transformer_encoder_cfg(cls, args, update_dict): method build_text_encoder (line 60) | def build_text_encoder(cls, args, src_dictionary): method build_speech_encoder (line 71) | def build_speech_encoder(cls, args): method share_layers (line 83) | def share_layers(cls, src_layers, tgt_layers): # share layer but not ... method build_unsup_speech_encoder (line 101) | def build_unsup_speech_encoder(cls, args, sup_speech_encoder): method build_encoder (line 130) | def build_encoder(cls, args, dictionary): method share_speech_text_encoder (line 185) | def share_speech_text_encoder( method select_encoder (line 202) | def select_encoder(self, mode, **kwargs): method forward (line 217) | def forward(self, src_tokens, src_lengths=None, mode="", alignment=Non... class SpeechDummyDecoder (line 222) | class SpeechDummyDecoder(FairseqDecoder): method __init__ (line 223) | def __init__( method extend_alignment (line 238) | def extend_alignment(self, alignment, src_lengths, prev_output_tokens): method forward (line 261) | def forward( method get_normalized_probs (line 353) | def get_normalized_probs( class SpeechTextPreTrainDecoder (line 364) | class SpeechTextPreTrainDecoder(MultiInputDecoder): method __init__ (line 365) | def __init__(self, dictionary, speech_decoder, text_decoder): method select_decoder (line 370) | def select_decoder(self, mode, **kwargs): method get_normalized_probs (line 387) | def get_normalized_probs( method build_text_decoder (line 401) | def build_text_decoder(cls, args, tgt_dictionary, dec_emb_share=None): method build_dummy_speech_decoder (line 413) | def build_dummy_speech_decoder(cls, args, dictionary, dec_emb_share=No... method build_decoder (line 428) | def build_decoder( class SpeechTextPreTrainModel (line 444) | class SpeechTextPreTrainModel(FairseqEncoderDecoderModel): method __init__ (line 445) | def __init__(self, encoder, decoder): method forward (line 449) | def forward( method max_positions (line 463) | def max_positions(self): method get_targets (line 466) | def get_targets(self, sample, net_output): method get_normalized_probs (line 474) | def get_normalized_probs( method add_args (line 486) | def add_args(parser): method build_model (line 550) | def build_model(cls, args, task): method upgrade_state_dict (line 558) | def upgrade_state_dict(self, state_dict): function speech_text_pretrain_bart_base (line 568) | def speech_text_pretrain_bart_base(args): function speech_text_pretrain_bart_base_stack (line 657) | def speech_text_pretrain_bart_base_stack(args): function speech_text_pretrain_bart_large (line 671) | def speech_text_pretrain_bart_large(args): function speech_text_pretrain_bart_large_stack (line 687) | def speech_text_pretrain_bart_large_stack(args): FILE: examples/speech_text_joint_to_text/models/s2t_dualinputtransformer.py class SpeechEoSEncoder (line 35) | class SpeechEoSEncoder(FairseqEncoder): method __init__ (line 36) | def __init__(self, encoder, eos_num, feat_dim, adapter_type="None", ad... method add_adapter (line 47) | def add_adapter(self, adapter_type, adapter_dim): method add_eos (line 77) | def add_eos(self, src_tokens, src_lengths): method apply_adapter (line 94) | def apply_adapter(self, enc_out): method forward (line 111) | def forward(self, src_tokens, src_lengths=None, return_all_hiddens=Fal... method reorder_encoder_out (line 121) | def reorder_encoder_out(self, encoder_out, new_order): class DualInputEncoder (line 125) | class DualInputEncoder(FairseqEncoder): method __init__ (line 126) | def __init__( method set_shared_layer (line 148) | def set_shared_layer(cls, share_level, src_layer, tgt_layer): method build_spch_encoder (line 185) | def build_spch_encoder(cls, args): method build_text_encoder (line 221) | def build_text_encoder(cls, args, src_dictionary, spch_encoder): method mult_rst_grad (line 278) | def mult_rst_grad(self, rst, ratio): method process_attentive_loss_states (line 284) | def process_attentive_loss_states(self, rst, interstates): method forward (line 289) | def forward( method reorder_encoder_out (line 375) | def reorder_encoder_out(self, encoder_out, new_order): class TransformerMultiInputDecoder (line 381) | class TransformerMultiInputDecoder(FairseqDecoder): method __init__ (line 382) | def __init__( method share_spchdecoder (line 400) | def share_spchdecoder(cls, task_args, text_decoder, spch_decoder): method cross_attentive_loss (line 439) | def cross_attentive_loss( method forward (line 484) | def forward( class DualInputS2TTransformerModel (line 557) | class DualInputS2TTransformerModel(FairseqEncoderDecoderModel): method __init__ (line 558) | def __init__(self, encoder, decoder): method max_positions (line 562) | def max_positions(self): method add_args (line 566) | def add_args(parser): method build_encoder (line 783) | def build_encoder(cls, args, task): method build_decoder (line 830) | def build_decoder(cls, args, task): method build_model (line 907) | def build_model(cls, args, task): method get_normalized_probs (line 917) | def get_normalized_probs(self, net_output, log_probs, sample=None): method set_num_updates (line 923) | def set_num_updates(self, num_updates): method forward (line 928) | def forward( function dualinputs2ttransformer_base (line 990) | def dualinputs2ttransformer_base(args): function dualinputs2ttransformer_s (line 1045) | def dualinputs2ttransformer_s(args): function dualinputs2ttransformer_m (line 1058) | def dualinputs2ttransformer_m(args): function dualinputs2ttransformer_b (line 1071) | def dualinputs2ttransformer_b(args): function dualinputs2ttransformer_l (line 1084) | def dualinputs2ttransformer_l(args): FILE: examples/speech_text_joint_to_text/models/s2t_dualinputwavtransformer.py class DualInputWavTransformerModel (line 32) | class DualInputWavTransformerModel(DualInputS2TTransformerModel): method __init__ (line 33) | def __init__(self, encoder, decoder): method add_args (line 37) | def add_args(parser): method update_transformer_encoder_cfg (line 223) | def update_transformer_encoder_cfg(cls, args, update_dict): method build_text_encoder (line 232) | def build_text_encoder(cls, args, src_dictionary): method build_speech_encoder (line 247) | def build_speech_encoder(cls, args): method check_args (line 255) | def check_args(cls, condition, is_strict, msg): method build_encoder (line 263) | def build_encoder(cls, args, task): method build_text_decoder (line 330) | def build_text_decoder(cls, args, tgt_dictionary, dec_emb_share=None): method build_decoder (line 342) | def build_decoder(cls, args, task): method load_pretrained_speech_text_components (line 381) | def load_pretrained_speech_text_components(cls, checkpoint, component_... method share_speech_text_encoder (line 398) | def share_speech_text_encoder( function dualinputs2twavtransformer_base (line 419) | def dualinputs2twavtransformer_base(args): function dualinputs2twavtransformer_base_stack (line 502) | def dualinputs2twavtransformer_base_stack(args): function dualinputs2twavtransformer_large (line 517) | def dualinputs2twavtransformer_large(args): FILE: examples/speech_text_joint_to_text/models/s2t_dualinputxmtransformer.py class TransformerSentenceEncoderLayerStd (line 34) | class TransformerSentenceEncoderLayerStd(TransformerSentenceEncoderLayer): method __init__ (line 35) | def __init__(self, sent_enc_layer): method forward (line 59) | def forward( class SharedEncoder (line 74) | class SharedEncoder(FairseqEncoder): method __init__ (line 75) | def __init__(self, wav2vec_enc, mbart_enc, adaptor, shared_layers): method forward (line 96) | def forward(self, src_tokens, src_lengths=None, **kwargs): class StackedWav2VecEncoderWithAdaptor (line 127) | class StackedWav2VecEncoderWithAdaptor(FairseqEncoder): method __init__ (line 128) | def __init__( method forward (line 146) | def forward(self, src_tokens, src_lengths=None, return_all_hiddens=Fal... method reorder_encoder_out (line 177) | def reorder_encoder_out(self, encoder_out, new_order): class DualInputXMTransformerModel (line 221) | class DualInputXMTransformerModel(DualInputS2TTransformerModel): method __init__ (line 222) | def __init__(self, encoder, decoder): method add_args (line 226) | def add_args(parser): method build_encoder (line 401) | def build_encoder(cls, args, task): method build_decoder (line 473) | def build_decoder(cls, args, task): method build_model (line 522) | def build_model(cls, args, task): function dualinputxmtransformer_base (line 534) | def dualinputxmtransformer_base(args): FILE: examples/speech_text_joint_to_text/scripts/convert_model.py function is_update (line 16) | def is_update(param_name, module_name): function load_checkpoint (line 22) | def load_checkpoint(src_cpt): function save_checkpoint (line 35) | def save_checkpoint(tgt_cpt, states): function main (line 45) | def main(): FILE: examples/speech_text_joint_to_text/scripts/g2p_encode.py function parse (line 19) | def parse(): function process_sent (line 42) | def process_sent(sent, g2p, res_wrds, args): function remove_punc (line 59) | def remove_punc(sent): function do_g2p (line 70) | def do_g2p(g2p, sent, res_wrds, is_first_sent): function pre_process_sent (line 80) | def pre_process_sent(sent, do_filter, lower_case, res_wrds): function dup_pho (line 95) | def dup_pho(sent, dup_v_num, dup_c_num): function add_word_start (line 114) | def add_word_start(sent): function load_reserve_word (line 129) | def load_reserve_word(reserve_word): function process_sents (line 139) | def process_sents(sents, args): function main (line 154) | def main(): FILE: examples/speech_text_joint_to_text/tasks/pair_denoising.py function gen_whole_word_mask (line 35) | def gen_whole_word_mask(args, dictionary): class PairedDenoisingTask (line 59) | class PairedDenoisingTask(TranslationTask): method add_args (line 64) | def add_args(parser): method setup_task (line 138) | def setup_task(cls, args, **kwargs): method __init__ (line 173) | def __init__(self, args, src_dict, tgt_dict): method language_pair_denoising_dataset (line 183) | def language_pair_denoising_dataset( method _get_sample_prob (line 302) | def _get_sample_prob(self, dataset_lens): method resample_datasets (line 312) | def resample_datasets(self, lang_datasets, lang_pairs_all, epoch): method load_dataset_only (line 352) | def load_dataset_only( method load_dataset (line 444) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): FILE: examples/speech_text_joint_to_text/tasks/speech_text_denoise_pretrain.py class SpeechTextJointDenoisingPreTask (line 30) | class SpeechTextJointDenoisingPreTask(PairedDenoisingTask): method add_args (line 38) | def add_args(cls, parser): method setup_task (line 192) | def setup_task(cls, args, **kwargs): method __init__ (line 231) | def __init__(self, args, src_dict, tgt_dict): method build_model (line 277) | def build_model(self, args): method build_tokenizer (line 282) | def build_tokenizer(self, data_cfg, msg=""): method build_bpe (line 286) | def build_bpe(self, data_cfg, msg=""): method resolve_data_type (line 291) | def resolve_data_type(cls, split, use_sup_speech_ctc): method create_modalitydatasetitem (line 311) | def create_modalitydatasetitem(self, dtype, dataset): method load_dataset (line 337) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method get_sample_ratio (line 544) | def get_sample_ratio(self, epoch): method get_batch_iterator (line 570) | def get_batch_iterator( FILE: examples/speech_text_joint_to_text/tasks/speech_text_joint.py class SpeechTextJointToTextTask (line 41) | class SpeechTextJointToTextTask(SpeechToTextTask): method add_args (line 47) | def add_args(cls, parser): method __init__ (line 122) | def __init__(self, args, src_dict, tgt_dict, infer_tgt_lang_id=None): method setup_task (line 132) | def setup_task(cls, args, **kwargs): method load_langpair_dataset (line 164) | def load_langpair_dataset( method inference_step (line 212) | def inference_step( method build_src_tokenizer (line 224) | def build_src_tokenizer(self, args): method build_src_bpe (line 228) | def build_src_bpe(self, args): method load_dataset (line 232) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method target_dictionary (line 302) | def target_dictionary(self): method source_dictionary (line 308) | def source_dictionary(self): method get_batch_iterator (line 313) | def get_batch_iterator( FILE: examples/speech_to_speech/asr_bleu/compute_asr_bleu.py function merge_tailo_init_final (line 12) | def merge_tailo_init_final(text): function remove_tone (line 31) | def remove_tone(text): function extract_audio_for_eval (line 38) | def extract_audio_for_eval(audio_dirpath: str, audio_format: str): function extract_text_for_eval (line 70) | def extract_text_for_eval( function compose_eval_data (line 86) | def compose_eval_data( function load_eval_data_from_tsv (line 117) | def load_eval_data_from_tsv(eval_data_filepath: str): function run_asr_bleu (line 126) | def run_asr_bleu(args): function main (line 164) | def main(): FILE: examples/speech_to_speech/asr_bleu/utils.py class DownloadProgressBar (line 18) | class DownloadProgressBar(tqdm): method update_to (line 21) | def update_to(self, b=1, bsize=1, tsize=None) -> None: function retrieve_asr_config (line 30) | def retrieve_asr_config(lang_key: str, asr_version: str, json_path: str)... class ASRGenerator (line 47) | class ASRGenerator(object): method __init__ (line 50) | def __init__( method prepare_hf_model (line 110) | def prepare_hf_model(self, model_cfg: dict) -> None: method prepare_fairseq_model (line 155) | def prepare_fairseq_model(self, model_cfg: dict) -> None: method load_audiofile (line 220) | def load_audiofile(self, audio_path: str) -> torch.Tensor: method compute_emissions (line 247) | def compute_emissions(self, audio_input: torch.Tensor) -> torch.Tensor: method decode_emissions (line 270) | def decode_emissions(self, emissions: torch.Tensor) -> str: method transcribe_audiofile (line 290) | def transcribe_audiofile(self, audio_path: str, lower=True) -> str: FILE: examples/speech_to_speech/benchmarking/core.py class BenchmarkingBase (line 29) | class BenchmarkingBase(nn.Module): method __init__ (line 30) | def __init__(self): method warm_up (line 34) | def warm_up(self, sample, repeat): method benchmark_run_time (line 40) | def benchmark_run_time(self, dataset, repeat): method benchmark_run_time_single_sample (line 51) | def benchmark_run_time_single_sample(self, sample, repeat): method count_flops (line 57) | def count_flops( method max_memory (line 75) | def max_memory(self, dataset, repeat): method gather_all_metrics (line 87) | def gather_all_metrics(self, dataset, repeat): method dump_final_speech_output (line 94) | def dump_final_speech_output( class Processing (line 117) | class Processing(BenchmarkingBase): method __init__ (line 120) | def __init__(self, args): method setUp (line 127) | def setUp(self, cfg): method encode_source (line 165) | def encode_source(self, src): method decode_target (line 180) | def decode_target(self, hypos): method forward (line 193) | def forward(self, sample): class GenerateWaveformFromCode (line 204) | class GenerateWaveformFromCode(BenchmarkingBase): method __init__ (line 207) | def __init__(self, args): method format_units (line 214) | def format_units(self, input): method generate_vocoder_input (line 218) | def generate_vocoder_input(self, dataset): method forward (line 221) | def forward(self, sample): class HubertUnitExtractor (line 225) | class HubertUnitExtractor(BenchmarkingBase): method __init__ (line 226) | def __init__(self, args): method forward (line 232) | def forward(self, sample): class SpeechGeneration (line 248) | class SpeechGeneration(BenchmarkingBase): method __init__ (line 252) | def __init__(self, args): method setUp (line 258) | def setUp(self, args): method processTextInput (line 284) | def processTextInput(self, text): method forward (line 312) | def forward(self, sample): class S2UT (line 318) | class S2UT(BenchmarkingBase): method __init__ (line 321) | def __init__(self, s2u_args, vocoder_args=None): method forward (line 329) | def forward(self, sample): method generate_s2u_outputs (line 338) | def generate_s2u_outputs(self, dataset): method compute_metrics (line 341) | def compute_metrics(self, metric_type, dataset, repeat=None): method benchmark_run_time (line 365) | def benchmark_run_time(self, dataset, repeat): method count_flops (line 368) | def count_flops(self, dataset, repeat): method max_memory (line 371) | def max_memory(self, dataset, repeat): class Cascaded2StageS2ST (line 375) | class Cascaded2StageS2ST(BenchmarkingBase): method __init__ (line 378) | def __init__(self, s2t_args, tts_args): method forward (line 386) | def forward(self, sample): method generate_s2t_outputs (line 397) | def generate_s2t_outputs(self, dataset): method generate_tts_inputs (line 401) | def generate_tts_inputs(self, dataset): method compute_metrics (line 405) | def compute_metrics(self, metric_type, dataset, repeat=None): method benchmark_run_time (line 428) | def benchmark_run_time(self, dataset, repeat): method count_flops (line 431) | def count_flops(self, dataset, repeat): method max_memory (line 434) | def max_memory(self, dataset, repeat): class Cascaded3StageS2ST (line 438) | class Cascaded3StageS2ST(Cascaded2StageS2ST): method __init__ (line 441) | def __init__(self, s2t_args, tts_args, mt_args): method forward (line 446) | def forward(self, sample): method generate_mt_inputs (line 456) | def generate_mt_inputs(self, dataset): method generate_mt_outputs (line 460) | def generate_mt_outputs(self, dataset): method compute_metrics (line 464) | def compute_metrics(self, metric_type, dataset, repeat=None): FILE: examples/speech_to_speech/benchmarking/data_utils.py function generate_random_data_sample (line 25) | def generate_random_data_sample(T, B=1, D=80): function generate_random_dataset (line 34) | def generate_random_dataset(T_range_min, T_range_max, B=1, D=80, dataset... function load_dataset_npy (line 43) | def load_dataset_npy(file_name, dataset_size=None): function load_dataset_raw_to_waveforms (line 51) | def load_dataset_raw_to_waveforms( function load_dataset_task (line 101) | def load_dataset_task( function randomly_sample_subset (line 158) | def randomly_sample_subset(dataset, size=500): function get_short_data_subset (line 164) | def get_short_data_subset(dataset, size=500): function get_long_data_subset (line 169) | def get_long_data_subset(dataset, size=500): function sort_dataset (line 174) | def sort_dataset(dataset, reverse=False): function save_dataset_npy (line 180) | def save_dataset_npy(dataset, file_name): function get_dataset_stats (line 185) | def get_dataset_stats(dataset): function make_parser (line 198) | def make_parser(): function get_ids_from_dataset (line 232) | def get_ids_from_dataset(dataset): function cli_main (line 236) | def cli_main(): FILE: examples/speech_to_speech/benchmarking/get_metrics.py function make_parser (line 29) | def make_parser(): function cli_main (line 95) | def cli_main(): FILE: examples/speech_to_speech/generate_waveform_from_code.py function dump_result (line 26) | def dump_result(args, sample_id, pred_wav, suffix=""): function load_code (line 34) | def load_code(in_file): function main (line 40) | def main(args): function cli_main (line 82) | def cli_main(): FILE: examples/speech_to_speech/preprocessing/data_utils.py function gen_config_yaml (line 12) | def gen_config_yaml( function load_units (line 73) | def load_units(in_file): function process_units (line 83) | def process_units(units, reduce=False): FILE: examples/speech_to_speech/preprocessing/prep_s2spect_data.py function prepare_target_data (line 29) | def prepare_target_data(args, tgt_audios): function process (line 60) | def process(args): function main (line 136) | def main(): FILE: examples/speech_to_speech/preprocessing/prep_s2ut_data.py function process (line 27) | def process(args): function main (line 79) | def main(): FILE: examples/speech_to_speech/preprocessing/prep_sn_data.py function process (line 21) | def process(args): function main (line 57) | def main(): FILE: examples/speech_to_speech/preprocessing/prep_sn_output_data.py function process (line 13) | def process(args): function main (line 34) | def main(): FILE: examples/speech_to_speech/unity/sequence_generator.py class SequenceGenerator (line 17) | class SequenceGenerator(SequenceGeneratorBase): method __init__ (line 18) | def __init__( method _generate (line 94) | def _generate( method generate_decoder (line 158) | def generate_decoder( class EnsembleModel (line 526) | class EnsembleModel(EnsembleModelBase): method __init__ (line 529) | def __init__(self, models): method forward_decoder (line 533) | def forward_decoder( method reorder_incremental_state (line 615) | def reorder_incremental_state( FILE: examples/speech_to_speech/unity/sequence_generator_multi_decoder.py class MultiDecoderSequenceGenerator (line 15) | class MultiDecoderSequenceGenerator(nn.Module): method __init__ (line 16) | def __init__( method generate (line 116) | def generate( method _generate (line 133) | def _generate( FILE: examples/speech_to_text/data_utils.py function gen_vocab (line 32) | def gen_vocab( function extract_fbank_features (line 73) | def extract_fbank_features( function create_zip (line 101) | def create_zip(data_root: Path, zip_path: Path): function get_zip_manifest (line 109) | def get_zip_manifest( function gen_config_yaml (line 136) | def gen_config_yaml( function load_df_from_tsv (line 205) | def load_df_from_tsv(path: Union[str, Path]) -> pd.DataFrame: function save_df_to_tsv (line 218) | def save_df_to_tsv(dataframe, path: Union[str, Path]): function load_tsv_to_dicts (line 231) | def load_tsv_to_dicts(path: Union[str, Path]) -> List[dict]: function filter_manifest_df (line 245) | def filter_manifest_df( function cal_gcmvn_stats (line 267) | def cal_gcmvn_stats(features_list): class S2TDataConfigWriter (line 277) | class S2TDataConfigWriter(object): method __init__ (line 282) | def __init__(self, yaml_path: Path): method flush (line 291) | def flush(self): method set_audio_root (line 295) | def set_audio_root(self, audio_root=""): method set_vocab_filename (line 298) | def set_vocab_filename(self, vocab_filename: str = "dict.txt"): method set_specaugment (line 301) | def set_specaugment( method set_specaugment_lb_policy (line 319) | def set_specaugment_lb_policy(self): method set_specaugment_ld_policy (line 329) | def set_specaugment_ld_policy(self): method set_specaugment_sm_policy (line 339) | def set_specaugment_sm_policy(self): method set_specaugment_ss_policy (line 349) | def set_specaugment_ss_policy(self): method set_input_channels (line 359) | def set_input_channels(self, input_channels: int = 1): method set_input_feat_per_channel (line 362) | def set_input_feat_per_channel(self, input_feat_per_channel: int = 80): method set_bpe_tokenizer (line 365) | def set_bpe_tokenizer(self, bpe_tokenizer: Dict[str, Any]): method set_global_cmvn (line 368) | def set_global_cmvn(self, stats_npz_path: str): method set_feature_transforms (line 371) | def set_feature_transforms(self, split: str, transforms: List[str]): method set_prepend_tgt_lang_tag (line 376) | def set_prepend_tgt_lang_tag(self, flag: bool = True): method set_sampling_alpha (line 379) | def set_sampling_alpha(self, sampling_alpha: float = 1.0): method set_extra (line 382) | def set_extra(self, data): FILE: examples/speech_to_text/prep_covost_data.py class CoVoST (line 38) | class CoVoST(Dataset): method __init__ (line 106) | def __init__( method __getitem__ (line 167) | def __getitem__( method __len__ (line 188) | def __len__(self) -> int: function process (line 192) | def process(args): function main (line 257) | def main(): FILE: examples/speech_to_text/prep_librispeech_data.py function process (line 41) | def process(args): function main (line 102) | def main(): FILE: examples/speech_to_text/prep_mtedx_data.py class mTEDx (line 43) | class mTEDx(Dataset): method __init__ (line 55) | def __init__(self, root: str, lang: str, split: str) -> None: method __getitem__ (line 102) | def __getitem__( method __len__ (line 111) | def __len__(self) -> int: function process (line 115) | def process(args): function process_joint (line 205) | def process_joint(args): function main (line 248) | def main(): FILE: examples/speech_to_text/prep_mustc_data.py class MUSTC (line 43) | class MUSTC(Dataset): method __init__ (line 53) | def __init__(self, root: str, lang: str, split: str) -> None: method __getitem__ (line 95) | def __getitem__( method __len__ (line 104) | def __len__(self) -> int: function process (line 108) | def process(args): function process_joint (line 220) | def process_joint(args): function main (line 261) | def main(): FILE: examples/speech_to_text/seg_mustc_data.py function main (line 20) | def main(args): FILE: examples/speech_to_text/simultaneous_translation/agents/fairseq_simul_st_agent.py class OnlineFeatureExtractor (line 25) | class OnlineFeatureExtractor: method __init__ (line 30) | def __init__(self, args): method clear_cache (line 43) | def clear_cache(self): method __call__ (line 46) | def __call__(self, new_samples): method transform (line 82) | def transform(self, input): class TensorListEntry (line 94) | class TensorListEntry(ListEntry): method append (line 99) | def append(self, value): method info (line 107) | def info(self): class FairseqSimulSTAgent (line 115) | class FairseqSimulSTAgent(SpeechAgent): method __init__ (line 119) | def __init__(self, args): method build_states (line 160) | def build_states(self, args, client, sentence_id): method to_device (line 167) | def to_device(self, tensor): method add_args (line 174) | def add_args(parser): method load_model_vocab (line 206) | def load_model_vocab(self, args): method initialize_states (line 237) | def initialize_states(self, states): method segment_to_units (line 243) | def segment_to_units(self, segment, states): method units_to_segment (line 251) | def units_to_segment(self, units, states): method update_model_encoder (line 290) | def update_model_encoder(self, states): method update_states_read (line 303) | def update_states_read(self, states): method policy (line 307) | def policy(self, states): method predict (line 342) | def predict(self, states): FILE: examples/textless_nlp/dgslm/create_code_file.py function main (line 9) | def main(): FILE: examples/textless_nlp/dgslm/dgslm_utils.py class HubertTokenizer (line 19) | class HubertTokenizer: method __init__ (line 20) | def __init__( method wav2code (line 33) | def wav2code(self, path, channel_id=1): method wav2codes (line 38) | def wav2codes(self, path): class HifiganVocoder (line 47) | class HifiganVocoder: method __init__ (line 48) | def __init__( method code2wav (line 61) | def code2wav(self, code, speaker_id=0, pred_dur=False): method codes2wav (line 71) | def codes2wav(self, codes, speaker_ids=[0, 4], pred_dur=False): FILE: examples/textless_nlp/dgslm/sample_speech_dlm.py function load_data (line 21) | def load_data(in_file): function write_data (line 27) | def write_data(out_file, data): function limit (line 34) | def limit(codes, n): function main (line 41) | def main(args): function cli_main (line 121) | def cli_main(): FILE: examples/textless_nlp/dgslm/vocoder_hifigan/generate_stereo_waveform.py function dump_result (line 26) | def dump_result(args, data, sample_id, pred_wav): function load_data (line 39) | def load_data(in_file): function load_vocoder (line 46) | def load_vocoder(vocoder_path, vocoder_cfg_path, use_cuda=True): function code2wav (line 55) | def code2wav(vocoder, code, speaker_id, use_cuda=True): function main (line 67) | def main(args): function cli_main (line 95) | def cli_main(): FILE: examples/textless_nlp/gslm/metrics/abx_metrics/dump_abx_feats.py function get_logger (line 16) | def get_logger(): function get_parser (line 22) | def get_parser(): function one_hot (line 69) | def one_hot(feat, n_clusters): function main (line 72) | def main(args, logger): FILE: examples/textless_nlp/gslm/metrics/asr_metrics/continuation_eval.py function get_args (line 14) | def get_args(): function main (line 30) | def main(): FILE: examples/textless_nlp/gslm/metrics/asr_metrics/misc/bleu_utils.py function corpus_bleu (line 19) | def corpus_bleu( function sentence_bleu (line 155) | def sentence_bleu( FILE: examples/textless_nlp/gslm/metrics/asr_metrics/misc/cut_as.py function get_args (line 13) | def get_args(): function cut (line 22) | def cut(src, tgt, l): function main (line 39) | def main(): FILE: examples/textless_nlp/gslm/metrics/asr_metrics/ppx.py function get_target_sequences (line 12) | def get_target_sequences(manifest, ground_truth, to_take=1000): function get_args (line 40) | def get_args(): function main (line 59) | def main(): FILE: examples/textless_nlp/gslm/metrics/asr_metrics/self_auto_bleu.py function get_target_sequences (line 12) | def get_target_sequences(manifest, ground_truth, to_take=1000): function get_args (line 40) | def get_args(): function get_self_bleu (line 61) | def get_self_bleu(utterances, averaging_mode, weights): function get_self_bleu2_arithmetic (line 74) | def get_self_bleu2_arithmetic(utterances): function get_self_bleu2_geometric (line 79) | def get_self_bleu2_geometric(utterances): function get_auto_bleu2_arithmetic (line 84) | def get_auto_bleu2_arithmetic(utterances): function get_auto_bleu2_geometric (line 89) | def get_auto_bleu2_geometric(utterances): function get_auto_bleu3_geometric (line 94) | def get_auto_bleu3_geometric(utterances): function get_auto_bleu3_arithmetic (line 99) | def get_auto_bleu3_arithmetic(utterances): function get_self_bleu3_arithmetic (line 104) | def get_self_bleu3_arithmetic(utterances): function get_self_bleu3_geometric (line 109) | def get_self_bleu3_geometric(utterances): function auto_bleu (line 114) | def auto_bleu(sentence, weights, mean_mode='arithmetic'): function main (line 141) | def main(): function run_f (line 192) | def run_f(task_params): FILE: examples/textless_nlp/gslm/speech2unit/clustering/cluster_kmeans.py function get_logger (line 21) | def get_logger(): function get_parser (line 28) | def get_parser(): function get_kmeans_model (line 113) | def get_kmeans_model( function train_kmeans (line 140) | def train_kmeans(kmeans_model, features_batch): function main (line 147) | def main(args, logger): FILE: examples/textless_nlp/gslm/speech2unit/clustering/dump_feats.py function get_parser (line 14) | def get_parser(): function get_logger (line 62) | def get_logger(): FILE: examples/textless_nlp/gslm/speech2unit/clustering/quantize_with_kmeans.py function get_logger (line 21) | def get_logger(): function get_parser (line 28) | def get_parser(): function main (line 91) | def main(args, logger): FILE: examples/textless_nlp/gslm/speech2unit/clustering/utils.py function get_audio_files (line 9) | def get_audio_files(manifest_path: str) -> Tuple[str, List[str], List[in... FILE: examples/textless_nlp/gslm/speech2unit/pretrained/cpc_feature_reader.py class CpcFeatureReader (line 7) | class CpcFeatureReader: method __init__ (line 13) | def __init__( method read_audio (line 32) | def read_audio(self, path, ref_len=None, channel_id=None): method get_feats (line 48) | def get_feats(self, file_path, ref_len=None, channel_id=None): function load_cpc_model (line 84) | def load_cpc_model(checkpoint_path, layer=None): class ChannelNorm (line 103) | class ChannelNorm(nn.Module): method __init__ (line 104) | def __init__(self, num_features, epsilon=1e-05, affine=True): method reset_parameters (line 117) | def reset_parameters(self): method forward (line 122) | def forward(self, x): class CPCEncoder (line 131) | class CPCEncoder(nn.Module): method __init__ (line 132) | def __init__(self, hidden_dim=512): method get_output_dim (line 146) | def get_output_dim(self): method forward (line 149) | def forward(self, x): class CPCAR (line 158) | class CPCAR(nn.Module): method __init__ (line 159) | def __init__(self, dim_encoded, dim_output, keep_hidden, num_layers): method get_output_dim (line 167) | def get_output_dim(self): method forward (line 170) | def forward(self, x): class CPCModel (line 184) | class CPCModel(nn.Module): method __init__ (line 185) | def __init__(self, encoder, ar_net): method forward (line 191) | def forward(self, x, label): method extract_features (line 196) | def extract_features(self, source, get_encoded=False, norm_output=False): FILE: examples/textless_nlp/gslm/speech2unit/pretrained/hubert_feature_reader.py class HubertFeatureReader (line 12) | class HubertFeatureReader: method __init__ (line 18) | def __init__(self, checkpoint_path, layer, max_chunk=1600000, use_cuda... method read_audio (line 34) | def read_audio(self, path, ref_len=None, channel_id=None): method get_feats (line 50) | def get_feats(self, file_path, ref_len=None, channel_id=None): FILE: examples/textless_nlp/gslm/speech2unit/pretrained/logmel_feature_reader.py class LogMelFeatureReader (line 11) | class LogMelFeatureReader: method __init__ (line 17) | def __init__(self, *args, **kwargs): method get_feats (line 21) | def get_feats(self, file_path, channel_id=None): FILE: examples/textless_nlp/gslm/speech2unit/pretrained/utils.py function get_feature_reader (line 28) | def get_feature_reader(feature_type): function get_feature_iterator (line 41) | def get_feature_iterator( function get_features (line 70) | def get_features( function get_and_dump_features (line 99) | def get_and_dump_features( FILE: examples/textless_nlp/gslm/speech2unit/pretrained/w2v2_feature_reader.py class Wav2VecFeatureReader (line 11) | class Wav2VecFeatureReader: method __init__ (line 17) | def __init__(self, checkpoint_path, layer, use_cuda=True): method read_audio (line 33) | def read_audio(self, fname, channel_id=None): method get_feats (line 47) | def get_feats(self, file_path, channel_id=None): FILE: examples/textless_nlp/gslm/tools/resynthesize_speech.py function get_logger (line 23) | def get_logger(): function get_parser (line 30) | def get_parser(): function main (line 73) | def main(args, logger): FILE: examples/textless_nlp/gslm/ulm/sample.py function make_batches (line 22) | def make_batches(lines, args, task, max_positions): function main (line 44) | def main(args): function cli_main (line 158) | def cli_main(): FILE: examples/textless_nlp/gslm/unit2speech/convert_to_16k.py function find_all_files (line 8) | def find_all_files(path_dir, extension): function convert16k (line 16) | def convert16k(inputfile, outputfile16k): FILE: examples/textless_nlp/gslm/unit2speech/glow.py function fused_add_tanh_sigmoid_multiply (line 34) | def fused_add_tanh_sigmoid_multiply(input_a, input_b, n_channels): class WaveGlowLoss (line 43) | class WaveGlowLoss(torch.nn.Module): method __init__ (line 44) | def __init__(self, sigma=1.0): method forward (line 48) | def forward(self, model_output): class Invertible1x1Conv (line 62) | class Invertible1x1Conv(torch.nn.Module): method __init__ (line 68) | def __init__(self, c): method forward (line 83) | def forward(self, z, reverse=False): class WN (line 106) | class WN(torch.nn.Module): method __init__ (line 112) | def __init__(self, n_in_channels, n_mel_channels, n_layers, n_channels, method forward (line 154) | def forward(self, forward_input): class WaveGlow (line 179) | class WaveGlow(torch.nn.Module): method __init__ (line 180) | def __init__(self, n_mel_channels, n_flows, n_group, n_early_every, method forward (line 208) | def forward(self, forward_input): method infer (line 252) | def infer(self, spect, sigma=1.0): method remove_weightnorm (line 297) | def remove_weightnorm(model): function remove (line 307) | def remove(conv_list): FILE: examples/textless_nlp/gslm/unit2speech/synthesize_audio_from_units.py function get_logger (line 22) | def get_logger(): function get_parser (line 29) | def get_parser(): function main (line 64) | def main(args, logger): FILE: examples/textless_nlp/gslm/unit2speech/tacotron2/audio_processing.py function window_sumsquare (line 7) | def window_sumsquare(window, n_frames, hop_length=200, win_length=800, function griffin_lim (line 59) | def griffin_lim(magnitudes, stft_fn, n_iters=30): function dynamic_range_compression (line 78) | def dynamic_range_compression(x, C=1, clip_val=1e-5): function dynamic_range_decompression (line 87) | def dynamic_range_decompression(x, C=1): FILE: examples/textless_nlp/gslm/unit2speech/tacotron2/cleaners.py function expand_abbreviations (line 46) | def expand_abbreviations(text): function expand_numbers (line 52) | def expand_numbers(text): function lowercase (line 56) | def lowercase(text): function collapse_whitespace (line 60) | def collapse_whitespace(text): function convert_to_ascii (line 64) | def convert_to_ascii(text): function basic_cleaners (line 68) | def basic_cleaners(text): function transliteration_cleaners (line 75) | def transliteration_cleaners(text): function english_cleaners (line 83) | def english_cleaners(text): FILE: examples/textless_nlp/gslm/unit2speech/tacotron2/cmudict.py class CMUDict (line 19) | class CMUDict: method __init__ (line 21) | def __init__(self, file_or_path, keep_ambiguous=True): method __len__ (line 32) | def __len__(self): method lookup (line 36) | def lookup(self, word): function _parse_cmudict (line 45) | def _parse_cmudict(file): function _get_pronunciation (line 60) | def _get_pronunciation(s): FILE: examples/textless_nlp/gslm/unit2speech/tacotron2/layers.py class LinearNorm (line 9) | class LinearNorm(torch.nn.Module): method __init__ (line 10) | def __init__(self, in_dim, out_dim, bias=True, w_init_gain='linear'): method forward (line 18) | def forward(self, x): class ConvNorm (line 22) | class ConvNorm(torch.nn.Module): method __init__ (line 23) | def __init__(self, in_channels, out_channels, kernel_size=1, stride=1, method forward (line 38) | def forward(self, signal): class GlobalAvgPool (line 43) | class GlobalAvgPool(torch.nn.Module): method __init__ (line 44) | def __init__(self): method forward (line 47) | def forward(self, x, lengths=None): class TacotronSTFT (line 65) | class TacotronSTFT(torch.nn.Module): method __init__ (line 66) | def __init__(self, filter_length=1024, hop_length=256, win_length=1024, method spectral_normalize (line 78) | def spectral_normalize(self, magnitudes): method spectral_de_normalize (line 82) | def spectral_de_normalize(self, magnitudes): method mel_spectrogram (line 86) | def mel_spectrogram(self, y): FILE: examples/textless_nlp/gslm/unit2speech/tacotron2/model.py class LocationLayer (line 11) | class LocationLayer(nn.Module): method __init__ (line 12) | def __init__(self, attention_n_filters, attention_kernel_size, method forward (line 23) | def forward(self, attention_weights_cat): class Attention (line 30) | class Attention(nn.Module): method __init__ (line 31) | def __init__(self, attention_rnn_dim, embedding_dim, attention_dim, method get_alignment_energies (line 44) | def get_alignment_energies(self, query, processed_memory, method forward (line 66) | def forward(self, attention_hidden_state, memory, processed_memory, class Prenet (line 90) | class Prenet(nn.Module): method __init__ (line 91) | def __init__(self, in_dim, sizes): method forward (line 98) | def forward(self, x): class Postnet (line 104) | class Postnet(nn.Module): method __init__ (line 109) | def __init__(self, hparams): method forward (line 142) | def forward(self, x): class Encoder (line 150) | class Encoder(nn.Module): method __init__ (line 155) | def __init__(self, hparams): method forward (line 174) | def forward(self, x, input_lengths): method inference (line 193) | def inference(self, x): class AudioEncoder (line 205) | class AudioEncoder(nn.Module): method __init__ (line 206) | def __init__(self, hparams): method forward (line 234) | def forward(self, x, lengths): class Decoder (line 269) | class Decoder(nn.Module): method __init__ (line 270) | def __init__(self, hparams): method get_go_frame (line 312) | def get_go_frame(self, memory): method initialize_decoder_states (line 327) | def initialize_decoder_states(self, memory, obs_and_lat, mask): method parse_decoder_inputs (line 362) | def parse_decoder_inputs(self, decoder_inputs): method parse_decoder_outputs (line 382) | def parse_decoder_outputs(self, mel_outputs, gate_outputs, alignments): method decode (line 411) | def decode(self, decoder_input): method forward (line 457) | def forward(self, memory, obs_and_lat, decoder_inputs, memory_lengths): method inference (line 495) | def inference(self, memory, obs_and_lat, ret_has_eos=False): class Tacotron2 (line 540) | class Tacotron2(nn.Module): method __init__ (line 541) | def __init__(self, hparams): method parse_batch (line 572) | def parse_batch(self, batch): method parse_output (line 588) | def parse_output(self, outputs, output_lengths=None): method forward (line 600) | def forward(self, inputs): method inference (line 634) | def inference(self, inputs, obs_labels=None, lat=None, ret_has_eos=Fal... FILE: examples/textless_nlp/gslm/unit2speech/tacotron2/numbers.py function _remove_commas (line 16) | def _remove_commas(m): function _expand_decimal_point (line 20) | def _expand_decimal_point(m): function _expand_dollars (line 24) | def _expand_dollars(m): function _expand_ordinal (line 45) | def _expand_ordinal(m): function _expand_number (line 49) | def _expand_number(m): function normalize_numbers (line 64) | def normalize_numbers(text): FILE: examples/textless_nlp/gslm/unit2speech/tacotron2/stft.py class STFT (line 42) | class STFT(torch.nn.Module): method __init__ (line 44) | def __init__(self, filter_length=800, hop_length=200, win_length=800, method transform (line 77) | def transform(self, input_data): method inverse (line 107) | def inverse(self, magnitude, phase): method forward (line 138) | def forward(self, input_data): FILE: examples/textless_nlp/gslm/unit2speech/tacotron2/text.py function text_to_sequence (line 19) | def text_to_sequence(text, cleaner_names): function sample_code_chunk (line 47) | def sample_code_chunk(code, size): function code_to_sequence (line 54) | def code_to_sequence(code, code_dict, collapse_code): function sequence_to_text (line 70) | def sequence_to_text(sequence): function sequence_to_code (line 83) | def sequence_to_code(sequence, code_dict): function _clean_text (line 89) | def _clean_text(text, cleaner_names): function _symbols_to_sequence (line 98) | def _symbols_to_sequence(symbols): function _arpabet_to_sequence (line 102) | def _arpabet_to_sequence(text): function _should_keep_symbol (line 106) | def _should_keep_symbol(s): FILE: examples/textless_nlp/gslm/unit2speech/tacotron2/utils.py function get_mask_from_lengths (line 18) | def get_mask_from_lengths(lengths): function load_wav_to_torch (line 25) | def load_wav_to_torch(full_path, sr=None): function read_binary_audio (line 32) | def read_binary_audio(bin_data, tar_sr=None): function load_filepaths_and_text (line 52) | def load_filepaths_and_text(filename): function to_gpu (line 58) | def to_gpu(x): function load_code_dict (line 66) | def load_code_dict(path, add_sos=False, add_eos=False): function load_obs_label_dict (line 83) | def load_obs_label_dict(path): class CudaTimer (line 92) | class CudaTimer: method __init__ (line 93) | def __init__(self, keys): method start (line 97) | def start(self, key): method stop (line 103) | def stop(self, key): method reset (line 109) | def reset(self): method value (line 116) | def value(self): method _synchronize (line 120) | def _synchronize(self): class Timer (line 139) | class Timer: method __init__ (line 140) | def __init__(self, keys): method start (line 147) | def start(self, key): method stop (line 151) | def stop(self, key): method reset (line 157) | def reset(self): method value (line 164) | def value(self): FILE: examples/textless_nlp/gslm/unit2speech/tacotron2/waveglow_denoiser.py class Denoiser (line 7) | class Denoiser(torch.nn.Module): method __init__ (line 10) | def __init__(self, waveglow, filter_length=1024, n_overlap=4, method forward (line 35) | def forward(self, audio, strength=0.1): FILE: examples/textless_nlp/gslm/unit2speech/tts_data.py class TacotronInputDataset (line 20) | class TacotronInputDataset: method __init__ (line 21) | def __init__(self, hparams, append_str=""): method process_code (line 33) | def process_code(self, inp_str): method process_text (line 41) | def process_text(self, inp_str): method get_tensor (line 44) | def get_tensor(self, inp_str): method __len__ (line 53) | def __len__(self): FILE: examples/textless_nlp/gslm/unit2speech/utils.py function load_quantized_audio_from_file (line 14) | def load_quantized_audio_from_file(file_path): function synthesize_audio (line 25) | def synthesize_audio(model, waveglow, denoiser, inp, lab=None, strength=... function load_tacotron (line 38) | def load_tacotron(tacotron_model_path, max_decoder_steps): function load_waveglow (line 49) | def load_waveglow(waveglow_path): FILE: examples/textless_nlp/pgslm/data_utils.py class Stat (line 12) | class Stat: method __init__ (line 13) | def __init__(self, keep_raw=False): method update (line 23) | def update(self, new_x): method mean (line 37) | def mean(self): method std (line 41) | def std(self): method mean_log (line 45) | def mean_log(self): method std_log (line 49) | def std_log(self): method n_frms (line 53) | def n_frms(self): method n_utts (line 57) | def n_utts(self): method raw_data (line 61) | def raw_data(self): class F0Stat (line 66) | class F0Stat(Stat): method update (line 67) | def update(self, new_x): function dump_speaker_f0_stat (line 73) | def dump_speaker_f0_stat(speaker_to_f0_stat, out_prefix): function load_audio_path (line 91) | def load_audio_path(path): function load_f0 (line 101) | def load_f0(f0_dir, nshards): FILE: examples/textless_nlp/pgslm/eval/cont_metrics.py function teacher_force_everything (line 39) | def teacher_force_everything( function get_bleu (line 148) | def get_bleu(produced_tokens, target_tokens, tgt_dict): function continuation (line 177) | def continuation(args, dataset, model, criterion, tgt_dict, rank, world_... function correlation (line 366) | def correlation(args, dataset, model, criterion, tgt_dict, rank, world_s... function main (line 488) | def main(rank, world_size, args): function wandb_results (line 599) | def wandb_results(summary, raw_args): function maybe_aggregate_normalize (line 617) | def maybe_aggregate_normalize(values, normalizers, world_size): function maybe_aggregate_correlations (line 627) | def maybe_aggregate_correlations(results, world_size): function cli_main (line 644) | def cli_main(): FILE: examples/textless_nlp/pgslm/generate_waveform.py function dump_result (line 26) | def dump_result(args, data, sample_id, pred_wav): function load_data (line 39) | def load_data(in_file): function get_f0_upsample_ratio (line 46) | def get_f0_upsample_ratio(code_hop_size, f_hop_size): function main (line 51) | def main(args): function cli_main (line 88) | def cli_main(): FILE: examples/textless_nlp/pgslm/inference_dataset.py class InferenceDataset (line 10) | class InferenceDataset: method __init__ (line 11) | def __init__( method pads (line 49) | def pads(self): method __len__ (line 52) | def __len__(self): method original_size (line 55) | def original_size(self, k): method __getitem__ (line 59) | def __getitem__(self, k): function explode_batch (line 85) | def explode_batch(batch, times): FILE: examples/textless_nlp/pgslm/naive_decoder.py class Naive_F0_Decoder (line 10) | class Naive_F0_Decoder(torch.nn.Module): method __init__ (line 11) | def __init__(self, bounds_path, n_units=32): method forward (line 28) | def forward(self, discrete_f0: torch.Tensor): FILE: examples/textless_nlp/pgslm/prepare_dataset.py function load_meta (line 26) | def load_meta(meta_path, split): function _align_f0 (line 34) | def _align_f0(f0, dur, ratio, frm_tol=5): function align_f0 (line 42) | def align_f0(path_to_f0, audio_paths, durs, ratio, mp=False): function prepare_seg_data (line 65) | def prepare_seg_data(config, audio_paths, codes, durs, speakers, path_to... function dump_seg_data (line 78) | def dump_seg_data(data, out_prefix): function main (line 108) | def main(meta_path, f0_dir, splits, nshards_list): FILE: examples/textless_nlp/pgslm/preprocess_f0.py function process_one (line 13) | def process_one(path, sr): function main (line 30) | def main(file_path, out_dir, nshards, rank, sampling_rate): FILE: examples/textless_nlp/pgslm/quantize_f0.py function load_speaker (line 16) | def load_speaker(path): function quantize_f0 (line 26) | def quantize_f0(speaker_to_f0, f0_stats, nbins, normalize, log): function main (line 57) | def main(file_path, f0_dir, out_dir, out_prefix, nbins, nshards, normali... FILE: examples/textless_nlp/pgslm/sample/sample.py class TemperatureDecoder (line 34) | class TemperatureDecoder: method __init__ (line 35) | def __init__(self, Ts, discrete_dur=False, discrete_f0=False): method __call__ (line 40) | def __call__(self, output): class FilterNamesDataset (line 83) | class FilterNamesDataset: method __init__ (line 84) | def __init__(self, dataset, fnames_path): method __len__ (line 102) | def __len__(self): method __getitem__ (line 105) | def __getitem__(self, k): method size (line 109) | def size(self, k): function do_sampling (line 115) | def do_sampling( function unroll_duration (line 182) | def unroll_duration(token_stream, duration_stream): function realign_shifted_streams (line 201) | def realign_shifted_streams(tokens, durations, F0s, shifts): function maybe_cut_eos (line 232) | def maybe_cut_eos(produced_tokens, produced_duration, produced_f0, eos_i... function maybe_filter_pad (line 241) | def maybe_filter_pad(produced_tokens, produced_duration, produced_f0, pa... function match_duration (line 258) | def match_duration(produced_tokens, produced_duration, produced_f0, targ... function main (line 292) | def main(rank, world_size, args): function cli_main (line 525) | def cli_main(): FILE: examples/textless_nlp/pgslm/scripts/join_units_manifest.py function main (line 11) | def main(): FILE: examples/textless_nlp/pgslm/truncated_laplace.py function truncated_laplace (line 10) | def truncated_laplace(mean, T, truncate_by_zero=False): FILE: examples/translation_moe/score.py function main (line 23) | def main(): function dictolist (line 51) | def dictolist(d): function load_sys (line 56) | def load_sys(paths): function load_ref (line 80) | def load_ref(path): function merge (line 101) | def merge(src, tgt, hypos, log_probs, path): function corpus_bleu (line 112) | def corpus_bleu(sys_stream, ref_streams): function sentence_bleu (line 117) | def sentence_bleu(hypothesis, reference): function pairwise (line 132) | def pairwise(sents): function multi_ref (line 143) | def multi_ref(refs, hypos): function intra_ref (line 180) | def intra_ref(refs): FILE: examples/translation_moe/translation_moe_src/logsumexp_moe.py class LogSumExpMoE (line 9) | class LogSumExpMoE(torch.autograd.Function): method forward (line 17) | def forward(ctx, logp, posterior, dim=-1): method backward (line 23) | def backward(ctx, grad_output): FILE: examples/translation_moe/translation_moe_src/mean_pool_gating_network.py class MeanPoolGatingNetwork (line 10) | class MeanPoolGatingNetwork(torch.nn.Module): method __init__ (line 18) | def __init__(self, embed_dim, num_experts, dropout=None): method forward (line 27) | def forward(self, encoder_out): FILE: examples/translation_moe/translation_moe_src/translation_moe.py class TranslationMoEConfig (line 24) | class TranslationMoEConfig(TranslationConfig): class TranslationMoETask (line 53) | class TranslationMoETask(TranslationTask): method __init__ (line 79) | def __init__(self, cfg: TranslationMoEConfig, src_dict, tgt_dict): method build_model (line 105) | def build_model(self, cfg, from_checkpoint=False): method expert_index (line 140) | def expert_index(self, i): method _get_loss (line 143) | def _get_loss(self, sample, model, criterion): method train_step (line 219) | def train_step( method valid_step (line 229) | def valid_step(self, sample, model, criterion): method inference_step (line 235) | def inference_step( method reduce_metrics (line 254) | def reduce_metrics(self, logging_outputs, criterion): FILE: examples/truncated_bptt/transformer_xl_model.py class TransformerXLConfig (line 25) | class TransformerXLConfig(FairseqDataclass): class TransformerXLLanguageModel (line 45) | class TransformerXLLanguageModel(FairseqLanguageModel): method build_model (line 47) | def build_model(cls, cfg: TransformerXLConfig, task): class TransformerXLDecoder (line 51) | class TransformerXLDecoder(FairseqIncrementalDecoder): method __init__ (line 52) | def __init__(self, cfg, task): method forward (line 99) | def forward( method max_positions (line 126) | def max_positions(self): method reorder_incremental_state (line 129) | def reorder_incremental_state( FILE: examples/truncated_bptt/truncated_bptt_lm_task.py class TruncatedBPTTLMConfig (line 29) | class TruncatedBPTTLMConfig(FairseqDataclass): class TruncatedBPTTLMTask (line 47) | class TruncatedBPTTLMTask(FairseqTask): method __init__ (line 48) | def __init__(self, cfg: TruncatedBPTTLMConfig): method load_dataset (line 65) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method dataset (line 101) | def dataset(self, split): method get_batch_iterator (line 104) | def get_batch_iterator( method _collate_fn (line 126) | def _collate_fn(self, items: List[List[torch.Tensor]]): method build_dataset_for_inference (line 150) | def build_dataset_for_inference( method inference_step (line 176) | def inference_step( method eval_lm_dataloader (line 195) | def eval_lm_dataloader( method source_dictionary (line 225) | def source_dictionary(self): method target_dictionary (line 229) | def target_dictionary(self): class TruncatedBPTTDataset (line 233) | class TruncatedBPTTDataset(torch.utils.data.Dataset): method __init__ (line 234) | def __init__( method __len__ (line 281) | def __len__(self): method __getitem__ (line 284) | def __getitem__(self, i) -> Tuple[int, List[torch.Tensor]]: FILE: examples/unsupervised_quality_estimation/aggregate_scores.py function main (line 22) | def main(): FILE: examples/unsupervised_quality_estimation/meteor.py function read_translations (line 16) | def read_translations(path, n_repeats): function generate_input (line 29) | def generate_input(translations, n_repeats): function run_meteor (line 44) | def run_meteor(ref_path, mt_path, metric_path, lang="en"): function read_output (line 68) | def read_output(meteor_output_path, n_repeats): function main (line 86) | def main(): FILE: examples/unsupervised_quality_estimation/repeat_lines.py function _normalize_spaces (line 10) | def _normalize_spaces(line): function main (line 14) | def main(): FILE: examples/wav2vec/libri_labels.py function main (line 15) | def main(): FILE: examples/wav2vec/unsupervised/data/extracted_features_dataset.py class ExtractedFeaturesDataset (line 20) | class ExtractedFeaturesDataset(FairseqDataset): method __init__ (line 21) | def __init__( method __getitem__ (line 88) | def __getitem__(self, index): method __len__ (line 106) | def __len__(self): method collater (line 109) | def collater(self, samples): method num_tokens (line 149) | def num_tokens(self, index): method size (line 152) | def size(self, index): method ordered_indices (line 155) | def ordered_indices(self): FILE: examples/wav2vec/unsupervised/data/random_input_dataset.py class RandomInputDataset (line 12) | class RandomInputDataset(BaseWrapperDataset): method __init__ (line 13) | def __init__( method get_target (line 30) | def get_target(self, item): method get_target_value (line 36) | def get_target_value(self, item): method __getitem__ (line 40) | def __getitem__(self, index): method collater (line 46) | def collater(self, samples): FILE: examples/wav2vec/unsupervised/kaldi_self_train/st/local/prepare_data_from_w2v.py function get_parser (line 6) | def get_parser(): function main (line 15) | def main(): FILE: examples/wav2vec/unsupervised/kaldi_self_train/st/local/unsup_select.py function get_parser (line 19) | def get_parser(): function load_tra (line 32) | def load_tra(tra_path): function load_lex (line 42) | def load_lex(lex_path): function compute_wer (line 50) | def compute_wer(ref_uid_to_tra, hyp_uid_to_tra, g2p, g2p_dict): function compute_lm_ppl (line 84) | def compute_lm_ppl(hyp_uid_to_tra, score_fn): function main (line 101) | def main(): FILE: examples/wav2vec/unsupervised/models/wav2vec_u.py class SegmentationType (line 26) | class SegmentationType(Enum): class SegmentationConfig (line 35) | class SegmentationConfig(FairseqDataclass): class Wav2vec_UConfig (line 44) | class Wav2vec_UConfig(FairseqDataclass): class Segmenter (line 88) | class Segmenter(nn.Module): method __init__ (line 91) | def __init__(self, cfg: SegmentationConfig): method pre_segment (line 96) | def pre_segment(self, dense_x, dense_padding_mask): method logit_segment (line 99) | def logit_segment(self, logits, padding_mask): class RandomSegmenter (line 103) | class RandomSegmenter(Segmenter): method pre_segment (line 104) | def pre_segment(self, dense_x, dense_padding_mask): class UniformRandomSegmenter (line 114) | class UniformRandomSegmenter(Segmenter): method pre_segment (line 115) | def pre_segment(self, dense_x, dense_padding_mask): class JoinSegmenter (line 146) | class JoinSegmenter(Segmenter): method logit_segment (line 147) | def logit_segment(self, logits, padding_mask): class UniformRandomJoinSegmenter (line 199) | class UniformRandomJoinSegmenter(UniformRandomSegmenter, JoinSegmenter): class Discriminator (line 212) | class Discriminator(nn.Module): method __init__ (line 213) | def __init__(self, dim, cfg: Wav2vec_UConfig): method forward (line 270) | def forward(self, x, padding_mask): class Generator (line 288) | class Generator(nn.Module): method __init__ (line 289) | def __init__(self, input_dim, output_dim, cfg: Wav2vec_UConfig): method forward (line 322) | def forward(self, dense_x, tokens, dense_padding_mask): method bn_padded_data (line 362) | def bn_padded_data(self, feature, padding_mask): class Wav2vec_U (line 371) | class Wav2vec_U(BaseFairseqModel): method calc_gradient_penalty (line 372) | def calc_gradient_penalty(self, real_data, fake_data): method set_num_updates (line 418) | def set_num_updates(self, num_updates): method discrim_step (line 425) | def discrim_step(self, num_updates): method get_groups_for_update (line 428) | def get_groups_for_update(self, num_updates): method __init__ (line 431) | def __init__(self, cfg: Wav2vec_UConfig, target_dict): method build_model (line 484) | def build_model(cls, cfg, task): method get_logits (line 487) | def get_logits( method get_normalized_probs (line 512) | def get_normalized_probs( method normalize (line 527) | def normalize(self, dense_x): method forward (line 559) | def forward( FILE: examples/wav2vec/unsupervised/scripts/apply_pca.py function get_parser (line 19) | def get_parser(): function main (line 35) | def main(): FILE: examples/wav2vec/unsupervised/scripts/filter_lexicon.py function get_parser (line 13) | def get_parser(): function main (line 21) | def main(): FILE: examples/wav2vec/unsupervised/scripts/filter_tsv.py function get_fname (line 19) | def get_fname(line): FILE: examples/wav2vec/unsupervised/scripts/g2p_wrd_to_phn.py function main (line 13) | def main(): FILE: examples/wav2vec/unsupervised/scripts/ltr_to_wrd.py function main (line 10) | def main(): FILE: examples/wav2vec/unsupervised/scripts/mean_pool.py function get_parser (line 20) | def get_parser(): function main (line 36) | def main(): FILE: examples/wav2vec/unsupervised/scripts/merge_clusters.py function get_parser (line 19) | def get_parser(): function main (line 34) | def main(): FILE: examples/wav2vec/unsupervised/scripts/normalize_and_filter_text.py function get_parser (line 14) | def get_parser(): function main (line 34) | def main(): FILE: examples/wav2vec/unsupervised/scripts/normalize_text.py function main (line 11) | def main(): FILE: examples/wav2vec/unsupervised/scripts/pca.py function get_parser (line 16) | def get_parser(): function main (line 29) | def main(): FILE: examples/wav2vec/unsupervised/scripts/phonemize_with_sil.py function get_parser (line 12) | def get_parser(): function main (line 37) | def main(): FILE: examples/wav2vec/unsupervised/scripts/vads.py function get_parser (line 19) | def get_parser(): function rvad (line 31) | def rvad(speechproc, path): function main (line 69) | def main(): FILE: examples/wav2vec/unsupervised/scripts/wav2vec_apply_cluster_faiss.py function get_parser (line 21) | def get_parser(): function get_iterator (line 36) | def get_iterator(args): function main (line 65) | def main(): FILE: examples/wav2vec/unsupervised/scripts/wav2vec_cluster_faiss.py function get_parser (line 24) | def get_parser(): function parse_faiss_specs (line 50) | def parse_faiss_specs(specs_str): class Wav2VecFeatureReader (line 74) | class Wav2VecFeatureReader(object): method __init__ (line 75) | def __init__(self, cp_file, layer): method read_audio (line 93) | def read_audio(self, fname): method get_feats (line 100) | def get_feats(self, loc): function get_iterator (line 110) | def get_iterator(args): function main (line 129) | def main(): FILE: examples/wav2vec/unsupervised/scripts/wav2vec_extract_features.py function get_parser (line 21) | def get_parser(): class Wav2VecFeatureReader (line 36) | class Wav2VecFeatureReader(object): method __init__ (line 37) | def __init__(self, cp_file, layer): method read_audio (line 48) | def read_audio(self, fname): method get_feats (line 55) | def get_feats(self, loc): function get_iterator (line 69) | def get_iterator(args): function main (line 86) | def main(): FILE: examples/wav2vec/unsupervised/scripts/wer.py function get_parser (line 22) | def get_parser(): function compute_wer (line 31) | def compute_wer(ref_uid_to_tra, hyp_uid_to_tra, g2p): function main (line 56) | def main(): function load_tra (line 75) | def load_tra(tra_path): FILE: examples/wav2vec/unsupervised/scripts/wrd_to_ltr.py function main (line 10) | def main(): FILE: examples/wav2vec/unsupervised/tasks/unpaired_audio_text.py class DecodingConfig (line 38) | class DecodingConfig(FairseqDataclass): class UnpairedAudioTextConfig (line 45) | class UnpairedAudioTextConfig(FairseqDataclass): class UnpairedAudioText (line 91) | class UnpairedAudioText(FairseqTask): method __init__ (line 96) | def __init__( method setup_task (line 151) | def setup_task(cls, cfg: UnpairedAudioTextConfig, **kwargs): method optimizer_step (line 167) | def optimizer_step(self, optimizer, model, update_num): method valid_step (line 174) | def valid_step(self, sample, model, criterion): method load_dataset (line 292) | def load_dataset(self, split: str, task_cfg: FairseqDataclass = None, ... method source_dictionary (line 327) | def source_dictionary(self): method target_dictionary (line 331) | def target_dictionary(self): method max_positions (line 336) | def max_positions(self): method reduce_metrics (line 340) | def reduce_metrics(self, logging_outputs, criterion): method build_model (line 449) | def build_model(self, cfg: FairseqDataclass, from_checkpoint=False): FILE: examples/wav2vec/unsupervised/w2vu_generate.py class DecoderType (line 42) | class DecoderType(Enum): class UnsupGenerateConfig (line 50) | class UnsupGenerateConfig(FairseqDataclass): function get_dataset_itr (line 166) | def get_dataset_itr(cfg, task): function process_predictions (line 181) | def process_predictions( function prepare_result_files (line 270) | def prepare_result_files(cfg: UnsupGenerateConfig): function optimize_models (line 295) | def optimize_models(cfg: UnsupGenerateConfig, use_cuda, models): function generate (line 324) | def generate(cfg: UnsupGenerateConfig, models, saved_cfg, use_cuda): function gen_hypos (line 556) | def gen_hypos(generator, models, num_feats, sample, task, use_cuda): function main (line 569) | def main(cfg: UnsupGenerateConfig, model=None): function hydra_main (line 677) | def hydra_main(cfg): function cli_main (line 699) | def cli_main(): FILE: examples/wav2vec/vq-wav2vec_featurize.py class FilesDataset (line 30) | class FilesDataset: method __init__ (line 31) | def __init__(self, files, labels): method __len__ (line 39) | def __len__(self): method __getitem__ (line 42) | def __getitem__(self, index): method collate (line 60) | def collate(self, batch): class ArgTypes (line 64) | class ArgTypes: method existing_path (line 66) | def existing_path(arg): method mkdir (line 72) | def mkdir(arg): class DatasetWriter (line 78) | class DatasetWriter: method __init__ (line 79) | def __init__(self): method __getattr__ (line 86) | def __getattr__(self, attr): method read_manifest (line 89) | def read_manifest(self, fname): method process_splits (line 100) | def process_splits(self): method iterate (line 133) | def iterate(self, files): method lbl_file (line 165) | def lbl_file(self, name): method data_file (line 169) | def data_file(self, name): method var_file (line 173) | def var_file(self): method load_config (line 176) | def load_config(self): method load_data (line 204) | def load_data(self, fnames): method load_model (line 212) | def load_model(self): method __call__ (line 226) | def __call__(self): FILE: examples/wav2vec/wav2vec_featurize.py function read_audio (line 25) | def read_audio(fname): class PretrainedWav2VecModel (line 34) | class PretrainedWav2VecModel(nn.Module): method __init__ (line 35) | def __init__(self, fname): method forward (line 44) | def forward(self, x): class EmbeddingWriterConfig (line 53) | class EmbeddingWriterConfig(argparse.ArgumentParser): method __init__ (line 54) | def __init__(self): class Prediction (line 80) | class Prediction: method __init__ (line 83) | def __init__(self, fname, gpu=0): method __call__ (line 87) | def __call__(self, x): class H5Writer (line 95) | class H5Writer: method __init__ (line 98) | def __init__(self, fname): method write (line 102) | def write(self, data): class EmbeddingDatasetWriter (line 111) | class EmbeddingDatasetWriter(object): method __init__ (line 123) | def __init__( method _progress (line 151) | def _progress(self, iterable, **kwargs): method require_output_path (line 156) | def require_output_path(self, fname=None): method input_path (line 161) | def input_path(self): method output_path (line 165) | def output_path(self): method get_input_path (line 168) | def get_input_path(self, fname=None): method get_output_path (line 173) | def get_output_path(self, fname=None): method copy_labels (line 178) | def copy_labels(self): method input_fnames (line 190) | def input_fnames(self): method __len__ (line 193) | def __len__(self): method write_features (line 196) | def write_features(self): method __repr__ (line 216) | def __repr__(self): FILE: examples/wav2vec/wav2vec_manifest.py function get_parser (line 18) | def get_parser(): function main (line 47) | def main(args): FILE: examples/wav2vec/xlsr/scripts/eval_speaker_clf_task.py function calculate_eer (line 24) | def calculate_eer(y_label, y_score): function calculate_minDCF (line 36) | def calculate_minDCF(y_label, y_score, p_target=0.01, c_miss=1, c_fa=1): FILE: examples/wav2vec/xlsr/scripts/gen_audio_embedding.py function subset_manifest (line 36) | def subset_manifest(infer_manifest, veri_pair): function wrap_target_dataset (line 56) | def wrap_target_dataset(infer_manifest, dataset, task): function resample_data (line 70) | def resample_data(source, padding_mask, n_sample, max_sample_len): function resample_sample (line 94) | def resample_sample(sample, n_sample, max_sample_len): FILE: examples/womens_bios/query_occupations_from_wikidata.py function get_results (line 10) | def get_results(endpoint_url, URL): FILE: examples/xmod/preprocess_nli.py function preprocess (line 18) | def preprocess(spm_model_path, train_path, valid_path, test_path, dest_d... class MultiprocessingEncoder (line 65) | class MultiprocessingEncoder(object): method __init__ (line 66) | def __init__(self, model, remove_empty, output_format): method initializer (line 71) | def initializer(self): method encode (line 75) | def encode(self, line): function write_lines (line 87) | def write_lines(lines, path): function read_jsonl (line 93) | def read_jsonl(path): function read_nli (line 98) | def read_nli(path, langs=None): function main (line 120) | def main(): FILE: fairseq/benchmark/benchmark_multihead_attention.py function _reset_seeds (line 24) | def _reset_seeds(): function _get_mask (line 29) | def _get_mask(to_dtype: torch.dtype, dim0: int, dim1: int): function benchmark_multihead_attention (line 36) | def benchmark_multihead_attention( function run_benchmarks (line 157) | def run_benchmarks(): FILE: fairseq/benchmark/dummy_dataset.py class DummyDataset (line 5) | class DummyDataset(FairseqDataset): method __init__ (line 6) | def __init__(self, batch, num_items, item_size): method __getitem__ (line 12) | def __getitem__(self, index): method __len__ (line 15) | def __len__(self): method collater (line 18) | def collater(self, samples): method sizes (line 22) | def sizes(self): method num_tokens (line 25) | def num_tokens(self, index): method size (line 28) | def size(self, index): method ordered_indices (line 31) | def ordered_indices(self): method supports_prefetch (line 35) | def supports_prefetch(self): FILE: fairseq/benchmark/dummy_lm.py class DummyLMConfig (line 22) | class DummyLMConfig(FairseqDataclass): class DummyLMTask (line 35) | class DummyLMTask(FairseqTask): method __init__ (line 36) | def __init__(self, cfg: DummyLMConfig): method load_dataset (line 51) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method source_dictionary (line 78) | def source_dictionary(self): method target_dictionary (line 82) | def target_dictionary(self): FILE: fairseq/benchmark/dummy_masked_lm.py class DummyMaskedLMConfig (line 22) | class DummyMaskedLMConfig(FairseqDataclass): class DummyMaskedLMTask (line 38) | class DummyMaskedLMTask(FairseqTask): method __init__ (line 39) | def __init__(self, cfg: DummyMaskedLMConfig): method load_dataset (line 62) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method source_dictionary (line 89) | def source_dictionary(self): method target_dictionary (line 93) | def target_dictionary(self): FILE: fairseq/benchmark/dummy_model.py class DummyModel (line 18) | class DummyModel(FairseqLanguageModel): method __init__ (line 19) | def __init__(self, args, encoder): method add_args (line 24) | def add_args(parser): method build_model (line 29) | def build_model(cls, args, task): method forward (line 37) | def forward(self, src_tokens, masked_tokens=None, **kwargs): class DummyEncoder (line 41) | class DummyEncoder(FairseqDecoder): method __init__ (line 42) | def __init__(self, num_embed=50000, embed_dim=1024, num_layers=24): method forward (line 73) | def forward(self, tokens, masked_tokens=None): method max_positions (line 83) | def max_positions(self): method get_normalized_probs (line 86) | def get_normalized_probs(self, net_output, log_probs, sample=None): function base_architecture (line 95) | def base_architecture(args): FILE: fairseq/benchmark/dummy_mt.py class DummyMTTask (line 18) | class DummyMTTask(LegacyFairseqTask): method add_args (line 20) | def add_args(parser): method __init__ (line 27) | def __init__(self, args, dictionary): method setup_task (line 38) | def setup_task(cls, args, **kwargs): method load_dataset (line 50) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method source_dictionary (line 80) | def source_dictionary(self): method target_dictionary (line 84) | def target_dictionary(self): class DummyDataset (line 88) | class DummyDataset(FairseqDataset): method __init__ (line 89) | def __init__(self, batch, num_items, item_size): method __getitem__ (line 95) | def __getitem__(self, index): method __len__ (line 98) | def __len__(self): method collater (line 101) | def collater(self, samples): method sizes (line 105) | def sizes(self): method num_tokens (line 108) | def num_tokens(self, index): method size (line 111) | def size(self, index): method ordered_indices (line 114) | def ordered_indices(self): method supports_prefetch (line 118) | def supports_prefetch(self): FILE: fairseq/binarizer.py class BinarizeSummary (line 25) | class BinarizeSummary: method num_replaced (line 35) | def num_replaced(self) -> int: method replaced_percent (line 41) | def replaced_percent(self) -> float: method __str__ (line 44) | def __str__(self) -> str: method merge (line 51) | def merge(self, other: "BinarizeSummary"): class Binarizer (line 65) | class Binarizer(ABC): method binarize_line (line 71) | def binarize_line( function _worker_prefix (line 79) | def _worker_prefix(output_prefix: str, worker_id: int): class FileBinarizer (line 83) | class FileBinarizer: method multiprocess_dataset (line 89) | def multiprocess_dataset( method _binarize_file_chunk (line 173) | def _binarize_file_chunk( method _binarize_chunk_and_finalize (line 204) | def _binarize_chunk_and_finalize( class VocabularyDatasetBinarizer (line 233) | class VocabularyDatasetBinarizer(Binarizer): method __init__ (line 239) | def __init__( method binarize_line (line 254) | def binarize_line( class AlignmentDatasetBinarizer (line 289) | class AlignmentDatasetBinarizer(Binarizer): method __init__ (line 295) | def __init__( method binarize_line (line 302) | def binarize_line( class LegacyBinarizer (line 313) | class LegacyBinarizer: method binarize (line 315) | def binarize( method binarize_alignments (line 343) | def binarize_alignments( method _consume_file (line 361) | def _consume_file( FILE: fairseq/checkpoint_utils.py function save_checkpoint (line 35) | def save_checkpoint(cfg: CheckpointConfig, trainer, epoch_itr, val_loss): function load_checkpoint (line 208) | def load_checkpoint(cfg: CheckpointConfig, trainer, **passthrough_args): function load_checkpoint_to_cpu (line 306) | def load_checkpoint_to_cpu(path, arg_overrides=None, load_on_all_ranks=F... function load_model_ensemble (line 372) | def load_model_ensemble( function get_maybe_sharded_checkpoint_filename (line 404) | def get_maybe_sharded_checkpoint_filename( function load_model_ensemble_and_task (line 419) | def load_model_ensemble_and_task( function load_model_ensemble_and_task_from_hf_hub (line 528) | def load_model_ensemble_and_task_from_hf_hub( function checkpoint_paths (line 556) | def checkpoint_paths(path, pattern=r"checkpoint(\d+)\.pt", keep_match=Fa... function torch_persistent_save (line 578) | def torch_persistent_save(obj, filename, async_write: bool = False): function _torch_persistent_save (line 594) | def _torch_persistent_save(obj, f): function _upgrade_state_dict (line 610) | def _upgrade_state_dict(state): function prune_state_dict (line 746) | def prune_state_dict(state_dict, model_cfg: Optional[DictConfig]): function load_pretrained_component_from_model (line 839) | def load_pretrained_component_from_model( function verify_checkpoint_directory (line 872) | def verify_checkpoint_directory(save_dir: str) -> None: function save_ema_as_checkpoint (line 888) | def save_ema_as_checkpoint(src_path, dst_path): function load_ema_from_checkpoint (line 893) | def load_ema_from_checkpoint(fpath): FILE: fairseq/clib/cuda/ngram_repeat_block_cuda.cpp function ngram_repeat_block_forward (line 32) | torch::Tensor ngram_repeat_block_forward( function PYBIND11_MODULE (line 50) | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { FILE: fairseq/clib/libbase/balanced_assignment.cpp function balanced_assignment (line 19) | torch::Tensor balanced_assignment(torch::Tensor job_and_worker_to_score) { function PYBIND11_MODULE (line 107) | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { FILE: fairseq/clib/libbleu/libbleu.cpp function bleu_ltrim (line 29) | void bleu_ltrim(size_t* len, int** sent, int pad) { function bleu_rtrim (line 42) | void bleu_rtrim(size_t* len, int** sent, int pad, int eos) { function bleu_trim (line 54) | void bleu_trim(size_t* len, int** sent, int pad, int eos) { function bleu_hash (line 59) | size_t bleu_hash(int len, int* data) { function bleu_addngram (line 73) | void bleu_addngram( function bleu_zero_init (line 114) | __declspec(dllexport) function bleu_one_init (line 121) | __declspec(dllexport) function bleu_add (line 136) | __declspec(dllexport) FILE: fairseq/clib/libbleu/module.cpp type PyModuleDef (line 13) | struct PyModuleDef FILE: fairseq/clib/libnat/edit_dist.cpp function edit_distance2_with_dp (line 23) | vector> edit_distance2_with_dp( function edit_distance2_backtracking (line 45) | vector> edit_distance2_backtracking( function edit_distance2_backtracking_with_delete (line 116) | vector> edit_distance2_backtracking_with_delete( function compute_ed2 (line 186) | vector compute_ed2( function suggested_ed2_path (line 197) | vector>> suggested_ed2_path( function suggested_ed2_path_with_delete (line 210) | vector>> suggested_ed2_path_with_delete( function PYBIND11_MODULE (line 224) | PYBIND11_MODULE(libnat, m) { FILE: fairseq/clib/libnat_cuda/binding.cpp function LevenshteinDistance (line 29) | torch::Tensor LevenshteinDistance( function GenerateDeletionLabel (line 41) | torch::Tensor GenerateDeletionLabel( function GenerateInsertionLabel (line 49) | std::pair GenerateInsertionLabel( function PYBIND11_MODULE (line 57) | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { FILE: fairseq/criterions/__init__.py function build_criterion (line 28) | def build_criterion(cfg: DictConfig, task, from_checkpoint=False): FILE: fairseq/criterions/adaptive_loss.py class AdaptiveLossConfig (line 19) | class AdaptiveLossConfig(FairseqDataclass): class AdaptiveLoss (line 25) | class AdaptiveLoss(FairseqCriterion): method __init__ (line 30) | def __init__(self, task, sentence_avg): method build_criterion (line 35) | def build_criterion(cls, cfg: AdaptiveLossConfig, task): method forward (line 44) | def forward(self, model, sample, reduce=True): method reduce_metrics (line 94) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 118) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/criterions/composite_loss.py class CompositeLoss (line 12) | class CompositeLoss(LegacyFairseqCriterion): method __init__ (line 16) | def __init__(self, args, task): method add_args (line 21) | def add_args(parser): method build_underlying_criterion (line 29) | def build_underlying_criterion(args, task): method build_criterion (line 38) | def build_criterion(cls, args, task): FILE: fairseq/criterions/cross_entropy.py class CrossEntropyCriterionConfig (line 18) | class CrossEntropyCriterionConfig(FairseqDataclass): class CrossEntropyCriterion (line 23) | class CrossEntropyCriterion(FairseqCriterion): method __init__ (line 24) | def __init__(self, task, sentence_avg): method forward (line 28) | def forward(self, model, sample, reduce=True): method compute_loss (line 49) | def compute_loss(self, model, net_output, sample, reduce=True): method reduce_metrics (line 62) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 85) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/criterions/ctc.py class CtcCriterionConfig (line 26) | class CtcCriterionConfig(FairseqDataclass): class CtcCriterion (line 72) | class CtcCriterion(FairseqCriterion): method __init__ (line 73) | def __init__( method forward (line 120) | def forward(self, model, sample, reduce=True, **kwargs): method reduce_metrics (line 258) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 319) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/criterions/fairseq_criterion.py class FairseqCriterion (line 16) | class FairseqCriterion(_Loss): method __init__ (line 17) | def __init__(self, task): method add_args (line 25) | def add_args(cls, parser): method build_criterion (line 32) | def build_criterion(cls, cfg: FairseqDataclass, task): method forward (line 63) | def forward(self, model, sample, reduce=True): method aggregate_logging_outputs (line 74) | def aggregate_logging_outputs( method reduce_metrics (line 85) | def reduce_metrics(cls, logging_outputs: List[Dict[str, Any]]) -> None: method logging_outputs_can_be_summed (line 98) | def logging_outputs_can_be_summed() -> bool: class LegacyFairseqCriterion (line 107) | class LegacyFairseqCriterion(FairseqCriterion): method __init__ (line 108) | def __init__(self, args, task): method build_criterion (line 119) | def build_criterion(cls, args, task): FILE: fairseq/criterions/fastspeech2_loss.py class FastSpeech2CriterionConfig (line 23) | class FastSpeech2CriterionConfig(FairseqDataclass): class FastSpeech2Loss (line 28) | class FastSpeech2Loss(FairseqCriterion): method __init__ (line 29) | def __init__(self, task, ctc_weight): method forward (line 33) | def forward(self, model: FairseqEncoderModel, sample, reduction="mean"): method reduce_metrics (line 105) | def reduce_metrics(cls, logging_outputs: List[Dict[str, Any]]) -> None: method logging_outputs_can_be_summed (line 136) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/criterions/hubert_criterion.py class HubertCriterionConfig (line 20) | class HubertCriterionConfig(FairseqDataclass): class HubertCriterion (line 40) | class HubertCriterion(FairseqCriterion): method __init__ (line 41) | def __init__( method forward (line 55) | def forward(self, model, sample, reduce=True, log_pred=False): method reduce_metrics (line 147) | def reduce_metrics(logging_outputs) -> None: method aggregate_logging_outputs (line 184) | def aggregate_logging_outputs(logging_outputs): method logging_outputs_can_be_summed (line 189) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/criterions/label_smoothed_cross_entropy.py class LabelSmoothedCrossEntropyCriterionConfig (line 18) | class LabelSmoothedCrossEntropyCriterionConfig(FairseqDataclass): function label_smoothed_nll_loss (line 34) | def label_smoothed_nll_loss(lprobs, target, epsilon, ignore_index=None, ... class LabelSmoothedCrossEntropyCriterion (line 57) | class LabelSmoothedCrossEntropyCriterion(FairseqCriterion): method __init__ (line 58) | def __init__( method forward (line 72) | def forward(self, model, sample, reduce=True): method get_lprobs_and_target (line 98) | def get_lprobs_and_target(self, model, net_output, sample): method compute_loss (line 107) | def compute_loss(self, model, net_output, sample, reduce=True): method compute_accuracy (line 118) | def compute_accuracy(self, model, net_output, sample): method reduce_metrics (line 128) | def reduce_metrics(cls, logging_outputs) -> None: method logging_outputs_can_be_summed (line 162) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/criterions/label_smoothed_cross_entropy_latency_augmented.py class LabelSmoothedCrossEntropyCriterionLatencyAugmentConfig (line 33) | class LabelSmoothedCrossEntropyCriterionLatencyAugmentConfig( class LatencyAugmentedLabelSmoothedCrossEntropyCriterion (line 66) | class LatencyAugmentedLabelSmoothedCrossEntropyCriterion( method __init__ (line 69) | def __init__( method forward (line 95) | def forward(self, model, sample, reduce=True): method compute_latency_loss (line 136) | def compute_latency_loss(self, model, sample, net_output): method reduce_metrics (line 211) | def reduce_metrics(cls, logging_outputs) -> None: FILE: fairseq/criterions/label_smoothed_cross_entropy_with_alignment.py class LabelSmoothedCrossEntropyCriterionWithAlignmentConfig (line 21) | class LabelSmoothedCrossEntropyCriterionWithAlignmentConfig( class LabelSmoothedCrossEntropyCriterionWithAlignment (line 33) | class LabelSmoothedCrossEntropyCriterionWithAlignment( method __init__ (line 36) | def __init__(self, task, sentence_avg, label_smoothing, alignment_lamb... method forward (line 40) | def forward(self, model, sample, reduce=True): method compute_alignment_loss (line 73) | def compute_alignment_loss(self, sample, net_output): method reduce_metrics (line 94) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 125) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/criterions/label_smoothed_cross_entropy_with_ctc.py class LabelSmoothedCrossEntropyWithCtcCriterionConfig (line 23) | class LabelSmoothedCrossEntropyWithCtcCriterionConfig( class LabelSmoothedCrossEntropyWithCtcCriterion (line 33) | class LabelSmoothedCrossEntropyWithCtcCriterion(LabelSmoothedCrossEntrop... method __init__ (line 34) | def __init__( method forward (line 48) | def forward(self, model, sample, reduce=True): method reduce_metrics (line 90) | def reduce_metrics(cls, logging_outputs) -> None: FILE: fairseq/criterions/label_smoothed_cross_entropy_with_rdrop.py class RdropLabelSmoothedCrossEntropyCriterionConfig (line 22) | class RdropLabelSmoothedCrossEntropyCriterionConfig( class RdropLabelSmoothedCrossEntropyCriterion (line 35) | class RdropLabelSmoothedCrossEntropyCriterion(LabelSmoothedCrossEntropyC... method __init__ (line 36) | def __init__( method forward (line 58) | def forward(self, model, sample, reduce=True, net_output=None): method get_lprobs_and_target (line 93) | def get_lprobs_and_target(self, model, net_output, sample): method compute_loss (line 105) | def compute_loss(self, model, net_output, sample, reduce=True): method reduce_metrics (line 124) | def reduce_metrics(cls, logging_outputs) -> None: function duplicate_input (line 139) | def duplicate_input(sample): function compute_kl_loss (line 155) | def compute_kl_loss(model, net_output, pad_mask=None, reduce=True): FILE: fairseq/criterions/legacy_masked_lm.py function compute_cross_entropy_loss (line 15) | def compute_cross_entropy_loss(logits, targets, ignore_index=-100): class LegacyMaskedLmLoss (line 35) | class LegacyMaskedLmLoss(FairseqCriterion): method __init__ (line 52) | def __init__(self, task, masked_lm_only, nsp_loss_weight): method add_args (line 58) | def add_args(parser): method forward (line 74) | def forward(self, model, sample, reduce=True): method reduce_metrics (line 137) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 172) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/criterions/masked_lm.py class MaskedLmConfig (line 18) | class MaskedLmConfig(FairseqDataclass): class MaskedLmLoss (line 23) | class MaskedLmLoss(FairseqCriterion): method __init__ (line 28) | def __init__(self, cfg: MaskedLmConfig, task): method forward (line 32) | def forward(self, model, sample, reduce=True): method reduce_metrics (line 80) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 93) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/criterions/model_criterion.py class ModelCriterionConfig (line 23) | class ModelCriterionConfig(FairseqDataclass): class ModelCriterion (line 36) | class ModelCriterion(FairseqCriterion): method __init__ (line 49) | def __init__(self, task, loss_weights=None, log_keys=None, can_sum=True): method forward (line 55) | def forward(self, model, sample, reduce=True): method reduce_metrics (line 119) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 171) | def logging_outputs_can_be_summed(self) -> bool: FILE: fairseq/criterions/nat_loss.py class LabelSmoothedDualImitationCriterionConfig (line 20) | class LabelSmoothedDualImitationCriterionConfig(FairseqDataclass): class LabelSmoothedDualImitationCriterion (line 28) | class LabelSmoothedDualImitationCriterion(FairseqCriterion): method __init__ (line 29) | def __init__(self, task, label_smoothing): method _compute_loss (line 33) | def _compute_loss( method _custom_loss (line 78) | def _custom_loss(self, loss, name="loss", factor=1.0): method forward (line 81) | def forward(self, model, sample, reduce=True): method reduce_metrics (line 146) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 175) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/criterions/sentence_prediction.py function simple_accuracy (line 23) | def simple_accuracy(preds, labels): function acc_and_f1 (line 27) | def acc_and_f1(preds, labels): function pearson_and_spearman (line 37) | def pearson_and_spearman(preds, labels): function matthews_corrcoef (line 47) | def matthews_corrcoef(preds, labels): class SentencePredictionConfig (line 54) | class SentencePredictionConfig(FairseqDataclass): class SentencePredictionCriterion (line 68) | class SentencePredictionCriterion(FairseqCriterion): method __init__ (line 69) | def __init__(self, cfg: SentencePredictionConfig, task): method forward (line 81) | def forward(self, model, sample, reduce=True): method reduce_metrics (line 164) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 282) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/criterions/sentence_prediction_adapters.py class SentencePredictionCriterionAdapters (line 16) | class SentencePredictionCriterionAdapters(SentencePredictionCriterion): method forward (line 17) | def forward(self, model, sample, reduce=True): FILE: fairseq/criterions/sentence_ranking.py class SentenceRankingCriterion (line 16) | class SentenceRankingCriterion(FairseqCriterion): method __init__ (line 17) | def __init__(self, task, ranking_head_name, save_predictions, num_clas... method __del__ (line 26) | def __del__(self): method add_args (line 31) | def add_args(parser): method forward (line 40) | def forward(self, model, sample, reduce=True): method reduce_metrics (line 93) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 115) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/criterions/speech_dlm_criterion.py class SpeechDLMCriterionConfig (line 18) | class SpeechDLMCriterionConfig(FairseqDataclass): class SpeechDLMCriterion (line 48) | class SpeechDLMCriterion(FairseqCriterion): method __init__ (line 61) | def __init__( method forward (line 104) | def forward(self, model, sample, reduce=True): method compute_loss (line 192) | def compute_loss(self, model, net_output, sample, reduce=True): method reduce_metrics (line 269) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 329) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/criterions/speech_to_speech_criterion.py class MultitaskCriterion (line 29) | class MultitaskCriterion: method __init__ (line 30) | def __init__(self, multitask_tasks, rdrop_alpha=0.0): method set_multitask_loss_weight (line 63) | def set_multitask_loss_weight(self, task_name, weight=0.0): method get_multitask_loss (line 66) | def get_multitask_loss(self, model, sample, model_out): method reduce_metrics (line 129) | def reduce_metrics(cls, logging_outputs) -> None: class SpeechToUnitMultitaskTaskCriterion (line 163) | class SpeechToUnitMultitaskTaskCriterion( method __init__ (line 166) | def __init__( method forward (line 185) | def forward(self, model, sample, reduce=True): method reduce_metrics (line 229) | def reduce_metrics(cls, logging_outputs) -> None: method logging_outputs_can_be_summed (line 250) | def logging_outputs_can_be_summed() -> bool: class SpeechToUnit2passMultitaskTaskCriterion (line 262) | class SpeechToUnit2passMultitaskTaskCriterion(SpeechToUnitMultitaskTaskC... method __init__ (line 263) | def __init__( method forward (line 281) | def forward(self, model, sample, reduce=True): class SpeechToSpectrogramMultitaskTaskCriterion (line 334) | class SpeechToSpectrogramMultitaskTaskCriterion(Tacotron2Criterion, Mult... method __init__ (line 335) | def __init__( method forward (line 354) | def forward(self, model, sample, reduction="mean"): method reduce_metrics (line 414) | def reduce_metrics(cls, logging_outputs) -> None: class SpeechToSpectrogram2passMultitaskTaskCriterion (line 436) | class SpeechToSpectrogram2passMultitaskTaskCriterion( method __init__ (line 439) | def __init__( method forward (line 457) | def forward(self, model, sample, reduction="mean"): FILE: fairseq/criterions/speech_ulm_criterion.py class SpeechUnitLmCriterionConfig (line 18) | class SpeechUnitLmCriterionConfig(FairseqDataclass): function mae_loss (line 30) | def mae_loss(pred, targ, mask, reduce=True): function nll_loss (line 40) | def nll_loss(pred, targ, mask, reduce=True): class SpeechUnitLmCriterion (line 49) | class SpeechUnitLmCriterion(FairseqCriterion): method __init__ (line 50) | def __init__(self, cfg: SpeechUnitLmCriterionConfig, task: FairseqTask): method forward (line 60) | def forward(self, model, sample, reduce=True): method reduce_metrics (line 105) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 125) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/criterions/tacotron2_loss.py class Tacotron2CriterionConfig (line 27) | class Tacotron2CriterionConfig(FairseqDataclass): class GuidedAttentionLoss (line 44) | class GuidedAttentionLoss(torch.nn.Module): method __init__ (line 50) | def __init__(self, sigma): method _get_weight (line 56) | def _get_weight(s_len, t_len, sigma): method _get_weights (line 63) | def _get_weights(self, src_lens, tgt_lens): method _get_masks (line 71) | def _get_masks(src_lens, tgt_lens): method forward (line 76) | def forward(self, attn, src_lens, tgt_lens, reduction="mean"): class Tacotron2Criterion (line 85) | class Tacotron2Criterion(FairseqCriterion): method __init__ (line 86) | def __init__( method forward (line 104) | def forward(self, model, sample, reduction="mean"): method compute_loss (line 170) | def compute_loss( method reduce_metrics (line 202) | def reduce_metrics(cls, logging_outputs: List[Dict[str, Any]]) -> None: method logging_outputs_can_be_summed (line 226) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/criterions/wav2vec_criterion.py class Wav2VecCriterionConfig (line 21) | class Wav2VecCriterionConfig(FairseqDataclass): class Wav2vecCriterion (line 39) | class Wav2vecCriterion(FairseqCriterion): method __init__ (line 40) | def __init__(self, task, infonce=False, loss_weights=None, log_keys=No... method forward (line 46) | def forward(self, model, sample, reduce=True): method reduce_metrics (line 168) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 223) | def logging_outputs_can_be_summed(self) -> bool: FILE: fairseq/data/add_class_target_dataset.py class AddTargetDataset (line 12) | class AddTargetDataset(BaseWrapperDataset): method __init__ (line 13) | def __init__( method get_label (line 35) | def get_label(self, index, process_fn=None): method __getitem__ (line 40) | def __getitem__(self, index): method size (line 45) | def size(self, index): method collater (line 50) | def collater(self, samples): method filter_indices_by_size (line 75) | def filter_indices_by_size(self, indices, max_sizes): FILE: fairseq/data/add_target_dataset.py class AddTargetDataset (line 12) | class AddTargetDataset(BaseWrapperDataset): method __init__ (line 13) | def __init__( method get_label (line 35) | def get_label(self, index, process_fn=None): method __getitem__ (line 40) | def __getitem__(self, index): method size (line 45) | def size(self, index): method collater (line 50) | def collater(self, samples): method filter_indices_by_size (line 79) | def filter_indices_by_size(self, indices, max_sizes): FILE: fairseq/data/append_token_dataset.py class AppendTokenDataset (line 12) | class AppendTokenDataset(BaseWrapperDataset): method __init__ (line 13) | def __init__(self, dataset, token=None): method __getitem__ (line 21) | def __getitem__(self, idx): method sizes (line 28) | def sizes(self): method num_tokens (line 31) | def num_tokens(self, index): method size (line 37) | def size(self, index): FILE: fairseq/data/audio/__init__.py class AudioTransform (line 8) | class AudioTransform(ABC): method from_config_dict (line 11) | def from_config_dict(cls, config: Optional[Dict] = None): class CompositeAudioTransform (line 15) | class CompositeAudioTransform(AudioTransform): method _from_config_dict (line 16) | def _from_config_dict( method __init__ (line 39) | def __init__(self, transforms): method __call__ (line 42) | def __call__(self, x): method __repr__ (line 47) | def __repr__(self): function register_audio_transform (line 56) | def register_audio_transform(name, cls_type, registry, class_names): function import_transforms (line 77) | def import_transforms(transforms_dir, transform_type): function rand_uniform (line 92) | def rand_uniform(a, b): FILE: fairseq/data/audio/audio_utils.py function convert_waveform (line 22) | def convert_waveform( function get_waveform (line 69) | def get_waveform( function get_features_from_npy_or_audio (line 129) | def get_features_from_npy_or_audio(path, waveform_transforms=None): function get_features_or_waveform_from_stored_zip (line 140) | def get_features_or_waveform_from_stored_zip( function get_features_or_waveform (line 169) | def get_features_or_waveform( function _get_kaldi_fbank (line 212) | def _get_kaldi_fbank( function _get_torchaudio_fbank (line 236) | def _get_torchaudio_fbank( function get_fbank (line 252) | def get_fbank( function is_npy_data (line 275) | def is_npy_data(data: bytes) -> bool: function is_sf_audio_data (line 279) | def is_sf_audio_data(data: bytes) -> bool: function mmap_read (line 286) | def mmap_read(path: str, offset: int, length: int) -> bytes: function read_from_stored_zip (line 293) | def read_from_stored_zip(zip_path: str, offset: int, length: int) -> bytes: function parse_path (line 297) | def parse_path(path: str) -> Tuple[str, List[int]]: function get_window (line 322) | def get_window(window_fn: callable, n_fft: int, win_length: int) -> torc... function get_fourier_basis (line 328) | def get_fourier_basis(n_fft: int) -> torch.Tensor: function get_mel_filters (line 336) | def get_mel_filters( class TTSSpectrogram (line 347) | class TTSSpectrogram(torch.nn.Module): method __init__ (line 348) | def __init__( method forward (line 365) | def forward( class TTSMelScale (line 380) | class TTSMelScale(torch.nn.Module): method __init__ (line 381) | def __init__( method forward (line 388) | def forward(self, specgram: torch.Tensor) -> torch.Tensor: FILE: fairseq/data/audio/data_cfg.py function get_config_from_yaml (line 17) | def get_config_from_yaml(yaml_path: Path): class S2TDataConfig (line 35) | class S2TDataConfig(object): method __init__ (line 38) | def __init__(self, yaml_path: Path): method _auto_convert_to_abs_path (line 42) | def _auto_convert_to_abs_path(self, x): method vocab_filename (line 51) | def vocab_filename(self): method speaker_set_filename (line 56) | def speaker_set_filename(self): method shuffle (line 61) | def shuffle(self) -> bool: method pre_tokenizer (line 66) | def pre_tokenizer(self) -> Dict: method bpe_tokenizer (line 75) | def bpe_tokenizer(self) -> Dict: method prepend_tgt_lang_tag (line 84) | def prepend_tgt_lang_tag(self) -> bool: method prepend_bos_and_append_tgt_lang_tag (line 91) | def prepend_bos_and_append_tgt_lang_tag(self) -> bool: method input_feat_per_channel (line 96) | def input_feat_per_channel(self): method input_channels (line 101) | def input_channels(self): method sample_rate (line 106) | def sample_rate(self): method sampling_alpha (line 110) | def sampling_alpha(self): method use_audio_input (line 116) | def use_audio_input(self): method standardize_audio (line 121) | def standardize_audio(self) -> bool: method use_sample_rate (line 125) | def use_sample_rate(self): method audio_root (line 131) | def audio_root(self): method get_transforms (line 136) | def get_transforms(self, transform_type, split, is_train): method get_feature_transforms (line 150) | def get_feature_transforms(self, split, is_train): method get_waveform_transforms (line 168) | def get_waveform_transforms(self, split, is_train): method get_dataset_transforms (line 173) | def get_dataset_transforms(self, split, is_train): method global_cmvn_stats_npz (line 179) | def global_cmvn_stats_npz(self) -> Optional[str]: method vocoder (line 184) | def vocoder(self) -> Dict[str, str]: method hub (line 189) | def hub(self) -> Dict[str, str]: class S2SDataConfig (line 193) | class S2SDataConfig(S2TDataConfig): method vocab_filename (line 197) | def vocab_filename(self): method pre_tokenizer (line 202) | def pre_tokenizer(self) -> Dict: method bpe_tokenizer (line 206) | def bpe_tokenizer(self) -> Dict: method input_transformed_channels (line 210) | def input_transformed_channels(self): method output_sample_rate (line 229) | def output_sample_rate(self): method target_speaker_embed (line 234) | def target_speaker_embed(self): method prepend_tgt_lang_tag_as_bos (line 239) | def prepend_tgt_lang_tag_as_bos(self) -> bool: class MultitaskConfig (line 244) | class MultitaskConfig(object): method __init__ (line 247) | def __init__(self, yaml_path: Path): method get_all_tasks (line 253) | def get_all_tasks(self): method get_single_task (line 256) | def get_single_task(self, name): method first_pass_decoder_task_index (line 261) | def first_pass_decoder_task_index(self): class SingleTaskConfig (line 279) | class SingleTaskConfig(object): method __init__ (line 280) | def __init__(self, name, config): method data (line 287) | def data(self): method decoder_type (line 291) | def decoder_type(self): method decoder_args (line 295) | def decoder_args(self): method criterion_cfg (line 301) | def criterion_cfg(self): method input_from (line 318) | def input_from(self): method input_layer (line 323) | def input_layer(self): method loss_weight_schedule (line 331) | def loss_weight_schedule(self): method get_loss_weight (line 339) | def get_loss_weight(self, num_updates): method prepend_bos_and_append_tgt_lang_tag (line 358) | def prepend_bos_and_append_tgt_lang_tag(self) -> bool: method eos_token (line 363) | def eos_token(self): method rdrop_alpha (line 368) | def rdrop_alpha(self): method is_first_pass_decoder (line 372) | def is_first_pass_decoder(self): method get_lang_tag_mapping (line 386) | def get_lang_tag_mapping(self): FILE: fairseq/data/audio/dataset_transforms/__init__.py class AudioDatasetTransform (line 10) | class AudioDatasetTransform(AudioTransform): function get_audio_dataset_transform (line 18) | def get_audio_dataset_transform(name): function register_audio_dataset_transform (line 22) | def register_audio_dataset_transform(name): class CompositeAudioDatasetTransform (line 34) | class CompositeAudioDatasetTransform(CompositeAudioTransform): method from_config_dict (line 36) | def from_config_dict(cls, config=None): method get_transform (line 46) | def get_transform(self, cls): method has_transform (line 52) | def has_transform(self, cls): FILE: fairseq/data/audio/dataset_transforms/concataugment.py class ConcatAugment (line 13) | class ConcatAugment(AudioDatasetTransform): method from_config_dict (line 15) | def from_config_dict(cls, config=None): method __init__ (line 23) | def __init__( method __repr__ (line 31) | def __repr__(self): method find_indices (line 45) | def find_indices(self, index: int, n_frames: List[int], n_samples: int): FILE: fairseq/data/audio/dataset_transforms/noisyoverlapaugment.py class NoisyOverlapAugment (line 25) | class NoisyOverlapAugment(AudioDatasetTransform): method from_config_dict (line 27) | def from_config_dict(cls, config=None): method __init__ (line 39) | def __init__( method __repr__ (line 57) | def __repr__(self): method __call__ (line 74) | def __call__(self, sources): FILE: fairseq/data/audio/feature_transforms/__init__.py class AudioFeatureTransform (line 10) | class AudioFeatureTransform(AudioTransform): function get_audio_feature_transform (line 18) | def get_audio_feature_transform(name): function register_audio_feature_transform (line 22) | def register_audio_feature_transform(name): class CompositeAudioFeatureTransform (line 34) | class CompositeAudioFeatureTransform(CompositeAudioTransform): method from_config_dict (line 36) | def from_config_dict(cls, config=None): FILE: fairseq/data/audio/feature_transforms/delta_deltas.py class DeltaDeltas (line 10) | class DeltaDeltas(AudioFeatureTransform): method from_config_dict (line 14) | def from_config_dict(cls, config=None): method __init__ (line 18) | def __init__(self, win_length=5): method __repr__ (line 21) | def __repr__(self): method __call__ (line 24) | def __call__(self, spectrogram): FILE: fairseq/data/audio/feature_transforms/global_cmvn.py class GlobalCMVN (line 9) | class GlobalCMVN(AudioFeatureTransform): method from_config_dict (line 14) | def from_config_dict(cls, config=None): method __init__ (line 18) | def __init__(self, stats_npz_path): method __repr__ (line 23) | def __repr__(self): method __call__ (line 26) | def __call__(self, x): FILE: fairseq/data/audio/feature_transforms/specaugment.py class SpecAugmentTransform (line 13) | class SpecAugmentTransform(AudioFeatureTransform): method from_config_dict (line 17) | def from_config_dict(cls, config=None): method __init__ (line 29) | def __init__( method __repr__ (line 62) | def __repr__(self): method __call__ (line 79) | def __call__(self, spectrogram): FILE: fairseq/data/audio/feature_transforms/utterance_cmvn.py class UtteranceCMVN (line 10) | class UtteranceCMVN(AudioFeatureTransform): method from_config_dict (line 14) | def from_config_dict(cls, config=None): method __init__ (line 21) | def __init__(self, norm_means=True, norm_vars=True): method __repr__ (line 24) | def __repr__(self): method __call__ (line 30) | def __call__(self, x): FILE: fairseq/data/audio/frm_text_to_speech_dataset.py class FrmTextToSpeechDataset (line 25) | class FrmTextToSpeechDataset(TextToSpeechDataset): method __init__ (line 26) | def __init__( method __getitem__ (line 86) | def __getitem__(self, index): method set_epoch (line 121) | def set_epoch(self, epoch): class FrmTextToSpeechDatasetCreator (line 135) | class FrmTextToSpeechDatasetCreator(TextToSpeechDatasetCreator): method from_tsv (line 138) | def from_tsv( FILE: fairseq/data/audio/hubert_dataset.py function load_audio (line 27) | def load_audio(manifest_path, max_keep, min_keep): function load_label (line 55) | def load_label(label_path, inds, tot): function load_label_offset (line 65) | def load_label_offset(label_path, inds, tot): function verify_label_lengths (line 76) | def verify_label_lengths( class HubertDataset (line 115) | class HubertDataset(FairseqDataset): method __init__ (line 116) | def __init__( method get_audio (line 176) | def get_audio(self, index): method get_label (line 192) | def get_label(self, index, label_idx): method get_labels (line 205) | def get_labels(self, index): method __getitem__ (line 208) | def __getitem__(self, index): method __len__ (line 213) | def __len__(self): method crop_to_max_size (line 216) | def crop_to_max_size(self, wav, target_size): method collater (line 228) | def collater(self, samples): method collater_audio (line 268) | def collater_audio(self, audios, audio_size): method collater_frm_label (line 289) | def collater_frm_label(self, targets, audio_size, audio_starts, label_... method collater_seq_label (line 307) | def collater_seq_label(self, targets, pad): method collater_label (line 313) | def collater_label(self, targets_by_label, audio_size, audio_starts): method num_tokens (line 328) | def num_tokens(self, index): method size (line 331) | def size(self, index): method ordered_indices (line 336) | def ordered_indices(self): method postprocess (line 345) | def postprocess(self, wav, cur_sample_rate): FILE: fairseq/data/audio/multi_modality_dataset.py class ModalityDatasetItem (line 25) | class ModalityDatasetItem(NamedTuple): class MultiModalityDataset (line 39) | class MultiModalityDataset(ConcatDataset): method __init__ (line 40) | def __init__(self, datasets: List[ModalityDatasetItem]): method set_epoch (line 61) | def set_epoch(self, epoch): method __getitem__ (line 65) | def __getitem__(self, idx): method collater (line 70) | def collater(self, samples): method size (line 82) | def size(self, index: int): method sizes (line 88) | def sizes(self): method ordered_indices (line 93) | def ordered_indices(self): method get_raw_batch_samplers (line 108) | def get_raw_batch_samplers(self, required_batch_size_multiple, seed): method get_batch_samplers (line 128) | def get_batch_samplers(self, mult_ratios, required_batch_size_multiple... class LangPairMaskDataset (line 172) | class LangPairMaskDataset(FairseqDataset): method __init__ (line 173) | def __init__( method src_sizes (line 191) | def src_sizes(self): method tgt_sizes (line 195) | def tgt_sizes(self): method sizes (line 199) | def sizes(self): method get_batch_shapes (line 203) | def get_batch_shapes(self): method num_tokens_vec (line 208) | def num_tokens_vec(self, indices): method __len__ (line 211) | def __len__(self): method num_tokens (line 214) | def num_tokens(self, index): method size (line 217) | def size(self, index): method ordered_indices (line 220) | def ordered_indices(self): method supports_prefetch (line 224) | def supports_prefetch(self): method prefetch (line 227) | def prefetch(self, indices): method mask_src_tokens (line 230) | def mask_src_tokens(self, sample): method __getitem__ (line 247) | def __getitem__(self, index): method collater (line 253) | def collater(self, samples, pad_to_length=None): class FileAudioDatasetWrapper (line 257) | class FileAudioDatasetWrapper(FileAudioDataset): method collater (line 258) | def collater(self, samples): FILE: fairseq/data/audio/raw_audio_dataset.py class RawAudioDataset (line 30) | class RawAudioDataset(FairseqDataset): method __init__ (line 31) | def __init__( method __getitem__ (line 78) | def __getitem__(self, index): method __len__ (line 81) | def __len__(self): method postprocess (line 84) | def postprocess(self, feats, curr_sample_rate): method crop_to_max_size (line 98) | def crop_to_max_size(self, t, target_size, dim=0): method _bucket_tensor (line 115) | def _bucket_tensor(tensor, num_pad, value): method collater (line 118) | def collater(self, samples): method _get_mask_indices_dims (line 177) | def _get_mask_indices_dims(self, size, padding=0, dilation=1): method num_tokens (line 187) | def num_tokens(self, index): method size (line 190) | def size(self, index): method ordered_indices (line 197) | def ordered_indices(self): method set_bucket_info (line 213) | def set_bucket_info(self, num_buckets): method filter_indices_by_size (line 232) | def filter_indices_by_size(self, indices, max_sizes): class FileAudioDataset (line 236) | class FileAudioDataset(RawAudioDataset): method __init__ (line 237) | def __init__( method __getitem__ (line 297) | def __getitem__(self, index): class BinarizedAudioDataset (line 349) | class BinarizedAudioDataset(RawAudioDataset): method __init__ (line 350) | def __init__( method __getitem__ (line 403) | def __getitem__(self, index): FILE: fairseq/data/audio/speech_to_speech_dataset.py class SpeechToSpeechDatasetItem (line 28) | class SpeechToSpeechDatasetItem(object): class SpeechToSpeechDataset (line 36) | class SpeechToSpeechDataset(SpeechToTextDataset): method __init__ (line 37) | def __init__( method pack_units (line 88) | def pack_units(self, input: torch.Tensor) -> torch.Tensor: method __getitem__ (line 111) | def __getitem__(self, index: int) -> SpeechToSpeechDatasetItem: method _collate_target (line 154) | def _collate_target(self, samples: List[SpeechToSpeechDatasetItem]) ->... method collater (line 187) | def collater( class SpeechToSpeechMultitaskDataset (line 235) | class SpeechToSpeechMultitaskDataset(SpeechToSpeechDataset): method __init__ (line 236) | def __init__(self, **kwargs): method add_multitask_dataset (line 240) | def add_multitask_dataset(self, task_name, task_data): method __getitem__ (line 243) | def __getitem__( method collater (line 256) | def collater( class SpeechToSpeechDatasetCreator (line 285) | class SpeechToSpeechDatasetCreator(object): method _from_list (line 295) | def _from_list( method from_tsv (line 352) | def from_tsv( FILE: fairseq/data/audio/speech_to_text_dataset.py function _collate_frames (line 35) | def _collate_frames( function _is_int_or_np_int (line 56) | def _is_int_or_np_int(n): class SpeechToTextDatasetItem (line 63) | class SpeechToTextDatasetItem(object): class SpeechToTextDataset (line 70) | class SpeechToTextDataset(FairseqDataset): method __init__ (line 73) | def __init__( method get_tgt_lens_and_check_oov (line 143) | def get_tgt_lens_and_check_oov(self): method __repr__ (line 161) | def __repr__(self): method is_lang_tag (line 174) | def is_lang_tag(cls, token): method check_tgt_lang_tag (line 178) | def check_tgt_lang_tag(self): method tokenize (line 187) | def tokenize(cls, tokenizer, text: str): method get_tokenized_tgt_text (line 190) | def get_tokenized_tgt_text(self, index: Union[int, List[int]]): method pack_frames (line 200) | def pack_frames(self, feature: torch.Tensor): method get_lang_tag_idx (line 208) | def get_lang_tag_idx(cls, lang: str, dictionary: Dictionary): method _get_source_audio (line 213) | def _get_source_audio(self, index: Union[int, List[int]]) -> torch.Ten... method __getitem__ (line 255) | def __getitem__(self, index: int) -> SpeechToTextDatasetItem: method __len__ (line 290) | def __len__(self): method collater (line 293) | def collater( method num_tokens (line 364) | def num_tokens(self, index): method size (line 367) | def size(self, index): method sizes (line 371) | def sizes(self): method can_reuse_epoch_itr_across_epochs (line 375) | def can_reuse_epoch_itr_across_epochs(self): method ordered_indices (line 378) | def ordered_indices(self): method prefetch (line 387) | def prefetch(self, indices): class TextTargetMultitaskData (line 391) | class TextTargetMultitaskData(object): method __init__ (line 396) | def __init__(self, args, split, tgt_dict): method is_lang_tag (line 410) | def is_lang_tag(cls, token): method tokenize (line 415) | def tokenize(cls, tokenizer, text: str): method get_tokenized_tgt_text (line 418) | def get_tokenized_tgt_text(self, index: int): method get_lang_tag_idx (line 423) | def get_lang_tag_idx(self, lang: str, dictionary: Dictionary): method build_tokenizer (line 430) | def build_tokenizer(self, args): method build_bpe (line 438) | def build_bpe(self, args): method get (line 446) | def get(self, sample_id, tgt_lang=None): method collater (line 465) | def collater(self, samples: List[torch.Tensor]) -> torch.Tensor: class SpeechToTextMultitaskDataset (line 495) | class SpeechToTextMultitaskDataset(SpeechToTextDataset): method __init__ (line 496) | def __init__(self, **kwargs): method add_multitask_dataset (line 500) | def add_multitask_dataset(self, task_name, task_data): method __getitem__ (line 503) | def __getitem__( method collater (line 516) | def collater( class SpeechToTextDatasetCreator (line 545) | class SpeechToTextDatasetCreator(object): method _from_list (line 556) | def _from_list( method get_size_ratios (line 612) | def get_size_ratios( method _load_samples_from_tsv (line 645) | def _load_samples_from_tsv(cls, root: str, split: str): method _from_tsv (line 664) | def _from_tsv( method from_tsv (line 692) | def from_tsv( FILE: fairseq/data/audio/speech_to_text_joint_dataset.py class S2TJointDataConfig (line 23) | class S2TJointDataConfig(S2TDataConfig): method src_vocab_filename (line 27) | def src_vocab_filename(self): method src_pre_tokenizer (line 32) | def src_pre_tokenizer(self) -> Dict: method src_bpe_tokenizer (line 40) | def src_bpe_tokenizer(self) -> Dict: method prepend_tgt_lang_tag_no_change (line 48) | def prepend_tgt_lang_tag_no_change(self) -> bool: method sampling_text_alpha (line 59) | def sampling_text_alpha(self): class SpeechToTextJointDatasetItem (line 65) | class SpeechToTextJointDatasetItem(NamedTuple): class SpeechToTextJointDataset (line 78) | class SpeechToTextJointDataset(SpeechToTextDataset): method __init__ (line 79) | def __init__( method get_tokenized_src_text (line 130) | def get_tokenized_src_text(self, index: int): method __getitem__ (line 135) | def __getitem__(self, index: int) -> SpeechToTextJointDatasetItem: method __len__ (line 166) | def __len__(self): method collater (line 169) | def collater(self, samples: List[SpeechToTextJointDatasetItem]) -> Dict: class SpeechToTextJointDatasetCreator (line 227) | class SpeechToTextJointDatasetCreator(SpeechToTextDatasetCreator): method _from_list (line 231) | def _from_list( method _from_tsv (line 282) | def _from_tsv( method from_tsv (line 314) | def from_tsv( FILE: fairseq/data/audio/text_to_speech_dataset.py class TextToSpeechDatasetItem (line 27) | class TextToSpeechDatasetItem(object): class TextToSpeechDataset (line 37) | class TextToSpeechDataset(SpeechToTextDataset): method __init__ (line 38) | def __init__( method __getitem__ (line 82) | def __getitem__(self, index: int) -> TextToSpeechDatasetItem: method collater (line 110) | def collater(self, samples: List[TextToSpeechDatasetItem]) -> Dict[str... class TextToSpeechDatasetCreator (line 183) | class TextToSpeechDatasetCreator(SpeechToTextDatasetCreator): method _from_list (line 189) | def _from_list( FILE: fairseq/data/audio/waveform_transforms/__init__.py class AudioWaveformTransform (line 10) | class AudioWaveformTransform(AudioTransform): function get_audio_waveform_transform (line 18) | def get_audio_waveform_transform(name): function register_audio_waveform_transform (line 22) | def register_audio_waveform_transform(name): class CompositeAudioWaveformTransform (line 34) | class CompositeAudioWaveformTransform(CompositeAudioTransform): method from_config_dict (line 36) | def from_config_dict(cls, config=None): method __call__ (line 45) | def __call__(self, x, sample_rate): FILE: fairseq/data/audio/waveform_transforms/noiseaugment.py class NoiseAugmentTransform (line 20) | class NoiseAugmentTransform(AudioWaveformTransform): method from_config_dict (line 22) | def from_config_dict(cls, config=None): method __init__ (line 31) | def __init__( method __repr__ (line 53) | def __repr__(self): method pick_sample (line 67) | def pick_sample(self, goal_shape, always_2d=False, use_sample_rate=None): method _mix (line 94) | def _mix(self, source, noise, snr): method _get_noise (line 104) | def _get_noise(self, goal_shape, always_2d=False, use_sample_rate=None): method __call__ (line 107) | def __call__(self, source, sample_rate): class MusicAugmentTransform (line 122) | class MusicAugmentTransform(NoiseAugmentTransform): class BackgroundNoiseAugmentTransform (line 127) | class BackgroundNoiseAugmentTransform(NoiseAugmentTransform): class BabbleAugmentTransform (line 132) | class BabbleAugmentTransform(NoiseAugmentTransform): method _get_noise (line 133) | def _get_noise(self, goal_shape, always_2d=False, use_sample_rate=None): class SporadicNoiseAugmentTransform (line 144) | class SporadicNoiseAugmentTransform(NoiseAugmentTransform): method from_config_dict (line 146) | def from_config_dict(cls, config=None): method __init__ (line 158) | def __init__( method _get_noise (line 173) | def _get_noise(self, goal_shape, always_2d=False, use_sample_rate=None): FILE: fairseq/data/backtranslation_dataset.py function backtranslate_samples (line 12) | def backtranslate_samples(samples, collate_fn, generate_fn, cuda=True): class BacktranslationDataset (line 53) | class BacktranslationDataset(FairseqDataset): method __init__ (line 79) | def __init__( method __getitem__ (line 98) | def __getitem__(self, index): method __len__ (line 106) | def __len__(self): method set_backtranslation_fn (line 109) | def set_backtranslation_fn(self, backtranslation_fn): method collater (line 112) | def collater(self, samples): method num_tokens (line 141) | def num_tokens(self, index): method ordered_indices (line 145) | def ordered_indices(self): method size (line 149) | def size(self, index): method supports_prefetch (line 161) | def supports_prefetch(self): method prefetch (line 164) | def prefetch(self, indices): FILE: fairseq/data/base_wrapper_dataset.py class BaseWrapperDataset (line 11) | class BaseWrapperDataset(FairseqDataset): method __init__ (line 12) | def __init__(self, dataset): method __getitem__ (line 16) | def __getitem__(self, index): method __len__ (line 19) | def __len__(self): method collater (line 22) | def collater(self, samples): method sizes (line 29) | def sizes(self): method num_tokens (line 32) | def num_tokens(self, index): method size (line 35) | def size(self, index): method ordered_indices (line 38) | def ordered_indices(self): method supports_prefetch (line 42) | def supports_prefetch(self): method attr (line 45) | def attr(self, attr: str, index: int): method prefetch (line 48) | def prefetch(self, indices): method get_batch_shapes (line 51) | def get_batch_shapes(self): method batch_by_size (line 54) | def batch_by_size( method filter_indices_by_size (line 68) | def filter_indices_by_size(self, indices, max_sizes): method can_reuse_epoch_itr_across_epochs (line 72) | def can_reuse_epoch_itr_across_epochs(self): method set_epoch (line 75) | def set_epoch(self, epoch): FILE: fairseq/data/bucket_pad_length_dataset.py class BucketPadLengthDataset (line 12) | class BucketPadLengthDataset(BaseWrapperDataset): method __init__ (line 26) | def __init__( method _set_tensor (line 44) | def _set_tensor(self, item, val): method _get_tensor (line 50) | def _get_tensor(self, item): method _pad (line 55) | def _pad(self, tensor, bucket_size, dim=-1): method __getitem__ (line 63) | def __getitem__(self, index): method sizes (line 71) | def sizes(self): method num_tokens (line 74) | def num_tokens(self, index): method size (line 77) | def size(self, index): FILE: fairseq/data/codedataset.py class ExpressiveCodeDataConfig (line 26) | class ExpressiveCodeDataConfig(object): method __init__ (line 27) | def __init__(self, json_path): method manifests (line 33) | def manifests(self): method n_units (line 37) | def n_units(self): method sampling_rate (line 41) | def sampling_rate(self): method code_hop_size (line 45) | def code_hop_size(self): method f0_stats (line 49) | def f0_stats(self): method f0_vq_type (line 54) | def f0_vq_type(self): method f0_vq_name (line 59) | def f0_vq_name(self): method get_f0_vq_naive_quantizer (line 62) | def get_f0_vq_naive_quantizer(self, log, norm_mean, norm_std): method f0_vq_n_units (line 73) | def f0_vq_n_units(self): method multispkr (line 77) | def multispkr(self): function get_f0 (line 82) | def get_f0(audio, rate=16000): function interpolate_f0 (line 108) | def interpolate_f0(f0): function naive_quantize (line 125) | def naive_quantize(x, edges): function load_wav (line 130) | def load_wav(full_path): function parse_code (line 139) | def parse_code(code_str, dictionary, append_eos): function parse_manifest (line 152) | def parse_manifest(manifest, dictionary): function parse_speaker (line 180) | def parse_speaker(path, method): function get_f0_by_filename (line 198) | def get_f0_by_filename(filename, tgt_sampling_rate): function align_f0_to_durations (line 211) | def align_f0_to_durations(f0, durations, f0_code_ratio, tol=1): class Paddings (line 241) | class Paddings(object): method __init__ (line 242) | def __init__(self, code_val, dur_val=0, f0_val=-2.0): class Shifts (line 248) | class Shifts(object): method __init__ (line 249) | def __init__(self, shifts_str, pads): method dur (line 257) | def dur(self): method f0 (line 261) | def f0(self): method shift_one (line 265) | def shift_one(seq, left_pad_num, right_pad_num, pad): method __call__ (line 274) | def __call__(self, code, dur, f0): class CodeDataset (line 291) | class CodeDataset(FairseqDataset): method __init__ (line 292) | def __init__( method get_data_handlers (line 365) | def get_data_handlers(self): method preprocess_f0 (line 388) | def preprocess_f0(self, f0, stats): method _get_raw_item (line 409) | def _get_raw_item(self, index): method __getitem__ (line 418) | def __getitem__(self, index): method __len__ (line 486) | def __len__(self): method size (line 489) | def size(self, index): method num_tokens (line 492) | def num_tokens(self, index): method collater (line 495) | def collater(self, samples): FILE: fairseq/data/colorize_dataset.py class ColorizeDataset (line 11) | class ColorizeDataset(BaseWrapperDataset): method __init__ (line 14) | def __init__(self, dataset, color_getter): method collater (line 18) | def collater(self, samples): FILE: fairseq/data/concat_dataset.py class ConcatDataset (line 14) | class ConcatDataset(FairseqDataset): method cumsum (line 16) | def cumsum(sequence, sample_ratios): method __init__ (line 24) | def __init__(self, datasets, sample_ratios=1): method __len__ (line 34) | def __len__(self): method __getitem__ (line 37) | def __getitem__(self, idx): method _get_dataset_and_sample_index (line 41) | def _get_dataset_and_sample_index(self, idx: int): method collater (line 50) | def collater(self, samples, **extra_args): method size (line 57) | def size(self, idx: int): method num_tokens (line 64) | def num_tokens(self, index: int): method attr (line 67) | def attr(self, attr: str, index: int): method sizes (line 72) | def sizes(self): method supports_prefetch (line 84) | def supports_prefetch(self): method ordered_indices (line 87) | def ordered_indices(self): method prefetch (line 108) | def prefetch(self, indices): method can_reuse_epoch_itr_across_epochs (line 117) | def can_reuse_epoch_itr_across_epochs(self): method set_epoch (line 120) | def set_epoch(self, epoch): FILE: fairseq/data/concat_sentences_dataset.py class ConcatSentencesDataset (line 11) | class ConcatSentencesDataset(FairseqDataset): method __init__ (line 12) | def __init__(self, *datasets): method __getitem__ (line 19) | def __getitem__(self, index): method __len__ (line 22) | def __len__(self): method collater (line 25) | def collater(self, samples): method sizes (line 29) | def sizes(self): method num_tokens (line 32) | def num_tokens(self, index): method size (line 35) | def size(self, index): method ordered_indices (line 38) | def ordered_indices(self): method supports_prefetch (line 42) | def supports_prefetch(self): method prefetch (line 45) | def prefetch(self, indices): method set_epoch (line 50) | def set_epoch(self, epoch): FILE: fairseq/data/data_utils.py function infer_language_pair (line 28) | def infer_language_pair(path): function collate_tokens (line 38) | def collate_tokens( function load_indexed_dataset (line 74) | def load_indexed_dataset( function numpy_seed (line 128) | def numpy_seed(seed, *addl_seeds): function collect_filtered (line 144) | def collect_filtered(function, iterable, filtered): function _filter_by_size_dynamic (line 161) | def _filter_by_size_dynamic(indices, size_fn, max_positions, raise_excep... function filter_by_size (line 194) | def filter_by_size(indices, dataset, max_positions, raise_exception=False): function filter_paired_dataset_indices_by_size (line 247) | def filter_paired_dataset_indices_by_size(src_sizes, tgt_sizes, indices,... function batch_by_size (line 283) | def batch_by_size( function post_process (line 374) | def post_process(sentence: str, symbol: str): function compute_mask_indices (line 399) | def compute_mask_indices( function compute_block_mask_2d (line 591) | def compute_block_mask_2d( function compute_block_mask_1d (line 726) | def compute_block_mask_1d( function get_mem_usage (line 850) | def get_mem_usage(): function lengths_to_padding_mask (line 862) | def lengths_to_padding_mask(lens): function lengths_to_mask (line 871) | def lengths_to_mask(lens): function get_buckets (line 875) | def get_buckets(sizes, num_buckets): function get_bucketed_sizes (line 886) | def get_bucketed_sizes(orig_sizes, buckets): function _find_extra_valid_paths (line 897) | def _find_extra_valid_paths(dataset_path: str) -> set: function raise_if_valid_subsets_unintentionally_ignored (line 909) | def raise_if_valid_subsets_unintentionally_ignored(train_cfg) -> None: function compute_mask_indices_for_one (line 927) | def compute_mask_indices_for_one( function compute_mask_indices_v2 (line 964) | def compute_mask_indices_v2( function compute_mask_indices_v3 (line 1004) | def compute_mask_indices_v3( FILE: fairseq/data/denoising_dataset.py function collate (line 14) | def collate( class DenoisingDataset (line 95) | class DenoisingDataset(FairseqDataset): method __init__ (line 112) | def __init__( method can_reuse_epoch_itr_across_epochs (line 184) | def can_reuse_epoch_itr_across_epochs(self): method set_epoch (line 187) | def set_epoch(self, epoch, **unused): method __getitem__ (line 190) | def __getitem__(self, index): method __len__ (line 222) | def __len__(self): method permute_sentences (line 225) | def permute_sentences(self, source, p=1.0): method word_starts (line 248) | def word_starts(self, source): method add_whole_word_mask (line 257) | def add_whole_word_mask(self, source, p): method add_permuted_noise (line 364) | def add_permuted_noise(self, tokens, p): method add_rolling_noise (line 371) | def add_rolling_noise(self, tokens): method add_insertion_noise (line 379) | def add_insertion_noise(self, tokens, p): method collater (line 402) | def collater(self, samples, pad_to_length=None): method num_tokens (line 413) | def num_tokens(self, index): method size (line 418) | def size(self, index): method ordered_indices (line 423) | def ordered_indices(self): method prefetch (line 432) | def prefetch(self, indices): method supports_prefetch (line 437) | def supports_prefetch(self): FILE: fairseq/data/dictionary.py class Dictionary (line 18) | class Dictionary: method __init__ (line 21) | def __init__( method __eq__ (line 45) | def __eq__(self, other): method __getitem__ (line 48) | def __getitem__(self, idx): method get_count (line 53) | def get_count(self, idx): method __len__ (line 56) | def __len__(self): method __contains__ (line 60) | def __contains__(self, sym): method index (line 63) | def index(self, sym): method string (line 70) | def string( method unk_string (line 120) | def unk_string(self, escape=False): method add_symbol (line 127) | def add_symbol(self, word, n=1, overwrite=False): method update (line 140) | def update(self, new_dict): method finalize (line 153) | def finalize(self, threshold=-1, nwords=-1, padding_factor=8): method pad_to_multiple_ (line 192) | def pad_to_multiple_(self, padding_factor): method bos (line 201) | def bos(self): method pad (line 205) | def pad(self): method eos (line 209) | def eos(self): method unk (line 213) | def unk(self): method load (line 218) | def load(cls, f, add_special_symbols=True): method add_from_file (line 231) | def add_from_file(self, f): method _save (line 276) | def _save(self, f, kv_iterator): method _get_meta (line 284) | def _get_meta(self): method _load_meta (line 287) | def _load_meta(self, lines): method save (line 290) | def save(self, f): method dummy_sentence (line 301) | def dummy_sentence(self, length): method encode_line (line 306) | def encode_line( method _add_file_to_dictionary_single_worker (line 334) | def _add_file_to_dictionary_single_worker( method add_file_to_dictionary (line 350) | def add_file_to_dictionary(filename, dict, tokenize, num_workers): class TruncatedDictionary (line 386) | class TruncatedDictionary(object): method __init__ (line 387) | def __init__(self, wrapped_dict, length): method __len__ (line 397) | def __len__(self): method __getitem__ (line 400) | def __getitem__(self, i): FILE: fairseq/data/encoders/byte_bpe.py class ByteBpeConfig (line 21) | class ByteBpeConfig(FairseqDataclass): class ByteBPE (line 28) | class ByteBPE(object): method __init__ (line 29) | def __init__(self, cfg): method encode (line 41) | def encode(self, x: str) -> str: method decode (line 46) | def decode(x: str) -> str: FILE: fairseq/data/encoders/byte_utils.py function byte_encode (line 22) | def byte_encode(x: str) -> str: function byte_decode (line 27) | def byte_decode(x: str) -> str: function smart_byte_decode (line 34) | def smart_byte_decode(x: str) -> str: FILE: fairseq/data/encoders/bytes.py class Bytes (line 17) | class Bytes(object): method __init__ (line 18) | def __init__(self, *unused): method add_args (line 22) | def add_args(parser): method encode (line 26) | def encode(x: str) -> str: method decode (line 32) | def decode(x: str) -> str: FILE: fairseq/data/encoders/characters.py class Characters (line 15) | class Characters(object): method __init__ (line 16) | def __init__(self, *unused): method add_args (line 20) | def add_args(parser): method encode (line 24) | def encode(x: str) -> str: method decode (line 29) | def decode(x: str) -> str: FILE: fairseq/data/encoders/fastbpe.py class fastBPEConfig (line 14) | class fastBPEConfig(FairseqDataclass): class fastBPE (line 19) | class fastBPE(object): method __init__ (line 20) | def __init__(self, cfg): method encode (line 32) | def encode(self, x: str) -> str: method decode (line 35) | def decode(self, x: str) -> str: FILE: fairseq/data/encoders/gpt2_bpe.py class GPT2BPEConfig (line 20) | class GPT2BPEConfig(FairseqDataclass): class GPT2BPE (line 30) | class GPT2BPE(object): method __init__ (line 31) | def __init__(self, cfg): method encode (line 36) | def encode(self, x: str) -> str: method decode (line 39) | def decode(self, x: str) -> str: method is_beginning_of_word (line 44) | def is_beginning_of_word(self, x: str) -> bool: FILE: fairseq/data/encoders/gpt2_bpe_utils.py function bytes_to_unicode (line 13) | def bytes_to_unicode(): function get_pairs (line 39) | def get_pairs(word): class Encoder (line 51) | class Encoder: method __init__ (line 52) | def __init__(self, encoder, bpe_merges, errors="replace"): method bpe (line 73) | def bpe(self, token): method encode (line 114) | def encode(self, text): method decode (line 123) | def decode(self, tokens): function get_encoder (line 131) | def get_encoder(encoder_json_path, vocab_bpe_path): FILE: fairseq/data/encoders/hf_bert_bpe.py class BertBPEConfig (line 14) | class BertBPEConfig(FairseqDataclass): class BertBPE (line 22) | class BertBPE(object): method __init__ (line 23) | def __init__(self, cfg): method encode (line 41) | def encode(self, x: str) -> str: method decode (line 44) | def decode(self, x: str) -> str: method is_beginning_of_word (line 49) | def is_beginning_of_word(self, x: str) -> bool: FILE: fairseq/data/encoders/hf_byte_bpe.py class HuggingFaceByteLevelBPEConfig (line 14) | class HuggingFaceByteLevelBPEConfig(FairseqDataclass): class HuggingFaceByteLevelBPE (line 23) | class HuggingFaceByteLevelBPE(object): method __init__ (line 24) | def __init__(self, cfg): method encode (line 41) | def encode(self, x: str) -> str: method decode (line 44) | def decode(self, x: str) -> str: method is_beginning_of_word (line 49) | def is_beginning_of_word(self, x: str) -> bool: FILE: fairseq/data/encoders/moses_tokenizer.py class MosesTokenizerConfig (line 13) | class MosesTokenizerConfig(FairseqDataclass): class MosesTokenizer (line 26) | class MosesTokenizer(object): method __init__ (line 27) | def __init__(self, cfg: MosesTokenizerConfig): method encode (line 40) | def encode(self, x: str) -> str: method decode (line 48) | def decode(self, x: str) -> str: FILE: fairseq/data/encoders/nltk_tokenizer.py class NLTKTokenizer (line 11) | class NLTKTokenizer(object): method __init__ (line 12) | def __init__(self, *unused): method encode (line 20) | def encode(self, x: str) -> str: method decode (line 23) | def decode(self, x: str) -> str: FILE: fairseq/data/encoders/sentencepiece_bpe.py class SentencepieceConfig (line 15) | class SentencepieceConfig(FairseqDataclass): class SentencepieceBPE (line 32) | class SentencepieceBPE(object): method __init__ (line 33) | def __init__(self, cfg): method encode (line 47) | def encode(self, x: str) -> str: method decode (line 54) | def decode(self, x: str) -> str: method is_beginning_of_word (line 57) | def is_beginning_of_word(self, x: str) -> bool: FILE: fairseq/data/encoders/space_tokenizer.py class SpaceTokenizer (line 13) | class SpaceTokenizer(object): method __init__ (line 14) | def __init__(self, *unused): method encode (line 17) | def encode(self, x: str) -> str: method decode (line 20) | def decode(self, x: str) -> str: FILE: fairseq/data/encoders/subword_nmt_bpe.py class SubwordNMTBPEConfig (line 14) | class SubwordNMTBPEConfig(FairseqDataclass): class SubwordNMTBPE (line 20) | class SubwordNMTBPE(object): method __init__ (line 21) | def __init__(self, cfg): method encode (line 50) | def encode(self, x: str) -> str: method decode (line 53) | def decode(self, x: str) -> str: FILE: fairseq/data/encoders/utils.py function get_whole_word_mask (line 10) | def get_whole_word_mask(args, dictionary): FILE: fairseq/data/fairseq_dataset.py class EpochListening (line 14) | class EpochListening: method can_reuse_epoch_itr_across_epochs (line 18) | def can_reuse_epoch_itr_across_epochs(self): method set_epoch (line 30) | def set_epoch(self, epoch): class FairseqDataset (line 35) | class FairseqDataset(torch.utils.data.Dataset, EpochListening): method __getitem__ (line 38) | def __getitem__(self, index): method __len__ (line 41) | def __len__(self): method collater (line 44) | def collater(self, samples): method num_tokens (line 55) | def num_tokens(self, index): method num_tokens_vec (line 60) | def num_tokens_vec(self, indices): method size (line 65) | def size(self, index): method ordered_indices (line 70) | def ordered_indices(self): method supports_prefetch (line 76) | def supports_prefetch(self): method attr (line 80) | def attr(self, attr: str, index: int): method prefetch (line 83) | def prefetch(self, indices): method get_batch_shapes (line 87) | def get_batch_shapes(self): method batch_by_size (line 104) | def batch_by_size( method filter_indices_by_size (line 155) | def filter_indices_by_size(self, indices, max_sizes): method supports_fetch_outside_dataloader (line 193) | def supports_fetch_outside_dataloader(self): class FairseqIterableDataset (line 198) | class FairseqIterableDataset(torch.utils.data.IterableDataset, EpochList... method __iter__ (line 204) | def __iter__(self): FILE: fairseq/data/fasta_dataset.py function fasta_file_path (line 15) | def fasta_file_path(prefix_path): class FastaDataset (line 19) | class FastaDataset(torch.utils.data.Dataset): method __init__ (line 24) | def __init__(self, path: str, cache_indices=False): method _get_file (line 39) | def _get_file(self): method __getitem__ (line 44) | def __getitem__(self, idx): method __len__ (line 55) | def __len__(self): method __setstate__ (line 58) | def __setstate__(self, state): method __getstate__ (line 62) | def __getstate__(self): method __del__ (line 69) | def __del__(self): method exists (line 75) | def exists(path): class EncodedFastaDataset (line 79) | class EncodedFastaDataset(FastaDataset): method __init__ (line 85) | def __init__(self, path, dictionary): method __getitem__ (line 89) | def __getitem__(self, idx): FILE: fairseq/data/huffman/huffman_coder.py class HuffmanCoder (line 20) | class HuffmanCoder: method __init__ (line 21) | def __init__( method _pad (line 28) | def _pad(self, a: bitarray) -> bitarray: method _unpad (line 38) | def _unpad(self, a: bitarray) -> bitarray: method encode (line 49) | def encode(self, iter: tp.List[str]) -> bytes: method decode (line 64) | def decode(self, bits: bytes) -> tp.Iterator["HuffmanNode"]: method get_code (line 72) | def get_code(self, symbol: str) -> tp.Optional[bitarray]: method get_node (line 76) | def get_node(self, symbol: str) -> "HuffmanNode": method from_file (line 80) | def from_file( method to_file (line 91) | def to_file(self, filename, sep="\t"): method __iter__ (line 98) | def __iter__(self): method merge (line 102) | def merge(self, other_coder: "HuffmanCoder") -> "HuffmanCoder": method __eq__ (line 110) | def __eq__(self, other: "HuffmanCoder") -> bool: method __len__ (line 113) | def __len__(self) -> int: method __contains__ (line 116) | def __contains__(self, sym: str) -> bool: method to_dictionary (line 119) | def to_dictionary(self) -> Dictionary: class HuffmanNode (line 128) | class HuffmanNode: method is_leaf (line 140) | def is_leaf(self) -> bool: method code_table (line 143) | def code_table( method decode (line 157) | def decode(self, bits: bitarray) -> tp.Iterator["HuffmanNode"]: class HuffmanCodeBuilder (line 174) | class HuffmanCodeBuilder: method __init__ (line 179) | def __init__(self): method add_symbols (line 182) | def add_symbols(self, *syms) -> None: method increment (line 185) | def increment(self, symbol: str, cnt: int) -> None: method from_file (line 189) | def from_file(cls, filename): method to_file (line 197) | def to_file(self, filename, sep="\t"): method _smallest (line 202) | def _smallest(self, q1: deque, q2: deque) -> HuffmanNode: method __add__ (line 214) | def __add__(self, c: "HuffmanCodeBuilder") -> "HuffmanCodeBuilder": method build_code (line 220) | def build_code( FILE: fairseq/data/huffman/huffman_mmap_indexed_dataset.py class HuffmanMMapIndex (line 20) | class HuffmanMMapIndex: method writer (line 31) | def writer(cls, path: str, data_len: int): method __init__ (line 62) | def __init__(self, path): method __del__ (line 95) | def __del__(self): method __iter__ (line 99) | def __iter__(self): method data_len (line 104) | def data_len(self): method sizes (line 108) | def sizes(self): method __getitem__ (line 112) | def __getitem__(self, i): method __len__ (line 115) | def __len__(self): function vocab_file_path (line 119) | def vocab_file_path(prefix_path): class HuffmanMMapIndexedDataset (line 123) | class HuffmanMMapIndexedDataset(torch.utils.data.Dataset): method __init__ (line 129) | def __init__(self, prefix_path): method __getstate__ (line 142) | def __getstate__(self): method __setstate__ (line 145) | def __setstate__(self, state): method _do_init (line 148) | def _do_init(self, prefix_path): method __del__ (line 168) | def __del__(self): method __len__ (line 174) | def __len__(self): method _decode (line 177) | def _decode(self, i): method __getitem__ (line 188) | def __getitem__(self, i): method __iter__ (line 192) | def __iter__(self): method get_symbols (line 196) | def get_symbols(self, i): method sizes (line 202) | def sizes(self): method supports_prefetch (line 206) | def supports_prefetch(self): method coder (line 210) | def coder(self): method exists (line 214) | def exists(prefix_path): class HuffmanMMapIndexedDatasetBuilder (line 222) | class HuffmanMMapIndexedDatasetBuilder: method __init__ (line 231) | def __init__(self, path_prefix: str, coder: HuffmanCoder) -> None: method open (line 238) | def open(self): method __enter__ (line 242) | def __enter__(self) -> "HuffmanMMapIndexedDatasetBuilder": method add_item (line 246) | def add_item(self, tokens: tp.List[str]) -> None: method append (line 261) | def append(self, other_dataset_path_prefix: str) -> None: method close (line 279) | def close(self): method __exit__ (line 286) | def __exit__(self, exc_type, exc_val, exc_tb) -> None: FILE: fairseq/data/id_dataset.py class IdDataset (line 11) | class IdDataset(FairseqDataset): method __getitem__ (line 12) | def __getitem__(self, index): method __len__ (line 15) | def __len__(self): method collater (line 18) | def collater(self, samples): FILE: fairseq/data/indexed_dataset.py function best_fitting_int_dtype (line 22) | def best_fitting_int_dtype( function get_available_dataset_impl (line 38) | def get_available_dataset_impl(): function infer_dataset_impl (line 42) | def infer_dataset_impl(path): function make_builder (line 62) | def make_builder(out_file, impl, vocab_size=None): function make_dataset (line 77) | def make_dataset(path, impl, fix_lua_indexing=False, dictionary=None): function dataset_exists (line 96) | def dataset_exists(path, impl): function read_longs (line 107) | def read_longs(f, n): function write_longs (line 113) | def write_longs(f, a): function _dtype_header_code (line 131) | def _dtype_header_code(dtype) -> int: function index_file_path (line 138) | def index_file_path(prefix_path): function data_file_path (line 142) | def data_file_path(prefix_path): class IndexedDataset (line 146) | class IndexedDataset(FairseqDataset): method __init__ (line 151) | def __init__(self, path, fix_lua_indexing=False): method read_index (line 158) | def read_index(self, path): method read_data (line 174) | def read_data(self, path): method check_index (line 177) | def check_index(self, i): method __del__ (line 181) | def __del__(self): method __getitem__ (line 186) | def __getitem__(self, i) -> torch.Tensor: method __len__ (line 199) | def __len__(self): method num_tokens (line 202) | def num_tokens(self, index): method size (line 205) | def size(self, index): method exists (line 209) | def exists(path): method supports_prefetch (line 215) | def supports_prefetch(self): class IndexedCachedDataset (line 219) | class IndexedCachedDataset(IndexedDataset): method __init__ (line 220) | def __init__(self, path, fix_lua_indexing=False): method supports_prefetch (line 226) | def supports_prefetch(self): method prefetch (line 229) | def prefetch(self, indices): method __getitem__ (line 254) | def __getitem__(self, i): class IndexedRawTextDataset (line 266) | class IndexedRawTextDataset(FairseqDataset): method __init__ (line 270) | def __init__(self, path, dictionary, append_eos=True, reverse_order=Fa... method read_data (line 279) | def read_data(self, path, dictionary): method check_index (line 293) | def check_index(self, i): method __getitem__ (line 298) | def __getitem__(self, i): method get_original_text (line 302) | def get_original_text(self, i): method __del__ (line 306) | def __del__(self): method __len__ (line 309) | def __len__(self): method num_tokens (line 312) | def num_tokens(self, index): method size (line 315) | def size(self, index): method exists (line 319) | def exists(path): class IndexedDatasetBuilder (line 323) | class IndexedDatasetBuilder: method __init__ (line 334) | def __init__(self, out_file, dtype=np.int32): method add_item (line 342) | def add_item(self, tensor): method merge_file_ (line 350) | def merge_file_(self, another_file): method finalize (line 370) | def finalize(self, index_file): function _warmup_mmap_file (line 385) | def _warmup_mmap_file(path): class MMapIndexedDataset (line 391) | class MMapIndexedDataset(torch.utils.data.Dataset): class Index (line 392) | class Index: method writer (line 396) | def writer(cls, path, dtype): method __init__ (line 437) | def __init__(self, path): method __del__ (line 468) | def __del__(self): method dtype (line 473) | def dtype(self): method sizes (line 477) | def sizes(self): method __getitem__ (line 481) | def __getitem__(self, i): method __len__ (line 484) | def __len__(self): method __init__ (line 487) | def __init__(self, path): method __getstate__ (line 496) | def __getstate__(self): method __setstate__ (line 499) | def __setstate__(self, state): method _do_init (line 502) | def _do_init(self, path): method __del__ (line 512) | def __del__(self): method __len__ (line 517) | def __len__(self): method __getitem__ (line 521) | def __getitem__(self, i): method sizes (line 532) | def sizes(self): method supports_prefetch (line 536) | def supports_prefetch(self): method exists (line 540) | def exists(path): method can_reuse_epoch_itr_across_epochs (line 546) | def can_reuse_epoch_itr_across_epochs(self): function get_indexed_dataset_to_local (line 551) | def get_indexed_dataset_to_local(path) -> str: class MMapIndexedDatasetBuilder (line 565) | class MMapIndexedDatasetBuilder: method __init__ (line 566) | def __init__(self, out_file, dtype=np.int64): method add_item (line 571) | def add_item(self, tensor): method merge_file_ (line 576) | def merge_file_(self, another_file): method finalize (line 588) | def finalize(self, index_file): FILE: fairseq/data/iterators.py class CountingIterator (line 28) | class CountingIterator(object): method __init__ (line 42) | def __init__(self, iterable, start=None, total=None): method __len__ (line 47) | def __len__(self): method __iter__ (line 50) | def __iter__(self): method __next__ (line 53) | def __next__(self): method has_next (line 66) | def has_next(self): method skip (line 70) | def skip(self, n): method take (line 76) | def take(self, n): class EpochBatchIterating (line 85) | class EpochBatchIterating(object): method __len__ (line 86) | def __len__(self) -> int: method next_epoch_idx (line 90) | def next_epoch_idx(self): method next_epoch_itr (line 93) | def next_epoch_itr( method end_of_epoch (line 109) | def end_of_epoch(self) -> bool: method iterations_in_epoch (line 114) | def iterations_in_epoch(self) -> int: method state_dict (line 118) | def state_dict(self): method load_state_dict (line 122) | def load_state_dict(self, state_dict): method first_batch (line 127) | def first_batch(self): class StreamingEpochBatchIterator (line 131) | class StreamingEpochBatchIterator(EpochBatchIterating): method __init__ (line 150) | def __init__( method next_epoch_idx (line 176) | def next_epoch_idx(self): method next_epoch_itr (line 183) | def next_epoch_itr( method end_of_epoch (line 192) | def end_of_epoch(self) -> bool: method iterations_in_epoch (line 196) | def iterations_in_epoch(self) -> int: method state_dict (line 201) | def state_dict(self): method load_state_dict (line 206) | def load_state_dict(self, state_dict): method _get_iterator_for_epoch (line 209) | def _get_iterator_for_epoch(self, epoch, shuffle, offset=0): class FrozenBatchSampler (line 236) | class FrozenBatchSampler: method __init__ (line 237) | def __init__( method make_batches_for_epoch (line 250) | def make_batches_for_epoch(self, epoch, offset=0): method __iter__ (line 257) | def __iter__(self) -> Iterator[List[int]]: method __len__ (line 260) | def __len__(self) -> int: class EpochBatchIterator (line 264) | class EpochBatchIterator(EpochBatchIterating): method __init__ (line 308) | def __init__( method frozen_batches (line 356) | def frozen_batches(self): method first_batch (line 362) | def first_batch(self): method __len__ (line 376) | def __len__(self): method n (line 380) | def n(self): method next_epoch_idx (line 384) | def next_epoch_idx(self): method next_epoch_itr (line 393) | def next_epoch_itr( method end_of_epoch (line 428) | def end_of_epoch(self) -> bool: method iterations_in_epoch (line 433) | def iterations_in_epoch(self): method state_dict (line 441) | def state_dict(self): method load_state_dict (line 456) | def load_state_dict(self, state_dict): method _get_iterator_for_epoch (line 481) | def _get_iterator_for_epoch( method ordered_batches (line 533) | def ordered_batches(self, epoch, fix_batches_to_gpus, shuffle): class GroupedIterator (line 573) | class GroupedIterator(CountingIterator): method __init__ (line 586) | def __init__(self, iterable, chunk_size, skip_remainder_batch=False): function _chunk_iterator (line 612) | def _chunk_iterator(itr, chunk_size, skip_remainder_batch=False): class ShardedIterator (line 623) | class ShardedIterator(CountingIterator): method __init__ (line 637) | def __init__( class BackgroundConsumer (line 661) | class BackgroundConsumer(Thread): method __init__ (line 662) | def __init__(self, queue, source, max_len, cuda_device): method run (line 671) | def run(self): class BufferedIterator (line 691) | class BufferedIterator(object): method __init__ (line 692) | def __init__(self, size, iterable): method _create_consumer (line 702) | def _create_consumer(self): method __iter__ (line 712) | def __iter__(self): method __len__ (line 715) | def __len__(self): method take (line 718) | def take(self, n): method __next__ (line 725) | def __next__(self): class GroupedEpochBatchIterator (line 753) | class GroupedEpochBatchIterator(EpochBatchIterator): method __init__ (line 767) | def __init__( method __len__ (line 801) | def __len__(self): method first_batch (line 805) | def first_batch(self): method _get_iterator_for_epoch (line 819) | def _get_iterator_for_epoch( FILE: fairseq/data/language_pair_dataset.py function collate (line 16) | def collate( class LanguagePairDataset (line 168) | class LanguagePairDataset(FairseqDataset): method __init__ (line 207) | def __init__( method get_batch_shapes (line 301) | def get_batch_shapes(self): method __getitem__ (line 304) | def __getitem__(self, index): method __len__ (line 341) | def __len__(self): method collater (line 344) | def collater(self, samples, pad_to_length=None): method num_tokens (line 403) | def num_tokens(self, index): method num_tokens_vec (line 411) | def num_tokens_vec(self, indices): method size (line 419) | def size(self, index): method ordered_indices (line 427) | def ordered_indices(self): method supports_prefetch (line 447) | def supports_prefetch(self): method prefetch (line 452) | def prefetch(self, indices): method filter_indices_by_size (line 459) | def filter_indices_by_size(self, indices, max_sizes): FILE: fairseq/data/legacy/block_pair_dataset.py class BlockPairDataset (line 13) | class BlockPairDataset(FairseqDataset): method __init__ (line 36) | def __init__( method _pair_sentences (line 100) | def _pair_sentences(self, dataset_index): method _sent_to_dataset_index (line 123) | def _sent_to_dataset_index(self, sent_sizes): method _generate_sentence_pair (line 153) | def _generate_sentence_pair(self, doc, doc_id, max_num_tokens, sizes): method _skip_sampling (line 215) | def _skip_sampling(self, total, skip_ids): method _truncate_sentences (line 223) | def _truncate_sentences(self, sent_a, sent_b, max_num_tokens): method _cut_sentence (line 258) | def _cut_sentence(self, sent, front_cut, end_cut): method _fetch_block (line 280) | def _fetch_block(self, start_ds_idx, offset, end_ds_idx, length): method __getitem__ (line 290) | def __getitem__(self, index): method __len__ (line 296) | def __len__(self): method supports_prefetch (line 300) | def supports_prefetch(self): method prefetch (line 303) | def prefetch(self, indices): FILE: fairseq/data/legacy/masked_lm_dataset.py class MaskedLMDataset (line 17) | class MaskedLMDataset(FairseqDataset): method __init__ (line 53) | def __init__( method __getitem__ (line 100) | def __getitem__(self, index: int): method __len__ (line 114) | def __len__(self): method _mask_block (line 117) | def _mask_block( method _collate (line 172) | def _collate(self, samples: List[Dict], pad_idx: int, eos_idx: int): method collater (line 261) | def collater(self, samples: List[Dict]): method num_tokens (line 272) | def num_tokens(self, index: int): method size (line 279) | def size(self, index: int): method ordered_indices (line 286) | def ordered_indices(self): method supports_prefetch (line 299) | def supports_prefetch(self): method prefetch (line 302) | def prefetch(self, indices): FILE: fairseq/data/legacy/masked_lm_dictionary.py class MaskedLMDictionary (line 9) | class MaskedLMDictionary(Dictionary): method __init__ (line 15) | def __init__( method mask (line 27) | def mask(self): class BertDictionary (line 32) | class BertDictionary(MaskedLMDictionary): method __init__ (line 38) | def __init__( method cls (line 54) | def cls(self): method sep (line 58) | def sep(self): FILE: fairseq/data/list_dataset.py class ListDataset (line 9) | class ListDataset(BaseWrapperDataset): method __init__ (line 10) | def __init__(self, dataset, sizes=None): method __iter__ (line 14) | def __iter__(self): method collater (line 18) | def collater(self, samples): method sizes (line 22) | def sizes(self): method num_tokens (line 25) | def num_tokens(self, index): method size (line 28) | def size(self, index): method set_epoch (line 31) | def set_epoch(self, epoch): FILE: fairseq/data/lm_context_window_dataset.py class LMContextWindowDataset (line 15) | class LMContextWindowDataset(FairseqDataset): method __init__ (line 30) | def __init__( method __getitem__ (line 44) | def __getitem__(self, index): method __len__ (line 47) | def __len__(self): method collater (line 50) | def collater(self, samples) -> Dict: method num_tokens (line 82) | def num_tokens(self, index): method size (line 85) | def size(self, index): method ordered_indices (line 88) | def ordered_indices(self): method supports_prefetch (line 93) | def supports_prefetch(self): method prefetch (line 96) | def prefetch(self, indices): FILE: fairseq/data/lru_cache_dataset.py class LRUCacheDataset (line 11) | class LRUCacheDataset(BaseWrapperDataset): method __init__ (line 12) | def __init__(self, dataset, token=None): method __getitem__ (line 16) | def __getitem__(self, index): method collater (line 20) | def collater(self, samples): FILE: fairseq/data/mask_tokens_dataset.py class MaskTokensDataset (line 15) | class MaskTokensDataset(BaseWrapperDataset): method apply_mask (line 49) | def apply_mask(cls, dataset: torch.utils.data.Dataset, *args, **kwargs): method __init__ (line 57) | def __init__( method can_reuse_epoch_itr_across_epochs (line 106) | def can_reuse_epoch_itr_across_epochs(self): method set_epoch (line 109) | def set_epoch(self, epoch, **unused): method __getitem__ (line 113) | def __getitem__(self, index: int): method __getitem_cached__ (line 117) | def __getitem_cached__(self, seed: int, epoch: int, index: int): FILE: fairseq/data/monolingual_dataset.py function collate (line 12) | def collate(samples, pad_idx, eos_idx, fixed_pad_length=None, pad_to_bsz... class MonolingualDataset (line 60) | class MonolingualDataset(FairseqDataset): method __init__ (line 72) | def __init__( method __getitem__ (line 106) | def __getitem__(self, index): method __len__ (line 126) | def __len__(self): method _make_source_target (line 129) | def _make_source_target(self, source, future_target, past_target): method _maybe_add_bos (line 173) | def _maybe_add_bos(self, source, target): method num_tokens_vec (line 180) | def num_tokens_vec(self, indices): method _filter_vocab (line 185) | def _filter_vocab(self, target): method collater (line 199) | def collater(self, samples): method num_tokens (line 228) | def num_tokens(self, index): method size (line 233) | def size(self, index): method ordered_indices (line 238) | def ordered_indices(self): method supports_prefetch (line 249) | def supports_prefetch(self): method prefetch (line 252) | def prefetch(self, indices): FILE: fairseq/data/multi_corpus_dataset.py class MultiCorpusDataset (line 21) | class MultiCorpusDataset(FairseqDataset): method __init__ (line 45) | def __init__( method ordered_indices (line 82) | def ordered_indices(self): method _map_index (line 145) | def _map_index(self, index: int): method __len__ (line 160) | def __len__(self): method getitem (line 166) | async def getitem(self, index): method __getitem__ (line 179) | def __getitem__(self, index): method getitems (line 182) | async def getitems(self, indices): method __getitems__ (line 200) | def __getitems__(self, indices): method collater (line 203) | def collater(self, samples): method num_tokens (line 223) | def num_tokens(self, index: int): method size (line 227) | def size(self, index: int): method can_reuse_epoch_itr_across_epochs (line 232) | def can_reuse_epoch_itr_across_epochs(self): method set_epoch (line 235) | def set_epoch(self, epoch, **unused): method supports_prefetch (line 241) | def supports_prefetch(self): method supports_fetch_outside_dataloader (line 245) | def supports_fetch_outside_dataloader(self): method batch_by_size (line 251) | def batch_by_size( FILE: fairseq/data/multi_corpus_sampled_dataset.py function uniform_sampler (line 14) | def uniform_sampler(x): class MultiCorpusSampledDataset (line 19) | class MultiCorpusSampledDataset(FairseqDataset): method __init__ (line 31) | def __init__( method __len__ (line 50) | def __len__(self): method ordered_indices (line 56) | def ordered_indices(self): method _map_index_to_dataset (line 71) | def _map_index_to_dataset(self, key: int, index: int): method __getitem__ (line 84) | def __getitem__(self, index: int): method collater (line 97) | def collater(self, samples: List[Dict]): method num_tokens (line 112) | def num_tokens(self, index: int): method size (line 123) | def size(self, index: int): method supports_prefetch (line 135) | def supports_prefetch(self): method prefetch (line 141) | def prefetch(self, indices): method supports_fetch_outside_dataloader (line 148) | def supports_fetch_outside_dataloader(self): FILE: fairseq/data/multilingual/multilingual_data_manager.py function _lang_id (line 47) | def _lang_id(dic: Dictionary, lang: str): function load_sampling_weights (line 54) | def load_sampling_weights(from_file): class MultilingualDatasetManager (line 60) | class MultilingualDatasetManager(object): method __init__ (line 61) | def __init__(self, args, lang_pairs, langs, dicts, sampling_method): method setup_data_manager (line 87) | def setup_data_manager(cls, args, lang_pairs, langs, dicts, sampling_m... method add_args (line 93) | def add_args(parser): method load_langs (line 283) | def load_langs(cls, args, **kwargs): method has_sharded_data (line 314) | def has_sharded_data(self, split): method _shared_collater (line 319) | def _shared_collater(self): method estimate_global_pass_epoch (line 324) | def estimate_global_pass_epoch(self, epoch): method prepare (line 336) | def prepare(cls, load_dictionary, args, **kargs): method load_all_dictionaries (line 397) | def load_all_dictionaries(cls, args, language_list, load_dictionary, t... method get_source_dictionary (line 450) | def get_source_dictionary(self, lang): method get_target_dictionary (line 456) | def get_target_dictionary(self, lang): method create_lang_dictionary (line 463) | def create_lang_dictionary(cls, langs): method get_langtok_index (line 472) | def get_langtok_index(cls, lang_tok, dic): method get_encoder_langtok (line 479) | def get_encoder_langtok(self, src_lang, tgt_lang, spec=None): method get_decoder_langtok (line 501) | def get_decoder_langtok(self, tgt_lang, spec=None): method load_data (line 510) | def load_data(cls, path, vdict, impl): method split_exists (line 515) | def split_exists(cls, split, src, tgt, lang, data_path, dataset_impl): method load_lang_dataset (line 519) | def load_lang_dataset( method load_langpair_dataset (line 606) | def load_langpair_dataset( method src_dataset_tranform_func (line 704) | def src_dataset_tranform_func(self, src_lang, tgt_lang, dataset, spec=... method tgt_dataset_tranform_func (line 716) | def tgt_dataset_tranform_func(self, source_lang, target_lang, dataset,... method alter_dataset_langtok (line 734) | def alter_dataset_langtok( method load_a_dataset (line 771) | def load_a_dataset( method load_split_langpair_datasets (line 853) | def load_split_langpair_datasets(self, split, data_param_list): method get_data_paths_and_lang_pairs (line 867) | def get_data_paths_and_lang_pairs(self, split): method get_dataset_key (line 883) | def get_dataset_key(cls, data_category, src, tgt): method _get_shard_num_dict (line 887) | def _get_shard_num_dict(cls, split, paths): method get_split_num_data_shards (line 901) | def get_split_num_data_shards(self, split): method get_shard_id (line 936) | def get_shard_id(cls, num_shards, epoch, shard_epoch=None): method get_split_data_path (line 941) | def get_split_data_path(self, paths, epoch, shard_epoch, num_shards): method get_split_data_param_list (line 945) | def get_split_data_param_list(self, split, epoch, shard_epoch=None): method get_train_dataset_sizes (line 999) | def get_train_dataset_sizes( method get_train_sampling_ratios (line 1029) | def get_train_sampling_ratios( method get_sampling_ratios (line 1039) | def get_sampling_ratios(self, data_param_list, datasets, epoch, shard_... method load_split_datasets (line 1063) | def load_split_datasets( method load_into_concat_dataset (line 1085) | def load_into_concat_dataset(self, split, datasets, data_param_list): method load_sampled_multi_epoch_dataset (line 1098) | def load_sampled_multi_epoch_dataset( method load_sampled_multi_dataset (line 1123) | def load_sampled_multi_dataset( method load_dataset (line 1146) | def load_dataset( FILE: fairseq/data/multilingual/multilingual_utils.py class EncoderLangtok (line 8) | class EncoderLangtok(Enum): class LangTokSpec (line 18) | class LangTokSpec(Enum): class LangTokStyle (line 23) | class LangTokStyle(Enum): function get_lang_tok (line 29) | def get_lang_tok( function augment_dictionary (line 47) | def augment_dictionary( FILE: fairseq/data/multilingual/sampled_multi_dataset.py function get_time_gap (line 22) | def get_time_gap(s, e): function default_virtual_size_func (line 31) | def default_virtual_size_func(datasets, ratios, max_scale_up=1.5): class CollateFormat (line 45) | class CollateFormat(Enum): class SampledMultiDataset (line 50) | class SampledMultiDataset(FairseqDataset): method __init__ (line 75) | def __init__( method _clean_if_not_none (line 124) | def _clean_if_not_none(self, var_list): method _reset_cached_properties (line 129) | def _reset_cached_properties(self): method setup_sampling (line 134) | def setup_sampling(self, sample_ratios, virtual_size): method adjust_sampling (line 153) | def adjust_sampling(self, epoch, sampling_ratios, virtual_size): method _sync_sample_ratios (line 158) | def _sync_sample_ratios(self, ratios): method random_choice_in_dataset (line 175) | def random_choice_in_dataset(self, rng, dataset, choice_size): method get_virtual_indices (line 183) | def get_virtual_indices(self, rng, datasets, sample_ratios, virtual_si... method _get_dataset_and_index (line 228) | def _get_dataset_and_index(self, index): method __getitem__ (line 232) | def __getitem__(self, index): method num_tokens (line 239) | def num_tokens(self, index): method num_tokens_vec (line 242) | def num_tokens_vec(self, indices): method size (line 247) | def size(self, index): method __len__ (line 250) | def __len__(self): method collater (line 253) | def collater(self, samples, **extra_args): method sizes (line 334) | def sizes(self): method ordered_indices (line 352) | def ordered_indices(self): method prefetch (line 370) | def prefetch(self, indices): method can_reuse_epoch_itr_across_epochs (line 379) | def can_reuse_epoch_itr_across_epochs(self): method set_epoch (line 382) | def set_epoch(self, epoch): method _establish_virtual_datasets (line 393) | def _establish_virtual_datasets(self): method filter_indices_by_size (line 447) | def filter_indices_by_size(self, indices, max_sizes): FILE: fairseq/data/multilingual/sampled_multi_epoch_dataset.py class SampledMultiEpochDataset (line 19) | class SampledMultiEpochDataset(SampledMultiDataset): method __init__ (line 49) | def __init__( method _setup (line 83) | def _setup(self, epoch): method _map_epoch_index_to_global (line 101) | def _map_epoch_index_to_global(self, index): method sizes (line 107) | def sizes(self): method _get_dataset_and_index (line 121) | def _get_dataset_and_index(self, index): method __len__ (line 125) | def __len__(self): method set_epoch (line 133) | def set_epoch(self, epoch): method _get_epoch_start_index (line 145) | def _get_epoch_start_index(self, epoch): method _next_global_indices (line 149) | def _next_global_indices(self, epoch): method _next_virtual_epoch (line 178) | def _next_virtual_epoch(self, epoch): FILE: fairseq/data/multilingual/sampling_method.py function uniform (line 13) | def uniform(dataset_sizes: List[int]): function temperature_sampling (line 17) | def temperature_sampling(dataset_sizes, temp): function make_temperature_sampling (line 22) | def make_temperature_sampling(temp=1.0): function make_ratio_sampling (line 29) | def make_ratio_sampling(ratios): class SamplingMethod (line 36) | class SamplingMethod: method add_arguments (line 38) | def add_arguments(parser): method build_sampler (line 59) | def build_sampler(args, task): method __init__ (line 62) | def __init__(self, args, task): method is_adaptive (line 66) | def is_adaptive(self): method sampling_method_selector (line 69) | def sampling_method_selector(self): FILE: fairseq/data/nested_dictionary_dataset.py function _flatten (line 14) | def _flatten(dico, prefix=None): function _unflatten (line 31) | def _unflatten(dico): class NestedDictionaryDataset (line 47) | class NestedDictionaryDataset(FairseqDataset): method __init__ (line 48) | def __init__(self, defn, sizes=None): method __getitem__ (line 69) | def __getitem__(self, index): method __len__ (line 72) | def __len__(self): method collater (line 75) | def collater(self, samples): method num_tokens (line 94) | def num_tokens(self, index): method size (line 99) | def size(self, index): method supports_prefetch (line 108) | def supports_prefetch(self): method prefetch (line 112) | def prefetch(self, indices): method can_reuse_epoch_itr_across_epochs (line 119) | def can_reuse_epoch_itr_across_epochs(self): method set_epoch (line 122) | def set_epoch(self, epoch): FILE: fairseq/data/noising.py class WordNoising (line 11) | class WordNoising(object): method __init__ (line 14) | def __init__(self, dictionary, bpe_cont_marker="@@", bpe_end_marker=No... method noising (line 36) | def noising(self, x, lengths, noising_prob=0.0): method _get_bpe_word_idx (line 39) | def _get_bpe_word_idx(self, x): method _get_token_idx (line 60) | def _get_token_idx(self, x): class WordDropout (line 70) | class WordDropout(WordNoising): method __init__ (line 75) | def __init__( method noising (line 85) | def noising(self, x, lengths, dropout_prob=None, blank_idx=None): class WordShuffle (line 150) | class WordShuffle(WordNoising): method __init__ (line 153) | def __init__( method noising (line 163) | def noising(self, x, lengths, max_shuffle_distance=None): class UnsupervisedMTNoising (line 199) | class UnsupervisedMTNoising(WordNoising): method __init__ (line 205) | def __init__( method noising (line 230) | def noising(self, x, lengths): class NoisingDataset (line 254) | class NoisingDataset(torch.utils.data.Dataset): method __init__ (line 255) | def __init__( method __getitem__ (line 301) | def __getitem__(self, index): method __len__ (line 322) | def __len__(self): method supports_prefetch (line 329) | def supports_prefetch(self): method prefetch (line 332) | def prefetch(self, indices): FILE: fairseq/data/num_samples_dataset.py class NumSamplesDataset (line 9) | class NumSamplesDataset(FairseqDataset): method __getitem__ (line 10) | def __getitem__(self, index): method __len__ (line 13) | def __len__(self): method collater (line 16) | def collater(self, samples): FILE: fairseq/data/numel_dataset.py class NumelDataset (line 12) | class NumelDataset(BaseWrapperDataset): method __init__ (line 13) | def __init__(self, dataset, reduce=False): method __getitem__ (line 17) | def __getitem__(self, index): method __len__ (line 24) | def __len__(self): method collater (line 27) | def collater(self, samples): FILE: fairseq/data/offset_tokens_dataset.py class OffsetTokensDataset (line 9) | class OffsetTokensDataset(BaseWrapperDataset): method __init__ (line 10) | def __init__(self, dataset, offset): method __getitem__ (line 14) | def __getitem__(self, idx): FILE: fairseq/data/pad_dataset.py class PadDataset (line 11) | class PadDataset(BaseWrapperDataset): method __init__ (line 12) | def __init__(self, dataset, pad_idx, left_pad, pad_length=None): method collater (line 18) | def collater(self, samples): class LeftPadDataset (line 24) | class LeftPadDataset(PadDataset): method __init__ (line 25) | def __init__(self, dataset, pad_idx): class RightPadDataset (line 29) | class RightPadDataset(PadDataset): method __init__ (line 30) | def __init__(self, dataset, pad_idx): FILE: fairseq/data/padding_mask_dataset.py class PaddingMaskDataset (line 12) | class PaddingMaskDataset(BaseWrapperDataset): method __init__ (line 13) | def __init__(self, dataset, left_pad, pad_length=None): method __getitem__ (line 18) | def __getitem__(self, index): method __len__ (line 22) | def __len__(self): method collater (line 25) | def collater(self, samples): class LeftPaddingMaskDataset (line 31) | class LeftPaddingMaskDataset(PaddingMaskDataset): method __init__ (line 32) | def __init__(self, dataset): class RightPaddingMaskDataset (line 36) | class RightPaddingMaskDataset(PaddingMaskDataset): method __init__ (line 37) | def __init__(self, dataset): FILE: fairseq/data/plasma_utils.py class PlasmaArray (line 22) | class PlasmaArray: method __init__ (line 30) | def __init__(self, array): method plasma (line 44) | def plasma(self): method start_server (line 49) | def start_server(self): method client (line 61) | def client(self): method __getstate__ (line 67) | def __getstate__(self): method __setstate__ (line 82) | def __setstate__(self, state): method __del__ (line 89) | def __del__(self): class PlasmaView (line 100) | class PlasmaView: method __init__ (line 104) | def __init__(self, array, split_path: str, hash_data: Hashable, plasma... method client (line 133) | def client(self): method array (line 139) | def array(self): method get_object_id (line 145) | def get_object_id(split_path: str, hash_data: Hashable): method __getstate__ (line 152) | def __getstate__(self): method __setstate__ (line 160) | def __setstate__(self, state): method __del__ (line 164) | def __del__(self): method disconnect (line 167) | def disconnect(self): method __len__ (line 172) | def __len__(self): class PlasmaStore (line 182) | class PlasmaStore: method __init__ (line 183) | def __init__(self, path=DEFAULT_PLASMA_PATH, nbytes: int = GB100): method __del__ (line 187) | def __del__(self): method start (line 191) | def start(path=DEFAULT_PLASMA_PATH, nbytes: int = GB100) -> subprocess... FILE: fairseq/data/prepend_dataset.py class PrependDataset (line 12) | class PrependDataset(BaseWrapperDataset): method __init__ (line 13) | def __init__(self, dataset, prepend_getter, ensure_first_token_is=None): method __getitem__ (line 18) | def __getitem__(self, idx): FILE: fairseq/data/prepend_token_dataset.py class PrependTokenDataset (line 12) | class PrependTokenDataset(BaseWrapperDataset): method __init__ (line 13) | def __init__(self, dataset, token=None): method __getitem__ (line 21) | def __getitem__(self, idx): method sizes (line 28) | def sizes(self): method num_tokens (line 31) | def num_tokens(self, index): method size (line 37) | def size(self, index): FILE: fairseq/data/raw_label_dataset.py class RawLabelDataset (line 11) | class RawLabelDataset(FairseqDataset): method __init__ (line 12) | def __init__(self, labels): method __getitem__ (line 16) | def __getitem__(self, index): method __len__ (line 19) | def __len__(self): method collater (line 22) | def collater(self, samples): FILE: fairseq/data/replace_dataset.py class ReplaceDataset (line 9) | class ReplaceDataset(BaseWrapperDataset): method __init__ (line 19) | def __init__(self, dataset, replace_map, offsets): method __getitem__ (line 25) | def __getitem__(self, index): FILE: fairseq/data/resampling_dataset.py class ResamplingDataset (line 15) | class ResamplingDataset(BaseWrapperDataset): method __init__ (line 41) | def __init__( method __getitem__ (line 78) | def __getitem__(self, index): method __len__ (line 81) | def __len__(self): method sizes (line 85) | def sizes(self): method num_tokens (line 90) | def num_tokens(self, index): method size (line 93) | def size(self, index): method ordered_indices (line 96) | def ordered_indices(self): method prefetch (line 106) | def prefetch(self, indices): method can_reuse_epoch_itr_across_epochs (line 110) | def can_reuse_epoch_itr_across_epochs(self): method set_epoch (line 113) | def set_epoch(self, epoch): FILE: fairseq/data/roll_dataset.py class RollDataset (line 11) | class RollDataset(BaseWrapperDataset): method __init__ (line 12) | def __init__(self, dataset, shifts): method __getitem__ (line 16) | def __getitem__(self, index): FILE: fairseq/data/round_robin_zip_datasets.py class RoundRobinZipDatasets (line 17) | class RoundRobinZipDatasets(FairseqDataset): method __init__ (line 30) | def __init__(self, datasets, eval_key=None): method _map_index (line 46) | def _map_index(self, key, index): method __getitem__ (line 53) | def __getitem__(self, index): method __len__ (line 65) | def __len__(self): method collater (line 70) | def collater(self, samples): method num_tokens (line 85) | def num_tokens(self, index): method size (line 93) | def size(self, index): method ordered_indices (line 101) | def ordered_indices(self): method filter_indices_by_size (line 115) | def filter_indices_by_size(self, indices, max_positions=None): method supports_prefetch (line 152) | def supports_prefetch(self): method prefetch (line 158) | def prefetch(self, indices): FILE: fairseq/data/shorten_dataset.py class TruncateDataset (line 12) | class TruncateDataset(BaseWrapperDataset): method __init__ (line 15) | def __init__(self, dataset, truncation_length): method __getitem__ (line 21) | def __getitem__(self, index): method sizes (line 29) | def sizes(self): method __len__ (line 32) | def __len__(self): class RandomCropDataset (line 36) | class RandomCropDataset(TruncateDataset): method __init__ (line 39) | def __init__(self, dataset, truncation_length, seed=1): method can_reuse_epoch_itr_across_epochs (line 45) | def can_reuse_epoch_itr_across_epochs(self): method set_epoch (line 48) | def set_epoch(self, epoch, **unused): method __getitem__ (line 52) | def __getitem__(self, index): function maybe_shorten_dataset (line 63) | def maybe_shorten_dataset( FILE: fairseq/data/sort_dataset.py class SortDataset (line 11) | class SortDataset(BaseWrapperDataset): method __init__ (line 12) | def __init__(self, dataset, sort_order): method ordered_indices (line 20) | def ordered_indices(self): FILE: fairseq/data/span_mask_tokens_dataset.py function collate (line 12) | def collate( class SpanMaskedTokensDataset (line 94) | class SpanMaskedTokensDataset(FairseqDataset): method __init__ (line 108) | def __init__( method can_reuse_epoch_itr_across_epochs (line 126) | def can_reuse_epoch_itr_across_epochs(self): method set_epoch (line 129) | def set_epoch(self, epoch, **unused): method __getitem__ (line 132) | def __getitem__(self, index): method random_spans_noise_mask (line 153) | def random_spans_noise_mask(self, length): method create_sentinel_ids (line 216) | def create_sentinel_ids(self, mask_indices): method filter_input_ids (line 233) | def filter_input_ids(input_ids, sentinel_ids): method __len__ (line 244) | def __len__(self): method collater (line 247) | def collater(self, samples, pad_to_length=None): method num_tokens (line 263) | def num_tokens(self, index): method size (line 268) | def size(self, index): method ordered_indices (line 273) | def ordered_indices(self): method prefetch (line 282) | def prefetch(self, indices): method supports_prefetch (line 287) | def supports_prefetch(self): FILE: fairseq/data/speech_dlm_dataset.py class SpeechDLMDataset (line 14) | class SpeechDLMDataset(FairseqDataset): method __init__ (line 50) | def __init__( method __getitem__ (line 99) | def __getitem__(self, index): method __len__ (line 126) | def __len__(self): method _get_target (line 129) | def _get_target(self, index, channel): method collater (line 181) | def collater(self, samples): method num_tokens (line 278) | def num_tokens(self, index): method size (line 283) | def size(self, index): method ordered_indices (line 288) | def ordered_indices(self): method supports_prefetch (line 299) | def supports_prefetch(self): method prefetch (line 305) | def prefetch(self, indices): FILE: fairseq/data/strip_token_dataset.py class StripTokenDataset (line 9) | class StripTokenDataset(BaseWrapperDataset): method __init__ (line 10) | def __init__(self, dataset, id_to_strip): method __getitem__ (line 14) | def __getitem__(self, index): FILE: fairseq/data/subsample_dataset.py class SubsampleDataset (line 18) | class SubsampleDataset(BaseWrapperDataset): method __init__ (line 26) | def __init__(self, dataset, size_ratio, shuffle=False, seed=None): method __getitem__ (line 41) | def __getitem__(self, index): method __len__ (line 44) | def __len__(self): method collater (line 47) | def collater(self, samples): method sizes (line 51) | def sizes(self): method name (line 55) | def name(self): method num_tokens (line 58) | def num_tokens(self, index): method size (line 61) | def size(self, index): method ordered_indices (line 64) | def ordered_indices(self): method prefetch (line 74) | def prefetch(self, indices): FILE: fairseq/data/text_compressor.py class TextCompressionLevel (line 9) | class TextCompressionLevel(Enum): class TextCompressor (line 15) | class TextCompressor(object): method __init__ (line 16) | def __init__( method compress (line 22) | def compress(self, text: str) -> bytes: method decompress (line 43) | def decompress(self, compressed: bytes) -> str: FILE: fairseq/data/token_block_dataset.py class TokenBlockDataset (line 13) | class TokenBlockDataset(FairseqDataset): method __init__ (line 36) | def __init__( method _build_slice_indices (line 85) | def _build_slice_indices( method slice_indices (line 145) | def slice_indices(self): method sizes (line 149) | def sizes(self): method block_to_dataset_index (line 153) | def block_to_dataset_index(self): method attr (line 156) | def attr(self, attr: str, index: int): method __getitem__ (line 160) | def __getitem__(self, index): method __len__ (line 191) | def __len__(self): method supports_prefetch (line 195) | def supports_prefetch(self): method prefetch (line 198) | def prefetch(self, indices): FILE: fairseq/data/transform_eos_concat_langpair_dataset.py class TransformEosConcatLangPairDataset (line 16) | class TransformEosConcatLangPairDataset(ConcatDataset): method __init__ (line 22) | def __init__( method src_dict_pad (line 51) | def src_dict_pad(self): method __getitem__ (line 58) | def __getitem__(self, idx): method is_left_pad_source (line 62) | def is_left_pad_source(self, datasets): method is_left_pad_target (line 77) | def is_left_pad_target(self, datasets): method collater (line 92) | def collater(self, samples, **extra_args): FILE: fairseq/data/transform_eos_dataset.py class TransformEosDataset (line 11) | class TransformEosDataset(FairseqDataset): method __init__ (line 25) | def __init__( method _check_src (line 61) | def _check_src(self, src, expect_eos): method _check_tgt (line 66) | def _check_tgt(self, tgt, expect_eos): method __getitem__ (line 71) | def __getitem__(self, index): method __len__ (line 74) | def __len__(self): method collater (line 77) | def collater(self, samples): method num_tokens (line 100) | def num_tokens(self, index): method size (line 103) | def size(self, index): method ordered_indices (line 110) | def ordered_indices(self): method supports_prefetch (line 116) | def supports_prefetch(self): method prefetch (line 119) | def prefetch(self, indices): FILE: fairseq/data/transform_eos_lang_pair_dataset.py class TransformEosLangPairDataset (line 14) | class TransformEosLangPairDataset(FairseqDataset): method __init__ (line 30) | def __init__( method __getitem__ (line 44) | def __getitem__(self, index): method __len__ (line 47) | def __len__(self): method collater (line 50) | def collater(self, samples, **extra_args): method num_tokens (line 94) | def num_tokens(self, index): method size (line 97) | def size(self, index): method sizes (line 101) | def sizes(self): method ordered_indices (line 105) | def ordered_indices(self): method supports_prefetch (line 109) | def supports_prefetch(self): method prefetch (line 112) | def prefetch(self, indices): FILE: fairseq/dataclass/configs.py class FairseqDataclass (line 28) | class FairseqDataclass: method name (line 34) | def name(): method _get_all_attributes (line 37) | def _get_all_attributes(self) -> List[str]: method _get_meta (line 40) | def _get_meta( method _get_name (line 45) | def _get_name(self, attribute_name: str) -> str: method _get_default (line 48) | def _get_default(self, attribute_name: str) -> Any: method _get_type (line 67) | def _get_type(self, attribute_name: str) -> Any: method _get_help (line 70) | def _get_help(self, attribute_name: str) -> Any: method _get_argparse_const (line 73) | def _get_argparse_const(self, attribute_name: str) -> Any: method _get_argparse_alias (line 76) | def _get_argparse_alias(self, attribute_name: str) -> Any: method _get_choices (line 79) | def _get_choices(self, attribute_name: str) -> Any: method from_namespace (line 83) | def from_namespace(cls, args): class CommonConfig (line 99) | class CommonConfig(FairseqDataclass): class DistributedTrainingConfig (line 256) | class DistributedTrainingConfig(FairseqDataclass): class DatasetConfig (line 464) | class DatasetConfig(FairseqDataclass): class OptimizationConfig (line 588) | class OptimizationConfig(FairseqDataclass): class CheckpointConfig (line 643) | class CheckpointConfig(FairseqDataclass): class FairseqBMUFConfig (line 783) | class FairseqBMUFConfig(FairseqDataclass): class GenerationConfig (line 810) | class GenerationConfig(FairseqDataclass): class CommonEvalConfig (line 1030) | class CommonEvalConfig(FairseqDataclass): class EvalLMConfig (line 1059) | class EvalLMConfig(FairseqDataclass): class InteractiveConfig (line 1087) | class InteractiveConfig(FairseqDataclass): class EMAConfig (line 1101) | class EMAConfig(FairseqDataclass): class FairseqConfig (line 1128) | class FairseqConfig(FairseqDataclass): FILE: fairseq/dataclass/constants.py class StrEnumMeta (line 10) | class StrEnumMeta(EnumMeta): method __instancecheck__ (line 14) | def __instancecheck__(cls, other): class StrEnum (line 18) | class StrEnum(Enum, metaclass=StrEnumMeta): method __str__ (line 19) | def __str__(self): method __eq__ (line 22) | def __eq__(self, other: str): method __repr__ (line 25) | def __repr__(self): method __hash__ (line 28) | def __hash__(self): function ChoiceEnum (line 32) | def ChoiceEnum(choices: List[str]): FILE: fairseq/dataclass/initialize.py function hydra_init (line 16) | def hydra_init(cfg_name="config") -> None: function add_defaults (line 30) | def add_defaults(cfg: DictConfig) -> None: FILE: fairseq/dataclass/utils.py function eval_str_list (line 25) | def eval_str_list(x, x_type=float): function interpret_dc_type (line 38) | def interpret_dc_type(field_type): function gen_parser_from_dataclass (line 53) | def gen_parser_from_dataclass( function _set_legacy_defaults (line 196) | def _set_legacy_defaults(args, cls): function _override_attr (line 219) | def _override_attr( function migrate_registry (line 292) | def migrate_registry( function override_module_args (line 305) | def override_module_args(args: Namespace) -> Tuple[List[str], List[str]]: class omegaconf_no_object_check (line 365) | class omegaconf_no_object_check: method __init__ (line 366) | def __init__(self): method __enter__ (line 373) | def __enter__(self): method __exit__ (line 379) | def __exit__(self, type, value, traceback): function convert_namespace_to_omegaconf (line 386) | def convert_namespace_to_omegaconf(args: Namespace) -> DictConfig: function overwrite_args_by_name (line 453) | def overwrite_args_by_name(cfg: DictConfig, overrides: Dict[str, any]): function merge_with_parent (line 487) | def merge_with_parent(dc: FairseqDataclass, cfg: DictConfig, remove_miss... FILE: fairseq/distributed/distributed_timeout_wrapper.py class DistributedTimeoutWrapper (line 17) | class DistributedTimeoutWrapper(nn.Module): method __init__ (line 37) | def __init__(self, module: nn.Module, timeout: int, signal=signal.SIGI... method __del__ (line 56) | def __del__(self): method __getattr__ (line 59) | def __getattr__(self, name): method stop_timeout (line 66) | def stop_timeout(self): method state_dict (line 71) | def state_dict(self, *args, **kwargs): method load_state_dict (line 74) | def load_state_dict(self, *args, **kwargs): method forward (line 77) | def forward(self, *args, **kwargs): method _check_heartbeat (line 82) | def _check_heartbeat(self, parent_pid): FILE: fairseq/distributed/fully_sharded_data_parallel.py class FullyShardedDataParallel (line 23) | class FullyShardedDataParallel(FSDP): method __init__ (line 37) | def __init__(self, *args, use_sharded_state: bool = False, **kwargs): method unwrapped_module (line 47) | def unwrapped_module(self) -> torch.nn.Module: method state_dict (line 53) | def state_dict(self, destination=None, prefix="", keep_vars=False): method load_state_dict (line 69) | def load_state_dict(self, state_dict, strict=True, model_cfg=None): class DummyProcessGroup (line 79) | class DummyProcessGroup: method __init__ (line 80) | def __init__(self, rank: int, size: int): method rank (line 84) | def rank(self) -> int: method size (line 87) | def size(self) -> int: function fsdp_enable_wrap (line 92) | def fsdp_enable_wrap(cfg: DistributedTrainingConfig): function fsdp_wrap (line 124) | def fsdp_wrap(module, min_num_params: Optional[int] = None, **kwargs): FILE: fairseq/distributed/legacy_distributed_data_parallel.py class LegacyDistributedDataParallel (line 26) | class LegacyDistributedDataParallel(nn.Module): method __init__ (line 41) | def __init__(self, module, process_group, buffer_size=2**28): method no_sync (line 66) | def no_sync(self): method forward (line 73) | def forward(self, *inputs, **kwargs): method all_reduce_grads (line 76) | def all_reduce_grads(self): FILE: fairseq/distributed/module_proxy_wrapper.py class ModuleProxyWrapper (line 9) | class ModuleProxyWrapper(nn.Module): method __init__ (line 27) | def __init__(self, module: nn.Module): method __getattr__ (line 34) | def __getattr__(self, name): method state_dict (line 47) | def state_dict(self, *args, **kwargs): method load_state_dict (line 51) | def load_state_dict(self, *args, **kwargs): method forward (line 55) | def forward(self, *args, **kwargs): FILE: fairseq/distributed/tpu_distributed_data_parallel.py class TPUDistributedDataParallel (line 12) | class TPUDistributedDataParallel(nn.Module): method __init__ (line 13) | def __init__(self, module, process_group): method forward (line 19) | def forward(self, *inputs, **kwargs): method all_reduce_grads (line 22) | def all_reduce_grads(self): FILE: fairseq/distributed/utils.py function is_master (line 42) | def is_master(cfg: DistributedTrainingConfig): function infer_init_method (line 46) | def infer_init_method(cfg: DistributedTrainingConfig, force_distributed=... function _infer_torch_distributed_launch_init (line 87) | def _infer_torch_distributed_launch_init(cfg: DistributedTrainingConfig): function _infer_slurm_init (line 96) | def _infer_slurm_init(cfg: DistributedTrainingConfig, num_pipelines_per_... function _infer_single_node_init (line 158) | def _infer_single_node_init(cfg: DistributedTrainingConfig): function _pipeline_parallel_pre_init (line 182) | def _pipeline_parallel_pre_init(cfg: DistributedTrainingConfig): function _pipeline_parallel_post_init (line 230) | def _pipeline_parallel_post_init( function distributed_init (line 273) | def distributed_init(cfg: FairseqConfig): function distributed_main (line 349) | def distributed_main(i, main, cfg: FairseqConfig, kwargs): function call_main (line 368) | def call_main(cfg: FairseqConfig, main, **kwargs): function use_xla (line 407) | def use_xla(): function new_groups (line 412) | def new_groups(grouped_ranks: List[List[int]]): function _find_my_group_index (line 421) | def _find_my_group_index(grouped_ranks): function _find_my_group (line 429) | def _find_my_group(grouped_ranks): function get_rank (line 434) | def get_rank(group): function get_world_size (line 443) | def get_world_size(group): function get_global_group (line 454) | def get_global_group(): function get_global_rank (line 467) | def get_global_rank(): function get_global_world_size (line 476) | def get_global_world_size(): function get_data_parallel_group (line 485) | def get_data_parallel_group(): function get_data_parallel_rank (line 496) | def get_data_parallel_rank(): function get_data_parallel_world_size (line 501) | def get_data_parallel_world_size(): function get_model_parallel_group (line 506) | def get_model_parallel_group(): function get_model_parallel_rank (line 516) | def get_model_parallel_rank(): function get_model_parallel_world_size (line 521) | def get_model_parallel_world_size(): function all_reduce (line 526) | def all_reduce(tensor, group, op="sum"): function broadcast (line 542) | def broadcast(tensor, src, group): function all_to_all (line 552) | def all_to_all(tensor, group): function all_gather (line 572) | def all_gather(tensor, group, return_tensor=False): function all_gather_list (line 595) | def all_gather_list(data, group=None, max_size=16384): function all_reduce_dict (line 668) | def all_reduce_dict(data: Mapping[str, Any], device, group) -> Dict[str,... function broadcast_tensors (line 717) | def broadcast_tensors( function broadcast_object (line 758) | def broadcast_object( function _broadcast_object_slow (line 784) | def _broadcast_object_slow( class _TensorPlaceholder (line 810) | class _TensorPlaceholder: function _split_tensors_from_obj (line 814) | def _split_tensors_from_obj(obj: Any, tensors: List[torch.Tensor]) -> Any: function _put_tensors_in_obj (line 831) | def _put_tensors_in_obj(obj: Any, tensors: List[torch.Tensor]) -> Any: FILE: fairseq/file_chunker_utils.py function _safe_readline (line 10) | def _safe_readline(fd) -> str: function find_offsets (line 20) | def find_offsets(filename: str, num_chunks: int) -> tp.List[int]: class ChunkLineIterator (line 37) | class ChunkLineIterator: method __init__ (line 42) | def __init__(self, fd, start_offset: int, end_offset: int): method __iter__ (line 47) | def __iter__(self) -> tp.Iterable[str]: class Chunker (line 69) | class Chunker: method __init__ (line 74) | def __init__(self, path: str, start_offset: int, end_offset: int): method __enter__ (line 79) | def __enter__(self) -> ChunkLineIterator: method __exit__ (line 83) | def __exit__(self, exc_type, exc_val, exc_tb) -> None: FILE: fairseq/file_io.py class PathManager (line 36) | class PathManager: method open (line 44) | def open( method copy (line 71) | def copy(src_path: str, dst_path: str, overwrite: bool = False) -> bool: method get_local_path (line 79) | def get_local_path(path: str, **kwargs) -> str: method exists (line 85) | def exists(path: str) -> bool: method isfile (line 91) | def isfile(path: str) -> bool: method ls (line 97) | def ls(path: str) -> List[str]: method mkdirs (line 103) | def mkdirs(path: str) -> None: method rm (line 109) | def rm(path: str) -> None: method chmod (line 115) | def chmod(path: str, mode: int) -> None: method register_handler (line 120) | def register_handler(handler) -> None: method copy_from_local (line 125) | def copy_from_local( method path_requires_pathmanager (line 135) | def path_requires_pathmanager(path: str) -> bool: method supports_rename (line 144) | def supports_rename(path: str) -> bool: method rename (line 149) | def rename(src: str, dst: str): method opena (line 157) | def opena( method async_close (line 187) | def async_close() -> bool: FILE: fairseq/file_utils.py function load_archive_file (line 54) | def load_archive_file(archive_file): function url_to_filename (line 98) | def url_to_filename(url, etag=None): function filename_to_url (line 116) | def filename_to_url(filename, cache_dir=None): function cached_path_from_pm (line 142) | def cached_path_from_pm(url_or_filename): function cached_path (line 156) | def cached_path(url_or_filename, cache_dir=None): function split_s3_path (line 191) | def split_s3_path(url): function s3_request (line 204) | def s3_request(func): function s3_etag (line 226) | def s3_etag(url): function s3_get (line 237) | def s3_get(url, temp_file): function request_wrap_timeout (line 246) | def request_wrap_timeout(func, url): function http_get (line 264) | def http_get(url, temp_file): function get_from_cache (line 279) | def get_from_cache(url, cache_dir=None): function read_set_from_file (line 355) | def read_set_from_file(filename): function get_file_extension (line 367) | def get_file_extension(path, dot=True, lower=True): FILE: fairseq/hub_utils.py function from_pretrained (line 23) | def from_pretrained( class GeneratorHubInterface (line 97) | class GeneratorHubInterface(nn.Module): method __init__ (line 103) | def __init__(self, cfg, task, models): method device (line 130) | def device(self): method translate (line 133) | def translate( method sample (line 138) | def sample( method score (line 147) | def score( method generate (line 170) | def generate( method encode (line 246) | def encode(self, sentence: str) -> torch.LongTensor: method decode (line 251) | def decode(self, tokens: torch.LongTensor) -> str: method tokenize (line 256) | def tokenize(self, sentence: str) -> str: method detokenize (line 261) | def detokenize(self, sentence: str) -> str: method apply_bpe (line 266) | def apply_bpe(self, sentence: str) -> str: method remove_bpe (line 271) | def remove_bpe(self, sentence: str) -> str: method binarize (line 276) | def binarize(self, sentence: str) -> torch.LongTensor: method string (line 279) | def string(self, tokens: torch.LongTensor) -> str: method _build_batches (line 282) | def _build_batches( class BPEHubInterface (line 297) | class BPEHubInterface(object): method __init__ (line 300) | def __init__(self, bpe, **kwargs): method encode (line 306) | def encode(self, sentence: str) -> str: method decode (line 309) | def decode(self, sentence: str) -> str: class TokenizerHubInterface (line 313) | class TokenizerHubInterface(object): method __init__ (line 316) | def __init__(self, tokenizer, **kwargs): method encode (line 322) | def encode(self, sentence: str) -> str: method decode (line 325) | def decode(self, sentence: str) -> str: FILE: fairseq/incremental_decoding_utils.py class FairseqIncrementalState (line 12) | class FairseqIncrementalState(object): method __init__ (line 13) | def __init__(self, *args, **kwargs): method init_incremental_state (line 17) | def init_incremental_state(self): method _get_full_incremental_state_key (line 20) | def _get_full_incremental_state_key(self, key: str) -> str: method get_incremental_state (line 23) | def get_incremental_state( method set_incremental_state (line 34) | def set_incremental_state( function with_incremental_state (line 47) | def with_incremental_state(cls): FILE: fairseq/iterative_refinement_generator.py class IterativeRefinementGenerator (line 19) | class IterativeRefinementGenerator(object): method __init__ (line 20) | def __init__( method generate_batched_itr (line 62) | def generate_batched_itr( method generate (line 102) | def generate(self, models, sample, prefix_tokens=None, constraints=None): method rerank (line 313) | def rerank(self, reranker, finalized, encoder_input, beam_size): FILE: fairseq/logging/meters.py function type_as (line 14) | def type_as(a, b): function type_as (line 23) | def type_as(a, b): class Meter (line 33) | class Meter(object): method __init__ (line 36) | def __init__(self): method state_dict (line 39) | def state_dict(self): method load_state_dict (line 42) | def load_state_dict(self, state_dict): method reset (line 45) | def reset(self): method smoothed_value (line 49) | def smoothed_value(self) -> float: function safe_round (line 54) | def safe_round(number, ndigits): class AverageMeter (line 65) | class AverageMeter(Meter): method __init__ (line 68) | def __init__(self, round: Optional[int] = None): method reset (line 72) | def reset(self): method update (line 77) | def update(self, val, n=1): method state_dict (line 84) | def state_dict(self): method load_state_dict (line 92) | def load_state_dict(self, state_dict): method avg (line 99) | def avg(self): method smoothed_value (line 103) | def smoothed_value(self) -> float: class SumMeter (line 110) | class SumMeter(Meter): method __init__ (line 113) | def __init__(self, round: Optional[int] = None): method reset (line 117) | def reset(self): method update (line 120) | def update(self, val): method state_dict (line 124) | def state_dict(self): method load_state_dict (line 130) | def load_state_dict(self, state_dict): method smoothed_value (line 135) | def smoothed_value(self) -> float: class ConcatTensorMeter (line 142) | class ConcatTensorMeter(Meter): method __init__ (line 145) | def __init__(self, dim=0): method reset (line 150) | def reset(self): method update (line 153) | def update(self, val): method state_dict (line 159) | def state_dict(self): method load_state_dict (line 164) | def load_state_dict(self, state_dict): method smoothed_value (line 168) | def smoothed_value(self) -> float: class TimeMeter (line 172) | class TimeMeter(Meter): method __init__ (line 175) | def __init__( method reset (line 184) | def reset(self, init=0, n=0): method update (line 190) | def update(self, val=1): method state_dict (line 194) | def state_dict(self): method load_state_dict (line 201) | def load_state_dict(self, state_dict): method avg (line 210) | def avg(self): method elapsed_time (line 214) | def elapsed_time(self): method smoothed_value (line 218) | def smoothed_value(self) -> float: class StopwatchMeter (line 225) | class StopwatchMeter(Meter): method __init__ (line 228) | def __init__(self, round: Optional[int] = None): method start (line 234) | def start(self): method stop (line 237) | def stop(self, n=1, prehook=None): method reset (line 245) | def reset(self): method state_dict (line 250) | def state_dict(self): method load_state_dict (line 257) | def load_state_dict(self, state_dict): method avg (line 264) | def avg(self): method elapsed_time (line 268) | def elapsed_time(self): method smoothed_value (line 274) | def smoothed_value(self) -> float: class MetersDict (line 281) | class MetersDict(OrderedDict): method __init__ (line 288) | def __init__(self, *args, **kwargs): method __setitem__ (line 292) | def __setitem__(self, key, value): method add_meter (line 300) | def add_meter(self, key, meter, priority): method state_dict (line 303) | def state_dict(self): method load_state_dict (line 311) | def load_state_dict(self, state_dict): method get_smoothed_value (line 319) | def get_smoothed_value(self, key: str) -> float: method get_smoothed_values (line 327) | def get_smoothed_values(self) -> Dict[str, float]: method reset (line 337) | def reset(self): class _DerivedMeter (line 344) | class _DerivedMeter(Meter): method __init__ (line 347) | def __init__(self, fn): method reset (line 350) | def reset(self): FILE: fairseq/logging/metrics.py function reset (line 29) | def reset() -> None: function aggregate (line 45) | def aggregate(name: Optional[str] = None, new_root: bool = False): function get_active_aggregators (line 107) | def get_active_aggregators() -> List[MetersDict]: function log_scalar (line 111) | def log_scalar( function log_scalar_sum (line 134) | def log_scalar_sum( function log_concat_tensor (line 154) | def log_concat_tensor( function log_derived (line 174) | def log_derived(key: str, fn: Callable[[MetersDict], float], priority: i... function log_speed (line 188) | def log_speed( function log_start_time (line 210) | def log_start_time(key: str, priority: int = 40, round: Optional[int] = ... function log_stop_time (line 226) | def log_stop_time(key: str, weight: float = 0.0, prehook=None): function log_custom (line 244) | def log_custom( function reset_meter (line 268) | def reset_meter(name: str, key: str) -> None: function reset_meters (line 275) | def reset_meters(name: str) -> None: function get_meter (line 282) | def get_meter(name: str, key: str) -> Meter: function get_meters (line 293) | def get_meters(name: str) -> MetersDict: function get_smoothed_value (line 302) | def get_smoothed_value(name: str, key: str) -> float: function get_smoothed_values (line 311) | def get_smoothed_values(name: str) -> Dict[str, float]: function state_dict (line 320) | def state_dict(): function load_state_dict (line 324) | def load_state_dict(state_dict): function xla_metrics_report (line 330) | def xla_metrics_report(): FILE: fairseq/logging/progress_bar.py function progress_bar (line 27) | def progress_bar( function build_progress_bar (line 91) | def build_progress_bar( function format_stat (line 117) | def format_stat(stat): class BaseProgressBar (line 131) | class BaseProgressBar(object): method __init__ (line 134) | def __init__(self, iterable, epoch=None, prefix=None): method __len__ (line 144) | def __len__(self): method __enter__ (line 147) | def __enter__(self): method __exit__ (line 150) | def __exit__(self, *exc): method __iter__ (line 153) | def __iter__(self): method log (line 156) | def log(self, stats, tag=None, step=None): method print (line 160) | def print(self, stats, tag=None, step=None): method update_config (line 164) | def update_config(self, config): method _str_commas (line 168) | def _str_commas(self, stats): method _str_pipes (line 171) | def _str_pipes(self, stats): method _format_stats (line 174) | def _format_stats(self, stats): function rename_logger (line 183) | def rename_logger(logger, new_name): class JsonProgressBar (line 191) | class JsonProgressBar(BaseProgressBar): method __init__ (line 194) | def __init__(self, iterable, epoch=None, prefix=None, log_interval=1000): method __iter__ (line 200) | def __iter__(self): method log (line 206) | def log(self, stats, tag=None, step=None): method print (line 219) | def print(self, stats, tag=None, step=None): method _format_stats (line 230) | def _format_stats(self, stats, epoch=None, update=None): class NoopProgressBar (line 242) | class NoopProgressBar(BaseProgressBar): method __init__ (line 245) | def __init__(self, iterable, epoch=None, prefix=None): method __iter__ (line 248) | def __iter__(self): method log (line 252) | def log(self, stats, tag=None, step=None): method print (line 256) | def print(self, stats, tag=None, step=None): class SimpleProgressBar (line 261) | class SimpleProgressBar(BaseProgressBar): method __init__ (line 264) | def __init__(self, iterable, epoch=None, prefix=None, log_interval=1000): method __iter__ (line 270) | def __iter__(self): method log (line 276) | def log(self, stats, tag=None, step=None): method print (line 289) | def print(self, stats, tag=None, step=None): class TqdmProgressBar (line 296) | class TqdmProgressBar(BaseProgressBar): method __init__ (line 299) | def __init__(self, iterable, epoch=None, prefix=None): method __iter__ (line 310) | def __iter__(self): method log (line 313) | def log(self, stats, tag=None, step=None): method print (line 317) | def print(self, stats, tag=None, step=None): function get_aim_run (line 330) | def get_aim_run(repo, run_hash): class AimProgressBarWrapper (line 340) | class AimProgressBarWrapper(BaseProgressBar): method __init__ (line 343) | def __init__(self, wrapped_bar, aim_repo, aim_run_hash, aim_param_chec... method __iter__ (line 367) | def __iter__(self): method log (line 370) | def log(self, stats, tag=None, step=None): method print (line 375) | def print(self, stats, tag=None, step=None): method update_config (line 380) | def update_config(self, config): method _log_to_aim (line 387) | def _log_to_aim(self, stats, tag=None, step=None): function _close_writers (line 415) | def _close_writers(): class TensorboardProgressBarWrapper (line 423) | class TensorboardProgressBarWrapper(BaseProgressBar): method __init__ (line 426) | def __init__(self, wrapped_bar, tensorboard_logdir): method _writer (line 435) | def _writer(self, key): method __iter__ (line 444) | def __iter__(self): method log (line 447) | def log(self, stats, tag=None, step=None): method print (line 452) | def print(self, stats, tag=None, step=None): method update_config (line 457) | def update_config(self, config): method _log_to_tensorboard (line 462) | def _log_to_tensorboard(self, stats, tag=None, step=None): class WandBProgressBarWrapper (line 484) | class WandBProgressBarWrapper(BaseProgressBar): method __init__ (line 487) | def __init__(self, wrapped_bar, wandb_project, run_name=None): method __iter__ (line 497) | def __iter__(self): method log (line 500) | def log(self, stats, tag=None, step=None): method print (line 505) | def print(self, stats, tag=None, step=None): method update_config (line 510) | def update_config(self, config): method _log_to_wandb (line 516) | def _log_to_wandb(self, stats, tag=None, step=None): class AzureMLProgressBarWrapper (line 537) | class AzureMLProgressBarWrapper(BaseProgressBar): method __init__ (line 540) | def __init__(self, wrapped_bar): method __exit__ (line 547) | def __exit__(self, *exc): method __iter__ (line 552) | def __iter__(self): method log (line 555) | def log(self, stats, tag=None, step=None): method print (line 560) | def print(self, stats, tag=None, step=None): method update_config (line 565) | def update_config(self, config): method _log_to_azureml (line 569) | def _log_to_azureml(self, stats, tag=None, step=None): FILE: fairseq/model_parallel/criterions/vocab_parallel_cross_entropy.py class VocabParallelCrossEntropyCriterion (line 24) | class VocabParallelCrossEntropyCriterion(FairseqCriterion): method __init__ (line 25) | def __init__(self, task, sentence_avg): method forward (line 35) | def forward(self, model, sample, reduce=True): method reduce_metrics (line 60) | def reduce_metrics(logging_outputs) -> None: method logging_outputs_can_be_summed (line 82) | def logging_outputs_can_be_summed() -> bool: FILE: fairseq/model_parallel/megatron_trainer.py class MegatronTrainer (line 27) | class MegatronTrainer(Trainer): method __init__ (line 30) | def __init__(self, cfg: FairseqConfig, task, model, criterion, **kwargs): method clip_grad_norm (line 39) | def clip_grad_norm(self, clip_norm): method save_checkpoint (line 53) | def save_checkpoint(self, filename, extra_state): method load_checkpoint (line 58) | def load_checkpoint( FILE: fairseq/model_parallel/models/pipeline_parallel_transformer/layers.py class TransformerEncoderEmbedding (line 32) | class TransformerEncoderEmbedding(nn.Module): method __init__ (line 35) | def __init__(self, args, embed_tokens): method forward (line 62) | def forward(self, input): class TransformerEncoderLayerNorm (line 88) | class TransformerEncoderLayerNorm(nn.Module): method __init__ (line 94) | def __init__(self, args, embed_dim): method forward (line 101) | def forward(self, input): class TransformerDecoderEmbedding (line 111) | class TransformerDecoderEmbedding(nn.Module): method __init__ (line 114) | def __init__(self, args, embed_tokens): method forward (line 153) | def forward(self, input): class TransformerDecoderOutputLayer (line 215) | class TransformerDecoderOutputLayer(nn.Module): method __init__ (line 216) | def __init__(self, args, embed_tokens, dictionary): method forward (line 255) | def forward(self, input, apply_final_proj=True): method output_layer (line 273) | def output_layer(self, features, **kwargs): class TransformerEncoderLayer (line 297) | class TransformerEncoderLayer(nn.Module): method __init__ (line 311) | def __init__(self, args): method upgrade_state_dict_named (line 334) | def upgrade_state_dict_named(self, state_dict, name): method forward (line 348) | def forward(self, input): method maybe_layer_norm (line 386) | def maybe_layer_norm(self, layer_norm, x, before=False, after=False): class TransformerDecoderLayer (line 394) | class TransformerDecoderLayer(nn.Module): method __init__ (line 411) | def __init__( method prepare_for_onnx_export_ (line 462) | def prepare_for_onnx_export_(self): method forward (line 465) | def forward(self, input): method buffered_future_mask (line 561) | def buffered_future_mask(self, tensor): method maybe_layer_norm (line 577) | def maybe_layer_norm(self, layer_norm, x, before=False, after=False): method make_generation_fast_ (line 584) | def make_generation_fast_(self, need_attn=False, **kwargs): function Embedding (line 588) | def Embedding(num_embeddings, embedding_dim, padding_idx): function Linear (line 595) | def Linear(in_features, out_features, bias=True): FILE: fairseq/model_parallel/models/pipeline_parallel_transformer/model.py function import_pipe (line 46) | def import_pipe(): class PipelineParallelTransformerModel (line 85) | class PipelineParallelTransformerModel(BaseFairseqModel): method __init__ (line 86) | def __init__(self, encoder, decoder, balance, devices, chunks, checkpo... method forward (line 130) | def forward(self, src_tokens, src_lengths, prev_output_tokens): method prepare_for_inference_ (line 146) | def prepare_for_inference_(self, cfg): method add_args (line 172) | def add_args(parser): method build_model_base (line 232) | def build_model_base(cls, args, task): method build_encoder (line 313) | def build_encoder(cls, args, src_dict, embed_tokens): method build_decoder (line 317) | def build_decoder(cls, args, tgt_dict, embed_tokens): method build_model (line 321) | def build_model(cls, args, task): method output_layer (line 332) | def output_layer(self, features, **kwargs): method max_positions (line 336) | def max_positions(self): method max_positions_helper (line 340) | def max_positions_helper( method get_normalized_probs (line 351) | def get_normalized_probs(self, net_output, log_probs, sample=None): method max_decoder_positions (line 371) | def max_decoder_positions(self): method load_state_dict (line 375) | def load_state_dict(self, state_dict, strict=True, model_cfg=None): method convert_to_pipeline_parallel_state_dict (line 388) | def convert_to_pipeline_parallel_state_dict(self, state_dict): class TransformerEncoder (line 464) | class TransformerEncoder(FairseqEncoder): method __init__ (line 475) | def __init__(self, args, dictionary, embed_tokens, encoder_module_list... method forward (line 520) | def forward(self, src_tokens, src_lengths): method reorder_encoder_out (line 562) | def reorder_encoder_out(self, encoder_out, new_order): method max_positions (line 594) | def max_positions(self): class TransformerDecoder (line 604) | class TransformerDecoder(FairseqDecoder): method __init__ (line 617) | def __init__( method forward (line 670) | def forward( method output_layer (line 707) | def output_layer(self, features, **kwargs): method max_positions (line 718) | def max_positions(self): method buffered_future_mask (line 727) | def buffered_future_mask(self, tensor): method upgrade_state_dict_named (line 740) | def upgrade_state_dict_named(self, state_dict, name): function transformer_iwslt_de_en_dist (line 771) | def transformer_iwslt_de_en_dist(args): function transformer_wmt_en_de_big_dist (line 778) | def transformer_wmt_en_de_big_dist(args): FILE: fairseq/model_parallel/models/roberta/model.py class ModelParallelRobertaModel (line 42) | class ModelParallelRobertaModel(RobertaModel): method __init__ (line 43) | def __init__(self, args, encoder): method add_args (line 49) | def add_args(parser): method build_model (line 61) | def build_model(cls, args, task): method forward (line 81) | def forward( method register_classification_head (line 98) | def register_classification_head( class ModelParallelRobertaLMHead (line 121) | class ModelParallelRobertaLMHead(nn.Module): method __init__ (line 124) | def __init__(self, embed_dim, output_dim, activation_fn, weight=None): method forward (line 135) | def forward(self, features, masked_tokens=None, **kwargs): class ModelParallelRobertaClassificationHead (line 153) | class ModelParallelRobertaClassificationHead(nn.Module): method __init__ (line 156) | def __init__( method forward (line 165) | def forward(self, features, **kwargs): class ModelParallelRobertaEncoder (line 175) | class ModelParallelRobertaEncoder(RobertaEncoder): method __init__ (line 178) | def __init__(self, args, dictionary): method build_embedding (line 182) | def build_embedding(self, vocab_size, embedding_dim, padding_idx): method build_encoder (line 185) | def build_encoder(self, args, dictionary, embed_tokens): method build_lm_head (line 188) | def build_lm_head(self, embed_dim, output_dim, activation_fn, weight): function base_architecture (line 193) | def base_architecture(args): function model_parallel_roberta_v1_architecture (line 201) | def model_parallel_roberta_v1_architecture(args): function model_parallel_roberta_postnorm_architecture (line 209) | def model_parallel_roberta_postnorm_architecture(args): function model_parallel_roberta_base_architecture (line 215) | def model_parallel_roberta_base_architecture(args): function model_parallel_roberta_large_architecture (line 220) | def model_parallel_roberta_large_architecture(args): FILE: fairseq/model_parallel/models/transformer.py class ModelParallelTransformerModel (line 37) | class ModelParallelTransformerModel(TransformerModel): method build_embedding (line 43) | def build_embedding(cls, args, dictionary, embed_dim, path=None): method build_encoder (line 69) | def build_encoder(cls, args, src_dict, embed_tokens): method build_decoder (line 73) | def build_decoder(cls, args, tgt_dict, embed_tokens): class ModelParallelTransformerEncoder (line 82) | class ModelParallelTransformerEncoder(TransformerEncoder): method __init__ (line 88) | def __init__(self, args, dictionary, embed_tokens): method build_encoder_layer (line 94) | def build_encoder_layer(self, args): class ModelParallelTransformerDecoder (line 98) | class ModelParallelTransformerDecoder(TransformerDecoder): method build_decoder_layer (line 104) | def build_decoder_layer(self, args, no_encoder_attn=False): method output_layer (line 107) | def output_layer(self, features, **kwargs): FILE: fairseq/model_parallel/models/transformer_lm.py class ModelParallelTransformerLanguageModel (line 24) | class ModelParallelTransformerLanguageModel(TransformerLanguageModel): method add_args (line 26) | def add_args(parser): method build_model (line 30) | def build_model(cls, args, task): method build_embedding (line 75) | def build_embedding(cls, args, dictionary, embed_dim, path=None): function base_lm_architecture (line 86) | def base_lm_architecture(args): function transformer_lm_megatron (line 147) | def transformer_lm_megatron(args): function transformer_lm_megatron_11b (line 161) | def transformer_lm_megatron_11b(args): FILE: fairseq/model_parallel/modules/multihead_attention.py class ModelParallelMultiheadAttention (line 30) | class ModelParallelMultiheadAttention(nn.Module): method __init__ (line 37) | def __init__( method forward (line 96) | def forward( method _append_prev_key_padding_mask (line 286) | def _append_prev_key_padding_mask( method reorder_incremental_state (line 322) | def reorder_incremental_state( method _get_input_buffer (line 334) | def _get_input_buffer( method _set_input_buffer (line 344) | def _set_input_buffer( FILE: fairseq/model_parallel/modules/transformer_layer.py class ModelParallelTransformerEncoderLayer (line 21) | class ModelParallelTransformerEncoderLayer(TransformerEncoderLayer): method build_fc1 (line 27) | def build_fc1(self, input_dim, output_dim, q_noise, qn_block_size): method build_fc2 (line 32) | def build_fc2(self, input_dim, output_dim, q_noise, qn_block_size): method build_self_attention (line 37) | def build_self_attention(self, embed_dim, args, **unused_kwargs): class ModelParallelTransformerDecoderLayer (line 46) | class ModelParallelTransformerDecoderLayer(TransformerDecoderLayer): method build_fc1 (line 52) | def build_fc1(self, input_dim, output_dim, q_noise, qn_block_size): method build_fc2 (line 57) | def build_fc2(self, input_dim, output_dim, q_noise, qn_block_size): method build_self_attention (line 62) | def build_self_attention(self, embed_dim, args, **unused_kwargs): method build_encoder_attention (line 70) | def build_encoder_attention(self, embed_dim, args, **unused_kwargs): FILE: fairseq/models/__init__.py function build_model (line 56) | def build_model(cfg: FairseqDataclass, task, from_checkpoint=False): function register_model (line 109) | def register_model(name, dataclass=None): function register_model_architecture (line 161) | def register_model_architecture(model_name, arch_name): function import_models (line 209) | def import_models(models_dir, namespace): FILE: fairseq/models/bart/hub_interface.py class BARTHubInterface (line 23) | class BARTHubInterface(GeneratorHubInterface): method __init__ (line 29) | def __init__(self, cfg, task, model): method encode (line 33) | def encode( method decode (line 65) | def decode(self, tokens: torch.LongTensor): method _build_sample (line 80) | def _build_sample(self, src_tokens: List[torch.LongTensor]): method generate (line 90) | def generate( method extract_features (line 119) | def extract_features( method register_classification_head (line 153) | def register_classification_head( method predict (line 160) | def predict(self, head: str, tokens: torch.LongTensor, return_logits: ... method fill_mask (line 173) | def fill_mask( FILE: fairseq/models/bart/model.py class BARTModel (line 26) | class BARTModel(TransformerModel): method hub_models (line 30) | def hub_models(cls): method __init__ (line 39) | def __init__(self, args, encoder, decoder): method add_args (line 50) | def add_args(parser): method supported_targets (line 70) | def supported_targets(self): method forward (line 73) | def forward( method from_pretrained (line 116) | def from_pretrained( method register_classification_head (line 139) | def register_classification_head( method upgrade_state_dict_named (line 165) | def upgrade_state_dict_named(self, state_dict, name): method set_beam_size (line 282) | def set_beam_size(self, beam): class BARTClassificationHead (line 294) | class BARTClassificationHead(nn.Module): method __init__ (line 297) | def __init__( method forward (line 315) | def forward(self, features, **kwargs): function bart_large_architecture (line 326) | def bart_large_architecture(args): function bart_base_architecture (line 369) | def bart_base_architecture(args): function mbart_large_architecture (line 380) | def mbart_large_architecture(args): function mbart_base_architecture (line 386) | def mbart_base_architecture(args): function mbart_base_wmt20_architecture (line 392) | def mbart_base_wmt20_architecture(args): FILE: fairseq/models/composite_encoder.py class CompositeEncoder (line 9) | class CompositeEncoder(FairseqEncoder): method __init__ (line 20) | def __init__(self, encoders): method forward (line 26) | def forward(self, src_tokens, src_lengths): method reorder_encoder_out (line 43) | def reorder_encoder_out(self, encoder_out, new_order): method max_positions (line 51) | def max_positions(self): method upgrade_state_dict (line 54) | def upgrade_state_dict(self, state_dict): FILE: fairseq/models/distributed_fairseq_model.py function DistributedFairseqModel (line 35) | def DistributedFairseqModel(args, model, process_group, device): FILE: fairseq/models/ema/__init__.py function build_ema (line 12) | def build_ema(model, cfg, device): FILE: fairseq/models/ema/ema.py class EMA (line 32) | class EMA(object): method __init__ (line 69) | def __init__(self, model, config, device=None, skip_keys=None): method get_model (line 100) | def get_model(self): method build_fp32_params (line 103) | def build_fp32_params(self, state_dict=None): method restore (line 128) | def restore(self, state_dict, build_fp32_params=False): method _set_decay (line 134) | def _set_decay(self, decay): method get_decay (line 137) | def get_decay(self): method _step_internal (line 140) | def _step_internal(self, new_model, updates=None): method step (line 176) | def step(self, new_model, updates=None): method reverse (line 199) | def reverse(self, model): FILE: fairseq/models/fairseq_decoder.py class FairseqDecoder (line 13) | class FairseqDecoder(nn.Module): method __init__ (line 16) | def __init__(self, dictionary): method forward (line 22) | def forward(self, prev_output_tokens, encoder_out=None, **kwargs): method extract_features (line 41) | def extract_features(self, prev_output_tokens, encoder_out=None, **kwa... method output_layer (line 50) | def output_layer(self, features, **kwargs): method get_normalized_probs (line 59) | def get_normalized_probs( method get_normalized_probs_scriptable (line 72) | def get_normalized_probs_scriptable( method max_positions (line 95) | def max_positions(self): method upgrade_state_dict_named (line 99) | def upgrade_state_dict_named(self, state_dict, name): method prepare_for_onnx_export_ (line 103) | def prepare_for_onnx_export_(self): FILE: fairseq/models/fairseq_encoder.py class FairseqEncoder (line 26) | class FairseqEncoder(nn.Module): method __init__ (line 29) | def __init__(self, dictionary): method forward (line 33) | def forward(self, src_tokens, src_lengths=None, **kwargs): method forward_torchscript (line 43) | def forward_torchscript(self, net_input: Dict[str, Tensor]): method forward_non_torchscript (line 58) | def forward_non_torchscript(self, net_input: Dict[str, Tensor]): method reorder_encoder_out (line 64) | def reorder_encoder_out(self, encoder_out, new_order): method max_positions (line 77) | def max_positions(self): method upgrade_state_dict_named (line 81) | def upgrade_state_dict_named(self, state_dict, name): method set_num_updates (line 85) | def set_num_updates(self, num_updates): FILE: fairseq/models/fairseq_incremental_decoder.py class FairseqIncrementalDecoder (line 18) | class FairseqIncrementalDecoder(FairseqDecoder): method __init__ (line 40) | def __init__(self, dictionary): method forward (line 43) | def forward( method extract_features (line 62) | def extract_features( method reorder_incremental_state (line 73) | def reorder_incremental_state( method reorder_incremental_state_scripting (line 86) | def reorder_incremental_state_scripting( method set_beam_size (line 103) | def set_beam_size(self, beam_size): FILE: fairseq/models/fairseq_model.py function check_type (line 30) | def check_type(module, expected_type): class BaseFairseqModel (line 39) | class BaseFairseqModel(nn.Module): method __init__ (line 42) | def __init__(self): method add_args (line 47) | def add_args(cls, parser): method build_model (line 55) | def build_model(cls, args, task): method get_targets (line 59) | def get_targets(self, sample, net_output): method get_normalized_probs (line 63) | def get_normalized_probs( method get_normalized_probs_scriptable (line 76) | def get_normalized_probs_scriptable( method extract_features (line 95) | def extract_features(self, *args, **kwargs): method max_positions (line 99) | def max_positions(self): method load_state_dict (line 103) | def load_state_dict( method upgrade_state_dict (line 130) | def upgrade_state_dict(self, state_dict): method upgrade_state_dict_named (line 134) | def upgrade_state_dict_named(self, state_dict, name): method set_num_updates (line 157) | def set_num_updates(self, num_updates): method set_epoch (line 163) | def set_epoch(self, epoch): method prepare_for_inference_ (line 168) | def prepare_for_inference_(self, cfg: DictConfig): method make_generation_fast_ (line 182) | def make_generation_fast_(self, **kwargs): method prepare_for_onnx_export_ (line 226) | def prepare_for_onnx_export_(self, **kwargs): method from_pretrained (line 242) | def from_pretrained( method hub_models (line 283) | def hub_models(cls): class FairseqEncoderDecoderModel (line 287) | class FairseqEncoderDecoderModel(BaseFairseqModel): method __init__ (line 295) | def __init__(self, encoder, decoder): method forward (line 304) | def forward(self, src_tokens, src_lengths, prev_output_tokens, **kwargs): method forward_decoder (line 333) | def forward_decoder(self, prev_output_tokens, **kwargs): method extract_features (line 336) | def extract_features(self, src_tokens, src_lengths, prev_output_tokens... method output_layer (line 351) | def output_layer(self, features, **kwargs): method max_positions (line 355) | def max_positions(self): method max_decoder_positions (line 359) | def max_decoder_positions(self): class FairseqModel (line 364) | class FairseqModel(FairseqEncoderDecoderModel): method __init__ (line 365) | def __init__(self, *args, **kwargs): class FairseqMultiModel (line 374) | class FairseqMultiModel(BaseFairseqModel): method __init__ (line 377) | def __init__(self, encoders, decoders): method build_shared_embeddings (line 393) | def build_shared_embeddings( method forward (line 422) | def forward(self, src_tokens, src_lengths, prev_output_tokens, **kwargs): method max_positions (line 425) | def max_positions(self): method max_decoder_positions (line 435) | def max_decoder_positions(self): method encoder (line 440) | def encoder(self): method decoder (line 444) | def decoder(self): method forward_decoder (line 447) | def forward_decoder(self, prev_output_tokens, **kwargs): method load_state_dict (line 450) | def load_state_dict( class FairseqLanguageModel (line 478) | class FairseqLanguageModel(BaseFairseqModel): method __init__ (line 485) | def __init__(self, decoder): method forward (line 490) | def forward(self, src_tokens, **kwargs): method forward_decoder (line 508) | def forward_decoder(self, prev_output_tokens, **kwargs): method extract_features (line 511) | def extract_features(self, src_tokens, **kwargs): method output_layer (line 522) | def output_layer(self, features, **kwargs): method max_positions (line 526) | def max_positions(self): method max_decoder_positions (line 530) | def max_decoder_positions(self): method supported_targets (line 535) | def supported_targets(self): class FairseqEncoderModel (line 539) | class FairseqEncoderModel(BaseFairseqModel): method __init__ (line 546) | def __init__(self, encoder): method forward (line 551) | def forward(self, src_tokens, src_lengths, **kwargs): method get_normalized_probs (line 566) | def get_normalized_probs(self, net_output, log_probs, sample=None): method max_positions (line 577) | def max_positions(self): FILE: fairseq/models/fconv.py class FConvModel (line 30) | class FConvModel(FairseqEncoderDecoderModel): method hub_models (line 49) | def hub_models(cls): method __init__ (line 69) | def __init__(self, encoder, decoder): method add_args (line 76) | def add_args(parser): method build_model (line 104) | def build_model(cls, args, task): class FConvEncoder (line 141) | class FConvEncoder(FairseqEncoder): method __init__ (line 159) | def __init__( method forward (line 224) | def forward(self, src_tokens, src_lengths): method reorder_encoder_out (line 308) | def reorder_encoder_out(self, encoder_out, new_order): method max_positions (line 320) | def max_positions(self): class AttentionLayer (line 325) | class AttentionLayer(nn.Module): method __init__ (line 326) | def __init__(self, conv_channels, embed_dim, bmm=None): method forward (line 335) | def forward(self, x, target_embedding, encoder_out, encoder_padding_ma... method make_generation_fast_ (line 373) | def make_generation_fast_(self, beamable_mm_beam_size=None, **kwargs): class FConvDecoder (line 380) | class FConvDecoder(FairseqIncrementalDecoder): method __init__ (line 383) | def __init__( method forward (line 490) | def forward( method reorder_incremental_state (line 572) | def reorder_incremental_state(self, incremental_state, new_order): method max_positions (line 583) | def max_positions(self): method upgrade_state_dict (line 591) | def upgrade_state_dict(self, state_dict): method make_generation_fast_ (line 601) | def make_generation_fast_(self, need_attn=False, **kwargs): method _embed_tokens (line 604) | def _embed_tokens(self, tokens, incremental_state): method _split_encoder_out (line 610) | def _split_encoder_out(self, encoder_out, incremental_state): method _transpose_if_training (line 630) | def _transpose_if_training(self, x, incremental_state): function extend_conv_spec (line 636) | def extend_conv_spec(convolutions): function Embedding (line 657) | def Embedding(num_embeddings, embedding_dim, padding_idx): function PositionalEmbedding (line 664) | def PositionalEmbedding(num_embeddings, embedding_dim, padding_idx): function Linear (line 671) | def Linear(in_features, out_features, dropout=0.0): function LinearizedConv1d (line 679) | def LinearizedConv1d(in_channels, out_channels, kernel_size, dropout=0.0... function ConvTBC (line 688) | def ConvTBC(in_channels, out_channels, kernel_size, dropout=0.0, **kwargs): function base_architecture (line 700) | def base_architecture(args): function fconv_iwslt_de_en (line 714) | def fconv_iwslt_de_en(args): function fconv_wmt_en_ro (line 724) | def fconv_wmt_en_ro(args): function fconv_wmt_en_de (line 730) | def fconv_wmt_en_de(args): function fconv_wmt_en_fr (line 744) | def fconv_wmt_en_fr(args): FILE: fairseq/models/fconv_lm.py class FConvLanguageModel (line 17) | class FConvLanguageModel(FairseqLanguageModel): method __init__ (line 18) | def __init__(self, decoder): method add_args (line 22) | def add_args(parser): method build_model (line 65) | def build_model(cls, args, task): function base_lm_architecture (line 96) | def base_lm_architecture(args): function fconv_lm_dauphin_wikitext103 (line 106) | def fconv_lm_dauphin_wikitext103(args): function fconv_lm_dauphin_gbw (line 124) | def fconv_lm_dauphin_gbw(args): FILE: fairseq/models/fconv_self_att.py class FConvModelSelfAtt (line 37) | class FConvModelSelfAtt(FairseqEncoderDecoderModel): method hub_models (line 39) | def hub_models(cls): method __init__ (line 57) | def __init__(self, encoder, decoder, pretrained_encoder=None): method add_args (line 72) | def add_args(parser): method build_model (line 112) | def build_model(cls, args, task): method pretrained (line 169) | def pretrained(self): class FConvEncoder (line 173) | class FConvEncoder(FairseqEncoder): method __init__ (line 176) | def __init__( method forward (line 234) | def forward(self, src_tokens, src_lengths): method reorder_encoder_out (line 290) | def reorder_encoder_out(self, encoder_out, new_order): method max_positions (line 308) | def max_positions(self): class FConvDecoder (line 314) | class FConvDecoder(FairseqDecoder): method __init__ (line 317) | def __init__( method forward (line 460) | def forward(self, prev_output_tokens, encoder_out): method max_positions (line 539) | def max_positions(self): method make_generation_fast_ (line 543) | def make_generation_fast_(self, need_attn=False, **kwargs): method _split_encoder_out (line 546) | def _split_encoder_out(self, encoder_out): class SelfAttention (line 556) | class SelfAttention(nn.Module): method __init__ (line 557) | def __init__( method forward (line 582) | def forward(self, x): function Embedding (line 593) | def Embedding(num_embeddings, embedding_dim, padding_idx): function PositionalEmbedding (line 599) | def PositionalEmbedding(num_embeddings, embedding_dim, padding_idx): function Linear (line 605) | def Linear(in_features, out_features, dropout=0.0): function LinearizedConv1d (line 613) | def LinearizedConv1d(in_channels, out_channels, kernel_size, dropout=0.0... function ConvTBC (line 622) | def ConvTBC(in_channels, out_channels, kernel_size, dropout=0.0, **kwargs): function base_architecture (line 634) | def base_architecture(args): function fconv_self_att_wp (line 657) | def fconv_self_att_wp(args): FILE: fairseq/models/hubert/hubert.py class HubertConfig (line 37) | class HubertConfig(FairseqDataclass): class HubertModel (line 248) | class HubertModel(BaseFairseqModel): method __init__ (line 249) | def __init__( method upgrade_state_dict_named (line 331) | def upgrade_state_dict_named(self, state_dict, name): method build_model (line 338) | def build_model(cls, cfg: HubertConfig, task: HubertPretrainingTask): method apply_mask (line 344) | def apply_mask(self, x, padding_mask, target_list): method compute_nce (line 384) | def compute_nce(self, x, pos, negs): method forward_features (line 396) | def forward_features(self, source: torch.Tensor) -> torch.Tensor: method forward_targets (line 406) | def forward_targets( method forward_padding_mask (line 421) | def forward_padding_mask( method forward (line 433) | def forward( method extract_features (line 533) | def extract_features( method get_logits (line 551) | def get_logits(self, net_output, is_masked=True): method get_targets (line 559) | def get_targets(self, net_output, is_masked=True): method get_extra_losses (line 564) | def get_extra_losses(self, net_output): method remove_pretraining_modules (line 574) | def remove_pretraining_modules(self): FILE: fairseq/models/hubert/hubert_asr.py class HubertAsrConfig (line 37) | class HubertAsrConfig(FairseqDataclass): class HubertCtcConfig (line 145) | class HubertCtcConfig(HubertAsrConfig): class HubertCtc (line 150) | class HubertCtc(BaseFairseqModel): method __init__ (line 151) | def __init__(self, cfg: HubertCtcConfig, w2v_encoder: BaseFairseqModel): method upgrade_state_dict_named (line 156) | def upgrade_state_dict_named(self, state_dict, name): method build_model (line 161) | def build_model(cls, cfg: HubertCtcConfig, task: FairseqTask): method get_normalized_probs (line 166) | def get_normalized_probs(self, net_output, log_probs): method get_logits (line 175) | def get_logits(self, net_output): method forward (line 185) | def forward(self, **kwargs): class HubertSeq2SeqConfig (line 191) | class HubertSeq2SeqConfig(HubertAsrConfig): class HubertSeq2SeqModel (line 251) | class HubertSeq2SeqModel(FairseqEncoderDecoderModel): method __init__ (line 252) | def __init__(self, encoder, decoder): method build_model (line 256) | def build_model(cls, cfg: HubertSeq2SeqConfig, task: FairseqTask): method build_encoder (line 288) | def build_encoder(cls, cfg: HubertAsrConfig, task): method build_decoder (line 292) | def build_decoder(cls, cfg: HubertSeq2SeqConfig, tgt_dict, embed_tokens): method forward (line 295) | def forward(self, **kwargs): method upgrade_state_dict_named (line 300) | def upgrade_state_dict_named(self, state_dict, name): method load_state_dict (line 303) | def load_state_dict( class HubertEncoder (line 318) | class HubertEncoder(FairseqEncoder): method __init__ (line 319) | def __init__(self, cfg: HubertAsrConfig, task): method set_num_updates (line 391) | def set_num_updates(self, num_updates): method forward (line 396) | def forward(self, source, padding_mask, tbc=True, **kwargs): method reorder_encoder_out (line 424) | def reorder_encoder_out(self, encoder_out, new_order): method max_positions (line 439) | def max_positions(self): method upgrade_state_dict_named (line 443) | def upgrade_state_dict_named(self, state_dict, name): class TransformerDecoder (line 447) | class TransformerDecoder(FairseqIncrementalDecoder): method __init__ (line 460) | def __init__( method forward (line 531) | def forward( method extract_features (line 563) | def extract_features( method output_layer (line 632) | def output_layer(self, features, **kwargs): method max_positions (line 640) | def max_positions(self): method buffered_future_mask (line 646) | def buffered_future_mask(self, tensor): method upgrade_state_dict_named (line 659) | def upgrade_state_dict_named(self, state_dict, name): function Embedding (line 663) | def Embedding(num_embeddings, embedding_dim, padding_idx): function Linear (line 670) | def Linear(in_features, out_features, bias=True): FILE: fairseq/models/huggingface/hf_gpt2.py class HuggingFaceGPT2LanguageModel (line 27) | class HuggingFaceGPT2LanguageModel(FairseqLanguageModel): method __init__ (line 28) | def __init__(self, decoder): method add_args (line 32) | def add_args(parser): method build_model (line 49) | def build_model(cls, args, task): class HuggingFaceGPT2Decoder (line 55) | class HuggingFaceGPT2Decoder(FairseqIncrementalDecoder): method __init__ (line 56) | def __init__(self, args, task): method forward (line 86) | def forward( method extract_features (line 97) | def extract_features( method max_positions (line 130) | def max_positions(self): function default_architecture (line 135) | def default_architecture(args): function hf_gpt2_medium (line 148) | def hf_gpt2_medium(args): function hf_gpt2_large (line 156) | def hf_gpt2_large(args): function hf_gpt2_xl (line 164) | def hf_gpt2_xl(args): FILE: fairseq/models/lightconv.py class LightConvModel (line 35) | class LightConvModel(FairseqEncoderDecoderModel): method hub_models (line 55) | def hub_models(cls): method __init__ (line 81) | def __init__(self, encoder, decoder): method add_args (line 85) | def add_args(parser): method build_model (line 258) | def build_model(cls, args, task): method forward (line 313) | def forward( class LightConvEncoder (line 350) | class LightConvEncoder(FairseqEncoder): method __init__ (line 361) | def __init__(self, args, dictionary, embed_tokens): method forward (line 400) | def forward( method reorder_encoder_out (line 448) | def reorder_encoder_out( method max_positions (line 478) | def max_positions(self): class LightConvDecoder (line 485) | class LightConvDecoder(FairseqIncrementalDecoder): method __init__ (line 498) | def __init__( method forward (line 588) | def forward( method max_positions (line 678) | def max_positions(self): method buffered_future_mask (line 684) | def buffered_future_mask(self, tensor): class LightConvEncoderLayer (line 701) | class LightConvEncoderLayer(nn.Module): method __init__ (line 709) | def __init__(self, args, kernel_size=0): method forward (line 762) | def forward(self, x, encoder_padding_mask: Optional[Tensor] = None) ->... method maybe_layer_norm (line 804) | def maybe_layer_norm(self, before: bool = False, after: bool = False): method extra_repr (line 808) | def extra_repr(self): class LightConvDecoderLayer (line 819) | class LightConvDecoderLayer(nn.Module): method __init__ (line 829) | def __init__(self, args, no_encoder_attn=False, kernel_size=0, diction... method forward (line 893) | def forward( method maybe_layer_norm (line 973) | def maybe_layer_norm(self, before: bool = False, after: bool = False): method make_generation_fast_ (line 977) | def make_generation_fast_(self, need_attn: bool = False, **kwargs): method extra_repr (line 980) | def extra_repr(self): function Embedding (line 991) | def Embedding(num_embeddings, embedding_dim, padding_idx): function Linear (line 998) | def Linear(in_features, out_features, bias=True): function base_architecture (line 1007) | def base_architecture(args): function lightconv_iwslt_de_en (line 1072) | def lightconv_iwslt_de_en(args): function lightconv_wmt_en_de (line 1090) | def lightconv_wmt_en_de(args): function lightconv_wmt_en_de_big (line 1095) | def lightconv_wmt_en_de_big(args): function lightconv_wmt_en_fr_big (line 1109) | def lightconv_wmt_en_fr_big(args): function lightconv_wmt_zh_en_big (line 1115) | def lightconv_wmt_zh_en_big(args): FILE: fairseq/models/lightconv_lm.py class LightConvLanguageModel (line 17) | class LightConvLanguageModel(FairseqLanguageModel): method __init__ (line 18) | def __init__(self, decoder): method add_args (line 22) | def add_args(parser): method build_model (line 202) | def build_model(cls, args, task): function base_lm_architecture (line 256) | def base_lm_architecture(args): function lightconv_lm_gbw (line 300) | def lightconv_lm_gbw(args): FILE: fairseq/models/lstm.py class LSTMModel (line 28) | class LSTMModel(FairseqEncoderDecoderModel): method __init__ (line 29) | def __init__(self, encoder, decoder): method add_args (line 33) | def add_args(parser): method build_model (line 86) | def build_model(cls, args, task): method forward (line 192) | def forward( class LSTMEncoder (line 208) | class LSTMEncoder(FairseqEncoder): method __init__ (line 211) | def __init__( method forward (line 257) | def forward( method combine_bidir (line 328) | def combine_bidir(self, outs, bsz: int): method reorder_encoder_out (line 332) | def reorder_encoder_out( method max_positions (line 344) | def max_positions(self): class AttentionLayer (line 349) | class AttentionLayer(nn.Module): method __init__ (line 350) | def __init__(self, input_embed_dim, source_embed_dim, output_embed_dim... method forward (line 358) | def forward(self, input, source_hids, encoder_padding_mask): class LSTMDecoder (line 385) | class LSTMDecoder(FairseqIncrementalDecoder): method __init__ (line 388) | def __init__( method forward (line 471) | def forward( method extract_features (line 483) | def extract_features( method output_layer (line 611) | def output_layer(self, x): method get_cached_state (line 620) | def get_cached_state( method reorder_incremental_state (line 637) | def reorder_incremental_state( method max_positions (line 660) | def max_positions(self): method make_generation_fast_ (line 664) | def make_generation_fast_(self, need_attn=False, **kwargs): function Embedding (line 668) | def Embedding(num_embeddings, embedding_dim, padding_idx): function LSTM (line 675) | def LSTM(input_size, hidden_size, **kwargs): function LSTMCell (line 683) | def LSTMCell(input_size, hidden_size, **kwargs): function Linear (line 691) | def Linear(in_features, out_features, bias=True, dropout=0.0): function base_architecture (line 701) | def base_architecture(args): function lstm_wiseman_iwslt_de_en (line 734) | def lstm_wiseman_iwslt_de_en(args): function lstm_luong_wmt_en_de (line 747) | def lstm_luong_wmt_en_de(args): FILE: fairseq/models/lstm_lm.py class LSTMLanguageModel (line 19) | class LSTMLanguageModel(FairseqLanguageModel): method __init__ (line 20) | def __init__(self, decoder): method add_args (line 24) | def add_args(parser): method build_model (line 59) | def build_model(cls, args, task): function base_architecture (line 124) | def base_architecture(args): FILE: fairseq/models/masked_lm.py class MaskedLMModel (line 31) | class MaskedLMModel(FairseqEncoderModel): method __init__ (line 37) | def __init__(self, args, encoder): method add_args (line 48) | def add_args(parser): method forward (line 150) | def forward(self, src_tokens, segment_labels=None, **kwargs): method max_positions (line 153) | def max_positions(self): method build_model (line 157) | def build_model(cls, args, task): class MaskedLMEncoder (line 171) | class MaskedLMEncoder(FairseqEncoder): method __init__ (line 176) | def __init__(self, args, dictionary): method forward (line 236) | def forward(self, src_tokens, segment_labels=None, masked_tokens=None,... method max_positions (line 292) | def max_positions(self): method upgrade_state_dict_named (line 296) | def upgrade_state_dict_named(self, state_dict, name): function base_architecture (line 309) | def base_architecture(args): function bert_base_architecture (line 339) | def bert_base_architecture(args): function bert_large_architecture (line 367) | def bert_large_architecture(args): function xlm_architecture (line 376) | def xlm_architecture(args): FILE: fairseq/models/model_utils.py function script_skip_tensor_list (line 13) | def script_skip_tensor_list(x: List[Tensor], mask): function script_skip_tensor (line 25) | def script_skip_tensor(x: Tensor, mask): function expand_2d_or_3d_tensor (line 37) | def expand_2d_or_3d_tensor(x, trg_dim: int, padding_idx: int): function coalesce (line 58) | def coalesce(x: Optional[Tensor], y: Tensor) -> Tensor: function fill_tensors (line 63) | def fill_tensors( FILE: fairseq/models/multilingual_transformer.py class MultilingualTransformerModel (line 25) | class MultilingualTransformerModel(FairseqMultiModel): method __init__ (line 41) | def __init__(self, encoders, decoders): method add_args (line 45) | def add_args(parser): method build_model (line 70) | def build_model(cls, args, task): method _get_module_class (line 194) | def _get_module_class(cls, is_encoder, args, lang_dict, embed_tokens, ... method load_state_dict (line 198) | def load_state_dict(self, state_dict, strict=True, model_cfg=None): function base_multilingual_architecture (line 209) | def base_multilingual_architecture(args): function multilingual_transformer_iwslt_de_en (line 220) | def multilingual_transformer_iwslt_de_en(args): FILE: fairseq/models/multires_hubert/multires_hubert.py class MultiresHubertConfig (line 40) | class MultiresHubertConfig(FairseqDataclass): class MultiresHubertModel (line 286) | class MultiresHubertModel(BaseFairseqModel): method __init__ (line 287) | def __init__( method upgrade_state_dict_named (line 594) | def upgrade_state_dict_named(self, state_dict, name): method build_model (line 601) | def build_model( method apply_mask (line 609) | def apply_mask(self, x, padding_mask, target_list): method compute_nce (line 649) | def compute_nce(self, x, pos, negs): method forward_features (line 661) | def forward_features(self, source: torch.Tensor) -> torch.Tensor: method forward_targets (line 671) | def forward_targets( method forward_padding_mask (line 692) | def forward_padding_mask( method forward (line 704) | def forward( method extract_features (line 885) | def extract_features( method get_logits (line 906) | def get_logits(self, net_output, is_masked=True): method get_targets (line 914) | def get_targets(self, net_output, is_masked=True): method get_extra_losses (line 919) | def get_extra_losses(self, net_output): method remove_pretraining_modules (line 929) | def remove_pretraining_modules(self): class ConvAdapter (line 934) | class ConvAdapter(nn.Module): method __init__ (line 939) | def __init__( method forward (line 1002) | def forward(self, x, padding=None, mask_indices=None): class ConvDownsampler (line 1062) | class ConvDownsampler(nn.Module): method __init__ (line 1067) | def __init__( method forward (line 1110) | def forward(self, x, padding=None, mask_indices=None): class ConvUpsampler (line 1146) | class ConvUpsampler(nn.Module): method __init__ (line 1151) | def __init__( method forward (line 1196) | def forward(self, x, padding=None, mask_indices=None): FILE: fairseq/models/multires_hubert/multires_hubert_asr.py class MultiresHubertAsrConfig (line 24) | class MultiresHubertAsrConfig(FairseqDataclass): class MultiresHubertCtcConfig (line 131) | class MultiresHubertCtcConfig(MultiresHubertAsrConfig): class MultiresHubertCtc (line 136) | class MultiresHubertCtc(BaseFairseqModel): method __init__ (line 137) | def __init__( method upgrade_state_dict_named (line 144) | def upgrade_state_dict_named(self, state_dict, name): method build_model (line 149) | def build_model(cls, cfg: MultiresHubertAsrConfig, task: FairseqTask): method get_normalized_probs (line 154) | def get_normalized_probs(self, net_output, log_probs, sample=None): method get_logits (line 163) | def get_logits(self, net_output): method forward (line 173) | def forward(self, **kwargs): class MultiresHubertSeq2SeqConfig (line 179) | class MultiresHubertSeq2SeqConfig(MultiresHubertAsrConfig): class MultiresHubertEncoder (line 231) | class MultiresHubertEncoder(FairseqEncoder): method __init__ (line 232) | def __init__(self, cfg: MultiresHubertAsrConfig, task): method set_num_updates (line 310) | def set_num_updates(self, num_updates): method forward (line 315) | def forward(self, source, padding_mask, tbc=True, **kwargs): method reorder_encoder_out (line 345) | def reorder_encoder_out(self, encoder_out, new_order): method max_positions (line 356) | def max_positions(self): method upgrade_state_dict_named (line 360) | def upgrade_state_dict_named(self, state_dict, name): function Embedding (line 364) | def Embedding(num_embeddings, embedding_dim, padding_idx): function Linear (line 371) | def Linear(in_features, out_features, bias=True): FILE: fairseq/models/nat/cmlm_transformer.py function _skeptical_unmasking (line 18) | def _skeptical_unmasking(output_scores, output_masks, p): class CMLMNATransformerModel (line 28) | class CMLMNATransformerModel(NATransformerModel): method add_args (line 30) | def add_args(parser): method forward (line 33) | def forward( method forward_decoder (line 71) | def forward_decoder(self, decoder_out, encoder_out, decoding_format=No... function cmlm_base_architecture (line 114) | def cmlm_base_architecture(args): function cmlm_wmt_en_de (line 161) | def cmlm_wmt_en_de(args): FILE: fairseq/models/nat/fairseq_nat_model.py function ensemble_encoder (line 17) | def ensemble_encoder(func): function ensemble_decoder (line 45) | def ensemble_decoder(func): class FairseqNATModel (line 96) | class FairseqNATModel(TransformerModel): method __init__ (line 101) | def __init__(self, args, encoder, decoder): method allow_length_beam (line 112) | def allow_length_beam(self): method allow_ensemble (line 116) | def allow_ensemble(self): method enable_ensemble (line 119) | def enable_ensemble(self, models): method add_args (line 124) | def add_args(parser): method build_decoder (line 133) | def build_decoder(cls, args, tgt_dict, embed_tokens): method build_encoder (line 140) | def build_encoder(cls, args, src_dict, embed_tokens): method forward_encoder (line 146) | def forward_encoder(self, encoder_inputs): method forward_decoder (line 149) | def forward_decoder(self, *args, **kwargs): method initialize_output_tokens (line 152) | def initialize_output_tokens(self, *args, **kwargs): method forward (line 155) | def forward(self, *args, **kwargs): class FairseqNATEncoder (line 159) | class FairseqNATEncoder(TransformerEncoder): method __init__ (line 160) | def __init__(self, args, dictionary, embed_tokens): method forward (line 165) | def forward(self, *args, **kwargs): class FairseqNATDecoder (line 169) | class FairseqNATDecoder(TransformerDecoder): method __init__ (line 170) | def __init__(self, args, dictionary, embed_tokens, no_encoder_attn=Fal... FILE: fairseq/models/nat/insertion_transformer.py class NegativeDistanceScore (line 21) | class NegativeDistanceScore(object): method __init__ (line 22) | def __init__(self): method __call__ (line 31) | def __call__(self, i, L, tau): method compute_score (line 40) | def compute_score(self, L, tau): method compute_score_full (line 45) | def compute_score_full(self, L, tau): function _get_ins_targets (line 55) | def _get_ins_targets(in_tokens, out_tokens, padding_idx, unk_idx, vocab_... function _apply_ins_words (line 102) | def _apply_ins_words(in_tokens, in_scores, word_ins_pred, word_ins_score... class InsertionTransformerModel (line 121) | class InsertionTransformerModel(LevenshteinTransformerModel): method __init__ (line 122) | def __init__(self, args, encoder, decoder): method add_args (line 126) | def add_args(parser): method build_decoder (line 131) | def build_decoder(cls, args, tgt_dict, embed_tokens): method forward (line 137) | def forward( method forward_decoder (line 173) | def forward_decoder( class InsertionTransformerDecoder (line 209) | class InsertionTransformerDecoder(LevenshteinTransformerDecoder): method __init__ (line 210) | def __init__(self, args, dictionary, embed_tokens, no_encoder_attn=Fal... method forward_word_ins (line 225) | def forward_word_ins(self, normalize, encoder_out, prev_output_tokens): method forward_mask_ins (line 233) | def forward_mask_ins(self, *args, **kwargs): method forward_word_del (line 236) | def forward_word_del(self, *args, **kwargs): function insertion_base_architecture (line 241) | def insertion_base_architecture(args): FILE: fairseq/models/nat/iterative_nonautoregressive_transformer.py function _sequential_poisoning (line 11) | def _sequential_poisoning(s, V, beta=0.33, bos=2, eos=3, pad=1): function gumbel_noise (line 45) | def gumbel_noise(input, TINY=1e-8): class IterNATransformerModel (line 59) | class IterNATransformerModel(NATransformerModel): method add_args (line 61) | def add_args(parser): method build_model (line 80) | def build_model(cls, args, task): method forward (line 87) | def forward( function inat_base_architecture (line 173) | def inat_base_architecture(args): function iter_nat_wmt_en_de (line 227) | def iter_nat_wmt_en_de(args): FILE: fairseq/models/nat/levenshtein_transformer.py class LevenshteinTransformerModel (line 29) | class LevenshteinTransformerModel(FairseqNATModel): method allow_length_beam (line 31) | def allow_length_beam(self): method add_args (line 35) | def add_args(parser): method build_decoder (line 65) | def build_decoder(cls, args, tgt_dict, embed_tokens): method forward (line 71) | def forward( method forward_decoder (line 140) | def forward_decoder( method initialize_output_tokens (line 253) | def initialize_output_tokens(self, encoder_out, src_tokens): class LevenshteinTransformerDecoder (line 272) | class LevenshteinTransformerDecoder(FairseqNATDecoder): method __init__ (line 273) | def __init__(self, args, dictionary, embed_tokens, no_encoder_attn=Fal... method extract_features (line 313) | def extract_features( method forward_mask_ins (line 387) | def forward_mask_ins(self, normalize, encoder_out, prev_output_tokens,... method forward_word_ins (line 402) | def forward_word_ins(self, normalize, encoder_out, prev_output_tokens,... method forward_word_del (line 416) | def forward_word_del(self, normalize, encoder_out, prev_output_tokens,... function levenshtein_base_architecture (line 431) | def levenshtein_base_architecture(args): function levenshtein_transformer_wmt_en_de (line 481) | def levenshtein_transformer_wmt_en_de(args): function levenshtein_transformer_vaswani_wmt_en_de_big (line 489) | def levenshtein_transformer_vaswani_wmt_en_de_big(args): function levenshtein_transformer_wmt_en_de_big_t2t (line 505) | def levenshtein_transformer_wmt_en_de_big_t2t(args): FILE: fairseq/models/nat/levenshtein_utils.py function load_libnat (line 13) | def load_libnat(): function _get_ins_targets (line 36) | def _get_ins_targets(in_tokens, out_tokens, padding_idx, unk_idx): function _get_del_targets (line 104) | def _get_del_targets(in_tokens, out_tokens, padding_idx): function _apply_ins_masks (line 155) | def _apply_ins_masks( function _apply_ins_words (line 189) | def _apply_ins_words(in_tokens, in_scores, word_ins_pred, word_ins_score... function _apply_del_words (line 203) | def _apply_del_words( function _skip (line 231) | def _skip(x, mask): function _skip_encoder_out (line 256) | def _skip_encoder_out(encoder, encoder_out, mask): function _fill (line 265) | def _fill(x, mask, y, padding_idx): FILE: fairseq/models/nat/nat_crf_transformer.py class NACRFTransformerModel (line 13) | class NACRFTransformerModel(NATransformerModel): method __init__ (line 14) | def __init__(self, args, encoder, decoder): method allow_ensemble (line 23) | def allow_ensemble(self): method add_args (line 27) | def add_args(parser): method forward (line 45) | def forward( method forward_decoder (line 88) | def forward_decoder(self, decoder_out, encoder_out, decoding_format=No... function nacrf_base_architecture (line 115) | def nacrf_base_architecture(args): FILE: fairseq/models/nat/nonautoregressive_ensembles.py class _EnsembleModelEncoder (line 20) | class _EnsembleModelEncoder(object): method __init__ (line 21) | def __init__(self, models): method reorder_encoder_out (line 24) | def reorder_encoder_out(self, encoder_outs, new_order): class BasicEnsembleModel (line 32) | class BasicEnsembleModel(torch.nn.Module): method __init__ (line 35) | def __init__(self, models): method has_encoder (line 44) | def has_encoder(self): method max_decoder_positions (line 47) | def max_decoder_positions(self): method forward_encoder (line 51) | def forward_encoder(self, encoder_input): method forward_decoder (line 57) | def forward_decoder(self, *inputs): method initialize_output_tokens (line 60) | def initialize_output_tokens(self, *inputs): class EnsembleLevT (line 64) | class EnsembleLevT(BasicEnsembleModel): method __init__ (line 67) | def __init__(self, models): method forward_decoder (line 71) | def forward_decoder( method forward_word_del (line 143) | def forward_word_del( method forward_mask_ins (line 179) | def forward_mask_ins( method forward_word_ins (line 217) | def forward_word_ins( method initialize_output_tokens (line 252) | def initialize_output_tokens(self, encoder_outs, src_tokens): FILE: fairseq/models/nat/nonautoregressive_transformer.py function _mean_pooling (line 16) | def _mean_pooling(enc_feats, src_masks): function _argmax (line 29) | def _argmax(x, dim): function _uniform_assignment (line 33) | def _uniform_assignment(src_lens, trg_lens): class NATransformerModel (line 44) | class NATransformerModel(FairseqNATModel): method allow_length_beam (line 46) | def allow_length_beam(self): method add_args (line 50) | def add_args(parser): method build_decoder (line 76) | def build_decoder(cls, args, tgt_dict, embed_tokens): method forward (line 82) | def forward( method forward_decoder (line 118) | def forward_decoder(self, decoder_out, encoder_out, decoding_format=No... method initialize_output_tokens (line 145) | def initialize_output_tokens(self, encoder_out, src_tokens): method regenerate_length_beam (line 177) | def regenerate_length_beam(self, decoder_out, beam_size): class NATransformerDecoder (line 207) | class NATransformerDecoder(FairseqNATDecoder): method __init__ (line 208) | def __init__(self, args, dictionary, embed_tokens, no_encoder_attn=Fal... method forward (line 225) | def forward(self, normalize, encoder_out, prev_output_tokens, step=0, ... method forward_length (line 235) | def forward_length(self, normalize, encoder_out): method extract_features (line 247) | def extract_features( method forward_embedding (line 331) | def forward_embedding(self, prev_output_tokens, states=None): method forward_copying_source (line 353) | def forward_copying_source(self, src_embeds, src_masks, tgt_masks): method forward_length_prediction (line 368) | def forward_length_prediction(self, length_out, encoder_out, tgt_token... function base_architecture (line 407) | def base_architecture(args): function nonautoregressive_transformer_wmt_en_de (line 455) | def nonautoregressive_transformer_wmt_en_de(args): FILE: fairseq/models/roberta/alignment_utils.py function align_bpe_to_words (line 12) | def align_bpe_to_words(roberta, bpe_tokens: torch.LongTensor, other_toke... function align_features_to_words (line 71) | def align_features_to_words(roberta, features, alignment): function spacy_nlp (line 100) | def spacy_nlp(): function spacy_tokenizer (line 111) | def spacy_tokenizer(): FILE: fairseq/models/roberta/enc_dec.py class RobertaEncDecModel (line 18) | class RobertaEncDecModel(FairseqEncoderDecoderModel): method add_args (line 20) | def add_args(parser): method build_model (line 49) | def build_model(cls, args, task): method from_roberta (line 76) | def from_roberta(roberta_enc: roberta.RobertaModel, args, dictionary): method read_args_from_roberta (line 138) | def read_args_from_roberta(roberta_args: argparse.Namespace): method upgrade_state_dict_named (line 163) | def upgrade_state_dict_named(self, state_dict, name): function base_enc_dec_architecture (line 183) | def base_enc_dec_architecture(args): FILE: fairseq/models/roberta/hub_interface.py class RobertaHubInterface (line 14) | class RobertaHubInterface(nn.Module): method __init__ (line 20) | def __init__(self, cfg, task, model): method device (line 32) | def device(self): method encode (line 35) | def encode( method decode (line 67) | def decode(self, tokens: torch.LongTensor): method extract_features (line 82) | def extract_features( method register_classification_head (line 105) | def register_classification_head( method predict (line 112) | def predict(self, head: str, tokens: torch.LongTensor, return_logits: ... method extract_features_aligned_to_words (line 119) | def extract_features_aligned_to_words( method fill_mask (line 156) | def fill_mask(self, masked_input: str, topk: int = 5): method disambiguate_pronoun (line 219) | def disambiguate_pronoun(self, sentence: str) -> bool: FILE: fairseq/models/roberta/model.py class RobertaModel (line 34) | class RobertaModel(FairseqEncoderModel): method hub_models (line 36) | def hub_models(cls): method __init__ (line 44) | def __init__(self, args, encoder): method add_args (line 54) | def add_args(parser): method build_model (line 221) | def build_model(cls, args, task): method forward (line 244) | def forward( method _get_adaptive_head_loss (line 261) | def _get_adaptive_head_loss(self): method _get_adaptive_ffn_loss (line 309) | def _get_adaptive_ffn_loss(self): method get_normalized_probs (line 321) | def get_normalized_probs(self, net_output, log_probs, sample=None): method register_classification_head (line 329) | def register_classification_head( method supported_targets (line 355) | def supported_targets(self): method from_pretrained (line 359) | def from_pretrained( method upgrade_state_dict_named (line 382) | def upgrade_state_dict_named(self, state_dict, name): class RobertaLMHead (line 470) | class RobertaLMHead(nn.Module): method __init__ (line 473) | def __init__(self, embed_dim, output_dim, activation_fn, weight=None): method forward (line 484) | def forward(self, features, masked_tokens=None, **kwargs): class RobertaClassificationHead (line 498) | class RobertaClassificationHead(nn.Module): method __init__ (line 501) | def __init__( method forward (line 526) | def forward(self, features, **kwargs): class RobertaEncoder (line 536) | class RobertaEncoder(FairseqEncoder): method __init__ (line 539) | def __init__(self, args, dictionary): method build_embedding (line 566) | def build_embedding(self, vocab_size, embedding_dim, padding_idx): method build_encoder (line 569) | def build_encoder(self, args, dictionary, embed_tokens): method build_lm_head (line 574) | def build_lm_head(self, embed_dim, output_dim, activation_fn, weight): method forward (line 577) | def forward( method extract_features (line 608) | def extract_features(self, src_tokens, return_all_hiddens=False, **kwa... method output_layer (line 619) | def output_layer(self, features, masked_tokens=None, **unused): method max_positions (line 622) | def max_positions(self): function base_architecture (line 628) | def base_architecture(args): function roberta_prenorm_architecture (line 674) | def roberta_prenorm_architecture(args): function roberta_base_architecture (line 681) | def roberta_base_architecture(args): function roberta_large_architecture (line 686) | def roberta_large_architecture(args): function xlm_architecture (line 695) | def xlm_architecture(args): FILE: fairseq/models/roberta/model_camembert.py class CamembertModel (line 16) | class CamembertModel(RobertaModel): method hub_models (line 18) | def hub_models(cls): method from_pretrained (line 31) | def from_pretrained( FILE: fairseq/models/roberta/model_gottbert.py class GottbertModel (line 16) | class GottbertModel(RobertaModel): method hub_models (line 18) | def hub_models(cls): method from_pretrained (line 24) | def from_pretrained( FILE: fairseq/models/roberta/model_xlmr.py class XLMRModel (line 16) | class XLMRModel(RobertaModel): method hub_models (line 18) | def hub_models(cls): method from_pretrained (line 27) | def from_pretrained( FILE: fairseq/models/speech_dlm/hub_interface.py class MultichannelGeneratorHubInterface (line 24) | class MultichannelGeneratorHubInterface(GeneratorHubInterface): method __init__ (line 29) | def __init__(self, cfg, task, models): method sample (line 42) | def sample( method score (line 55) | def score(self, sentences: List[Dict[str, str]], **kwargs): method generate (line 60) | def generate( method encode (line 131) | def encode(self, sentence: Dict[str, str]) -> Dict[str, torch.LongTens... method decode (line 154) | def decode(self, tokens: Dict[str, torch.LongTensor]) -> Dict[str, str]: method binarize (line 172) | def binarize(self, sentence: str, channel: str) -> torch.LongTensor: method string (line 177) | def string(self, tokens: torch.LongTensor, channel: str) -> str: method _build_batches (line 180) | def _build_batches( FILE: fairseq/models/speech_dlm/modules/speech_dlm_decoder.py class CrossChannelTransformerDecoder (line 28) | class CrossChannelTransformerDecoder(FairseqIncrementalDecoder): method __init__ (line 45) | def __init__(self, args, dictionary, embed_tokens, channels, no_encode... method build_decoder_layer (line 191) | def build_decoder_layer(self, args, no_encoder_attn=False): method build_cross_decoder_layer (line 198) | def build_cross_decoder_layer(self, args, no_encoder_attn=False): method forward (line 205) | def forward( method extract_features (line 251) | def extract_features( method extract_features_scriptable (line 277) | def extract_features_scriptable( method output_layer (line 435) | def output_layer(self, features): method max_positions (line 498) | def max_positions(self): method buffered_future_mask (line 504) | def buffered_future_mask(self, tensor): method get_normalized_probs_scriptable (line 518) | def get_normalized_probs_scriptable( method reorder_incremental_state_scripting (line 554) | def reorder_incremental_state_scripting( FILE: fairseq/models/speech_dlm/modules/speech_dlm_decoder_layer.py class CrossChannelTransformerDecoderLayer (line 17) | class CrossChannelTransformerDecoderLayer(nn.Module): method __init__ (line 32) | def __init__( method build_fc1 (line 106) | def build_fc1(self, input_dim, output_dim, q_noise, qn_block_size): method build_fc2 (line 109) | def build_fc2(self, input_dim, output_dim, q_noise, qn_block_size): method build_self_attention (line 112) | def build_self_attention( method build_cross_channel_attention (line 126) | def build_cross_channel_attention( method build_encoder_attention (line 140) | def build_encoder_attention(self, embed_dim, args): method prepare_for_onnx_export_ (line 152) | def prepare_for_onnx_export_(self): method residual_connection (line 155) | def residual_connection(self, x, residual): method forward (line 158) | def forward( method make_generation_fast_ (line 407) | def make_generation_fast_(self, need_attn: bool = False, **kwargs): class StandardTransformerDecoderLayer (line 414) | class StandardTransformerDecoderLayer(nn.Module): method __init__ (line 435) | def __init__( method build_fc1 (line 500) | def build_fc1(self, input_dim, output_dim, q_noise, qn_block_size): method build_fc2 (line 503) | def build_fc2(self, input_dim, output_dim, q_noise, qn_block_size): method build_self_attention (line 506) | def build_self_attention( method build_encoder_attention (line 520) | def build_encoder_attention(self, embed_dim, args): method prepare_for_onnx_export_ (line 532) | def prepare_for_onnx_export_(self): method residual_connection (line 535) | def residual_connection(self, x, residual): method forward (line 538) | def forward( method make_generation_fast_ (line 716) | def make_generation_fast_(self, need_attn: bool = False, **kwargs): FILE: fairseq/models/speech_dlm/sequence_generator/multichannel_search.py class MultichannelSearch (line 13) | class MultichannelSearch(nn.Module): method __init__ (line 14) | def __init__(self, tgt_dicts): method step (line 29) | def step( method set_src_lengths (line 60) | def set_src_lengths(self, src_lengths): method init_constraints (line 64) | def init_constraints(self, batch_constraints: Optional[Tensor], beam_s... method prune_sentences (line 77) | def prune_sentences(self, batch_idxs: Tensor): method update_constraints (line 88) | def update_constraints(self, active_hypos: Tensor): function unravel_index (line 102) | def unravel_index(index, shape): function topk_sum (line 110) | def topk_sum(lprobs_list, k): class MultichannelBeamSearch (line 172) | class MultichannelBeamSearch(MultichannelSearch): method __init__ (line 173) | def __init__(self, tgt_dicts): method step (line 178) | def step( class ContiguousMultichannelBeamSearch (line 230) | class ContiguousMultichannelBeamSearch(MultichannelSearch): method __init__ (line 231) | def __init__(self, tgt_dicts): method step (line 236) | def step( class ContiguousMultichannelSampling (line 285) | class ContiguousMultichannelSampling(MultichannelSearch): method __init__ (line 289) | def __init__(self, tgt_dicts, sampling_topk=-1, sampling_topp=-1.0): method _sample_topp (line 294) | def _sample_topp(self, lprobs): method step (line 340) | def step( FILE: fairseq/models/speech_dlm/sequence_generator/multichannel_sequence_generator.py class MultichannelSequenceGenerator (line 21) | class MultichannelSequenceGenerator(nn.Module): method __init__ (line 22) | def __init__( method cuda (line 147) | def cuda(self): method forward (line 152) | def forward( method generate (line 170) | def generate(self, models, sample: Dict[str, Dict[str, Tensor]], **kwa... method _generate (line 185) | def _generate( method _prefix_tokens (line 722) | def _prefix_tokens( method replicate_first_beam (line 765) | def replicate_first_beam(self, tensor, mask, beam_size: int): method finalize_hypos (line 770) | def finalize_hypos( method is_finished (line 888) | def is_finished( class MultichannelEnsembleModel (line 907) | class MultichannelEnsembleModel(nn.Module): method __init__ (line 910) | def __init__(self, models): method forward (line 935) | def forward(self): method has_encoder (line 938) | def has_encoder(self): method has_incremental_states (line 941) | def has_incremental_states(self): method max_decoder_positions (line 944) | def max_decoder_positions(self): method forward_encoder (line 948) | def forward_encoder(self, net_input: Dict[str, Tensor]): method forward_decoder (line 954) | def forward_decoder( method reorder_encoder_out (line 1076) | def reorder_encoder_out( method reorder_incremental_state (line 1100) | def reorder_incremental_state( FILE: fairseq/models/speech_dlm/speech_dlm.py class SpeechDLMConfig (line 28) | class SpeechDLMConfig(FairseqDataclass): class SpeechDLM (line 128) | class SpeechDLM(FairseqLanguageModel): method __init__ (line 133) | def __init__(self, decoder): method build_model (line 137) | def build_model(cls, args, task): method build_embedding (line 177) | def build_embedding(cls, args, dictionary, embed_dim, path=None): method from_pretrained (line 182) | def from_pretrained( method supported_targets (line 225) | def supported_targets(self): function base_lm_architecture (line 229) | def base_lm_architecture(args): function speech_dlm_big (line 274) | def speech_dlm_big(args): FILE: fairseq/models/speech_to_speech/modules/ctc_decoder.py class CTCDecoder (line 11) | class CTCDecoder(FairseqEncoder): method __init__ (line 12) | def __init__(self, dictionary, in_dim): method forward (line 16) | def forward(self, src_tokens, src_lengths=None, **kwargs): FILE: fairseq/models/speech_to_speech/modules/stacked_embedding.py class StackedEmbedding (line 12) | class StackedEmbedding(nn.Embedding): method __init__ (line 15) | def __init__(self, num_embeddings, embed_dim, padding_idx, num_stacked... method forward (line 30) | def forward(self, input): FILE: fairseq/models/speech_to_speech/modules/transformer_decoder_aug.py class AugTransformerUnitDecoder (line 14) | class AugTransformerUnitDecoder(AugTransformerDecoder): method __init__ (line 17) | def __init__( method forward (line 40) | def forward( method upgrade_state_dict_named (line 97) | def upgrade_state_dict_named(self, state_dict, name): FILE: fairseq/models/speech_to_speech/modules/transformer_encoder.py class TransformerEncoderNoEmb (line 12) | class TransformerEncoderNoEmb(FairseqEncoder): method __init__ (line 15) | def __init__(self, args): method forward (line 26) | def forward(self, x, encoder_padding_mask, return_all_hiddens=False): method reorder_encoder_out (line 49) | def reorder_encoder_out(self, encoder_out, new_order): FILE: fairseq/models/speech_to_speech/s2s_conformer.py function build_s2s_conformer_encoder (line 25) | def build_s2s_conformer_encoder(args): class S2SConformerEncoder (line 41) | class S2SConformerEncoder(S2TConformerEncoder): method __init__ (line 45) | def __init__(self, args): method forward (line 54) | def forward( class S2UTConformerModel (line 70) | class S2UTConformerModel(S2UTTransformerModel): method add_args (line 76) | def add_args(parser): method build_encoder (line 98) | def build_encoder(cls, args): class S2SpecTConformerModel (line 103) | class S2SpecTConformerModel(S2SpecTTransformerModel): method add_args (line 109) | def add_args(parser): method build_encoder (line 126) | def build_encoder(cls, args): function s2ut_conformer_architecture_base (line 131) | def s2ut_conformer_architecture_base(args): function s2spect_conformer_architecture_base (line 147) | def s2spect_conformer_architecture_base(args): function s2spect_architecture_fisher (line 163) | def s2spect_architecture_fisher(args): FILE: fairseq/models/speech_to_speech/s2s_conformer_translatotron2.py class S2SpecT2ConformerModel (line 34) | class S2SpecT2ConformerModel(S2SpecTConformerModel): method add_args (line 40) | def add_args(parser): method build_multitask_decoder (line 64) | def build_multitask_decoder( method build_decoder (line 108) | def build_decoder(cls, args): method build_model (line 118) | def build_model(cls, args, task): method build_text_encoder (line 168) | def build_text_encoder(cls, args): method forward (line 177) | def forward( function s2spect2_conformer_architecture_base (line 243) | def s2spect2_conformer_architecture_base(args): function s2spect2_conformer_architecture_base_legacy (line 261) | def s2spect2_conformer_architecture_base_legacy(args): FILE: fairseq/models/speech_to_speech/s2s_conformer_unity.py function multitask_text_transformer_decoder_arch (line 35) | def multitask_text_transformer_decoder_arch( class UnityConformerModel (line 45) | class UnityConformerModel(S2UTConformerModel): method add_args (line 51) | def add_args(parser): method build_multitask_decoder (line 81) | def build_multitask_decoder( method build_decoder (line 125) | def build_decoder(cls, args, tgt_dict, aug_attn=False): method build_model (line 146) | def build_model(cls, args, task): method build_text_encoder (line 204) | def build_text_encoder(cls, args): method forward (line 213) | def forward( function unity_conformer_architecture_base (line 279) | def unity_conformer_architecture_base(args): function unity_conformer_architecture_base_legacy (line 297) | def unity_conformer_architecture_base_legacy(args): FILE: fairseq/models/speech_to_speech/s2s_transformer.py class S2STransformerEncoder (line 30) | class S2STransformerEncoder(S2TTransformerEncoder): method __init__ (line 34) | def __init__(self, args): method forward (line 43) | def forward( class TransformerUnitDecoder (line 58) | class TransformerUnitDecoder(TransformerDecoder): method __init__ (line 61) | def __init__( method forward (line 84) | def forward( method upgrade_state_dict_named (line 139) | def upgrade_state_dict_named(self, state_dict, name): class S2STransformerMultitaskModelBase (line 153) | class S2STransformerMultitaskModelBase(FairseqEncoderDecoderModel): method build_encoder (line 155) | def build_encoder(cls, args): method build_multitask_decoder (line 171) | def build_multitask_decoder(cls, args, tgt_dict, in_dim): method build_model (line 198) | def build_model(cls, args, task): method forward_encoder (line 231) | def forward_encoder(self, src_tokens, src_lengths, speaker=None, **kwa... class S2UTTransformerModel (line 238) | class S2UTTransformerModel(S2STransformerMultitaskModelBase): method add_args (line 245) | def add_args(parser): method build_decoder (line 384) | def build_decoder(cls, args, tgt_dict): method forward (line 400) | def forward( class S2SpecTTransformerModel (line 427) | class S2SpecTTransformerModel(S2STransformerMultitaskModelBase): method add_args (line 433) | def add_args(parser): method build_decoder (line 547) | def build_decoder(cls, args): method forward (line 550) | def forward( function base_multitask_text_transformer_decoder_arch (line 582) | def base_multitask_text_transformer_decoder_arch(args): function base_s2st_transformer_encoder_architecture (line 619) | def base_s2st_transformer_encoder_architecture(args): function s2ut_architecture_base (line 647) | def s2ut_architecture_base(args): function s2ut_architecture_fisher (line 677) | def s2ut_architecture_fisher(args): function s2spect_architecture_base (line 688) | def s2spect_architecture_base(args): function s2spect_architecture_fisher (line 713) | def s2spect_architecture_fisher(args): FILE: fairseq/models/speech_to_text/berard.py class BerardModel (line 22) | class BerardModel(FairseqEncoderDecoderModel): method __init__ (line 38) | def __init__(self, encoder, decoder): method add_args (line 42) | def add_args(parser): method build_encoder (line 125) | def build_encoder(cls, args, task): method build_decoder (line 142) | def build_decoder(cls, args, task): method build_model (line 160) | def build_model(cls, args, task): method get_normalized_probs (line 167) | def get_normalized_probs(self, net_output, log_probs, sample=None): class BerardEncoder (line 175) | class BerardEncoder(FairseqEncoder): method __init__ (line 176) | def __init__( method forward (line 253) | def forward(self, src_tokens, src_lengths=None, **kwargs): method reorder_encoder_out (line 306) | def reorder_encoder_out(self, encoder_out, new_order): class MLPAttention (line 316) | class MLPAttention(nn.Module): method __init__ (line 324) | def __init__(self, decoder_hidden_state_dim, context_dim, attention_dim): method forward (line 338) | def forward(self, decoder_state, source_hids, encoder_padding_mask): class LSTMDecoder (line 379) | class LSTMDecoder(FairseqIncrementalDecoder): method __init__ (line 380) | def __init__( method forward (line 435) | def forward( method reorder_incremental_state (line 530) | def reorder_incremental_state(self, incremental_state, new_order): function berard (line 548) | def berard(args): function berard_256_3_3 (line 571) | def berard_256_3_3(args): function berard_512_3_2 (line 585) | def berard_512_3_2(args): function berard_512_5_3 (line 598) | def berard_512_5_3(args): FILE: fairseq/models/speech_to_text/convtransformer.py class ConvTransformerModel (line 31) | class ConvTransformerModel(FairseqEncoderDecoderModel): method __init__ (line 37) | def __init__(self, encoder, decoder): method add_args (line 41) | def add_args(parser): method build_encoder (line 163) | def build_encoder(cls, args): method build_decoder (line 172) | def build_decoder(cls, args, task, embed_tokens): method build_model (line 181) | def build_model(cls, args, task): method set_batch_first (line 201) | def set_batch_first(lprobs): method get_normalized_probs (line 204) | def get_normalized_probs( method output_layout (line 216) | def output_layout(self): method forward (line 225) | def forward(self, src_tokens, src_lengths, prev_output_tokens): class ConvTransformerEncoder (line 233) | class ConvTransformerEncoder(FairseqEncoder): method __init__ (line 236) | def __init__(self, args): method pooling_ratio (line 279) | def pooling_ratio(self): method forward (line 282) | def forward(self, src_tokens, src_lengths): method reorder_encoder_out (line 334) | def reorder_encoder_out(self, encoder_out: Dict[str, List[Tensor]], ne... class TransformerDecoderNoExtra (line 373) | class TransformerDecoderNoExtra(TransformerDecoder): method extract_features (line 374) | def extract_features( function base_architecture (line 396) | def base_architecture(args): function convtransformer_espnet (line 439) | def convtransformer_espnet(args): FILE: fairseq/models/speech_to_text/hub_interface.py class S2THubInterface (line 24) | class S2THubInterface(nn.Module): method __init__ (line 25) | def __init__(self, cfg, task, model): method get_model_input (line 34) | def get_model_input(cls, task, audio: Union[str, torch.Tensor]): method detokenize (line 72) | def detokenize(cls, task, tokens): method get_prefix_token (line 79) | def get_prefix_token(cls, task, lang): method get_prediction (line 89) | def get_prediction( method predict (line 112) | def predict( FILE: fairseq/models/speech_to_text/modules/augmented_memory_attention.py class AugmentedMemoryConvTransformerEncoder (line 27) | class AugmentedMemoryConvTransformerEncoder(ConvTransformerEncoder): method __init__ (line 28) | def __init__(self, args): method stride (line 48) | def stride(self): method forward (line 53) | def forward(self, src_tokens, src_lengths, states=None): class AugmentedMemoryTransformerEncoderLayer (line 121) | class AugmentedMemoryTransformerEncoderLayer(TransformerEncoderLayer): method __init__ (line 122) | def __init__(self, args): method forward (line 128) | def forward(self, x, state): method build_self_attention (line 173) | def build_self_attention(self, embed_dim, args): class AugmentedMemoryMultiheadAttention (line 189) | class AugmentedMemoryMultiheadAttention(MultiheadAttention): method __init__ (line 197) | def __init__( method forward (line 248) | def forward(self, input_and_summary, state): method suppress_mem_on_mem_attention (line 340) | def suppress_mem_on_mem_attention( class SequenceEncoder (line 360) | class SequenceEncoder(FairseqEncoder): method __init__ (line 381) | def __init__(self, args, module): method forward (line 391) | def forward( method incremental_encode (line 438) | def incremental_encode( function augmented_memory (line 459) | def augmented_memory(klass): FILE: fairseq/models/speech_to_text/modules/convolution.py class Conv1dSubsampler (line 13) | class Conv1dSubsampler(nn.Module): method __init__ (line 25) | def __init__( method get_out_seq_lens_tensor (line 45) | def get_out_seq_lens_tensor(self, in_seq_lens_tensor): method forward (line 51) | def forward(self, src_tokens, src_lengths): function infer_conv_output_dim (line 62) | def infer_conv_output_dim(in_channels, input_dim, out_channels): class Conv2dSubsampler (line 73) | class Conv2dSubsampler(nn.Module): method __init__ (line 84) | def __init__( method forward (line 112) | def forward(self, src_tokens, src_lengths): FILE: fairseq/models/speech_to_text/modules/emformer.py class RelativePositionEmbedding (line 43) | class RelativePositionEmbedding(nn.Module): method __init__ (line 48) | def __init__(self, head_dim, max_position, norm_init=True): method forward (line 58) | def forward(self, input: Tensor): class Fp32LayerNorm (line 63) | class Fp32LayerNorm(nn.Module): method __init__ (line 64) | def __init__( method forward (line 80) | def forward(self, input): class PositionwiseFF (line 100) | class PositionwiseFF(nn.Module): method __init__ (line 114) | def __init__( method forward (line 139) | def forward(self, input): method quantize_ (line 145) | def quantize_(self, params=None): class SummarizationLayer (line 161) | class SummarizationLayer(nn.Module): method __init__ (line 162) | def __init__(self, method, segment_size, embedding_dim): method forward (line 200) | def forward(self, input): class NoSegAugmentedMemoryMultiheadAttentionBmm (line 237) | class NoSegAugmentedMemoryMultiheadAttentionBmm(nn.Module): method __init__ (line 291) | def __init__( method prepare_qkv (line 365) | def prepare_qkv( method prepare_attention_weights (line 410) | def prepare_attention_weights( method prepare_attention_output (line 448) | def prepare_attention_output( method forward (line 506) | def forward( method forward_jit (line 630) | def forward_jit( method quantize_ (line 733) | def quantize_(self, params=None): class NoSegAugmentedMemoryTransformer (line 744) | class NoSegAugmentedMemoryTransformer(nn.Module): method __init__ (line 752) | def __init__( method set_mini_batches (line 806) | def set_mini_batches(self, mini_batches): method gen_summary_queries (line 809) | def gen_summary_queries(self, input): method pre_attention_ops (line 813) | def pre_attention_ops(self, input, right_context_blocks): method after_attention_ops (line 824) | def after_attention_ops(self, attention_output, residual_input): method forward_jit (line 832) | def forward_jit( method forward (line 873) | def forward( class NoSegAugmentedMemoryTransformerEncoderLayer (line 919) | class NoSegAugmentedMemoryTransformerEncoderLayer(FairseqEncoder): method __init__ (line 960) | def __init__( method set_mini_batches (line 1050) | def set_mini_batches(self, mini_batches): method _get_relative_position (line 1056) | def _get_relative_position( method _get_attention_mask (line 1142) | def _get_attention_mask(self, input, past_length=0, left_context_cache... method init_state (line 1276) | def init_state( method batch_state (line 1305) | def batch_state(self, states: List[List[Tensor]]) -> List[Tensor]: method reorder_state (line 1341) | def reorder_state(self, state: List[Tensor], indices: Tensor) -> List[... method reset_state (line 1353) | def reset_state(self, state: List[Tensor], indices: Tensor) -> List[Te... method state_size (line 1363) | def state_size(self) -> int: method batch_size_in_state (line 1367) | def batch_size_in_state( method gen_summary_queries (line 1374) | def gen_summary_queries(self, input): method _gen_right_context_padded_input (line 1378) | def _gen_right_context_padded_input(self, input): method _gen_segs_right_context (line 1395) | def _gen_segs_right_context(self, input, lengths): method forward (line 1420) | def forward( method forward_jit_mini_batch_init (line 1475) | def forward_jit_mini_batch_init( method state_update_before (line 1511) | def state_update_before( method state_update_after (line 1519) | def state_update_after( method state_update_after_loop (line 1546) | def state_update_after_loop( method forward_mini_batches (line 1561) | def forward_mini_batches( method forward_jit_test (line 1646) | def forward_jit_test( method forward_jit (line 1679) | def forward_jit( method quantize_ (line 1776) | def quantize_(self, params=None): function emformer_encoder (line 1791) | def emformer_encoder(klass): FILE: fairseq/models/speech_to_text/multi_modality_model.py class MultiModalityEncoder (line 11) | class MultiModalityEncoder(FairseqEncoder): method __init__ (line 12) | def __init__(self, dictionary): method select_encoder (line 15) | def select_encoder(self, mode, **kwargs): method forward (line 24) | def forward(self, src_tokens, src_lengths=None, mode="", **kwargs): class MultiInputDecoder (line 32) | class MultiInputDecoder(FairseqDecoder): method __init__ (line 33) | def __init__(self, dictionary): method select_decoder (line 36) | def select_decoder(self, mode, **kwargs): method forward (line 40) | def forward( FILE: fairseq/models/speech_to_text/s2t_conformer.py class S2TConformerEncoder (line 32) | class S2TConformerEncoder(FairseqEncoder): method __init__ (line 35) | def __init__(self, args): method _forward (line 91) | def _forward(self, src_tokens, src_lengths, return_all_hiddens=False): method forward (line 140) | def forward(self, src_tokens, src_lengths, return_all_hiddens=False): method reorder_encoder_out (line 156) | def reorder_encoder_out(self, encoder_out, new_order): method set_num_updates (line 160) | def set_num_updates(self, num_updates): class S2TConformerModel (line 166) | class S2TConformerModel(S2TTransformerModel): method __init__ (line 167) | def __init__(self, encoder, decoder): method add_args (line 171) | def add_args(parser): method build_encoder (line 205) | def build_encoder(cls, args): function conformer_base_architecture (line 222) | def conformer_base_architecture(args): FILE: fairseq/models/speech_to_text/s2t_transformer.py class S2TTransformerModel (line 40) | class S2TTransformerModel(FairseqEncoderDecoderModel): method hub_models (line 48) | def hub_models(cls): method from_pretrained (line 58) | def from_pretrained( method __init__ (line 78) | def __init__(self, encoder, decoder): method add_args (line 82) | def add_args(parser): method build_encoder (line 215) | def build_encoder(cls, args): method build_decoder (line 231) | def build_decoder(cls, args, task, embed_tokens): method build_model (line 235) | def build_model(cls, args, task): method get_normalized_probs (line 254) | def get_normalized_probs( method get_ctc_target (line 265) | def get_ctc_target(self, sample: Optional[Dict[str, Tensor]]): method get_ctc_output (line 268) | def get_ctc_output( method forward (line 282) | def forward(self, src_tokens, src_lengths, prev_output_tokens): class S2TTransformerEncoder (line 295) | class S2TTransformerEncoder(FairseqEncoder): method __init__ (line 299) | def __init__(self, args): method _forward (line 345) | def _forward(self, src_tokens, src_lengths, return_all_hiddens=False): method forward (line 375) | def forward(self, src_tokens, src_lengths, return_all_hiddens=False): method reorder_encoder_out (line 387) | def reorder_encoder_out(self, encoder_out, new_order): method set_num_updates (line 425) | def set_num_updates(self, num_updates): class TransformerDecoderScriptable (line 430) | class TransformerDecoderScriptable(TransformerDecoder): method extract_features (line 431) | def extract_features( function base_architecture (line 454) | def base_architecture(args): function s2t_transformer_s (line 499) | def s2t_transformer_s(args): function s2t_transformer_xs (line 509) | def s2t_transformer_xs(args): function s2t_transformer_sp (line 518) | def s2t_transformer_sp(args): function s2t_transformer_m (line 524) | def s2t_transformer_m(args): function s2t_transformer_mp (line 534) | def s2t_transformer_mp(args): function s2t_transformer_l (line 540) | def s2t_transformer_l(args): function s2t_transformer_lp (line 550) | def s2t_transformer_lp(args): FILE: fairseq/models/speech_to_text/s2t_wav_transformer.py class SpeechWavTransformerEncoder (line 17) | class SpeechWavTransformerEncoder(FairseqEncoder): method add_args (line 21) | def add_args(parser): method __init__ (line 166) | def __init__(self, args, alway_mask=False): method _get_feat_extract_output_lengths (line 239) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method apply_mask (line 256) | def apply_mask(self, x, padding_mask): method forward (line 296) | def forward( method reorder_encoder_out (line 397) | def reorder_encoder_out(self, encoder_out, new_order): class StackedSpeechWavTransformerEncoder (line 436) | class StackedSpeechWavTransformerEncoder(FairseqEncoder): method __init__ (line 437) | def __init__(self, speech_enc, text_enc_layers, text_layer_norm): method forward (line 443) | def forward( method reorder_encoder_out (line 503) | def reorder_encoder_out(self, encoder_out, new_order): FILE: fairseq/models/speech_to_text/utils.py function assert_equal (line 22) | def assert_equal(value1, value2, name1=None, name2=None): function fill_config (line 37) | def fill_config(config, key, value): function check_and_return_expected (line 49) | def check_and_return_expected(value, undefined_value, expected_value, na... function get_time_axis (line 71) | def get_time_axis(layout): function get_batch_axis (line 90) | def get_batch_axis(layout): function monotonically_increasing_and_bounded (line 106) | def monotonically_increasing_and_bounded(iterable, min=None, max=None): function to_pair (line 132) | def to_pair(value, name): function infer_conv_output_attrs (line 151) | def infer_conv_output_attrs( class NoOp (line 167) | class NoOp(torch.nn.Module): method __init__ (line 172) | def __init__(self): method forward (line 175) | def forward(self, input: Tensor) -> Tensor: class Permute (line 184) | class Permute(torch.nn.Module): method __init__ (line 185) | def __init__(self, dims): method forward (line 189) | def forward(self, input: Tensor) -> Tensor: function lengths_to_padding_mask (line 198) | def lengths_to_padding_mask(lengths: Tensor) -> Tensor: function lengths_to_attention_mask (line 214) | def lengths_to_attention_mask( function infer_output_norm (line 295) | def infer_output_norm(module, output_norm=None): function infer_channels_from_layout (line 342) | def infer_channels_from_layout(layout, channels): function pad_sequence (line 362) | def pad_sequence( function sequence_to_segments (line 407) | def sequence_to_segments( function segments_to_sequence (line 460) | def segments_to_sequence( function lengths_to_encoder_padding_mask (line 481) | def lengths_to_encoder_padding_mask(lengths, batch_first: bool = False): function attention_suppression (line 523) | def attention_suppression(attention_weights: Tensor, scale: float): function layer_norm_backward_hook (line 561) | def layer_norm_backward_hook(module, grad_input, grad_output, clamp_value): FILE: fairseq/models/speech_to_text/xm_transformer.py function build_embedding (line 38) | def build_embedding(dictionary, embed_dim): class Conv1dAdaptor (line 44) | class Conv1dAdaptor(nn.Module): method __init__ (line 45) | def __init__( method add_args (line 86) | def add_args(cls, parser): method forward (line 94) | def forward(self, x, padding_mask: Optional[torch.Tensor]): function add_wav2vec_asr_args (line 131) | def add_wav2vec_asr_args(parser): function need_finetuning (line 257) | def need_finetuning(ft_params, param_name): class Wav2VecEncoderWithAdaptor (line 267) | class Wav2VecEncoderWithAdaptor(FairseqEncoder): method build_adaptor (line 268) | def build_adaptor(self, args): method __init__ (line 283) | def __init__(self, args): method add_args (line 299) | def add_args(cls, parser): method set_num_updates (line 317) | def set_num_updates(self, num_updates): method forward (line 321) | def forward(self, src_tokens, src_lengths=None, **kwargs): method reorder_encoder_out (line 349) | def reorder_encoder_out(self, encoder_out, new_order): function add_decoder_args (line 388) | def add_decoder_args(parser): function remove_weight_norm_from_model (line 472) | def remove_weight_norm_from_model(model): class XMTransformerModel (line 490) | class XMTransformerModel(FairseqEncoderDecoderModel): method hub_models (line 492) | def hub_models(cls): method from_pretrained (line 520) | def from_pretrained( method __init__ (line 544) | def __init__(self, encoder, decoder): method add_args (line 548) | def add_args(cls, parser): method maybe_load_pretrained (line 557) | def maybe_load_pretrained(cls, component, checkpoint: Optional[str] = ... method build_encoder (line 569) | def build_encoder(cls, args): method get_decoder_args_from_checkpoint (line 599) | def get_decoder_args_from_checkpoint(cls, ckpt_args): method override_decoder_args (line 609) | def override_decoder_args(cls, cli_args, decoder_args_dict): method build_decoder (line 620) | def build_decoder(cls, args, task, embed_tokens): method build_model (line 639) | def build_model(cls, args, task): method build_multitask_decoder (line 680) | def build_multitask_decoder( method get_normalized_probs (line 720) | def get_normalized_probs( method forward (line 728) | def forward( method upgrade_state_dict (line 755) | def upgrade_state_dict(self, state_dict): function set_default_w2v_encoder_args (line 763) | def set_default_w2v_encoder_args(args): function set_default_adaptor_args (line 796) | def set_default_adaptor_args(args): function set_default_transformer_decoder_args (line 805) | def set_default_transformer_decoder_args(args): function set_default_general_args (line 843) | def set_default_general_args(args): function base_architecture (line 851) | def base_architecture(args): FILE: fairseq/models/speech_to_text/xm_transformer_unity.py function unit_transformer_decoder_arch_base (line 37) | def unit_transformer_decoder_arch_base( function unit_transformer_decoder_arch_large (line 50) | def unit_transformer_decoder_arch_large( class XMTransformerModelUnitY (line 64) | class XMTransformerModelUnitY(XMTransformerModel): method hub_models (line 66) | def hub_models(cls): method __init__ (line 71) | def __init__(self, encoder, decoder): method add_args (line 75) | def add_args(cls, parser): method build_text_decoder (line 106) | def build_text_decoder(cls, args, tgt_dict): method build_decoder (line 130) | def build_decoder(cls, args, task, aug_attn=False): method build_model (line 162) | def build_model(cls, args, task): method build_t2u_encoder (line 219) | def build_t2u_encoder(cls, args): method forward (line 228) | def forward( function base_architecture_unity (line 300) | def base_architecture_unity(args): function base_architecture_unity_legacy (line 314) | def base_architecture_unity_legacy(args): FILE: fairseq/models/text_to_speech/codehifigan.py class CodeGenerator (line 9) | class CodeGenerator(Generator): method __init__ (line 10) | def __init__(self, cfg): method _upsample (line 34) | def _upsample(signal, max_frames): method forward (line 56) | def forward(self, **kwargs): FILE: fairseq/models/text_to_speech/fastspeech2.py function model_init (line 31) | def model_init(m): function Embedding (line 36) | def Embedding(num_embeddings, embedding_dim, padding_idx=None): class PositionwiseFeedForward (line 42) | class PositionwiseFeedForward(nn.Module): method __init__ (line 43) | def __init__(self, in_dim, hidden_dim, kernel_size, dropout): method forward (line 65) | def forward(self, x): class FFTLayer (line 73) | class FFTLayer(torch.nn.Module): method __init__ (line 74) | def __init__( method forward (line 86) | def forward(self, x, padding_mask=None): class LengthRegulator (line 98) | class LengthRegulator(nn.Module): method forward (line 99) | def forward(self, x, durations): class VariancePredictor (line 117) | class VariancePredictor(nn.Module): method __init__ (line 118) | def __init__(self, args): method forward (line 145) | def forward(self, x): class VarianceAdaptor (line 154) | class VarianceAdaptor(nn.Module): method __init__ (line 155) | def __init__(self, args): method get_pitch_emb (line 169) | def get_pitch_emb(self, x, tgt=None, factor=1.0): method get_energy_emb (line 179) | def get_energy_emb(self, x, tgt=None, factor=1.0): method forward (line 189) | def forward( class FastSpeech2Encoder (line 219) | class FastSpeech2Encoder(FairseqEncoder): method __init__ (line 220) | def __init__(self, args, src_dict, embed_speaker): method forward (line 287) | def forward( class FastSpeech2Model (line 328) | class FastSpeech2Model(FairseqEncoderModel): method hub_models (line 336) | def hub_models(cls): method from_pretrained (line 345) | def from_pretrained( method add_args (line 370) | def add_args(parser): method __init__ (line 396) | def __init__(self, encoder, args, src_dict): method build_model (line 406) | def build_model(cls, args, task): method set_num_updates (line 411) | def set_num_updates(self, num_updates): method get_normalized_probs (line 415) | def get_normalized_probs(self, net_output, log_probs, sample=None): function base_architecture (line 424) | def base_architecture(args): FILE: fairseq/models/text_to_speech/hifigan.py function init_weights (line 10) | def init_weights(m, mean=0.0, std=0.01): function get_padding (line 16) | def get_padding(kernel_size, dilation=1): class ResBlock (line 20) | class ResBlock(torch.nn.Module): method __init__ (line 21) | def __init__(self, channels, kernel_size=3, dilation=(1, 3, 5)): method forward (line 95) | def forward(self, x): method remove_weight_norm (line 104) | def remove_weight_norm(self): class Generator (line 111) | class Generator(torch.nn.Module): method __init__ (line 112) | def __init__(self, cfg): method forward (line 154) | def forward(self, x): method remove_weight_norm (line 172) | def remove_weight_norm(self): FILE: fairseq/models/text_to_speech/hub_interface.py class TTSHubInterface (line 17) | class TTSHubInterface(nn.Module): method __init__ (line 18) | def __init__(self, cfg, task, model): method phonemize (line 29) | def phonemize( method tokenize (line 72) | def tokenize(cls, text: str, tkn_cfg: Dict[str, str]): method update_cfg_with_data_cfg (line 85) | def update_cfg_with_data_cfg(cls, cfg, data_cfg): method get_model_input (line 89) | def get_model_input( method get_prediction (line 131) | def get_prediction(cls, task, model, generator, sample) -> Tuple[torch... method predict (line 135) | def predict( class VocoderHubInterface (line 142) | class VocoderHubInterface(nn.Module): method __init__ (line 145) | def __init__(self, cfg, model): method get_model_input (line 158) | def get_model_input( method get_prediction (line 177) | def get_prediction(self, sample, dur_prediction: Optional[bool] = True): method predict (line 181) | def predict( FILE: fairseq/models/text_to_speech/tacotron2.py function encoder_init (line 25) | def encoder_init(m): class Tacotron2Encoder (line 30) | class Tacotron2Encoder(FairseqEncoder): method __init__ (line 31) | def __init__(self, args, src_dict, embed_speaker): method forward (line 71) | def forward(self, src_tokens, src_lengths=None, speaker=None, **kwargs): class Prenet (line 96) | class Prenet(nn.Module): method __init__ (line 97) | def __init__(self, in_dim, n_layers, n_units, dropout): method forward (line 105) | def forward(self, x): class Postnet (line 111) | class Postnet(nn.Module): method __init__ (line 112) | def __init__(self, in_dim, n_channels, kernel_size, n_layers, dropout): method forward (line 136) | def forward(self, x): function decoder_init (line 143) | def decoder_init(m): class Tacotron2Decoder (line 148) | class Tacotron2Decoder(FairseqIncrementalDecoder): method __init__ (line 149) | def __init__(self, args, src_dict): method _get_states (line 204) | def _get_states(self, incremental_state, enc_out): method _get_init_attn_c (line 234) | def _get_init_attn_c(self, enc_out, enc_mask): method forward (line 245) | def forward( class Tacotron2Model (line 306) | class Tacotron2Model(FairseqEncoderDecoderModel): method add_args (line 312) | def add_args(parser): method __init__ (line 337) | def __init__(self, *args, **kwargs): method build_model (line 342) | def build_model(cls, args, task): method forward_encoder (line 348) | def forward_encoder(self, src_tokens, src_lengths, **kwargs): method set_num_updates (line 351) | def set_num_updates(self, num_updates): function base_architecture (line 357) | def base_architecture(args): FILE: fairseq/models/text_to_speech/tts_transformer.py function encoder_init (line 34) | def encoder_init(m): function Embedding (line 39) | def Embedding(num_embeddings, embedding_dim): class TTSTransformerEncoder (line 45) | class TTSTransformerEncoder(FairseqEncoder): method __init__ (line 46) | def __init__(self, args, src_dict, embed_speaker): method forward (line 94) | def forward(self, src_tokens, src_lengths=None, speaker=None, **kwargs): function decoder_init (line 134) | def decoder_init(m): class TTSTransformerDecoder (line 139) | class TTSTransformerDecoder(FairseqIncrementalDecoder): method __init__ (line 140) | def __init__(self, args, src_dict, padding_idx=1): method extract_features (line 189) | def extract_features( method forward (line 262) | def forward( method get_normalized_probs (line 294) | def get_normalized_probs(self, net_output, log_probs, sample): method buffered_future_mask (line 301) | def buffered_future_mask(self, tensor): class TTSTransformerModel (line 317) | class TTSTransformerModel(FairseqEncoderDecoderModel): method hub_models (line 323) | def hub_models(cls): method from_pretrained (line 339) | def from_pretrained( method add_args (line 364) | def add_args(parser): method __init__ (line 397) | def __init__(self, *args, **kwargs): method build_model (line 402) | def build_model(cls, args, task): method forward_encoder (line 408) | def forward_encoder(self, src_tokens, src_lengths, speaker=None, **kwa... method set_num_updates (line 413) | def set_num_updates(self, num_updates): function base_architecture (line 419) | def base_architecture(args): FILE: fairseq/models/text_to_speech/vocoder.py class PseudoInverseMelScale (line 30) | class PseudoInverseMelScale(torch.nn.Module): method __init__ (line 31) | def __init__(self, n_stft, n_mels, sample_rate, f_min, f_max) -> None: method forward (line 38) | def forward(self, melspec: torch.Tensor) -> torch.Tensor: class GriffinLim (line 53) | class GriffinLim(torch.nn.Module): method __init__ (line 54) | def __init__( method get_window_sum_square (line 80) | def get_window_sum_square( method inverse (line 91) | def inverse(self, magnitude: torch.Tensor, phase) -> torch.Tensor: method forward (line 110) | def forward(self, specgram: torch.Tensor) -> torch.Tensor: class GriffinLimVocoder (line 121) | class GriffinLimVocoder(nn.Module): method __init__ (line 122) | def __init__( method forward (line 159) | def forward(self, x): method from_data_cfg (line 170) | def from_data_cfg(cls, args, data_cfg: S2TDataConfig): class HiFiGANVocoder (line 187) | class HiFiGANVocoder(nn.Module): method __init__ (line 188) | def __init__( method forward (line 199) | def forward(self, x: torch.Tensor) -> torch.Tensor: method from_data_cfg (line 208) | def from_data_cfg(cls, args, data_cfg: S2TDataConfig): class CodeHiFiGANVocoder (line 217) | class CodeHiFiGANVocoder(BaseFairseqModel): method __init__ (line 218) | def __init__( method forward (line 234) | def forward(self, x: Dict[str, torch.Tensor], dur_prediction=False) ->... method from_data_cfg (line 249) | def from_data_cfg(cls, args, data_cfg): method hub_models (line 257) | def hub_models(cls): method from_pretrained (line 267) | def from_pretrained( function get_vocoder (line 297) | def get_vocoder(args, data_cfg: S2TDataConfig): FILE: fairseq/models/transformer/transformer_base.py class TransformerModelBase (line 28) | class TransformerModelBase(FairseqEncoderDecoderModel): method __init__ (line 45) | def __init__(self, cfg, encoder, decoder): method add_args (line 51) | def add_args(cls, parser): method build_model (line 59) | def build_model(cls, cfg, task): method build_embedding (line 119) | def build_embedding(cls, cfg, dictionary, embed_dim, path=None): method build_encoder (line 131) | def build_encoder(cls, cfg, src_dict, embed_tokens): method build_decoder (line 135) | def build_decoder(cls, cfg, tgt_dict, embed_tokens): method forward (line 145) | def forward( method get_normalized_probs (line 179) | def get_normalized_probs( function Embedding (line 189) | def Embedding(num_embeddings, embedding_dim, padding_idx): FILE: fairseq/models/transformer/transformer_config.py class EncDecBaseConfig (line 26) | class EncDecBaseConfig(FairseqDataclass): class DecoderConfig (line 61) | class DecoderConfig(EncDecBaseConfig): method __post_init__ (line 70) | def __post_init__(self): class QuantNoiseConfig (line 79) | class QuantNoiseConfig(FairseqDataclass): class TransformerConfig (line 97) | class TransformerConfig(FairseqDataclass): method __getattr__ (line 245) | def __getattr__(self, name): method __setattr__ (line 252) | def __setattr__(self, name, value): method _copy_keys (line 261) | def _copy_keys(args, cls, prefix, seen): method from_namespace (line 280) | def from_namespace(cls, args): FILE: fairseq/models/transformer/transformer_decoder.py function module_name_fordropout (line 32) | def module_name_fordropout(module_name: str) -> str: class TransformerDecoderBase (line 39) | class TransformerDecoderBase(FairseqIncrementalDecoder): method __init__ (line 52) | def __init__( method build_output_projection (line 142) | def build_output_projection(self, cfg, dictionary, embed_tokens): method build_decoder_layer (line 174) | def build_decoder_layer(self, cfg, no_encoder_attn=False): method forward (line 186) | def forward( method extract_features (line 230) | def extract_features( method extract_features_scriptable (line 254) | def extract_features_scriptable( method output_layer (line 372) | def output_layer(self, features): method max_positions (line 380) | def max_positions(self): method buffered_future_mask (line 386) | def buffered_future_mask(self, tensor): method upgrade_state_dict_named (line 400) | def upgrade_state_dict_named(self, state_dict, name): function Linear (line 440) | def Linear(in_features, out_features, bias=True): class TransformerDecoder (line 448) | class TransformerDecoder(TransformerDecoderBase): method __init__ (line 449) | def __init__( method build_output_projection (line 466) | def build_output_projection(self, args, dictionary, embed_tokens): method build_decoder_layer (line 471) | def build_decoder_layer(self, args, no_encoder_attn=False): FILE: fairseq/models/transformer/transformer_decoder_aug.py class AugTransformerDecoderBase (line 24) | class AugTransformerDecoderBase(TransformerDecoderBase): method __init__ (line 41) | def __init__( method build_decoder_layer (line 71) | def build_decoder_layer( method forward (line 93) | def forward( method extract_features (line 139) | def extract_features( method extract_features_scriptable (line 165) | def extract_features_scriptable( method upgrade_state_dict_named (line 306) | def upgrade_state_dict_named(self, state_dict, name): class AugTransformerDecoder (line 347) | class AugTransformerDecoder(AugTransformerDecoderBase): method __init__ (line 348) | def __init__( method build_output_projection (line 368) | def build_output_projection(self, args, dictionary, embed_tokens): method build_decoder_layer (line 373) | def build_decoder_layer( FILE: fairseq/models/transformer/transformer_encoder.py function module_name_fordropout (line 30) | def module_name_fordropout(module_name: str) -> str: class TransformerEncoderBase (line 37) | class TransformerEncoderBase(FairseqEncoder): method __init__ (line 48) | def __init__(self, cfg, dictionary, embed_tokens, return_fc=False): method build_encoder_layer (line 105) | def build_encoder_layer(self, cfg): method forward_embedding (line 119) | def forward_embedding( method forward (line 135) | def forward( method forward_scriptable (line 173) | def forward_scriptable( method reorder_encoder_out (line 269) | def reorder_encoder_out(self, encoder_out: Dict[str, List[Tensor]], ne... method _reorder_encoder_out (line 322) | def _reorder_encoder_out(self, encoder_out: Dict[str, List[Tensor]], n... method max_positions (line 326) | def max_positions(self): method upgrade_state_dict_named (line 332) | def upgrade_state_dict_named(self, state_dict, name): class TransformerEncoder (line 349) | class TransformerEncoder(TransformerEncoderBase): method __init__ (line 350) | def __init__(self, args, dictionary, embed_tokens, return_fc=False): method build_encoder_layer (line 359) | def build_encoder_layer(self, args): FILE: fairseq/models/transformer/transformer_legacy.py class TransformerModel (line 23) | class TransformerModel(TransformerModelBase): method hub_models (line 30) | def hub_models(cls): method __init__ (line 77) | def __init__(self, args, encoder, decoder): method add_args (line 83) | def add_args(cls, parser): method build_model (line 92) | def build_model(cls, args, task): method build_embedding (line 136) | def build_embedding(cls, args, dictionary, embed_dim, path=None): method build_encoder (line 142) | def build_encoder(cls, args, src_dict, embed_tokens): method build_decoder (line 148) | def build_decoder(cls, args, tgt_dict, embed_tokens): function tiny_architecture (line 158) | def tiny_architecture(args): function base_architecture (line 169) | def base_architecture(args): function transformer_iwslt_de_en (line 227) | def transformer_iwslt_de_en(args): function transformer_wmt_en_de (line 240) | def transformer_wmt_en_de(args): function transformer_vaswani_wmt_en_de_big (line 246) | def transformer_vaswani_wmt_en_de_big(args): function transformer_vaswani_wmt_en_fr_big (line 259) | def transformer_vaswani_wmt_en_fr_big(args): function transformer_wmt_en_de_big (line 265) | def transformer_wmt_en_de_big(args): function transformer_wmt_en_de_big_t2t (line 272) | def transformer_wmt_en_de_big_t2t(args): FILE: fairseq/models/transformer_align.py class TransformerAlignModel (line 15) | class TransformerAlignModel(TransformerModel): method __init__ (line 21) | def __init__(self, encoder, decoder, args): method add_args (line 28) | def add_args(parser): method build_model (line 40) | def build_model(cls, args, task): method forward (line 49) | def forward(self, src_tokens, src_lengths, prev_output_tokens): method forward_decoder (line 53) | def forward_decoder( function transformer_align (line 82) | def transformer_align(args): function transformer_wmt_en_de_big_align (line 90) | def transformer_wmt_en_de_big_align(args): FILE: fairseq/models/transformer_from_pretrained_xlm.py class TransformerFromPretrainedXLMModel (line 21) | class TransformerFromPretrainedXLMModel(TransformerModel): method add_args (line 23) | def add_args(parser): method build_model (line 44) | def build_model(self, args, task, cls_dictionary=MaskedLMDictionary): method build_encoder (line 65) | def build_encoder(cls, args, src_dict, embed_tokens): method build_decoder (line 69) | def build_decoder(cls, args, tgt_dict, embed_tokens): function upgrade_state_dict_with_xlm_weights (line 73) | def upgrade_state_dict_with_xlm_weights( class TransformerEncoderFromPretrainedXLM (line 112) | class TransformerEncoderFromPretrainedXLM(TransformerEncoder): method __init__ (line 113) | def __init__(self, args, dictionary, embed_tokens): class TransformerDecoderFromPretrainedXLM (line 130) | class TransformerDecoderFromPretrainedXLM(TransformerDecoder): method __init__ (line 131) | def __init__(self, args, dictionary, embed_tokens, no_encoder_attn=Fal... function base_architecture (line 151) | def base_architecture(args): FILE: fairseq/models/transformer_lm.py class TransformerLanguageModelConfig (line 31) | class TransformerLanguageModelConfig(FairseqDataclass): class TransformerLanguageModel (line 230) | class TransformerLanguageModel(FairseqLanguageModel): method hub_models (line 232) | def hub_models(cls): method __init__ (line 265) | def __init__(self, decoder): method build_model (line 269) | def build_model(cls, args, task): method build_embedding (line 320) | def build_embedding(cls, args, dictionary, embed_dim, path=None): function base_lm_architecture (line 325) | def base_lm_architecture(args): function transformer_lm_big (line 399) | def transformer_lm_big(args): function transformer_lm_baevski_wiki103 (line 409) | def transformer_lm_baevski_wiki103(args): function transformer_lm_baevski_gbw (line 431) | def transformer_lm_baevski_gbw(args): function transformer_lm_gpt (line 440) | def transformer_lm_gpt(args): function transformer_lm_gpt2_small (line 452) | def transformer_lm_gpt2_small(args): function transformer_lm_gpt2_tiny (line 464) | def transformer_lm_gpt2_tiny(args): function transformer_lm_gpt2_medium (line 476) | def transformer_lm_gpt2_medium(args): function transformer_lm_gpt2_big (line 488) | def transformer_lm_gpt2_big(args): function transformer_lm_gpt2_big_wide (line 500) | def transformer_lm_gpt2_big_wide(args): function transformer_lm_gpt2_bigger (line 512) | def transformer_lm_gpt2_bigger(args): function base_gpt3_architecture (line 523) | def base_gpt3_architecture(args): function transformer_lm_gpt3_small (line 539) | def transformer_lm_gpt3_small(args): function transformer_lm_gpt3_medium (line 548) | def transformer_lm_gpt3_medium(args): function transformer_lm_gpt3_large (line 557) | def transformer_lm_gpt3_large(args): function transformer_lm_gpt3_xl (line 566) | def transformer_lm_gpt3_xl(args): function transformer_lm_gpt3_2_7 (line 575) | def transformer_lm_gpt3_2_7(args): function transformer_lm_gpt3_6_7 (line 584) | def transformer_lm_gpt3_6_7(args): function transformer_lm_gpt3_13 (line 593) | def transformer_lm_gpt3_13(args): function transformer_lm_gpt3_175 (line 602) | def transformer_lm_gpt3_175(args): FILE: fairseq/models/transformer_ulm.py class SpeechUnitLanguageModelConfig (line 31) | class SpeechUnitLanguageModelConfig(TransformerLanguageModelConfig): class TransformerUnitLanguageModel (line 71) | class TransformerUnitLanguageModel(FairseqLanguageModel): method __init__ (line 72) | def __init__( method build_model (line 96) | def build_model(cls, args, task): method apply_seg_dropout (line 135) | def apply_seg_dropout(self, inp, mask_prob, mask_leng, mask_type, mask... method apply_seq_dropout (line 147) | def apply_seq_dropout(self, inp, mask_prob, mask_val): method apply_dropout (line 159) | def apply_dropout(self, src_tokens, dur_src, f0_src): method forward (line 194) | def forward( function base_ulm_architecture (line 232) | def base_ulm_architecture(args): function transformer_ulm_big (line 239) | def transformer_ulm_big(args): function transformer_ulm_tiny (line 247) | def transformer_ulm_tiny(args): class MultiStreamTransformerDecoder (line 254) | class MultiStreamTransformerDecoder(TransformerDecoder): method __init__ (line 255) | def __init__( method extract_features_scriptable (line 284) | def extract_features_scriptable( FILE: fairseq/models/wav2vec/utils.py function pad_to_multiple (line 10) | def pad_to_multiple(x, multiple, dim=-1, value=0): FILE: fairseq/models/wav2vec/wav2vec.py class Wav2VecConfig (line 39) | class Wav2VecConfig(FairseqDataclass): class Wav2VecModel (line 163) | class Wav2VecModel(BaseFairseqModel): method build_model (line 165) | def build_model(cls, cfg: Wav2VecConfig, task: FairseqTask): method __init__ (line 172) | def __init__(self, cfg: Wav2VecConfig): method forward (line 298) | def forward(self, source): method upgrade_state_dict_named (line 321) | def upgrade_state_dict_named(self, state_dict, name): method max_positions (line 324) | def max_positions(self): method get_logits (line 328) | def get_logits(self, net_output): method get_targets (line 332) | def get_targets(self, sample, net_output): method get_target_weights (line 338) | def get_target_weights(self, targets, net_output): method get_extra_losses (line 344) | def get_extra_losses(self, net_output): function norm_block (line 354) | def norm_block(is_layer_norm, dim, affine=True): class ConvFeatureExtractionModel (line 367) | class ConvFeatureExtractionModel(nn.Module): method __init__ (line 368) | def __init__( method forward (line 400) | def forward(self, x): class ZeroPad1d (line 421) | class ZeroPad1d(nn.Module): method __init__ (line 422) | def __init__(self, pad_left, pad_right): method forward (line 427) | def forward(self, x): class ConvAggegator (line 431) | class ConvAggegator(nn.Module): method __init__ (line 432) | def __init__( method forward (line 478) | def forward(self, x): class Wav2VecPredictionsModel (line 489) | class Wav2VecPredictionsModel(nn.Module): method __init__ (line 490) | def __init__( method sample_negatives (line 516) | def sample_negatives(self, y): method forward (line 575) | def forward(self, x, y): FILE: fairseq/models/wav2vec/wav2vec2.py class Wav2Vec2Config (line 45) | class Wav2Vec2Config(FairseqDataclass): class Wav2Vec2Model (line 309) | class Wav2Vec2Model(BaseFairseqModel): method __init__ (line 310) | def __init__(self, cfg: Wav2Vec2Config): method upgrade_state_dict_named (line 418) | def upgrade_state_dict_named(self, state_dict, name): method build_model (line 424) | def build_model(cls, cfg: Wav2Vec2Config, task=None): method apply_mask (line 429) | def apply_mask( method sample_negatives (line 499) | def sample_negatives(self, y, num, padding_count=None): method compute_preds (line 557) | def compute_preds(self, x, y, negatives): method _get_feat_extract_output_lengths (line 579) | def _get_feat_extract_output_lengths(self, input_lengths: torch.LongTe... method forward (line 596) | def forward( method quantize (line 788) | def quantize(self, x): method extract_features (line 795) | def extract_features( method get_logits (line 808) | def get_logits(self, net_output): method get_targets (line 814) | def get_targets(self, sample, net_output, expand_steps=True): method get_extra_losses (line 818) | def get_extra_losses(self, net_output): method remove_pretraining_modules (line 832) | def remove_pretraining_modules(self, last_layer=None): class ConvFeatureExtractionModel (line 844) | class ConvFeatureExtractionModel(nn.Module): method __init__ (line 845) | def __init__( method forward (line 914) | def forward(self, x): function make_conv_pos (line 925) | def make_conv_pos(e, k, g, is_batch_norm=False): class TransformerEncoder (line 948) | class TransformerEncoder(nn.Module): method build_encoder_layer (line 949) | def build_encoder_layer(self, args: Wav2Vec2Config, **kwargs): method __init__ (line 1012) | def __init__(self, args: Wav2Vec2Config, skip_pos_conv: bool = False, ... method forward (line 1074) | def forward(self, x, padding_mask=None, layer=None, corpus_key=None): method extract_features (line 1084) | def extract_features( method max_positions (line 1172) | def max_positions(self): method upgrade_state_dict_named (line 1176) | def upgrade_state_dict_named(self, state_dict, name): class ConformerEncoder (line 1181) | class ConformerEncoder(TransformerEncoder): method build_encoder_layer (line 1182) | def build_encoder_layer(self, args): method __init__ (line 1199) | def __init__(self, args): method extract_features (line 1225) | def extract_features(self, x, padding_mask=None, tgt_layer=None): class TransformerSentenceEncoderLayer (line 1268) | class TransformerSentenceEncoderLayer(nn.Module): method __init__ (line 1274) | def __init__( method forward (line 1315) | def forward( class AdapterFast (line 1380) | class AdapterFast(nn.Module): method __init__ (line 1381) | def __init__(self, adapter_num, input_dim, hidden_dim, act_fn): method reset_parameters (line 1412) | def reset_parameters(self): method forward (line 1426) | def forward(self, x, adapter_id): method extra_repr (line 1436) | def extra_repr(self): class TransformerSentenceEncoderWithAdapterLayer (line 1441) | class TransformerSentenceEncoderWithAdapterLayer(TransformerSentenceEnco... method __init__ (line 1447) | def __init__( method forward (line 1478) | def forward( FILE: fairseq/models/wav2vec/wav2vec2_asr.py class Wav2Vec2AsrConfig (line 39) | class Wav2Vec2AsrConfig(FairseqDataclass): class Wav2Vec2CtcConfig (line 203) | class Wav2Vec2CtcConfig(Wav2Vec2AsrConfig): class Wav2VecCtc (line 209) | class Wav2VecCtc(BaseFairseqModel): method __init__ (line 210) | def __init__(self, cfg: Wav2Vec2CtcConfig, w2v_encoder: BaseFairseqMod... method upgrade_state_dict_named (line 217) | def upgrade_state_dict_named(self, state_dict, name): method build_model (line 222) | def build_model(cls, cfg: Wav2Vec2CtcConfig, task: FairseqTask): method get_logits (line 227) | def get_logits(self, net_output, normalize=False): method get_normalized_probs (line 256) | def get_normalized_probs(self, net_output, log_probs): method forward (line 266) | def forward(self, **kwargs): class Wav2Vec2Seq2SeqConfig (line 272) | class Wav2Vec2Seq2SeqConfig(Wav2Vec2AsrConfig): class Wav2Vec2Seq2SeqModel (line 324) | class Wav2Vec2Seq2SeqModel(FairseqEncoderDecoderModel): method __init__ (line 325) | def __init__(self, encoder, decoder): method build_model (line 329) | def build_model(cls, cfg: Wav2Vec2Seq2SeqConfig, task: FairseqTask): method build_encoder (line 352) | def build_encoder(cls, cfg: Wav2Vec2AsrConfig): method build_decoder (line 356) | def build_decoder(cls, cfg: Wav2Vec2Seq2SeqConfig, tgt_dict, embed_tok... method forward (line 359) | def forward(self, **kwargs): method upgrade_state_dict_named (line 364) | def upgrade_state_dict_named(self, state_dict, name): class Wav2VecEncoder (line 369) | class Wav2VecEncoder(FairseqEncoder): method __init__ (line 370) | def __init__(self, cfg: Wav2Vec2AsrConfig, output_size=None): method freeze_regex (line 525) | def freeze_regex(self, pattern): method load_model_weights (line 533) | def load_model_weights(self, state, model, cfg): method set_num_updates (line 583) | def set_num_updates(self, num_updates): method forward (line 588) | def forward(self, source, padding_mask, **kwargs): method forward_torchscript (line 623) | def forward_torchscript(self, net_input): method reorder_encoder_out (line 629) | def reorder_encoder_out(self, encoder_out, new_order): method max_positions (line 640) | def max_positions(self): method upgrade_state_dict_named (line 644) | def upgrade_state_dict_named(self, state_dict, name): class TransformerDecoder (line 648) | class TransformerDecoder(FairseqIncrementalDecoder): method __init__ (line 661) | def __init__( method forward (line 732) | def forward( method extract_features (line 766) | def extract_features( method output_layer (line 835) | def output_layer(self, features, **kwargs): method max_positions (line 843) | def max_positions(self): method buffered_future_mask (line 849) | def buffered_future_mask(self, tensor): method upgrade_state_dict_named (line 862) | def upgrade_state_dict_named(self, state_dict, name): function Embedding (line 866) | def Embedding(num_embeddings, embedding_dim, padding_idx): function Linear (line 873) | def Linear(in_features, out_features, bias=True): FILE: fairseq/models/wav2vec/wav2vec2_classification.py class Wav2Vec2ClassificationConfig (line 29) | class Wav2Vec2ClassificationConfig(Wav2Vec2AsrConfig): class Wav2VecClassification (line 43) | class Wav2VecClassification(BaseFairseqModel): method __init__ (line 45) | def __init__( method upgrade_state_dict_named (line 56) | def upgrade_state_dict_named(self, state_dict, name): method build_model (line 61) | def build_model(cls, cfg: Wav2Vec2ClassificationConfig, task: FairseqT... method get_normalized_probs (line 72) | def get_normalized_probs(self, net_output, log_probs): method get_logits (line 81) | def get_logits(self, net_output): method forward (line 84) | def forward(self, **kwargs): function get_pooling_layer (line 107) | def get_pooling_layer( class Pooling (line 132) | class Pooling(nn.Module): method __init__ (line 133) | def __init__( method forward (line 142) | def forward(self, last_layer_feats, **kwargs): class FirstToken (line 146) | class FirstToken(Pooling): method __init__ (line 147) | def __init__(self, *args, **kwargs): method forward (line 150) | def forward(self, last_layer_feats, **kwargs): function fn_mean (line 179) | def fn_mean(x, mask): class MeanPoolingFast (line 194) | class MeanPoolingFast(nn.Module): method __init__ (line 195) | def __init__( method forward (line 213) | def forward(self, last_layer_feats, padding_mask, **kwargs): method forward_latent (line 228) | def forward_latent(self, last_layer_feats, padding_mask, **kwargs): class MeanPoolingFastAMSoftmax (line 243) | class MeanPoolingFastAMSoftmax(MeanPoolingFast): method __init__ (line 244) | def __init__( method forward (line 255) | def forward(self, last_layer_feats, padding_mask, **kwargs): function fn_max (line 273) | def fn_max(x, mask): class MaxPoolingFast (line 285) | class MaxPoolingFast(Pooling): method __init__ (line 286) | def __init__( method forward (line 297) | def forward(self, last_layer_feats, padding_mask, **kwargs): class LayerWeightedMeanPooling (line 311) | class LayerWeightedMeanPooling(MeanPoolingFast): method __init__ (line 314) | def __init__( method forward (line 325) | def forward(self, last_layer_feats, padding_mask, all_layer_feats): FILE: fairseq/models/wav2vec/wav2vec2_laser.py class Wav2VecLaser (line 16) | class Wav2VecLaser(Wav2VecCtc): method __init__ (line 17) | def __init__(self, cfg: Wav2Vec2CtcConfig, w2v_encoder: BaseFairseqMod... method build_model (line 23) | def build_model(cls, cfg: Wav2Vec2CtcConfig, task: FairseqTask): method forward (line 28) | def forward(self, **kwargs): FILE: fairseq/models/xmod/hub_interface.py class XMODHubInterface (line 12) | class XMODHubInterface(RobertaHubInterface): method extract_features (line 13) | def extract_features( method predict (line 40) | def predict( FILE: fairseq/models/xmod/model.py class XMODModel (line 26) | class XMODModel(XLMRModel): method hub_models (line 28) | def hub_models(cls): method from_pretrained (line 42) | def from_pretrained( method build_model (line 64) | def build_model(cls, args, task): method forward (line 87) | def forward( class XMODEncoder (line 107) | class XMODEncoder(RobertaEncoder): method build_encoder (line 110) | def build_encoder(self, args, dictionary, embed_tokens): method forward (line 115) | def forward( method extract_features (line 147) | def extract_features( class XMODTransformerEncoder (line 162) | class XMODTransformerEncoder(TransformerEncoder): method build_encoder_layer (line 163) | def build_encoder_layer(self, cfg): method forward (line 175) | def forward( method forward_scriptable (line 218) | def forward_scriptable( function roberta_base_architecture (line 302) | def roberta_base_architecture(args): function roberta_base_architecture (line 331) | def roberta_base_architecture(args): function roberta_base_architecture (line 377) | def roberta_base_architecture(args): function roberta_base_architecture (line 453) | def roberta_base_architecture(args): function roberta_base_architecture (line 544) | def roberta_base_architecture(args): function roberta_base_architecture (line 641) | def roberta_base_architecture(args): FILE: fairseq/models/xmod/transformer_layer_xmod.py class Adapter (line 17) | class Adapter(nn.Module): method __init__ (line 18) | def __init__(self, cfg, red_fac=2): method forward (line 45) | def forward(self, x): class XMODTransformerEncoderLayerBase (line 53) | class XMODTransformerEncoderLayerBase(TransformerEncoderLayer): method __init__ (line 68) | def __init__(self, cfg): method lang_adapter (line 82) | def lang_adapter(self, lang_id, x): method forward (line 120) | def forward( FILE: fairseq/modules/adaptive_input.py class AdaptiveInput (line 15) | class AdaptiveInput(nn.Module): method __init__ (line 16) | def __init__( method weights_for_band (line 67) | def weights_for_band(self, band: int): method forward (line 70) | def forward(self, input: torch.Tensor): FILE: fairseq/modules/adaptive_softmax.py class TiedLinear (line 16) | class TiedLinear(nn.Module): method __init__ (line 17) | def __init__(self, weight, transpose): method forward (line 22) | def forward(self, input): class TiedHeadModule (line 26) | class TiedHeadModule(nn.Module): method __init__ (line 27) | def __init__(self, weights, input_dim, num_classes, q_noise, qn_block_... method forward (line 50) | def forward(self, input): class AdaptiveSoftmax (line 58) | class AdaptiveSoftmax(nn.Module): method __init__ (line 65) | def __init__( method _make_tail (line 129) | def _make_tail(self, adaptive_inputs=None, tie_proj=False): method upgrade_state_dict_named (line 175) | def upgrade_state_dict_named(self, state_dict, name): method adapt_target (line 180) | def adapt_target(self, target): method forward (line 205) | def forward(self, input, target): method get_log_prob (line 228) | def get_log_prob(self, input, target): FILE: fairseq/modules/base_layer.py class BaseLayer (line 14) | class BaseLayer(nn.Module): method __init__ (line 15) | def __init__(self, args): method forward (line 34) | def forward(self, input_features, *args, **kwargs): method inverse_sort (line 81) | def inverse_sort(self, order): method balanced_assignment (line 87) | def balanced_assignment(self, scores): method greedy_assignment (line 95) | def greedy_assignment(self, scores, k=1): method load_assignment (line 110) | def load_assignment(self): class BaseSublayer (line 123) | class BaseSublayer(nn.Module): method __init__ (line 124) | def __init__(self, args): method forward (line 134) | def forward(self, xs): class All2All (line 139) | class All2All(torch.autograd.Function): method forward (line 141) | def forward(ctx, xs, input_splits=None, output_splits=None): method backward (line 156) | def backward(ctx, grad_output): FILE: fairseq/modules/beamable_mm.py class BeamableMM (line 10) | class BeamableMM(nn.Module): method __init__ (line 19) | def __init__(self, beam_size=None): method forward (line 23) | def forward(self, input1, input2): method set_beam_size (line 48) | def set_beam_size(self, beam_size): FILE: fairseq/modules/character_token_embedder.py class CharacterTokenEmbedder (line 22) | class CharacterTokenEmbedder(torch.nn.Module): method __init__ (line 23) | def __init__( method prepare_for_onnx_export_ (line 64) | def prepare_for_onnx_export_(self): method set_vocab (line 67) | def set_vocab(self, vocab, max_char_len): method padding_idx (line 94) | def padding_idx(self): method reset_parameters (line 97) | def reset_parameters(self): method forward (line 107) | def forward( method _convolve (line 155) | def _convolve( class Highway (line 179) | class Highway(torch.nn.Module): method __init__ (line 185) | def __init__(self, input_dim: int, num_layers: int = 1): method reset_parameters (line 195) | def reset_parameters(self): method forward (line 207) | def forward(self, x: torch.Tensor): FILE: fairseq/modules/checkpoint_activations.py function checkpoint_wrapper (line 14) | def checkpoint_wrapper(m, offload_to_cpu=False): function unwrap_checkpoint (line 41) | def unwrap_checkpoint(m: torch.nn.Module): function _checkpointed_forward (line 55) | def _checkpointed_forward(original_forward, offload_to_cpu, *args, **kwa... function pack_kwargs (line 73) | def pack_kwargs(*args, **kwargs) -> Tuple[List[str], List[Any]]: function unpack_kwargs (line 90) | def unpack_kwargs( function split_non_tensors (line 100) | def split_non_tensors( function unpack_non_tensors (line 126) | def unpack_non_tensors( class CheckpointFunction (line 148) | class CheckpointFunction(torch.autograd.Function): method forward (line 157) | def forward(ctx, run_function, parent_ctx_dict, kwarg_keys, *args): method backward (line 194) | def backward(ctx, *args): FILE: fairseq/modules/conformer_layer.py class ConvolutionModule (line 21) | class ConvolutionModule(torch.nn.Module): method __init__ (line 24) | def __init__( method forward (line 79) | def forward(self, x): class FeedForwardModule (line 104) | class FeedForwardModule(torch.nn.Module): method __init__ (line 107) | def __init__( method forward (line 134) | def forward(self, x): class ConformerEncoderLayer (line 149) | class ConformerEncoderLayer(torch.nn.Module): method __init__ (line 152) | def __init__( method forward (line 231) | def forward( class ConformerWav2Vec2EncoderLayer (line 289) | class ConformerWav2Vec2EncoderLayer(ConformerEncoderLayer): method forward (line 292) | def forward( FILE: fairseq/modules/conv_tbc.py class ConvTBC (line 12) | class ConvTBC(torch.nn.Module): method __init__ (line 19) | def __init__(self, in_channels, out_channels, kernel_size, padding=0): method reset_parameters (line 33) | def reset_parameters(self): method conv_tbc (line 37) | def conv_tbc(self, input: Tensor): method forward (line 42) | def forward(self, input: Tensor): method __repr__ (line 45) | def __repr__(self): FILE: fairseq/modules/cross_entropy.py function _cross_entropy_pytorch (line 14) | def _cross_entropy_pytorch(logits, target, ignore_index=None, reduction=... function cross_entropy (line 28) | def cross_entropy(logits, target, ignore_index=-100, reduction="mean"): function cross_entropy (line 58) | def cross_entropy(logits, target, ignore_index=-100, reduction="mean"): FILE: fairseq/modules/downsampled_multihead_attention.py class SingleHeadAttention (line 17) | class SingleHeadAttention(nn.Module): method __init__ (line 22) | def __init__( method forward (line 75) | def forward( class DownsampledMultiHeadAttention (line 171) | class DownsampledMultiHeadAttention(nn.ModuleList): method __init__ (line 176) | def __init__( method forward (line 231) | def forward( class Downsample (line 288) | class Downsample(nn.Module): method __init__ (line 293) | def __init__(self, index): method forward (line 297) | def forward(self, x): function Linear (line 301) | def Linear(in_features, out_features, dropout=0.0, bias=True): function GatedLinear (line 309) | def GatedLinear(in_features, out_features, dropout=0.0, bias=True): FILE: fairseq/modules/dynamic_convolution.py function DynamicConv (line 22) | def DynamicConv( function Linear (line 67) | def Linear(in_features, out_features, bias=True): class DynamicConv1dTBC (line 76) | class DynamicConv1dTBC(nn.Module): method __init__ (line 101) | def __init__( method in_proj (line 142) | def in_proj(self): method reset_parameters (line 148) | def reset_parameters(self): method forward (line 153) | def forward(self, x, incremental_state=None, query=None, unfold=None): method _forward_unfolded (line 178) | def _forward_unfolded(self, x, incremental_state, query): method _forward_expanded (line 234) | def _forward_expanded(self, x, incremental_stat, query): method reorder_incremental_state (line 286) | def reorder_incremental_state(self, incremental_state, new_order): method _get_input_buffer (line 292) | def _get_input_buffer(self, incremental_state): method _set_input_buffer (line 295) | def _set_input_buffer(self, incremental_state, new_buffer): method extra_repr (line 300) | def extra_repr(self): class DynamicConv_scripatable (line 319) | class DynamicConv_scripatable(nn.Module, FairseqIncrementalState): method __init__ (line 344) | def __init__( method reset_parameters (line 388) | def reset_parameters(self): method forward (line 393) | def forward( method _forward_unfolded (line 417) | def _forward_unfolded( method reorder_incremental_state (line 479) | def reorder_incremental_state( method _get_input_buffer (line 489) | def _get_input_buffer( method _set_input_buffer (line 498) | def _set_input_buffer( method extra_repr (line 510) | def extra_repr(self): FILE: fairseq/modules/dynamic_crf_layer.py function logsumexp (line 24) | def logsumexp(x, dim=1): class DynamicCRF (line 28) | class DynamicCRF(nn.Module): method __init__ (line 42) | def __init__(self, num_embedding, low_rank=32, beam_size=64): method extra_repr (line 52) | def extra_repr(self): method forward (line 57) | def forward(self, emissions, targets, masks, beam=None): method forward_decoder (line 75) | def forward_decoder(self, emissions, masks=None, beam=None): method _compute_score (line 89) | def _compute_score(self, emissions, targets, masks=None): method _compute_normalizer (line 101) | def _compute_normalizer(self, emissions, targets=None, masks=None, bea... method _viterbi_decode (line 135) | def _viterbi_decode(self, emissions, masks=None, beam=None): FILE: fairseq/modules/dynamicconv_layer/cuda_function_gen.py function gen_forward (line 7) | def gen_forward(): function gen_backward (line 96) | def gen_backward(): FILE: fairseq/modules/dynamicconv_layer/dynamicconv_cuda.cpp function dynamicconv_forward (line 28) | std::vector function dynamicconv_backward (line 36) | std::vector dynamicconv_backward( function PYBIND11_MODULE (line 48) | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { FILE: fairseq/modules/dynamicconv_layer/dynamicconv_layer.py class dynamicconvFunction (line 17) | class dynamicconvFunction(Function): method forward (line 19) | def forward(ctx, x, weights, padding_l): method backward (line 27) | def backward(ctx, grad_output): class DynamicconvLayer (line 36) | class DynamicconvLayer(nn.Module): method __init__ (line 37) | def __init__( method reset_parameters (line 71) | def reset_parameters(self): method forward (line 77) | def forward(self, x, incremental_state=None, query=None, unfold=None): method reorder_incremental_state (line 121) | def reorder_incremental_state(self, incremental_state, new_order): method _get_input_buffer (line 127) | def _get_input_buffer(self, incremental_state): method _set_input_buffer (line 130) | def _set_input_buffer(self, incremental_state, new_buffer): method _forward_unfolded (line 135) | def _forward_unfolded(self, x, incremental_state, query): method _forward_expanded (line 184) | def _forward_expanded(self, x, incremental_stat, query): FILE: fairseq/modules/dynamicconv_layer/dynamiconv_cpu.cpp function dynamicconv_forward (line 13) | std::vector function dynamicconv_backward (line 18) | std::vector dynamicconv_backward( function PYBIND11_MODULE (line 26) | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { FILE: fairseq/modules/ema_module.py class EMAModuleConfig (line 28) | class EMAModuleConfig(FairseqDataclass): class EMAModule (line 40) | class EMAModule: method __init__ (line 43) | def __init__( method build_fp32_params (line 83) | def build_fp32_params(self, state_dict=None): method restore (line 115) | def restore(self, state_dict, build_fp32_params=False): method set_decay (line 121) | def set_decay(self, decay, weight_decay=None): method get_decay (line 126) | def get_decay(self): method _step_internal (line 129) | def _step_internal(self, new_model): method step (line 202) | def step(self, new_model): method reverse (line 205) | def reverse(self, model): FILE: fairseq/modules/espnet_multihead_attention.py class ESPNETMultiHeadedAttention (line 20) | class ESPNETMultiHeadedAttention(nn.Module): method __init__ (line 28) | def __init__(self, n_feat, n_head, dropout): method forward_qkv (line 42) | def forward_qkv(self, query, key, value, **kwargs): method forward_attention (line 62) | def forward_attention(self, value, scores, mask): method forward (line 90) | def forward(self, query, key, value, key_padding_mask=None, **kwargs): class RelPositionMultiHeadedAttention (line 111) | class RelPositionMultiHeadedAttention(ESPNETMultiHeadedAttention): method __init__ (line 121) | def __init__(self, n_feat, n_head, dropout, zero_triu=False): method rel_shift (line 134) | def rel_shift(self, x): method forward (line 155) | def forward(self, query, key, value, pos_emb, key_padding_mask=None, *... class RotaryPositionMultiHeadedAttention (line 201) | class RotaryPositionMultiHeadedAttention(ESPNETMultiHeadedAttention): method __init__ (line 202) | def __init__( method forward (line 221) | def forward(self, query, key, value, key_padding_mask=None, **kwargs): FILE: fairseq/modules/fairseq_dropout.py class FairseqDropout (line 16) | class FairseqDropout(nn.Module): method __init__ (line 17) | def __init__(self, p, module_name=None): method forward (line 23) | def forward(self, x, inplace: bool = False): method make_generation_fast_ (line 29) | def make_generation_fast_( FILE: fairseq/modules/fp32_batch_norm.py class Fp32BatchNorm (line 12) | class Fp32BatchNorm(nn.Module): method __init__ (line 13) | def __init__(self, sync=False, *args, **kwargs): method forward (line 29) | def forward(self, input): FILE: fairseq/modules/fp32_group_norm.py class Fp32GroupNorm (line 13) | class Fp32GroupNorm(nn.GroupNorm): method __init__ (line 14) | def __init__(self, *args, **kwargs): method forward (line 17) | def forward(self, input): FILE: fairseq/modules/fp32_instance_norm.py class Fp32InstanceNorm (line 13) | class Fp32InstanceNorm(nn.InstanceNorm1d): method __init__ (line 14) | def __init__(self, *args, **kwargs): method forward (line 20) | def forward(self, input): FILE: fairseq/modules/gelu.py function gelu_accurate (line 16) | def gelu_accurate(x): function gelu (line 24) | def gelu(x: torch.Tensor) -> torch.Tensor: FILE: fairseq/modules/grad_multiply.py class GradMultiply (line 9) | class GradMultiply(torch.autograd.Function): method forward (line 11) | def forward(ctx, x, scale): method backward (line 17) | def backward(ctx, grad): FILE: fairseq/modules/gumbel_vector_quantizer.py class GumbelVectorQuantizer (line 11) | class GumbelVectorQuantizer(nn.Module): method __init__ (line 12) | def __init__( method set_num_updates (line 92) | def set_num_updates(self, num_updates): method get_codebook_indices (line 97) | def get_codebook_indices(self): method codebook (line 116) | def codebook(self): method sample_from_codebook (line 124) | def sample_from_codebook(self, b, n): method to_codebook_index (line 137) | def to_codebook_index(self, indices): method forward_idx (line 144) | def forward_idx(self, x): method forward (line 148) | def forward(self, x, produce_targets=False): FILE: fairseq/modules/kmeans_attention.py function exists (line 22) | def exists(val): function identity (line 26) | def identity(x, *args, **kwargs): function default (line 30) | def default(x, d): function cast_tuple (line 36) | def cast_tuple(x): function cache_fn (line 40) | def cache_fn(f): function to (line 54) | def to(t): function find_modules (line 58) | def find_modules(nn_module, type): function is_empty (line 62) | def is_empty(t): function max_neg_value (line 66) | def max_neg_value(tensor): function batched_index_select (line 70) | def batched_index_select(values, indices): function merge_dims (line 75) | def merge_dims(ind_from, ind_to, tensor): function expand_dim (line 82) | def expand_dim(t, dim, k): function scatter_mean (line 89) | def scatter_mean(src, t, index, dim, eps=1e-5): function split_at_index (line 95) | def split_at_index(dim, index, t): function reshape_dim (line 102) | def reshape_dim(t, dim, split_dims): function ema (line 110) | def ema(old, new, decay): function ema_inplace (line 116) | def ema_inplace(moving_avg, new, decay): function map_first_tuple_or_el (line 126) | def map_first_tuple_or_el(x, fn): class Chunk (line 132) | class Chunk(nn.Module): method __init__ (line 133) | def __init__(self, chunks, fn, along_dim=-1): method forward (line 139) | def forward(self, x, **kwargs): class PreNorm (line 146) | class PreNorm(nn.ModuleList): method __init__ (line 147) | def __init__(self, norm_class, dim, fn): method forward (line 152) | def forward(self, x, **kwargs): class ReZero (line 157) | class ReZero(nn.Module): method __init__ (line 158) | def __init__(self, fn): method forward (line 163) | def forward(self, x, **kwargs): class ScaleNorm (line 168) | class ScaleNorm(nn.Module): method __init__ (line 169) | def __init__(self, dim, eps=1e-5): method forward (line 174) | def forward(self, x): class ProjectInOut (line 182) | class ProjectInOut(nn.Module): method __init__ (line 183) | def __init__(self, fn, dim_in, dim_out, project_out=True): method forward (line 189) | def forward(self, x, **kwargs): class MatrixMultiply (line 196) | class MatrixMultiply(nn.Module): method __init__ (line 197) | def __init__(self, tensor, transpose=False): method forward (line 202) | def forward(self, x): class DepthWiseConv1d (line 212) | class DepthWiseConv1d(nn.Module): method __init__ (line 213) | def __init__(self, dim_in, dim_out, kernel_size, stride=1, bias=True, ... method forward (line 231) | def forward(self, x): class FixedPositionalEmbedding (line 236) | class FixedPositionalEmbedding(nn.Module): method __init__ (line 237) | def __init__(self, dim, max_seq_len): method forward (line 245) | def forward(self, x): function rotate_every_two (line 249) | def rotate_every_two(x): function apply_rotary_pos_emb (line 256) | def apply_rotary_pos_emb(q, k, sinu_pos): function update_kmeans_on_backwards (line 267) | def update_kmeans_on_backwards(module): function similarity (line 277) | def similarity(x, means): function dists_and_buckets (line 281) | def dists_and_buckets(x, means): function batched_bincount (line 287) | def batched_bincount(index, num_classes, dim=-1): function kmeans_iter (line 295) | def kmeans_iter(x, means, buckets=None): function distribution (line 313) | def distribution(dists, window_size): class Kmeans (line 319) | class Kmeans(nn.Module): method __init__ (line 320) | def __init__( method init (line 333) | def init(self, x): method update (line 358) | def update(self, new_means=None): method forward (line 367) | def forward(self, x, update_means=False): class KmeansAttention (line 394) | class KmeansAttention(nn.Module): method __init__ (line 395) | def __init__( method forward (line 432) | def forward(self, q, k, v, query_mask=None, key_mask=None, **kwargs): class GELU_ (line 529) | class GELU_(nn.Module): method forward (line 530) | def forward(self, x): class FeedForward (line 544) | class FeedForward(nn.Module): method __init__ (line 545) | def __init__(self, dim, mult=4, dropout=0.0, activation=None, glu=False): method forward (line 555) | def forward(self, x, **kwargs): class SelfAttention (line 571) | class SelfAttention(nn.Module): method __init__ (line 572) | def __init__( method forward (line 681) | def forward( FILE: fairseq/modules/kmeans_vector_quantizer.py class KmeansVectorQuantizer (line 11) | class KmeansVectorQuantizer(nn.Module): method __init__ (line 12) | def __init__( method _pass_grad (line 52) | def _pass_grad(self, x, y): method expand_embedding (line 63) | def expand_embedding(self): method forward_idx (line 68) | def forward_idx(self, x): method forward (line 72) | def forward(self, x, produce_targets=False): FILE: fairseq/modules/layer_drop.py class LayerDropModuleList (line 13) | class LayerDropModuleList(nn.ModuleList): method __init__ (line 36) | def __init__(self, p, modules=None): method __iter__ (line 40) | def __iter__(self): FILE: fairseq/modules/layer_norm.py class FusedLayerNorm (line 15) | class FusedLayerNorm(_FusedLayerNorm): method forward (line 17) | def forward(self, x): function LayerNorm (line 28) | def LayerNorm(normalized_shape, eps=1e-5, elementwise_affine=True, expor... class Fp32LayerNorm (line 36) | class Fp32LayerNorm(nn.LayerNorm): method __init__ (line 37) | def __init__(self, *args, **kwargs): method forward (line 40) | def forward(self, input): FILE: fairseq/modules/learned_positional_embedding.py class LearnedPositionalEmbedding (line 15) | class LearnedPositionalEmbedding(nn.Embedding): method __init__ (line 23) | def __init__(self, num_embeddings: int, embedding_dim: int, padding_id... method forward (line 31) | def forward( FILE: fairseq/modules/lightconv_layer/cuda_function_gen.py function gen_forward (line 7) | def gen_forward(): function gen_backward (line 116) | def gen_backward(): FILE: fairseq/modules/lightconv_layer/lightconv_cuda.cpp function lightconv_forward (line 28) | std::vector function lightconv_backward (line 36) | std::vector lightconv_backward( function PYBIND11_MODULE (line 48) | PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) { FILE: fairseq/modules/lightconv_layer/lightconv_layer.py class lightconvFunction (line 16) | class lightconvFunction(Function): method forward (line 18) | def forward(ctx, x, weights, padding_l): method backward (line 26) | def backward(ctx, grad_output): class LightconvLayer (line 35) | class LightconvLayer(nn.Module): method __init__ (line 36) | def __init__( method upgrade_state_dict_named (line 63) | def upgrade_state_dict_named(self, state_dict, name): method reset_parameters (line 70) | def reset_parameters(self): method forward (line 75) | def forward(self, x, incremental_state=None): method reorder_incremental_state (line 122) | def reorder_incremental_state(self, incremental_state, new_order): method _get_input_buffer (line 128) | def _get_input_buffer(self, incremental_state): method _set_input_buffer (line 131) | def _set_input_buffer(self, incremental_state, new_buffer): method half (line 136) | def half(self): FILE: fairseq/modules/lightweight_convolution.py function LightweightConv (line 15) | def LightweightConv( class LightweightConv1d (line 50) | class LightweightConv1d(nn.Module): method __init__ (line 73) | def __init__( method reset_parameters (line 100) | def reset_parameters(self): method forward (line 105) | def forward(self, input): class LightweightConv1dTBC (line 132) | class LightweightConv1dTBC(nn.Module): method __init__ (line 153) | def __init__( method reset_parameters (line 182) | def reset_parameters(self): method forward (line 187) | def forward(self, x, incremental_state=None, unfold=False): method prepare_for_onnx_export_ (line 205) | def prepare_for_onnx_export_(self): method _forward_unfolded (line 208) | def _forward_unfolded(self, x, incremental_state): method _forward_expanded (line 250) | def _forward_expanded(self, x, incremental_state): method reorder_incremental_state (line 285) | def reorder_incremental_state(self, incremental_state, new_order): method _get_input_buffer (line 291) | def _get_input_buffer(self, incremental_state): method _set_input_buffer (line 294) | def _set_input_buffer(self, incremental_state, new_buffer): method extra_repr (line 299) | def extra_repr(self): FILE: fairseq/modules/linearized_convolution.py class LinearizedConvolution (line 18) | class LinearizedConvolution(ConvTBC): method __init__ (line 27) | def __init__(self, in_channels, out_channels, kernel_size, **kwargs): method state_dict (line 32) | def state_dict(self, destination=None, prefix="", keep_vars=False): method upgrade_state_dict_named (line 39) | def upgrade_state_dict_named(self, state_dict, name): method forward (line 45) | def forward( method reorder_incremental_state (line 88) | def reorder_incremental_state( method _get_input_buffer (line 99) | def _get_input_buffer( method _set_input_buffer (line 105) | def _set_input_buffer( method _get_linearized_weight (line 115) | def _get_linearized_weight(self): method _clear_linearized_weight (line 124) | def _clear_linearized_weight(self, *args): FILE: fairseq/modules/location_attention.py class LocationAttention (line 11) | class LocationAttention(nn.Module): method __init__ (line 23) | def __init__( method clear_cache (line 51) | def clear_cache(self): method forward (line 54) | def forward(self, encoder_out, encoder_padding_mask, decoder_h, attn_s... FILE: fairseq/modules/lstm_cell_with_zoneout.py class LSTMCellWithZoneOut (line 9) | class LSTMCellWithZoneOut(nn.Module): method __init__ (line 15) | def __init__( method zoneout (line 26) | def zoneout(self, h, next_h, prob): method forward (line 36) | def forward(self, x, h): FILE: fairseq/modules/multihead_attention.py function _mask_for_xformers (line 30) | def _mask_for_xformers(mask: Tensor, to_dtype: Optional[torch.dtype] = N... class MultiheadAttention (line 63) | class MultiheadAttention(FairseqIncrementalDecoder): method __init__ (line 69) | def __init__( method prepare_for_onnx_export_ (line 165) | def prepare_for_onnx_export_(self): method reset_parameters (line 168) | def reset_parameters(self): method _get_reserve_head_index (line 188) | def _get_reserve_head_index(self, num_heads_to_keep: int): method _adaptive_prune_heads (line 243) | def _adaptive_prune_heads(self, reserve_head_index: List[Tuple[int, in... method _set_skip_embed_dim_check (line 313) | def _set_skip_embed_dim_check(self): method _pad_masks (line 316) | def _pad_masks( method _add_bias (line 335) | def _add_bias( method _append_zero_attn (line 352) | def _append_zero_attn( method _xformers_attn_forward (line 371) | def _xformers_attn_forward( method forward (line 469) | def forward( method _append_prev_key_padding_mask (line 786) | def _append_prev_key_padding_mask( method reorder_incremental_state (line 830) | def reorder_incremental_state( method set_beam_size (line 857) | def set_beam_size(self, beam_size): method _get_input_buffer (line 861) | def _get_input_buffer( method _set_input_buffer (line 871) | def _set_input_buffer( method apply_sparse_mask (line 878) | def apply_sparse_mask(self, attn_weights, tgt_len: int, src_len: int, ... method upgrade_state_dict_named (line 881) | def upgrade_state_dict_named(self, state_dict, name): FILE: fairseq/modules/positional_embedding.py function PositionalEmbedding (line 12) | def PositionalEmbedding( FILE: fairseq/modules/positional_encoding.py class PositionalEncoding (line 11) | class PositionalEncoding(nn.Module): method __init__ (line 21) | def __init__(self, d_model, dropout_rate, max_len=5000, reverse=False): method extend_pe (line 31) | def extend_pe(self, x): method forward (line 54) | def forward(self, x: torch.Tensor): class RelPositionalEncoding (line 66) | class RelPositionalEncoding(nn.Module): method __init__ (line 75) | def __init__(self, max_len, d_model): method extend_pe (line 82) | def extend_pe(self, x): method forward (line 114) | def forward(self, x: torch.Tensor): FILE: fairseq/modules/quant_noise.py function quant_noise (line 10) | def quant_noise(module, p, block_size): FILE: fairseq/modules/quantization/pq/em.py class EM (line 14) | class EM: method __init__ (line 34) | def __init__( method initialize_centroids (line 47) | def initialize_centroids(self): method step (line 58) | def step(self, i): method resolve_empty_clusters (line 93) | def resolve_empty_clusters(self): method compute_distances (line 133) | def compute_distances(self): method assign (line 164) | def assign(self): method save (line 177) | def save(self, path, layer): method load (line 191) | def load(self, path, layer): class EmptyClusterResolveError (line 210) | class EmptyClusterResolveError(Exception): FILE: fairseq/modules/quantization/pq/modules/qconv.py class PQConv2d (line 13) | class PQConv2d(nn.Module): method __init__ (line 35) | def __init__( method weight (line 81) | def weight(self): method forward (line 91) | def forward(self, x): method extra_repr (line 102) | def extra_repr(self): FILE: fairseq/modules/quantization/pq/modules/qemb.py class PQEmbedding (line 11) | class PQEmbedding(nn.Module): method __init__ (line 30) | def __init__( method weight (line 74) | def weight(self): method forward (line 82) | def forward(self, input): method extra_repr (line 93) | def extra_repr(self): FILE: fairseq/modules/quantization/pq/modules/qlinear.py class PQLinear (line 11) | class PQLinear(nn.Module): method __init__ (line 30) | def __init__(self, centroids, assignments, bias, in_features, out_feat... method weight (line 51) | def weight(self): method forward (line 59) | def forward(self, x): method extra_repr (line 66) | def extra_repr(self): FILE: fairseq/modules/quantization/pq/pq.py class PQ (line 9) | class PQ(EM): method __init__ (line 39) | def __init__( method _reshape (line 60) | def _reshape(self, W): method encode (line 94) | def encode(self): method decode (line 106) | def decode(self): FILE: fairseq/modules/quantization/pq/utils.py function quantize_model_ (line 18) | def quantize_model_( function get_layers (line 190) | def get_layers(model, filter_regexp, remove_weights=False): function get_param (line 232) | def get_param(module, layer_name, param_config): class SizeTracker (line 291) | class SizeTracker(object): method __init__ (line 308) | def __init__(self, model): method compute_size (line 316) | def compute_size(self): method update (line 326) | def update(self, W, block_size, n_centroids): method __repr__ (line 347) | def __repr__(self): function attrsetter (line 361) | def attrsetter(*items): FILE: fairseq/modules/quantization/quantization_options.py function parse_config_yaml (line 7) | def parse_config_yaml(yaml_data): function convert_yaml_to_tuple (line 41) | def convert_yaml_to_tuple(yaml_dictionary): FILE: fairseq/modules/quantization/scalar/modules/qact.py class ActivationQuantizer (line 11) | class ActivationQuantizer: method __init__ (line 36) | def __init__( method register_hook (line 55) | def register_hook(self): FILE: fairseq/modules/quantization/scalar/modules/qconv.py class IntConv2d (line 14) | class IntConv2d(_ConvNd): method __init__ (line 34) | def __init__( method _conv_forward (line 75) | def _conv_forward(self, input, weight): method forward (line 96) | def forward(self, input): method extra_repr (line 132) | def extra_repr(self): FILE: fairseq/modules/quantization/scalar/modules/qemb.py class IntEmbedding (line 13) | class IntEmbedding(nn.Module): method __init__ (line 34) | def __init__( method reset_parameters (line 84) | def reset_parameters(self): method forward (line 90) | def forward(self, input): method extra_repr (line 134) | def extra_repr(self): FILE: fairseq/modules/quantization/scalar/modules/qlinear.py class IntLinear (line 13) | class IntLinear(nn.Module): method __init__ (line 35) | def __init__( method reset_parameters (line 63) | def reset_parameters(self): method forward (line 69) | def forward(self, input): method extra_repr (line 105) | def extra_repr(self): FILE: fairseq/modules/quantization/scalar/ops.py function emulate_int (line 14) | def emulate_int(w, bits, method, scale=None, zero_point=None): function quantize (line 19) | def quantize(w, scale, zero_point, bits=8): function emulate_int8_histogram (line 27) | def emulate_int8_histogram(w, scale=None, zero_point=None, bits=8): function emulate_int8_channel (line 38) | def emulate_int8_channel(w, scale=None, zero_point=None, bits=8): function emulate_int8_tensor (line 51) | def emulate_int8_tensor(w, scale=None, zero_point=None, bits=8): FILE: fairseq/modules/quantization/scalar/utils.py function quantize_model_ (line 19) | def quantize_model_( FILE: fairseq/modules/rotary_positional_embedding.py class RotaryPositionalEmbedding (line 4) | class RotaryPositionalEmbedding(torch.nn.Module): method __init__ (line 5) | def __init__(self, dim, base=10000, precision=torch.half): method forward (line 22) | def forward(self, x, seq_len: int = 0): function rotate_half (line 38) | def rotate_half(x): function apply_rotary_pos_emb (line 45) | def apply_rotary_pos_emb(q, k, cos, sin, offset: int = 0): FILE: fairseq/modules/same_pad.py class SamePad (line 10) | class SamePad(nn.Module): method __init__ (line 11) | def __init__(self, kernel_size, causal=False): method forward (line 18) | def forward(self, x): class SamePad2d (line 24) | class SamePad2d(nn.Module): method __init__ (line 25) | def __init__(self, kernel_size): method forward (line 29) | def forward(self, x): FILE: fairseq/modules/scalar_bias.py class ScalarBias (line 10) | class ScalarBias(torch.autograd.Function): method forward (line 17) | def forward(ctx, input, dim, bias_init): method backward (line 26) | def backward(ctx, grad): function scalar_bias (line 30) | def scalar_bias(input, dim, bias_init=0): FILE: fairseq/modules/sinusoidal_positional_embedding.py class SinusoidalPositionalEmbedding (line 15) | class SinusoidalPositionalEmbedding(nn.Module): method __init__ (line 21) | def __init__(self, embedding_dim, padding_idx, init_size=1024, auto_ex... method prepare_for_onnx_export_ (line 36) | def prepare_for_onnx_export_(self): method _load_from_state_dict (line 39) | def _load_from_state_dict(self, state_dict, prefix, *args, **kwargs): method get_embedding (line 48) | def get_embedding( method forward (line 72) | def forward( FILE: fairseq/modules/sparse_multihead_attention.py class SparseMultiheadAttention (line 13) | class SparseMultiheadAttention(MultiheadAttention): method __init__ (line 24) | def __init__( method compute_checkpoint (line 60) | def compute_checkpoint(self, word_index): method compute_subset_summaries (line 72) | def compute_subset_summaries(self, absolute_max): method compute_fixed_attention_subset (line 87) | def compute_fixed_attention_subset(self, word_index, tgt_len): method buffered_sparse_mask (line 119) | def buffered_sparse_mask(self, tensor, tgt_len, src_len): method apply_sparse_mask (line 135) | def apply_sparse_mask(self, attn_weights, tgt_len, src_len, bsz): FILE: fairseq/modules/sparse_transformer_sentence_encoder.py class SparseTransformerSentenceEncoder (line 13) | class SparseTransformerSentenceEncoder(TransformerSentenceEncoder): method __init__ (line 19) | def __init__( FILE: fairseq/modules/sparse_transformer_sentence_encoder_layer.py class SparseTransformerSentenceEncoderLayer (line 10) | class SparseTransformerSentenceEncoderLayer(TransformerSentenceEncoderLa... method __init__ (line 15) | def __init__( FILE: fairseq/modules/transformer_layer.py class TransformerEncoderLayerBase (line 19) | class TransformerEncoderLayerBase(nn.Module): method __init__ (line 34) | def __init__(self, cfg, return_fc=False): method build_fc1 (line 70) | def build_fc1(self, input_dim, output_dim, q_noise, qn_block_size): method build_fc2 (line 75) | def build_fc2(self, input_dim, output_dim, q_noise, qn_block_size): method _get_fc_rank (line 80) | def _get_fc_rank(self, remove_num: int) -> List[int]: method _prune_fc_layer (line 92) | def _prune_fc_layer(self, remove_index: List[int]): method build_self_attention (line 135) | def build_self_attention(self, embed_dim, cfg): method residual_connection (line 146) | def residual_connection(self, x, residual): method upgrade_state_dict_named (line 149) | def upgrade_state_dict_named(self, state_dict, name): method forward (line 163) | def forward( class TransformerEncoderLayer (line 230) | class TransformerEncoderLayer(TransformerEncoderLayerBase): method __init__ (line 231) | def __init__(self, args): method build_self_attention (line 235) | def build_self_attention(self, embed_dim, args): class TransformerDecoderLayerBase (line 241) | class TransformerDecoderLayerBase(nn.Module): method __init__ (line 258) | def __init__( method build_fc1 (line 344) | def build_fc1(self, input_dim, output_dim, q_noise, qn_block_size): method build_fc2 (line 347) | def build_fc2(self, input_dim, output_dim, q_noise, qn_block_size): method build_self_attention (line 350) | def build_self_attention( method build_encoder_attention (line 365) | def build_encoder_attention(self, embed_dim, cfg): method prepare_for_onnx_export_ (line 378) | def prepare_for_onnx_export_(self): method residual_connection (line 381) | def residual_connection(self, x, residual): method forward (line 384) | def forward( method make_generation_fast_ (line 531) | def make_generation_fast_(self, need_attn: bool = False, **kwargs): class TransformerDecoderLayer (line 536) | class TransformerDecoderLayer(TransformerDecoderLayerBase): method __init__ (line 537) | def __init__( method build_self_attention (line 548) | def build_self_attention( method build_encoder_attention (line 558) | def build_encoder_attention(self, embed_dim, args): FILE: fairseq/modules/transformer_layer_aug.py class AugTransformerDecoderLayerBase (line 16) | class AugTransformerDecoderLayerBase(TransformerDecoderLayerBase): method __init__ (line 32) | def __init__( method forward (line 57) | def forward( method get_dropnet_ratio (line 292) | def get_dropnet_ratio(self): FILE: fairseq/modules/transformer_sentence_encoder.py function init_bert_params (line 21) | def init_bert_params(module): class TransformerSentenceEncoder (line 54) | class TransformerSentenceEncoder(nn.Module): method __init__ (line 78) | def __init__( method build_embedding (line 198) | def build_embedding(self, vocab_size, embedding_dim, padding_idx): method build_transformer_sentence_encoder_layer (line 201) | def build_transformer_sentence_encoder_layer( method forward (line 227) | def forward( FILE: fairseq/modules/transformer_sentence_encoder_layer.py class TransformerSentenceEncoderLayer (line 16) | class TransformerSentenceEncoderLayer(nn.Module): method __init__ (line 22) | def __init__( method build_fc1 (line 85) | def build_fc1(self, input_dim, output_dim, q_noise, qn_block_size): method build_fc2 (line 88) | def build_fc2(self, input_dim, output_dim, q_noise, qn_block_size): method build_self_attention (line 91) | def build_self_attention( method forward (line 109) | def forward( FILE: fairseq/modules/transpose_last.py class TransposeLast (line 12) | class TransposeLast(nn.Module): method __init__ (line 13) | def __init__(self, deconstruct_idx=None, tranpose_dim=-2): method forward (line 18) | def forward(self, x): FILE: fairseq/modules/unfold.py function unfold1d (line 9) | def unfold1d(x, kernel_size: int, padding_l: int, pad_value: float = 0): FILE: fairseq/modules/vggblock.py function _pair (line 15) | def _pair(v): function infer_conv_output_dim (line 22) | def infer_conv_output_dim(conv_op, input_dim, sample_inchannel): class VGGBlock (line 38) | class VGGBlock(torch.nn.Module): method __init__ (line 60) | def __init__( method forward (line 113) | def forward(self, x): FILE: fairseq/nan_detector.py class NanDetector (line 14) | class NanDetector: method __init__ (line 19) | def __init__(self, model, forward=True, backward=True): method __enter__ (line 31) | def __enter__(self): method __exit__ (line 34) | def __exit__(self, exc_type, exc_value, exc_traceback): method add_hooks (line 51) | def add_hooks(self, module): method reset (line 57) | def reset(self): method _detect (line 61) | def _detect(self, tensor, name, backward): method _apply (line 77) | def _apply(self, module, inp, x, backward): method fhook_fn (line 98) | def fhook_fn(self, module, inp, output): method bhook_fn (line 102) | def bhook_fn(self, module, inp, output): method close (line 106) | def close(self): FILE: fairseq/ngram_repeat_block.py function is_cuda_extension_usable (line 20) | def is_cuda_extension_usable() -> bool: class NGramRepeatBlock (line 39) | class NGramRepeatBlock(nn.Module): method __init__ (line 42) | def __init__(self, no_repeat_ngram_size: int, use_extension: bool = Tr... method reset_parameters (line 47) | def reset_parameters(self): method call_cuda_extension (line 51) | def call_cuda_extension( method forward (line 63) | def forward( method _no_repeat_ngram (line 96) | def _no_repeat_ngram(self, tokens, lprobs, bsz: int, beam_size: int, s... FILE: fairseq/optim/__init__.py function build_optimizer (line 37) | def build_optimizer(cfg: DictConfig, params, *extra_args, **extra_kwargs): FILE: fairseq/optim/adadelta.py class Adadelta (line 12) | class Adadelta(LegacyFairseqOptimizer): method __init__ (line 13) | def __init__(self, args, params): method add_args (line 18) | def add_args(parser): method optimizer_config (line 31) | def optimizer_config(self): method supports_flat_params (line 46) | def supports_flat_params(self): FILE: fairseq/optim/adafactor.py class FairseqAdafactor (line 15) | class FairseqAdafactor(LegacyFairseqOptimizer): method __init__ (line 16) | def __init__(self, args, params): method add_args (line 21) | def add_args(parser): method optimizer_config (line 44) | def optimizer_config(self): class Adafactor (line 66) | class Adafactor(torch.optim.Optimizer): method __init__ (line 100) | def __init__( method supports_memory_efficient_fp16 (line 132) | def supports_memory_efficient_fp16(self): method supports_flat_params (line 136) | def supports_flat_params(self): method _get_lr (line 139) | def _get_lr(self, param_group, param_state): method _get_options (line 151) | def _get_options(self, param_group, param_shape): method _rms (line 156) | def _rms(self, tensor): method _approx_sq_grad (line 159) | def _approx_sq_grad(self, exp_avg_sq_row, exp_avg_sq_col): method step (line 168) | def step(self, closure=None): FILE: fairseq/optim/adagrad.py class Adagrad (line 12) | class Adagrad(LegacyFairseqOptimizer): method __init__ (line 13) | def __init__(self, args, params): method add_args (line 18) | def add_args(parser): method optimizer_config (line 26) | def optimizer_config(self): method supports_flat_params (line 39) | def supports_flat_params(self): FILE: fairseq/optim/adam.py class FairseqAdamConfig (line 25) | class FairseqAdamConfig(FairseqDataclass): class FairseqAdam (line 45) | class FairseqAdam(FairseqOptimizer): method __init__ (line 53) | def __init__(self, cfg: FairseqAdamConfig, params): method optimizer_config (line 80) | def optimizer_config(self): method average_params (line 98) | def average_params(self): class Adam (line 110) | class Adam(torch.optim.Optimizer): method __init__ (line 137) | def __init__( method supports_memory_efficient_fp16 (line 152) | def supports_memory_efficient_fp16(self): method supports_flat_params (line 156) | def supports_flat_params(self): method step (line 159) | def step(self, closure=None): FILE: fairseq/optim/adamax.py class FairseqAdamax (line 13) | class FairseqAdamax(LegacyFairseqOptimizer): method __init__ (line 14) | def __init__(self, args, params): method add_args (line 19) | def add_args(parser): method optimizer_config (line 33) | def optimizer_config(self): class Adamax (line 49) | class Adamax(torch.optim.Optimizer): method __init__ (line 70) | def __init__( method supports_memory_efficient_fp16 (line 100) | def supports_memory_efficient_fp16(self): method supports_flat_params (line 104) | def supports_flat_params(self): method step (line 107) | def step(self, closure=None): FILE: fairseq/optim/amp_optimizer.py class AMPOptimizer (line 15) | class AMPOptimizer(optim.FairseqOptimizer): method __init__ (line 20) | def __init__(self, cfg: DictConfig, params, fp32_optimizer, **kwargs): method build_optimizer (line 30) | def build_optimizer(cls, cfg: DictConfig, params, **kwargs): method backward (line 39) | def backward(self, loss): method step (line 48) | def step(self): method clip_grad_norm (line 52) | def clip_grad_norm(self, max_norm, aggregate_norm_fn=None): method scaler (line 72) | def scaler(self): method next_loss_scale (line 76) | def next_loss_scale(self): method optimizer (line 80) | def optimizer(self): method optimizer (line 84) | def optimizer(self, optimizer): method lr_scheduler (line 88) | def lr_scheduler(self): method optimizer_config (line 92) | def optimizer_config(self): method get_lr (line 95) | def get_lr(self): method set_lr (line 98) | def set_lr(self, lr): method all_reduce_grads (line 101) | def all_reduce_grads(self, module): method supports_flat_params (line 105) | def supports_flat_params(self): FILE: fairseq/optim/bmuf.py class FairseqBMUF (line 15) | class FairseqBMUF(FairseqOptimizer): method __init__ (line 25) | def __init__(self, cfg: FairseqBMUFConfig, optimizer): method add_args (line 40) | def add_args(parser): method optimizer (line 45) | def optimizer(self): method optimizer_config (line 49) | def optimizer_config(self): method get_lr (line 52) | def get_lr(self): method set_lr (line 55) | def set_lr(self, lr): method state_dict (line 58) | def state_dict(self): method load_state_dict (line 61) | def load_state_dict(self, state_dict, optimizer_overrides=None): method multiply_grads (line 65) | def multiply_grads(self, c): method clip_grad_norm (line 69) | def clip_grad_norm(self, max_norm, aggregate_norm_fn=None): method average_params (line 73) | def average_params(self): method _block_sync (line 76) | def _block_sync(self): method _is_warmup_end (line 96) | def _is_warmup_end(self): method _is_bmuf_iter (line 102) | def _is_bmuf_iter(self): method _warmup_sync (line 110) | def _warmup_sync(self, root_rank=0): method step (line 125) | def step(self, closure=None): method zero_grad (line 134) | def zero_grad(self): method get_num_updates (line 138) | def get_num_updates(self): method set_num_updates (line 142) | def set_num_updates(self, num_updates): method _reset_local_data (line 147) | def _reset_local_data(self): method _calc_grad (line 158) | def _calc_grad(self): method _avg_grad_from_all_gpus (line 168) | def _avg_grad_from_all_gpus(self): method _update_global_model (line 175) | def _update_global_model(self): FILE: fairseq/optim/composite.py class OptimizerAndSchedulerConfig (line 23) | class OptimizerAndSchedulerConfig(FairseqDataclass): class CompositeOptimizerConfig (line 33) | class CompositeOptimizerConfig(FairseqDataclass): class FairseqCompositeOptimizer (line 50) | class FairseqCompositeOptimizer(FairseqOptimizer): method __init__ (line 57) | def __init__(self, cfg: CompositeOptimizerConfig, params): method supports_groups (line 175) | def supports_groups(self): method param_groups (line 179) | def param_groups(self): method get_lr (line 184) | def get_lr(self): method state_dict (line 193) | def state_dict(self): method load_state_dict (line 197) | def load_state_dict(self, state_dict, optimizer_overrides=None): class CompositeOptimizer (line 212) | class CompositeOptimizer(torch.optim.Optimizer): method __init__ (line 213) | def __init__(self, optimizers: Dict[str, FairseqOptimizer]): method supports_memory_efficient_fp16 (line 217) | def supports_memory_efficient_fp16(self): method supports_flat_params (line 221) | def supports_flat_params(self): method step (line 224) | def step(self, closure=None, groups=None): method zero_grad (line 241) | def zero_grad(self): class CompositeLRScheduler (line 246) | class CompositeLRScheduler(FairseqLRScheduler): method __init__ (line 247) | def __init__(self, lr_schedulers): method state_dict (line 252) | def state_dict(self): method load_state_dict (line 256) | def load_state_dict(self, state_dict): method step_begin_epoch (line 261) | def step_begin_epoch(self, epoch): method step (line 266) | def step(self, epoch, val_loss=None): method step_update (line 271) | def step_update(self, num_updates): FILE: fairseq/optim/cpu_adam.py function _get_cpu_adam (line 25) | def _get_cpu_adam(): class FairseqCPUAdamConfig (line 38) | class FairseqCPUAdamConfig(FairseqDataclass): class FairseqCPUAdam (line 54) | class FairseqCPUAdam(FairseqOptimizer): method __init__ (line 62) | def __init__(self, cfg: DictConfig, params): method optimizer_config (line 67) | def optimizer_config(self): class CPUAdam (line 85) | class CPUAdam(torch.optim.Optimizer): method __init__ (line 89) | def __init__( method supports_memory_efficient_fp16 (line 124) | def supports_memory_efficient_fp16(self): method supports_flat_params (line 128) | def supports_flat_params(self): method step (line 132) | def step(self, closure=None): FILE: fairseq/optim/dynamic_loss_scaler.py class DynamicLossScaler (line 7) | class DynamicLossScaler(object): method __init__ (line 8) | def __init__( method scale (line 28) | def scale(self, outputs): method update (line 31) | def update(self): method _decrease_loss_scale (line 37) | def _decrease_loss_scale(self): method check_overflow (line 42) | def check_overflow(self, grad_norm): FILE: fairseq/optim/fairseq_optimizer.py class FairseqOptimizer (line 12) | class FairseqOptimizer(object): method __init__ (line 13) | def __init__(self, cfg): method add_args (line 18) | def add_args(cls, parser): method optimizer (line 25) | def optimizer(self): method optimizer (line 34) | def optimizer(self, optimizer): method optimizer_config (line 43) | def optimizer_config(self): method params (line 53) | def params(self): method param_groups (line 60) | def param_groups(self): method __getstate__ (line 63) | def __getstate__(self): method get_lr (line 66) | def get_lr(self): method set_lr (line 70) | def set_lr(self, lr): method state_dict (line 75) | def state_dict(self): method load_state_dict (line 79) | def load_state_dict(self, state_dict, optimizer_overrides=None): method backward (line 94) | def backward(self, loss): method all_reduce_grads (line 98) | def all_reduce_grads(self, module): method multiply_grads (line 103) | def multiply_grads(self, c): method clip_grad_norm (line 118) | def clip_grad_norm(self, max_norm, aggregate_norm_fn=None): method step (line 122) | def step(self, closure=None, scale=1.0, groups=None): method zero_grad (line 137) | def zero_grad(self): method supports_memory_efficient_fp16 (line 144) | def supports_memory_efficient_fp16(self): method supports_step_with_scale (line 150) | def supports_step_with_scale(self): method supports_groups (line 156) | def supports_groups(self): method supports_flat_params (line 162) | def supports_flat_params(self): method average_params (line 171) | def average_params(self): method broadcast_global_state_dict (line 174) | def broadcast_global_state_dict(self, state_dict): class LegacyFairseqOptimizer (line 185) | class LegacyFairseqOptimizer(FairseqOptimizer): method __init__ (line 186) | def __init__(self, args): FILE: fairseq/optim/fp16_optimizer.py class _FP16OptimizerMixin (line 17) | class _FP16OptimizerMixin(object): method __init__ (line 18) | def __init__(self, *args, **kwargs): method has_flat_params (line 24) | def has_flat_params(self): method build_fp32_params (line 31) | def build_fp32_params(cls, args, params, flatten=True): method state_dict (line 80) | def state_dict(self): method load_state_dict (line 87) | def load_state_dict(self, state_dict, optimizer_overrides=None): method backward (line 99) | def backward(self, loss): method _sync_fp16_grads_to_fp32 (line 111) | def _sync_fp16_grads_to_fp32(self): method _sync_fp32_params_to_fp16 (line 148) | def _sync_fp32_params_to_fp16(self): method _unscale_grads (line 172) | def _unscale_grads(self): method multiply_grads (line 187) | def multiply_grads(self, c): method clip_grad_norm (line 191) | def clip_grad_norm(self, max_norm, aggregate_norm_fn=None): method step (line 213) | def step(self, closure=None, groups=None): method zero_grad (line 230) | def zero_grad(self): class FP16Optimizer (line 252) | class FP16Optimizer(_FP16OptimizerMixin, optim.FairseqOptimizer): method __init__ (line 257) | def __init__(self, cfg: DictConfig, params, fp32_optimizer, fp32_param... method build_optimizer (line 292) | def build_optimizer(cls, cfg: DictConfig, params, **kwargs): method optimizer (line 313) | def optimizer(self): method optimizer (line 317) | def optimizer(self, optimizer): method lr_scheduler (line 321) | def lr_scheduler(self): method optimizer_config (line 325) | def optimizer_config(self): method get_lr (line 328) | def get_lr(self): method set_lr (line 331) | def set_lr(self, lr): method all_reduce_grads (line 334) | def all_reduce_grads(self, module): method supports_flat_params (line 338) | def supports_flat_params(self): class _MemoryEfficientFP16OptimizerMixin (line 342) | class _MemoryEfficientFP16OptimizerMixin(object): method __init__ (line 343) | def __init__(self, *args, **kwargs): method has_flat_params (line 349) | def has_flat_params(self): method state_dict (line 352) | def state_dict(self): method load_state_dict (line 359) | def load_state_dict(self, state_dict, optimizer_overrides=None): method backward (line 392) | def backward(self, loss): method _unscale_grads (line 403) | def _unscale_grads(self): method multiply_grads (line 417) | def multiply_grads(self, c): method clip_grad_norm (line 421) | def clip_grad_norm(self, max_norm, aggregate_norm_fn=None): method step (line 441) | def step(self, closure=None, groups=None): method zero_grad (line 455) | def zero_grad(self): method supports_flat_params (line 464) | def supports_flat_params(self): class MemoryEfficientFP16Optimizer (line 468) | class MemoryEfficientFP16Optimizer( method __init__ (line 486) | def __init__( method build_optimizer (line 526) | def build_optimizer(cls, cfg: DictConfig, params, **kwargs): method optimizer (line 536) | def optimizer(self): method optimizer (line 540) | def optimizer(self, optimizer): method optimizer_config (line 544) | def optimizer_config(self): method lr_scheduler (line 548) | def lr_scheduler(self): method get_lr (line 551) | def get_lr(self): method set_lr (line 554) | def set_lr(self, lr): method all_reduce_grads (line 557) | def all_reduce_grads(self, module): FILE: fairseq/optim/fused_adam.py function get_fused_adam_class (line 11) | def get_fused_adam_class(): class FusedAdamV1 (line 40) | class FusedAdamV1(torch.optim.Optimizer): method __init__ (line 72) | def __init__( method supports_memory_efficient_fp16 (line 107) | def supports_memory_efficient_fp16(self): method supports_flat_params (line 111) | def supports_flat_params(self): method supports_step_with_scale (line 115) | def supports_step_with_scale(self): method step (line 118) | def step(self, closure=None, grads=None, scale=1.0, grad_norms=None): class FusedAdamV2 (line 261) | class FusedAdamV2(FusedAdam): method __init__ (line 267) | def __init__(self, *args, use_fp16_stats=False, **kwargs): method supports_memory_efficient_fp16 (line 279) | def supports_memory_efficient_fp16(self): method supports_flat_params (line 283) | def supports_flat_params(self): method step (line 286) | def step( FILE: fairseq/optim/fused_lamb.py class FairseqLAMB (line 10) | class FairseqLAMB(LegacyFairseqOptimizer): method __init__ (line 13) | def __init__(self, args, params): method add_args (line 23) | def add_args(parser): method optimizer_config (line 35) | def optimizer_config(self): method supports_flat_params (line 50) | def supports_flat_params(self): FILE: fairseq/optim/lr_scheduler/__init__.py function build_lr_scheduler (line 28) | def build_lr_scheduler(cfg: DictConfig, optimizer): FILE: fairseq/optim/lr_scheduler/cosine_lr_scheduler.py class CosineLRScheduleConfig (line 18) | class CosineLRScheduleConfig(FairseqDataclass): class CosineLRSchedule (line 48) | class CosineLRSchedule(FairseqLRScheduler): method __init__ (line 71) | def __init__(self, cfg: CosineLRScheduleConfig, fairseq_optimizer): method step (line 109) | def step(self, epoch, val_loss=None): method step_update (line 115) | def step_update(self, num_updates): FILE: fairseq/optim/lr_scheduler/fairseq_lr_scheduler.py class FairseqLRScheduler (line 12) | class FairseqLRScheduler(object): method __init__ (line 13) | def __init__(self, cfg, optimizer): method add_args (line 22) | def add_args(cls, parser): method state_dict (line 28) | def state_dict(self): method load_state_dict (line 32) | def load_state_dict(self, state_dict): method step_begin_epoch (line 36) | def step_begin_epoch(self, epoch): method step (line 40) | def step(self, epoch, val_loss=None): method step_update (line 48) | def step_update(self, num_updates): class LegacyFairseqLRScheduler (line 53) | class LegacyFairseqLRScheduler(FairseqLRScheduler): method __init__ (line 54) | def __init__(self, args: Namespace, optimizer): FILE: fairseq/optim/lr_scheduler/fixed_schedule.py class FixedLRScheduleConfig (line 15) | class FixedLRScheduleConfig(FairseqDataclass): class FixedLRSchedule (line 32) | class FixedLRSchedule(FairseqLRScheduler): method __init__ (line 35) | def __init__(self, cfg: FixedLRScheduleConfig, optimizer): method state_dict (line 44) | def state_dict(self): method load_state_dict (line 47) | def load_state_dict(self, state_dict): method get_next_lr (line 51) | def get_next_lr(self, epoch): method step_begin_epoch (line 63) | def step_begin_epoch(self, epoch): method step_update (line 69) | def step_update(self, num_updates): FILE: fairseq/optim/lr_scheduler/inverse_square_root_schedule.py class InverseSquareRootLRScheduleConfig (line 17) | class InverseSquareRootLRScheduleConfig(FairseqDataclass): class InverseSquareRootSchedule (line 32) | class InverseSquareRootSchedule(FairseqLRScheduler): method __init__ (line 51) | def __init__(self, cfg: InverseSquareRootLRScheduleConfig, optimizer): method step (line 72) | def step(self, epoch, val_loss=None): method step_update (line 78) | def step_update(self, num_updates): FILE: fairseq/optim/lr_scheduler/manual_lr_scheduler.py class ManualSchedule (line 15) | class ManualSchedule(LegacyFairseqLRScheduler): method __init__ (line 18) | def __init__(self, args, optimizer): method parse_manuallr_args (line 34) | def parse_manuallr_args(self, lr_args_str): method add_args (line 56) | def add_args(parser): method state_dict (line 75) | def state_dict(self): method load_state_dict (line 78) | def load_state_dict(self, state_dict): method get_next_lr (line 82) | def get_next_lr(self, epoch): method step_begin_epoch (line 98) | def step_begin_epoch(self, epoch): method step_update (line 104) | def step_update(self, num_updates): FILE: fairseq/optim/lr_scheduler/pass_through.py class PassThroughScheduleConfig (line 13) | class PassThroughScheduleConfig(FairseqDataclass): class PassThroughScheduleSchedule (line 18) | class PassThroughScheduleSchedule(FairseqLRScheduler): method __init__ (line 21) | def __init__(self, cfg: PassThroughScheduleConfig, optimizer): method state_dict (line 27) | def state_dict(self): method load_state_dict (line 30) | def load_state_dict(self, state_dict): method step_begin_epoch (line 33) | def step_begin_epoch(self, epoch): method step_update (line 37) | def step_update(self, num_updates): FILE: fairseq/optim/lr_scheduler/polynomial_decay_schedule.py class PolynomialDecayLRScheduleConfig (line 15) | class PolynomialDecayLRScheduleConfig(FairseqDataclass): class PolynomialDecayLRSchedule (line 40) | class PolynomialDecayLRSchedule(FairseqLRScheduler): method __init__ (line 43) | def __init__(self, cfg: PolynomialDecayLRScheduleConfig, optimizer): method get_next_lr (line 58) | def get_next_lr(self, epoch): method step_begin_epoch (line 68) | def step_begin_epoch(self, epoch): method step_update (line 74) | def step_update(self, num_updates): FILE: fairseq/optim/lr_scheduler/reduce_lr_on_plateau.py class ReduceLROnPlateauLRScheduleConfig (line 17) | class ReduceLROnPlateauLRScheduleConfig(FairseqDataclass): class ReduceLROnPlateauLRSchedule (line 58) | class ReduceLROnPlateauLRSchedule(FairseqLRScheduler): method __init__ (line 75) | def __init__(self, cfg: ReduceLROnPlateauLRScheduleConfig, optimizer): method state_dict (line 107) | def state_dict(self): method load_state_dict (line 114) | def load_state_dict(self, state_dict): method step (line 120) | def step(self, epoch, val_loss=None): method step_update (line 131) | def step_update(self, num_updates): FILE: fairseq/optim/lr_scheduler/step_lr_scheduler.py class StepLRScheduleConfig (line 17) | class StepLRScheduleConfig(FairseqDataclass): class StepLRSchedule (line 38) | class StepLRSchedule(FairseqLRScheduler): method __init__ (line 41) | def __init__(self, cfg: StepLRScheduleConfig, fairseq_optimizer): method step (line 69) | def step(self, epoch, val_loss=None): method step_update (line 75) | def step_update(self, num_updates): FILE: fairseq/optim/lr_scheduler/tri_stage_lr_scheduler.py class TriStageLRScheduleConfig (line 16) | class TriStageLRScheduleConfig(FairseqDataclass): class TriStageLRSchedule (line 51) | class TriStageLRSchedule(FairseqLRScheduler): method __init__ (line 89) | def __init__(self, cfg: TriStageLRScheduleConfig, optimizer): method _decide_stage (line 128) | def _decide_stage(self, update_step): method step (line 153) | def step(self, epoch, val_loss=None): method step_update (line 159) | def step_update(self, num_updates): FILE: fairseq/optim/lr_scheduler/triangular_lr_scheduler.py class TriangularLRScheduleConfig (line 17) | class TriangularLRScheduleConfig(FairseqDataclass): class TriangularLRSchedule (line 35) | class TriangularLRSchedule(FairseqLRScheduler): method __init__ (line 41) | def __init__(self, cfg: TriangularLRScheduleConfig, optimizer): method step (line 62) | def step(self, epoch, val_loss=None): method step_update (line 68) | def step_update(self, num_updates): FILE: fairseq/optim/nag.py class FairseqNAGConfig (line 19) | class FairseqNAGConfig(FairseqDataclass): class FairseqNAG (line 27) | class FairseqNAG(FairseqOptimizer): method __init__ (line 28) | def __init__(self, cfg: DictConfig, params): method optimizer_config (line 33) | def optimizer_config(self): class NAG (line 49) | class NAG(Optimizer): method __init__ (line 50) | def __init__(self, params, lr=required, momentum=0, weight_decay=0): method supports_memory_efficient_fp16 (line 55) | def supports_memory_efficient_fp16(self): method supports_flat_params (line 59) | def supports_flat_params(self): method step (line 62) | def step(self, closure=None): FILE: fairseq/optim/sgd.py class SGD (line 12) | class SGD(LegacyFairseqOptimizer): method __init__ (line 13) | def __init__(self, args, params): method add_args (line 18) | def add_args(parser): method optimizer_config (line 28) | def optimizer_config(self): method supports_flat_params (line 42) | def supports_flat_params(self): FILE: fairseq/optim/shard.py function shard_ (line 19) | def shard_(optimizer, group): FILE: fairseq/options.py function get_preprocessing_parser (line 31) | def get_preprocessing_parser(default_task="translation"): function get_training_parser (line 37) | def get_training_parser(default_task="translation"): function get_generation_parser (line 48) | def get_generation_parser(interactive=False, default_task="translation"): function get_speech_generation_parser (line 59) | def get_speech_generation_parser(default_task="text_to_speech"): function get_interactive_generation_parser (line 67) | def get_interactive_generation_parser(default_task="translation"): function get_eval_lm_parser (line 71) | def get_eval_lm_parser(default_task="language_modeling"): function get_validation_parser (line 79) | def get_validation_parser(default_task=None): function parse_args_and_arch (line 88) | def parse_args_and_arch( function get_parser (line 228) | def get_parser(desc, default_task="translation"): function add_preprocess_args (line 262) | def add_preprocess_args(parser): function add_dataset_args (line 312) | def add_dataset_args(parser, train=False, gen=False): function add_distributed_training_args (line 319) | def add_distributed_training_args(parser, default_world_size=None): function add_optimization_args (line 329) | def add_optimization_args(parser): function add_checkpoint_args (line 337) | def add_checkpoint_args(parser): function add_common_eval_args (line 345) | def add_common_eval_args(group): function add_eval_lm_args (line 349) | def add_eval_lm_args(parser): function add_generation_args (line 355) | def add_generation_args(parser): function add_speech_generation_args (line 362) | def add_speech_generation_args(parser): function add_interactive_args (line 372) | def add_interactive_args(parser): function add_model_args (line 377) | def add_model_args(parser): function get_args (line 396) | def get_args( function add_ema_args (line 411) | def add_ema_args(parser): FILE: fairseq/pdb.py class MultiprocessingPdb (line 23) | class MultiprocessingPdb(pdb.Pdb): method __init__ (line 29) | def __init__(self): method _cmdloop (line 32) | def _cmdloop(self): function set_trace (line 45) | def set_trace(): FILE: fairseq/quantization_utils.py function quantize_model_scalar (line 15) | def quantize_model_scalar(model, model_cfg: DictConfig): class Quantizer (line 23) | class Quantizer(object): method __init__ (line 24) | def __init__(self, config_path, max_epoch, max_update): method set_trainer (line 71) | def set_trainer(self, trainer): method step (line 75) | def step(self): method begin_epoch (line 104) | def begin_epoch(self, epoch): method step_update (line 118) | def step_update(self, num_updates): method state_dict (line 127) | def state_dict(self): method load_state_dict (line 137) | def load_state_dict(self, state_dict): FILE: fairseq/registry.py function setup_registry (line 17) | def setup_registry(registry_name: str, base_class=None, default=None, re... FILE: fairseq/scoring/__init__.py class BaseScorer (line 15) | class BaseScorer(ABC): method __init__ (line 16) | def __init__(self, cfg): method add_string (line 21) | def add_string(self, ref, pred): method score (line 26) | def score(self) -> float: method result_string (line 30) | def result_string(self) -> str: function build_scorer (line 39) | def build_scorer(choice, tgt_dict): FILE: fairseq/scoring/bertscore.py class BertScoreScorerConfig (line 15) | class BertScoreScorerConfig(FairseqDataclass): class BertScoreScorer (line 20) | class BertScoreScorer(BaseScorer): method __init__ (line 21) | def __init__(self, cfg): method add_string (line 32) | def add_string(self, ref, pred): method score (line 36) | def score(self, order=4): method result_string (line 43) | def result_string(self, order=4): FILE: fairseq/scoring/bleu.py class BleuStat (line 17) | class BleuStat(ctypes.Structure): class SacrebleuConfig (line 33) | class SacrebleuConfig(FairseqDataclass): class SacrebleuScorer (line 46) | class SacrebleuScorer(BaseScorer): method __init__ (line 47) | def __init__(self, cfg): method add_string (line 58) | def add_string(self, ref, pred): method _score (line 62) | def _score(self, order=4): method score (line 68) | def score(self, order=4): method result_string (line 71) | def result_string(self, order=4): class BleuConfig (line 76) | class BleuConfig(FairseqDataclass): class Scorer (line 83) | class Scorer(object): method __init__ (line 84) | def __init__(self, cfg): method reset (line 102) | def reset(self, one_init=False): method add (line 108) | def add(self, ref, pred): method score (line 132) | def score(self, order=4): method precision (line 138) | def precision(self): method brevity (line 149) | def brevity(self): method result_string (line 153) | def result_string(self, order=4): FILE: fairseq/scoring/chrf.py class ChrFScorerConfig (line 14) | class ChrFScorerConfig(FairseqDataclass): class ChrFScorer (line 19) | class ChrFScorer(BaseScorer): method __init__ (line 20) | def __init__(self, args): method add_string (line 26) | def add_string(self, ref, pred): method score (line 30) | def score(self, order=4): method result_string (line 33) | def result_string(self, order=4): FILE: fairseq/scoring/meteor.py class MeteorScorerConfig (line 14) | class MeteorScorerConfig(FairseqDataclass): class MeteorScorer (line 19) | class MeteorScorer(BaseScorer): method __init__ (line 20) | def __init__(self, args): method add_string (line 30) | def add_string(self, ref, pred): method score (line 34) | def score(self, order=4): method result_string (line 41) | def result_string(self, order=4): FILE: fairseq/scoring/tokenizer.py class EvaluationTokenizer (line 15) | class EvaluationTokenizer(object): method __init__ (line 38) | def __init__( method remove_punctuation (line 58) | def remove_punctuation(cls, sent: str): method tokenize (line 66) | def tokenize(self, sent: str): FILE: fairseq/scoring/wer.py class WerScorerConfig (line 14) | class WerScorerConfig(FairseqDataclass): class WerScorer (line 28) | class WerScorer(BaseScorer): method __init__ (line 29) | def __init__(self, cfg): method reset (line 44) | def reset(self): method add_string (line 48) | def add_string(self, ref, pred): method result_string (line 54) | def result_string(self): method score (line 57) | def score(self): FILE: fairseq/search.py class Search (line 20) | class Search(nn.Module): method __init__ (line 21) | def __init__(self, tgt_dict): method step (line 31) | def step( method set_src_lengths (line 62) | def set_src_lengths(self, src_lengths): method init_constraints (line 66) | def init_constraints(self, batch_constraints: Optional[Tensor], beam_s... method prune_sentences (line 79) | def prune_sentences(self, batch_idxs: Tensor): method update_constraints (line 90) | def update_constraints(self, active_hypos: Tensor): class BeamSearch (line 104) | class BeamSearch(Search): method __init__ (line 105) | def __init__(self, tgt_dict): method step (line 110) | def step( class PrefixConstrainedBeamSearch (line 149) | class PrefixConstrainedBeamSearch(Search): method __init__ (line 150) | def __init__(self, tgt_dict, prefix_allowed_tokens_fn): method apply_mask (line 156) | def apply_mask(self, x, prev_output_tokens, original_batch_idxs): method step (line 171) | def step( class LexicallyConstrainedBeamSearch (line 212) | class LexicallyConstrainedBeamSearch(Search): method __init__ (line 231) | def __init__(self, tgt_dict, representation): method init_constraints (line 239) | def init_constraints(self, batch_constraints: Optional[Tensor], beam_s... method prune_sentences (line 250) | def prune_sentences(self, batch_idxs: Tensor): method update_constraints (line 256) | def update_constraints(self, active_hypos: Tensor): method step (line 265) | def step( method step_sentence (line 383) | def step_sentence( class LengthConstrainedBeamSearch (line 528) | class LengthConstrainedBeamSearch(Search): method __init__ (line 529) | def __init__(self, tgt_dict, min_len_a, min_len_b, max_len_a, max_len_b): method step (line 538) | def step( class DiverseBeamSearch (line 553) | class DiverseBeamSearch(Search): method __init__ (line 590) | def __init__( method step (line 612) | def step( class Sampling (line 699) | class Sampling(Search): method __init__ (line 703) | def __init__(self, tgt_dict, sampling_topk=-1, sampling_topp=-1.0): method _sample_topp (line 708) | def _sample_topp(self, lprobs): method step (line 754) | def step( class DiverseSiblingsSearch (line 823) | class DiverseSiblingsSearch(Search): method __init__ (line 838) | def __init__(self, tgt_dict, diversity_rate): method step (line 843) | def step( FILE: fairseq/sequence_generator.py class SequenceGenerator (line 20) | class SequenceGenerator(nn.Module): method __init__ (line 21) | def __init__( method cuda (line 133) | def cuda(self): method forward (line 138) | def forward( method generate_batched_itr (line 156) | def generate_batched_itr(self, data_itr, beam_size=None, cuda=False, t... method generate (line 189) | def generate( method _generate (line 206) | def _generate( method _prefix_tokens (line 596) | def _prefix_tokens( method replicate_first_beam (line 625) | def replicate_first_beam(self, tensor, mask, beam_size: int): method finalize_hypos (line 630) | def finalize_hypos( method is_finished (line 741) | def is_finished( class EnsembleModel (line 760) | class EnsembleModel(nn.Module): method __init__ (line 763) | def __init__(self, models): method forward (line 777) | def forward(self): method has_encoder (line 780) | def has_encoder(self): method has_incremental_states (line 783) | def has_incremental_states(self): method max_decoder_positions (line 786) | def max_decoder_positions(self): method set_decoder_beam_size (line 796) | def set_decoder_beam_size(self, beam_size): method forward_encoder (line 804) | def forward_encoder(self, net_input: Dict[str, Tensor]): method forward_decoder (line 810) | def forward_decoder( method reorder_encoder_out (line 877) | def reorder_encoder_out( method reorder_incremental_state (line 901) | def reorder_incremental_state( class SequenceGeneratorWithAlignment (line 914) | class SequenceGeneratorWithAlignment(SequenceGenerator): method __init__ (line 915) | def __init__( method generate (line 937) | def generate(self, models, sample, **kwargs): method _prepare_batch_for_alignment (line 970) | def _prepare_batch_for_alignment(self, sample, hypothesis): class EnsembleModelWithAlignment (line 1003) | class EnsembleModelWithAlignment(EnsembleModel): method __init__ (line 1006) | def __init__(self, models): method forward_align (line 1009) | def forward_align(self, src_tokens, src_lengths, prev_output_tokens): FILE: fairseq/sequence_scorer.py class SequenceScorer (line 12) | class SequenceScorer(object): method __init__ (line 15) | def __init__( method generate (line 35) | def generate(self, models, sample, **kwargs): FILE: fairseq/speech_generator.py class SpeechGenerator (line 12) | class SpeechGenerator(object): method __init__ (line 13) | def __init__(self, model, vocoder, data_cfg: S2TDataConfig): method gcmvn_denormalize (line 21) | def gcmvn_denormalize(self, x): method get_waveform (line 31) | def get_waveform(self, feat): class AutoRegressiveSpeechGenerator (line 36) | class AutoRegressiveSpeechGenerator(SpeechGenerator): method __init__ (line 37) | def __init__( method generate (line 50) | def generate(self, model, sample, has_targ=False, **kwargs): class MultiDecoderSpeechGenerator (line 129) | class MultiDecoderSpeechGenerator(SpeechGenerator): method __init__ (line 130) | def __init__( method generate (line 171) | def generate(self, model, sample, has_targ=False, **kwargs): class NonAutoregressiveSpeechGenerator (line 325) | class NonAutoregressiveSpeechGenerator(SpeechGenerator): method generate (line 327) | def generate(self, model, sample, has_targ=False, **kwargs): class TeacherForcingAutoRegressiveSpeechGenerator (line 379) | class TeacherForcingAutoRegressiveSpeechGenerator(AutoRegressiveSpeechGe... method generate (line 381) | def generate(self, model, sample, has_targ=False, **kwargs): FILE: fairseq/tasks/__init__.py function setup_task (line 24) | def setup_task(cfg: FairseqDataclass, **kwargs): function register_task (line 50) | def register_task(name, dataclass=None): function get_task (line 106) | def get_task(name): function import_tasks (line 110) | def import_tasks(tasks_dir, namespace): FILE: fairseq/tasks/audio_classification.py class AudioClassificationConfig (line 35) | class AudioClassificationConfig(AudioPretrainingConfig): class AudioClassificationTask (line 42) | class AudioClassificationTask(AudioPretrainingTask): method __init__ (line 47) | def __init__( method load_target_dictionary (line 55) | def load_target_dictionary(self): method load_dataset (line 65) | def load_dataset( method source_dictionary (line 168) | def source_dictionary(self): method target_dictionary (line 172) | def target_dictionary(self): method train_step (line 177) | def train_step(self, sample, model, *args, **kwargs): method valid_step (line 185) | def valid_step(self, sample, model, criterion): method _log_metrics (line 191) | def _log_metrics(self, sample, model, logging_output): method _inference_with_metrics (line 206) | def _inference_with_metrics(self, sample, model): method reduce_metrics (line 237) | def reduce_metrics(self, logging_outputs, criterion): FILE: fairseq/tasks/audio_finetuning.py class LabelEncoder (line 32) | class LabelEncoder(object): method __init__ (line 33) | def __init__(self, dictionary): method __call__ (line 36) | def __call__(self, label): function label_len_fn (line 42) | def label_len_fn(label): class AudioFinetuningConfig (line 47) | class AudioFinetuningConfig(AudioPretrainingConfig): class AudioFinetuningTask (line 113) | class AudioFinetuningTask(AudioPretrainingTask): method __init__ (line 118) | def __init__( method load_target_dictionary (line 127) | def load_target_dictionary(self): method load_dataset (line 137) | def load_dataset( method target_dictionary (line 228) | def target_dictionary(self): method valid_step (line 233) | def valid_step(self, sample, model, criterion): method build_model (line 253) | def build_model(self, model_cfg: FairseqDataclass, from_checkpoint=Fal... method _inference_with_wer (line 281) | def _inference_with_wer(self, generator, sample, model): method _inference_with_bleu (line 316) | def _inference_with_bleu(self, generator, sample, model): method reduce_metrics (line 351) | def reduce_metrics(self, logging_outputs, criterion): FILE: fairseq/tasks/audio_pretraining.py class AudioMaskingConfig (line 29) | class AudioMaskingConfig: class AudioPretrainingConfig (line 42) | class AudioPretrainingConfig(FairseqDataclass): class AudioPretrainingTask (line 103) | class AudioPretrainingTask(FairseqTask): method setup_task (line 109) | def setup_task(cls, cfg: AudioPretrainingConfig, **kwargs): method load_dataset (line 118) | def load_dataset(self, split: str, task_cfg: FairseqDataclass = None, ... method max_positions (line 219) | def max_positions(self): method build_model (line 223) | def build_model(self, model_cfg: FairseqDataclass, from_checkpoint=Fal... method post_save (line 234) | def post_save(self, cp_path, num_updates): FILE: fairseq/tasks/cross_lingual_lm.py class CrossLingualLMTask (line 24) | class CrossLingualLMTask(LegacyFairseqTask): method add_args (line 35) | def add_args(parser): method __init__ (line 61) | def __init__(self, args, dictionary): method _lang_to_id (line 68) | def _lang_to_id(self, languages: str): method load_dictionary (line 80) | def load_dictionary(cls, filename): method build_dictionary (line 84) | def build_dictionary( method target_dictionary (line 96) | def target_dictionary(self): method setup_task (line 100) | def setup_task(cls, args, **kwargs): method _load_single_lang_dataset (line 106) | def _load_single_lang_dataset(self, split, epoch): method load_dataset (line 154) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): FILE: fairseq/tasks/denoising.py class DenoisingConfig (line 43) | class DenoisingConfig(FairseqDataclass): class DenoisingTask (line 139) | class DenoisingTask(FairseqTask): method __init__ (line 146) | def __init__(self, cfg, dictionary): method setup_task (line 154) | def setup_task(cls, cfg: DenoisingConfig, **kwargs): method _load_dataset_split (line 164) | def _load_dataset_split(self, split, epoch, combine): method load_dataset (line 210) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method build_dataset_for_inference (line 249) | def build_dataset_for_inference(self, src_tokens, src_lengths, **kwargs): method max_positions (line 284) | def max_positions(self): method source_dictionary (line 289) | def source_dictionary(self): method target_dictionary (line 294) | def target_dictionary(self): FILE: fairseq/tasks/fairseq_task.py class StatefulContainer (line 25) | class StatefulContainer(object): method __init__ (line 26) | def __init__(self): method add_factory (line 30) | def add_factory(self, name, factory: Callable[[], Any]): method merge_state_dict (line 33) | def merge_state_dict(self, state_dict: Dict[str, Any]): method state_dict (line 37) | def state_dict(self) -> Dict[str, Any]: method __getattr__ (line 40) | def __getattr__(self, name): class FairseqTask (line 50) | class FairseqTask(object): method add_args (line 67) | def add_args(cls, parser): method logging_outputs_can_be_summed (line 74) | def logging_outputs_can_be_summed(criterion) -> bool: method __init__ (line 82) | def __init__(self, cfg: FairseqDataclass, **kwargs): method load_dictionary (line 89) | def load_dictionary(cls, filename): method build_dictionary (line 98) | def build_dictionary( method setup_task (line 122) | def setup_task(cls, cfg: DictConfig, **kwargs): method has_sharded_data (line 130) | def has_sharded_data(self, split): method load_dataset (line 133) | def load_dataset( method dataset (line 150) | def dataset(self, split): method filter_indices_by_size (line 168) | def filter_indices_by_size( method can_reuse_epoch_itr (line 201) | def can_reuse_epoch_itr(self, dataset): method get_batch_iterator (line 208) | def get_batch_iterator( method build_model (line 342) | def build_model(self, cfg: FairseqDataclass, from_checkpoint=False): method build_criterion (line 359) | def build_criterion(self, cfg: DictConfig, from_checkpoint=False): method build_generator (line 374) | def build_generator( method train_step (line 505) | def train_step( method valid_step (line 539) | def valid_step(self, sample, model, criterion): method optimizer_step (line 545) | def optimizer_step(self, optimizer, model, update_num): method build_dataset_for_inference (line 548) | def build_dataset_for_inference( method inference_step (line 553) | def inference_step( method begin_epoch (line 561) | def begin_epoch(self, epoch, model): method begin_valid_epoch (line 565) | def begin_valid_epoch(self, epoch, model): method aggregate_logging_outputs (line 569) | def aggregate_logging_outputs(self, logging_outputs, criterion): method reduce_metrics (line 579) | def reduce_metrics(self, logging_outputs, criterion): method state_dict (line 615) | def state_dict(self): method load_state_dict (line 620) | def load_state_dict(self, state_dict: Dict[str, Any]): method max_positions (line 624) | def max_positions(self): method source_dictionary (line 629) | def source_dictionary(self): method target_dictionary (line 635) | def target_dictionary(self): method build_tokenizer (line 640) | def build_tokenizer(self, args): method build_bpe (line 644) | def build_bpe(self, args): method get_interactive_tokens_and_lengths (line 648) | def get_interactive_tokens_and_lengths(self, lines, encode_fn): class LegacyFairseqTask (line 659) | class LegacyFairseqTask(FairseqTask): method __init__ (line 660) | def __init__(self, args: Namespace): method setup_task (line 667) | def setup_task(cls, args: Namespace, **kwargs): method has_sharded_data (line 675) | def has_sharded_data(self, split): method build_model (line 678) | def build_model(self, args: Namespace, from_checkpoint=False): method build_criterion (line 695) | def build_criterion(self, args: Namespace): FILE: fairseq/tasks/frm_text_to_speech.py class FrmTextToSpeechTask (line 22) | class FrmTextToSpeechTask(TextToSpeechTask): method add_args (line 24) | def add_args(parser): method load_dataset (line 34) | def load_dataset(self, split, **unused_kwargs): FILE: fairseq/tasks/hubert_pretraining.py class LabelEncoder (line 25) | class LabelEncoder(object): method __init__ (line 26) | def __init__(self, dictionary: Dictionary) -> None: method __call__ (line 29) | def __call__(self, label: str) -> List[str]: class HubertPretrainingConfig (line 38) | class HubertPretrainingConfig(FairseqDataclass): class HubertPretrainingTask (line 106) | class HubertPretrainingTask(FairseqTask): method __init__ (line 110) | def __init__( method source_dictionary (line 130) | def source_dictionary(self) -> Optional[Dictionary]: method target_dictionary (line 134) | def target_dictionary(self) -> Optional[Dictionary]: method dictionaries (line 138) | def dictionaries(self) -> List[Dictionary]: method setup_task (line 142) | def setup_task( method load_dictionaries (line 147) | def load_dictionaries(self): method get_label_dir (line 155) | def get_label_dir(self) -> str: method load_dataset (line 160) | def load_dataset(self, split: str, **kwargs) -> None: method max_positions (line 187) | def max_positions(self) -> Tuple[int, int]: method filter_indices_by_size (line 190) | def filter_indices_by_size(self, indices: np.array, *args, **kwargs) -... FILE: fairseq/tasks/language_modeling.py class LanguageModelingConfig (line 42) | class LanguageModelingConfig(FairseqDataclass): class LanguageModelingTask (line 110) | class LanguageModelingTask(LegacyFairseqTask): method __init__ (line 139) | def __init__(self, args, dictionary, output_dictionary=None, targets=N... method setup_dictionary (line 149) | def setup_dictionary(cls, args, **kwargs): method setup_task (line 165) | def setup_task(cls, args, **kwargs): method build_model (line 190) | def build_model(self, args, from_checkpoint=False): method load_dataset (line 200) | def load_dataset( method build_dataset_for_inference (line 269) | def build_dataset_for_inference(self, src_tokens, src_lengths, **kwargs): method inference_step (line 314) | def inference_step( method eval_lm_dataloader (line 340) | def eval_lm_dataloader( method source_dictionary (line 374) | def source_dictionary(self): method target_dictionary (line 380) | def target_dictionary(self): FILE: fairseq/tasks/legacy_masked_lm.py class LegacyMaskedLMTask (line 23) | class LegacyMaskedLMTask(LegacyFairseqTask): method add_args (line 31) | def add_args(parser): method __init__ (line 50) | def __init__(self, args, dictionary): method load_dictionary (line 56) | def load_dictionary(cls, filename): method build_dictionary (line 60) | def build_dictionary( method target_dictionary (line 72) | def target_dictionary(self): method setup_task (line 76) | def setup_task(cls, args, **kwargs): method load_dataset (line 85) | def load_dataset(self, split, epoch=1, combine=False): FILE: fairseq/tasks/masked_lm.py class MaskedLMConfig (line 39) | class MaskedLMConfig(FairseqDataclass): class MaskedLMTask (line 129) | class MaskedLMTask(FairseqTask): method __init__ (line 135) | def __init__(self, cfg: MaskedLMConfig, dictionary=None): method setup_task (line 143) | def setup_task(cls, cfg: MaskedLMConfig, **kwargs): method load_dict (line 148) | def load_dict(cls, cfg): method _load_dataset_split (line 155) | def _load_dataset_split(self, split, epoch, combine): method load_dataset (line 194) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method _regular_dataset (line 242) | def _regular_dataset(self, src_dataset, target_dataset): method _d2v2_multi_dataset (line 267) | def _d2v2_multi_dataset(self, src_dataset): method build_dataset_for_inference (line 288) | def build_dataset_for_inference(self, src_tokens, src_lengths, sort=Tr... method source_dictionary (line 316) | def source_dictionary(self): method target_dictionary (line 320) | def target_dictionary(self): method begin_epoch (line 323) | def begin_epoch(self, epoch, model): method max_positions (line 326) | def max_positions(self): FILE: fairseq/tasks/multilingual_denoising.py class MultilingualDenoisingConfig (line 33) | class MultilingualDenoisingConfig(DenoisingConfig): class MultilingualDenoisingTask (line 57) | class MultilingualDenoisingTask(DenoisingTask): method setup_task (line 62) | def setup_task(cls, cfg: MultilingualDenoisingConfig, **kwargs): method __init__ (line 89) | def __init__(self, cfg: MultilingualDenoisingConfig, dictionary): method _get_sample_prob (line 97) | def _get_sample_prob(self, dataset_lens): method load_dataset (line 107) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): FILE: fairseq/tasks/multilingual_language_modeling.py function lang_token (line 44) | def lang_token(lang): class MultilingualLanguageModelingConfig (line 49) | class MultilingualLanguageModelingConfig(FairseqDataclass): class MultilingualLanguageModelingTask (line 153) | class MultilingualLanguageModelingTask(LegacyFairseqTask): method __init__ (line 182) | def __init__(self, args, dictionary, output_dictionary=None, targets=N... method _get_langs (line 192) | def _get_langs(args, epoch=1): method setup_dictionary (line 210) | def setup_dictionary(cls, args, **kwargs): method setup_task (line 234) | def setup_task(cls, args, **kwargs): method build_model (line 259) | def build_model(self, args, from_checkpoint=False): method _get_sample_prob (line 269) | def _get_sample_prob(self, dataset_lens): method load_dataset (line 279) | def load_dataset(self, split: str, epoch=1, combine=False, **kwargs): method build_dataset_for_inference (line 496) | def build_dataset_for_inference( method inference_step (line 552) | def inference_step( method eval_lm_dataloader (line 584) | def eval_lm_dataloader( method source_dictionary (line 618) | def source_dictionary(self): method target_dictionary (line 624) | def target_dictionary(self): FILE: fairseq/tasks/multilingual_masked_lm.py class MultiLingualMaskedLMTask (line 36) | class MultiLingualMaskedLMTask(LegacyFairseqTask): method add_args (line 40) | def add_args(parser): method __init__ (line 100) | def __init__(self, args, dictionary): method setup_task (line 109) | def setup_task(cls, args, **kwargs): method _get_whole_word_mask (line 116) | def _get_whole_word_mask(self): method _get_sample_prob (line 141) | def _get_sample_prob(self, dataset_lens): method load_dataset (line 151) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method build_dataset_for_inference (line 304) | def build_dataset_for_inference(self, src_tokens, src_lengths, sort=Tr... method source_dictionary (line 333) | def source_dictionary(self): method target_dictionary (line 337) | def target_dictionary(self): FILE: fairseq/tasks/multilingual_translation.py function _lang_token (line 30) | def _lang_token(lang: str): function _lang_token_index (line 34) | def _lang_token_index(dic: Dictionary, lang: str): class MultilingualTranslationTask (line 42) | class MultilingualTranslationTask(LegacyFairseqTask): method add_args (line 68) | def add_args(parser): method __init__ (line 100) | def __init__(self, args, dicts, training): method setup_task (line 121) | def setup_task(cls, args, **kwargs): method update_args (line 126) | def update_args(cls, args): method prepare (line 138) | def prepare(cls, args, **kargs): method get_encoder_langtok (line 166) | def get_encoder_langtok(self, src_lang, tgt_lang): method get_decoder_langtok (line 174) | def get_decoder_langtok(self, tgt_lang): method alter_dataset_langtok (line 179) | def alter_dataset_langtok( method load_dataset (line 215) | def load_dataset(self, split, epoch=1, **kwargs): method build_dataset_for_inference (line 258) | def build_dataset_for_inference(self, src_tokens, src_lengths, constra... method build_model (line 285) | def build_model(self, args, from_checkpoint=False): method _per_lang_pair_train_loss (line 327) | def _per_lang_pair_train_loss( method train_step (line 338) | def train_step( method _per_lang_pair_valid_loss (line 381) | def _per_lang_pair_valid_loss(self, lang_pair, model, criterion, sample): method valid_step (line 384) | def valid_step(self, sample, model, criterion): method inference_step (line 408) | def inference_step( method reduce_metrics (line 426) | def reduce_metrics(self, logging_outputs, criterion): method source_dictionary (line 434) | def source_dictionary(self): method target_dictionary (line 441) | def target_dictionary(self): method max_positions (line 447) | def max_positions(self): FILE: fairseq/tasks/multires_hubert_pretraining.py class LabelEncoder (line 25) | class LabelEncoder(object): method __init__ (line 26) | def __init__(self, dictionary: Dictionary) -> None: method __call__ (line 29) | def __call__(self, label: str) -> List[str]: class MultiresHubertPretrainingConfig (line 38) | class MultiresHubertPretrainingConfig(FairseqDataclass): class MultiresHubertPretrainingTask (line 105) | class MultiresHubertPretrainingTask(FairseqTask): method __init__ (line 113) | def __init__( method source_dictionary (line 134) | def source_dictionary(self) -> Optional[Dictionary]: method target_dictionary (line 138) | def target_dictionary(self) -> Optional[Dictionary]: method dictionaries (line 142) | def dictionaries(self) -> List[Dictionary]: method setup_task (line 146) | def setup_task( method load_dictionaries (line 151) | def load_dictionaries(self): method get_label_dir (line 157) | def get_label_dir(self) -> str: method load_dataset (line 162) | def load_dataset(self, split: str, **kwargs) -> None: method max_positions (line 200) | def max_positions(self) -> Tuple[int, int]: method filter_indices_by_size (line 203) | def filter_indices_by_size(self, indices: np.array, *args, **kwargs) -... FILE: fairseq/tasks/nlu_finetuning.py class LabelEncoder (line 31) | class LabelEncoder(object): method __init__ (line 32) | def __init__(self, dictionary): method __call__ (line 35) | def __call__(self, label): function label_len_fn (line 41) | def label_len_fn(label): class NLUFinetuningConfig (line 46) | class NLUFinetuningConfig(AudioPretrainingConfig): class NLUFinetuningTask (line 109) | class NLUFinetuningTask(AudioPretrainingTask): method __init__ (line 114) | def __init__( method load_target_dictionary (line 123) | def load_target_dictionary(self): method load_dataset (line 129) | def load_dataset(self, split: str, task_cfg: NLUFinetuningConfig = Non... method target_dictionary (line 168) | def target_dictionary(self): method valid_step (line 173) | def valid_step(self, sample, model, criterion): method build_model (line 205) | def build_model(self, model_cfg: FairseqDataclass): method _inference_with_wer_parse (line 233) | def _inference_with_wer_parse(self, generator, sample, model): method _inference_with_wer (line 321) | def _inference_with_wer(self, generator, sample, model): method _inference_with_bleu (line 356) | def _inference_with_bleu(self, generator, sample, model): method reduce_metrics (line 391) | def reduce_metrics(self, logging_outputs, criterion): FILE: fairseq/tasks/online_backtranslation.py class PiecewiseLinearFn (line 42) | class PiecewiseLinearFn: method __init__ (line 45) | def __init__(self, pieces: Sequence[Tuple[int, float]]): method __call__ (line 52) | def __call__(self, x: int) -> float: method from_string (line 61) | def from_string(configuration: str) -> "PiecewiseLinearFn": method one (line 88) | def one() -> "PiecewiseLinearFn": class OnlineBackTranslationTask (line 93) | class OnlineBackTranslationTask(TranslationTask): method add_args (line 95) | def add_args(parser): method __init__ (line 168) | def __init__(self, args, common_dict, mono_langs, valid_lang_pairs): method setup_task (line 192) | def setup_task(cls, args, **kwargs): method load_dataset (line 214) | def load_dataset(self, split, epoch=1, combine=False, **kwargs) -> Fai... method load_train_dataset (line 230) | def load_train_dataset(self, data_path: str) -> FairseqDataset: method _langpair_dataset (line 244) | def _langpair_dataset( method _prepend_lang_bos_to_target (line 260) | def _prepend_lang_bos_to_target( method load_bt_dataset (line 272) | def load_bt_dataset(self, data_path: str, lang: str) -> FairseqDataset: method load_denoise_dataset (line 296) | def load_denoise_dataset(self, data_path: str, lang: str) -> FairseqDa... method load_translation_dataset (line 320) | def load_translation_dataset( method build_dataset_for_inference (line 355) | def build_dataset_for_inference(self, src_tokens, src_lengths, constra... method build_model (line 358) | def build_model(self, args, from_checkpoint=False): method max_positions (line 397) | def max_positions(self): method dictionary (line 402) | def dictionary(self): method display_samples_once_in_a_while (line 406) | def display_samples_once_in_a_while(self, smp, mono_lang, other_lang): method backtranslate_sample (line 432) | def backtranslate_sample(self, smp, orig_lang, other_lang) -> None: method generate (line 480) | def generate(self, smp, model): method get_other_lang (line 494) | def get_other_lang(self, lang): method train_step (line 502) | def train_step( method get_bos_token_from_sample (line 553) | def get_bos_token_from_sample(self, sample): method reduce_metrics (line 563) | def reduce_metrics(self, logging_outputs, criterion): function extend_embedding (line 596) | def extend_embedding( function add_secial_tokens_to_dict_and_model (line 630) | def add_secial_tokens_to_dict_and_model( function _lang_token (line 664) | def _lang_token(lang: str) -> str: function _lang_token_index (line 668) | def _lang_token_index(dictionary, lang: str) -> int: function assert_weights_have_changed (line 673) | def assert_weights_have_changed(model: nn.Module): FILE: fairseq/tasks/semisupervised_translation.py function _get_bt_dataset_key (line 32) | def _get_bt_dataset_key(lang_pair): function _get_denoising_dataset_key (line 36) | def _get_denoising_dataset_key(lang_pair): function parse_lambda_config (line 41) | def parse_lambda_config(x): class SemisupervisedTranslationTask (line 64) | class SemisupervisedTranslationTask(MultilingualTranslationTask): method add_args (line 88) | def add_args(parser): method __init__ (line 123) | def __init__(self, args, dicts, training): method setup_task (line 144) | def setup_task(cls, args, **kwargs): method load_dataset (line 148) | def load_dataset(self, split, epoch=1, **kwargs): method build_model (line 356) | def build_model(self, args, from_checkpoint=False): method train_step (line 398) | def train_step( method update_step (line 457) | def update_step(self, num_updates): FILE: fairseq/tasks/sentence_prediction.py class SentencePredictionConfig (line 42) | class SentencePredictionConfig(FairseqDataclass): class SentencePredictionTask (line 94) | class SentencePredictionTask(FairseqTask): method __init__ (line 102) | def __init__(self, cfg, data_dictionary, label_dictionary): method load_dictionary (line 108) | def load_dictionary(cls, filename): method setup_task (line 119) | def setup_task(cls, cfg, **kwargs): method load_dataset (line 138) | def load_dataset(self, split, combine=False, **kwargs): method build_model (line 275) | def build_model(self, cfg, from_checkpoint=False): method max_positions (line 290) | def max_positions(self): method source_dictionary (line 294) | def source_dictionary(self): method target_dictionary (line 298) | def target_dictionary(self): method label_dictionary (line 302) | def label_dictionary(self): FILE: fairseq/tasks/sentence_prediction_adapters.py class SentencePredictionAdapterTask (line 22) | class SentencePredictionAdapterTask(SentencePredictionTask): method build_model (line 23) | def build_model(self, cfg): FILE: fairseq/tasks/sentence_ranking.py class SentenceRankingTask (line 33) | class SentenceRankingTask(LegacyFairseqTask): method add_args (line 42) | def add_args(parser): method __init__ (line 73) | def __init__(self, args, dictionary): method load_dictionary (line 78) | def load_dictionary(cls, args, filename, source=True): method setup_task (line 89) | def setup_task(cls, args, **kwargs): method load_dataset (line 103) | def load_dataset(self, split, combine=False, **kwargs): method build_model (line 198) | def build_model(self, args, from_checkpoint=False): method max_positions (line 210) | def max_positions(self): method source_dictionary (line 214) | def source_dictionary(self): method target_dictionary (line 218) | def target_dictionary(self): FILE: fairseq/tasks/simultaneous_translation.py function check_import (line 22) | def check_import(flag): class SimulSpeechToTextTask (line 31) | class SimulSpeechToTextTask(SpeechToTextTask): method __init__ (line 32) | def __init__(self, args, tgt_dict): class SimulTextToTextTask (line 38) | class SimulTextToTextTask(TranslationTask): method __init__ (line 39) | def __init__(self, cfg, src_dict, tgt_dict): FILE: fairseq/tasks/span_masked_lm.py class SpanMaskedLMConfig (line 41) | class SpanMaskedLMConfig(FairseqDataclass): class SpanMaskedLMTask (line 106) | class SpanMaskedLMTask(FairseqTask): method __init__ (line 113) | def __init__(self, cfg, dictionary): method setup_task (line 118) | def setup_task(cls, cfg: SpanMaskedLMConfig, **kwargs): method _load_dataset_split (line 128) | def _load_dataset_split(self, split, epoch, combine): method load_dataset (line 173) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method build_dataset_for_inference (line 196) | def build_dataset_for_inference(self, src_tokens, src_lengths, **kwargs): method max_positions (line 231) | def max_positions(self): method source_dictionary (line 236) | def source_dictionary(self): method target_dictionary (line 241) | def target_dictionary(self): FILE: fairseq/tasks/speech_dlm_task.py class SpeechDLMConfig (line 44) | class SpeechDLMConfig(FairseqDataclass): class SpeechDLMTask (line 138) | class SpeechDLMTask(LegacyFairseqTask): method __init__ (line 163) | def __init__(self, args, dicts, output_dicts=None, targets=None): method setup_dictionary (line 212) | def setup_dictionary(cls, args, **kwargs): method setup_task (line 254) | def setup_task(cls, args, **kwargs): method build_model (line 275) | def build_model(self, args): method load_dataset (line 282) | def load_dataset( method build_dataset_for_inference (line 352) | def build_dataset_for_inference(self, src_tokens, src_lengths, **kwargs): method inference_step (line 426) | def inference_step( method eval_lm_dataloader (line 459) | def eval_lm_dataloader( method source_dictionary (line 493) | def source_dictionary(self): method target_dictionary (line 499) | def target_dictionary(self): method source_dictionaries (line 505) | def source_dictionaries(self): method target_dictionaries (line 511) | def target_dictionaries(self): method build_generator (line 516) | def build_generator(self, models, args, extra_gen_cls_kwargs=None): FILE: fairseq/tasks/speech_to_speech.py class StackUnitSequenceGenerator (line 31) | class StackUnitSequenceGenerator(nn.Module): method __init__ (line 32) | def __init__(self, tgt_dict, vocab_size): method pack_units (line 40) | def pack_units(self, input: torch.Tensor, n_frames_per_step) -> torch.... method generate (line 57) | def generate(self, models, sample, **kwargs): class SpeechToSpeechTask (line 140) | class SpeechToSpeechTask(LegacyFairseqTask): method add_args (line 142) | def add_args(cls, parser): method __init__ (line 212) | def __init__(self, args, tgt_dict, infer_tgt_lang_id=None): method setup_task (line 248) | def setup_task(cls, args, **kwargs): method build_criterion (line 290) | def build_criterion(self, args): method load_dataset (line 307) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method target_dictionary (line 322) | def target_dictionary(self): method target_dictionary_mt (line 326) | def target_dictionary_mt(self): method source_dictionary (line 330) | def source_dictionary(self): method max_positions (line 333) | def max_positions(self): method build_model (line 336) | def build_model(self, args, from_checkpoint=False): method build_generator_dual_decoder (line 359) | def build_generator_dual_decoder( method build_generator (line 389) | def build_generator( method train_step (line 494) | def train_step( method valid_step (line 509) | def valid_step(self, sample, model, criterion): method valid_step_with_inference (line 525) | def valid_step_with_inference(self, sample, model, generator): method inference_step (line 578) | def inference_step( FILE: fairseq/tasks/speech_to_text.py class SpeechToTextTask (line 26) | class SpeechToTextTask(LegacyFairseqTask): method add_args (line 28) | def add_args(cls, parser): method __init__ (line 57) | def __init__(self, args, tgt_dict): method _get_speaker_to_id (line 98) | def _get_speaker_to_id(self): method setup_task (line 108) | def setup_task(cls, args, **kwargs): method build_criterion (line 123) | def build_criterion(self, args): method load_dataset (line 133) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method target_dictionary (line 152) | def target_dictionary(self): method target_dictionary_mt (line 156) | def target_dictionary_mt(self): method source_dictionary (line 160) | def source_dictionary(self): method max_positions (line 163) | def max_positions(self): method build_model (line 166) | def build_model(self, args, from_checkpoint=False): method build_generator_dual_decoder (line 172) | def build_generator_dual_decoder( method build_generator (line 217) | def build_generator( method train_step (line 269) | def train_step( method valid_step (line 284) | def valid_step(self, sample, model, criterion): method build_tokenizer (line 292) | def build_tokenizer(self, args): method build_bpe (line 296) | def build_bpe(self, args): method get_interactive_tokens_and_lengths (line 300) | def get_interactive_tokens_and_lengths(self, lines, encode_fn): method build_dataset_for_inference (line 304) | def build_dataset_for_inference(self, src_tokens, src_lengths, **kwargs): class DummyMultiTask (line 310) | class DummyMultiTask(LegacyFairseqTask): method __init__ (line 311) | def __init__(self, args, tgt_dict, first_pass=False): method target_dictionary (line 317) | def target_dictionary(self): method is_first_pass_decoder (line 321) | def is_first_pass_decoder(self): method inference_step (line 324) | def inference_step( method build_generator (line 342) | def build_generator( FILE: fairseq/tasks/speech_ulm_task.py class UnitDictionary (line 25) | class UnitDictionary(Dictionary): method __init__ (line 32) | def __init__( method encode_line (line 63) | def encode_line(self, line, append_eos=True, prepend_bos=False) -> tor... class SpeechUnitModelingConfig (line 76) | class SpeechUnitModelingConfig(FairseqDataclass): class SpeechUnitLanguageModelingTask (line 129) | class SpeechUnitLanguageModelingTask(FairseqTask): method __init__ (line 130) | def __init__(self, cfg: SpeechUnitModelingConfig) -> None: method source_dictionary (line 157) | def source_dictionary(self) -> Optional[Dictionary]: method source_duration_dictionary (line 161) | def source_duration_dictionary(self) -> Optional[Dictionary]: method source_f0_dictionary (line 165) | def source_f0_dictionary(self) -> Optional[Dictionary]: method channel_names (line 169) | def channel_names(self) -> List[str]: method channel_sizes (line 173) | def channel_sizes(self) -> List[int]: method dictionary (line 177) | def dictionary(self) -> Optional[Dictionary]: method target_dictionary (line 181) | def target_dictionary(self) -> Optional[Dictionary]: method target_duration_dictionary (line 185) | def target_duration_dictionary(self) -> Optional[Dictionary]: method target_f0_dictionary (line 189) | def target_f0_dictionary(self) -> Optional[Dictionary]: method dictionaries (line 193) | def dictionaries(self) -> List[Dictionary]: method setup_task (line 197) | def setup_task( method load_dataset (line 202) | def load_dataset(self, split: str, **kwargs) -> None: method max_positions (line 218) | def max_positions(self) -> Tuple[int, int]: method build_criterion (line 221) | def build_criterion(self, cfg: DictConfig): FILE: fairseq/tasks/text_to_speech.py class TextToSpeechTask (line 39) | class TextToSpeechTask(SpeechToTextTask): method add_args (line 41) | def add_args(parser): method __init__ (line 70) | def __init__(self, args, src_dict): method load_dataset (line 80) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method target_dictionary (line 99) | def target_dictionary(self): method source_dictionary (line 103) | def source_dictionary(self): method get_speaker_embeddings_path (line 106) | def get_speaker_embeddings_path(self): method get_speaker_embeddings (line 115) | def get_speaker_embeddings(cls, args): method build_model (line 136) | def build_model(self, cfg, from_checkpoint=False): method build_generator (line 148) | def build_generator(self, models, cfg, vocoder=None, **unused): method build_default_vocoder (line 167) | def build_default_vocoder(self): method valid_step (line 177) | def valid_step(self, sample, model, criterion): method valid_step_with_inference (line 198) | def valid_step_with_inference(self, sample, model, generator): method log_tensorboard (line 224) | def log_tensorboard(self, sample, hypos, num_updates, is_na_model=False): function save_figure_to_numpy (line 270) | def save_figure_to_numpy(fig): function plot_tts_output (line 279) | def plot_tts_output( function antidiag_indices (line 330) | def antidiag_indices(offset, min_i=0, max_i=None, min_j=0, max_j=None): function batch_dynamic_time_warping (line 355) | def batch_dynamic_time_warping(distance, shapes=None): function compute_l2_dist (line 407) | def compute_l2_dist(x1, x2): function compute_rms_dist (line 412) | def compute_rms_dist(x1, x2): function get_divisor (line 417) | def get_divisor(pathmap, normalize_type): function batch_compute_distortion (line 430) | def batch_compute_distortion(y1, y2, sr, feat_fn, dist_fn, normalize_type): function batch_mel_cepstral_distortion (line 464) | def batch_mel_cepstral_distortion(y1, y2, sr, normalize_type="path", mfc... FILE: fairseq/tasks/translation.py function load_langpair_dataset (line 40) | def load_langpair_dataset( class TranslationConfig (line 175) | class TranslationConfig(FairseqDataclass): class TranslationTask (line 269) | class TranslationTask(FairseqTask): method __init__ (line 285) | def __init__(self, cfg: TranslationConfig, src_dict, tgt_dict): method setup_task (line 291) | def setup_task(cls, cfg: TranslationConfig, **kwargs): method load_dataset (line 323) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method build_dataset_for_inference (line 360) | def build_dataset_for_inference(self, src_tokens, src_lengths, constra... method build_model (line 369) | def build_model(self, cfg, from_checkpoint=False): method valid_step (line 383) | def valid_step(self, sample, model, criterion): method reduce_metrics (line 397) | def reduce_metrics(self, logging_outputs, criterion): method max_positions (line 450) | def max_positions(self): method source_dictionary (line 455) | def source_dictionary(self): method target_dictionary (line 460) | def target_dictionary(self): method _inference_with_bleu (line 464) | def _inference_with_bleu(self, generator, sample, model): FILE: fairseq/tasks/translation_from_pretrained_bart.py class TranslationFromPretrainedBARTTask (line 15) | class TranslationFromPretrainedBARTTask(TranslationTask): method add_args (line 37) | def add_args(parser): method __init__ (line 52) | def __init__(self, args, src_dict, tgt_dict): method load_dataset (line 60) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method build_generator (line 92) | def build_generator(self, models, args, **unused): method build_dataset_for_inference (line 119) | def build_dataset_for_inference(self, src_tokens, src_lengths, constra... FILE: fairseq/tasks/translation_from_pretrained_xlm.py class TranslationFromPretrainedXLMConfig (line 14) | class TranslationFromPretrainedXLMConfig(TranslationConfig): class TranslationFromPretrainedXLMTask (line 21) | class TranslationFromPretrainedXLMTask(TranslationTask): method load_dictionary (line 33) | def load_dictionary(cls, filename): FILE: fairseq/tasks/translation_lev.py class TranslationLevenshteinConfig (line 24) | class TranslationLevenshteinConfig(TranslationConfig): class TranslationLevenshteinTask (line 32) | class TranslationLevenshteinTask(TranslationTask): method load_dataset (line 40) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method inject_noise (line 70) | def inject_noise(self, target_tokens): method build_generator (line 153) | def build_generator(self, models, args, **unused): method build_dataset_for_inference (line 168) | def build_dataset_for_inference(self, src_tokens, src_lengths, constra... method train_step (line 179) | def train_step( method valid_step (line 190) | def valid_step(self, sample, model, criterion): FILE: fairseq/tasks/translation_multi_simple_epoch.py function get_time_gap (line 27) | def get_time_gap(s, e): class TranslationMultiSimpleEpochTask (line 40) | class TranslationMultiSimpleEpochTask(LegacyFairseqTask): method add_args (line 63) | def add_args(parser): method __init__ (line 80) | def __init__(self, args, langs, dicts, training): method check_dicts (line 108) | def check_dicts(self, dicts, source_langs, target_langs): method setup_task (line 126) | def setup_task(cls, args, **kwargs): method has_sharded_data (line 132) | def has_sharded_data(self, split): method load_dataset (line 135) | def load_dataset(self, split, epoch=1, combine=False, **kwargs): method build_dataset_for_inference (line 171) | def build_dataset_for_inference(self, src_tokens, src_lengths, constra... method build_generator (line 199) | def build_generator( method build_model (line 219) | def build_model(self, args, from_checkpoint=False): method valid_step (line 222) | def valid_step(self, sample, model, criterion): method inference_step (line 226) | def inference_step( method reduce_metrics (line 259) | def reduce_metrics(self, logging_outputs, criterion): method max_positions (line 262) | def max_positions(self): method source_dictionary (line 267) | def source_dictionary(self): method target_dictionary (line 271) | def target_dictionary(self): method create_batch_sampler_func (line 274) | def create_batch_sampler_func( method get_batch_iterator (line 337) | def get_batch_iterator( FILE: fairseq/token_generation_constraints.py class ConstraintState (line 36) | class ConstraintState: method __init__ (line 37) | def __init__(self): function pack_constraints (line 41) | def pack_constraints(batch_constraints: List[List[torch.Tensor]]) -> tor... function unpack_constraints (line 94) | def unpack_constraints(constraint_tensor: torch.Tensor) -> List[torch.Te... class ConstraintNode (line 111) | class ConstraintNode: method __init__ (line 116) | def __init__(self, token: int = None, parent=None): method id (line 131) | def id(self): method __str__ (line 134) | def __str__(self): method __getitem__ (line 138) | def __getitem__(self, key: int): method next_tokens (line 141) | def next_tokens(self) -> Set[int]: method create (line 146) | def create(constraints: List[List[int]]): method print_graph (line 154) | def print_graph(node: "ConstraintNode"): method token_counts (line 164) | def token_counts(self) -> Counter: method tokens (line 177) | def tokens(self) -> Set[int]: method add_sequence (line 181) | def add_sequence(self, sequence: List[int]): class UnorderedConstraintState (line 202) | class UnorderedConstraintState(ConstraintState): method __init__ (line 208) | def __init__(self, node: ConstraintNode, copy_from: "ConstraintState" ... method create (line 230) | def create(constraint_tensor: torch.Tensor): method __str__ (line 235) | def __str__(self): method __copy__ (line 239) | def __copy__(self): method copy (line 243) | def copy(self): method name (line 247) | def name(self): method is_root (line 254) | def is_root(self): method bank (line 258) | def bank(self): method num_completed (line 262) | def num_completed(self): method finished (line 272) | def finished(self): method token_counts (line 276) | def token_counts(self): method tokens (line 280) | def tokens(self): method num_constraint_tokens (line 284) | def num_constraint_tokens(self): method next_tokens (line 287) | def next_tokens(self) -> Set[int]: method advance (line 298) | def advance(self, token: int): class ConstraintSequence (line 361) | class ConstraintSequence: method __init__ (line 362) | def __init__(self, sequences: List[List[int]]): method __getitem__ (line 377) | def __getitem__(self, key: int): method __len__ (line 380) | def __len__(self): method __str__ (line 383) | def __str__(self): class OrderedConstraintState (line 387) | class OrderedConstraintState(ConstraintState): method __init__ (line 392) | def __init__(self, sequence: ConstraintSequence, state: int = -1): method create (line 397) | def create(constraint_tensor: torch.Tensor): method __str__ (line 401) | def __str__(self): method __copy__ (line 404) | def __copy__(self): method copy (line 407) | def copy(self): method num_completed (line 411) | def num_completed(self): method is_root (line 420) | def is_root(self): method name (line 424) | def name(self): method bank (line 431) | def bank(self) -> int: method finished (line 435) | def finished(self): method token_counts (line 439) | def token_counts(self): method tokens (line 443) | def tokens(self): method num_constraint_tokens (line 447) | def num_constraint_tokens(self): method next_tokens (line 450) | def next_tokens(self) -> Set[int]: method advance (line 463) | def advance(self, token: int): FILE: fairseq/tokenizer.py function tokenize_line (line 12) | def tokenize_line(line): FILE: fairseq/trainer.py class Trainer (line 36) | class Trainer(object): method __init__ (line 46) | def __init__(self, cfg: FairseqConfig, task, model, criterion, quantiz... method reinitialize (line 175) | def reinitialize(self): method data_parallel_world_size (line 183) | def data_parallel_world_size(self): method data_parallel_process_group (line 189) | def data_parallel_process_group(self): method data_parallel_rank (line 193) | def data_parallel_rank(self): method is_data_parallel_master (line 199) | def is_data_parallel_master(self): method use_distributed_wrapper (line 205) | def use_distributed_wrapper(self) -> bool: method should_save_checkpoint_on_current_rank (line 211) | def should_save_checkpoint_on_current_rank(self) -> bool: method always_call_state_dict_during_save_checkpoint (line 221) | def always_call_state_dict_during_save_checkpoint(self) -> bool: method checkpoint_suffix (line 229) | def checkpoint_suffix(self) -> str: method criterion (line 239) | def criterion(self): method model (line 253) | def model(self): method ema (line 267) | def ema(self): method _build_ema (line 272) | def _build_ema(self): method optimizer (line 278) | def optimizer(self): method lr_scheduler (line 284) | def lr_scheduler(self): method _build_optimizer (line 289) | def _build_optimizer(self): method is_fsdp (line 385) | def is_fsdp(self): method consolidate_optimizer (line 388) | def consolidate_optimizer(self): method state_dict (line 401) | def state_dict(self): method save_checkpoint (line 447) | def save_checkpoint(self, filename, extra_state): method load_checkpoint (line 465) | def load_checkpoint( method get_train_iterator (line 693) | def get_train_iterator( method get_valid_iterator (line 739) | def get_valid_iterator( method begin_epoch (line 769) | def begin_epoch(self, epoch): method begin_valid_epoch (line 787) | def begin_valid_epoch(self, epoch): method reset_dummy_batch (line 793) | def reset_dummy_batch(self, batch): method train_step (line 797) | def train_step(self, samples, raise_oom=False): method valid_step (line 1131) | def valid_step(self, sample, raise_oom=False): method zero_grad (line 1192) | def zero_grad(self): method lr_step_begin_epoch (line 1195) | def lr_step_begin_epoch(self, epoch): method lr_step (line 1201) | def lr_step(self, epoch, val_loss=None): method lr_step_update (line 1207) | def lr_step_update(self): method get_lr (line 1218) | def get_lr(self): method get_model (line 1222) | def get_model(self): method get_criterion (line 1226) | def get_criterion(self): method get_meter (line 1230) | def get_meter(self, name): method get_num_updates (line 1271) | def get_num_updates(self): method set_num_updates (line 1275) | def set_num_updates(self, num_updates): method clip_grad_norm (line 1283) | def clip_grad_norm(self, clip_norm): method cumulative_training_time (line 1299) | def cumulative_training_time(self): method _local_cumulative_training_time (line 1306) | def _local_cumulative_training_time(self): method _fp_convert_sample (line 1310) | def _fp_convert_sample(self, sample): method _prepare_sample (line 1329) | def _prepare_sample(self, sample, is_dummy=False): method _set_seed (line 1371) | def _set_seed(self): method _sync_stats (line 1377) | def _sync_stats(self): method _log_oom (line 1391) | def _log_oom(self, exc): method _aggregate_logging_outputs (line 1399) | def _aggregate_logging_outputs( method _all_gather_list_sync (line 1414) | def _all_gather_list_sync( method _fast_stat_sync_sum (line 1442) | def _fast_stat_sync_sum( method _check_grad_norms (line 1482) | def _check_grad_norms(self, grad_norm): method _reduce_and_log_stats (line 1521) | def _reduce_and_log_stats(self, logging_outputs, sample_size, grad_nor... method _check_xla_compilation (line 1565) | def _check_xla_compilation(self): method _xla_markstep_and_send_to_cpu (line 1581) | def _xla_markstep_and_send_to_cpu(self, data=None): function _catalog_shared_params (line 1591) | def _catalog_shared_params(module, memo=None, prefix=""): function _get_module_by_path (line 1611) | def _get_module_by_path(module, path): function _set_module_by_path (line 1618) | def _set_module_by_path(module, path, value): FILE: fairseq/utils.py class FileContentsAction (line 44) | class FileContentsAction(argparse.Action): method __init__ (line 45) | def __init__(self, option_strings, dest, nargs=None, **kwargs): method __call__ (line 50) | def __call__(self, parser, namespace, values, option_string=None): function split_paths (line 61) | def split_paths(paths: str, separator=os.pathsep) -> List[str]: function load_ensemble_for_inference (line 67) | def load_ensemble_for_inference(filenames, task, model_arg_overrides=None): function apply_to_sample (line 79) | def apply_to_sample(f, sample): function move_to_cuda (line 107) | def move_to_cuda(sample, device=None): function move_to_cpu (line 118) | def move_to_cpu(sample): function move_to_tpu (line 129) | def move_to_tpu(sample): function get_incremental_state (line 141) | def get_incremental_state( function set_incremental_state (line 150) | def set_incremental_state( function load_align_dict (line 164) | def load_align_dict(replace_unk): function print_embed_overlap (line 181) | def print_embed_overlap(embed_dict, vocab_dict): function parse_embedding (line 188) | def parse_embedding(embed_path): function load_embedding (line 210) | def load_embedding(embed_dict, vocab, embedding): function replace_unk (line 218) | def replace_unk(hypo_str, src_str, alignment, align_dict, unk): function post_process_prediction (line 233) | def post_process_prediction( function make_positions (line 256) | def make_positions(tensor, padding_idx: int, onnx_trace: bool = False): function strip_pad (line 269) | def strip_pad(tensor, pad): function buffered_arange (line 273) | def buffered_arange(max, device="cpu"): function convert_padding_direction (line 282) | def convert_padding_direction( function item (line 309) | def item(tensor): function multi_tensor_total_norm (line 320) | def multi_tensor_total_norm(grads, chunk_size=2048 * 32) -> torch.Tensor: function clip_grad_norm_ (line 347) | def clip_grad_norm_(params, max_norm, aggregate_norm_fn=None) -> torch.T... function fill_with_neg_inf (line 400) | def fill_with_neg_inf(t): function _match_types (line 405) | def _match_types(arg1, arg2): function resolve_max_positions (line 427) | def resolve_max_positions(*args): function import_user_module (line 464) | def import_user_module(args): function softmax (line 514) | def softmax(x, dim: int, onnx_trace: bool = False): function log_softmax (line 521) | def log_softmax(x, dim: int, onnx_trace: bool = False): function get_perplexity (line 528) | def get_perplexity(loss, round=2, base=2): function deprecation_warning (line 539) | def deprecation_warning(message, stacklevel=3): function relu_squared (line 544) | def relu_squared(x: torch.Tensor): function get_activation_fn (line 548) | def get_activation_fn(activation: str) -> Callable: function get_available_activation_fns (line 575) | def get_available_activation_fns() -> List: function model_eval (line 587) | def model_eval(model): function has_parameters (line 594) | def has_parameters(module): function get_rng_state (line 602) | def get_rng_state(): function set_rng_state (line 611) | def set_rng_state(state): class set_torch_seed (line 619) | class set_torch_seed(object): method __init__ (line 620) | def __init__(self, seed): method __enter__ (line 630) | def __enter__(self): method __exit__ (line 633) | def __exit__(self, *exc): function parse_alignment (line 637) | def parse_alignment(line): function get_token_to_word_mapping (line 658) | def get_token_to_word_mapping(tokens, exclude_list): function extract_hard_alignment (line 666) | def extract_hard_alignment(attn, src_sent, tgt_sent, pad, eos): function extract_soft_alignment (line 690) | def extract_soft_alignment(attn, src_sent, tgt_sent, pad, eos): function new_arange (line 702) | def new_arange(x, *size): function get_tpu_device (line 712) | def get_tpu_device(): function tpu_data_loader (line 716) | def tpu_data_loader(itr): function is_xla_tensor (line 732) | def is_xla_tensor(tensor): function index_put (line 736) | def index_put(tensor, indices, value): function xla_device_to_cpu (line 748) | def xla_device_to_cpu(dat): class CudaEnvironment (line 754) | class CudaEnvironment(object): method __init__ (line 755) | def __init__(self): method pretty_print_cuda_env_list (line 764) | def pretty_print_cuda_env_list(cuda_env_list): function csv_str_list (line 783) | def csv_str_list(x): function eval_str_list (line 787) | def eval_str_list(x, type=float): function eval_str_dict (line 798) | def eval_str_dict(x, type=dict): function eval_bool (line 806) | def eval_bool(x, default=False): function reset_logging (line 815) | def reset_logging(): function safe_getattr (line 830) | def safe_getattr(obj, k, default=None): function safe_hasattr (line 840) | def safe_hasattr(obj, k): function hotreload_function (line 845) | def hotreload_function(name=None): FILE: fairseq_cli/eval_lm.py function eval_lm (line 37) | def eval_lm( class WordStat (line 204) | class WordStat(object): method __init__ (line 205) | def __init__(self, word, is_bpe): method add (line 213) | def add(self, log_prob, next_word_prob): method __str__ (line 225) | def __str__(self): function main (line 236) | def main(cfg: DictConfig, **unused_kwargs): function cli_main (line 339) | def cli_main(): FILE: fairseq_cli/generate.py function main (line 28) | def main(cfg: DictConfig): function get_symbols_to_strip_from_output (line 53) | def get_symbols_to_strip_from_output(generator): function _main (line 60) | def _main(cfg: DictConfig, output_file): function cli_main (line 401) | def cli_main(): FILE: fairseq_cli/hydra_train.py function hydra_main (line 26) | def hydra_main(cfg: FairseqConfig) -> float: function _hydra_main (line 30) | def _hydra_main(cfg: FairseqConfig, **kwargs) -> float: function cli_main (line 77) | def cli_main(): FILE: fairseq_cli/hydra_validate.py function hydra_main (line 35) | def hydra_main(cfg: FairseqConfig) -> float: function _hydra_main (line 39) | def _hydra_main(cfg: FairseqConfig, **kwargs) -> float: function validate (line 66) | def validate(cfg): function cli_main (line 174) | def cli_main(): FILE: fairseq_cli/interactive.py function buffered_read (line 42) | def buffered_read(input, buffer_size): function make_batches (line 55) | def make_batches(lines, cfg, task, max_positions, encode_fn): function main (line 108) | def main(cfg: FairseqConfig): function cli_main (line 310) | def cli_main(): FILE: fairseq_cli/preprocess.py function _train_path (line 39) | def _train_path(lang, trainpref): function _file_name (line 43) | def _file_name(prefix, lang): function _dest_path (line 50) | def _dest_path(prefix, lang, destdir): function _dict_path (line 54) | def _dict_path(lang, destdir): function dataset_dest_prefix (line 58) | def dataset_dest_prefix(args, output_prefix, lang): function dataset_dest_file (line 70) | def dataset_dest_file(args, output_prefix, lang, extension): function _build_dictionary (line 79) | def _build_dictionary( function _make_binary_dataset (line 101) | def _make_binary_dataset( function _make_binary_alignment_dataset (line 131) | def _make_binary_alignment_dataset( function _make_dataset (line 161) | def _make_dataset( function _make_all (line 183) | def _make_all(lang, vocab, args): function _make_all_alignments (line 202) | def _make_all_alignments(args): function _align_files (line 231) | def _align_files(args, src_dict, tgt_dict): function main (line 277) | def main(args): function cli_main (line 386) | def cli_main(): FILE: fairseq_cli/score.py function get_parser (line 18) | def get_parser(): function cli_main (line 37) | def cli_main(): FILE: fairseq_cli/train.py function main (line 44) | def main(cfg: FairseqConfig) -> None: function should_stop_early (line 232) | def should_stop_early(cfg: DictConfig, valid_loss: float) -> bool: function train (line 261) | def train( function _flatten_config (line 362) | def _flatten_config(cfg: DictConfig): function validate_and_save (line 375) | def validate_and_save( function get_training_stats (line 451) | def get_training_stats(stats: Dict[str, Any]) -> Dict[str, Any]: function validate (line 456) | def validate( function get_valid_stats (line 538) | def get_valid_stats( function cli_main (line 555) | def cli_main( FILE: fairseq_cli/validate.py function main (line 30) | def main(cfg: DictConfig, override_args=None): function cli_main (line 139) | def cli_main(): FILE: hydra_plugins/dependency_submitit_launcher/hydra_plugins/dependency_submitit_launcher/config.py class DependencySubmititConf (line 10) | class DependencySubmititConf(SlurmQueueConf): FILE: hydra_plugins/dependency_submitit_launcher/hydra_plugins/dependency_submitit_launcher/launcher.py class DependencySubmititLauncher (line 18) | class DependencySubmititLauncher(BaseSubmititLauncher): method launch (line 21) | def launch( FILE: release_utils.py function get_next_version (line 5) | def get_next_version(release_type) -> Tuple[Tuple[int, int, int], str, s... function find_version (line 28) | def find_version(version_file_path) -> str: function update_version (line 34) | def update_version(new_version_str) -> None: function main (line 44) | def main(args): FILE: scripts/average_checkpoints.py function average_checkpoints (line 17) | def average_checkpoints(inputs): function last_n_checkpoints (line 77) | def last_n_checkpoints(paths, n, update_based, upper_bound=None): function main (line 100) | def main(): FILE: scripts/build_sym_alignment.py function main (line 29) | def main(): FILE: scripts/compare_namespaces.py function main (line 7) | def main(): FILE: scripts/constraints/extract.py function get_phrase (line 15) | def get_phrase(words, index, length): function main (line 23) | def main(args): FILE: scripts/count_docs.py function main (line 18) | def main(): FILE: scripts/read_binarized.py function get_parser (line 12) | def get_parser(): function main (line 26) | def main(): FILE: scripts/rm_pt.py function parse_checkpoints (line 19) | def parse_checkpoints(files): function last_n_checkpoints (line 32) | def last_n_checkpoints(files, n): function every_n_checkpoints (line 37) | def every_n_checkpoints(files, n): function main (line 42) | def main(): FILE: scripts/shard_docs.py function main (line 15) | def main(): FILE: scripts/split_train_valid_docs.py function main (line 16) | def main(): FILE: scripts/spm_decode.py function main (line 15) | def main(): FILE: scripts/spm_encode.py function main (line 17) | def main(): FILE: setup.py function write_version_py (line 18) | def write_version_py(): class NumpyExtension (line 41) | class NumpyExtension(Extension): method __init__ (line 44) | def __init__(self, *args, **kwargs): method include_dirs (line 49) | def include_dirs(self): method include_dirs (line 55) | def include_dirs(self, dirs): function do_setup (line 163) | def do_setup(package_data): function get_files (line 230) | def get_files(path, relative_to="fairseq"): FILE: tests/distributed/test_bmuf.py class Model (line 20) | class Model(nn.Module): method __init__ (line 21) | def __init__(self, input_size, output_size): method forward (line 25) | def forward(self, input): function setup_model_loss_criterion (line 30) | def setup_model_loss_criterion(cfg, args, rank, is_cuda): function train_step (line 51) | def train_step(input, target, model, loss_fn, optimizer, **unused): function single_gpu_training (line 60) | def single_gpu_training(cfg, args, rank, iterations, shared_results): function setup_args (line 87) | def setup_args(): class TestBMUF (line 141) | class TestBMUF(unittest.TestCase): method bmuf_process (line 142) | def bmuf_process(self, cfg, args, iterations): method test_bmuf_sync (line 152) | def test_bmuf_sync(self): method test_warmup_sync (line 161) | def test_warmup_sync(self): method test_warmup_sync_bmuf_sync (line 172) | def test_warmup_sync_bmuf_sync(self): method test_single_gpu_bmuf (line 186) | def test_single_gpu_bmuf(self): method assertAlmostEqual (line 198) | def assertAlmostEqual(self, t1, t2): FILE: tests/distributed/test_distributed_timeout_wrapper.py class ModuleWithDelay (line 17) | class ModuleWithDelay(nn.Module): method __init__ (line 18) | def __init__(self, delay): method forward (line 22) | def forward(self, x): class TestDistributedTimeoutWrapper (line 27) | class TestDistributedTimeoutWrapper(unittest.TestCase): method setUp (line 28) | def setUp(self): method tearDown (line 31) | def tearDown(self): method test_no_timeout (line 34) | def test_no_timeout(self): method test_timeout_safe (line 39) | def test_timeout_safe(self): method test_timeout_killed (line 44) | def test_timeout_killed(self): FILE: tests/distributed/test_module_proxy_wrapper.py class MockDDPWrapper (line 16) | class MockDDPWrapper(nn.Module): method __init__ (line 19) | def __init__(self, module): method forward (line 23) | def forward(self, x): class Model (line 27) | class Model(nn.Module): method __init__ (line 28) | def __init__(self): method forward (line 33) | def forward(self, x): method get_xyz (line 36) | def get_xyz(self): class TestModuleProxyWrapper (line 40) | class TestModuleProxyWrapper(unittest.TestCase): method _get_module (line 41) | def _get_module(self): method test_getattr_forwarding (line 47) | def test_getattr_forwarding(self): method test_state_dict (line 57) | def test_state_dict(self): method test_load_state_dict (line 61) | def test_load_state_dict(self): method test_forward (line 67) | def test_forward(self): FILE: tests/distributed/test_utils.py class DistributedTest (line 17) | class DistributedTest(unittest.TestCase): method setUp (line 18) | def setUp(self): class TestBroadcastObject (line 27) | class TestBroadcastObject(DistributedTest): method test_str (line 28) | def test_str(self): method test_tensor (line 36) | def test_tensor(self): method test_complex (line 45) | def test_complex(self): method _test_broadcast_object (line 62) | def _test_broadcast_object(ref_obj, rank, group): class TestAllGatherList (line 69) | class TestAllGatherList(DistributedTest): method test_str_equality (line 70) | def test_str_equality(self): method test_tensor_equality (line 79) | def test_tensor_equality(self): method test_complex_equality (line 88) | def test_complex_equality(self): method _test_all_gather_list_equality (line 105) | def _test_all_gather_list_equality(ref_obj, rank, group): method test_rank_tensor (line 110) | def test_rank_tensor(self): method _test_all_gather_list_rank_tensor (line 116) | def _test_all_gather_list_rank_tensor(rank, group): FILE: tests/distributed/utils.py function spawn_and_init (line 12) | def spawn_and_init(fn, world_size, args=None): function distributed_init (line 27) | def distributed_init(rank, world_size, tmp_file): function init_and_run (line 37) | def init_and_run(fn, args, rank, world_size, tmp_file): function objects_are_equal (line 43) | def objects_are_equal(a, b) -> bool: FILE: tests/gpu/test_binaries_gpu.py class TestMultiGPU (line 29) | class TestMultiGPU(unittest.TestCase): method parse_logs (line 31) | def parse_logs(logfile): method world_size (line 41) | def world_size(self): method train_flags (line 44) | def train_flags(self, mu): method _test_resume_multilingual_training (line 69) | def _test_resume_multilingual_training( class TestTranslationGPU (line 140) | class TestTranslationGPU(unittest.TestCase): method setUp (line 141) | def setUp(self): method tearDown (line 144) | def tearDown(self): method test_fp16_multigpu (line 147) | def test_fp16_multigpu(self): method test_slowmo_multigpu (line 150) | def test_slowmo_multigpu(self): method test_slowmo_single_node_multigpu (line 155) | def test_slowmo_single_node_multigpu(self): method _test_multigpu (line 161) | def _test_multigpu(self, test_name, test_args): method parse_logs (line 177) | def parse_logs(logfile): method test_resume_training_fsdp (line 186) | def test_resume_training_fsdp(self): method test_resume_training_fsdp_sharded_state (line 189) | def test_resume_training_fsdp_sharded_state(self): method test_resume_training_noc10d (line 194) | def test_resume_training_noc10d(self): method _test_resume_training (line 197) | def _test_resume_training(self, extra_clargs, arch="fconv_iwslt_de_en"): method test_memory_efficient_fp16 (line 244) | def test_memory_efficient_fp16(self): method test_transformer_fp16 (line 254) | def test_transformer_fp16(self): method test_amp (line 278) | def test_amp(self): method test_transformer_amp (line 287) | def test_transformer_amp(self): method test_levenshtein_transformer (line 311) | def test_levenshtein_transformer(self): method test_fsdp_checkpoint_generate (line 353) | def test_fsdp_checkpoint_generate(self): method test_fsdp_sharded_checkpoint_generate (line 369) | def test_fsdp_sharded_checkpoint_generate(self): function _quantize_language_model (line 392) | def _quantize_language_model(data_dir, arch, extra_flags=None, run_valid... class TestQuantization (line 518) | class TestQuantization(unittest.TestCase): method setUp (line 519) | def setUp(self): method tearDown (line 522) | def tearDown(self): method test_quantization (line 525) | def test_quantization(self): class TestOptimizersGPU (line 535) | class TestOptimizersGPU(unittest.TestCase): method setUp (line 536) | def setUp(self): method tearDown (line 539) | def tearDown(self): method test_flat_grads (line 542) | def test_flat_grads(self): FILE: tests/gpu/test_ema_gpu.py class DummyModule (line 16) | class DummyModule(torch.nn.Module): method __init__ (line 17) | def __init__(self) -> None: method forward (line 28) | def forward(self, x: torch.Tensor) -> torch.Tensor: class EMAConfig (line 34) | class EMAConfig(object): class TestEMAGPU (line 43) | class TestEMAGPU(unittest.TestCase): method assertTorchAllClose (line 44) | def assertTorchAllClose(self, x, y, atol=1e-8, rtol=1e-5, msg=None): method test_ema (line 58) | def test_ema(self): method test_ema_fp32 (line 109) | def test_ema_fp32(self): method test_ema_fp16 (line 160) | def test_ema_fp16(self): FILE: tests/speech/__init__.py class TestFairseqSpeech (line 23) | class TestFairseqSpeech(unittest.TestCase): method download (line 25) | def download(cls, base_url: str, out_root: Path, filename: str): method _set_up (line 32) | def _set_up(self, dataset_id: str, s3_dir: str, data_filenames: List[s... method set_up_librispeech (line 43) | def set_up_librispeech(self): method set_up_ljspeech (line 56) | def set_up_ljspeech(self): method set_up_sotasty_es_en (line 69) | def set_up_sotasty_es_en(self): method set_up_mustc_de_fbank (line 82) | def set_up_mustc_de_fbank(self): method download_and_load_checkpoint (line 97) | def download_and_load_checkpoint( method build_generator (line 115) | def build_generator( method get_batch_iterator (line 124) | def get_batch_iterator(cls, task, test_split, max_tokens, max_positions): method get_wer_scorer (line 134) | def get_wer_scorer( method get_bleu_scorer (line 146) | def get_bleu_scorer(cls, tokenizer="13a", lowercase=False, char_level=... method base_test (line 155) | def base_test( method postprocess_tokens (line 201) | def postprocess_tokens(self, task, target, hypo_tokens): method unzip_files (line 207) | def unzip_files(self, zip_file_name): FILE: tests/speech/test_convtransformer_simul_trans.py class TestConvtransformerSimulTrans (line 12) | class TestConvtransformerSimulTrans(TestFairseqSpeech): method setUp (line 13) | def setUp(self): method test_waitk_checkpoint (line 20) | def test_waitk_checkpoint(self): FILE: tests/speech/test_dual_input_wav_transformer.py class TestLibrispeechDualInputWavTransformer (line 22) | class TestLibrispeechDualInputWavTransformer(TestFairseqSpeech): method setUp (line 23) | def setUp(self): method import_user_module (line 44) | def import_user_module(self): method test_librispeech_dualinput_wav_transformer_checkpoint (line 53) | def test_librispeech_dualinput_wav_transformer_checkpoint(self): FILE: tests/speech/test_dualinput_s2t_transformer.py class TestDualInputS2TTransformer (line 23) | class TestDualInputS2TTransformer(TestFairseqSpeech): method setUp (line 24) | def setUp(self): method import_user_module (line 27) | def import_user_module(self): method test_mustc_de_fbank_dualinput_s2t_transformer_checkpoint (line 36) | def test_mustc_de_fbank_dualinput_s2t_transformer_checkpoint(self): FILE: tests/speech/test_fastspeech2.py class TestFastSpeech2 (line 17) | class TestFastSpeech2(TestFairseqSpeech): method setUp (line 18) | def setUp(self): method test_ljspeech_fastspeech2_checkpoint (line 22) | def test_ljspeech_fastspeech2_checkpoint(self): FILE: tests/speech/test_s2s_transformer.py class TestS2STransformer (line 13) | class TestS2STransformer(TestFairseqSpeech): method setUp (line 14) | def setUp(self): method test_s2s_transformer_checkpoint (line 27) | def test_s2s_transformer_checkpoint(self): method postprocess_tokens (line 43) | def postprocess_tokens(self, task, target, hypo_tokens): FILE: tests/speech/test_s2t_conformer.py class TestS2TConformer (line 10) | class TestS2TConformer(TestFairseqSpeech): method setUp (line 11) | def setUp(self): method test_librispeech_s2t_conformer_s_checkpoint (line 14) | def test_librispeech_s2t_conformer_s_checkpoint(self): FILE: tests/speech/test_s2t_transformer.py class TestS2TTransformer (line 10) | class TestS2TTransformer(TestFairseqSpeech): method setUp (line 11) | def setUp(self): method test_librispeech_s2t_transformer_s_checkpoint (line 14) | def test_librispeech_s2t_transformer_s_checkpoint(self): FILE: tests/speech/test_tts_transformer.py class TestTTSTransformer (line 17) | class TestTTSTransformer(TestFairseqSpeech): method setUp (line 18) | def setUp(self): method test_ljspeech_tts_transformer_checkpoint (line 22) | def test_ljspeech_tts_transformer_checkpoint(self): FILE: tests/speech/test_wav2vec2.py class TestWav2Vec2 (line 17) | class TestWav2Vec2(TestFairseqSpeech): method setUp (line 18) | def setUp(self): method test_transformer_w2v2 (line 36) | def test_transformer_w2v2(self): method test_conformer_w2v2 (line 53) | def test_conformer_w2v2(self): method build_generator (line 70) | def build_generator(self, task, models, cfg): method postprocess_tokens (line 79) | def postprocess_tokens(self, task, target, hypo_tokens): FILE: tests/speech/test_xm_transformer.py class TestXMTransformer (line 10) | class TestXMTransformer(TestFairseqSpeech): method setUp (line 11) | def setUp(self): method test_sotasty_es_en_600m_checkpoint (line 15) | def test_sotasty_es_en_600m_checkpoint(self): FILE: tests/speech_recognition/asr_test_base.py function get_dummy_dictionary (line 32) | def get_dummy_dictionary(vocab_size=DEFAULT_TEST_VOCAB_SIZE): class DummyTask (line 40) | class DummyTask(LegacyFairseqTask): method __init__ (line 41) | def __init__(self, args): method target_dictionary (line 49) | def target_dictionary(self): function get_dummy_task_and_parser (line 53) | def get_dummy_task_and_parser(): function get_dummy_input (line 70) | def get_dummy_input(T=100, D=80, B=5, K=100): function get_dummy_encoder_output (line 104) | def get_dummy_encoder_output(encoder_out_shape=(100, 80, 5)): function _current_postion_info (line 126) | def _current_postion_info(): function check_encoder_output (line 134) | def check_encoder_output(encoder_output, batch_size=None): function check_decoder_output (line 201) | def check_decoder_output(decoder_output): class TestBaseFairseqModelBase (line 228) | class TestBaseFairseqModelBase(unittest.TestCase): method setUpClass (line 235) | def setUpClass(cls): method setUpModel (line 240) | def setUpModel(self, model): method setupInput (line 244) | def setupInput(self): method setUp (line 247) | def setUp(self): class TestFairseqEncoderDecoderModelBase (line 253) | class TestFairseqEncoderDecoderModelBase(TestBaseFairseqModelBase): method setUpClass (line 260) | def setUpClass(cls): method setUpModel (line 265) | def setUpModel(self, model_cls, extra_args_setters=None): method setUpInput (line 282) | def setUpInput(self, input=None): method setUp (line 285) | def setUp(self): method test_forward (line 288) | def test_forward(self): method test_get_normalized_probs (line 298) | def test_get_normalized_probs(self): class TestFairseqEncoderModelBase (line 317) | class TestFairseqEncoderModelBase(TestBaseFairseqModelBase): method setUpClass (line 323) | def setUpClass(cls): method setUpModel (line 328) | def setUpModel(self, model_cls, extra_args_setters=None): method setUpInput (line 343) | def setUpInput(self, input=None): method setUp (line 349) | def setUp(self): method test_forward (line 352) | def test_forward(self): method test_get_normalized_probs (line 366) | def test_get_normalized_probs(self): class TestFairseqEncoderBase (line 385) | class TestFairseqEncoderBase(unittest.TestCase): method setUpClass (line 391) | def setUpClass(cls): method setUpEncoder (line 396) | def setUpEncoder(self, encoder): method setUpInput (line 403) | def setUpInput(self, input=None): method setUp (line 409) | def setUp(self): method test_forward (line 413) | def test_forward(self): class TestFairseqDecoderBase (line 424) | class TestFairseqDecoderBase(unittest.TestCase): method setUpClass (line 430) | def setUpClass(cls): method setUpDecoder (line 435) | def setUpDecoder(self, decoder): method setUpInput (line 442) | def setUpInput(self, input=None): method setUpPrevOutputTokens (line 445) | def setUpPrevOutputTokens(self, tokens=None): method setUp (line 452) | def setUp(self): method test_forward (line 457) | def test_forward(self): class DummyEncoderModel (line 473) | class DummyEncoderModel(FairseqEncoderModel): method __init__ (line 474) | def __init__(self, encoder): method build_model (line 478) | def build_model(cls, args, task): method get_logits (line 481) | def get_logits(self, net_output): method get_normalized_probs (line 488) | def get_normalized_probs(self, net_output, log_probs, sample=None): class DummyEncoder (line 494) | class DummyEncoder(FairseqEncoder): method __init__ (line 495) | def __init__(self): method forward (line 498) | def forward(self, src_tokens, src_lengths): class CrossEntropyCriterionTestBase (line 503) | class CrossEntropyCriterionTestBase(unittest.TestCase): method setUpClass (line 505) | def setUpClass(cls): method setUpArgs (line 510) | def setUpArgs(self): method setUp (line 516) | def setUp(self): method get_src_tokens (line 521) | def get_src_tokens(self, correct_prediction, aggregate): method get_target (line 540) | def get_target(self, soft_target): method get_test_sample (line 549) | def get_test_sample(self, correct, soft_target, aggregate): FILE: tests/speech_recognition/test_collaters.py class TestSeq2SeqCollator (line 14) | class TestSeq2SeqCollator(unittest.TestCase): method test_collate (line 15) | def test_collate(self): method assertTensorEqual (line 52) | def assertTensorEqual(self, t1, t2): FILE: tests/speech_recognition/test_cross_entropy.py class CrossEntropyWithAccCriterionTest (line 14) | class CrossEntropyWithAccCriterionTest(CrossEntropyCriterionTestBase): method setUp (line 15) | def setUp(self): method test_cross_entropy_all_correct (line 19) | def test_cross_entropy_all_correct(self): method test_cross_entropy_all_wrong (line 29) | def test_cross_entropy_all_wrong(self): FILE: tests/speech_recognition/test_data_utils.py class DataUtilsTest (line 12) | class DataUtilsTest(unittest.TestCase): method test_normalization (line 13) | def test_normalization(self): FILE: tests/speech_recognition/test_vggtransformer.py class VGGTransformerModelTest_mid (line 25) | class VGGTransformerModelTest_mid(TestFairseqEncoderDecoderModelBase): method setUp (line 26) | def setUp(self): class VGGTransformerModelTest_big (line 44) | class VGGTransformerModelTest_big(TestFairseqEncoderDecoderModelBase): method setUp (line 45) | def setUp(self): class VGGTransformerModelTest_base (line 63) | class VGGTransformerModelTest_base(TestFairseqEncoderDecoderModelBase): method setUp (line 64) | def setUp(self): class VGGTransformerEncoderTest (line 82) | class VGGTransformerEncoderTest(TestFairseqEncoderBase): method setUp (line 83) | def setUp(self): method test_forward (line 88) | def test_forward(self): class TransformerDecoderTest (line 125) | class TransformerDecoderTest(TestFairseqDecoderBase): method setUp (line 126) | def setUp(self): FILE: tests/tasks/test_denoising.py class TestDenoising (line 17) | class TestDenoising(unittest.TestCase): method test_denoising (line 18) | def test_denoising(self): FILE: tests/tasks/test_masked_lm.py class TestMaskedLM (line 15) | class TestMaskedLM(unittest.TestCase): method test_masks_tokens (line 16) | def test_masks_tokens(self): FILE: tests/tasks/test_multilingual_denoising.py class TestMultilingualDenoising (line 17) | class TestMultilingualDenoising(unittest.TestCase): method test_multilingual_denoising (line 18) | def test_multilingual_denoising(self): FILE: tests/tasks/test_span_masked_lm.py class TestSpanMaskedLM (line 17) | class TestSpanMaskedLM(unittest.TestCase): method test_masks_token_spans (line 18) | def test_masks_token_spans(self): FILE: tests/test_activation_checkpointing.py class Model (line 14) | class Model(nn.Module): method __init__ (line 15) | def __init__( method forward (line 31) | def forward(self, x): class TestActivationCheckpointing (line 39) | class TestActivationCheckpointing(unittest.TestCase): method _test_checkpoint_wrapper (line 40) | def _test_checkpoint_wrapper(self, device, log_memory_usage=False): method test_checkpoint_wrapper_cpu (line 70) | def test_checkpoint_wrapper_cpu(self): method test_checkpoint_wrapper_cuda (line 74) | def test_checkpoint_wrapper_cuda(self): FILE: tests/test_amp_optimizer.py class TestGradientScalingAMP (line 17) | class TestGradientScalingAMP(unittest.TestCase): method setUp (line 18) | def setUp(self): method run_iter (line 46) | def run_iter(self, model, params, optimizer): method test_automatic_mixed_precision (line 70) | def test_automatic_mixed_precision(self): FILE: tests/test_average_checkpoints.py class ModelWithSharedParameter (line 18) | class ModelWithSharedParameter(nn.Module): method __init__ (line 19) | def __init__(self): method forward (line 30) | def forward(self, input): class TestAverageCheckpoints (line 34) | class TestAverageCheckpoints(unittest.TestCase): method test_average_checkpoints (line 35) | def test_average_checkpoints(self): method test_average_checkpoints_with_shared_parameters (line 88) | def test_average_checkpoints_with_shared_parameters(self): FILE: tests/test_backtranslation_dataset.py class TestBacktranslationDataset (line 18) | class TestBacktranslationDataset(unittest.TestCase): method setUp (line 19) | def setUp(self): method _backtranslation_dataset_helper (line 34) | def _backtranslation_dataset_helper( method test_backtranslation_dataset_no_eos_in_output_src (line 99) | def test_backtranslation_dataset_no_eos_in_output_src(self): method test_backtranslation_dataset_with_eos_in_output_src (line 105) | def test_backtranslation_dataset_with_eos_in_output_src(self): method test_backtranslation_dataset_no_eos_in_input_src (line 111) | def test_backtranslation_dataset_no_eos_in_input_src(self): method assertTensorEqual (line 117) | def assertTensorEqual(self, t1, t2): FILE: tests/test_binaries.py class TestTranslation (line 41) | class TestTranslation(unittest.TestCase): method setUp (line 42) | def setUp(self): method tearDown (line 45) | def tearDown(self): method test_fconv (line 48) | def test_fconv(self): method test_raw (line 56) | def test_raw(self): method test_update_freq (line 66) | def test_update_freq(self): method test_max_positions (line 76) | def test_max_positions(self): method test_generation (line 104) | def test_generation(self): method test_eval_bleu (line 167) | def test_eval_bleu(self): method test_lstm (line 186) | def test_lstm(self): method test_lstm_bidirectional (line 209) | def test_lstm_bidirectional(self): method test_transformer (line 235) | def test_transformer(self): method test_multilingual_transformer (line 257) | def test_multilingual_transformer(self): method test_multilingual_translation_latent_depth (line 314) | def test_multilingual_translation_latent_depth(self): method test_translation_multi_simple_epoch (line 381) | def test_translation_multi_simple_epoch(self): method test_translation_multi_simple_epoch_no_vepoch (line 443) | def test_translation_multi_simple_epoch_no_vepoch(self): method test_translation_multi_simple_epoch_dicts (line 493) | def test_translation_multi_simple_epoch_dicts(self): method test_translation_multi_simple_epoch_src_tgt_dict_spec (line 545) | def test_translation_multi_simple_epoch_src_tgt_dict_spec(self): method test_transformer_cross_self_attention (line 601) | def test_transformer_cross_self_attention(self): method test_transformer_pointer_generator (line 633) | def test_transformer_pointer_generator(self): method test_lightconv (line 675) | def test_lightconv(self): method test_dynamicconv (line 696) | def test_dynamicconv(self): method test_cmlm_transformer (line 717) | def test_cmlm_transformer(self): method test_nonautoregressive_transformer (line 750) | def test_nonautoregressive_transformer(self): method test_iterative_nonautoregressive_transformer (line 806) | def test_iterative_nonautoregressive_transformer(self): method test_insertion_transformer (line 844) | def test_insertion_transformer(self): method test_mixture_of_experts (line 874) | def test_mixture_of_experts(self): method test_alignment (line 919) | def test_alignment(self): method test_laser_lstm (line 946) | def test_laser_lstm(self): method test_laser_transformer (line 979) | def test_laser_transformer(self): method test_alignment_full_context (line 1005) | def test_alignment_full_context(self): method test_transformer_layerdrop (line 1033) | def test_transformer_layerdrop(self): class TestStories (line 1066) | class TestStories(unittest.TestCase): method setUp (line 1067) | def setUp(self): method tearDown (line 1070) | def tearDown(self): method test_fconv_self_att_wp (line 1073) | def test_fconv_self_att_wp(self): class TestLanguageModeling (line 1123) | class TestLanguageModeling(unittest.TestCase): method setUp (line 1124) | def setUp(self): method tearDown (line 1127) | def tearDown(self): method test_fconv_lm (line 1130) | def test_fconv_lm(self): method test_transformer_lm (line 1162) | def test_transformer_lm(self): method test_normformer_lm (line 1187) | def test_normformer_lm(self): method test_transformer_lm_with_adaptive_softmax (line 1220) | def test_transformer_lm_with_adaptive_softmax(self): method test_lightconv_lm (line 1252) | def test_lightconv_lm(self): method test_lstm_lm (line 1276) | def test_lstm_lm(self): method test_lstm_lm_residuals (line 1300) | def test_lstm_lm_residuals(self): method test_transformer_xl_bptt_lm (line 1325) | def test_transformer_xl_bptt_lm(self): class TestMaskedLanguageModel (line 1369) | class TestMaskedLanguageModel(unittest.TestCase): method setUp (line 1370) | def setUp(self): method tearDown (line 1373) | def tearDown(self): method test_legacy_masked_lm (line 1376) | def test_legacy_masked_lm(self): method test_roberta_masked_lm (line 1383) | def test_roberta_masked_lm(self): method test_roberta_sentence_prediction (line 1392) | def test_roberta_sentence_prediction(self): method test_roberta_regression_single (line 1401) | def test_roberta_regression_single(self): method test_roberta_regression_multiple (line 1418) | def test_roberta_regression_multiple(self): method test_linformer_roberta_masked_lm (line 1435) | def test_linformer_roberta_masked_lm(self): method test_linformer_roberta_sentence_prediction (line 1451) | def test_linformer_roberta_sentence_prediction(self): method test_linformer_roberta_regression_single (line 1465) | def test_linformer_roberta_regression_single(self): method test_linformer_roberta_regression_multiple (line 1486) | def test_linformer_roberta_regression_multiple(self): method _test_pretrained_masked_lm_for_translation (line 1507) | def _test_pretrained_masked_lm_for_translation(self, learned_pos_emb, ... method test_pretrained_masked_lm_for_translation_learned_pos_emb (line 1563) | def test_pretrained_masked_lm_for_translation_learned_pos_emb(self): method test_pretrained_masked_lm_for_translation_sinusoidal_pos_emb (line 1566) | def test_pretrained_masked_lm_for_translation_sinusoidal_pos_emb(self): method test_pretrained_masked_lm_for_translation_encoder_only (line 1569) | def test_pretrained_masked_lm_for_translation_encoder_only(self): method test_r4f_roberta (line 1572) | def test_r4f_roberta(self): function train_legacy_masked_language_model (line 1593) | def train_legacy_masked_language_model(data_dir, arch, extra_args=()): class TestOptimizers (line 1659) | class TestOptimizers(unittest.TestCase): method setUp (line 1660) | def setUp(self): method tearDown (line 1663) | def tearDown(self): method test_optimizers (line 1666) | def test_optimizers(self): function read_last_log_entry (line 1696) | def read_last_log_entry( class TestActivationCheckpointing (line 1705) | class TestActivationCheckpointing(unittest.TestCase): method _train (line 1725) | def _train(self, data_dir, extra_flags): method test_activation_offloading_does_not_change_metrics (line 1736) | def test_activation_offloading_does_not_change_metrics(self): method test_activation_checkpointing_does_not_change_metrics (line 1760) | def test_activation_checkpointing_does_not_change_metrics(self): function create_dummy_roberta_head_data (line 1780) | def create_dummy_roberta_head_data( function train_masked_lm (line 1817) | def train_masked_lm(data_dir, arch, extra_flags=None): function train_roberta_head (line 1854) | def train_roberta_head(data_dir, arch, num_classes=2, extra_flags=None): function eval_lm_main (line 1897) | def eval_lm_main(data_dir, extra_flags=None): FILE: tests/test_binarizer.py function build_vocab (line 17) | def build_vocab(data: tp.List[tp.List[str]]) -> Dictionary: class TestBinarizer (line 26) | class TestBinarizer(unittest.TestCase): method compare_ds_data (line 27) | def compare_ds_data(self, summary, data, prefix, impl, vocab): method test_can_binarize_line (line 40) | def test_can_binarize_line(self): method test_can_binarize_file_chunk (line 61) | def test_can_binarize_file_chunk(self): method test_can_multiprocess (line 88) | def test_can_multiprocess(self): FILE: tests/test_character_token_embedder.py class TestCharacterTokenEmbedder (line 13) | class TestCharacterTokenEmbedder(unittest.TestCase): method test_character_token_embedder (line 14) | def test_character_token_embedder(self): method assertAlmostEqual (line 42) | def assertAlmostEqual(self, t1, t2): FILE: tests/test_checkpoint_utils.py class TestCheckpointUtils (line 23) | class TestCheckpointUtils(unittest.TestCase): method setUp (line 24) | def setUp(self): method tearDown (line 27) | def tearDown(self): method _train_transformer (line 31) | def _train_transformer(self, seed, extra_args=None): method test_load_model_ensemble_and_task (line 56) | def test_load_model_ensemble_and_task(self): method test_prune_state_dict (line 76) | def test_prune_state_dict(self): method test_torch_persistent_save_async (line 91) | def test_torch_persistent_save_async(self): method test_load_ema_from_checkpoint (line 105) | def test_load_ema_from_checkpoint(self): FILE: tests/test_checkpoint_utils_for_task_level_attributes.py function mock_trainer (line 15) | def mock_trainer(epoch, num_updates, iterations_in_epoch): function checkpoint_dict (line 33) | def checkpoint_dict(): function mock_dict (line 48) | def mock_dict(): function get_trainer_and_epoch_itr (line 56) | def get_trainer_and_epoch_itr(epoch, epoch_size, num_updates, iterations... function get_mock_cfg (line 78) | def get_mock_cfg(finetune_from_model): class TestCheckpointsForTaskLevelAttributes (line 106) | class TestCheckpointsForTaskLevelAttributes(unittest.TestCase): method setUp (line 107) | def setUp(self) -> None: method tearDown (line 128) | def tearDown(self): method test_verify_checkpoint (line 132) | def test_verify_checkpoint(self) -> None: method test_load_checkpoint (line 159) | def test_load_checkpoint(self) -> None: FILE: tests/test_concat_dataset.py class TestConcatDataset (line 14) | class TestConcatDataset(unittest.TestCase): method setUp (line 15) | def setUp(self): method test_concat_dataset_basics (line 42) | def test_concat_dataset_basics(self): FILE: tests/test_constraints.py function tensorize (line 19) | def tensorize(constraints: List[List[int]]) -> torch.Tensor: class TestHelperRoutines (line 23) | class TestHelperRoutines(unittest.TestCase): method setUp (line 24) | def setUp(self): method test_packing (line 49) | def test_packing(self): class TestUnorderedConstraintState (line 56) | class TestUnorderedConstraintState(unittest.TestCase): method setUp (line 57) | def setUp(self): method test_graphs (line 150) | def test_graphs(self): method test_next_tokens (line 164) | def test_next_tokens(self): method test_sequences (line 182) | def test_sequences(self): class TestOrderedConstraintState (line 196) | class TestOrderedConstraintState(unittest.TestCase): method setUp (line 197) | def setUp(self): method test_sequences (line 261) | def test_sequences(self): FILE: tests/test_convtbc.py class TestConvTBC (line 13) | class TestConvTBC(unittest.TestCase): method test_convtbc (line 14) | def test_convtbc(self): method assertAlmostEqual (line 48) | def assertAlmostEqual(self, t1, t2): FILE: tests/test_data_utils.py class TestBatchBySize (line 13) | class TestBatchBySize(unittest.TestCase): method batch_by_size_baseline (line 15) | def batch_by_size_baseline( method _get_error_message (line 44) | def _get_error_message( method _compare_results (line 57) | def _compare_results( method _run_compare_with_baseline_sweep (line 88) | def _run_compare_with_baseline_sweep(self, batch_by_size_impl): class TestBatchBySizeVec (line 111) | class TestBatchBySizeVec(TestBatchBySize): method test_compare_with_baseline (line 112) | def test_compare_with_baseline(self): class TestBatchBySizeFn (line 116) | class TestBatchBySizeFn(TestBatchBySize): method test_compare_with_baseline (line 117) | def test_compare_with_baseline(self): FILE: tests/test_dataclass_utils.py class A (line 15) | class A(FairseqDataclass): class B (line 21) | class B(FairseqDataclass): class D (line 27) | class D(FairseqDataclass): class C (line 33) | class C(FairseqDataclass): class TestDataclassUtils (line 40) | class TestDataclassUtils(unittest.TestCase): method test_argparse_convert_basic (line 41) | def test_argparse_convert_basic(self): method test_argparse_recursive (line 48) | def test_argparse_recursive(self): method test_argparse_recursive_prefixing (line 56) | def test_argparse_recursive_prefixing(self): FILE: tests/test_dataset.py function lang_pair_dataset (line 14) | def lang_pair_dataset(lengths: Sequence[int]) -> LanguagePairDataset: function sample (line 19) | def sample(id: int, length: int): class TestDataset (line 23) | class TestDataset(unittest.TestCase): method setUp (line 24) | def setUp(self): method tearDown (line 27) | def tearDown(self): method test_round_robin_zip_datasets (line 30) | def test_round_robin_zip_datasets(self): method test_round_robin_zip_datasets_filtered (line 42) | def test_round_robin_zip_datasets_filtered(self): method test_round_robin_zip_datasets_filtered_with_tuple (line 55) | def test_round_robin_zip_datasets_filtered_with_tuple(self): FILE: tests/test_dictionary.py class TestDictionary (line 17) | class TestDictionary(unittest.TestCase): method test_finalize (line 18) | def test_finalize(self): method test_overwrite (line 80) | def test_overwrite(self): method test_no_overwrite (line 99) | def test_no_overwrite(self): method test_space (line 108) | def test_space(self): method test_add_file_to_dict (line 117) | def test_add_file_to_dict(self): FILE: tests/test_ema.py class DummyModule (line 18) | class DummyModule(torch.nn.Module): method __init__ (line 19) | def __init__(self) -> None: method forward (line 30) | def forward(self, x: torch.Tensor) -> torch.Tensor: class EMAConfig (line 36) | class EMAConfig(object): class TestEMA (line 44) | class TestEMA(unittest.TestCase): method assertTorchAllClose (line 45) | def assertTorchAllClose(self, x, y, atol=1e-8, rtol=1e-5, msg=None): method test_ema (line 59) | def test_ema(self): method _test_ema_start_update (line 115) | def _test_ema_start_update(self, updates): method test_ema_before_start_update (line 157) | def test_ema_before_start_update(self): method test_ema_after_start_update (line 160) | def test_ema_after_start_update(self): method test_ema_fp32 (line 163) | def test_ema_fp32(self): method test_ema_fp16 (line 220) | def test_ema_fp16(self): FILE: tests/test_espnet_multihead_attention.py class TestESPNETMultiHeadedAttention (line 13) | class TestESPNETMultiHeadedAttention(unittest.TestCase): method setUp (line 14) | def setUp(self) -> None: method test_forward (line 23) | def test_forward(self): method test_forward_qkv (line 36) | def test_forward_qkv(self): method test_forward_attention (line 70) | def test_forward_attention(self): class TestRelPositionMultiHeadedAttention (line 88) | class TestRelPositionMultiHeadedAttention(unittest.TestCase): method setUp (line 89) | def setUp(self) -> None: method test_rel_shift (line 99) | def test_rel_shift(self): method test_forward (line 120) | def test_forward(self): class TestRotaryPositionMultiHeadedAttention (line 150) | class TestRotaryPositionMultiHeadedAttention(unittest.TestCase): method setUp (line 151) | def setUp(self) -> None: method test_forward (line 161) | def test_forward(self): FILE: tests/test_export.py class DummyTask (line 21) | class DummyTask(LegacyFairseqTask): method __init__ (line 22) | def __init__(self, args): method source_dictionary (line 31) | def source_dictionary(self): method target_dictionary (line 35) | def target_dictionary(self): function get_dummy_dictionary (line 39) | def get_dummy_dictionary(vocab_size=DEFAULT_TEST_VOCAB_SIZE): function get_dummy_task_and_parser (line 47) | def get_dummy_task_and_parser(): function _test_save_and_load (line 61) | def _test_save_and_load(scripted_module): class TestExportModels (line 67) | class TestExportModels(unittest.TestCase): method test_export_multihead_attention (line 68) | def test_export_multihead_attention(self): method test_incremental_state_multihead_attention (line 73) | def test_incremental_state_multihead_attention(self): method test_positional_embedding (line 88) | def test_positional_embedding(self): method test_export_transformer (line 98) | def test_export_transformer(self): method test_export_transformer_no_token_pos_emb (line 109) | def test_export_transformer_no_token_pos_emb(self): FILE: tests/test_file_chunker_utils.py class TestFileChunker (line 11) | class TestFileChunker(unittest.TestCase): method setUpClass (line 20) | def setUpClass(cls) -> None: method tearDownClass (line 30) | def tearDownClass(cls) -> None: method test_find_offsets (line 35) | def test_find_offsets(self): method test_readchunks (line 50) | def test_readchunks(self): FILE: tests/test_file_io.py class TestFileIO (line 13) | class TestFileIO(unittest.TestCase): method setUpClass (line 20) | def setUpClass(cls) -> None: method tearDownClass (line 28) | def tearDownClass(cls) -> None: method test_file_io (line 33) | def test_file_io(self): method test_file_io_oss (line 40) | def test_file_io_oss(self): method test_file_io_async (line 49) | def test_file_io_async(self): FILE: tests/test_fp16_optimizer.py class TestGradientScaling (line 16) | class TestGradientScaling(unittest.TestCase): method setUp (line 17) | def setUp(self): method tearDown (line 55) | def tearDown(self): method run_iter (line 58) | def run_iter(self, model, params, optimizer): method test_mixed_precision (line 83) | def test_mixed_precision(self): method test_memory_efficient (line 102) | def test_memory_efficient(self): FILE: tests/test_hf_hub.py class TestHuggingFaceHub (line 20) | class TestHuggingFaceHub(unittest.TestCase): method test_hf_fastspeech2 (line 22) | def test_hf_fastspeech2(self): FILE: tests/test_huffman.py function make_counts (line 22) | def make_counts(data: tp.List[tp.List[str]]) -> Counter: function make_code_builder (line 26) | def make_code_builder(data: tp.List[tp.List[str]]) -> HuffmanCodeBuilder: class TestCodeBuilder (line 33) | class TestCodeBuilder(unittest.TestCase): method test_code_builder_can_count (line 34) | def test_code_builder_can_count(self): method test_code_builder_can_add (line 41) | def test_code_builder_can_add(self): method test_code_builder_can_io (line 50) | def test_code_builder_can_io(self): class TestCoder (line 61) | class TestCoder(unittest.TestCase): method test_coder_can_io (line 62) | def test_coder_can_io(self): method test_coder_can_encode_decode (line 73) | def test_coder_can_encode_decode(self): function build_dataset (line 91) | def build_dataset(prefix, data, coder): class TestHuffmanDataset (line 97) | class TestHuffmanDataset(unittest.TestCase): method test_huffman_can_encode_decode (line 98) | def test_huffman_can_encode_decode(self): method test_huffman_compresses (line 115) | def test_huffman_compresses(self): method test_huffman_can_append (line 142) | def test_huffman_can_append(self): FILE: tests/test_inference_dropout.py class TestInferenceDropout (line 14) | class TestInferenceDropout(unittest.TestCase): method setUp (line 15) | def setUp(self): method tearDown (line 23) | def tearDown(self): method test_sets_inference_dropout_to_true (line 26) | def test_sets_inference_dropout_to_true(self): method test_inference_dropout_false_by_default (line 36) | def test_inference_dropout_false_by_default(self): method test_applies_training_mode (line 47) | def test_applies_training_mode(self): method test_retain_modules (line 58) | def test_retain_modules(self): FILE: tests/test_iopath.py class TestIOPath (line 10) | class TestIOPath(unittest.TestCase): method test_no_iopath (line 11) | def test_no_iopath(self): method test_no_supports_rename (line 19) | def test_no_supports_rename(self): FILE: tests/test_iterators.py class TestIterators (line 11) | class TestIterators(unittest.TestCase): method test_counting_iterator_index (line 12) | def test_counting_iterator_index(self, ref=None, itr=None): method test_counting_iterator_length_mismatch (line 36) | def test_counting_iterator_length_mismatch(self): method test_counting_iterator_take (line 47) | def test_counting_iterator_take(self): method test_grouped_iterator (line 63) | def test_grouped_iterator(self): method test_sharded_iterator (line 79) | def test_sharded_iterator(self): method test_counting_iterator_buffered_iterator_take (line 101) | def test_counting_iterator_buffered_iterator_take(self): method test_epoch_batch_iterator_skip_remainder_batch (line 135) | def test_epoch_batch_iterator_skip_remainder_batch(self): method test_grouped_iterator_skip_remainder_batch (line 151) | def test_grouped_iterator_skip_remainder_batch(self): function _get_epoch_batch_itr (line 178) | def _get_epoch_batch_itr(ref, bsz, skip_remainder_batch): FILE: tests/test_label_smoothing.py class TestLabelSmoothing (line 18) | class TestLabelSmoothing(unittest.TestCase): method setUp (line 19) | def setUp(self): method test_nll_loss (line 62) | def test_nll_loss(self): method test_padding (line 77) | def test_padding(self): method test_reduction (line 96) | def test_reduction(self): method test_zero_eps (line 103) | def test_zero_eps(self): method assertAlmostEqual (line 117) | def assertAlmostEqual(self, t1, t2): FILE: tests/test_lm_context_window.py class TestLMContextWindow (line 15) | class TestLMContextWindow(unittest.TestCase): method test_eval_dataloader (line 16) | def test_eval_dataloader(self): FILE: tests/test_lstm_jitable.py class DummyTask (line 19) | class DummyTask(LegacyFairseqTask): method __init__ (line 20) | def __init__(self, args): method source_dictionary (line 29) | def source_dictionary(self): method target_dictionary (line 33) | def target_dictionary(self): function get_dummy_dictionary (line 37) | def get_dummy_dictionary(vocab_size=DEFAULT_TEST_VOCAB_SIZE): function get_dummy_task_and_parser (line 45) | def get_dummy_task_and_parser(): class TestJitLSTMModel (line 62) | class TestJitLSTMModel(unittest.TestCase): method _test_save_and_load (line 63) | def _test_save_and_load(self, scripted_module): method assertTensorEqual (line 68) | def assertTensorEqual(self, t1, t2): method test_jit_and_export_lstm (line 74) | def test_jit_and_export_lstm(self): method test_assert_jit_vs_nonjit_ (line 83) | def test_assert_jit_vs_nonjit_(self): FILE: tests/test_memory_efficient_fp16.py class TestMemoryEfficientFP16 (line 17) | class TestMemoryEfficientFP16(unittest.TestCase): method setUp (line 18) | def setUp(self): method tearDown (line 21) | def tearDown(self): method test_load_state_dict (line 24) | def test_load_state_dict(self): FILE: tests/test_metrics.py class TestMetrics (line 12) | class TestMetrics(unittest.TestCase): method test_nesting (line 13) | def test_nesting(self): method test_new_root (line 22) | def test_new_root(self): method test_nested_new_root (line 31) | def test_nested_new_root(self): method test_named (line 47) | def test_named(self): method test_nested_duplicate_names (line 61) | def test_nested_duplicate_names(self): FILE: tests/test_multi_corpus_dataset.py class TestMultiCorpusDataset (line 16) | class TestMultiCorpusDataset(unittest.TestCase): method setUp (line 17) | def setUp(self): method _test_sample_helper (line 44) | def _test_sample_helper( method test_multi_corpus_dataset (line 80) | def test_multi_corpus_dataset(self): FILE: tests/test_multi_corpus_sampled_dataset.py class TestMultiCorpusSampledDataset (line 16) | class TestMultiCorpusSampledDataset(unittest.TestCase): method setUp (line 17) | def setUp(self): method _test_sample_helper (line 44) | def _test_sample_helper( method test_multi_corpus_sampled_dataset_uniform_sample (line 77) | def test_multi_corpus_sampled_dataset_uniform_sample(self): method test_multi_corpus_sampled_dataset_weighted_sample (line 80) | def test_multi_corpus_sampled_dataset_weighted_sample(self): FILE: tests/test_multihead_attention.py function assert_almost_equal (line 25) | def assert_almost_equal(x, y, decimal=1, err_msg=""): function _reset_seeds (line 35) | def _reset_seeds(): function _get_mask (line 42) | def _get_mask(to_dtype: torch.dtype, dim0: int, dim1: int): function test_mask_for_xformers (line 49) | def test_mask_for_xformers(): function test_xformers_blocksparse_parity (line 111) | def test_xformers_blocksparse_parity( function test_xformers_single_forward_parity (line 220) | def test_xformers_single_forward_parity( function test_mask_padding_parity (line 327) | def test_mask_padding_parity(): function test_add_bias_parity (line 364) | def test_add_bias_parity(): class TestMultiheadAttention (line 412) | class TestMultiheadAttention(unittest.TestCase): method test_append_prev_key_padding_mask (line 413) | def test_append_prev_key_padding_mask(self): method test_pruning_heads (line 471) | def test_pruning_heads(self): FILE: tests/test_noising.py class TestDataNoising (line 22) | class TestDataNoising(unittest.TestCase): method _get_test_data_with_bpe_cont_marker (line 23) | def _get_test_data_with_bpe_cont_marker(self, append_eos=True): method _get_test_data_with_bpe_end_marker (line 58) | def _get_test_data_with_bpe_end_marker(self, append_eos=True): method _get_test_data_with_word_vocab (line 94) | def _get_test_data_with_word_vocab(self, append_eos=True): method _convert_src_tokens_to_tensor (line 123) | def _convert_src_tokens_to_tensor( method assert_eos_at_end (line 141) | def assert_eos_at_end(self, x, x_len, eos): method assert_word_dropout_correct (line 153) | def assert_word_dropout_correct(self, x, x_noised, x_len, l_noised): method test_word_dropout_with_eos (line 160) | def test_word_dropout_with_eos(self): method assert_word_blanking_correct (line 171) | def assert_word_blanking_correct(self, x, x_noised, x_len, l_noised, u... method test_word_blank_with_eos (line 181) | def test_word_blank_with_eos(self): method generate_unchanged_shuffle_map (line 192) | def generate_unchanged_shuffle_map(self, length): method assert_word_shuffle_matches_expected (line 195) | def assert_word_shuffle_matches_expected( method test_word_shuffle_with_eos (line 247) | def test_word_shuffle_with_eos(self): method test_word_shuffle_with_eos_nonbpe (line 278) | def test_word_shuffle_with_eos_nonbpe(self): method test_word_shuffle_without_eos (line 310) | def test_word_shuffle_without_eos(self): method test_word_shuffle_without_eos_with_bpe_end_marker (line 342) | def test_word_shuffle_without_eos_with_bpe_end_marker(self): method assert_no_eos_at_end (line 376) | def assert_no_eos_at_end(self, x, x_len, eos): method test_word_dropout_without_eos (line 387) | def test_word_dropout_without_eos(self): method test_word_blank_without_eos (line 399) | def test_word_blank_without_eos(self): method _get_noising_dataset_batch (line 411) | def _get_noising_dataset_batch( method test_noising_dataset_with_eos (line 453) | def test_noising_dataset_with_eos(self): method test_noising_dataset_without_eos (line 485) | def test_noising_dataset_without_eos(self): method assertTensorEqual (line 525) | def assertTensorEqual(self, t1, t2): FILE: tests/test_online_backtranslation.py function mk_sample (line 18) | def mk_sample(tokens: Sequence[int], batch_size: int = 2) -> Dict[str, A... function mk_dataset (line 31) | def mk_dataset(num_samples: int, max_len: int, output: Path): class OnlineBacktranslationTest (line 44) | class OnlineBacktranslationTest(unittest.TestCase): method obt_task (line 49) | def obt_task( method tmp_path (line 98) | def tmp_path(self, test_case: str) -> Path: method test_lang_tokens (line 101) | def test_lang_tokens(self): method test_backtranslate_sample (line 116) | def test_backtranslate_sample(self): method test_train_dataset (line 129) | def test_train_dataset(self): method test_valid_dataset (line 167) | def test_valid_dataset(self): method assertFnMatch (line 186) | def assertFnMatch(self, fn, values): method test_piecewise_linear_fn (line 191) | def test_piecewise_linear_fn(self): FILE: tests/test_plasma_utils.py class TestPlasmaView (line 23) | class TestPlasmaView(unittest.TestCase): method setUp (line 24) | def setUp(self) -> None: method tearDown (line 30) | def tearDown(self) -> None: method test_two_servers_do_not_share_object_id_space (line 35) | def test_two_servers_do_not_share_object_id_space(self): method test_hash_collision (line 51) | def test_hash_collision(self): method _assert_view_equal (line 76) | def _assert_view_equal(pv1, pv2): method test_putting_same_array_twice (line 79) | def test_putting_same_array_twice(self): method test_plasma_store_full_raises (line 104) | def test_plasma_store_full_raises(self): method test_object_id_overflow (line 114) | def test_object_id_overflow(self): method test_training_lm_plasma (line 117) | def test_training_lm_plasma(self): FILE: tests/test_positional_encoding.py class TestRelPositionalEncoding (line 8) | class TestRelPositionalEncoding(unittest.TestCase): method setUp (line 9) | def setUp(self) -> None: method test_extend_pe (line 17) | def test_extend_pe(self): method test_forward (line 42) | def test_forward(self): FILE: tests/test_reproducibility.py class TestReproducibility (line 16) | class TestReproducibility(unittest.TestCase): method _test_reproducibility (line 17) | def _test_reproducibility( method test_reproducibility (line 100) | def test_reproducibility(self): method test_reproducibility_fp16 (line 104) | def test_reproducibility_fp16(self): method test_reproducibility_memory_efficient_fp16 (line 116) | def test_reproducibility_memory_efficient_fp16(self): method test_reproducibility_amp (line 127) | def test_reproducibility_amp(self): method test_mid_epoch_reproducibility (line 138) | def test_mid_epoch_reproducibility(self): FILE: tests/test_resampling_dataset.py class TestResamplingDataset (line 13) | class TestResamplingDataset(unittest.TestCase): method setUp (line 14) | def setUp(self): method _test_common (line 22) | def _test_common(self, resampling_dataset, iters): method test_resampling_dataset_batch_by_size_false (line 65) | def test_resampling_dataset_batch_by_size_false(self): method test_resampling_dataset_batch_by_size_true (line 83) | def test_resampling_dataset_batch_by_size_true(self): FILE: tests/test_roberta.py class FakeTask (line 20) | class FakeTask(fairseq.tasks.LegacyFairseqTask): method __init__ (line 21) | def __init__(self, args): method source_dictionary (line 27) | def source_dictionary(self): method target_dictionary (line 31) | def target_dictionary(self): function get_toy_model (line 36) | def get_toy_model( function mk_sample (line 77) | def mk_sample( function cpu_gpu (line 103) | def cpu_gpu(fn): function architectures (line 112) | def architectures(fn): class RobertaTest (line 120) | class RobertaTest(unittest.TestCase): method assertTensorEqual (line 121) | def assertTensorEqual(self, t1, t2, delta: float = 1e-6): method assertSharing (line 128) | def assertSharing(self, model, link_groups: Sequence[Sequence[str]]): method test_roberta_shared_params (line 137) | def test_roberta_shared_params(self): method test_roberta_enc_dec_shared_params (line 160) | def test_roberta_enc_dec_shared_params(self): method test_roberta_max_positions_is_correctly_set (line 202) | def test_roberta_max_positions_is_correctly_set(self): method test_roberta_forward_backward (line 219) | def test_roberta_forward_backward(self, device: str): method test_roberta_forward_backward_bs1 (line 233) | def test_roberta_forward_backward_bs1(self, device: str): method test_roberta_batching (line 244) | def test_roberta_batching(self, device: str): method test_roberta_incremental_decoder (line 271) | def test_roberta_incremental_decoder(self, device: str): method test_regularize_for_adaprune_in_roberta (line 309) | def test_regularize_for_adaprune_in_roberta(self, device: str): method test_ffn_prune_for_adaprune_in_roberta (line 324) | def test_ffn_prune_for_adaprune_in_roberta(self, device: str): function params (line 339) | def params(model, name): FILE: tests/test_rotary_positional_embedding.py class TestRotaryPositionalEmbedding (line 8) | class TestRotaryPositionalEmbedding(unittest.TestCase): method setUp (line 9) | def setUp(self) -> None: method test_forward (line 17) | def test_forward(self): method test_apply_rotary_pos_emb (line 40) | def test_apply_rotary_pos_emb(self): method test_jit_compile_rope_module (line 62) | def test_jit_compile_rope_module(self): FILE: tests/test_sequence_generator.py class DummyTask (line 25) | class DummyTask(LegacyFairseqTask): method __init__ (line 26) | def __init__(self, args): method source_dictionary (line 35) | def source_dictionary(self): method target_dictionary (line 39) | def target_dictionary(self): function get_dummy_dictionary (line 43) | def get_dummy_dictionary(vocab_size=DEFAULT_TEST_VOCAB_SIZE): function get_dummy_task_and_parser (line 51) | def get_dummy_task_and_parser(): class TestJitSequenceGeneratorBase (line 68) | class TestJitSequenceGeneratorBase(unittest.TestCase): method setUp (line 69) | def setUp(self): method assertOutputEqual (line 84) | def assertOutputEqual(self, hypo, pos_probs): method assertTensorSizeEqual (line 89) | def assertTensorSizeEqual(self, t1, t2): method assertAlmostEqual (line 92) | def assertAlmostEqual(self, t1, t2): method assertTensorEqual (line 96) | def assertTensorEqual(self, t1, t2): method assertHypoEqual (line 100) | def assertHypoEqual(self, h1, h2): method _test_save_and_load (line 107) | def _test_save_and_load(self, scripted_module): class TestJitSequenceGenerator (line 117) | class TestJitSequenceGenerator(TestJitSequenceGeneratorBase): method test_export_transformer (line 118) | def test_export_transformer(self): method test_ensemble_sequence_generator (line 122) | def test_ensemble_sequence_generator(self): method test_export_ensemble_model (line 134) | def test_export_ensemble_model(self): class TestExportSearch (line 140) | class TestExportSearch(unittest.TestCase): method setUp (line 141) | def setUp(self): method test_export_diverse_bs (line 146) | def test_export_diverse_bs(self): method test_export_sampling (line 152) | def test_export_sampling(self): method test_export_diverse_siblings_search (line 159) | def test_export_diverse_siblings_search(self): class TestSequenceGeneratorBase (line 166) | class TestSequenceGeneratorBase(unittest.TestCase): method assertHypoTokens (line 167) | def assertHypoTokens(self, hypo, tokens): method assertHypoScore (line 170) | def assertHypoScore(self, hypo, pos_probs, normalized=True, lenpen=1.0): method assertAlmostEqual (line 179) | def assertAlmostEqual(self, t1, t2): method assertTensorEqual (line 183) | def assertTensorEqual(self, t1, t2): class TestSequenceGenerator (line 188) | class TestSequenceGenerator(TestSequenceGeneratorBase): method setUp (line 189) | def setUp(self): method test_with_normalization (line 202) | def test_with_normalization(self): method test_without_normalization (line 219) | def test_without_normalization(self): method test_with_lenpen_favoring_short_hypos (line 240) | def test_with_lenpen_favoring_short_hypos(self): method test_with_lenpen_favoring_long_hypos (line 260) | def test_with_lenpen_favoring_long_hypos(self): method test_maxlen (line 280) | def test_maxlen(self): method test_encoder_with_different_output_len (line 299) | def test_encoder_with_different_output_len(self): method test_generation_with_additional_input (line 313) | def test_generation_with_additional_input(self): class TestRepeatNgramBlocking (line 330) | class TestRepeatNgramBlocking(TestSequenceGeneratorBase): method setUpClass (line 332) | def setUpClass(cls): method test_finds_repetitive_tokens (line 343) | def test_finds_repetitive_tokens(self): method test_jit_no_extension (line 360) | def test_jit_no_extension(self): method test_ngram_blocking_same_as_default_implem (line 374) | def test_ngram_blocking_same_as_default_implem(self): method _compare_cuda_ext_to_default_implem (line 400) | def _compare_cuda_ext_to_default_implem( class TestDiverseBeamSearch (line 426) | class TestDiverseBeamSearch(TestSequenceGeneratorBase): method setUp (line 427) | def setUp(self): method test_diverse_beam_search (line 491) | def test_diverse_beam_search(self): class TestDiverseSiblingsSearch (line 523) | class TestDiverseSiblingsSearch(TestDiverseBeamSearch): method assertHypoScore (line 524) | def assertHypoScore( method test_diverse_beam_search (line 536) | def test_diverse_beam_search(self): class TestTopPSamplingSearch (line 565) | class TestTopPSamplingSearch(TestSequenceGeneratorBase): method setUp (line 566) | def setUp(self): method test_topp_sampling_search_low_prob (line 633) | def test_topp_sampling_search_low_prob(self): method test_topp_sampling_search_high_prob (line 664) | def test_topp_sampling_search_high_prob(self): method hypoTokens (line 722) | def hypoTokens(self, hypo, tokens): method hypoScore (line 725) | def hypoScore(self, hypo, pos_probs, normalized=True, lenpen=1.0): method almostEqual (line 736) | def almostEqual(self, t1, t2): method tensorEqual (line 739) | def tensorEqual(self, t1, t2): FILE: tests/test_sequence_scorer.py class TestSequenceScorer (line 14) | class TestSequenceScorer(unittest.TestCase): method test_sequence_scorer (line 15) | def test_sequence_scorer(self): method assertHypoTokens (line 98) | def assertHypoTokens(self, hypo, tokens): method assertHypoScore (line 101) | def assertHypoScore(self, hypo, pos_probs, normalized=True, lenpen=1.0): method assertAlmostEqual (line 110) | def assertAlmostEqual(self, t1, t2): method assertTensorEqual (line 114) | def assertTensorEqual(self, t1, t2): FILE: tests/test_sparse_multihead_attention.py class TestSparseMultiheadAttention (line 12) | class TestSparseMultiheadAttention(unittest.TestCase): method test_sparse_multihead_attention (line 13) | def test_sparse_multihead_attention(self): FILE: tests/test_token_block_dataset.py class TestTokenBlockDataset (line 13) | class TestTokenBlockDataset(unittest.TestCase): method _build_dataset (line 14) | def _build_dataset(self, data, **kwargs): method test_eos_break_mode (line 19) | def test_eos_break_mode(self): method test_block_break_mode (line 40) | def test_block_break_mode(self): method test_complete_break_mode (line 52) | def test_complete_break_mode(self): method test_4billion_tokens (line 77) | def test_4billion_tokens(self): FILE: tests/test_train.py function mock_trainer (line 17) | def mock_trainer(epoch, num_updates, iterations_in_epoch): function mock_dict (line 30) | def mock_dict(): function get_trainer_and_epoch_itr (line 38) | def get_trainer_and_epoch_itr(epoch, epoch_size, num_updates, iterations... function get_mock_cfg (line 60) | def get_mock_cfg(finetune_from_model): class TestLoadCheckpoint (line 82) | class TestLoadCheckpoint(unittest.TestCase): method setUp (line 83) | def setUp(self): method tearDown (line 96) | def tearDown(self): method test_load_partial_checkpoint (line 100) | def test_load_partial_checkpoint(self): method test_load_full_checkpoint (line 131) | def test_load_full_checkpoint(self): method test_load_no_checkpoint (line 145) | def test_load_no_checkpoint(self): method test_finetune_from_model_args_conflict (line 160) | def test_finetune_from_model_args_conflict(self): method test_finetune_from_model (line 185) | def test_finetune_from_model(self): method test_finetune_from_model_resume (line 214) | def test_finetune_from_model_resume(self): FILE: tests/test_transformer.py function mk_sample (line 11) | def mk_sample(tok: Sequence[int] = None, batch_size: int = 2) -> Dict[st... function mk_transformer (line 29) | def mk_transformer(**extra_args: Any): class TransformerTestCase (line 52) | class TransformerTestCase(unittest.TestCase): method test_forward_backward (line 53) | def test_forward_backward(self): method test_different_encoder_decoder_embed_dim (line 60) | def test_different_encoder_decoder_embed_dim(self): FILE: tests/test_utils.py class TestUtils (line 12) | class TestUtils(unittest.TestCase): method test_convert_padding_direction (line 13) | def test_convert_padding_direction(self): method test_make_positions (line 47) | def test_make_positions(self): method test_clip_grad_norm_ (line 87) | def test_clip_grad_norm_(self): method test_resolve_max_positions_with_tuple (line 104) | def test_resolve_max_positions_with_tuple(self): method assertAlmostEqual (line 108) | def assertAlmostEqual(self, t1, t2): FILE: tests/test_valid_subset_checks.py function make_lm_config (line 12) | def make_lm_config( function write_empty_file (line 48) | def write_empty_file(path): class TestValidSubsetsErrors (line 54) | class TestValidSubsetsErrors(unittest.TestCase): method _test_case (line 57) | def _test_case(self, paths, extra_flags): method test_default_raises (line 66) | def test_default_raises(self): method partially_specified_valid_subsets (line 74) | def partially_specified_valid_subsets(self): method test_legal_configs (line 85) | def test_legal_configs(self): method test_disable_validation (line 98) | def test_disable_validation(self): method test_dummy_task (line 102) | def test_dummy_task(self): method test_masked_dummy_task (line 106) | def test_masked_dummy_task(self): class TestCombineValidSubsets (line 111) | class TestCombineValidSubsets(unittest.TestCase): method _train (line 112) | def _train(self, extra_flags): method test_combined (line 128) | def test_combined(self): method test_subsets (line 134) | def test_subsets(self): FILE: tests/utils.py function dummy_dictionary (line 34) | def dummy_dictionary(vocab_size, prefix="token_"): function dummy_dataloader (line 43) | def dummy_dataloader( function sequence_generator_setup (line 67) | def sequence_generator_setup(): function create_dummy_data (line 169) | def create_dummy_data( function preprocess_lm_data (line 226) | def preprocess_lm_data(data_dir, languages=None): function preprocess_translation_data (line 267) | def preprocess_translation_data(data_dir, extra_flags=None): function preprocess_summarization_data (line 293) | def preprocess_summarization_data(data_dir, extra_flags=None): function create_laser_data_and_config_json (line 320) | def create_laser_data_and_config_json(data_dir): function train_translation_model (line 357) | def train_translation_model( function generate_main (line 431) | def generate_main(data_dir, extra_flags=None, path=None): class TestDataset (line 473) | class TestDataset(torch.utils.data.Dataset): method __init__ (line 474) | def __init__(self, data): method __getitem__ (line 479) | def __getitem__(self, index): method __len__ (line 482) | def __len__(self): class TestTranslationTask (line 486) | class TestTranslationTask(LegacyFairseqTask): method __init__ (line 487) | def __init__(self, args, src_dict, tgt_dict, model): method setup_task (line 494) | def setup_task(cls, args, src_dict=None, tgt_dict=None, model=None): method build_model (line 497) | def build_model(self, args, from_checkpoint=False): method source_dictionary (line 501) | def source_dictionary(self): method target_dictionary (line 505) | def target_dictionary(self): class TestModel (line 509) | class TestModel(FairseqEncoderDecoderModel): method __init__ (line 510) | def __init__(self, encoder, decoder): method build_model (line 514) | def build_model(cls, args, task): class TestEncoder (line 520) | class TestEncoder(FairseqEncoder): method __init__ (line 521) | def __init__(self, args, dictionary): method forward (line 525) | def forward(self, src_tokens, src_lengths=None, **kwargs): method reorder_encoder_out (line 535) | def reorder_encoder_out(self, encoder_out, new_order): class TestIncrementalDecoder (line 546) | class TestIncrementalDecoder(FairseqIncrementalDecoder): method __init__ (line 547) | def __init__(self, args, dictionary): method forward (line 553) | def forward(self, prev_output_tokens, encoder_out=None, incremental_st... method get_normalized_probs (line 594) | def get_normalized_probs(self, net_output, log_probs, _): method max_positions (line 602) | def max_positions(self): class TestReshapingEncoder (line 606) | class TestReshapingEncoder(FairseqEncoder): method __init__ (line 607) | def __init__(self, args, dictionary): method forward (line 611) | def forward(self, src_tokens, src_lengths=None, **kwargs): method reorder_encoder_out (line 628) | def reorder_encoder_out(self, encoder_out, new_order): class TestReshapingModel (line 639) | class TestReshapingModel(FairseqEncoderDecoderModel): method __init__ (line 640) | def __init__(self, encoder, decoder): method build_model (line 644) | def build_model(cls, args, task): class TestAdditionalInputEncoder (line 650) | class TestAdditionalInputEncoder(FairseqEncoder): method __init__ (line 651) | def __init__(self, args, dictionary): method forward (line 655) | def forward(self, src_tokens, src_lengths=None, **kwargs): method reorder_encoder_out (line 667) | def reorder_encoder_out(self, encoder_out, new_order): class TestAdditionalInputModel (line 678) | class TestAdditionalInputModel(FairseqEncoderDecoderModel): method __init__ (line 679) | def __init__(self, encoder, decoder): method build_model (line 683) | def build_model(cls, args, task): method forward (line 688) | def forward(self, src_tokens, src_lengths, prev_output_tokens, **kwargs): function train_language_model (line 696) | def train_language_model( function sizes (line 763) | def sizes(data): function make_sentence (line 770) | def make_sentence() -> tp.List[str]: function make_data (line 777) | def make_data(length=1000, out_file=None) -> tp.List[tp.List[str]]: function build_vocab (line 791) | def build_vocab(data: tp.List[tp.List[str]]) -> Dictionary: