├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── build ├── lib.linux-x86_64-3.6 │ └── fairseq │ │ ├── data │ │ ├── data_utils_fast.cpython-36m-x86_64-linux-gnu.so │ │ └── token_block_utils_fast.cpython-36m-x86_64-linux-gnu.so │ │ ├── libbase.cpython-36m-x86_64-linux-gnu.so │ │ ├── libbleu.cpython-36m-x86_64-linux-gnu.so │ │ └── libnat.cpython-36m-x86_64-linux-gnu.so └── temp.linux-x86_64-3.6 │ └── fairseq │ ├── clib │ ├── libbase │ │ └── balanced_assignment.o │ ├── libbleu │ │ ├── libbleu.o │ │ └── module.o │ └── libnat │ │ └── edit_dist.o │ └── data │ ├── data_utils_fast.o │ └── token_block_utils_fast.o ├── docs ├── Makefile ├── _static │ └── theme_overrides.css ├── command_line_tools.rst ├── conf.py ├── criterions.rst ├── data.rst ├── docutils.conf ├── fairseq.gif ├── fairseq_logo.png ├── getting_started.rst ├── hydra_integration.md ├── index.rst ├── lr_scheduler.rst ├── make.bat ├── models.rst ├── modules.rst ├── optim.rst ├── overview.rst ├── requirements.txt ├── tasks.rst ├── tutorial_classifying_names.rst └── tutorial_simple_lstm.rst ├── examples ├── .gitignore ├── __init__.py ├── __pycache__ │ └── __init__.cpython-36.pyc ├── adaptive_span │ ├── README.md │ ├── __init__.py │ ├── adagrad_with_grad_clip.py │ ├── adaptive_span_attention.py │ ├── adaptive_span_loss.py │ ├── adaptive_span_model.py │ ├── adaptive_span_model_wrapper.py │ └── truncated_bptt_lm_task.py ├── backtranslation │ ├── README.md │ ├── deduplicate_lines.py │ ├── extract_bt_data.py │ ├── prepare-de-monolingual.sh │ ├── prepare-wmt18en2de.sh │ ├── sacrebleu.sh │ └── tokenized_bleu.sh ├── bart │ ├── README.glue.md │ ├── README.md │ ├── README.summarization.md │ └── summarize.py ├── byte_level_bpe │ ├── README.md │ ├── get_bitext.py │ ├── get_data.sh │ └── gru_transformer.py ├── camembert │ └── README.md ├── constrained_decoding │ ├── README.md │ ├── normalize.py │ └── tok.py ├── conv_seq2seq │ └── README.md ├── criss │ ├── README.md │ ├── download_and_preprocess_flores_test.sh │ ├── download_and_preprocess_tatoeba.sh │ ├── mining │ │ ├── mine.py │ │ └── mine_example.sh │ ├── save_encoder.py │ ├── sentence_retrieval │ │ ├── encoder_analysis.py │ │ └── sentence_retrieval_tatoeba.sh │ └── unsupervised_mt │ │ └── eval.sh ├── cross_lingual_language_model │ └── README.md ├── fast_noisy_channel │ ├── README.md │ ├── __init__.py │ ├── noisy_channel_beam_search.py │ ├── noisy_channel_sequence_generator.py │ └── noisy_channel_translation.py ├── flores101 │ ├── README.md │ └── flores_logo.png ├── fully_sharded_data_parallel │ └── README.md ├── gottbert │ └── README.md ├── hubert │ ├── README.md │ ├── config │ │ ├── decode │ │ │ ├── ax_sweep │ │ │ │ ├── ngram.yaml │ │ │ │ └── transformer.yaml │ │ │ ├── infer_fsqlm.yaml │ │ │ ├── infer_kenlm.yaml │ │ │ ├── infer_viterbi.yaml │ │ │ └── run │ │ │ │ ├── submitit_slurm.yaml │ │ │ │ └── submitit_slurm_8gpu.yaml │ │ ├── finetune │ │ │ ├── base_10h.yaml │ │ │ ├── ckpt │ │ │ │ └── it1.yaml │ │ │ ├── lm │ │ │ │ └── ls_4gram.yaml │ │ │ └── run │ │ │ │ └── submitit_reg.yaml │ │ └── pretrain │ │ │ ├── data │ │ │ ├── iter1.yaml │ │ │ └── iter2.yaml │ │ │ ├── hubert_base_librispeech.yaml │ │ │ ├── hubert_large_librivox.yaml │ │ │ ├── hubert_xlarge_librivox.yaml │ │ │ └── run │ │ │ └── submitit_reg.yaml │ ├── measure_teacher_quality.py │ ├── simple_kmeans │ │ ├── README.md │ │ ├── dump_hubert_feature.py │ │ ├── dump_hubert_feature_s2t.py │ │ ├── dump_km_label.py │ │ ├── dump_mfcc_feature.py │ │ └── learn_kmeans.py │ └── update_ckpt.py ├── joint_alignment_translation │ ├── README.md │ └── prepare-wmt18en2de_no_norm_no_escape_no_agressive.sh ├── language_model │ ├── README.adaptive_inputs.md │ ├── README.conv.md │ ├── README.md │ └── prepare-wikitext-103.sh ├── laser │ ├── README.md │ └── laser_src │ │ ├── __init__.py │ │ ├── laser_lstm.py │ │ ├── laser_task.py │ │ ├── laser_transformer.py │ │ └── multitask_data_utils.py ├── latent_depth │ ├── README.md │ └── latent_depth_src │ │ ├── __init__.py │ │ ├── loss │ │ ├── __init__.py │ │ └── latent_depth.py │ │ ├── models │ │ ├── __init__.py │ │ ├── latent_multilingual_transformer.py │ │ └── latent_transformer.py │ │ ├── modules │ │ ├── __init__.py │ │ └── latent_layers.py │ │ └── multilingual_translation_latent_depth.py ├── layerdrop │ └── README.md ├── linformer │ ├── README.md │ └── linformer_src │ │ ├── __init__.py │ │ ├── models │ │ ├── __init__.py │ │ └── linformer_roberta.py │ │ └── modules │ │ ├── __init__.py │ │ ├── linformer_sentence_encoder.py │ │ ├── linformer_sentence_encoder_layer.py │ │ └── multihead_linear_attention.py ├── m2m_100 │ ├── README.md │ ├── install_dependecies.sh │ ├── process_data │ │ ├── clean_histogram.py │ │ ├── dedup_data.py │ │ └── remove_too_much_punc.py │ ├── tok.sh │ └── tokenizers │ │ ├── README.md │ │ ├── seg_ja.sh │ │ ├── seg_ko.sh │ │ ├── thirdparty │ │ └── .gitignore │ │ ├── tokenize_indic.py │ │ ├── tokenize_thai.py │ │ ├── tokenize_zh.py │ │ └── tokenizer_ar.sh ├── mbart │ └── README.md ├── megatron_11b │ ├── README.md │ └── detok.py ├── multilingual │ ├── ML50_langs.txt │ ├── README.md │ ├── data_scripts │ │ ├── README.md │ │ ├── binarize.py │ │ ├── check_iswlt_test_data.py │ │ ├── check_self_overlaps.py │ │ ├── check_valid_test_overlaps.py │ │ ├── dedup_all.py │ │ ├── download_ML50_v1.sh │ │ ├── download_af_xh.sh │ │ ├── download_flores_data.sh │ │ ├── download_iitb.sh │ │ ├── download_iwslt_and_extract.sh │ │ ├── download_lotus.sh │ │ ├── download_ted_and_extract.py │ │ ├── download_wat19_my.sh │ │ ├── download_wmt19_and_before.py │ │ ├── download_wmt20.sh │ │ ├── preprocess_ML50_v1.sh │ │ ├── remove_valid_test_in_train.py │ │ ├── requirement.txt │ │ └── utils │ │ │ ├── dedup.py │ │ │ ├── fasttext_multi_filter.py │ │ │ └── strip_sgm.sh │ ├── finetune_multilingual_model.sh │ ├── multilingual_fairseq_gen.sh │ └── train_multilingual_model.sh ├── noisychannel │ ├── README.md │ ├── __init__.py │ ├── rerank.py │ ├── rerank_generate.py │ ├── rerank_options.py │ ├── rerank_score_bw.py │ ├── rerank_score_lm.py │ ├── rerank_tune.py │ └── rerank_utils.py ├── nonautoregressive_translation │ ├── README.md │ └── scripts.md ├── paraphraser │ ├── README.md │ └── paraphrase.py ├── pay_less_attention_paper │ └── README.md ├── pointer_generator │ ├── README.md │ ├── README.xsum.md │ ├── pointer_generator_src │ │ ├── __init__.py │ │ └── transformer_pg.py │ ├── postprocess.py │ └── preprocess.py ├── quant_noise │ ├── README.md │ └── transformer_quantization_config.yaml ├── roberta │ ├── README.custom_classification.md │ ├── README.glue.md │ ├── README.md │ ├── README.pretraining.md │ ├── README.race.md │ ├── __pycache__ │ │ └── multiprocessing_bpe_encoder.cpython-36.pyc │ ├── commonsense_qa │ │ ├── README.md │ │ ├── __init__.py │ │ ├── commonsense_qa_task.py │ │ └── download_cqa_data.sh │ ├── multiprocessing_bpe_encoder.py │ ├── preprocess_GLUE_tasks.sh │ ├── preprocess_RACE.py │ ├── preprocess_RACE.sh │ └── wsc │ │ ├── README.md │ │ ├── __init__.py │ │ ├── wsc_criterion.py │ │ ├── wsc_task.py │ │ └── wsc_utils.py ├── rxf │ ├── README.md │ ├── __init__.py │ └── rxf_src │ │ ├── __init__.py │ │ ├── label_smoothed_cross_entropy_r3f.py │ │ └── sentence_prediction_r3f.py ├── scaling_nmt │ └── README.md ├── simultaneous_translation │ ├── README.md │ ├── __init__.py │ ├── __pycache__ │ │ └── __init__.cpython-36.pyc │ ├── docs │ │ ├── ende-mma.md │ │ └── enja-waitk.md │ ├── eval │ │ └── agents │ │ │ └── simul_t2t_enja.py │ ├── models │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── convtransformer_simul_trans.cpython-36.pyc │ │ │ └── transformer_monotonic_attention.cpython-36.pyc │ │ ├── convtransformer_simul_trans.py │ │ └── transformer_monotonic_attention.py │ ├── modules │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── fixed_pre_decision.cpython-36.pyc │ │ │ ├── monotonic_multihead_attention.cpython-36.pyc │ │ │ └── monotonic_transformer_layer.cpython-36.pyc │ │ ├── fixed_pre_decision.py │ │ ├── monotonic_multihead_attention.py │ │ └── monotonic_transformer_layer.py │ └── utils │ │ ├── __init__.py │ │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── data_utils.cpython-36.pyc │ │ ├── functions.cpython-36.pyc │ │ ├── latency.cpython-36.pyc │ │ └── p_choose_strategy.cpython-36.pyc │ │ ├── data_utils.py │ │ ├── functions.py │ │ ├── latency.py │ │ └── p_choose_strategy.py ├── speech_recognition │ ├── README.md │ ├── __init__.py │ ├── criterions │ │ ├── ASG_loss.py │ │ ├── __init__.py │ │ └── cross_entropy_acc.py │ ├── data │ │ ├── __init__.py │ │ ├── asr_dataset.py │ │ ├── collaters.py │ │ ├── data_utils.py │ │ └── replabels.py │ ├── datasets │ │ ├── asr_prep_json.py │ │ └── prepare-librispeech.sh │ ├── infer.py │ ├── kaldi │ │ ├── __init__.py │ │ ├── add-self-loop-simple.cc │ │ ├── config │ │ │ └── kaldi_initializer.yaml │ │ ├── kaldi_decoder.py │ │ └── kaldi_initializer.py │ ├── models │ │ ├── __init__.py │ │ ├── vggtransformer.py │ │ └── w2l_conv_glu_enc.py │ ├── new │ │ ├── README.md │ │ ├── __init__.py │ │ ├── conf │ │ │ ├── hydra │ │ │ │ └── sweeper │ │ │ │ │ └── ax.yaml │ │ │ └── infer.yaml │ │ ├── decoders │ │ │ ├── __init__.py │ │ │ ├── base_decoder.py │ │ │ ├── decoder.py │ │ │ ├── decoder_config.py │ │ │ ├── flashlight_decoder.py │ │ │ └── viterbi_decoder.py │ │ └── infer.py │ ├── tasks │ │ ├── __init__.py │ │ └── speech_recognition.py │ ├── utils │ │ └── wer_utils.py │ └── w2l_decoder.py ├── speech_to_text │ ├── README.md │ ├── data_utils.py │ ├── docs │ │ ├── covost_example.md │ │ ├── librispeech_example.md │ │ ├── mtedx_example.md │ │ ├── mustc_example.md │ │ └── simulst_mustc_example.md │ ├── prep_covost_data.py │ ├── prep_librispeech_data.py │ ├── prep_mtedx_data.py │ ├── prep_mustc_data.py │ ├── seg_mustc_data.py │ └── simultaneous_translation │ │ └── agents │ │ └── fairseq_simul_st_agent.py ├── stories │ └── README.md ├── translation │ ├── README.md │ ├── prepare-iwslt14.sh │ ├── prepare-iwslt17-multilingual.sh │ ├── prepare-wmt14en2de.sh │ └── prepare-wmt14en2fr.sh ├── translation_moe │ ├── README.md │ ├── score.py │ └── translation_moe_src │ │ ├── __init__.py │ │ ├── logsumexp_moe.py │ │ ├── mean_pool_gating_network.py │ │ └── translation_moe.py ├── truncated_bptt │ ├── README.md │ ├── __init__.py │ ├── transformer_xl_model.py │ └── truncated_bptt_lm_task.py ├── unsupervised_quality_estimation │ ├── README.md │ ├── aggregate_scores.py │ ├── meteor.py │ └── repeat_lines.py ├── wmt19 │ └── README.md ├── wmt20 │ └── README.md └── xlmr │ └── README.md ├── fairseq.egg-info ├── PKG-INFO ├── SOURCES.txt ├── dependency_links.txt ├── entry_points.txt ├── not-zip-safe ├── requires.txt └── top_level.txt ├── fairseq ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-36.pyc │ ├── binarizer.cpython-36.pyc │ ├── checkpoint_utils.cpython-36.pyc │ ├── file_io.cpython-36.pyc │ ├── file_utils.cpython-36.pyc │ ├── hub_utils.cpython-36.pyc │ ├── incremental_decoding_utils.cpython-36.pyc │ ├── iterative_refinement_generator.cpython-36.pyc │ ├── nan_detector.cpython-36.pyc │ ├── ngram_repeat_block.cpython-36.pyc │ ├── options.cpython-36.pyc │ ├── pdb.cpython-36.pyc │ ├── quantization_utils.cpython-36.pyc │ ├── registry.cpython-36.pyc │ ├── search.cpython-36.pyc │ ├── sequence_generator.cpython-36.pyc │ ├── sequence_scorer.cpython-36.pyc │ ├── token_generation_constraints.cpython-36.pyc │ ├── tokenizer.cpython-36.pyc │ ├── trainer.cpython-36.pyc │ ├── utils.cpython-36.pyc │ └── version.cpython-36.pyc ├── benchmark │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── dummy_dataset.cpython-36.pyc │ │ ├── dummy_lm.cpython-36.pyc │ │ ├── dummy_masked_lm.cpython-36.pyc │ │ ├── dummy_model.cpython-36.pyc │ │ └── dummy_mt.cpython-36.pyc │ ├── dummy_dataset.py │ ├── dummy_lm.py │ ├── dummy_masked_lm.py │ ├── dummy_model.py │ └── dummy_mt.py ├── binarizer.py ├── checkpoint_utils.py ├── clib │ ├── cuda │ │ ├── ngram_repeat_block_cuda.cpp │ │ └── ngram_repeat_block_cuda_kernel.cu │ ├── libbase │ │ └── balanced_assignment.cpp │ ├── libbleu │ │ ├── libbleu.cpp │ │ └── module.cpp │ ├── libnat │ │ └── edit_dist.cpp │ └── libnat_cuda │ │ ├── binding.cpp │ │ ├── edit_dist.cu │ │ └── edit_dist.h ├── config │ ├── __init__.py │ ├── config.yaml │ ├── model │ │ └── transformer_lm │ │ │ ├── transformer_lm_baevski_gbw.yaml │ │ │ ├── transformer_lm_baevski_wiki103.yaml │ │ │ ├── transformer_lm_big.yaml │ │ │ ├── transformer_lm_gbw.yaml │ │ │ ├── transformer_lm_gpt.yaml │ │ │ ├── transformer_lm_gpt2_big.yaml │ │ │ ├── transformer_lm_gpt2_medium.yaml │ │ │ ├── transformer_lm_gpt2_small.yaml │ │ │ └── transformer_lm_wiki103.yaml │ └── optim │ │ └── composite_small.yaml ├── criterions │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── adaptive_loss.cpython-36.pyc │ │ ├── composite_loss.cpython-36.pyc │ │ ├── cross_entropy.cpython-36.pyc │ │ ├── ctc.cpython-36.pyc │ │ ├── fairseq_criterion.cpython-36.pyc │ │ ├── hubert_criterion.cpython-36.pyc │ │ ├── label_smoothed_cross_entropy.cpython-36.pyc │ │ ├── label_smoothed_cross_entropy_latency_augmented.cpython-36.pyc │ │ ├── label_smoothed_cross_entropy_with_alignment.cpython-36.pyc │ │ ├── legacy_masked_lm.cpython-36.pyc │ │ ├── masked_lm.cpython-36.pyc │ │ ├── model_criterion.cpython-36.pyc │ │ ├── nat_loss.cpython-36.pyc │ │ ├── sentence_prediction.cpython-36.pyc │ │ ├── sentence_ranking.cpython-36.pyc │ │ ├── wav2vec_criterion.cpython-36.pyc │ │ ├── xentropy_and_balance.cpython-36.pyc │ │ └── xentropy_with_aux_loss.cpython-36.pyc │ ├── adaptive_loss.py │ ├── composite_loss.py │ ├── cross_entropy.py │ ├── ctc.py │ ├── fairseq_criterion.py │ ├── hubert_criterion.py │ ├── label_smoothed_cross_entropy.py │ ├── label_smoothed_cross_entropy_latency_augmented.py │ ├── label_smoothed_cross_entropy_with_alignment.py │ ├── legacy_masked_lm.py │ ├── masked_lm.py │ ├── model_criterion.py │ ├── nat_loss.py │ ├── sentence_prediction.py │ ├── sentence_ranking.py │ ├── wav2vec_criterion.py │ └── xentropy_with_aux_loss.py ├── data │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── add_target_dataset.cpython-36.pyc │ │ ├── append_token_dataset.cpython-36.pyc │ │ ├── backtranslation_dataset.cpython-36.pyc │ │ ├── base_wrapper_dataset.cpython-36.pyc │ │ ├── bucket_pad_length_dataset.cpython-36.pyc │ │ ├── colorize_dataset.cpython-36.pyc │ │ ├── concat_dataset.cpython-36.pyc │ │ ├── concat_sentences_dataset.cpython-36.pyc │ │ ├── data_utils.cpython-36.pyc │ │ ├── denoising_dataset.cpython-36.pyc │ │ ├── dictionary.cpython-36.pyc │ │ ├── fairseq_dataset.cpython-36.pyc │ │ ├── fasta_dataset.cpython-36.pyc │ │ ├── id_dataset.cpython-36.pyc │ │ ├── indexed_dataset.cpython-36.pyc │ │ ├── iterators.cpython-36.pyc │ │ ├── language_pair_dataset.cpython-36.pyc │ │ ├── list_dataset.cpython-36.pyc │ │ ├── lm_context_window_dataset.cpython-36.pyc │ │ ├── lru_cache_dataset.cpython-36.pyc │ │ ├── mask_tokens_dataset.cpython-36.pyc │ │ ├── monolingual_dataset.cpython-36.pyc │ │ ├── multi_corpus_sampled_dataset.cpython-36.pyc │ │ ├── nested_dictionary_dataset.cpython-36.pyc │ │ ├── noising.cpython-36.pyc │ │ ├── num_samples_dataset.cpython-36.pyc │ │ ├── numel_dataset.cpython-36.pyc │ │ ├── offset_tokens_dataset.cpython-36.pyc │ │ ├── pad_dataset.cpython-36.pyc │ │ ├── plasma_utils.cpython-36.pyc │ │ ├── prepend_dataset.cpython-36.pyc │ │ ├── prepend_token_dataset.cpython-36.pyc │ │ ├── raw_label_dataset.cpython-36.pyc │ │ ├── replace_dataset.cpython-36.pyc │ │ ├── resampling_dataset.cpython-36.pyc │ │ ├── roll_dataset.cpython-36.pyc │ │ ├── round_robin_zip_datasets.cpython-36.pyc │ │ ├── shorten_dataset.cpython-36.pyc │ │ ├── sort_dataset.cpython-36.pyc │ │ ├── strip_token_dataset.cpython-36.pyc │ │ ├── subsample_dataset.cpython-36.pyc │ │ ├── token_block_dataset.cpython-36.pyc │ │ ├── transform_eos_dataset.cpython-36.pyc │ │ └── transform_eos_lang_pair_dataset.cpython-36.pyc │ ├── add_target_dataset.py │ ├── append_token_dataset.py │ ├── audio │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── audio_utils.cpython-36.pyc │ │ │ ├── hubert_dataset.cpython-36.pyc │ │ │ ├── raw_audio_dataset.cpython-36.pyc │ │ │ └── speech_to_text_dataset.cpython-36.pyc │ │ ├── audio_utils.py │ │ ├── feature_transforms │ │ │ ├── __init__.py │ │ │ ├── __pycache__ │ │ │ │ ├── __init__.cpython-36.pyc │ │ │ │ ├── global_cmvn.cpython-36.pyc │ │ │ │ ├── specaugment.cpython-36.pyc │ │ │ │ └── utterance_cmvn.cpython-36.pyc │ │ │ ├── global_cmvn.py │ │ │ ├── specaugment.py │ │ │ └── utterance_cmvn.py │ │ ├── hubert_dataset.py │ │ ├── raw_audio_dataset.py │ │ └── speech_to_text_dataset.py │ ├── backtranslation_dataset.py │ ├── base_wrapper_dataset.py │ ├── bucket_pad_length_dataset.py │ ├── colorize_dataset.py │ ├── concat_dataset.py │ ├── concat_sentences_dataset.py │ ├── data_utils.py │ ├── data_utils_fast.cpp │ ├── data_utils_fast.cpython-36m-x86_64-linux-gnu.so │ ├── data_utils_fast.pyx │ ├── denoising_dataset.py │ ├── dictionary.py │ ├── encoders │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── byte_bpe.cpython-36.pyc │ │ │ ├── byte_utils.cpython-36.pyc │ │ │ ├── bytes.cpython-36.pyc │ │ │ ├── characters.cpython-36.pyc │ │ │ ├── fastbpe.cpython-36.pyc │ │ │ ├── gpt2_bpe.cpython-36.pyc │ │ │ ├── gpt2_bpe_utils.cpython-36.pyc │ │ │ ├── hf_bert_bpe.cpython-36.pyc │ │ │ ├── hf_byte_bpe.cpython-36.pyc │ │ │ ├── moses_tokenizer.cpython-36.pyc │ │ │ ├── nltk_tokenizer.cpython-36.pyc │ │ │ ├── sentencepiece_bpe.cpython-36.pyc │ │ │ ├── space_tokenizer.cpython-36.pyc │ │ │ ├── subword_nmt_bpe.cpython-36.pyc │ │ │ └── utils.cpython-36.pyc │ │ ├── byte_bpe.py │ │ ├── byte_utils.py │ │ ├── bytes.py │ │ ├── characters.py │ │ ├── fastbpe.py │ │ ├── gpt2_bpe.py │ │ ├── gpt2_bpe_utils.py │ │ ├── hf_bert_bpe.py │ │ ├── hf_byte_bpe.py │ │ ├── moses_tokenizer.py │ │ ├── nltk_tokenizer.py │ │ ├── sentencepiece_bpe.py │ │ ├── space_tokenizer.py │ │ ├── subword_nmt_bpe.py │ │ └── utils.py │ ├── fairseq_dataset.py │ ├── fasta_dataset.py │ ├── id_dataset.py │ ├── indexed_dataset.py │ ├── iterators.py │ ├── language_pair_dataset.py │ ├── legacy │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── block_pair_dataset.cpython-36.pyc │ │ │ ├── masked_lm_dataset.cpython-36.pyc │ │ │ └── masked_lm_dictionary.cpython-36.pyc │ │ ├── block_pair_dataset.py │ │ ├── masked_lm_dataset.py │ │ └── masked_lm_dictionary.py │ ├── list_dataset.py │ ├── lm_context_window_dataset.py │ ├── lru_cache_dataset.py │ ├── mask_tokens_dataset.py │ ├── monolingual_dataset.py │ ├── multi_corpus_dataset.py │ ├── multi_corpus_sampled_dataset.py │ ├── multilingual │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── multilingual_data_manager.cpython-36.pyc │ │ │ ├── multilingual_utils.cpython-36.pyc │ │ │ ├── sampled_multi_dataset.cpython-36.pyc │ │ │ ├── sampled_multi_epoch_dataset.cpython-36.pyc │ │ │ └── sampling_method.cpython-36.pyc │ │ ├── multilingual_data_manager.py │ │ ├── multilingual_utils.py │ │ ├── sampled_multi_dataset.py │ │ ├── sampled_multi_epoch_dataset.py │ │ └── sampling_method.py │ ├── nested_dictionary_dataset.py │ ├── noising.py │ ├── num_samples_dataset.py │ ├── numel_dataset.py │ ├── offset_tokens_dataset.py │ ├── pad_dataset.py │ ├── plasma_utils.py │ ├── prepend_dataset.py │ ├── prepend_token_dataset.py │ ├── raw_label_dataset.py │ ├── replace_dataset.py │ ├── resampling_dataset.py │ ├── roll_dataset.py │ ├── round_robin_zip_datasets.py │ ├── shorten_dataset.py │ ├── sort_dataset.py │ ├── strip_token_dataset.py │ ├── subsample_dataset.py │ ├── token_block_dataset.py │ ├── token_block_utils_fast.cpp │ ├── token_block_utils_fast.cpython-36m-x86_64-linux-gnu.so │ ├── token_block_utils_fast.pyx │ ├── transform_eos_dataset.py │ └── transform_eos_lang_pair_dataset.py ├── dataclass │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── configs.cpython-36.pyc │ │ ├── constants.cpython-36.pyc │ │ ├── initialize.cpython-36.pyc │ │ └── utils.cpython-36.pyc │ ├── configs.py │ ├── constants.py │ ├── initialize.py │ └── utils.py ├── distributed │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── distributed_timeout_wrapper.cpython-36.pyc │ │ ├── fully_sharded_data_parallel.cpython-36.pyc │ │ ├── legacy_distributed_data_parallel.cpython-36.pyc │ │ ├── module_proxy_wrapper.cpython-36.pyc │ │ ├── tpu_distributed_data_parallel.cpython-36.pyc │ │ └── utils.cpython-36.pyc │ ├── distributed_timeout_wrapper.py │ ├── fully_sharded_data_parallel.py │ ├── legacy_distributed_data_parallel.py │ ├── module_proxy_wrapper.py │ ├── tpu_distributed_data_parallel.py │ └── utils.py ├── file_io.py ├── file_utils.py ├── hub_utils.py ├── incremental_decoding_utils.py ├── iterative_refinement_generator.py ├── libbase.cpython-36m-x86_64-linux-gnu.so ├── libbleu.cpython-36m-x86_64-linux-gnu.so ├── libnat.cpython-36m-x86_64-linux-gnu.so ├── logging │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── meters.cpython-36.pyc │ │ ├── metrics.cpython-36.pyc │ │ └── progress_bar.cpython-36.pyc │ ├── meters.py │ ├── metrics.py │ └── progress_bar.py ├── model_parallel │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ └── megatron_trainer.cpython-36.pyc │ ├── criterions │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ └── vocab_parallel_cross_entropy.cpython-36.pyc │ │ └── vocab_parallel_cross_entropy.py │ ├── megatron_trainer.py │ ├── models │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── transformer.cpython-36.pyc │ │ │ └── transformer_lm.cpython-36.pyc │ │ ├── pipeline_parallel_transformer │ │ │ ├── __init__.py │ │ │ ├── __pycache__ │ │ │ │ ├── __init__.cpython-36.pyc │ │ │ │ ├── layers.cpython-36.pyc │ │ │ │ └── model.cpython-36.pyc │ │ │ ├── layers.py │ │ │ └── model.py │ │ ├── roberta │ │ │ ├── __init__.py │ │ │ ├── __pycache__ │ │ │ │ ├── __init__.cpython-36.pyc │ │ │ │ └── model.cpython-36.pyc │ │ │ └── model.py │ │ ├── transformer.py │ │ └── transformer_lm.py │ └── modules │ │ ├── __init__.py │ │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── multihead_attention.cpython-36.pyc │ │ └── transformer_layer.cpython-36.pyc │ │ ├── multihead_attention.py │ │ └── transformer_layer.py ├── models │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── composite_encoder.cpython-36.pyc │ │ ├── distributed_fairseq_model.cpython-36.pyc │ │ ├── fairseq_decoder.cpython-36.pyc │ │ ├── fairseq_encoder.cpython-36.pyc │ │ ├── fairseq_incremental_decoder.cpython-36.pyc │ │ ├── fairseq_model.cpython-36.pyc │ │ ├── fconv.cpython-36.pyc │ │ ├── fconv_lm.cpython-36.pyc │ │ ├── fconv_self_att.cpython-36.pyc │ │ ├── lightconv.cpython-36.pyc │ │ ├── lightconv_lm.cpython-36.pyc │ │ ├── lstm.cpython-36.pyc │ │ ├── lstm_lm.cpython-36.pyc │ │ ├── masked_lm.cpython-36.pyc │ │ ├── model_utils.cpython-36.pyc │ │ ├── multilingual_transformer.cpython-36.pyc │ │ ├── transformer.cpython-36.pyc │ │ ├── transformer_align.cpython-36.pyc │ │ ├── transformer_from_pretrained_xlm.cpython-36.pyc │ │ └── transformer_lm.cpython-36.pyc │ ├── bart │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── hub_interface.cpython-36.pyc │ │ │ └── model.cpython-36.pyc │ │ ├── hub_interface.py │ │ └── model.py │ ├── composite_encoder.py │ ├── distributed_fairseq_model.py │ ├── fairseq_decoder.py │ ├── fairseq_encoder.py │ ├── fairseq_incremental_decoder.py │ ├── fairseq_model.py │ ├── fconv.py │ ├── fconv_lm.py │ ├── fconv_self_att.py │ ├── hubert │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── hubert.cpython-36.pyc │ │ │ └── hubert_asr.cpython-36.pyc │ │ ├── hubert.py │ │ └── hubert_asr.py │ ├── huggingface │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ └── hf_gpt2.cpython-36.pyc │ │ └── hf_gpt2.py │ ├── lightconv.py │ ├── lightconv_lm.py │ ├── lstm.py │ ├── lstm_lm.py │ ├── masked_lm.py │ ├── model_utils.py │ ├── multilingual_transformer.py │ ├── nat │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── cmlm_transformer.cpython-36.pyc │ │ │ ├── fairseq_nat_model.cpython-36.pyc │ │ │ ├── insertion_transformer.cpython-36.pyc │ │ │ ├── iterative_nonautoregressive_transformer.cpython-36.pyc │ │ │ ├── levenshtein_transformer.cpython-36.pyc │ │ │ ├── levenshtein_utils.cpython-36.pyc │ │ │ ├── nat_crf_transformer.cpython-36.pyc │ │ │ └── nonautoregressive_transformer.cpython-36.pyc │ │ ├── cmlm_transformer.py │ │ ├── fairseq_nat_model.py │ │ ├── insertion_transformer.py │ │ ├── iterative_nonautoregressive_transformer.py │ │ ├── levenshtein_transformer.py │ │ ├── levenshtein_utils.py │ │ ├── nat_crf_transformer.py │ │ ├── nonautoregressive_ensembles.py │ │ └── nonautoregressive_transformer.py │ ├── roberta │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── enc_dec.cpython-36.pyc │ │ │ ├── hub_interface.cpython-36.pyc │ │ │ ├── model.cpython-36.pyc │ │ │ ├── model_camembert.cpython-36.pyc │ │ │ ├── model_gottbert.cpython-36.pyc │ │ │ └── model_xlmr.cpython-36.pyc │ │ ├── alignment_utils.py │ │ ├── enc_dec.py │ │ ├── hub_interface.py │ │ ├── model.py │ │ ├── model_camembert.py │ │ ├── model_gottbert.py │ │ └── model_xlmr.py │ ├── speech_to_text │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── berard.cpython-36.pyc │ │ │ ├── convtransformer.cpython-36.pyc │ │ │ ├── s2t_transformer.cpython-36.pyc │ │ │ └── utils.cpython-36.pyc │ │ ├── berard.py │ │ ├── convtransformer.py │ │ ├── modules │ │ │ ├── __pycache__ │ │ │ │ ├── augmented_memory_attention.cpython-36.pyc │ │ │ │ └── emformer.cpython-36.pyc │ │ │ ├── augmented_memory_attention.py │ │ │ └── emformer.py │ │ ├── s2t_transformer.py │ │ └── utils.py │ ├── transformer.py │ ├── transformer_align.py │ ├── transformer_from_pretrained_xlm.py │ ├── transformer_lm.py │ └── wav2vec │ │ ├── __init__.py │ │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── wav2vec.cpython-36.pyc │ │ ├── wav2vec2.cpython-36.pyc │ │ └── wav2vec2_asr.cpython-36.pyc │ │ ├── wav2vec.py │ │ ├── wav2vec2.py │ │ └── wav2vec2_asr.py ├── modules │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── adaptive_input.cpython-36.pyc │ │ ├── adaptive_softmax.cpython-36.pyc │ │ ├── base_layer.cpython-36.pyc │ │ ├── beamable_mm.cpython-36.pyc │ │ ├── character_token_embedder.cpython-36.pyc │ │ ├── checkpoint_activations.cpython-36.pyc │ │ ├── conv_tbc.cpython-36.pyc │ │ ├── cross_entropy.cpython-36.pyc │ │ ├── downsampled_multihead_attention.cpython-36.pyc │ │ ├── dynamic_convolution.cpython-36.pyc │ │ ├── dynamic_crf_layer.cpython-36.pyc │ │ ├── fairseq_dropout.cpython-36.pyc │ │ ├── fp32_group_norm.cpython-36.pyc │ │ ├── gelu.cpython-36.pyc │ │ ├── grad_multiply.cpython-36.pyc │ │ ├── gumbel_vector_quantizer.cpython-36.pyc │ │ ├── kmeans_vector_quantizer.cpython-36.pyc │ │ ├── layer_drop.cpython-36.pyc │ │ ├── layer_norm.cpython-36.pyc │ │ ├── learned_positional_embedding.cpython-36.pyc │ │ ├── lightweight_convolution.cpython-36.pyc │ │ ├── linearized_convolution.cpython-36.pyc │ │ ├── moe_layer.cpython-36.pyc │ │ ├── multihead_attention.cpython-36.pyc │ │ ├── positional_embedding.cpython-36.pyc │ │ ├── quant_noise.cpython-36.pyc │ │ ├── same_pad.cpython-36.pyc │ │ ├── scalar_bias.cpython-36.pyc │ │ ├── sinusoidal_positional_embedding.cpython-36.pyc │ │ ├── transformer_layer.cpython-36.pyc │ │ ├── transformer_sentence_encoder.cpython-36.pyc │ │ ├── transformer_sentence_encoder_layer.cpython-36.pyc │ │ ├── transpose_last.cpython-36.pyc │ │ ├── unfold.cpython-36.pyc │ │ └── vggblock.cpython-36.pyc │ ├── adaptive_input.py │ ├── adaptive_softmax.py │ ├── beamable_mm.py │ ├── character_token_embedder.py │ ├── checkpoint_activations.py │ ├── conv_tbc.py │ ├── cross_entropy.py │ ├── cuda_utils.cu │ ├── downsampled_multihead_attention.py │ ├── dynamic_convolution.py │ ├── dynamic_crf_layer.py │ ├── dynamicconv_layer │ │ ├── __init__.py │ │ ├── cuda_function_gen.py │ │ ├── dynamicconv_cuda.cpp │ │ ├── dynamicconv_cuda.cuh │ │ ├── dynamicconv_cuda_kernel.cu │ │ ├── dynamicconv_layer.py │ │ ├── dynamiconv_cpu.cpp │ │ └── setup.py │ ├── fairseq_dropout.py │ ├── fp32_group_norm.py │ ├── gelu.py │ ├── grad_multiply.py │ ├── gumbel_vector_quantizer.py │ ├── kmeans_vector_quantizer.py │ ├── layer_drop.py │ ├── layer_norm.py │ ├── learned_positional_embedding.py │ ├── lightconv_layer │ │ ├── __init__.py │ │ ├── cuda_function_gen.py │ │ ├── lightconv_cuda.cpp │ │ ├── lightconv_cuda.cuh │ │ ├── lightconv_cuda_kernel.cu │ │ ├── lightconv_layer.py │ │ └── setup.py │ ├── lightweight_convolution.py │ ├── linearized_convolution.py │ ├── moe_layer.py │ ├── multihead_attention.py │ ├── positional_embedding.py │ ├── quant_noise.py │ ├── quantization │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ └── quantization_options.cpython-36.pyc │ │ ├── pq │ │ │ ├── __init__.py │ │ │ ├── __pycache__ │ │ │ │ ├── __init__.cpython-36.pyc │ │ │ │ ├── em.cpython-36.pyc │ │ │ │ ├── pq.cpython-36.pyc │ │ │ │ └── utils.cpython-36.pyc │ │ │ ├── em.py │ │ │ ├── modules │ │ │ │ ├── __init__.py │ │ │ │ ├── __pycache__ │ │ │ │ │ ├── __init__.cpython-36.pyc │ │ │ │ │ ├── qconv.cpython-36.pyc │ │ │ │ │ ├── qemb.cpython-36.pyc │ │ │ │ │ └── qlinear.cpython-36.pyc │ │ │ │ ├── qconv.py │ │ │ │ ├── qemb.py │ │ │ │ └── qlinear.py │ │ │ ├── pq.py │ │ │ └── utils.py │ │ ├── quantization_options.py │ │ └── scalar │ │ │ ├── __init__.py │ │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── ops.cpython-36.pyc │ │ │ └── utils.cpython-36.pyc │ │ │ ├── modules │ │ │ ├── __init__.py │ │ │ ├── __pycache__ │ │ │ │ ├── __init__.cpython-36.pyc │ │ │ │ ├── qact.cpython-36.pyc │ │ │ │ ├── qconv.cpython-36.pyc │ │ │ │ ├── qemb.cpython-36.pyc │ │ │ │ └── qlinear.cpython-36.pyc │ │ │ ├── qact.py │ │ │ ├── qconv.py │ │ │ ├── qemb.py │ │ │ └── qlinear.py │ │ │ ├── ops.py │ │ │ └── utils.py │ ├── same_pad.py │ ├── scalar_bias.py │ ├── sinusoidal_positional_embedding.py │ ├── sparse_multihead_attention.py │ ├── sparse_transformer_sentence_encoder.py │ ├── sparse_transformer_sentence_encoder_layer.py │ ├── transformer_layer.py │ ├── transformer_sentence_encoder.py │ ├── transformer_sentence_encoder_layer.py │ ├── transpose_last.py │ ├── unfold.py │ └── vggblock.py ├── nan_detector.py ├── ngram_repeat_block.py ├── optim │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── adadelta.cpython-36.pyc │ │ ├── adafactor.cpython-36.pyc │ │ ├── adagrad.cpython-36.pyc │ │ ├── adam.cpython-36.pyc │ │ ├── adamax.cpython-36.pyc │ │ ├── amp_optimizer.cpython-36.pyc │ │ ├── bmuf.cpython-36.pyc │ │ ├── composite.cpython-36.pyc │ │ ├── cpu_adam.cpython-36.pyc │ │ ├── dynamic_loss_scaler.cpython-36.pyc │ │ ├── fairseq_optimizer.cpython-36.pyc │ │ ├── fp16_optimizer.cpython-36.pyc │ │ ├── fused_adam.cpython-36.pyc │ │ ├── fused_lamb.cpython-36.pyc │ │ ├── nag.cpython-36.pyc │ │ ├── sgd.cpython-36.pyc │ │ └── shard.cpython-36.pyc │ ├── adadelta.py │ ├── adafactor.py │ ├── adagrad.py │ ├── adam.py │ ├── adamax.py │ ├── amp_optimizer.py │ ├── bmuf.py │ ├── composite.py │ ├── cpu_adam.py │ ├── dynamic_loss_scaler.py │ ├── fairseq_optimizer.py │ ├── fp16_optimizer.py │ ├── fused_adam.py │ ├── fused_lamb.py │ ├── lr_scheduler │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-36.pyc │ │ │ ├── cosine_lr_scheduler.cpython-36.pyc │ │ │ ├── fairseq_lr_scheduler.cpython-36.pyc │ │ │ ├── fixed_schedule.cpython-36.pyc │ │ │ ├── inverse_square_root_schedule.cpython-36.pyc │ │ │ ├── manual_lr_scheduler.cpython-36.pyc │ │ │ ├── pass_through.cpython-36.pyc │ │ │ ├── polynomial_decay_schedule.cpython-36.pyc │ │ │ ├── reduce_lr_on_plateau.cpython-36.pyc │ │ │ ├── tri_stage_lr_scheduler.cpython-36.pyc │ │ │ └── triangular_lr_scheduler.cpython-36.pyc │ │ ├── cosine_lr_scheduler.py │ │ ├── fairseq_lr_scheduler.py │ │ ├── fixed_schedule.py │ │ ├── inverse_square_root_schedule.py │ │ ├── manual_lr_scheduler.py │ │ ├── pass_through.py │ │ ├── polynomial_decay_schedule.py │ │ ├── reduce_lr_on_plateau.py │ │ ├── tri_stage_lr_scheduler.py │ │ └── triangular_lr_scheduler.py │ ├── nag.py │ ├── sgd.py │ └── shard.py ├── options.py ├── pdb.py ├── quantization_utils.py ├── registry.py ├── scoring │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── bleu.cpython-36.pyc │ │ ├── chrf.cpython-36.pyc │ │ ├── tokenizer.cpython-36.pyc │ │ └── wer.cpython-36.pyc │ ├── bleu.py │ ├── chrf.py │ ├── tokenizer.py │ └── wer.py ├── search.py ├── sequence_generator.py ├── sequence_scorer.py ├── tasks │ ├── __init__.py │ ├── __pycache__ │ │ ├── __init__.cpython-36.pyc │ │ ├── audio_pretraining.cpython-36.pyc │ │ ├── cross_lingual_lm.cpython-36.pyc │ │ ├── denoising.cpython-36.pyc │ │ ├── fairseq_task.cpython-36.pyc │ │ ├── hubert_pretraining.cpython-36.pyc │ │ ├── language_modeling.cpython-36.pyc │ │ ├── legacy_masked_lm.cpython-36.pyc │ │ ├── masked_lm.cpython-36.pyc │ │ ├── multilingual_denoising.cpython-36.pyc │ │ ├── multilingual_masked_lm.cpython-36.pyc │ │ ├── multilingual_translation.cpython-36.pyc │ │ ├── online_backtranslation.cpython-36.pyc │ │ ├── semisupervised_translation.cpython-36.pyc │ │ ├── sentence_prediction.cpython-36.pyc │ │ ├── sentence_ranking.cpython-36.pyc │ │ ├── simultaneous_translation.cpython-36.pyc │ │ ├── speech_to_text.cpython-36.pyc │ │ ├── translation.cpython-36.pyc │ │ ├── translation_from_pretrained_bart.cpython-36.pyc │ │ ├── translation_from_pretrained_xlm.cpython-36.pyc │ │ ├── translation_lev.cpython-36.pyc │ │ └── translation_multi_simple_epoch.cpython-36.pyc │ ├── audio_pretraining.py │ ├── cross_lingual_lm.py │ ├── denoising.py │ ├── fairseq_task.py │ ├── hubert_pretraining.py │ ├── language_modeling.py │ ├── legacy_masked_lm.py │ ├── masked_lm.py │ ├── multilingual_denoising.py │ ├── multilingual_masked_lm.py │ ├── multilingual_translation.py │ ├── online_backtranslation.py │ ├── semisupervised_translation.py │ ├── sentence_prediction.py │ ├── sentence_ranking.py │ ├── simultaneous_translation.py │ ├── speech_to_text.py │ ├── translation.py │ ├── translation_from_pretrained_bart.py │ ├── translation_from_pretrained_xlm.py │ ├── translation_lev.py │ └── translation_multi_simple_epoch.py ├── token_generation_constraints.py ├── tokenizer.py ├── trainer.py ├── utils.py ├── version.py └── version.txt ├── fairseq_cli ├── __init__.py ├── __pycache__ │ ├── __init__.cpython-36.pyc │ ├── generate.cpython-36.pyc │ └── train.cpython-36.pyc ├── eval_lm.py ├── generate.py ├── hydra_train.py ├── interactive.py ├── preprocess.py ├── score.py ├── train.py └── validate.py ├── hubconf.py ├── pyproject.toml ├── scripts ├── __init__.py ├── average_checkpoints.py ├── build_sym_alignment.py ├── compare_namespaces.py ├── compound_split_bleu.sh ├── constraints │ ├── extract.py │ └── validate.py ├── convert_dictionary.lua ├── convert_model.lua ├── count_docs.py ├── read_binarized.py ├── rm_pt.py ├── sacrebleu.sh ├── shard_docs.py ├── split_train_valid_docs.py ├── spm_decode.py ├── spm_encode.py ├── spm_train.py └── test_fsdp.sh ├── setup.py ├── tests ├── __init__.py ├── distributed │ ├── __init__.py │ ├── test_bmuf.py │ ├── test_distributed_timeout_wrapper.py │ ├── test_module_proxy_wrapper.py │ ├── test_utils.py │ └── utils.py ├── gpu │ ├── __init__.py │ ├── test_binaries_gpu.py │ └── transformer_quantization_config.yaml ├── speech_recognition │ ├── __init__.py │ ├── asr_test_base.py │ ├── test_collaters.py │ ├── test_cross_entropy.py │ ├── test_data_utils.py │ └── test_vggtransformer.py ├── test_activation_checkpointing.py ├── test_amp_optimizer.py ├── test_average_checkpoints.py ├── test_backtranslation_dataset.py ├── test_binaries.py ├── test_character_token_embedder.py ├── test_checkpoint_utils.py ├── test_concat_dataset.py ├── test_constraints.py ├── test_convtbc.py ├── test_data_utils.py ├── test_dataset.py ├── test_dictionary.py ├── test_export.py ├── test_file_io.py ├── test_fp16_optimizer.py ├── test_inference_dropout.py ├── test_iopath.py ├── test_iterators.py ├── test_label_smoothing.py ├── test_lm_context_window.py ├── test_lstm_jitable.py ├── test_memory_efficient_fp16.py ├── test_metrics.py ├── test_multi_corpus_dataset.py ├── test_multi_corpus_sampled_dataset.py ├── test_multihead_attention.py ├── test_noising.py ├── test_online_backtranslation.py ├── test_plasma_utils.py ├── test_reproducibility.py ├── test_resampling_dataset.py ├── test_roberta.py ├── test_sequence_generator.py ├── test_sequence_scorer.py ├── test_sparse_multihead_attention.py ├── test_token_block_dataset.py ├── test_train.py ├── test_transformer.py ├── test_utils.py ├── test_valid_subset_checks.py └── utils.py └── train.py /build/lib.linux-x86_64-3.6/fairseq/data/data_utils_fast.cpython-36m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/build/lib.linux-x86_64-3.6/fairseq/data/data_utils_fast.cpython-36m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /build/lib.linux-x86_64-3.6/fairseq/data/token_block_utils_fast.cpython-36m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/build/lib.linux-x86_64-3.6/fairseq/data/token_block_utils_fast.cpython-36m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /build/lib.linux-x86_64-3.6/fairseq/libbase.cpython-36m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/build/lib.linux-x86_64-3.6/fairseq/libbase.cpython-36m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /build/lib.linux-x86_64-3.6/fairseq/libbleu.cpython-36m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/build/lib.linux-x86_64-3.6/fairseq/libbleu.cpython-36m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /build/lib.linux-x86_64-3.6/fairseq/libnat.cpython-36m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/build/lib.linux-x86_64-3.6/fairseq/libnat.cpython-36m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /build/temp.linux-x86_64-3.6/fairseq/clib/libbase/balanced_assignment.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/build/temp.linux-x86_64-3.6/fairseq/clib/libbase/balanced_assignment.o -------------------------------------------------------------------------------- /build/temp.linux-x86_64-3.6/fairseq/clib/libbleu/libbleu.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/build/temp.linux-x86_64-3.6/fairseq/clib/libbleu/libbleu.o -------------------------------------------------------------------------------- /build/temp.linux-x86_64-3.6/fairseq/clib/libbleu/module.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/build/temp.linux-x86_64-3.6/fairseq/clib/libbleu/module.o -------------------------------------------------------------------------------- /build/temp.linux-x86_64-3.6/fairseq/clib/libnat/edit_dist.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/build/temp.linux-x86_64-3.6/fairseq/clib/libnat/edit_dist.o -------------------------------------------------------------------------------- /build/temp.linux-x86_64-3.6/fairseq/data/data_utils_fast.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/build/temp.linux-x86_64-3.6/fairseq/data/data_utils_fast.o -------------------------------------------------------------------------------- /build/temp.linux-x86_64-3.6/fairseq/data/token_block_utils_fast.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/build/temp.linux-x86_64-3.6/fairseq/data/token_block_utils_fast.o -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = python -msphinx 7 | SPHINXPROJ = fairseq 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /docs/_static/theme_overrides.css: -------------------------------------------------------------------------------- 1 | .wy-table-responsive table td kbd { 2 | white-space: nowrap; 3 | } 4 | .wy-table-responsive table td { 5 | white-space: normal !important; 6 | } 7 | .wy-table-responsive { 8 | overflow: visible !important; 9 | } 10 | -------------------------------------------------------------------------------- /docs/criterions.rst: -------------------------------------------------------------------------------- 1 | .. role:: hidden 2 | :class: hidden-section 3 | 4 | .. _Criterions: 5 | 6 | Criterions 7 | ========== 8 | 9 | Criterions compute the loss function given the model and batch, roughly:: 10 | 11 | loss = criterion(model, batch) 12 | 13 | .. automodule:: fairseq.criterions 14 | :members: 15 | 16 | .. autoclass:: fairseq.criterions.FairseqCriterion 17 | :members: 18 | :undoc-members: 19 | 20 | .. autoclass:: fairseq.criterions.adaptive_loss.AdaptiveLoss 21 | :members: 22 | :undoc-members: 23 | .. autoclass:: fairseq.criterions.composite_loss.CompositeLoss 24 | :members: 25 | :undoc-members: 26 | .. autoclass:: fairseq.criterions.cross_entropy.CrossEntropyCriterion 27 | :members: 28 | :undoc-members: 29 | .. autoclass:: fairseq.criterions.label_smoothed_cross_entropy.LabelSmoothedCrossEntropyCriterion 30 | :members: 31 | :undoc-members: 32 | -------------------------------------------------------------------------------- /docs/docutils.conf: -------------------------------------------------------------------------------- 1 | [writers] 2 | option-limit=0 3 | -------------------------------------------------------------------------------- /docs/fairseq.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/docs/fairseq.gif -------------------------------------------------------------------------------- /docs/fairseq_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/docs/fairseq_logo.png -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=python -msphinx 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | set SPHINXPROJ=fairseq 13 | 14 | if "%1" == "" goto help 15 | 16 | %SPHINXBUILD% >NUL 2>NUL 17 | if errorlevel 9009 ( 18 | echo. 19 | echo.The Sphinx module was not found. Make sure you have Sphinx installed, 20 | echo.then set the SPHINXBUILD environment variable to point to the full 21 | echo.path of the 'sphinx-build' executable. Alternatively you may add the 22 | echo.Sphinx directory to PATH. 23 | echo. 24 | echo.If you don't have Sphinx installed, grab it from 25 | echo.http://sphinx-doc.org/ 26 | exit /b 1 27 | ) 28 | 29 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 30 | goto end 31 | 32 | :help 33 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 34 | 35 | :end 36 | popd 37 | -------------------------------------------------------------------------------- /docs/modules.rst: -------------------------------------------------------------------------------- 1 | Modules 2 | ======= 3 | 4 | Fairseq provides several stand-alone :class:`torch.nn.Module` classes that may 5 | be helpful when implementing a new :class:`~fairseq.models.BaseFairseqModel`. 6 | 7 | .. automodule:: fairseq.modules 8 | :members: 9 | :undoc-members: 10 | -------------------------------------------------------------------------------- /docs/optim.rst: -------------------------------------------------------------------------------- 1 | .. role:: hidden 2 | :class: hidden-section 3 | 4 | .. _optimizers: 5 | 6 | Optimizers 7 | ========== 8 | 9 | Optimizers update the Model parameters based on the gradients. 10 | 11 | .. automodule:: fairseq.optim 12 | :members: 13 | 14 | .. autoclass:: fairseq.optim.FairseqOptimizer 15 | :members: 16 | :undoc-members: 17 | 18 | .. autoclass:: fairseq.optim.adadelta.Adadelta 19 | :members: 20 | :undoc-members: 21 | .. autoclass:: fairseq.optim.adagrad.Adagrad 22 | :members: 23 | :undoc-members: 24 | .. autoclass:: fairseq.optim.adafactor.FairseqAdafactor 25 | :members: 26 | :undoc-members: 27 | .. autoclass:: fairseq.optim.adam.FairseqAdam 28 | :members: 29 | :undoc-members: 30 | .. autoclass:: fairseq.optim.fp16_optimizer.FP16Optimizer 31 | :members: 32 | :undoc-members: 33 | .. autoclass:: fairseq.optim.nag.FairseqNAG 34 | :members: 35 | :undoc-members: 36 | .. autoclass:: fairseq.optim.sgd.SGD 37 | :members: 38 | :undoc-members: 39 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx<2.0 2 | sphinx-argparse 3 | -------------------------------------------------------------------------------- /examples/.gitignore: -------------------------------------------------------------------------------- 1 | !*/*.sh 2 | !*/*.md 3 | -------------------------------------------------------------------------------- /examples/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | try: 7 | from fairseq.version import __version__ # noqa 8 | except ImportError: 9 | pass 10 | -------------------------------------------------------------------------------- /examples/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /examples/adaptive_span/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import importlib 7 | import os 8 | 9 | # automatically import any Python files in the current directory 10 | cur_dir = os.path.dirname(__file__) 11 | for file in os.listdir(cur_dir): 12 | path = os.path.join(cur_dir, file) 13 | if ( 14 | not file.startswith("_") 15 | and not file.startswith(".") 16 | and (file.endswith(".py") or os.path.isdir(path)) 17 | ): 18 | mod_name = file[: file.find(".py")] if file.endswith(".py") else file 19 | module = importlib.import_module(__name__ + "." + mod_name) 20 | -------------------------------------------------------------------------------- /examples/adaptive_span/truncated_bptt_lm_task.py: -------------------------------------------------------------------------------- 1 | ../truncated_bptt/truncated_bptt_lm_task.py -------------------------------------------------------------------------------- /examples/constrained_decoding/normalize.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # 5 | # This source code is licensed under the MIT license found in the 6 | # LICENSE file in the root directory of this source tree. 7 | 8 | import sys 9 | 10 | from sacremoses.normalize import MosesPunctNormalizer 11 | 12 | 13 | def main(args): 14 | normalizer = MosesPunctNormalizer(lang=args.lang, penn=args.penn) 15 | for line in sys.stdin: 16 | print(normalizer.normalize(line.rstrip()), flush=True) 17 | 18 | 19 | if __name__ == "__main__": 20 | import argparse 21 | 22 | parser = argparse.ArgumentParser() 23 | parser.add_argument("--lang", "-l", default="en") 24 | parser.add_argument("--penn", "-p", action="store_true") 25 | args = parser.parse_args() 26 | 27 | main(args) 28 | -------------------------------------------------------------------------------- /examples/fast_noisy_channel/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from . import noisy_channel_translation # noqa 7 | from . import noisy_channel_sequence_generator # noqa 8 | from . import noisy_channel_beam_search # noqa 9 | -------------------------------------------------------------------------------- /examples/flores101/flores_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/flores101/flores_logo.png -------------------------------------------------------------------------------- /examples/hubert/config/decode/infer_kenlm.yaml: -------------------------------------------------------------------------------- 1 | # @package _group_ 2 | 3 | defaults: 4 | - model: null 5 | 6 | hydra: 7 | run: 8 | dir: ${common_eval.results_path}/beam${decoding.decoder.beam}_lmw${decoding.decoder.lmweight}_wrd${decoding.decoder.wordscore}_sil${decoding.decoder.silweight} 9 | sweep: 10 | dir: ${common_eval.results_path} 11 | subdir: beam${decoding.decoder.beam}_th${decoding.decoder.beamthreshold}_lmw${decoding.decoder.lmweight}_wrd${decoding.decoder.wordscore}_sil${decoding.decoder.silweight} 12 | 13 | task: 14 | _name: hubert_pretraining 15 | single_target: true 16 | data: ??? 17 | normalize: ??? 18 | 19 | decoding: 20 | type: kenlm 21 | lexicon: ??? 22 | lmpath: ??? 23 | beamthreshold: 100 24 | beam: 500 25 | lmweight: 2 26 | wordscore: -1 27 | silweight: 0 28 | unique_wer_file: true 29 | beam: 500 30 | common_eval: 31 | results_path: ??? 32 | path: ??? 33 | post_process: letter 34 | dataset: 35 | max_tokens: 1100000 36 | gen_subset: ??? 37 | -------------------------------------------------------------------------------- /examples/hubert/config/decode/infer_viterbi.yaml: -------------------------------------------------------------------------------- 1 | # @package _group_ 2 | 3 | defaults: 4 | - model: null 5 | 6 | hydra: 7 | run: 8 | dir: ${common_eval.results_path}/beam${decoding.decoder.beam}_lmw${decoding.decoder.lmweight}_wrd${decoding.decoder.wordscore}_sil${decoding.decoder.silweight} 9 | sweep: 10 | dir: ${common_eval.results_path} 11 | subdir: beam${decoding.decoder.beam}_th${decoding.decoder.beamthreshold}_lmw${decoding.decoder.lmweight}_wrd${decoding.decoder.wordscore}_sil${decoding.decoder.silweight} 12 | 13 | task: 14 | _name: hubert_pretraining 15 | single_target: true 16 | data: ??? 17 | normalize: ??? 18 | 19 | decoding: 20 | type: viterbi 21 | unique_wer_file: true 22 | common_eval: 23 | results_path: ??? 24 | path: ??? 25 | post_process: letter 26 | generation: 27 | nbest: 1 28 | beam: 500 29 | dataset: 30 | max_tokens: 1100000 31 | gen_subset: ??? 32 | -------------------------------------------------------------------------------- /examples/hubert/config/decode/run/submitit_slurm.yaml: -------------------------------------------------------------------------------- 1 | # @package _global_ 2 | hydra: 3 | launcher: 4 | cpus_per_task: ${distributed_training.distributed_world_size} 5 | gpus_per_node: ${distributed_training.distributed_world_size} 6 | tasks_per_node: ${hydra.launcher.gpus_per_node} 7 | nodes: 1 8 | mem_gb: 200 9 | timeout_min: 4320 10 | max_num_timeout: 50 11 | name: ${hydra.job.config_name} 12 | submitit_folder: ${hydra.sweep.dir}/submitit 13 | 14 | distributed_training: 15 | distributed_world_size: 1 16 | distributed_no_spawn: true 17 | distributed_port: 29761 18 | -------------------------------------------------------------------------------- /examples/hubert/config/decode/run/submitit_slurm_8gpu.yaml: -------------------------------------------------------------------------------- 1 | # @package _global_ 2 | hydra: 3 | launcher: 4 | cpus_per_task: ${distributed_training.distributed_world_size} 5 | gpus_per_node: ${distributed_training.distributed_world_size} 6 | tasks_per_node: ${hydra.launcher.gpus_per_node} 7 | nodes: 1 8 | mem_gb: 200 9 | timeout_min: 4320 10 | max_num_timeout: 50 11 | name: ${hydra.job.config_name} 12 | submitit_folder: ${hydra.sweep.dir}/submitit 13 | 14 | distributed_training: 15 | distributed_world_size: 8 16 | distributed_no_spawn: true 17 | distributed_port: 29761 18 | -------------------------------------------------------------------------------- /examples/hubert/config/finetune/ckpt/it1.yaml: -------------------------------------------------------------------------------- 1 | # @package _global_ 2 | 3 | task: 4 | normalize: false 5 | 6 | model: 7 | w2v_path: /checkpoint/wnhsu/w2v/hubert_final/iter1/hubert.km.randcrop.pmw1_0.puw0_0.grpnorm.ml10.mp0_8.untie.mxsz250000.ufreq1.maxtok1400000.MU400k.s1337.ngpu32/checkpoint_last.pt 8 | -------------------------------------------------------------------------------- /examples/hubert/config/finetune/lm/ls_4gram.yaml: -------------------------------------------------------------------------------- 1 | # @package _global_ 2 | 3 | criterion: 4 | wer_kenlm_model: /checkpoint/abdo/old_checkpoint02/datasets/librispeech/4-gram.bin 5 | wer_lexicon: /checkpoint/abdo/old_checkpoint02/datasets/librispeech/10h/raw/lexicon_ltr.lst 6 | wer_lm_weight: 2.0 7 | wer_word_score: -1.0 8 | -------------------------------------------------------------------------------- /examples/hubert/config/finetune/run/submitit_reg.yaml: -------------------------------------------------------------------------------- 1 | # @package _global_ 2 | 3 | hydra: 4 | launcher: 5 | cpus_per_task: 8 6 | gpus_per_node: 8 7 | tasks_per_node: ${hydra.launcher.gpus_per_node} 8 | nodes: 1 9 | comment: null 10 | mem_gb: 384 11 | timeout_min: 4320 12 | max_num_timeout: 100 13 | constraint: volta32gb 14 | name: ${hydra.job.config_name}/${hydra.job.override_dirname} 15 | submitit_folder: ${hydra.sweep.dir}/submitit/%j 16 | 17 | distributed_training: 18 | distributed_world_size: 8 19 | distributed_port: 29671 20 | nprocs_per_node: 8 21 | -------------------------------------------------------------------------------- /examples/hubert/config/pretrain/data/iter1.yaml: -------------------------------------------------------------------------------- 1 | # @package _global_ 2 | 3 | task: 4 | label_dir: ??? 5 | labels: ["km"] 6 | 7 | model: 8 | label_rate: 100 9 | -------------------------------------------------------------------------------- /examples/hubert/config/pretrain/data/iter2.yaml: -------------------------------------------------------------------------------- 1 | # @package _global_ 2 | 3 | task: 4 | label_dir: ??? 5 | labels: ["km"] 6 | 7 | model: 8 | label_rate: 50 9 | -------------------------------------------------------------------------------- /examples/hubert/config/pretrain/run/submitit_reg.yaml: -------------------------------------------------------------------------------- 1 | # @package _global_ 2 | 3 | hydra: 4 | launcher: 5 | cpus_per_task: 8 6 | gpus_per_node: 8 7 | tasks_per_node: ${hydra.launcher.gpus_per_node} 8 | nodes: 4 9 | comment: null 10 | mem_gb: 384 11 | timeout_min: 4320 12 | max_num_timeout: 100 13 | constraint: volta32gb 14 | name: ${hydra.job.config_name}/${hydra.job.override_dirname} 15 | submitit_folder: ${hydra.sweep.dir}/submitit/%j 16 | 17 | distributed_training: 18 | distributed_world_size: 32 19 | distributed_port: 29671 20 | nprocs_per_node: 8 21 | -------------------------------------------------------------------------------- /examples/hubert/update_ckpt.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import torch 7 | 8 | src_ckpt = "/checkpoint/wnhsu/w2v/archived/hubert_base_ls960_it2.pt" 9 | ref_ckpt = "/checkpoint/wnhsu/w2v/hubert_icassp_oss_v3/iter2_km100-400k-grp-L6/oss.km500_p0_1_s334.pmw1_0.puw0_0.grpnorm.ml10.mp0_8.untie.mxsz250000.ufreq1.maxtok1400000.MU100k.s1337.ngpu32/checkpoint_last.pt" 10 | new_ckpt = "/checkpoint/wnhsu/w2v/archived/hubert_base_ls960_it2_updated.pt" 11 | 12 | 13 | def update_state(state): 14 | state["model"]["label_embs_concat"] = state["model"].pop("label_embs") 15 | state["args"].task = "hubert_pretraining" 16 | state["args"].labels = f"['{state['args'].labels}']" 17 | return state 18 | 19 | 20 | src_state = torch.load(src_ckpt) 21 | src_state = update_state(src_state) 22 | torch.save(src_state, new_ckpt) 23 | -------------------------------------------------------------------------------- /examples/language_model/prepare-wikitext-103.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Adapted from https://github.com/facebookresearch/MIXER/blob/master/prepareData.sh 3 | 4 | URLS=( 5 | "https://s3.amazonaws.com/research.metamind.io/wikitext/wikitext-103-v1.zip" 6 | ) 7 | FILES=( 8 | "wikitext-103-v1.zip" 9 | ) 10 | 11 | for ((i=0;i<${#URLS[@]};++i)); do 12 | file=${FILES[i]} 13 | if [ -f $file ]; then 14 | echo "$file already exists, skipping download" 15 | else 16 | url=${URLS[i]} 17 | wget "$url" 18 | if [ -f $file ]; then 19 | echo "$url successfully downloaded." 20 | else 21 | echo "$url not successfully downloaded." 22 | exit -1 23 | fi 24 | if [ ${file: -4} == ".tgz" ]; then 25 | tar zxvf $file 26 | elif [ ${file: -4} == ".tar" ]; then 27 | tar xvf $file 28 | elif [ ${file: -4} == ".zip" ]; then 29 | unzip $file 30 | fi 31 | fi 32 | done 33 | cd .. 34 | -------------------------------------------------------------------------------- /examples/laser/laser_src/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .laser_task import * # noqa 7 | from .laser_lstm import * # noqa 8 | from .laser_transformer import * # noqa 9 | -------------------------------------------------------------------------------- /examples/latent_depth/latent_depth_src/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from . import multilingual_translation_latent_depth # noqa 7 | from .loss import latent_depth # noqa 8 | from .models import latent_multilingual_transformer # noqa 9 | from .modules import latent_layers # noqa 10 | -------------------------------------------------------------------------------- /examples/latent_depth/latent_depth_src/loss/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/latent_depth/latent_depth_src/loss/__init__.py -------------------------------------------------------------------------------- /examples/latent_depth/latent_depth_src/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/latent_depth/latent_depth_src/models/__init__.py -------------------------------------------------------------------------------- /examples/latent_depth/latent_depth_src/modules/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/latent_depth/latent_depth_src/modules/__init__.py -------------------------------------------------------------------------------- /examples/linformer/README.md: -------------------------------------------------------------------------------- 1 | # Linformer: Self-Attention with Linear Complexity (Wang et al., 2020) 2 | 3 | This example contains code to train Linformer models as described in our paper 4 | [Linformer: Self-Attention with Linear Complexity](https://arxiv.org/abs/2006.04768). 5 | 6 | ## Training a new Linformer RoBERTa model 7 | 8 | You can mostly follow the [RoBERTa pretraining README](/examples/roberta/README.pretraining.md), 9 | updating your training command with `--user-dir examples/linformer/linformer_src --arch linformer_roberta_base`. 10 | 11 | ## Citation 12 | 13 | If you use our work, please cite: 14 | 15 | ```bibtex 16 | @article{wang2020linformer, 17 | title={Linformer: Self-Attention with Linear Complexity}, 18 | author={Wang, Sinong and Li, Belinda and Khabsa, Madian and Fang, Han and Ma, Hao}, 19 | journal={arXiv preprint arXiv:2006.04768}, 20 | year={2020} 21 | } 22 | ``` 23 | -------------------------------------------------------------------------------- /examples/linformer/linformer_src/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .models import linformer_roberta # noqa 7 | -------------------------------------------------------------------------------- /examples/linformer/linformer_src/models/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/linformer/linformer_src/models/__init__.py -------------------------------------------------------------------------------- /examples/linformer/linformer_src/modules/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/linformer/linformer_src/modules/__init__.py -------------------------------------------------------------------------------- /examples/m2m_100/tokenizers/README.md: -------------------------------------------------------------------------------- 1 | # M2M-100 Tokenization 2 | 3 | We apply different tokenization strategies for different languages following the existing literature. Here we provide tok.sh a tokenizer that can be used to reproduce our results. 4 | 5 | To reproduce the results, follow these steps: 6 | 7 | ``` 8 | tgt_lang=... 9 | reference_translation=... 10 | cat generation_output | grep -P "^H" | sort -V | cut -f 3- | sh tok.sh $tgt_lang > hyp 11 | cat $reference_translation |sh tok.sh $tgt_lang > ref 12 | sacrebleu -tok 'none' ref < hyp 13 | ``` 14 | 15 | ## Installation 16 | 17 | Tools needed for all the languages except Arabic can be installed by running install_dependencies.sh 18 | If you want to evaluate Arabic models, please follow the instructions provided here: http://alt.qcri.org/tools/arabic-normalizer/ to install 19 | -------------------------------------------------------------------------------- /examples/m2m_100/tokenizers/seg_ja.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | SCRIPT=`realpath $0` 7 | KYTEA=`dirname $SCRIPT`/thirdparty/kytea 8 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$KYTEA/lib:/usr/local/lib 9 | export PATH=$PATH:"$KYTEA/bin" 10 | 11 | cat - | tr -d "[:blank:]" | kytea -notags 12 | -------------------------------------------------------------------------------- /examples/m2m_100/tokenizers/seg_ko.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | SCRIPT=`realpath $0` 7 | MECAB=`dirname $SCRIPT`/thirdparty/mecab-0.996-ko-0.9.2 8 | 9 | export PATH=$PATH:"$MECAB/bin":"$MECAB/lib" 10 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$MECAB/lib" 11 | 12 | cat - | mecab -O wakati 13 | -------------------------------------------------------------------------------- /examples/m2m_100/tokenizers/thirdparty/.gitignore: -------------------------------------------------------------------------------- 1 | seg_my.py 2 | indic_nlp_library/ 3 | indic_nlp_resources/ 4 | kytea/ 5 | mecab-0.996-ko-0.9.2.tar.gz 6 | mecab-0.996-ko-0.9.2/ 7 | mosesdecoder/ 8 | wat2020.my-en.zip 9 | wat2020.my-en/ 10 | wmt16-scripts/ 11 | mecab-ko-dic-2.1.1-20180720/ 12 | mecab-ko-dic-2.1.1-20180720.tar.gz -------------------------------------------------------------------------------- /examples/m2m_100/tokenizers/tokenize_indic.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | # Use: echo {text} | python tokenize_indic.py {language} 8 | 9 | import sys 10 | 11 | from indicnlp.normalize.indic_normalize import IndicNormalizerFactory 12 | from indicnlp.tokenize.indic_tokenize import trivial_tokenize 13 | 14 | 15 | factory = IndicNormalizerFactory() 16 | normalizer = factory.get_normalizer( 17 | sys.argv[1], remove_nuktas=False, nasals_mode="do_nothing" 18 | ) 19 | 20 | for line in sys.stdin: 21 | normalized_line = normalizer.normalize(line.strip()) 22 | tokenized_line = " ".join(trivial_tokenize(normalized_line, sys.argv[1])) 23 | print(tokenized_line) 24 | -------------------------------------------------------------------------------- /examples/m2m_100/tokenizers/tokenize_thai.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import sys 8 | 9 | from pythainlp import word_tokenize 10 | 11 | 12 | for line in sys.stdin: 13 | print(" ".join(word_tokenize(line.strip()))) 14 | -------------------------------------------------------------------------------- /examples/m2m_100/tokenizers/tokenize_zh.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | 8 | import fileinput 9 | 10 | import sacrebleu 11 | 12 | 13 | for line in fileinput.input(): 14 | print(sacrebleu.tokenize_zh(line)) 15 | -------------------------------------------------------------------------------- /examples/m2m_100/tokenizers/tokenizer_ar.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | # 7 | # Please follow the instructions here http://alt.qcri.org/tools/arabic-normalizer/ 8 | # to install tools needed for Arabic 9 | 10 | echo "Please install Arabic tools: http://alt.qcri.org/tools/arabic-normalizer/" 11 | echo "Then update environment variables in tokenizer_ar.sh" 12 | exit 1 13 | 14 | SVMTOOL=... 15 | GOMOSESGO=... 16 | QCRI_ARABIC_NORMALIZER=... 17 | 18 | export PERL5LIB="$SVMTOOL/lib":"$GOMOSESGO/bin/MADA-3.2":$PERL5LIB 19 | 20 | 21 | tempfile=$(mktemp) 22 | cat - > $tempfile 23 | 24 | cd $QCRI_ARABIC_NORMALIZER 25 | 26 | bash qcri_normalizer_mada3.2_aramorph1.2.1.sh $tempfile 27 | cat $tempfile.mada_norm-aramorph.europarl_tok 28 | -------------------------------------------------------------------------------- /examples/megatron_11b/detok.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 -u 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | import argparse 8 | import fileinput 9 | 10 | import sacremoses 11 | 12 | 13 | def main(): 14 | parser = argparse.ArgumentParser(description="") 15 | parser.add_argument("files", nargs="*", help="input files") 16 | args = parser.parse_args() 17 | 18 | detok = sacremoses.MosesDetokenizer() 19 | 20 | for line in fileinput.input(args.files, openhook=fileinput.hook_compressed): 21 | print( 22 | detok.detokenize(line.strip().split(" ")) 23 | .replace(" @", "") 24 | .replace("@ ", "") 25 | .replace(" =", "=") 26 | .replace("= ", "=") 27 | .replace(" – ", "–") 28 | ) 29 | 30 | 31 | if __name__ == "__main__": 32 | main() 33 | -------------------------------------------------------------------------------- /examples/multilingual/ML50_langs.txt: -------------------------------------------------------------------------------- 1 | ar_AR 2 | cs_CZ 3 | de_DE 4 | en_XX 5 | es_XX 6 | et_EE 7 | fi_FI 8 | fr_XX 9 | gu_IN 10 | hi_IN 11 | it_IT 12 | ja_XX 13 | kk_KZ 14 | ko_KR 15 | lt_LT 16 | lv_LV 17 | my_MM 18 | ne_NP 19 | nl_XX 20 | ro_RO 21 | ru_RU 22 | si_LK 23 | tr_TR 24 | vi_VN 25 | zh_CN 26 | af_ZA 27 | az_AZ 28 | bn_IN 29 | fa_IR 30 | he_IL 31 | hr_HR 32 | id_ID 33 | ka_GE 34 | km_KH 35 | mk_MK 36 | ml_IN 37 | mn_MN 38 | mr_IN 39 | pl_PL 40 | ps_AF 41 | pt_XX 42 | sv_SE 43 | sw_KE 44 | ta_IN 45 | te_IN 46 | th_TH 47 | tl_XX 48 | uk_UA 49 | ur_PK 50 | xh_ZA 51 | gl_ES 52 | sl_SI -------------------------------------------------------------------------------- /examples/multilingual/data_scripts/README.md: -------------------------------------------------------------------------------- 1 | 2 | # Install dependency 3 | ```bash 4 | pip install -r requirement.txt 5 | ``` 6 | 7 | # Download the data set 8 | ```bash 9 | export WORKDIR_ROOT= 10 | 11 | ``` 12 | The downloaded data will be at $WORKDIR_ROOT/ML50 13 | 14 | # preprocess the data 15 | Install SPM [here](https://github.com/google/sentencepiece) 16 | ```bash 17 | export WORKDIR_ROOT= 18 | export SPM_PATH= 19 | ``` 20 | * $WORKDIR_ROOT/ML50/raw: extracted raw data 21 | * $WORKDIR_ROOT/ML50/dedup: dedup data 22 | * $WORKDIR_ROOT/ML50/clean: data with valid and test sentences removed from the dedup data 23 | 24 | 25 | -------------------------------------------------------------------------------- /examples/multilingual/data_scripts/preprocess_ML50_v1.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # All rights reserved. 4 | # 5 | # This source code is licensed under the license found in the 6 | # LICENSE file in the root directory of this source tree. 7 | 8 | if [ -z $WORKDIR_ROOT ] ; 9 | then 10 | echo "please specify your working directory root in environment variable WORKDIR_ROOT. Exitting..." 11 | exit 12 | fi 13 | 14 | if [ -z $SPM_PATH ] ; 15 | then 16 | echo "Please install sentence piecence from https://github.com/google/sentencepiece and set SPM_PATH pointing to the installed spm_encode.py. Exitting..." 17 | exit 18 | fi 19 | 20 | ML50=${WORKDIR_ROOT}/ML50 21 | 22 | mkdir -p $ML50/dedup 23 | mkdir -p $ML50/cleaned_dedup 24 | 25 | python ./dedup_all.py --from-folder $ML50/raw --to-folder $ML50/dedup 26 | python ./remove_valid_test_in_train.py --from-folder $ML50/dedup --to-folder $ML50/clean 27 | python ./binarize.py --raw-folder $ML50/clean -------------------------------------------------------------------------------- /examples/multilingual/data_scripts/requirement.txt: -------------------------------------------------------------------------------- 1 | wget 2 | pandas -------------------------------------------------------------------------------- /examples/multilingual/data_scripts/utils/strip_sgm.sh: -------------------------------------------------------------------------------- 1 | grep "seg id" | sed 's///g' | sed 's/<\/seg>//g' 2 | -------------------------------------------------------------------------------- /examples/multilingual/multilingual_fairseq_gen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # All rights reserved. 4 | # 5 | # This source code is licensed under the license found in the 6 | # LICENSE file in the root directory of this source tree. 7 | 8 | lang_pairs="en-fr,en-cs,fr-en,cs-en" 9 | path_2_data=$1 # 10 | lang_list=$2 # 11 | model=$3 # 12 | source_lang=cs 13 | target_lang=en 14 | 15 | fairseq-generate "$path_2_data" \ 16 | --path "$model" \ 17 | --task translation_multi_simple_epoch \ 18 | --gen-subset test \ 19 | --source-lang "$source_lang" \ 20 | --target-lang "$target_lang" \ 21 | --sacrebleu --remove-bpe 'sentencepiece'\ 22 | --batch-size 32 \ 23 | --encoder-langtok "src" \ 24 | --decoder-langtok \ 25 | --lang-dict "$lang_list" \ 26 | --lang-pairs "$lang_pairs" 27 | -------------------------------------------------------------------------------- /examples/noisychannel/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .rerank_options import * # noqa 7 | -------------------------------------------------------------------------------- /examples/pointer_generator/pointer_generator_src/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from . import transformer_pg # noqa 7 | -------------------------------------------------------------------------------- /examples/roberta/__pycache__/multiprocessing_bpe_encoder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/roberta/__pycache__/multiprocessing_bpe_encoder.cpython-36.pyc -------------------------------------------------------------------------------- /examples/roberta/commonsense_qa/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from . import commonsense_qa_task # noqa 7 | -------------------------------------------------------------------------------- /examples/roberta/commonsense_qa/download_cqa_data.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | OUTDIR=data/CommonsenseQA 8 | 9 | mkdir -p $OUTDIR 10 | 11 | wget -O $OUTDIR/train.jsonl https://s3.amazonaws.com/commensenseqa/train_rand_split.jsonl 12 | wget -O $OUTDIR/valid.jsonl https://s3.amazonaws.com/commensenseqa/dev_rand_split.jsonl 13 | wget -O $OUTDIR/test.jsonl https://s3.amazonaws.com/commensenseqa/test_rand_split_no_answers.jsonl 14 | wget -O $OUTDIR/dict.txt https://dl.fbaipublicfiles.com/fairseq/gpt2_bpe/dict.txt 15 | -------------------------------------------------------------------------------- /examples/roberta/wsc/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from . import wsc_criterion # noqa 7 | from . import wsc_task # noqa 8 | -------------------------------------------------------------------------------- /examples/rxf/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from . import rxf_src # noqa 7 | -------------------------------------------------------------------------------- /examples/rxf/rxf_src/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from . import label_smoothed_cross_entropy_r3f, sentence_prediction_r3f # noqa 7 | -------------------------------------------------------------------------------- /examples/simultaneous_translation/README.md: -------------------------------------------------------------------------------- 1 | # Simultaneous Translation 2 | Examples of simultaneous translation in fairseq 3 | - [English-to-Japanese text-to-text wait-k model](docs/enja-waitk.md) 4 | - [English-to-Germen text-to-text monotonic multihead attention model](docs/ende-mma.md) 5 | - [English-to-Germen speech-to-text simultaneous translation model](../speech_to_text/docs/simulst_mustc_example.md) 6 | -------------------------------------------------------------------------------- /examples/simultaneous_translation/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from . import models # noqa 7 | -------------------------------------------------------------------------------- /examples/simultaneous_translation/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/simultaneous_translation/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /examples/simultaneous_translation/models/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import importlib 7 | import os 8 | 9 | 10 | for file in sorted(os.listdir(os.path.dirname(__file__))): 11 | if file.endswith(".py") and not file.startswith("_"): 12 | model_name = file[: file.find(".py")] 13 | importlib.import_module( 14 | "examples.simultaneous_translation.models." + model_name 15 | ) 16 | -------------------------------------------------------------------------------- /examples/simultaneous_translation/models/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/simultaneous_translation/models/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /examples/simultaneous_translation/models/__pycache__/convtransformer_simul_trans.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/simultaneous_translation/models/__pycache__/convtransformer_simul_trans.cpython-36.pyc -------------------------------------------------------------------------------- /examples/simultaneous_translation/models/__pycache__/transformer_monotonic_attention.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/simultaneous_translation/models/__pycache__/transformer_monotonic_attention.cpython-36.pyc -------------------------------------------------------------------------------- /examples/simultaneous_translation/modules/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import importlib 7 | import os 8 | 9 | from fairseq import registry 10 | 11 | 12 | ( 13 | build_monotonic_attention, 14 | register_monotonic_attention, 15 | MONOTONIC_ATTENTION_REGISTRY, 16 | _, 17 | ) = registry.setup_registry("--simul-type") 18 | 19 | for file in sorted(os.listdir(os.path.dirname(__file__))): 20 | if file.endswith(".py") and not file.startswith("_"): 21 | model_name = file[: file.find(".py")] 22 | importlib.import_module( 23 | "examples.simultaneous_translation.modules." + model_name 24 | ) 25 | -------------------------------------------------------------------------------- /examples/simultaneous_translation/modules/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/simultaneous_translation/modules/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /examples/simultaneous_translation/modules/__pycache__/fixed_pre_decision.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/simultaneous_translation/modules/__pycache__/fixed_pre_decision.cpython-36.pyc -------------------------------------------------------------------------------- /examples/simultaneous_translation/modules/__pycache__/monotonic_multihead_attention.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/simultaneous_translation/modules/__pycache__/monotonic_multihead_attention.cpython-36.pyc -------------------------------------------------------------------------------- /examples/simultaneous_translation/modules/__pycache__/monotonic_transformer_layer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/simultaneous_translation/modules/__pycache__/monotonic_transformer_layer.cpython-36.pyc -------------------------------------------------------------------------------- /examples/simultaneous_translation/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import importlib 7 | import os 8 | 9 | 10 | # automatically import any Python files in the criterions/ directory 11 | for file in sorted(os.listdir(os.path.dirname(__file__))): 12 | if file.endswith(".py") and not file.startswith("_"): 13 | module = file[: file.find(".py")] 14 | importlib.import_module("examples.simultaneous_translation.utils." + module) 15 | -------------------------------------------------------------------------------- /examples/simultaneous_translation/utils/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/simultaneous_translation/utils/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /examples/simultaneous_translation/utils/__pycache__/data_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/simultaneous_translation/utils/__pycache__/data_utils.cpython-36.pyc -------------------------------------------------------------------------------- /examples/simultaneous_translation/utils/__pycache__/functions.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/simultaneous_translation/utils/__pycache__/functions.cpython-36.pyc -------------------------------------------------------------------------------- /examples/simultaneous_translation/utils/__pycache__/latency.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/simultaneous_translation/utils/__pycache__/latency.cpython-36.pyc -------------------------------------------------------------------------------- /examples/simultaneous_translation/utils/__pycache__/p_choose_strategy.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/simultaneous_translation/utils/__pycache__/p_choose_strategy.cpython-36.pyc -------------------------------------------------------------------------------- /examples/speech_recognition/__init__.py: -------------------------------------------------------------------------------- 1 | from . import criterions, models, tasks # noqa 2 | -------------------------------------------------------------------------------- /examples/speech_recognition/criterions/__init__.py: -------------------------------------------------------------------------------- 1 | import importlib 2 | import os 3 | 4 | 5 | # ASG loss requires flashlight bindings 6 | files_to_skip = set() 7 | try: 8 | import flashlight.lib.sequence.criterion 9 | except ImportError: 10 | files_to_skip.add("ASG_loss.py") 11 | 12 | for file in sorted(os.listdir(os.path.dirname(__file__))): 13 | if file.endswith(".py") and not file.startswith("_") and file not in files_to_skip: 14 | criterion_name = file[: file.find(".py")] 15 | importlib.import_module( 16 | "examples.speech_recognition.criterions." + criterion_name 17 | ) 18 | -------------------------------------------------------------------------------- /examples/speech_recognition/data/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .asr_dataset import AsrDataset 7 | 8 | 9 | __all__ = [ 10 | "AsrDataset", 11 | ] 12 | -------------------------------------------------------------------------------- /examples/speech_recognition/kaldi/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/speech_recognition/kaldi/__init__.py -------------------------------------------------------------------------------- /examples/speech_recognition/kaldi/config/kaldi_initializer.yaml: -------------------------------------------------------------------------------- 1 | # @package _group_ 2 | 3 | data_dir: ??? 4 | fst_dir: ??? 5 | in_labels: ??? 6 | kaldi_root: ??? 7 | lm_arpa: ??? 8 | blank_symbol: 9 | -------------------------------------------------------------------------------- /examples/speech_recognition/models/__init__.py: -------------------------------------------------------------------------------- 1 | import importlib 2 | import os 3 | 4 | 5 | for file in sorted(os.listdir(os.path.dirname(__file__))): 6 | if file.endswith(".py") and not file.startswith("_"): 7 | model_name = file[: file.find(".py")] 8 | importlib.import_module("examples.speech_recognition.models." + model_name) 9 | -------------------------------------------------------------------------------- /examples/speech_recognition/new/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/speech_recognition/new/__init__.py -------------------------------------------------------------------------------- /examples/speech_recognition/new/conf/hydra/sweeper/ax.yaml: -------------------------------------------------------------------------------- 1 | # @package hydra.sweeper 2 | _target_: hydra_plugins.hydra_ax_sweeper.ax_sweeper.AxSweeper 3 | max_batch_size: null 4 | ax_config: 5 | max_trials: 128 6 | early_stop: 7 | minimize: true 8 | max_epochs_without_improvement: 32 9 | epsilon: 1.0e-05 10 | experiment: 11 | name: ${dataset.gen_subset} 12 | objective_name: wer 13 | minimize: true 14 | parameter_constraints: null 15 | outcome_constraints: null 16 | status_quo: null 17 | client: 18 | verbose_logging: false 19 | random_seed: null 20 | params: 21 | decoding.lmweight: 22 | type: range 23 | bounds: [0.0, 5.0] 24 | decoding.wordscore: 25 | type: range 26 | bounds: [-5.0, 5.0] 27 | -------------------------------------------------------------------------------- /examples/speech_recognition/new/conf/infer.yaml: -------------------------------------------------------------------------------- 1 | # @package _group_ 2 | 3 | defaults: 4 | - task: null 5 | - model: null 6 | 7 | hydra: 8 | run: 9 | dir: ${common_eval.results_path}/${dataset.gen_subset} 10 | sweep: 11 | dir: ${common_eval.results_path} 12 | subdir: ${dataset.gen_subset} 13 | common_eval: 14 | results_path: null 15 | path: null 16 | post_process: letter 17 | quiet: true 18 | dataset: 19 | max_tokens: 1000000 20 | gen_subset: test 21 | distributed_training: 22 | distributed_world_size: 1 23 | decoding: 24 | beam: 5 25 | type: viterbi 26 | -------------------------------------------------------------------------------- /examples/speech_recognition/new/decoders/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/examples/speech_recognition/new/decoders/__init__.py -------------------------------------------------------------------------------- /examples/speech_recognition/new/decoders/viterbi_decoder.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) Facebook, Inc. and its affiliates. 4 | # 5 | # This source code is licensed under the MIT license found in the 6 | # LICENSE file in the root directory of this source tree. 7 | 8 | import torch 9 | 10 | from typing import List, Dict 11 | 12 | from .base_decoder import BaseDecoder 13 | 14 | 15 | class ViterbiDecoder(BaseDecoder): 16 | def decode( 17 | self, 18 | emissions: torch.FloatTensor, 19 | ) -> List[List[Dict[str, torch.LongTensor]]]: 20 | def get_pred(e): 21 | toks = e.argmax(dim=-1).unique_consecutive() 22 | return toks[toks != self.blank] 23 | 24 | return [[{"tokens": get_pred(x), "score": 0}] for x in emissions] 25 | -------------------------------------------------------------------------------- /examples/speech_recognition/tasks/__init__.py: -------------------------------------------------------------------------------- 1 | import importlib 2 | import os 3 | 4 | 5 | for file in sorted(os.listdir(os.path.dirname(__file__))): 6 | if file.endswith(".py") and not file.startswith("_"): 7 | task_name = file[: file.find(".py")] 8 | importlib.import_module("examples.speech_recognition.tasks." + task_name) 9 | -------------------------------------------------------------------------------- /examples/translation_moe/translation_moe_src/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from . import translation_moe # noqa 7 | -------------------------------------------------------------------------------- /examples/translation_moe/translation_moe_src/logsumexp_moe.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import torch 7 | 8 | 9 | class LogSumExpMoE(torch.autograd.Function): 10 | """Standard LogSumExp forward pass, but use *posterior* for the backward. 11 | 12 | See `"Mixture Models for Diverse Machine Translation: Tricks of the Trade" 13 | (Shen et al., 2019) `_. 14 | """ 15 | 16 | @staticmethod 17 | def forward(ctx, logp, posterior, dim=-1): 18 | ctx.save_for_backward(posterior) 19 | ctx.dim = dim 20 | return torch.logsumexp(logp, dim=dim) 21 | 22 | @staticmethod 23 | def backward(ctx, grad_output): 24 | (posterior,) = ctx.saved_tensors 25 | grad_logp = grad_output.unsqueeze(ctx.dim) * posterior 26 | return grad_logp, None, None 27 | -------------------------------------------------------------------------------- /examples/truncated_bptt/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from . import transformer_xl_model, truncated_bptt_lm_task # noqa 7 | -------------------------------------------------------------------------------- /examples/unsupervised_quality_estimation/repeat_lines.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import argparse 7 | import sys 8 | 9 | 10 | def _normalize_spaces(line): 11 | return " ".join(line.split()) 12 | 13 | 14 | def main(): 15 | parser = argparse.ArgumentParser() 16 | parser.add_argument("-i", "--input_file", required=True, type=str) 17 | parser.add_argument("-n", "--repeat_times", required=True, type=int) 18 | parser.add_argument("-o", "--output_file", required=False, type=str) 19 | args = parser.parse_args() 20 | stream = open(args.output_file, "w") if args.output_file else sys.stdout 21 | 22 | for line in open(args.input_file): 23 | for _ in range(args.repeat_times): 24 | stream.write(_normalize_spaces(line) + "\n") 25 | 26 | 27 | if __name__ == "__main__": 28 | main() 29 | -------------------------------------------------------------------------------- /fairseq.egg-info/dependency_links.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fairseq.egg-info/entry_points.txt: -------------------------------------------------------------------------------- 1 | [console_scripts] 2 | fairseq-eval-lm = fairseq_cli.eval_lm:cli_main 3 | fairseq-generate = fairseq_cli.generate:cli_main 4 | fairseq-hydra-train = fairseq_cli.hydra_train:cli_main 5 | fairseq-interactive = fairseq_cli.interactive:cli_main 6 | fairseq-preprocess = fairseq_cli.preprocess:cli_main 7 | fairseq-score = fairseq_cli.score:cli_main 8 | fairseq-train = fairseq_cli.train:cli_main 9 | fairseq-validate = fairseq_cli.validate:cli_main 10 | 11 | -------------------------------------------------------------------------------- /fairseq.egg-info/not-zip-safe: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /fairseq.egg-info/requires.txt: -------------------------------------------------------------------------------- 1 | cffi 2 | cython 3 | hydra-core<1.1 4 | omegaconf<2.1 5 | regex 6 | sacrebleu>=1.4.12 7 | torch 8 | tqdm 9 | 10 | [:python_version < "3.7"] 11 | dataclasses 12 | numpy<1.20.0 13 | 14 | [:python_version >= "3.7"] 15 | numpy 16 | -------------------------------------------------------------------------------- /fairseq.egg-info/top_level.txt: -------------------------------------------------------------------------------- 1 | fairseq 2 | fairseq_cli 3 | -------------------------------------------------------------------------------- /fairseq/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/binarizer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/binarizer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/checkpoint_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/checkpoint_utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/file_io.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/file_io.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/file_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/file_utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/hub_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/hub_utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/incremental_decoding_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/incremental_decoding_utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/iterative_refinement_generator.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/iterative_refinement_generator.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/nan_detector.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/nan_detector.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/ngram_repeat_block.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/ngram_repeat_block.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/options.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/options.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/pdb.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/pdb.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/quantization_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/quantization_utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/registry.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/registry.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/search.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/search.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/sequence_generator.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/sequence_generator.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/sequence_scorer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/sequence_scorer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/token_generation_constraints.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/token_generation_constraints.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/tokenizer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/tokenizer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/trainer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/trainer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/__pycache__/version.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/__pycache__/version.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/benchmark/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | # import models/tasks to register them 7 | from . import dummy_dataset, dummy_lm, dummy_masked_lm, dummy_model, dummy_mt # noqa 8 | -------------------------------------------------------------------------------- /fairseq/benchmark/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/benchmark/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/benchmark/__pycache__/dummy_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/benchmark/__pycache__/dummy_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/benchmark/__pycache__/dummy_lm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/benchmark/__pycache__/dummy_lm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/benchmark/__pycache__/dummy_masked_lm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/benchmark/__pycache__/dummy_masked_lm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/benchmark/__pycache__/dummy_model.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/benchmark/__pycache__/dummy_model.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/benchmark/__pycache__/dummy_mt.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/benchmark/__pycache__/dummy_mt.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/benchmark/dummy_dataset.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | from fairseq.data import FairseqDataset 3 | 4 | 5 | class DummyDataset(FairseqDataset): 6 | def __init__(self, batch, num_items, item_size): 7 | super().__init__() 8 | self.batch = batch 9 | self.num_items = num_items 10 | self.item_size = item_size 11 | 12 | def __getitem__(self, index): 13 | return index 14 | 15 | def __len__(self): 16 | return self.num_items 17 | 18 | def collater(self, samples): 19 | return self.batch 20 | 21 | @property 22 | def sizes(self): 23 | return np.array([self.item_size] * self.num_items) 24 | 25 | def num_tokens(self, index): 26 | return self.item_size 27 | 28 | def size(self, index): 29 | return self.item_size 30 | 31 | def ordered_indices(self): 32 | return np.arange(self.num_items) 33 | 34 | @property 35 | def supports_prefetch(self): 36 | return False 37 | -------------------------------------------------------------------------------- /fairseq/clib/libbleu/module.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | #include 10 | 11 | 12 | static PyMethodDef method_def[] = { 13 | {NULL, NULL, 0, NULL} 14 | }; 15 | 16 | static struct PyModuleDef module_def = { 17 | PyModuleDef_HEAD_INIT, 18 | "libbleu", /* name of module */ 19 | NULL, /* module documentation, may be NULL */ 20 | -1, /* size of per-interpreter state of the module, 21 | or -1 if the module keeps state in global variables. */ 22 | method_def 23 | }; 24 | 25 | 26 | #if PY_MAJOR_VERSION == 2 27 | PyMODINIT_FUNC init_libbleu() 28 | #else 29 | PyMODINIT_FUNC PyInit_libbleu() 30 | #endif 31 | { 32 | PyObject *m = PyModule_Create(&module_def); 33 | if (!m) { 34 | return NULL; 35 | } 36 | return m; 37 | } 38 | -------------------------------------------------------------------------------- /fairseq/clib/libnat_cuda/edit_dist.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2017-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the license found in the 6 | * LICENSE file in the root directory of this source tree. 7 | */ 8 | 9 | #pragma once 10 | 11 | #include 12 | 13 | torch::Tensor LevenshteinDistanceCuda( 14 | torch::Tensor source, 15 | torch::Tensor target, 16 | torch::Tensor source_length, 17 | torch::Tensor target_length); 18 | 19 | torch::Tensor GenerateDeletionLabelCuda( 20 | torch::Tensor source, 21 | torch::Tensor operations); 22 | 23 | std::pair GenerateInsertionLabelCuda( 24 | torch::Tensor source, 25 | torch::Tensor operations); 26 | -------------------------------------------------------------------------------- /fairseq/config/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | -------------------------------------------------------------------------------- /fairseq/config/config.yaml: -------------------------------------------------------------------------------- 1 | # @package _group_ 2 | 3 | hydra: 4 | run: 5 | dir: . 6 | 7 | defaults: 8 | - task: null 9 | - model: null 10 | - criterion: cross_entropy 11 | - optimizer: null 12 | - lr_scheduler: fixed 13 | - bpe: null 14 | - tokenizer: null 15 | - scoring: null 16 | - generation: null 17 | - common_eval: null 18 | - eval_lm: null 19 | -------------------------------------------------------------------------------- /fairseq/config/optim/composite_small.yaml: -------------------------------------------------------------------------------- 1 | optimizer: 2 | _name: composite 3 | groups: 4 | default: 5 | lr: [0.0006] 6 | optimizer: 7 | _name: adam 8 | adam_betas: [0.9, 0.98] 9 | lr_scheduler: 10 | _name: polynomial_decay 11 | total_num_update: 20000 12 | warmup_updates: 1000 13 | finetuning: 14 | lr: [0.00006] 15 | optimizer: 16 | _name: adam 17 | adam_betas: [0.9, 0.98] 18 | lr_scheduler: 19 | _name: polynomial_decay 20 | total_num_update: 20000 21 | warmup_updates: 1000 22 | 23 | lr_scheduler: pass_through -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/adaptive_loss.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/adaptive_loss.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/composite_loss.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/composite_loss.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/cross_entropy.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/cross_entropy.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/ctc.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/ctc.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/fairseq_criterion.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/fairseq_criterion.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/hubert_criterion.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/hubert_criterion.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/label_smoothed_cross_entropy.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/label_smoothed_cross_entropy.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/label_smoothed_cross_entropy_latency_augmented.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/label_smoothed_cross_entropy_latency_augmented.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/label_smoothed_cross_entropy_with_alignment.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/label_smoothed_cross_entropy_with_alignment.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/legacy_masked_lm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/legacy_masked_lm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/masked_lm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/masked_lm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/model_criterion.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/model_criterion.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/nat_loss.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/nat_loss.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/sentence_prediction.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/sentence_prediction.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/sentence_ranking.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/sentence_ranking.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/wav2vec_criterion.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/wav2vec_criterion.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/xentropy_and_balance.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/xentropy_and_balance.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/criterions/__pycache__/xentropy_with_aux_loss.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/criterions/__pycache__/xentropy_with_aux_loss.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/add_target_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/add_target_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/append_token_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/append_token_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/backtranslation_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/backtranslation_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/base_wrapper_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/base_wrapper_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/bucket_pad_length_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/bucket_pad_length_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/colorize_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/colorize_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/concat_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/concat_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/concat_sentences_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/concat_sentences_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/data_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/data_utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/denoising_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/denoising_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/dictionary.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/dictionary.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/fairseq_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/fairseq_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/fasta_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/fasta_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/id_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/id_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/indexed_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/indexed_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/iterators.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/iterators.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/language_pair_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/language_pair_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/list_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/list_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/lm_context_window_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/lm_context_window_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/lru_cache_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/lru_cache_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/mask_tokens_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/mask_tokens_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/monolingual_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/monolingual_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/multi_corpus_sampled_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/multi_corpus_sampled_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/nested_dictionary_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/nested_dictionary_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/noising.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/noising.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/num_samples_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/num_samples_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/numel_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/numel_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/offset_tokens_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/offset_tokens_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/pad_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/pad_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/plasma_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/plasma_utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/prepend_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/prepend_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/prepend_token_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/prepend_token_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/raw_label_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/raw_label_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/replace_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/replace_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/resampling_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/resampling_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/roll_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/roll_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/round_robin_zip_datasets.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/round_robin_zip_datasets.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/shorten_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/shorten_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/sort_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/sort_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/strip_token_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/strip_token_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/subsample_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/subsample_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/token_block_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/token_block_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/transform_eos_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/transform_eos_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/__pycache__/transform_eos_lang_pair_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/__pycache__/transform_eos_lang_pair_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/audio/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/audio/__init__.py -------------------------------------------------------------------------------- /fairseq/data/audio/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/audio/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/audio/__pycache__/audio_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/audio/__pycache__/audio_utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/audio/__pycache__/hubert_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/audio/__pycache__/hubert_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/audio/__pycache__/raw_audio_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/audio/__pycache__/raw_audio_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/audio/__pycache__/speech_to_text_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/audio/__pycache__/speech_to_text_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/audio/feature_transforms/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/audio/feature_transforms/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/audio/feature_transforms/__pycache__/global_cmvn.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/audio/feature_transforms/__pycache__/global_cmvn.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/audio/feature_transforms/__pycache__/specaugment.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/audio/feature_transforms/__pycache__/specaugment.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/audio/feature_transforms/__pycache__/utterance_cmvn.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/audio/feature_transforms/__pycache__/utterance_cmvn.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/colorize_dataset.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import torch 7 | 8 | from . import BaseWrapperDataset 9 | 10 | 11 | class ColorizeDataset(BaseWrapperDataset): 12 | """ Adds 'colors' property to net input that is obtained from the provided color getter for use by models """ 13 | 14 | def __init__(self, dataset, color_getter): 15 | super().__init__(dataset) 16 | self.color_getter = color_getter 17 | 18 | def collater(self, samples): 19 | base_collate = super().collater(samples) 20 | if len(base_collate) > 0: 21 | base_collate["net_input"]["colors"] = torch.tensor( 22 | list(self.color_getter(self.dataset, s["id"]) for s in samples), 23 | dtype=torch.long, 24 | ) 25 | return base_collate 26 | -------------------------------------------------------------------------------- /fairseq/data/data_utils_fast.cpython-36m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/data_utils_fast.cpython-36m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /fairseq/data/encoders/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | import importlib 8 | import os 9 | 10 | from fairseq import registry 11 | 12 | 13 | build_tokenizer, register_tokenizer, TOKENIZER_REGISTRY, _ = registry.setup_registry( 14 | "--tokenizer", 15 | default=None, 16 | ) 17 | 18 | 19 | build_bpe, register_bpe, BPE_REGISTRY, _ = registry.setup_registry( 20 | "--bpe", 21 | default=None, 22 | ) 23 | 24 | 25 | # automatically import any Python files in the encoders/ directory 26 | for file in sorted(os.listdir(os.path.dirname(__file__))): 27 | if file.endswith(".py") and not file.startswith("_"): 28 | module = file[: file.find(".py")] 29 | importlib.import_module("fairseq.data.encoders." + module) 30 | -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/byte_bpe.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/byte_bpe.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/byte_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/byte_utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/bytes.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/bytes.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/characters.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/characters.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/fastbpe.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/fastbpe.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/gpt2_bpe.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/gpt2_bpe.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/gpt2_bpe_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/gpt2_bpe_utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/hf_bert_bpe.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/hf_bert_bpe.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/hf_byte_bpe.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/hf_byte_bpe.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/moses_tokenizer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/moses_tokenizer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/nltk_tokenizer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/nltk_tokenizer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/sentencepiece_bpe.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/sentencepiece_bpe.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/space_tokenizer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/space_tokenizer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/subword_nmt_bpe.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/subword_nmt_bpe.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/__pycache__/utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/encoders/__pycache__/utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/encoders/bytes.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | from fairseq.data.encoders import register_bpe 8 | from fairseq.data.encoders.byte_utils import ( 9 | SPACE, 10 | SPACE_ESCAPE, 11 | byte_encode, 12 | smart_byte_decode, 13 | ) 14 | 15 | 16 | @register_bpe("bytes") 17 | class Bytes(object): 18 | def __init__(self, *unused): 19 | pass 20 | 21 | @staticmethod 22 | def add_args(parser): 23 | pass 24 | 25 | @staticmethod 26 | def encode(x: str) -> str: 27 | encoded = byte_encode(x) 28 | escaped = encoded.replace(SPACE, SPACE_ESCAPE) 29 | return SPACE.join(list(escaped)) 30 | 31 | @staticmethod 32 | def decode(x: str) -> str: 33 | unescaped = x.replace(SPACE, "").replace(SPACE_ESCAPE, SPACE) 34 | return smart_byte_decode(unescaped) 35 | -------------------------------------------------------------------------------- /fairseq/data/encoders/characters.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | from fairseq.data.encoders import register_bpe 8 | 9 | 10 | SPACE = chr(32) 11 | SPACE_ESCAPE = chr(9601) 12 | 13 | 14 | @register_bpe("characters") 15 | class Characters(object): 16 | def __init__(self, *unused): 17 | pass 18 | 19 | @staticmethod 20 | def add_args(parser): 21 | pass 22 | 23 | @staticmethod 24 | def encode(x: str) -> str: 25 | escaped = x.replace(SPACE, SPACE_ESCAPE) 26 | return SPACE.join(list(escaped)) 27 | 28 | @staticmethod 29 | def decode(x: str) -> str: 30 | return x.replace(SPACE, "").replace(SPACE_ESCAPE, SPACE) 31 | -------------------------------------------------------------------------------- /fairseq/data/encoders/nltk_tokenizer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from fairseq.data.encoders import register_tokenizer 7 | from fairseq.dataclass import FairseqDataclass 8 | 9 | 10 | @register_tokenizer("nltk", dataclass=FairseqDataclass) 11 | class NLTKTokenizer(object): 12 | def __init__(self, *unused): 13 | try: 14 | from nltk.tokenize import word_tokenize 15 | 16 | self.word_tokenize = word_tokenize 17 | except ImportError: 18 | raise ImportError("Please install nltk with: pip install nltk") 19 | 20 | def encode(self, x: str) -> str: 21 | return " ".join(self.word_tokenize(x)) 22 | 23 | def decode(self, x: str) -> str: 24 | return x 25 | -------------------------------------------------------------------------------- /fairseq/data/encoders/space_tokenizer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import re 7 | 8 | from fairseq.data.encoders import register_tokenizer 9 | from fairseq.dataclass import FairseqDataclass 10 | 11 | 12 | @register_tokenizer("space", dataclass=FairseqDataclass) 13 | class SpaceTokenizer(object): 14 | def __init__(self, *unused): 15 | self.space_tok = re.compile(r"\s+") 16 | 17 | def encode(self, x: str) -> str: 18 | return self.space_tok.sub(" ", x) 19 | 20 | def decode(self, x: str) -> str: 21 | return x 22 | -------------------------------------------------------------------------------- /fairseq/data/id_dataset.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import torch 7 | 8 | from . import FairseqDataset 9 | 10 | 11 | class IdDataset(FairseqDataset): 12 | def __getitem__(self, index): 13 | return index 14 | 15 | def __len__(self): 16 | return 0 17 | 18 | def collater(self, samples): 19 | return torch.tensor(samples) 20 | -------------------------------------------------------------------------------- /fairseq/data/legacy/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .block_pair_dataset import BlockPairDataset 7 | from .masked_lm_dataset import MaskedLMDataset 8 | from .masked_lm_dictionary import BertDictionary, MaskedLMDictionary 9 | 10 | 11 | __all__ = [ 12 | "BertDictionary", 13 | "BlockPairDataset", 14 | "MaskedLMDataset", 15 | "MaskedLMDictionary", 16 | ] 17 | -------------------------------------------------------------------------------- /fairseq/data/legacy/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/legacy/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/legacy/__pycache__/block_pair_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/legacy/__pycache__/block_pair_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/legacy/__pycache__/masked_lm_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/legacy/__pycache__/masked_lm_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/legacy/__pycache__/masked_lm_dictionary.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/legacy/__pycache__/masked_lm_dictionary.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/list_dataset.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from . import BaseWrapperDataset 7 | 8 | 9 | class ListDataset(BaseWrapperDataset): 10 | def __init__(self, dataset, sizes=None): 11 | super().__init__(dataset) 12 | self._sizes = sizes 13 | 14 | def __iter__(self): 15 | for x in self.dataset: 16 | yield x 17 | 18 | def collater(self, samples): 19 | return samples 20 | 21 | @property 22 | def sizes(self): 23 | return self._sizes 24 | 25 | def num_tokens(self, index): 26 | return self.sizes[index] 27 | 28 | def size(self, index): 29 | return self.sizes[index] 30 | 31 | def set_epoch(self, epoch): 32 | pass 33 | -------------------------------------------------------------------------------- /fairseq/data/lru_cache_dataset.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from functools import lru_cache 7 | 8 | from . import BaseWrapperDataset 9 | 10 | 11 | class LRUCacheDataset(BaseWrapperDataset): 12 | def __init__(self, dataset, token=None): 13 | super().__init__(dataset) 14 | 15 | @lru_cache(maxsize=8) 16 | def __getitem__(self, index): 17 | return self.dataset[index] 18 | 19 | @lru_cache(maxsize=8) 20 | def collater(self, samples): 21 | return self.dataset.collater(samples) 22 | -------------------------------------------------------------------------------- /fairseq/data/multilingual/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | -------------------------------------------------------------------------------- /fairseq/data/multilingual/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/multilingual/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/multilingual/__pycache__/multilingual_data_manager.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/multilingual/__pycache__/multilingual_data_manager.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/multilingual/__pycache__/multilingual_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/multilingual/__pycache__/multilingual_utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/multilingual/__pycache__/sampled_multi_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/multilingual/__pycache__/sampled_multi_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/multilingual/__pycache__/sampled_multi_epoch_dataset.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/multilingual/__pycache__/sampled_multi_epoch_dataset.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/multilingual/__pycache__/sampling_method.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/multilingual/__pycache__/sampling_method.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/data/num_samples_dataset.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from . import FairseqDataset 7 | 8 | 9 | class NumSamplesDataset(FairseqDataset): 10 | def __getitem__(self, index): 11 | return 1 12 | 13 | def __len__(self): 14 | return 0 15 | 16 | def collater(self, samples): 17 | return sum(samples) 18 | -------------------------------------------------------------------------------- /fairseq/data/numel_dataset.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import numpy as np 7 | import torch 8 | 9 | from . import BaseWrapperDataset 10 | 11 | 12 | class NumelDataset(BaseWrapperDataset): 13 | def __init__(self, dataset, reduce=False): 14 | super().__init__(dataset) 15 | self.reduce = reduce 16 | 17 | def __getitem__(self, index): 18 | item = self.dataset[index] 19 | if torch.is_tensor(item): 20 | return torch.numel(item) 21 | else: 22 | return np.size(item) 23 | 24 | def __len__(self): 25 | return len(self.dataset) 26 | 27 | def collater(self, samples): 28 | if self.reduce: 29 | return sum(samples) 30 | else: 31 | return torch.tensor(samples) 32 | -------------------------------------------------------------------------------- /fairseq/data/offset_tokens_dataset.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from . import BaseWrapperDataset 7 | 8 | 9 | class OffsetTokensDataset(BaseWrapperDataset): 10 | def __init__(self, dataset, offset): 11 | super().__init__(dataset) 12 | self.offset = offset 13 | 14 | def __getitem__(self, idx): 15 | return self.dataset[idx] + self.offset 16 | -------------------------------------------------------------------------------- /fairseq/data/pad_dataset.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from fairseq.data import data_utils 7 | 8 | from . import BaseWrapperDataset 9 | 10 | 11 | class PadDataset(BaseWrapperDataset): 12 | def __init__(self, dataset, pad_idx, left_pad): 13 | super().__init__(dataset) 14 | self.pad_idx = pad_idx 15 | self.left_pad = left_pad 16 | 17 | def collater(self, samples): 18 | return data_utils.collate_tokens(samples, self.pad_idx, left_pad=self.left_pad) 19 | 20 | 21 | class LeftPadDataset(PadDataset): 22 | def __init__(self, dataset, pad_idx): 23 | super().__init__(dataset, pad_idx, left_pad=True) 24 | 25 | 26 | class RightPadDataset(PadDataset): 27 | def __init__(self, dataset, pad_idx): 28 | super().__init__(dataset, pad_idx, left_pad=False) 29 | -------------------------------------------------------------------------------- /fairseq/data/raw_label_dataset.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import torch 7 | 8 | from . import FairseqDataset 9 | 10 | 11 | class RawLabelDataset(FairseqDataset): 12 | def __init__(self, labels): 13 | super().__init__() 14 | self.labels = labels 15 | 16 | def __getitem__(self, index): 17 | return self.labels[index] 18 | 19 | def __len__(self): 20 | return len(self.labels) 21 | 22 | def collater(self, samples): 23 | return torch.tensor(samples) 24 | -------------------------------------------------------------------------------- /fairseq/data/roll_dataset.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import torch 7 | 8 | from . import BaseWrapperDataset 9 | 10 | 11 | class RollDataset(BaseWrapperDataset): 12 | def __init__(self, dataset, shifts): 13 | super().__init__(dataset) 14 | self.shifts = shifts 15 | 16 | def __getitem__(self, index): 17 | item = self.dataset[index] 18 | return torch.roll(item, self.shifts) 19 | -------------------------------------------------------------------------------- /fairseq/data/sort_dataset.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import numpy as np 7 | 8 | from . import BaseWrapperDataset 9 | 10 | 11 | class SortDataset(BaseWrapperDataset): 12 | def __init__(self, dataset, sort_order): 13 | super().__init__(dataset) 14 | if not isinstance(sort_order, (list, tuple)): 15 | sort_order = [sort_order] 16 | self.sort_order = sort_order 17 | 18 | assert all(len(so) == len(dataset) for so in sort_order) 19 | 20 | def ordered_indices(self): 21 | return np.lexsort(self.sort_order) 22 | -------------------------------------------------------------------------------- /fairseq/data/strip_token_dataset.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from . import BaseWrapperDataset 7 | 8 | 9 | class StripTokenDataset(BaseWrapperDataset): 10 | def __init__(self, dataset, id_to_strip): 11 | super().__init__(dataset) 12 | self.id_to_strip = id_to_strip 13 | 14 | def __getitem__(self, index): 15 | item = self.dataset[index] 16 | while len(item) > 0 and item[-1] == self.id_to_strip: 17 | item = item[:-1] 18 | while len(item) > 0 and item[0] == self.id_to_strip: 19 | item = item[1:] 20 | return item 21 | -------------------------------------------------------------------------------- /fairseq/data/token_block_utils_fast.cpython-36m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/data/token_block_utils_fast.cpython-36m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /fairseq/dataclass/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .configs import FairseqDataclass 7 | from .constants import ChoiceEnum 8 | 9 | 10 | __all__ = [ 11 | "FairseqDataclass", 12 | "ChoiceEnum", 13 | ] 14 | -------------------------------------------------------------------------------- /fairseq/dataclass/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/dataclass/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/dataclass/__pycache__/configs.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/dataclass/__pycache__/configs.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/dataclass/__pycache__/constants.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/dataclass/__pycache__/constants.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/dataclass/__pycache__/initialize.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/dataclass/__pycache__/initialize.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/dataclass/__pycache__/utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/dataclass/__pycache__/utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/distributed/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .distributed_timeout_wrapper import DistributedTimeoutWrapper 7 | from .fully_sharded_data_parallel import fsdp_enable_wrap, fsdp_wrap, FullyShardedDataParallel 8 | from .legacy_distributed_data_parallel import LegacyDistributedDataParallel 9 | from .module_proxy_wrapper import ModuleProxyWrapper 10 | from .tpu_distributed_data_parallel import TPUDistributedDataParallel 11 | 12 | 13 | __all__ = [ 14 | "DistributedTimeoutWrapper", 15 | "fsdp_enable_wrap", 16 | "fsdp_wrap", 17 | "FullyShardedDataParallel", 18 | "LegacyDistributedDataParallel", 19 | "ModuleProxyWrapper", 20 | "TPUDistributedDataParallel", 21 | ] 22 | -------------------------------------------------------------------------------- /fairseq/distributed/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/distributed/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/distributed/__pycache__/distributed_timeout_wrapper.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/distributed/__pycache__/distributed_timeout_wrapper.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/distributed/__pycache__/fully_sharded_data_parallel.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/distributed/__pycache__/fully_sharded_data_parallel.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/distributed/__pycache__/legacy_distributed_data_parallel.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/distributed/__pycache__/legacy_distributed_data_parallel.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/distributed/__pycache__/module_proxy_wrapper.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/distributed/__pycache__/module_proxy_wrapper.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/distributed/__pycache__/tpu_distributed_data_parallel.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/distributed/__pycache__/tpu_distributed_data_parallel.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/distributed/__pycache__/utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/distributed/__pycache__/utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/libbase.cpython-36m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/libbase.cpython-36m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /fairseq/libbleu.cpython-36m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/libbleu.cpython-36m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /fairseq/libnat.cpython-36m-x86_64-linux-gnu.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/libnat.cpython-36m-x86_64-linux-gnu.so -------------------------------------------------------------------------------- /fairseq/logging/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/logging/__init__.py -------------------------------------------------------------------------------- /fairseq/logging/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/logging/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/logging/__pycache__/meters.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/logging/__pycache__/meters.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/logging/__pycache__/metrics.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/logging/__pycache__/metrics.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/logging/__pycache__/progress_bar.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/logging/__pycache__/progress_bar.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/model_parallel/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from . import criterions, models, modules # noqa 7 | -------------------------------------------------------------------------------- /fairseq/model_parallel/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/model_parallel/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/model_parallel/__pycache__/megatron_trainer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/model_parallel/__pycache__/megatron_trainer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/model_parallel/criterions/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import importlib 7 | import os 8 | 9 | 10 | # automatically import any Python files in the criterions/ directory 11 | for file in sorted(os.listdir(os.path.dirname(__file__))): 12 | if file.endswith(".py") and not file.startswith("_"): 13 | module = file[: file.find(".py")] 14 | importlib.import_module("fairseq.model_parallel.criterions." + module) 15 | -------------------------------------------------------------------------------- /fairseq/model_parallel/criterions/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/model_parallel/criterions/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/model_parallel/criterions/__pycache__/vocab_parallel_cross_entropy.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/model_parallel/criterions/__pycache__/vocab_parallel_cross_entropy.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/model_parallel/models/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import importlib 7 | import os 8 | 9 | 10 | # automatically import any Python files in the models/ directory 11 | models_dir = os.path.dirname(__file__) 12 | for file in os.listdir(models_dir): 13 | path = os.path.join(models_dir, file) 14 | if ( 15 | not file.startswith("_") 16 | and not file.startswith(".") 17 | and (file.endswith(".py") or os.path.isdir(path)) 18 | ): 19 | model_name = file[: file.find(".py")] if file.endswith(".py") else file 20 | module = importlib.import_module("fairseq.model_parallel.models." + model_name) 21 | -------------------------------------------------------------------------------- /fairseq/model_parallel/models/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/model_parallel/models/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/model_parallel/models/__pycache__/transformer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/model_parallel/models/__pycache__/transformer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/model_parallel/models/__pycache__/transformer_lm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/model_parallel/models/__pycache__/transformer_lm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/model_parallel/models/pipeline_parallel_transformer/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .model import * # noqa 7 | -------------------------------------------------------------------------------- /fairseq/model_parallel/models/pipeline_parallel_transformer/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/model_parallel/models/pipeline_parallel_transformer/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/model_parallel/models/pipeline_parallel_transformer/__pycache__/layers.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/model_parallel/models/pipeline_parallel_transformer/__pycache__/layers.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/model_parallel/models/pipeline_parallel_transformer/__pycache__/model.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/model_parallel/models/pipeline_parallel_transformer/__pycache__/model.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/model_parallel/models/roberta/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .model import * # noqa 7 | -------------------------------------------------------------------------------- /fairseq/model_parallel/models/roberta/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/model_parallel/models/roberta/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/model_parallel/models/roberta/__pycache__/model.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/model_parallel/models/roberta/__pycache__/model.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/model_parallel/modules/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | """isort:skip_file""" 6 | 7 | from .multihead_attention import ModelParallelMultiheadAttention 8 | from .transformer_layer import ( 9 | ModelParallelTransformerEncoderLayer, 10 | ModelParallelTransformerDecoderLayer, 11 | ) 12 | 13 | __all__ = [ 14 | "ModelParallelMultiheadAttention", 15 | "ModelParallelTransformerEncoderLayer", 16 | "ModelParallelTransformerDecoderLayer", 17 | ] 18 | -------------------------------------------------------------------------------- /fairseq/model_parallel/modules/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/model_parallel/modules/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/model_parallel/modules/__pycache__/multihead_attention.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/model_parallel/modules/__pycache__/multihead_attention.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/model_parallel/modules/__pycache__/transformer_layer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/model_parallel/modules/__pycache__/transformer_layer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/composite_encoder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/composite_encoder.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/distributed_fairseq_model.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/distributed_fairseq_model.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/fairseq_decoder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/fairseq_decoder.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/fairseq_encoder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/fairseq_encoder.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/fairseq_incremental_decoder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/fairseq_incremental_decoder.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/fairseq_model.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/fairseq_model.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/fconv.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/fconv.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/fconv_lm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/fconv_lm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/fconv_self_att.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/fconv_self_att.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/lightconv.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/lightconv.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/lightconv_lm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/lightconv_lm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/lstm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/lstm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/lstm_lm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/lstm_lm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/masked_lm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/masked_lm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/model_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/model_utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/multilingual_transformer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/multilingual_transformer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/transformer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/transformer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/transformer_align.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/transformer_align.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/transformer_from_pretrained_xlm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/transformer_from_pretrained_xlm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/__pycache__/transformer_lm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/__pycache__/transformer_lm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/bart/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .hub_interface import * # noqa 7 | from .model import * # noqa 8 | -------------------------------------------------------------------------------- /fairseq/models/bart/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/bart/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/bart/__pycache__/hub_interface.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/bart/__pycache__/hub_interface.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/bart/__pycache__/model.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/bart/__pycache__/model.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/hubert/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .hubert import * # noqa 7 | from .hubert_asr import * # noqa 8 | -------------------------------------------------------------------------------- /fairseq/models/hubert/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/hubert/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/hubert/__pycache__/hubert.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/hubert/__pycache__/hubert.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/hubert/__pycache__/hubert_asr.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/hubert/__pycache__/hubert_asr.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/huggingface/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import importlib 7 | import os 8 | 9 | 10 | # automatically import any Python files in the models/huggingface/ directory 11 | models_dir = os.path.dirname(__file__) 12 | for file in os.listdir(models_dir): 13 | path = os.path.join(models_dir, file) 14 | if ( 15 | not file.startswith("_") 16 | and not file.startswith(".") 17 | and (file.endswith(".py") or os.path.isdir(path)) 18 | ): 19 | model_name = file[: file.find(".py")] if file.endswith(".py") else file 20 | module = importlib.import_module("fairseq.models.huggingface." + model_name) 21 | -------------------------------------------------------------------------------- /fairseq/models/huggingface/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/huggingface/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/huggingface/__pycache__/hf_gpt2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/huggingface/__pycache__/hf_gpt2.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/nat/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | """isort:skip_file""" 6 | 7 | from .fairseq_nat_model import * 8 | from .nonautoregressive_transformer import * 9 | from .nat_crf_transformer import * 10 | from .iterative_nonautoregressive_transformer import * 11 | from .cmlm_transformer import * 12 | from .levenshtein_transformer import * 13 | from .insertion_transformer import * 14 | -------------------------------------------------------------------------------- /fairseq/models/nat/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/nat/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/nat/__pycache__/cmlm_transformer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/nat/__pycache__/cmlm_transformer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/nat/__pycache__/fairseq_nat_model.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/nat/__pycache__/fairseq_nat_model.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/nat/__pycache__/insertion_transformer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/nat/__pycache__/insertion_transformer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/nat/__pycache__/iterative_nonautoregressive_transformer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/nat/__pycache__/iterative_nonautoregressive_transformer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/nat/__pycache__/levenshtein_transformer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/nat/__pycache__/levenshtein_transformer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/nat/__pycache__/levenshtein_utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/nat/__pycache__/levenshtein_utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/nat/__pycache__/nat_crf_transformer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/nat/__pycache__/nat_crf_transformer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/nat/__pycache__/nonautoregressive_transformer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/nat/__pycache__/nonautoregressive_transformer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/roberta/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .hub_interface import * # noqa 7 | from .model import * # noqa 8 | from .enc_dec import * # noqa 9 | from .model_camembert import * # noqa 10 | from .model_gottbert import * # noqa 11 | from .model_xlmr import * # noqa 12 | -------------------------------------------------------------------------------- /fairseq/models/roberta/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/roberta/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/roberta/__pycache__/enc_dec.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/roberta/__pycache__/enc_dec.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/roberta/__pycache__/hub_interface.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/roberta/__pycache__/hub_interface.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/roberta/__pycache__/model.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/roberta/__pycache__/model.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/roberta/__pycache__/model_camembert.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/roberta/__pycache__/model_camembert.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/roberta/__pycache__/model_gottbert.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/roberta/__pycache__/model_gottbert.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/roberta/__pycache__/model_xlmr.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/roberta/__pycache__/model_xlmr.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/speech_to_text/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .berard import * # noqa 7 | from .convtransformer import * # noqa 8 | from .s2t_transformer import * # noqa 9 | -------------------------------------------------------------------------------- /fairseq/models/speech_to_text/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/speech_to_text/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/speech_to_text/__pycache__/berard.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/speech_to_text/__pycache__/berard.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/speech_to_text/__pycache__/convtransformer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/speech_to_text/__pycache__/convtransformer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/speech_to_text/__pycache__/s2t_transformer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/speech_to_text/__pycache__/s2t_transformer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/speech_to_text/__pycache__/utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/speech_to_text/__pycache__/utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/speech_to_text/modules/__pycache__/augmented_memory_attention.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/speech_to_text/modules/__pycache__/augmented_memory_attention.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/speech_to_text/modules/__pycache__/emformer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/speech_to_text/modules/__pycache__/emformer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/wav2vec/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .wav2vec import * # noqa 7 | from .wav2vec2 import * # noqa 8 | from .wav2vec2_asr import * # noqa 9 | -------------------------------------------------------------------------------- /fairseq/models/wav2vec/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/wav2vec/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/wav2vec/__pycache__/wav2vec.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/wav2vec/__pycache__/wav2vec.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/wav2vec/__pycache__/wav2vec2.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/wav2vec/__pycache__/wav2vec2.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/models/wav2vec/__pycache__/wav2vec2_asr.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/models/wav2vec/__pycache__/wav2vec2_asr.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/adaptive_input.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/adaptive_input.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/adaptive_softmax.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/adaptive_softmax.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/base_layer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/base_layer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/beamable_mm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/beamable_mm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/character_token_embedder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/character_token_embedder.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/checkpoint_activations.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/checkpoint_activations.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/conv_tbc.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/conv_tbc.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/cross_entropy.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/cross_entropy.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/downsampled_multihead_attention.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/downsampled_multihead_attention.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/dynamic_convolution.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/dynamic_convolution.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/dynamic_crf_layer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/dynamic_crf_layer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/fairseq_dropout.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/fairseq_dropout.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/fp32_group_norm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/fp32_group_norm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/gelu.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/gelu.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/grad_multiply.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/grad_multiply.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/gumbel_vector_quantizer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/gumbel_vector_quantizer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/kmeans_vector_quantizer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/kmeans_vector_quantizer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/layer_drop.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/layer_drop.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/layer_norm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/layer_norm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/learned_positional_embedding.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/learned_positional_embedding.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/lightweight_convolution.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/lightweight_convolution.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/linearized_convolution.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/linearized_convolution.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/moe_layer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/moe_layer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/multihead_attention.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/multihead_attention.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/positional_embedding.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/positional_embedding.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/quant_noise.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/quant_noise.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/same_pad.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/same_pad.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/scalar_bias.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/scalar_bias.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/sinusoidal_positional_embedding.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/sinusoidal_positional_embedding.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/transformer_layer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/transformer_layer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/transformer_sentence_encoder.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/transformer_sentence_encoder.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/transformer_sentence_encoder_layer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/transformer_sentence_encoder_layer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/transpose_last.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/transpose_last.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/unfold.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/unfold.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/__pycache__/vggblock.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/__pycache__/vggblock.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/dynamicconv_layer/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .dynamicconv_layer import DynamicconvLayer # noqa 7 | -------------------------------------------------------------------------------- /fairseq/modules/dynamicconv_layer/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from setuptools import setup 8 | from torch.utils.cpp_extension import BuildExtension, CUDAExtension 9 | 10 | 11 | setup( 12 | name="dynamicconv_layer", 13 | ext_modules=[ 14 | CUDAExtension( 15 | name="dynamicconv_cuda", 16 | sources=[ 17 | "dynamicconv_cuda.cpp", 18 | "dynamicconv_cuda_kernel.cu", 19 | ], 20 | ), 21 | ], 22 | cmdclass={"build_ext": BuildExtension}, 23 | ) 24 | -------------------------------------------------------------------------------- /fairseq/modules/fp32_group_norm.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | """ 6 | Layer norm done in fp32 (for fp16 training) 7 | """ 8 | 9 | import torch.nn as nn 10 | import torch.nn.functional as F 11 | 12 | 13 | class Fp32GroupNorm(nn.GroupNorm): 14 | def __init__(self, *args, **kwargs): 15 | super().__init__(*args, **kwargs) 16 | 17 | def forward(self, input): 18 | output = F.group_norm( 19 | input.float(), 20 | self.num_groups, 21 | self.weight.float() if self.weight is not None else None, 22 | self.bias.float() if self.bias is not None else None, 23 | self.eps, 24 | ) 25 | return output.type_as(input) 26 | -------------------------------------------------------------------------------- /fairseq/modules/gelu.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | """ 6 | See "Gaussian Error Linear Units (GELUs)" by Dan Hendrycks and Kevin Gimpel with 7 | the corresponding GitHub repo: https://github.com/hendrycks/GELUs 8 | """ 9 | 10 | import math 11 | 12 | import torch 13 | import torch.nn as nn 14 | 15 | 16 | def gelu_accurate(x): 17 | if not hasattr(gelu_accurate, "_a"): 18 | gelu_accurate._a = math.sqrt(2 / math.pi) 19 | return ( 20 | 0.5 * x * (1 + torch.tanh(gelu_accurate._a * (x + 0.044715 * torch.pow(x, 3)))) 21 | ) 22 | 23 | 24 | def gelu(x: torch.Tensor) -> torch.Tensor: 25 | return torch.nn.functional.gelu(x.float()).type_as(x) 26 | -------------------------------------------------------------------------------- /fairseq/modules/grad_multiply.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import torch 7 | 8 | 9 | class GradMultiply(torch.autograd.Function): 10 | @staticmethod 11 | def forward(ctx, x, scale): 12 | ctx.scale = scale 13 | res = x.new(x) 14 | return res 15 | 16 | @staticmethod 17 | def backward(ctx, grad): 18 | return grad * ctx.scale, None 19 | -------------------------------------------------------------------------------- /fairseq/modules/lightconv_layer/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .lightconv_layer import LightconvLayer # noqa 7 | -------------------------------------------------------------------------------- /fairseq/modules/lightconv_layer/setup.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | 7 | from setuptools import setup 8 | from torch.utils.cpp_extension import BuildExtension, CUDAExtension 9 | 10 | 11 | setup( 12 | name="lightconv_layer", 13 | ext_modules=[ 14 | CUDAExtension( 15 | "lightconv_cuda", 16 | [ 17 | "lightconv_cuda.cpp", 18 | "lightconv_cuda_kernel.cu", 19 | ], 20 | ), 21 | ], 22 | cmdclass={"build_ext": BuildExtension}, 23 | ) 24 | -------------------------------------------------------------------------------- /fairseq/modules/quantization/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/__init__.py -------------------------------------------------------------------------------- /fairseq/modules/quantization/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/__pycache__/quantization_options.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/__pycache__/quantization_options.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/pq/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .utils import SizeTracker, quantize_model_ # NOQA 7 | -------------------------------------------------------------------------------- /fairseq/modules/quantization/pq/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/pq/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/pq/__pycache__/em.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/pq/__pycache__/em.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/pq/__pycache__/pq.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/pq/__pycache__/pq.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/pq/__pycache__/utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/pq/__pycache__/utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/pq/modules/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .qconv import PQConv2d # NOQA 7 | from .qemb import PQEmbedding # NOQA 8 | from .qlinear import PQLinear # NOQA 9 | -------------------------------------------------------------------------------- /fairseq/modules/quantization/pq/modules/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/pq/modules/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/pq/modules/__pycache__/qconv.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/pq/modules/__pycache__/qconv.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/pq/modules/__pycache__/qemb.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/pq/modules/__pycache__/qemb.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/pq/modules/__pycache__/qlinear.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/pq/modules/__pycache__/qlinear.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/scalar/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .utils import quantize_model_ # NOQA 7 | -------------------------------------------------------------------------------- /fairseq/modules/quantization/scalar/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/scalar/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/scalar/__pycache__/ops.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/scalar/__pycache__/ops.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/scalar/__pycache__/utils.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/scalar/__pycache__/utils.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/scalar/modules/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from .qact import ActivationQuantizer # NOQA 7 | from .qconv import IntConv2d # NOQA 8 | from .qemb import IntEmbedding # NOQA 9 | from .qlinear import IntLinear # NOQA 10 | -------------------------------------------------------------------------------- /fairseq/modules/quantization/scalar/modules/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/scalar/modules/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/scalar/modules/__pycache__/qact.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/scalar/modules/__pycache__/qact.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/scalar/modules/__pycache__/qconv.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/scalar/modules/__pycache__/qconv.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/scalar/modules/__pycache__/qemb.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/scalar/modules/__pycache__/qemb.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/quantization/scalar/modules/__pycache__/qlinear.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/modules/quantization/scalar/modules/__pycache__/qlinear.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/modules/same_pad.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | from torch import nn 8 | 9 | 10 | class SamePad(nn.Module): 11 | def __init__(self, kernel_size, causal=False): 12 | super().__init__() 13 | if causal: 14 | self.remove = kernel_size - 1 15 | else: 16 | self.remove = 1 if kernel_size % 2 == 0 else 0 17 | 18 | def forward(self, x): 19 | if self.remove > 0: 20 | x = x[:, :, : -self.remove] 21 | return x 22 | -------------------------------------------------------------------------------- /fairseq/modules/transpose_last.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | """ 6 | transpose last 2 dimensions of the input 7 | """ 8 | 9 | import torch.nn as nn 10 | 11 | 12 | class TransposeLast(nn.Module): 13 | def __init__(self, deconstruct_idx=None): 14 | super().__init__() 15 | self.deconstruct_idx = deconstruct_idx 16 | 17 | def forward(self, x): 18 | if self.deconstruct_idx is not None: 19 | x = x[self.deconstruct_idx] 20 | return x.transpose(-2, -1) 21 | -------------------------------------------------------------------------------- /fairseq/modules/unfold.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import torch.nn.functional as F 7 | 8 | 9 | def unfold1d(x, kernel_size, padding_l, pad_value=0): 10 | """unfold T x B x C to T x B x C x K""" 11 | if kernel_size > 1: 12 | T, B, C = x.size() 13 | x = F.pad( 14 | x, (0, 0, 0, 0, padding_l, kernel_size - 1 - padding_l), value=pad_value 15 | ) 16 | x = x.as_strided((T, B, C, kernel_size), (B * C, C, 1, B * C)) 17 | else: 18 | x = x.unsqueeze(3) 19 | return x 20 | -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/adadelta.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/adadelta.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/adafactor.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/adafactor.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/adagrad.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/adagrad.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/adam.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/adam.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/adamax.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/adamax.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/amp_optimizer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/amp_optimizer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/bmuf.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/bmuf.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/composite.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/composite.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/cpu_adam.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/cpu_adam.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/dynamic_loss_scaler.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/dynamic_loss_scaler.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/fairseq_optimizer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/fairseq_optimizer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/fp16_optimizer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/fp16_optimizer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/fused_adam.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/fused_adam.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/fused_lamb.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/fused_lamb.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/nag.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/nag.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/sgd.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/sgd.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/__pycache__/shard.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/__pycache__/shard.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/lr_scheduler/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/lr_scheduler/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/lr_scheduler/__pycache__/cosine_lr_scheduler.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/lr_scheduler/__pycache__/cosine_lr_scheduler.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/lr_scheduler/__pycache__/fairseq_lr_scheduler.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/lr_scheduler/__pycache__/fairseq_lr_scheduler.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/lr_scheduler/__pycache__/fixed_schedule.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/lr_scheduler/__pycache__/fixed_schedule.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/lr_scheduler/__pycache__/inverse_square_root_schedule.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/lr_scheduler/__pycache__/inverse_square_root_schedule.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/lr_scheduler/__pycache__/manual_lr_scheduler.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/lr_scheduler/__pycache__/manual_lr_scheduler.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/lr_scheduler/__pycache__/pass_through.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/lr_scheduler/__pycache__/pass_through.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/lr_scheduler/__pycache__/polynomial_decay_schedule.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/lr_scheduler/__pycache__/polynomial_decay_schedule.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/lr_scheduler/__pycache__/reduce_lr_on_plateau.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/lr_scheduler/__pycache__/reduce_lr_on_plateau.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/lr_scheduler/__pycache__/tri_stage_lr_scheduler.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/lr_scheduler/__pycache__/tri_stage_lr_scheduler.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/optim/lr_scheduler/__pycache__/triangular_lr_scheduler.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/optim/lr_scheduler/__pycache__/triangular_lr_scheduler.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/scoring/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/scoring/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/scoring/__pycache__/bleu.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/scoring/__pycache__/bleu.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/scoring/__pycache__/chrf.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/scoring/__pycache__/chrf.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/scoring/__pycache__/tokenizer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/scoring/__pycache__/tokenizer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/scoring/__pycache__/wer.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/scoring/__pycache__/wer.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/scoring/chrf.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | from fairseq.scoring import BaseScorer, register_scorer 7 | 8 | 9 | @register_scorer("chrf") 10 | class ChrFScorer(BaseScorer): 11 | def __init__(self, args): 12 | super(ChrFScorer, self).__init__(args) 13 | import sacrebleu 14 | 15 | self.sacrebleu = sacrebleu 16 | 17 | def add_string(self, ref, pred): 18 | self.ref.append(ref) 19 | self.pred.append(pred) 20 | 21 | def score(self, order=4): 22 | return self.result_string(order).score 23 | 24 | def result_string(self, order=4): 25 | if order != 4: 26 | raise NotImplementedError 27 | return self.sacrebleu.corpus_chrf(self.pred, [self.ref]).format() 28 | -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/audio_pretraining.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/audio_pretraining.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/cross_lingual_lm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/cross_lingual_lm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/denoising.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/denoising.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/fairseq_task.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/fairseq_task.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/hubert_pretraining.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/hubert_pretraining.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/language_modeling.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/language_modeling.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/legacy_masked_lm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/legacy_masked_lm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/masked_lm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/masked_lm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/multilingual_denoising.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/multilingual_denoising.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/multilingual_masked_lm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/multilingual_masked_lm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/multilingual_translation.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/multilingual_translation.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/online_backtranslation.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/online_backtranslation.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/semisupervised_translation.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/semisupervised_translation.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/sentence_prediction.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/sentence_prediction.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/sentence_ranking.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/sentence_ranking.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/simultaneous_translation.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/simultaneous_translation.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/speech_to_text.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/speech_to_text.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/translation.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/translation.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/translation_from_pretrained_bart.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/translation_from_pretrained_bart.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/translation_from_pretrained_xlm.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/translation_from_pretrained_xlm.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/translation_lev.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/translation_lev.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tasks/__pycache__/translation_multi_simple_epoch.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq/tasks/__pycache__/translation_multi_simple_epoch.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq/tokenizer.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | import re 7 | 8 | 9 | SPACE_NORMALIZER = re.compile(r"\s+") 10 | 11 | 12 | def tokenize_line(line): 13 | line = SPACE_NORMALIZER.sub(" ", line) 14 | line = line.strip() 15 | return line.split() 16 | -------------------------------------------------------------------------------- /fairseq/version.py: -------------------------------------------------------------------------------- 1 | __version__ = "1.0.0a0+abe64b5" 2 | -------------------------------------------------------------------------------- /fairseq/version.txt: -------------------------------------------------------------------------------- 1 | 1.0.0a0 2 | -------------------------------------------------------------------------------- /fairseq_cli/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq_cli/__init__.py -------------------------------------------------------------------------------- /fairseq_cli/__pycache__/__init__.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq_cli/__pycache__/__init__.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq_cli/__pycache__/generate.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq_cli/__pycache__/generate.cpython-36.pyc -------------------------------------------------------------------------------- /fairseq_cli/__pycache__/train.cpython-36.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/fairseq_cli/__pycache__/train.cpython-36.pyc -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["setuptools", "wheel", "cython"] 3 | build-backend = "setuptools.build_meta" 4 | -------------------------------------------------------------------------------- /scripts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/scripts/__init__.py -------------------------------------------------------------------------------- /scripts/compound_split_bleu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $# -ne 1 ]; then 4 | echo "usage: $0 GENERATE_PY_OUTPUT" 5 | exit 1 6 | fi 7 | 8 | GEN=$1 9 | 10 | SYS=$GEN.sys 11 | REF=$GEN.ref 12 | 13 | if [ $(tail -n 1 $GEN | grep BLEU | wc -l) -ne 1 ]; then 14 | echo "not done generating" 15 | exit 16 | fi 17 | 18 | grep ^H $GEN | awk -F '\t' '{print $NF}' | perl -ple 's{(\S)-(\S)}{$1 ##AT##-##AT## $2}g' > $SYS 19 | grep ^T $GEN | cut -f2- | perl -ple 's{(\S)-(\S)}{$1 ##AT##-##AT## $2}g' > $REF 20 | fairseq-score --sys $SYS --ref $REF 21 | -------------------------------------------------------------------------------- /scripts/convert_dictionary.lua: -------------------------------------------------------------------------------- 1 | -- Copyright (c) Facebook, Inc. and its affiliates. 2 | -- 3 | -- This source code is licensed under the MIT license found in the 4 | -- LICENSE file in the root directory of this source tree. 5 | -- 6 | -- Usage: convert_dictionary.lua 7 | require 'fairseq' 8 | require 'torch' 9 | require 'paths' 10 | 11 | if #arg < 1 then 12 | print('usage: convert_dictionary.lua ') 13 | os.exit(1) 14 | end 15 | if not paths.filep(arg[1]) then 16 | print('error: file does not exit: ' .. arg[1]) 17 | os.exit(1) 18 | end 19 | 20 | dict = torch.load(arg[1]) 21 | dst = paths.basename(arg[1]):gsub('.th7', '.txt') 22 | assert(dst:match('.txt$')) 23 | 24 | f = io.open(dst, 'w') 25 | for idx, symbol in ipairs(dict.index_to_symbol) do 26 | if idx > dict.cutoff then 27 | break 28 | end 29 | f:write(symbol) 30 | f:write(' ') 31 | f:write(dict.index_to_freq[idx]) 32 | f:write('\n') 33 | end 34 | f:close() 35 | -------------------------------------------------------------------------------- /scripts/sacrebleu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $# -ne 4 ]; then 4 | echo "usage: $0 TESTSET SRCLANG TGTLANG GEN" 5 | exit 1 6 | fi 7 | 8 | TESTSET=$1 9 | SRCLANG=$2 10 | TGTLANG=$3 11 | 12 | GEN=$4 13 | 14 | if ! command -v sacremoses &> /dev/null 15 | then 16 | echo "sacremoses could not be found, please install with: pip install sacremoses" 17 | exit 18 | fi 19 | 20 | grep ^H $GEN \ 21 | | sed 's/^H\-//' \ 22 | | sort -n -k 1 \ 23 | | cut -f 3 \ 24 | | sacremoses detokenize \ 25 | > $GEN.sorted.detok 26 | 27 | sacrebleu --test-set $TESTSET --language-pair "${SRCLANG}-${TGTLANG}" < $GEN.sorted.detok 28 | -------------------------------------------------------------------------------- /scripts/spm_train.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # All rights reserved. 4 | # 5 | # This source code is licensed under the license found in the 6 | # LICENSE file in the root directory of this source tree. 7 | 8 | from __future__ import absolute_import, division, print_function, unicode_literals 9 | 10 | import sys 11 | 12 | import sentencepiece as spm 13 | 14 | 15 | if __name__ == "__main__": 16 | spm.SentencePieceTrainer.Train(" ".join(sys.argv[1:])) 17 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/tests/__init__.py -------------------------------------------------------------------------------- /tests/distributed/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/tests/distributed/__init__.py -------------------------------------------------------------------------------- /tests/gpu/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/tests/gpu/__init__.py -------------------------------------------------------------------------------- /tests/gpu/transformer_quantization_config.yaml: -------------------------------------------------------------------------------- 1 | # Copyright (c) Facebook, Inc. and its affiliates. 2 | # 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | # This file defines example configuration arguments for quantizing 7 | # a transformer model with product quantization 8 | 9 | n_centroids: 10 | Linear: 11 | key: in_features 12 | value: {"*": 8} 13 | Embedding: 14 | key: embedding_dim 15 | value: {"*": 8} 16 | 17 | block_sizes: 18 | Linear: 19 | key: fuzzy_name 20 | value: {fc: 8, attn: 4, emb: 4} 21 | Embedding: 22 | key: fuzzy_name 23 | value: {emb: 8} 24 | 25 | layers_to_quantize: 26 | - decoder\\.layers\\.\d+\\.fc[12] 27 | - decoder\\.embed_tokens\\.embeddings\\.[012]\\.[01] 28 | - decoder\\.layers\\.\d+\\.self_attn\\.(k_proj|v_proj|q_proj|out_proj) 29 | -------------------------------------------------------------------------------- /tests/speech_recognition/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Hunter-DDM/stablemoe/73ea6efe625f30bdb0463efb7bb721337c0955da/tests/speech_recognition/__init__.py -------------------------------------------------------------------------------- /train.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 -u 2 | # Copyright (c) Facebook, Inc. and its affiliates. 3 | # 4 | # This source code is licensed under the MIT license found in the 5 | # LICENSE file in the root directory of this source tree. 6 | """ 7 | Legacy entry point. Use fairseq_cli/train.py or fairseq-train instead. 8 | """ 9 | 10 | from fairseq_cli.train import cli_main 11 | 12 | 13 | if __name__ == "__main__": 14 | cli_main() 15 | --------------------------------------------------------------------------------