Full Code of microsoft/unilm for AI

master 833df7e7832e cached
5915 files
112.5 MB
5.0M tokens
1686 symbols
1 requests
Copy disabled (too large) Download .txt
Showing preview only (19,728K chars total). Download the full file to get everything.
Repository: microsoft/unilm
Branch: master
Commit: 833df7e7832e
Files: 5915
Total size: 112.5 MB

Directory structure:
gitextract_cuit3xwy/

├── .github/
│   └── ISSUE_TEMPLATE/
│       ├── bug_report.md
│       └── custom.md
├── .gitignore
├── .gitmodules
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Diff-Transformer/
│   ├── Diff-Transformer-V2/
│   │   ├── README.md
│   │   └── multihead_flashdiffv2.py
│   ├── README.md
│   ├── example.py
│   ├── kernel/
│   │   └── rotary.py
│   ├── multihead_attention.py
│   ├── multihead_diffattn.py
│   ├── multihead_flashdiff_1.py
│   ├── multihead_flashdiff_2.py
│   └── rms_norm.py
├── LICENSE
├── LatentLM/
│   ├── README.md
│   ├── evaluate_fid.py
│   ├── evaluate_fid_fidelity.py
│   ├── inference_speed.py
│   ├── metrics/
│   │   ├── IS.py
│   │   ├── __init__.py
│   │   ├── fid.py
│   │   └── inception.py
│   ├── models/
│   │   ├── DiT.py
│   │   ├── EMA.py
│   │   ├── RMSNorm.py
│   │   ├── Transformer.py
│   │   ├── __init__.py
│   │   └── kernel/
│   │       ├── rotary.py
│   │       └── swiglu.py
│   ├── sample_hf.py
│   ├── sample_many.py
│   ├── schedule/
│   │   ├── __init__.py
│   │   ├── ddpm.py
│   │   └── dpm_solver.py
│   ├── tokenizer_models/
│   │   ├── __init__.py
│   │   ├── modeling_beit3_vision.py
│   │   ├── modeling_common.py
│   │   ├── modeling_sigma_vae.py
│   │   ├── modeling_utils.py
│   │   └── vae.py
│   ├── train_hf.py
│   └── utils.py
├── NOTICE.md
├── PFPO/
│   ├── README.md
│   ├── apps_train_sub_val_ids.json
│   ├── conf/
│   │   ├── api/
│   │   │   └── vllm/
│   │   │       ├── apps/
│   │   │       │   ├── deepseek_coder/
│   │   │       │   │   ├── dev_v1_0.yaml
│   │   │       │   │   ├── dev_v1_0_fix_bos.yaml
│   │   │       │   │   ├── dev_v1_1.yaml
│   │   │       │   │   ├── dev_v1_1_sample.yaml
│   │   │       │   │   ├── dev_v2_0.yaml
│   │   │       │   │   ├── r2c/
│   │   │       │   │   │   ├── dev_v1_0.yaml
│   │   │       │   │   │   ├── dev_v1_1.yaml
│   │   │       │   │   │   ├── dev_v1_1_sample.yaml
│   │   │       │   │   │   ├── dev_v2_0.yaml
│   │   │       │   │   │   ├── dev_v2_0_sample.yaml
│   │   │       │   │   │   ├── general_combine_train_v2_0.yaml
│   │   │       │   │   │   ├── general_combine_train_v2_0_prefix_completion.yaml
│   │   │       │   │   │   ├── general_combine_train_v2_1_4o_non_sc.yaml
│   │   │       │   │   │   ├── sub_dev_v1_1.yaml
│   │   │       │   │   │   ├── sub_dev_v2_0.yaml
│   │   │       │   │   │   ├── train_v1_0.yaml
│   │   │       │   │   │   ├── train_v1_0_s43.yaml
│   │   │       │   │   │   ├── train_v2_0.yaml
│   │   │       │   │   │   ├── train_v2_0_prefix_completion.yaml
│   │   │       │   │   │   └── xcode_train_v2_0.yaml
│   │   │       │   │   ├── sub_dev_v1_1.yaml
│   │   │       │   │   ├── sub_dev_v2_0.yaml
│   │   │       │   │   ├── test_inputs_gen/
│   │   │       │   │   │   ├── sub_dev_v1_0.yaml
│   │   │       │   │   │   └── test_v1_0.yaml
│   │   │       │   │   ├── train_v1_0.yaml
│   │   │       │   │   └── train_v2_0.yaml
│   │   │       │   └── general_eval/
│   │   │       │       ├── dev_v2_0.yaml
│   │   │       │       ├── dev_v2_1.yaml
│   │   │       │       └── dev_v2_2.yaml
│   │   │       ├── human_eval/
│   │   │       │   ├── ds_coder/
│   │   │       │   │   ├── r2c/
│   │   │       │   │   │   ├── test_v1_0.yaml
│   │   │       │   │   │   ├── test_v1_0_local.yaml
│   │   │       │   │   │   ├── test_v2_0_local.yaml
│   │   │       │   │   │   ├── test_v2_1_local.yaml
│   │   │       │   │   │   └── test_v2_2_local.yaml
│   │   │       │   │   ├── test_v1_0_local.yaml
│   │   │       │   │   └── test_v2_0.yaml
│   │   │       │   ├── test_v2_1.yaml
│   │   │       │   └── test_v2_2.yaml
│   │   │       ├── magicoder/
│   │   │       │   ├── llama3/
│   │   │       │   │   └── test_case_input_gen_v1_0.yaml
│   │   │       │   └── mistral/
│   │   │       │       ├── func_head_extract_v1_0.yaml
│   │   │       │       └── test_case_input_gen_v1_0.yaml
│   │   │       ├── mathscale/
│   │   │       │   ├── 4o_mathstral_train_0shot_v1_0.yaml
│   │   │       │   ├── 4o_mathstral_train_0shot_v1_0_completion.yaml
│   │   │       │   ├── 4o_mathstral_train_0shot_v1_1.yaml
│   │   │       │   ├── 4o_mathstral_train_0shot_v1_1_completion.yaml
│   │   │       │   ├── 4o_mathstral_train_half_0shot_v1_0.yaml
│   │   │       │   ├── 4o_mathstral_train_half_0shot_v1_0_completion.yaml
│   │   │       │   ├── mathstral/
│   │   │       │   │   ├── deepseek_test_0shot_tem_v1_1.yaml
│   │   │       │   │   ├── mistral_mathscale4o_labeling.yaml
│   │   │       │   │   ├── mistral_train_0shot_iter0_v1_0.yaml
│   │   │       │   │   ├── test_0shot_tem_v1_1.yaml
│   │   │       │   │   ├── test_0shot_tem_v1_1_step.yaml
│   │   │       │   │   ├── test_0shot_tem_v1_1_step_seed.yaml
│   │   │       │   │   ├── test_0shot_tem_v2_0_step.yaml
│   │   │       │   │   └── test_0shot_tem_v3_0_step.yaml
│   │   │       │   ├── mistral_train_0shot_v1_0.yaml
│   │   │       │   ├── mistral_train_0shot_v1_1.yaml
│   │   │       │   ├── mistral_train_0shot_v1_2.yaml
│   │   │       │   ├── numina_hard_train_0shot_v1_0_completion.yaml
│   │   │       │   ├── numina_hard_train_0shot_v1_0_seed.yaml
│   │   │       │   ├── numina_rewrite_qwen25_0shot_v1_0.yaml
│   │   │       │   ├── numina_train_0shot_v1_0.yaml
│   │   │       │   ├── numina_train_0shot_v1_0_completion.yaml
│   │   │       │   ├── test_0shot_tem_v1_1.yaml
│   │   │       │   └── test_0shot_tem_v1_1_step.yaml
│   │   │       ├── mbpp_sanitized/
│   │   │       │   ├── r2c/
│   │   │       │   │   ├── test_3shot_v2_0.yaml
│   │   │       │   │   ├── test_v1_0.yaml
│   │   │       │   │   └── test_v1_0_local.yaml
│   │   │       │   ├── test_3shot_v1_0.yaml
│   │   │       │   ├── test_3shot_v1_0_local.yaml
│   │   │       │   ├── test_v1_0_local.yaml
│   │   │       │   ├── test_v1_1_local.yaml
│   │   │       │   ├── test_v2_0_local.yaml
│   │   │       │   ├── test_v2_1_local.yaml
│   │   │       │   └── test_v2_2_local.yaml
│   │   │       ├── mwp-bench/
│   │   │       │   ├── deepseek_test_0shot_v1_1.yaml
│   │   │       │   ├── llama_base/
│   │   │       │   │   └── college_math_test_4shot_v1_0.yaml
│   │   │       │   ├── llama_chat/
│   │   │       │   │   ├── dev_0shot_v1_0.yaml
│   │   │       │   │   ├── math_test_0shot_v1_0.yaml
│   │   │       │   │   ├── math_test_0shot_v3_0.yaml
│   │   │       │   │   └── test_0shot_v1_0.yaml
│   │   │       │   ├── mathstral_dev_0shot_self_correct_v1_0.yaml
│   │   │       │   ├── mathstral_dev_0shot_v1_0.yaml
│   │   │       │   ├── mathstral_test_0shot_self_correct_v1_0.yaml
│   │   │       │   ├── mathstral_test_0shot_v1_0.yaml
│   │   │       │   ├── mathstral_test_gaokao_2023_0shot_v1_0.yaml
│   │   │       │   ├── mathstral_test_gsm8k_0shot_v1_0.yaml
│   │   │       │   ├── mistral/
│   │   │       │   │   ├── dev_0shot_v1_0.yaml
│   │   │       │   │   └── test_0shot_v1_0.yaml
│   │   │       │   └── mistral_dev_0shot_v1_0.yaml
│   │   │       └── vllm_params/
│   │   │           ├── sampling_param_greedy.yaml
│   │   │           └── sampling_param_sample.yaml
│   │   ├── deepspeed/
│   │   │   ├── fp16.yaml
│   │   │   ├── train_hybrid_engine_zero0.yaml
│   │   │   ├── train_hybrid_engine_zero1.yaml
│   │   │   ├── train_hybrid_engine_zero1_cosine.yaml
│   │   │   ├── train_hybrid_engine_zero1_lr.yaml
│   │   │   ├── train_hybrid_engine_zero1_optim_offload.yaml
│   │   │   ├── train_hybrid_engine_zero1_optim_offload_cosine.yaml
│   │   │   ├── train_hybrid_engine_zero1_optim_offload_lr.yaml
│   │   │   ├── train_hybrid_engine_zero1_wo_optim.yaml
│   │   │   ├── train_hybrid_engine_zero2.yaml
│   │   │   ├── train_hybrid_engine_zero2_cosine.yaml
│   │   │   ├── train_hybrid_engine_zero2_lr.yaml
│   │   │   ├── train_hybrid_engine_zero2_optim_offload.yaml
│   │   │   ├── train_hybrid_engine_zero2_optim_offload_cosine.yaml
│   │   │   ├── train_hybrid_engine_zero3.yaml
│   │   │   ├── train_hybrid_engine_zero3_cosine.yaml
│   │   │   ├── train_hybrid_engine_zero3_optim_offload.yaml
│   │   │   └── train_hybrid_engine_zero3_optim_offload_cosine.yaml
│   │   ├── exp/
│   │   │   ├── apps/
│   │   │   │   ├── code_gen/
│   │   │   │   │   └── deepseek_coder/
│   │   │   │   │       ├── dpo/
│   │   │   │   │       │   ├── orig-pseudo-v1.0-a100.yaml
│   │   │   │   │       │   ├── orig-v1.0-v100.yaml
│   │   │   │   │       │   ├── orig-v1.1-v100-tp2.yaml
│   │   │   │   │       │   ├── orig-v1.1-v100-tp4.yaml
│   │   │   │   │       │   ├── orig-v1.1-v100.yaml
│   │   │   │   │       │   ├── orig-v1.2-v100-tp4.yaml
│   │   │   │   │       │   ├── orig-v1.3-a100.yaml
│   │   │   │   │       │   ├── orig-v1.3-v100-tp4.yaml
│   │   │   │   │       │   ├── orig-v1.4-a100.yaml
│   │   │   │   │       │   ├── orig-v1.4-v100-tp4.yaml
│   │   │   │   │       │   ├── pseudo-sc-dpo-v1.0-v100-tp8.yaml
│   │   │   │   │       │   ├── pseudo-sc-dpo-v1.1-h100.yaml
│   │   │   │   │       │   ├── pseudo-sc-dpo-v1.1-v100-tp8.yaml
│   │   │   │   │       │   ├── pseudo-sc-dpo-v1.2-a100.yaml
│   │   │   │   │       │   └── pseudo-sc-dpo-v1.2-v100-tp8.yaml
│   │   │   │   │       └── sft/
│   │   │   │   │           ├── v1.0-a100.yaml
│   │   │   │   │           └── v1.0-v100.yaml
│   │   │   │   ├── r2c_generation/
│   │   │   │   │   └── deepseek_coder/
│   │   │   │   │       ├── dpo/
│   │   │   │   │       │   ├── deprecated/
│   │   │   │   │       │   │   └── sft-v1.0-v100-tp4.yaml
│   │   │   │   │       │   ├── gpt4o-distil-4o-ps-test-pdpo-h100-v1.0.yaml
│   │   │   │   │       │   ├── gpt4o-distil-4o-ps-test-pdpo-h100-v1.1.yaml
│   │   │   │   │       │   ├── gpt4o-distil-4o-self-mix-ps-test-v1.0-mi300x-dp16.yaml
│   │   │   │   │       │   ├── gpt4o-distil-4o-self-mix-ps-test-v1.0-mi300x.yaml
│   │   │   │   │       │   ├── gpt4o-distil-4o-self-mix-ps-test-v1.1-mi300x.yaml
│   │   │   │   │       │   ├── gpt4o-distil-ps-pdpo-ctr-ts-num-v1.0-mi300x-dp32.yaml
│   │   │   │   │       │   ├── gpt4o-distil-pseudo-v1.0-a100.yaml
│   │   │   │   │       │   ├── gpt4o-distil-self-pseudo-v1.0-a100.yaml
│   │   │   │   │       │   ├── gpt4o-distil-self-pseudo-v1.0-v100.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v1.0-H100-4o-ps-test.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v2.0-v100.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v3.0-a100.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v3.1-rm-a100.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v3.2-v100.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.0-v100-ps-test.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.1-H100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.10-V100-ps-pdpo-rerun.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.2-H100-gd-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.2-v100-gd-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.3-H100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.3-V100-ps-pdpo-rerun.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.3-v100-gd-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.4-H100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.4-V100-ps-pdpo-rerun.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.5-A100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.5-v100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.6-v100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.7-A100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.8-A100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.9-V100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.9.1-V100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.9.2-V100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.9.3-A100-ps-pdpo.yaml
│   │   │   │   │       │   ├── iter1/
│   │   │   │   │       │   │   ├── gpt4o-distil-apps-mc-v1.0-mi300x-hybrid.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-apps-mc-v1.1-mi300x-hybrid.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.0-a100-40-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.1-v100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.2-h100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.0-H100-4o-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.0-v100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.1-H100-4o-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.1-a100-40-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.1-v100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.2-H100-4o-ps-test.yaml
│   │   │   │   │       │   │   └── gpt4o-distil-combine-v1.2-a100-40-ps-test.yaml
│   │   │   │   │       │   ├── iter2/
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-dpo-n64sc-v1.0-A100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-dpo-n64sc-v1.1-A100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-dpo-n64sc-v1.2-A100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-dpo-n64sc-v1.2-V100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-dpo-n64sc-v1.3-A100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-dpo-n64sc-v1.4-A100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.0-h100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.1-h100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.1-v100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.2-v100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.3-h100-fix-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.3-v100-fix-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.3-v100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v2.0-h100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v2.1-h100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.0-H100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.0-mi300x-hybrid.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.1-mi300x-hybrid.yaml
│   │   │   │   │       │   │   └── gpt4o-distil-combine-v1.2-mi300x-hybrid.yaml
│   │   │   │   │       │   └── iter3/
│   │   │   │   │       │       ├── gpt4o-distil-combine-pdpo-v1.0-h100-ps-test.yaml
│   │   │   │   │       │       ├── gpt4o-distil-combine-pdpo-v1.1-h100-ps-test.yaml
│   │   │   │   │       │       └── gpt4o-distil-combine-pdpo-v1.2-h100-ps-test.yaml
│   │   │   │   │       └── sft/
│   │   │   │   │           ├── deprecated/
│   │   │   │   │           │   ├── gpt4o-distil-v1.0-v100.yaml
│   │   │   │   │           │   ├── gpt4o-distil-v1.1-v100.yaml
│   │   │   │   │           │   ├── gpt4o-distil-v2.0-v100.yaml
│   │   │   │   │           │   ├── gpt4o-distil-v2.1-v100-tp.yaml
│   │   │   │   │           │   ├── gpt4o-distil-v2.1-v100.yaml
│   │   │   │   │           │   ├── gpt4o-distil-v2.2-v100.yaml
│   │   │   │   │           │   ├── gpt4o-distil-v2.3-v100.yaml
│   │   │   │   │           │   ├── gpt4o-distil-v2.5-v100.yaml
│   │   │   │   │           │   └── gpt4o-distil-v2.6-v100.yaml
│   │   │   │   │           ├── gpt4o-distil-v2.4-a100.yaml
│   │   │   │   │           ├── gpt4o-distil-v2.4-v100-fix-2node-test.yaml
│   │   │   │   │           ├── gpt4o-distil-v2.4-v100-fix.yaml
│   │   │   │   │           ├── gpt4o-distil-v2.4-v100.yaml
│   │   │   │   │           ├── gpt4o-distil-v3.0-a100.yaml
│   │   │   │   │           ├── gpt4o-distil-v3.0-v100.yaml
│   │   │   │   │           ├── gpt4o-distil-v3.1-v100-test.yaml
│   │   │   │   │           └── gpt4o-distil-v3.1-v100.yaml
│   │   │   │   └── test_input_gen/
│   │   │   │       └── deepseek_coder/
│   │   │   │           └── sft/
│   │   │   │               └── v1.0-a100.yaml
│   │   │   └── mathscale/
│   │   │       ├── llama/
│   │   │       │   ├── dpo/
│   │   │       │   │   ├── iter1/
│   │   │       │   │   │   ├── llama3.1-dpo-4o-iter0-v1.0-H100.yaml
│   │   │       │   │   │   ├── llama3.1-dpo-4o-iter0-v1.1-A100-40.yaml
│   │   │       │   │   │   ├── llama3.1-pdpo-4o-iter1-1.0-A100.yaml
│   │   │       │   │   │   └── llama3.1-pdpo-4o-iter1-1.1-v100.yaml
│   │   │       │   │   ├── llama3.1-dpo-4o-iter0-v1.0-v100.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v1.0-v100.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v1.1-H100.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v1.2-V100.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v1.2-a100-40.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v2.0-v100.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v2.1-a100-40.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v2.1-v100.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v2.2-A100.yaml
│   │   │       │   │   └── numina-co/
│   │   │       │   │       ├── llama3.1-pdpo-iter1-1.0-split01-p0.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-1.0-split01-p0.5-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split0123-cross2-p0.5-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split0123-cross2-p0.5-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split0123-p0.5-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split0123-p0.5-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split23-p0.0-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split23-p0.0-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split23-p0.5-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split23-p0.5-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter2-split01-23-p0.5-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter2-split01-23-p0.5-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter2-split01-23-p0.5-v1.2-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter2-split01-23-p0.5-v1.3-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter2-split01-23-p0.5-v1.4-a100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter2-split01-23-p0.5-v1.4-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter2-split01-23-p0.5-v1.4-v100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter3-split01-23-45-p0.5-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter3-split01-23-45-p0.5-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter3-split01-23-45-p0.5-v1.2-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter3-split01-23-45-p0.5-v1.3-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter3-split01-23-45-p0.5-v1.3-v100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter3-split01-23-45-p0.5-v1.4-a100-dp16.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter3-split01-23-45-p0.5-v1.4-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.2-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.3-v100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.4-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.5-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.6-a100-40.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.6-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.7-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-6789-p0.0-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-6789-p0.0-v1.2-a100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-6789-p0.0-v1.3-v100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-6789-p0.0-v1.5-h100-dp16.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-6789-p0.0-v1.5-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-6789-p0.0-v1.5-v100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-p0.0-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter5-split01-23-45-67-89-p0.2-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter5-split01-23-45-67-89-p0.2-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter5-split01-23-45-67-89-p0.4-v1.2-h100.yaml
│   │   │       │   │       └── llama3.1-pdpo-iter5-split01-23-45-67-89-p0.5-v1.3-a100-40.yaml
│   │   │       │   └── sft/
│   │   │       │       ├── 70b-sft-v1.0-mi300x.yaml
│   │   │       │       ├── 70b-sft-v1.1-mi300x.yaml
│   │   │       │       ├── 70b-sft-v1.2-mi300x.yaml
│   │   │       │       └── 70b-sft-v2.0-mi300x.yaml
│   │   │       └── mistral/
│   │   │           ├── dpo/
│   │   │           │   ├── co-half-0/
│   │   │           │   │   ├── mathstral-co-pdpo-half0-iter0-v1.0-a100.yaml
│   │   │           │   │   ├── mathstral-co-pdpo-half0-iter0-v1.1-h100.yaml
│   │   │           │   │   ├── mathstral-co-pdpo-half0-iter0-v1.2-h100.yaml
│   │   │           │   │   ├── mathstral-co-pdpo-half0-iter0-v1.3-a100.yaml
│   │   │           │   │   └── mathstral-co-pdpo-sc-half0-iter0-p0.0-v1.0-a100.yaml
│   │   │           │   ├── co-half-1/
│   │   │           │   │   ├── mathstral-co-pdpo-half1-iter0-v1.0-a100.yaml
│   │   │           │   │   └── mathstral-co-pdpo-sc-half1-iter1-p0.0-v1.0-a100.yaml
│   │   │           │   ├── iter-2-mscale-v0.1/
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.0-A100-40.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.0-V100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.1-A100-40.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.1-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.1-V100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.2-V100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.3-A100-40.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.3-A100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.3-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.3-V100.yaml
│   │   │           │   │   └── mathstral-pdpo-mscale300k-iter2-v1.3.1-A100-40.yaml
│   │   │           │   ├── iter-3-mscale-v0.1/
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter3-v1.0-V100.yaml
│   │   │           │   │   └── mathstral-pdpo-mscale300k-iter3-v1.1-A100.yaml
│   │   │           │   ├── iter1/
│   │   │           │   │   ├── mathstral-dpo-4o-iter1-v1.0-v100.yaml
│   │   │           │   │   ├── mathstral-dpo-4o-iter1-v1.1-a100.yaml
│   │   │           │   │   ├── mathstral-dpo-4o-iter1-v1.2-h100.yaml
│   │   │           │   │   ├── mathstral-dpo-4o-iter1-v1.3-h100.yaml
│   │   │           │   │   ├── mathstral-dpo-4o-iter1-v1.4-v100.yaml
│   │   │           │   │   ├── mathstral-dpo-4o-iter1-v1.5-h100.yaml
│   │   │           │   │   ├── mathstral-pdpo-4o-iter1-v1.0-H100.yaml
│   │   │           │   │   ├── mathstral-raft-dpo-4o-iter1-v2.0-h100.yaml
│   │   │           │   │   ├── mathstral-raft-dpo-4o-iter1-v2.1-h100.yaml
│   │   │           │   │   ├── mathstral-sc-dpo-4o-iter1-v1.0-a100-40.yaml
│   │   │           │   │   ├── mathstral-sc-dpo-4o-iter1-v1.1-a100.yaml
│   │   │           │   │   ├── mathstral-sc-dpo-4o-iter1-v1.2-a100-40.yaml
│   │   │           │   │   ├── mathstral-sc-dpo-numina-iter1-v1.0-h100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v1.0-H100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v1.1-H100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v1.2-A100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v1.3-A100-40.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v1.4-A100-40.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v1.4-H100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v2.0-H100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v2.1-H100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v2.2-H100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-numina-iter1-v2.0-h100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-numina-iter1-v2.1-A100-40.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-numina-iter1-v2.1-a100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-numina-iter1-v2.2-h100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-numina-iter1-v2.3-A100-40.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-numina-iter1-v2.4-A100-40.yaml
│   │   │           │   │   ├── mathstral-sc-prm-4o-iter1-v1.0-H100.yaml
│   │   │           │   │   └── mathstral-sc-prm-4o-iter1-v1.1-A100-40.yaml
│   │   │           │   ├── iter1-mscale-v0.1/
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-4o-iter1-v1.0-MI300x.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.0-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.1-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.2-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.3-A100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.4-A100-40.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.4-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.5-A100-40.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.5-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.6-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.7-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v2.0-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v2.1-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v3.0-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v3.1-A100-40.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v3.1-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v3.1-V100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v3.2-A100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v3.2-v100.yaml
│   │   │           │   │   └── mathstral-sc-dpo-mscale300k-iter1-v1.0-H100.yaml
│   │   │           │   ├── mathstral-dpo-4o-iter0-v1.0-a100.yaml
│   │   │           │   ├── mathstral-dpo-4o-iter0-v1.1-a100.yaml
│   │   │           │   ├── mathstral-dpo-4o-iter0-v1.2-a100.yaml
│   │   │           │   ├── mathstral-dpo-full-v1.0-a100.yaml
│   │   │           │   ├── mathstral-dpo-split1-v1.0-a100.yaml
│   │   │           │   ├── mathstral-dpo-split1-v1.0-v100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v1.1-a100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v1.2-a100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v1.3-a100-40.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.0-A100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.1-A100-40-tp2.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.1-A100-40.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.1-H100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.1-V100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.2-V100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.2.1-H100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.2.2-A100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.3-H100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.4-H100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.4-V100.yaml
│   │   │           │   ├── mathstral-pdpo-sc-iter0-v1.0-H100.yaml
│   │   │           │   ├── mathstral-pdpo-sc-iter0-v1.1-H100.yaml
│   │   │           │   ├── mathstral-pdpo-sc-iter0-v2.0-H100.yaml
│   │   │           │   ├── mathstral-pdpo-sc-iter0-v2.1-A100.yaml
│   │   │           │   ├── ms-mistral-dpo-split1-v1.0-v100.yaml
│   │   │           │   ├── ms-mistral-dpo-split1-v1.1-v100.yaml
│   │   │           │   ├── ms-mistral-dpo-split1-v1.2-v100.yaml
│   │   │           │   ├── ms-mistral-dpo-split2-v1.0-v100.yaml
│   │   │           │   ├── ms-mistral-dpo-split2-v1.1-v100.yaml
│   │   │           │   └── reverse_order/
│   │   │           │       ├── mathstral-pre-sc-pdpo-4o-iter1-v1.0-H100.yaml
│   │   │           │       ├── mathstral-pre-sc-pdpo-4o-iter1-v1.0-V100.yaml
│   │   │           │       ├── mathstral-pre-sc-pdpo-mscale-iter1-v1.0-H100.yaml
│   │   │           │       ├── mathstral-pre-sc-pdpo-mscale-iter1-v1.1-H100.yaml
│   │   │           │       ├── mathstral-pre-sc-pdpo-mscale-iter1-v1.2-H100.yaml
│   │   │           │       ├── mathstral-pre-sc-pdpo-mscale-iter1-v1.3-H100-dp8.yaml
│   │   │           │       ├── mathstral-pre-sc-pdpo-mscale-iter1-v1.3-H100.yaml
│   │   │           │       ├── mathstral-pre-sc-pdpo-mscale-iter2-4o-gd-v1.0-H100-dp16.yaml
│   │   │           │       └── mathstral-pre-sc-pdpo-mscale-iter2-4o-gd-v1.1-H100-dp16.yaml
│   │   │           ├── reward/
│   │   │           │   └── iter1/
│   │   │           │       ├── mathstral-sc-prm-4o-iter1-v1.0-h100.yaml
│   │   │           │       ├── mathstral-sc-prm-4o-iter1-v1.0-v100.yaml
│   │   │           │       ├── mathstral-sc-prm-mscale-iter2-v1.0-v100.yaml
│   │   │           │       ├── mathstral-sc-prm-mscale-iter3-v1.0-v100.yaml
│   │   │           │       ├── process-rm-predict-flat.yaml
│   │   │           │       └── process-rm-predict-single.yaml
│   │   │           └── sft/
│   │   │               ├── co-half-0/
│   │   │               │   └── mathstral-mathscale4o-sft-v1.0-v100.yaml
│   │   │               ├── co-half-1/
│   │   │               │   └── mathstral-mathscale4o-sft-v1.0-v100.yaml
│   │   │               ├── iter1/
│   │   │               │   ├── mathstral-mathscale4o-raft-v1.0-h100.yaml
│   │   │               │   ├── mathstral-mathscale4o-raft-v1.1-a100-40.yaml
│   │   │               │   └── mathstral-mathscale4o-raft-v1.1-h100.yaml
│   │   │               ├── mathstral-mathscale4o-sft-v1.0-a100.yaml
│   │   │               ├── mathstral-mathscale4o-sft-v1.1-v100.yaml
│   │   │               ├── mathstral-mathscale4o-sft-v1.2-v100.yaml
│   │   │               ├── mathstral-mathscale4o-sft-v2.0-v100.yaml
│   │   │               └── mistral-mathscale4o-sft-v1.0-v100.yaml
│   │   ├── hydra/
│   │   │   └── default.yaml
│   │   └── post_process/
│   │       ├── deepseek.yaml
│   │       ├── gsm8k.yaml
│   │       ├── math.yaml
│   │       ├── openai_cot.yaml
│   │       └── openai_react.yaml
│   ├── data/
│   │   ├── apps.py
│   │   ├── code_contest.py
│   │   ├── combine_dataset.py
│   │   ├── deepseek_math_utils/
│   │   │   ├── answer_extraction.py
│   │   │   ├── eval_script.py
│   │   │   ├── eval_utils.py
│   │   │   └── ocwcourses_eval_utils.py
│   │   ├── general_collator.py
│   │   ├── human_eval.py
│   │   ├── input_aligner.py
│   │   ├── input_utils.py
│   │   ├── math.py
│   │   ├── math_reader.py
│   │   ├── math_util.py
│   │   ├── mathscale/
│   │   │   └── util.py
│   │   ├── numina_math.py
│   │   ├── openai_api_caller.py
│   │   ├── qwen25math/
│   │   │   ├── LICENSE
│   │   │   ├── README.md
│   │   │   ├── data_loader.py
│   │   │   ├── evaluate.py
│   │   │   ├── examples.py
│   │   │   ├── grader.py
│   │   │   ├── math_eval.py
│   │   │   ├── math_utils.py
│   │   │   ├── model_utils.py
│   │   │   ├── parser.py
│   │   │   ├── python_executor.py
│   │   │   ├── requirements.txt
│   │   │   ├── trajectory.py
│   │   │   └── utils.py
│   │   └── vllm.py
│   ├── eval/
│   │   ├── codex_humaneval/
│   │   │   ├── data.py
│   │   │   ├── evaluation.py
│   │   │   ├── execution.py
│   │   │   └── run_eval.py
│   │   ├── dispatch_openai_requests.py
│   │   ├── mbpp_eval/
│   │   │   ├── execute.py
│   │   │   ├── run_eval.py
│   │   │   └── utils.py
│   │   └── utils.py
│   ├── general_util/
│   │   ├── __init__.py
│   │   ├── average_meter.py
│   │   ├── dist_utils.py
│   │   ├── evaluator.py
│   │   ├── fs_tp_utils.py
│   │   ├── fsdp_utils.py
│   │   ├── lightseq_utils.py
│   │   ├── logger.py
│   │   ├── mixin.py
│   │   ├── mpu_proxy.py
│   │   ├── tensorboard_helper.py
│   │   ├── tokenization_utils.py
│   │   ├── torch_fsdp_utils.py
│   │   ├── training_utils.py
│   │   └── transformer_engine.py
│   ├── models/
│   │   ├── dpo_utils.py
│   │   ├── ds_utils.py
│   │   ├── fs_tp_mixin.py
│   │   ├── llama.py
│   │   ├── llama_megatron_tp.py
│   │   ├── llama_tp.py
│   │   ├── megatron_tp_mixin.py
│   │   ├── mistral.py
│   │   ├── mistral_tp.py
│   │   ├── mixin.py
│   │   ├── qwen2.py
│   │   ├── qwen2_megatron_tp.py
│   │   ├── qwen2_tp.py
│   │   └── utils.py
│   ├── openai_api_caller_v1.py
│   ├── post_inference.py
│   ├── post_processors/
│   │   ├── code/
│   │   │   ├── clean.py
│   │   │   ├── code.py
│   │   │   └── evaluator.py
│   │   ├── dist_mixin.py
│   │   ├── dpo.py
│   │   ├── openai_api_callback.py
│   │   ├── pattern/
│   │   │   └── tags.py
│   │   └── qwen25_math_callback.py
│   ├── prompts/
│   │   ├── apps/
│   │   │   ├── critique_0shot_v1.0.txt
│   │   │   ├── magicoder_cls_2shot.txt
│   │   │   ├── r2c_prompt_0shot_v1.0.txt
│   │   │   ├── r2c_prompt_1shot_v1.0.txt
│   │   │   ├── test_case_simulate.v1.0.txt
│   │   │   ├── test_input_gen_0shot_v1.0.txt
│   │   │   ├── test_input_gen_2shot_v2.0.txt
│   │   │   ├── test_input_gen_2shot_v2.1.txt
│   │   │   ├── worsen_0shot_v1.0.txt
│   │   │   └── worsen_from_feedback_0shot_v1.0.txt
│   │   ├── human_eval/
│   │   │   ├── ds_coder_prompt_v1_0.txt
│   │   │   ├── r2c_prompt_0shot_v1.0.txt
│   │   │   ├── r2c_prompt_0shot_v1.1.txt
│   │   │   ├── r2c_prompt_0shot_v1.2.txt
│   │   │   └── r2c_prompt_0shot_v1.3.txt
│   │   ├── magicoder/
│   │   │   ├── oss_has_function_head_v1_0.txt
│   │   │   └── test_input_gen_2shot_v1.0.txt
│   │   ├── math/
│   │   │   └── college_math_4shot.txt
│   │   └── mbpp/
│   │       ├── r2c_prompt_0shot_v1.0.txt
│   │       ├── r2c_prompt_3shot_v1.0.txt
│   │       └── r2c_prompt_3shot_v2.0.txt
│   ├── requirements.txt
│   ├── scripts/
│   │   ├── __init__.py
│   │   ├── apps/
│   │   │   ├── __init__.py
│   │   │   ├── analyze/
│   │   │   │   ├── freq2image.py
│   │   │   │   ├── get_output_frequency.py
│   │   │   │   └── pipeline.sh
│   │   │   ├── code_flaw/
│   │   │   │   └── pipeline_v1.0.sh
│   │   │   ├── construct_prefer_pair.py
│   │   │   ├── construct_prefer_pair_rm.py
│   │   │   ├── construct_prefer_pair_soft.py
│   │   │   ├── eval_gpt4_outputs.py
│   │   │   ├── execute_gold_sol_on_test_case.py
│   │   │   ├── execute_gold_sol_on_test_case.sh
│   │   │   ├── extract_pseudo_outputs_as_label.py
│   │   │   ├── get_output_frequency.py
│   │   │   ├── gpt4o_to_normal_pred_format.py
│   │   │   ├── merge_dp_predictions.py
│   │   │   ├── merge_dp_solutions.sh
│   │   │   ├── pp_critique_difficulty.py
│   │   │   ├── pp_eval_gpt4.py
│   │   │   ├── pp_eval_gpt4_general_combine.py
│   │   │   ├── pp_solution_gen_inputs.py
│   │   │   ├── pp_test_case.py
│   │   │   ├── pp_test_case_gen_inputs.py
│   │   │   ├── pp_test_case_gen_inputs_v2.0.py
│   │   │   ├── pp_test_case_gen_outputs.py
│   │   │   ├── pp_test_case_gen_public_outputs.py
│   │   │   ├── pp_test_case_gen_public_outputs_few_shot.py
│   │   │   ├── pp_test_case_gen_public_outputs_few_shot_verify.py
│   │   │   ├── pp_worsen_inputs.py
│   │   │   ├── prm/
│   │   │   │   ├── construct_process_rm_sample.py
│   │   │   │   ├── construct_process_rm_sample_fix.py
│   │   │   │   └── sample_steps.py
│   │   │   ├── pseudo_test_cases/
│   │   │   │   ├── 4o_pseudo_baseline.sh
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── clean_oss_mistral_data.py
│   │   │   │   ├── clean_xcode_4o_test_inputs_data.py
│   │   │   │   ├── collect_pseudo_outputs.py
│   │   │   │   ├── combine_gpt_raw_requests.py
│   │   │   │   ├── combine_pseudo_test_inputs.py
│   │   │   │   ├── construct_dpo_pairs.sh
│   │   │   │   ├── control_test_case_num_baseline.sh
│   │   │   │   ├── control_test_case_num_baseline_pipeline.sh
│   │   │   │   ├── extract_4o_combine_outputs_as_label.sh
│   │   │   │   ├── oss_combine_collect_pseudo_outputs.py
│   │   │   │   ├── oss_combine_collect_pseudo_outputs_mp.py
│   │   │   │   ├── oss_combine_collect_pseudo_outputs_mp_compress.py
│   │   │   │   ├── oss_combine_collect_pseudo_outputs_takes_extra.py
│   │   │   │   ├── oss_combine_prefix_fail_extract_pseudo_label.py
│   │   │   │   ├── oss_combine_run_extract_pseudo_label.py
│   │   │   │   ├── pipeline.sh
│   │   │   │   ├── pp_inputs_pick_problem_evol.py
│   │   │   │   ├── pp_inputs_pick_problem_oss.py
│   │   │   │   ├── prefix_fail_extract_pseudo_label.py
│   │   │   │   ├── prefix_fail_extract_pseudo_label_align_ts_num.py
│   │   │   │   ├── run_outputs_local.sh
│   │   │   │   ├── xcode_pipeline.sh
│   │   │   │   └── xcode_pp_test_case_gen.py
│   │   │   ├── re_verify_solutions.py
│   │   │   ├── rerank_code_rm.py
│   │   │   ├── solution_fail_extract.py
│   │   │   ├── solution_fail_extract_critique.py
│   │   │   ├── solution_fail_extract_pseudo_label.py
│   │   │   ├── solution_run_outputs.py
│   │   │   ├── solution_run_outputs_local.py
│   │   │   ├── solution_run_pseudo_outputs_local.py
│   │   │   ├── utils_execute.py
│   │   │   └── worsen_gpt4_combine.py
│   │   ├── collect_mbpp_test_cases_outputs_sc_v1.0.py
│   │   ├── eval_mbpp_judgement.py
│   │   ├── eval_mbpp_judgement_v2.py
│   │   ├── execute_mbpp_intermediate_res.py
│   │   ├── execute_mbpp_intermediate_res_mp.py
│   │   ├── inference/
│   │   │   └── vllm_dp_mul_node.sh
│   │   ├── math/
│   │   │   ├── analyze_sc.py
│   │   │   ├── deepseek_math_sample_steps.py
│   │   │   ├── estimate_state_value.py
│   │   │   ├── merge_dp_multi_solution.py
│   │   │   ├── merge_dp_predictions.py
│   │   │   ├── merge_dp_predictions.sh
│   │   │   ├── merge_incomplete_predictions.py
│   │   │   ├── merge_rm_dp_multi_solution.py
│   │   │   ├── rerank_w_orm.py
│   │   │   ├── rerank_w_prm.py
│   │   │   └── rerank_w_prm_combine.py
│   │   ├── math_scale/
│   │   │   ├── __init__.py
│   │   │   ├── analyze/
│   │   │   │   ├── compute_acc_by_id.py
│   │   │   │   ├── draw_sc.py
│   │   │   │   ├── extract_hard_questions.py
│   │   │   │   ├── freq2image.py
│   │   │   │   ├── get_output_frequency.py
│   │   │   │   ├── hard_change.sh
│   │   │   │   └── pipeline.sh
│   │   │   ├── concat_data.py
│   │   │   ├── construct_prefer_pair.py
│   │   │   ├── construct_prefer_pair_sc.py
│   │   │   ├── construct_prm_pair.sh
│   │   │   ├── construct_process_rm_sample_gd.py
│   │   │   ├── construct_process_rm_sample_sc.py
│   │   │   ├── exclude_unused_data.py
│   │   │   ├── extract_content_from_orig_format.py
│   │   │   ├── extract_mathscale_v2_box_answer.py
│   │   │   ├── extract_numina_math_box_answer.py
│   │   │   ├── fix_answer_extract_and_verify.py
│   │   │   ├── fix_answer_extract_and_verify_v2.py
│   │   │   ├── llama_numina_co_train/
│   │   │   │   ├── construct_prm_sc_pair.sh
│   │   │   │   └── pipeline.sh
│   │   │   ├── math_scale_offline_gpt_eval.py
│   │   │   ├── mathstral_mathscale_co_train/
│   │   │   │   ├── construct_prm_gd_pair.sh
│   │   │   │   ├── construct_prm_sc_pair.sh
│   │   │   │   └── pipeline.sh
│   │   │   ├── merge_dp_predictions.py
│   │   │   ├── merge_dp_predictions.sh
│   │   │   ├── merge_dp_seed_predictions.py
│   │   │   ├── merge_dp_seed_predictions_by_split.sh
│   │   │   ├── merge_math500_predictions.sh
│   │   │   ├── merge_mwpbench_predictions.sh
│   │   │   ├── merge_mwpbench_sympy_predictions.sh
│   │   │   ├── merge_qwen2_dp_math_dev_predictions_v0.0.sh
│   │   │   ├── merge_qwen2_dp_math_dev_predictions_v1.3.sh
│   │   │   ├── merge_qwen2_dp_predictions_v1.1.sh
│   │   │   ├── merge_qwen2_dp_predictions_v1.2.sh
│   │   │   ├── merge_qwen2_dp_predictions_v1.3.sh
│   │   │   ├── mscale/
│   │   │   │   ├── 4o_pipeline.sh
│   │   │   │   ├── construct_prm_sc_pair.sh
│   │   │   │   ├── pipeline.sh
│   │   │   │   └── rerank.sh
│   │   │   ├── pipeline.sh
│   │   │   ├── pp_gpt_inputs.py
│   │   │   ├── process_4o.py
│   │   │   ├── process_raw_4o.py
│   │   │   ├── process_raw_4o_labeling.py
│   │   │   ├── qwen25math_style_eval.py
│   │   │   ├── qwen25math_style_eval.sh
│   │   │   ├── qwen25math_style_eval_math.py
│   │   │   ├── qwen25math_style_eval_v2.0.py
│   │   │   ├── qwen25math_style_preprocess_pred_label.py
│   │   │   ├── reject_sampling_pipeline.sh
│   │   │   ├── rerank_w_prm_math.py
│   │   │   ├── rerank_w_prm_math_scale_save.py
│   │   │   ├── rerank_w_prm_math_scale_save_pair.py
│   │   │   ├── rerank_w_prm_math_scale_save_pair_margin.py
│   │   │   └── split_data.py
│   │   ├── mbpp/
│   │   │   ├── eval_human_eval_gpt_outputs.py
│   │   │   ├── eval_mbpp_gpt_outputs.py
│   │   │   ├── pp_eval_gpt4_human_eval.py
│   │   │   ├── pp_eval_gpt4_mbpp.py
│   │   │   ├── prepare_mbpp_test_cases_inputs_v1.0.py
│   │   │   ├── print_human_eval_mbpp_res.sh
│   │   │   ├── process_mbpp_test_cases_inputs.py
│   │   │   └── run_test_case_v1.0.py
│   │   ├── model_converts/
│   │   │   ├── llama_hf_mp_split.py
│   │   │   └── pad_model_embedding.py
│   │   ├── prepare_code_contests_decompose.py
│   │   ├── prepare_code_contests_decompose_verification.py
│   │   ├── prepare_code_contests_decompose_verification_v2.0.py
│   │   ├── prepare_code_contests_judgement.py
│   │   ├── prepare_mbpp_desc2code_inputs_v1.0.py
│   │   ├── prepare_mbpp_inputs_v1.0.py
│   │   ├── prepare_mbpp_intermediate_print_v1.0.py
│   │   ├── prepare_mbpp_predict_judgement.py
│   │   ├── prepare_mbpp_test_cases_inputs_v1.0.py
│   │   ├── prepare_mbpp_test_cases_outputs_v1.0.py
│   │   ├── prepare_mbpp_test_cases_outputs_v1.1.py
│   │   ├── split_data_according_to_id.py
│   │   └── verify_mbpp_test_cases.py
│   ├── service_api_caller_v1.py
│   ├── trainer_base_ds_mul_fs_tp.py
│   ├── trainer_ds_megatron_mul.py
│   ├── visualize/
│   │   ├── length_distribution.py
│   │   ├── reward_histogram.py
│   │   └── test_response_length.py
│   ├── vllm_inference.py
│   └── vllm_inference_dp.py
├── README.md
├── ReSA/
│   ├── README.md
│   ├── figures/
│   │   └── figure.py
│   ├── llm/
│   │   ├── __init__.py
│   │   ├── arch/
│   │   │   ├── __init__.py
│   │   │   ├── context_manager.py
│   │   │   └── model.py
│   │   ├── config.py
│   │   ├── data/
│   │   │   └── tokenizer.py
│   │   ├── eval.py
│   │   ├── eval_math.py
│   │   ├── kernel/
│   │   │   ├── __init__.py
│   │   │   ├── flash_attention_with_kv_cache.py
│   │   │   ├── flash_sparse_decoding.py
│   │   │   ├── rotary.py
│   │   │   ├── tilelang_attention_with_kv_cache.py
│   │   │   └── tilelang_sparse_decoding.py
│   │   └── utils/
│   │       └── math_utils.py
│   ├── math_data/
│   │   ├── aime24/
│   │   │   └── test.jsonl
│   │   ├── amc23/
│   │   │   └── test.jsonl
│   │   ├── aqua/
│   │   │   └── test.jsonl
│   │   ├── asdiv/
│   │   │   └── test.jsonl
│   │   ├── carp_en/
│   │   │   ├── demo.json
│   │   │   └── test.jsonl
│   │   ├── cmath/
│   │   │   └── test.jsonl
│   │   ├── cn_middle_school/
│   │   │   └── test.jsonl
│   │   ├── college_math/
│   │   │   └── test.jsonl
│   │   ├── eval_rm_maj_example/
│   │   │   └── math_cot_100.jsonl
│   │   ├── gaokao2023en/
│   │   │   └── test.jsonl
│   │   ├── gaokao2024_I/
│   │   │   └── test.jsonl
│   │   ├── gaokao2024_II/
│   │   │   └── test.jsonl
│   │   ├── gaokao2024_mix/
│   │   │   └── test.jsonl
│   │   ├── gaokao_math_cloze/
│   │   │   └── test.jsonl
│   │   ├── gaokao_math_qa/
│   │   │   └── test.jsonl
│   │   ├── gsm8k/
│   │   │   ├── test.jsonl
│   │   │   └── train.jsonl
│   │   ├── math/
│   │   │   ├── test.jsonl
│   │   │   └── train.jsonl
│   │   ├── mawps/
│   │   │   ├── addsub.jsonl
│   │   │   ├── multiarith.jsonl
│   │   │   ├── singleeq.jsonl
│   │   │   ├── singleop.jsonl
│   │   │   └── test.jsonl
│   │   ├── minerva_math/
│   │   │   ├── README.md
│   │   │   └── test.jsonl
│   │   ├── mmlu_stem/
│   │   │   └── test.jsonl
│   │   ├── olympiadbench/
│   │   │   ├── test.json
│   │   │   └── test.jsonl
│   │   ├── sat_math/
│   │   │   └── test.jsonl
│   │   ├── svamp/
│   │   │   └── test.jsonl
│   │   └── tabmwp/
│   │       └── test.jsonl
│   └── scripts/
│       ├── local_eval_math.sh
│       ├── math_eval_result.sh
│       ├── math_eval_result_length.py
│       ├── math_utils.py
│       └── setup_math_eval.sh
├── SECURITY.md
├── YOCO/
│   ├── README.md
│   ├── requirements.txt
│   ├── scripts/
│   │   ├── eval_needle.sh
│   │   ├── eval_task.sh
│   │   └── train.sh
│   └── yoco/
│       ├── __init__.py
│       ├── criterions/
│       │   ├── __init__.py
│       │   ├── harness_eval.py
│       │   ├── multi_needle.py
│       │   └── needle_haystack.py
│       ├── models/
│       │   ├── __init__.py
│       │   ├── decoder/
│       │   │   ├── __init__.py
│       │   │   ├── cross_attention.py
│       │   │   ├── feedforward_network.py
│       │   │   ├── gate_retention.py
│       │   │   ├── kernel/
│       │   │   │   ├── gate_recurrent.py
│       │   │   │   ├── rotary.py
│       │   │   │   └── swiglu.py
│       │   │   ├── model_parallel_init.py
│       │   │   ├── rms_norm.py
│       │   │   ├── sliding_window_attention.py
│       │   │   ├── transformer.py
│       │   │   └── yoco.py
│       │   ├── transformer.py
│       │   └── yoco.py
│       ├── tasks/
│       │   ├── __init__.py
│       │   ├── data/
│       │   │   ├── __init__.py
│       │   │   ├── basic_loader.py
│       │   │   ├── llama_tokenizer.py
│       │   │   ├── lm_loader.py
│       │   │   ├── tiktoken_tokenizer.py
│       │   │   └── utils.py
│       │   ├── gpt.py
│       │   ├── harness_eval.py
│       │   ├── harness_task.py
│       │   ├── mmlu_task.py
│       │   └── pseudo.py
│       ├── train.py
│       └── validate.py
├── adalm/
│   ├── README.md
│   ├── finetune/
│   │   ├── __init__.py
│   │   ├── run_classifier.py
│   │   ├── run_ner.py
│   │   ├── run_pico.py
│   │   ├── utils_for_glue.py
│   │   └── utils_ner.py
│   ├── incr_bpe/
│   │   ├── README.md
│   │   ├── subword_builder.py
│   │   ├── test_data/
│   │   │   ├── chem.txt
│   │   │   └── vocab.txt
│   │   ├── text_encoder.py
│   │   ├── tokenizer.py
│   │   └── vocab_extend.py
│   ├── requirements.txt
│   └── setup.py
├── beats/
│   ├── BEATs.py
│   ├── README.md
│   ├── Tokenizers.py
│   ├── backbone.py
│   ├── beats_README.md
│   ├── modules.py
│   └── quantizer.py
├── beit/
│   ├── .gitignore
│   ├── README.md
│   ├── dall_e/
│   │   ├── __init__.py
│   │   ├── decoder.py
│   │   ├── encoder.py
│   │   └── utils.py
│   ├── dataset_folder.py
│   ├── datasets.py
│   ├── engine_for_finetuning.py
│   ├── engine_for_pretraining.py
│   ├── get_started_for_image_classification.md
│   ├── masking_generator.py
│   ├── modeling_discrete_vae.py
│   ├── modeling_finetune.py
│   ├── modeling_pretrain.py
│   ├── optim_factory.py
│   ├── requirements.txt
│   ├── run_beit_pretraining.py
│   ├── run_class_finetuning.py
│   ├── run_linear_eval.py
│   ├── semantic_segmentation/
│   │   ├── README.md
│   │   ├── backbone/
│   │   │   └── beit.py
│   │   ├── configs/
│   │   │   ├── _base_/
│   │   │   │   ├── datasets/
│   │   │   │   │   ├── ade20k.py
│   │   │   │   │   └── ade20k_640x640.py
│   │   │   │   ├── default_runtime.py
│   │   │   │   ├── models/
│   │   │   │   │   └── upernet_beit.py
│   │   │   │   └── schedules/
│   │   │   │       ├── schedule_160k.py
│   │   │   │       └── schedule_320k.py
│   │   │   └── beit/
│   │   │       └── upernet/
│   │   │           ├── upernet_beit_base_12_512_slide_160k_ade20k_ms.py
│   │   │           ├── upernet_beit_base_12_512_slide_160k_ade20k_pt.py
│   │   │           ├── upernet_beit_base_12_512_slide_160k_ade20k_pt2ft.py
│   │   │           ├── upernet_beit_base_12_640_slide_160k_ade20k_ms.py
│   │   │           ├── upernet_beit_base_12_640_slide_160k_ade20k_pt2ft.py
│   │   │           ├── upernet_beit_large_24_512_slide_160k_ade20k_ms.py
│   │   │           ├── upernet_beit_large_24_512_slide_160k_ade20k_pt2ft.py
│   │   │           ├── upernet_beit_large_24_640_slide_160k_ade20k_ms.py
│   │   │           └── upernet_beit_large_24_640_slide_160k_ade20k_pt2ft.py
│   │   ├── mmcv_custom/
│   │   │   ├── __init__.py
│   │   │   ├── apex_runner/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── apex_iter_based_runner.py
│   │   │   │   ├── checkpoint.py
│   │   │   │   └── optimizer.py
│   │   │   ├── checkpoint.py
│   │   │   ├── layer_decay_optimizer_constructor.py
│   │   │   ├── resize_transform.py
│   │   │   └── train_api.py
│   │   └── tools/
│   │       ├── dist_test.sh
│   │       ├── dist_train.sh
│   │       ├── test.py
│   │       └── train.py
│   ├── transforms.py
│   └── utils.py
├── beit2/
│   ├── .gitignore
│   ├── PRETRAINING.md
│   ├── README.md
│   ├── TOKENIZER.md
│   ├── dataset_folder.py
│   ├── datasets.py
│   ├── engine_for_finetuning.py
│   ├── engine_for_pretraining.py
│   ├── engine_for_vqkd.py
│   ├── get_started_for_image_classification.md
│   ├── imagenet_a_r_indices.py
│   ├── masking_generator.py
│   ├── modeling_finetune.py
│   ├── modeling_pretrain.py
│   ├── modeling_vqkd.py
│   ├── norm_ema_quantizer.py
│   ├── optim_factory.py
│   ├── requirements.txt
│   ├── run_beitv2_pretraining.py
│   ├── run_class_finetuning.py
│   ├── run_vqkd_training.py
│   ├── semantic_segmentation/
│   │   ├── README.md
│   │   ├── backbone/
│   │   │   └── beit.py
│   │   ├── configs/
│   │   │   ├── _base_/
│   │   │   │   ├── datasets/
│   │   │   │   │   ├── ade20k.py
│   │   │   │   │   └── ade20k_640x640.py
│   │   │   │   ├── default_runtime.py
│   │   │   │   ├── models/
│   │   │   │   │   └── upernet_beit.py
│   │   │   │   └── schedules/
│   │   │   │       ├── schedule_160k.py
│   │   │   │       └── schedule_320k.py
│   │   │   └── beit/
│   │   │       └── upernet/
│   │   │           ├── upernet_beit_base_12_512_slide_160k_21ktoade20k.py
│   │   │           ├── upernet_beit_base_12_512_slide_160k_ade20k.py
│   │   │           ├── upernet_beit_large_24_512_slide_160k_21ktoade20k.py
│   │   │           └── upernet_beit_large_24_512_slide_160k_ade20k.py
│   │   ├── mmcv_custom/
│   │   │   ├── __init__.py
│   │   │   ├── apex_runner/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── apex_iter_based_runner.py
│   │   │   │   ├── checkpoint.py
│   │   │   │   └── optimizer.py
│   │   │   ├── checkpoint.py
│   │   │   ├── layer_decay_optimizer_constructor.py
│   │   │   ├── resize_transform.py
│   │   │   └── train_api.py
│   │   └── tools/
│   │       ├── dist_test.sh
│   │       ├── dist_train.sh
│   │       ├── test.py
│   │       └── train.py
│   ├── test_get_code.py
│   ├── transforms.py
│   ├── utils.py
│   ├── visualize_attention.py
│   └── vqkd_teacher/
│       ├── __init__.py
│       ├── clip/
│       │   ├── __init__.py
│       │   ├── clip.py
│       │   ├── model.py
│       │   └── simple_tokenizer.py
│       └── dino.py
├── beit3/
│   ├── README.md
│   ├── datasets.py
│   ├── engine_for_finetuning.py
│   ├── get_started/
│   │   ├── get_started_for_captioning.md
│   │   ├── get_started_for_image_classification.md
│   │   ├── get_started_for_nlvr2.md
│   │   ├── get_started_for_retrieval.md
│   │   └── get_started_for_vqav2.md
│   ├── glossary.py
│   ├── modeling_finetune.py
│   ├── modeling_utils.py
│   ├── optim_factory.py
│   ├── randaug.py
│   ├── requirements.txt
│   ├── run_beit3_finetuning.py
│   └── utils.py
├── bitnet/
│   └── README.md
├── decoding/
│   ├── GAD/
│   │   ├── block_plugins/
│   │   │   ├── __init__.py
│   │   │   ├── criterions/
│   │   │   │   ├── __init__.py
│   │   │   │   └── glat_loss.py
│   │   │   ├── models/
│   │   │   │   ├── BlockNAT.py
│   │   │   │   └── __init__.py
│   │   │   └── tasks/
│   │   │       ├── __init__.py
│   │   │       └── translation_lev_modified.py
│   │   ├── data/
│   │   │   ├── test.de.compound.ref
│   │   │   ├── wmt14.en-de/
│   │   │   │   ├── bpe.32000
│   │   │   │   ├── dict.de.txt
│   │   │   │   └── dict.en.txt
│   │   │   └── wmt16.en-ro/
│   │   │       ├── dict.en.txt
│   │   │       ├── dict.ro.txt
│   │   │       └── get_data.sh
│   │   ├── fairseq/
│   │   │   ├── __init__.py
│   │   │   ├── benchmark/
│   │   │   │   ├── __init__.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
│   │   │   │   ├── 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
│   │   │   │       ├── wav2vec/
│   │   │   │       │   └── vq_wav2vec_gumbel.yaml
│   │   │   │       └── wav2vec2/
│   │   │   │           ├── wav2vec2_base.yaml
│   │   │   │           └── wav2vec2_large.yaml
│   │   │   ├── criterions/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── adaptive_loss.py
│   │   │   │   ├── composite_loss.py
│   │   │   │   ├── cross_entropy.py
│   │   │   │   ├── ctc.py
│   │   │   │   ├── fairseq_criterion.py
│   │   │   │   ├── label_smoothed_cross_entropy.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
│   │   │   ├── data/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── add_target_dataset.py
│   │   │   │   ├── append_token_dataset.py
│   │   │   │   ├── audio/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── audio_utils.py
│   │   │   │   │   ├── feature_transforms/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── global_cmvn.py
│   │   │   │   │   │   ├── specaugment.py
│   │   │   │   │   │   └── utterance_cmvn.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.pyx
│   │   │   │   ├── denoising_dataset.py
│   │   │   │   ├── dictionary.py
│   │   │   │   ├── encoders/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── 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
│   │   │   │   │   ├── 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
│   │   │   │   │   ├── 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.pyx
│   │   │   │   ├── transform_eos_dataset.py
│   │   │   │   └── transform_eos_lang_pair_dataset.py
│   │   │   ├── dataclass/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── configs.py
│   │   │   │   ├── constants.py
│   │   │   │   ├── initialize.py
│   │   │   │   └── utils.py
│   │   │   ├── distributed/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── distributed_timeout_wrapper.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
│   │   │   ├── logging/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── meters.py
│   │   │   │   ├── metrics.py
│   │   │   │   └── progress_bar.py
│   │   │   ├── model_parallel/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── criterions/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── vocab_parallel_cross_entropy.py
│   │   │   │   ├── megatron_trainer.py
│   │   │   │   ├── models/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── pipeline_parallel_transformer/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── layers.py
│   │   │   │   │   │   └── model.py
│   │   │   │   │   ├── roberta/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   └── model.py
│   │   │   │   │   ├── transformer.py
│   │   │   │   │   └── transformer_lm.py
│   │   │   │   └── modules/
│   │   │   │       ├── __init__.py
│   │   │   │       ├── multihead_attention.py
│   │   │   │       └── transformer_layer.py
│   │   │   ├── models/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── bart/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── 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
│   │   │   │   ├── huggingface/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── 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
│   │   │   │   │   ├── fairseq_nat_model.py
│   │   │   │   │   ├── nonautoregressive_ensembles.py
│   │   │   │   │   └── nonautoregressive_transformer.py
│   │   │   │   ├── roberta/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── alignment_utils.py
│   │   │   │   │   ├── hub_interface.py
│   │   │   │   │   ├── model.py
│   │   │   │   │   ├── model_camembert.py
│   │   │   │   │   ├── model_gottbert.py
│   │   │   │   │   └── model_xlmr.py
│   │   │   │   ├── speech_to_text/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── berard.py
│   │   │   │   │   ├── convtransformer.py
│   │   │   │   │   └── s2t_transformer.py
│   │   │   │   ├── transformer.py
│   │   │   │   ├── transformer_align.py
│   │   │   │   ├── transformer_from_pretrained_xlm.py
│   │   │   │   ├── transformer_lm.py
│   │   │   │   └── wav2vec/
│   │   │   │       ├── __init__.py
│   │   │   │       ├── wav2vec.py
│   │   │   │       ├── wav2vec2.py
│   │   │   │       └── wav2vec2_asr.py
│   │   │   ├── modules/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── 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
│   │   │   │   ├── multihead_attention.py
│   │   │   │   ├── positional_embedding.py
│   │   │   │   ├── quant_noise.py
│   │   │   │   ├── quantization/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── pq/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── em.py
│   │   │   │   │   │   ├── modules/
│   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   ├── qconv.py
│   │   │   │   │   │   │   ├── qemb.py
│   │   │   │   │   │   │   └── qlinear.py
│   │   │   │   │   │   ├── pq.py
│   │   │   │   │   │   └── utils.py
│   │   │   │   │   ├── quantization_options.py
│   │   │   │   │   └── scalar/
│   │   │   │   │       ├── __init__.py
│   │   │   │   │       ├── modules/
│   │   │   │   │       │   ├── __init__.py
│   │   │   │   │       │   ├── 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
│   │   │   │   ├── adadelta.py
│   │   │   │   ├── adafactor.py
│   │   │   │   ├── adagrad.py
│   │   │   │   ├── adam.py
│   │   │   │   ├── adamax.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
│   │   │   │   │   ├── 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
│   │   │   │   ├── bleu.py
│   │   │   │   ├── chrf.py
│   │   │   │   ├── tokenizer.py
│   │   │   │   └── wer.py
│   │   │   ├── search.py
│   │   │   ├── sequence_generator.py
│   │   │   ├── sequence_scorer.py
│   │   │   ├── tasks/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── audio_pretraining.py
│   │   │   │   ├── cross_lingual_lm.py
│   │   │   │   ├── denoising.py
│   │   │   │   ├── fairseq_task.py
│   │   │   │   ├── language_modeling.py
│   │   │   │   ├── legacy_masked_lm.py
│   │   │   │   ├── masked_lm.py
│   │   │   │   ├── multilingual_denoising.py
│   │   │   │   ├── multilingual_masked_lm.py
│   │   │   │   ├── multilingual_translation.py
│   │   │   │   ├── semisupervised_translation.py
│   │   │   │   ├── sentence_prediction.py
│   │   │   │   ├── sentence_ranking.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
│   │   │   ├── eval_lm.py
│   │   │   ├── generate.py
│   │   │   ├── hydra_train.py
│   │   │   ├── interactive.py
│   │   │   ├── preprocess.py
│   │   │   ├── score.py
│   │   │   ├── train.py
│   │   │   └── validate.py
│   │   ├── hubconf.py
│   │   ├── inference.py
│   │   ├── inference.sh
│   │   ├── inference_paper.py
│   │   ├── pyproject.toml
│   │   ├── readme.md
│   │   ├── ref.sh
│   │   ├── 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
│   │   ├── setup.py
│   │   ├── train.py
│   │   └── train.sh
│   ├── IAD/
│   │   ├── README.md
│   │   ├── fairseq/
│   │   │   ├── .github/
│   │   │   │   ├── ISSUE_TEMPLATE/
│   │   │   │   │   ├── bug_report.md
│   │   │   │   │   ├── documentation.md
│   │   │   │   │   ├── feature_request.md
│   │   │   │   │   └── how-to-question.md
│   │   │   │   ├── ISSUE_TEMPLATE.md
│   │   │   │   ├── PULL_REQUEST_TEMPLATE.md
│   │   │   │   ├── stale.yml
│   │   │   │   └── workflows/
│   │   │   │       ├── build.yml
│   │   │   │       └── build_wheels.yml
│   │   │   ├── .gitignore
│   │   │   ├── .gitmodules
│   │   │   ├── CODE_OF_CONDUCT.md
│   │   │   ├── CONTRIBUTING.md
│   │   │   ├── LICENSE
│   │   │   ├── README.md
│   │   │   ├── README_FAIRSEQ.md
│   │   │   ├── docs/
│   │   │   │   ├── Makefile
│   │   │   │   ├── _static/
│   │   │   │   │   └── theme_overrides.css
│   │   │   │   ├── command_line_tools.rst
│   │   │   │   ├── conf.py
│   │   │   │   ├── criterions.rst
│   │   │   │   ├── data.rst
│   │   │   │   ├── docutils.conf
│   │   │   │   ├── 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
│   │   │   │   ├── 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
│   │   │   │   ├── 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
│   │   │   │   ├── gottbert/
│   │   │   │   │   └── README.md
│   │   │   │   ├── 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
│   │   │   │   ├── 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
│   │   │   │   │   ├── 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
│   │   │   │   │   ├── criterions/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   └── label_smoothed_cross_entropy_latency_augmented.py
│   │   │   │   │   ├── docs/
│   │   │   │   │   │   ├── baseline.md
│   │   │   │   │   │   └── evaluation.md
│   │   │   │   │   ├── eval/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── agents/
│   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   ├── agent.py
│   │   │   │   │   │   │   ├── simul_trans_agent.py
│   │   │   │   │   │   │   ├── simul_trans_text_agent.py
│   │   │   │   │   │   │   └── word_splitter.py
│   │   │   │   │   │   ├── client.py
│   │   │   │   │   │   ├── eval_latency.py
│   │   │   │   │   │   ├── evaluate.py
│   │   │   │   │   │   ├── scorers/
│   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   ├── scorer.py
│   │   │   │   │   │   │   └── text_scorer.py
│   │   │   │   │   │   └── server.py
│   │   │   │   │   ├── models/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   └── transformer_monotonic_attention.py
│   │   │   │   │   ├── modules/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── monotonic_multihead_attention.py
│   │   │   │   │   │   └── monotonic_transformer_layer.py
│   │   │   │   │   └── utils/
│   │   │   │   │       ├── __init__.py
│   │   │   │   │       ├── functions.py
│   │   │   │   │       └── latency.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
│   │   │   │   │   ├── models/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── vggtransformer.py
│   │   │   │   │   │   └── w2l_conv_glu_enc.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
│   │   │   │   │   │   └── mustc_example.md
│   │   │   │   │   ├── prep_covost_data.py
│   │   │   │   │   ├── prep_librispeech_data.py
│   │   │   │   │   └── prep_mustc_data.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
│   │   │   │   ├── wav2vec/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── config/
│   │   │   │   │   │   ├── finetuning/
│   │   │   │   │   │   │   ├── base_100h.yaml
│   │   │   │   │   │   │   ├── base_10h.yaml
│   │   │   │   │   │   │   ├── base_10m.yaml
│   │   │   │   │   │   │   ├── base_1h.yaml
│   │   │   │   │   │   │   ├── base_960h.yaml
│   │   │   │   │   │   │   ├── vox_100h.yaml
│   │   │   │   │   │   │   ├── vox_10h.yaml
│   │   │   │   │   │   │   ├── vox_10m.yaml
│   │   │   │   │   │   │   ├── vox_1h.yaml
│   │   │   │   │   │   │   └── vox_960h.yaml
│   │   │   │   │   │   └── pretraining/
│   │   │   │   │   │       ├── wav2vec2_base_librispeech.yaml
│   │   │   │   │   │       └── wav2vec2_large_librivox.yaml
│   │   │   │   │   ├── libri_labels.py
│   │   │   │   │   ├── vq-wav2vec_featurize.py
│   │   │   │   │   ├── wav2vec_featurize.py
│   │   │   │   │   └── wav2vec_manifest.py
│   │   │   │   ├── wmt19/
│   │   │   │   │   └── README.md
│   │   │   │   ├── wmt20/
│   │   │   │   │   └── README.md
│   │   │   │   └── xlmr/
│   │   │   │       └── README.md
│   │   │   ├── fairseq/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── benchmark/
│   │   │   │   │   ├── __init__.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
│   │   │   │   │   ├── 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
│   │   │   │   │       ├── wav2vec/
│   │   │   │   │       │   └── vq_wav2vec_gumbel.yaml
│   │   │   │   │       └── wav2vec2/
│   │   │   │   │           ├── wav2vec2_base.yaml
│   │   │   │   │           └── wav2vec2_large.yaml
│   │   │   │   ├── criterions/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── adaptive_loss.py
│   │   │   │   │   ├── composite_loss.py
│   │   │   │   │   ├── cross_entropy.py
│   │   │   │   │   ├── ctc.py
│   │   │   │   │   ├── fairseq_criterion.py
│   │   │   │   │   ├── label_smoothed_cross_entropy.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
│   │   │   │   ├── data/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── add_target_dataset.py
│   │   │   │   │   ├── append_token_dataset.py
│   │   │   │   │   ├── audio/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── audio_utils.py
│   │   │   │   │   │   ├── feature_transforms/
│   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   ├── global_cmvn.py
│   │   │   │   │   │   │   ├── specaugment.py
│   │   │   │   │   │   │   └── utterance_cmvn.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.pyx
│   │   │   │   │   ├── denoising_dataset.py
│   │   │   │   │   ├── dictionary.py
│   │   │   │   │   ├── encoders/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── 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
│   │   │   │   │   │   ├── 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
│   │   │   │   │   │   ├── 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.pyx
│   │   │   │   │   ├── transform_eos_dataset.py
│   │   │   │   │   └── transform_eos_lang_pair_dataset.py
│   │   │   │   ├── dataclass/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── configs.py
│   │   │   │   │   ├── constants.py
│   │   │   │   │   ├── initialize.py
│   │   │   │   │   └── utils.py
│   │   │   │   ├── distributed_utils.py
│   │   │   │   ├── file_io.py
│   │   │   │   ├── file_utils.py
│   │   │   │   ├── hub_utils.py
│   │   │   │   ├── incremental_decoding_utils.py
│   │   │   │   ├── iterative_refinement_generator.py
│   │   │   │   ├── legacy_distributed_data_parallel.py
│   │   │   │   ├── logging/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── meters.py
│   │   │   │   │   ├── metrics.py
│   │   │   │   │   └── progress_bar.py
│   │   │   │   ├── model_parallel/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── criterions/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   └── vocab_parallel_cross_entropy.py
│   │   │   │   │   ├── megatron_trainer.py
│   │   │   │   │   ├── models/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── pipeline_parallel_transformer/
│   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   ├── layers.py
│   │   │   │   │   │   │   └── model.py
│   │   │   │   │   │   ├── roberta/
│   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   └── model.py
│   │   │   │   │   │   ├── transformer.py
│   │   │   │   │   │   └── transformer_lm.py
│   │   │   │   │   └── modules/
│   │   │   │   │       ├── __init__.py
│   │   │   │   │       ├── multihead_attention.py
│   │   │   │   │       ├── transformer_layer.py
│   │   │   │   │       ├── transformer_sentence_encoder.py
│   │   │   │   │       └── transformer_sentence_encoder_layer.py
│   │   │   │   ├── models/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── bart/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── 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
│   │   │   │   │   ├── huggingface/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   └── 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
│   │   │   │   │   │   ├── 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
│   │   │   │   │   │   ├── alignment_utils.py
│   │   │   │   │   │   ├── hub_interface.py
│   │   │   │   │   │   ├── model.py
│   │   │   │   │   │   ├── model_camembert.py
│   │   │   │   │   │   ├── model_gottbert.py
│   │   │   │   │   │   └── model_xlmr.py
│   │   │   │   │   ├── speech_to_text/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── berard.py
│   │   │   │   │   │   └── s2t_transformer.py
│   │   │   │   │   ├── transformer.py
│   │   │   │   │   ├── transformer_align.py
│   │   │   │   │   ├── transformer_from_pretrained_xlm.py
│   │   │   │   │   ├── transformer_lm.py
│   │   │   │   │   └── wav2vec/
│   │   │   │   │       ├── __init__.py
│   │   │   │   │       ├── wav2vec.py
│   │   │   │   │       ├── wav2vec2.py
│   │   │   │   │       └── wav2vec2_asr.py
│   │   │   │   ├── modules/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── 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
│   │   │   │   │   ├── multihead_attention.py
│   │   │   │   │   ├── positional_embedding.py
│   │   │   │   │   ├── quant_noise.py
│   │   │   │   │   ├── quantization/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── pq/
│   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   ├── em.py
│   │   │   │   │   │   │   ├── modules/
│   │   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   │   ├── qconv.py
│   │   │   │   │   │   │   │   ├── qemb.py
│   │   │   │   │   │   │   │   └── qlinear.py
│   │   │   │   │   │   │   ├── pq.py
│   │   │   │   │   │   │   └── utils.py
│   │   │   │   │   │   ├── quantization_options.py
│   │   │   │   │   │   └── scalar/
│   │   │   │   │   │       ├── __init__.py
│   │   │   │   │   │       ├── modules/
│   │   │   │   │   │       │   ├── __init__.py
│   │   │   │   │   │       │   ├── 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
│   │   │   │   │   ├── adadelta.py
│   │   │   │   │   ├── adafactor.py
│   │   │   │   │   ├── adagrad.py
│   │   │   │   │   ├── adam.py
│   │   │   │   │   ├── adamax.py
│   │   │   │   │   ├── bmuf.py
│   │   │   │   │   ├── composite.py
│   │   │   │   │   ├── dynamic_loss_scaler.py
│   │   │   │   │   ├── fairseq_optimizer.py
│   │   │   │   │   ├── fp16_optimizer.py
│   │   │   │   │   ├── fused_adam.py
│   │   │   │   │   ├── fused_lamb.py
│   │   │   │   │   ├── lr_scheduler/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── 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
│   │   │   │   │   ├── bleu.py
│   │   │   │   │   ├── chrf.py
│   │   │   │   │   ├── tokenizer.py
│   │   │   │   │   └── wer.py
│   │   │   │   ├── search.py
│   │   │   │   ├── sequence_generator.py
│   │   │   │   ├── sequence_scorer.py
│   │   │   │   ├── tasks/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── audio_pretraining.py
│   │   │   │   │   ├── cross_lingual_lm.py
│   │   │   │   │   ├── denoising.py
│   │   │   │   │   ├── fairseq_task.py
│   │   │   │   │   ├── language_modeling.py
│   │   │   │   │   ├── legacy_masked_lm.py
│   │   │   │   │   ├── masked_lm.py
│   │   │   │   │   ├── multilingual_denoising.py
│   │   │   │   │   ├── multilingual_masked_lm.py
│   │   │   │   │   ├── multilingual_translation.py
│   │   │   │   │   ├── semisupervised_translation.py
│   │   │   │   │   ├── sentence_prediction.py
│   │   │   │   │   ├── sentence_ranking.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.txt
│   │   │   ├── fairseq_cli/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── 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
│   │   │   ├── setup.py
│   │   │   ├── tests/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── distributed/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── test_distributed_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_average_checkpoints.py
│   │   │   │   ├── test_backtranslation_dataset.py
│   │   │   │   ├── test_binaries.py
│   │   │   │   ├── test_bmuf.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_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_sampled_dataset.py
│   │   │   │   ├── test_multihead_attention.py
│   │   │   │   ├── test_noising.py
│   │   │   │   ├── test_reproducibility.py
│   │   │   │   ├── test_resampling_dataset.py
│   │   │   │   ├── test_sequence_generator.py
│   │   │   │   ├── test_sequence_scorer.py
│   │   │   │   ├── test_sparse_multihead_attention.py
│   │   │   │   ├── test_token_block_dataset.py
│   │   │   │   ├── test_train.py
│   │   │   │   ├── test_utils.py
│   │   │   │   └── utils.py
│   │   │   ├── tmp.txt
│   │   │   └── train.py
│   │   ├── inference.py
│   │   ├── inference_batch.py
│   │   └── interactive.sh
│   └── readme.md
├── deepnet/
│   └── README.md
├── deltalm/
│   ├── README.md
│   ├── deltalm/
│   │   ├── __init__.py
│   │   └── models/
│   │       ├── __init__.py
│   │       └── deltalm.py
│   ├── examples/
│   │   ├── binary_iwslt14.sh
│   │   ├── evaluate_iwslt14.sh
│   │   ├── prepare_iwslt14.sh
│   │   ├── spm_iwslt14.sh
│   │   └── train_iwslt14.sh
│   ├── generate.py
│   ├── interactive.py
│   ├── preprocess.py
│   └── train.py
├── dit/
│   ├── README.md
│   ├── classification/
│   │   ├── README.md
│   │   ├── dataset_folder.py
│   │   ├── datasets.py
│   │   ├── deepspeed_configs/
│   │   │   └── config.json
│   │   ├── engine_for_finetuning.py
│   │   ├── modeling_finetune.py
│   │   ├── optim_factory.py
│   │   ├── requirements.txt
│   │   ├── run_class_finetuning.py
│   │   ├── transforms.py
│   │   └── utils.py
│   ├── object_detection/
│   │   ├── README.md
│   │   ├── adaptive_binarize.py
│   │   ├── convert_to_coco_format.py
│   │   ├── ditod/
│   │   │   ├── __init__.py
│   │   │   ├── backbone.py
│   │   │   ├── beit.py
│   │   │   ├── config.py
│   │   │   ├── dataset_mapper.py
│   │   │   ├── deit.py
│   │   │   ├── icdar_evaluation.py
│   │   │   ├── mycheckpointer.py
│   │   │   ├── mytrainer.py
│   │   │   └── table_evaluation/
│   │   │       ├── __init__.py
│   │   │       ├── data_structure.py
│   │   │       └── evaluate.py
│   │   ├── icdar19_configs/
│   │   │   ├── Base-RCNN-FPN.yaml
│   │   │   ├── cascade/
│   │   │   │   ├── cascade_dit_base.yaml
│   │   │   │   └── cascade_dit_large.yaml
│   │   │   └── maskrcnn/
│   │   │       ├── maskrcnn_dit_base.yaml
│   │   │       └── maskrcnn_dit_large.yaml
│   │   ├── inference.py
│   │   ├── publaynet_configs/
│   │   │   ├── Base-RCNN-FPN.yaml
│   │   │   ├── cascade/
│   │   │   │   ├── cascade_dit_base.yaml
│   │   │   │   └── cascade_dit_large.yaml
│   │   │   └── maskrcnn/
│   │   │       ├── maskrcnn_dit_base.yaml
│   │   │       └── maskrcnn_dit_large.yaml
│   │   └── train_net.py
│   ├── requirements.txt
│   └── text_detection/
│       ├── README.md
│       ├── configs/
│       │   ├── Base-RCNN-FPN.yaml
│       │   ├── mask_rcnn_dit_base.yaml
│       │   └── mask_rcnn_dit_large.yaml
│       ├── ditod/
│       │   ├── __init__.py
│       │   ├── backbone.py
│       │   ├── beit.py
│       │   ├── concern/
│       │   │   ├── __init__.py
│       │   │   ├── average_meter.py
│       │   │   ├── box2seg.py
│       │   │   ├── config.py
│       │   │   ├── convert.py
│       │   │   ├── icdar2015_eval/
│       │   │   │   ├── __init__.py
│       │   │   │   └── detection/
│       │   │   │       ├── __init__.py
│       │   │   │       ├── deteval.py
│       │   │   │       ├── icdar2013.py
│       │   │   │       ├── iou.py
│       │   │   │       └── mtwi2018.py
│       │   │   ├── log.py
│       │   │   ├── signal_monitor.py
│       │   │   ├── visualizer.py
│       │   │   └── webcv2/
│       │   │       ├── __init__.py
│       │   │       ├── manager.py
│       │   │       ├── server.py
│       │   │       └── templates/
│       │   │           └── index.html
│       │   ├── config.py
│       │   ├── dataset_mapper.py
│       │   ├── deit.py
│       │   ├── funsd_evaluation.py
│       │   ├── mycheckpointer.py
│       │   └── mytrainer.py
│       └── train_net.py
├── e5/
│   ├── README.md
│   ├── model_config.py
│   ├── mteb_beir_eval.py
│   ├── mteb_except_retrieval_eval.py
│   ├── requirements.txt
│   ├── scripts/
│   │   ├── eval_mteb_beir.sh
│   │   └── eval_mteb_except_retrieval.sh
│   └── utils.py
├── edgelm/
│   ├── CODE_OF_CONDUCT.md
│   ├── CONTRIBUTING.md
│   ├── LICENSE
│   ├── README.md
│   ├── docs/
│   │   ├── Makefile
│   │   ├── _static/
│   │   │   └── theme_overrides.css
│   │   ├── command_line_tools.rst
│   │   ├── conf.py
│   │   ├── criterions.rst
│   │   ├── data.rst
│   │   ├── docutils.conf
│   │   ├── 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
│   │   ├── MMPT/
│   │   │   ├── .gitignore
│   │   │   ├── CONFIG.md
│   │   │   ├── DATASET.md
│   │   │   ├── README.md
│   │   │   ├── endtask.md
│   │   │   ├── locallaunch.py
│   │   │   ├── mmpt/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── datasets/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── fairseqmmdataset.py
│   │   │   │   │   └── mmdataset.py
│   │   │   │   ├── evaluators/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── evaluator.py
│   │   │   │   │   ├── metric.py
│   │   │   │   │   └── predictor.py
│   │   │   │   ├── losses/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── fairseqmmloss.py
│   │   │   │   │   ├── loss.py
│   │   │   │   │   └── nce.py
│   │   │   │   ├── models/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── fairseqmmmodel.py
│   │   │   │   │   ├── mmfusion.py
│   │   │   │   │   ├── mmfusionnlg.py
│   │   │   │   │   └── transformermodel.py
│   │   │   │   ├── modules/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── mm.py
│   │   │   │   │   ├── retri.py
│   │   │   │   │   └── vectorpool.py
│   │   │   │   ├── processors/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── dedupprocessor.py
│   │   │   │   │   ├── dsprocessor.py
│   │   │   │   │   ├── how2processor.py
│   │   │   │   │   ├── how2retriprocessor.py
│   │   │   │   │   ├── models/
│   │   │   │   │   │   └── s3dg.py
│   │   │   │   │   └── processor.py
│   │   │   │   ├── tasks/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── fairseqmmtask.py
│   │   │   │   │   ├── milncetask.py
│   │   │   │   │   ├── retritask.py
│   │   │   │   │   ├── task.py
│   │   │   │   │   └── vlmtask.py
│   │   │   │   └── utils/
│   │   │   │       ├── __init__.py
│   │   │   │       ├── load_config.py
│   │   │   │       └── shardedtensor.py
│   │   │   ├── mmpt_cli/
│   │   │   │   ├── localjob.py
│   │   │   │   └── predict.py
│   │   │   ├── pretraining.md
│   │   │   ├── projects/
│   │   │   │   ├── mfmmlm.yaml
│   │   │   │   ├── mtm/
│   │   │   │   │   ├── mmfusionmtm.yaml
│   │   │   │   │   ├── vlm/
│   │   │   │   │   │   ├── coin.yaml
│   │   │   │   │   │   ├── crosstask.yaml
│   │   │   │   │   │   ├── how2.yaml
│   │   │   │   │   │   ├── test_coin.yaml
│   │   │   │   │   │   ├── test_crosstask.yaml
│   │   │   │   │   │   ├── test_crosstask_zs.yaml
│   │   │   │   │   │   ├── test_vtt.yaml
│   │   │   │   │   │   ├── test_vttqa.yaml
│   │   │   │   │   │   ├── test_youcook.yaml
│   │   │   │   │   │   ├── test_youcookcap.yaml
│   │   │   │   │   │   ├── vtt.yaml
│   │   │   │   │   │   ├── vttqa.yaml
│   │   │   │   │   │   ├── youcook.yaml
│   │   │   │   │   │   └── youcookcap.yaml
│   │   │   │   │   └── vlm.yaml
│   │   │   │   ├── retri/
│   │   │   │   │   ├── videoclip/
│   │   │   │   │   │   ├── coin_videoclip.yaml
│   │   │   │   │   │   ├── crosstask_videoclip.yaml
│   │   │   │   │   │   ├── how2.yaml
│   │   │   │   │   │   ├── test_coin_videoclip.yaml
│   │   │   │   │   │   ├── test_coin_zs.yaml
│   │   │   │   │   │   ├── test_crosstask_videoclip.yaml
│   │   │   │   │   │   ├── test_crosstask_zs_videoclip.yaml
│   │   │   │   │   │   ├── test_didemo_zs.yaml
│   │   │   │   │   │   ├── test_vtt_videoclip.yaml
│   │   │   │   │   │   ├── test_vtt_zs.yaml
│   │   │   │   │   │   ├── test_vttqa_videoclip.yaml
│   │   │   │   │   │   ├── test_vttqa_zs.yaml
│   │   │   │   │   │   ├── test_youcook_videoclip.yaml
│   │   │   │   │   │   ├── test_youcook_zs.yaml
│   │   │   │   │   │   ├── vtt_videoclip.yaml
│   │   │   │   │   │   ├── vttqa_videoclip.yaml
│   │   │   │   │   │   └── youcook_videoclip.yaml
│   │   │   │   │   ├── videoclip.yaml
│   │   │   │   │   └── videoretri.yaml
│   │   │   │   └── task/
│   │   │   │       ├── coin.yaml
│   │   │   │       ├── coin_videoclip.yaml
│   │   │   │       ├── crosstask.yaml
│   │   │   │       ├── crosstask_videoclip.yaml
│   │   │   │       ├── default.yaml
│   │   │   │       ├── ft.yaml
│   │   │   │       ├── how2.yaml
│   │   │   │       ├── test.yaml
│   │   │   │       ├── test_coin.yaml
│   │   │   │       ├── test_coin_videoclip.yaml
│   │   │   │       ├── test_coin_zs.yaml
│   │   │   │       ├── test_crosstask.yaml
│   │   │   │       ├── test_crosstask_videoclip.yaml
│   │   │   │       ├── test_crosstask_zs.yaml
│   │   │   │       ├── test_crosstask_zs_videoclip.yaml
│   │   │   │       ├── test_didemo_zs.yaml
│   │   │   │       ├── test_vtt.yaml
│   │   │   │       ├── test_vtt_videoclip.yaml
│   │   │   │       ├── test_vtt_zs.yaml
│   │   │   │       ├── test_vttqa.yaml
│   │   │   │       ├── test_vttqa_videoclip.yaml
│   │   │   │       ├── test_vttqa_zs.yaml
│   │   │   │       ├── test_youcook.yaml
│   │   │   │       ├── test_youcook_videoclip.yaml
│   │   │   │       ├── test_youcook_zs.yaml
│   │   │   │       ├── test_youcookcap.yaml
│   │   │   │       ├── vtt.yaml
│   │   │   │       ├── vtt_videoclip.yaml
│   │   │   │       ├── vttqa.yaml
│   │   │   │       ├── vttqa_videoclip.yaml
│   │   │   │       ├── youcook.yaml
│   │   │   │       ├── youcook_videoclip.yaml
│   │   │   │       └── youcookcap.yaml
│   │   │   ├── scripts/
│   │   │   │   ├── text_token_extractor/
│   │   │   │   │   ├── configs/
│   │   │   │   │   │   └── bert-base-uncased.yaml
│   │   │   │   │   └── pretokenization.py
│   │   │   │   └── video_feature_extractor/
│   │   │   │       ├── extract.py
│   │   │   │       ├── how2/
│   │   │   │       │   └── s3d.sh
│   │   │   │       ├── model.py
│   │   │   │       ├── pathbuilder.py
│   │   │   │       ├── preprocessing.py
│   │   │   │       ├── random_sequence_shuffler.py
│   │   │   │       ├── shard_feature.py
│   │   │   │       └── videoreader.py
│   │   │   └── setup.py
│   │   ├── __init__.py
│   │   ├── 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
│   │   ├── discriminative_reranking_nmt/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   ├── config/
│   │   │   │   └── deen.yaml
│   │   │   ├── criterions/
│   │   │   │   ├── __init__.py
│   │   │   │   └── discriminative_reranking_criterion.py
│   │   │   ├── drnmt_rerank.py
│   │   │   ├── models/
│   │   │   │   ├── __init__.py
│   │   │   │   └── discriminative_reranking_model.py
│   │   │   ├── scripts/
│   │   │   │   └── prep_data.py
│   │   │   └── tasks/
│   │   │       ├── __init__.py
│   │   │       └── discriminative_reranking_task.py
│   │   ├── fast_noisy_channel/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   ├── noisy_channel_beam_search.py
│   │   │   ├── noisy_channel_sequence_generator.py
│   │   │   └── noisy_channel_translation.py
│   │   ├── flores101/
│   │   │   └── README.md
│   │   ├── 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
│   │   │   │   ├── dump_w2v2_feature.py
│   │   │   │   ├── feature_utils.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
│   │   ├── normformer/
│   │   │   ├── README.md
│   │   │   └── train_lm.sh
│   │   ├── operators/
│   │   │   ├── alignment_train_cpu.cpp
│   │   │   ├── alignment_train_cuda.cpp
│   │   │   ├── alignment_train_cuda.h
│   │   │   ├── alignment_train_kernel.cu
│   │   │   └── utils.h
│   │   ├── 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
│   │   │   ├── commonsense_qa/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── commonsense_qa_task.py
│   │   │   │   └── download_cqa_data.sh
│   │   │   ├── config/
│   │   │   │   ├── finetuning/
│   │   │   │   │   ├── cola.yaml
│   │   │   │   │   ├── mnli.yaml
│   │   │   │   │   ├── mrpc.yaml
│   │   │   │   │   ├── qnli.yaml
│   │   │   │   │   ├── qqp.yaml
│   │   │   │   │   ├── rte.yaml
│   │   │   │   │   ├── sst_2.yaml
│   │   │   │   │   └── sts_b.yaml
│   │   │   │   └── pretraining/
│   │   │   │       └── base.yaml
│   │   │   ├── 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
│   │   ├── shuffled_word_order/
│   │   │   ├── README.finetuning.md
│   │   │   └── README.md
│   │   ├── simultaneous_translation/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   ├── docs/
│   │   │   │   ├── ende-mma.md
│   │   │   │   └── enja-waitk.md
│   │   │   ├── eval/
│   │   │   │   └── agents/
│   │   │   │       └── simul_t2t_enja.py
│   │   │   ├── models/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── convtransformer_simul_trans.py
│   │   │   │   └── transformer_monotonic_attention.py
│   │   │   ├── modules/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── fixed_pre_decision.py
│   │   │   │   ├── monotonic_multihead_attention.py
│   │   │   │   └── monotonic_transformer_layer.py
│   │   │   ├── tests/
│   │   │   │   ├── test_alignment_train.py
│   │   │   │   └── test_text_models.py
│   │   │   └── utils/
│   │   │       ├── __init__.py
│   │   │       ├── functions.py
│   │   │       ├── monotonic_attention.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_synthesis/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   ├── data_utils.py
│   │   │   ├── docs/
│   │   │   │   ├── common_voice_example.md
│   │   │   │   ├── ljspeech_example.md
│   │   │   │   └── vctk_example.md
│   │   │   ├── evaluation/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── eval_asr.py
│   │   │   │   ├── eval_f0.py
│   │   │   │   ├── eval_sp.py
│   │   │   │   └── get_eval_manifest.py
│   │   │   ├── generate_waveform.py
│   │   │   ├── preprocessing/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── denoise_and_vad_audio.py
│   │   │   │   ├── denoiser/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── demucs.py
│   │   │   │   │   ├── pretrained.py
│   │   │   │   │   ├── resample.py
│   │   │   │   │   └── utils.py
│   │   │   │   ├── get_common_voice_audio_manifest.py
│   │   │   │   ├── get_feature_manifest.py
│   │   │   │   ├── get_ljspeech_audio_manifest.py
│   │   │   │   ├── get_speaker_embedding.py
│   │   │   │   ├── get_vctk_audio_manifest.py
│   │   │   │   ├── speaker_embedder/
│   │   │   │   │   └── __init__.py
│   │   │   │   └── vad/
│   │   │   │       └── __init__.py
│   │   │   └── utils.py
│   │   ├── speech_text_joint_to_text/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   ├── configs/
│   │   │   │   └── mustc_noise.list
│   │   │   ├── criterions/
│   │   │   │   ├── __init__.py
│   │   │   │   └── text_guide_cross_entropy_acc.py
│   │   │   ├── docs/
│   │   │   │   ├── ende-mustc.md
│   │   │   │   └── iwslt2021.md
│   │   │   ├── models/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── s2t_dualinputtransformer.py
│   │   │   │   └── s2t_dualinputxmtransformer.py
│   │   │   ├── scripts/
│   │   │   │   └── g2p_encode.py
│   │   │   └── tasks/
│   │   │       ├── __init__.py
│   │   │       └── speech_text_joint.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
│   │   ├── textless_nlp/
│   │   │   └── gslm/
│   │   │       ├── README.md
│   │   │       ├── metrics/
│   │   │       │   ├── README.md
│   │   │       │   ├── abx_metrics/
│   │   │       │   │   ├── README.md
│   │   │       │   │   └── dump_abx_feats.py
│   │   │       │   └── asr_metrics/
│   │   │       │       ├── README.md
│   │   │       │       ├── continuation_eval.py
│   │   │       │       ├── misc/
│   │   │       │       │   ├── bleu_utils.py
│   │   │       │       │   ├── cut_as.py
│   │   │       │       │   └── dict.ltr.txt
│   │   │       │       ├── ppx.py
│   │   │       │       └── self_auto_bleu.py
│   │   │       ├── speech2unit/
│   │   │       │   ├── README.md
│   │   │       │   ├── __init__.py
│   │   │       │   ├── clustering/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   ├── cluster_kmeans.py
│   │   │       │   │   ├── dump_feats.py
│   │   │       │   │   ├── quantize_with_kmeans.py
│   │   │       │   │   └── utils.py
│   │   │       │   └── pretrained/
│   │   │       │       ├── cpc_feature_reader.py
│   │   │       │       ├── hubert_feature_reader.py
│   │   │       │       ├── logmel_feature_reader.py
│   │   │       │       ├── utils.py
│   │   │       │       └── w2v2_feature_reader.py
│   │   │       ├── tools/
│   │   │       │   ├── README.md
│   │   │       │   └── resynthesize_speech.py
│   │   │       ├── ulm/
│   │   │       │   ├── README.md
│   │   │       │   └── sample.py
│   │   │       └── unit2speech/
│   │   │           ├── README.md
│   │   │           ├── convert_to_16k.py
│   │   │           ├── glow.py
│   │   │           ├── multiproc.py
│   │   │           ├── synthesize_audio_from_units.py
│   │   │           ├── tacotron2/
│   │   │           │   ├── __init__.py
│   │   │           │   ├── audio_processing.py
│   │   │           │   ├── cleaners.py
│   │   │           │   ├── cmudict.py
│   │   │           │   ├── layers.py
│   │   │           │   ├── model.py
│   │   │           │   ├── numbers.py
│   │   │           │   ├── stft.py
│   │   │           │   ├── symbols.py
│   │   │           │   ├── text.py
│   │   │           │   ├── utils.py
│   │   │           │   └── waveglow_denoiser.py
│   │   │           ├── tts_data.py
│   │   │           └── utils.py
│   │   ├── 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
│   │   ├── wav2vec/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   ├── config/
│   │   │   │   ├── finetuning/
│   │   │   │   │   ├── base_100h.yaml
│   │   │   │   │   ├── base_10h.yaml
│   │   │   │   │   ├── base_10m.yaml
│   │   │   │   │   ├── base_1h.yaml
│   │   │   │   │   ├── base_960h.yaml
│   │   │   │   │   ├── vox_100h.yaml
│   │   │   │   │   ├── vox_10h.yaml
│   │   │   │   │   ├── vox_10m.yaml
│   │   │   │   │   ├── vox_1h.yaml
│   │   │   │   │   └── vox_960h.yaml
│   │   │   │   └── pretraining/
│   │   │   │       ├── wav2vec2_base_librispeech.yaml
│   │   │   │       ├── wav2vec2_large_librivox.yaml
│   │   │   │       ├── wav2vec2_large_librivox_tpu-pod.yaml
│   │   │   │       └── wav2vec2_large_librivox_tpu.yaml
│   │   │   ├── libri_labels.py
│   │   │   ├── scripts/
│   │   │   │   └── binarize_manifest.sh
│   │   │   ├── unsupervised/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── config/
│   │   │   │   │   ├── finetuning/
│   │   │   │   │   │   └── w2v_finetune.yaml
│   │   │   │   │   ├── gan/
│   │   │   │   │   │   └── w2vu.yaml
│   │   │   │   │   ├── generate/
│   │   │   │   │   │   └── viterbi.yaml
│   │   │   │   │   ├── timit_matched/
│   │   │   │   │   │   ├── test.uid
│   │   │   │   │   │   ├── train.uid
│   │   │   │   │   │   ├── train_text.uid
│   │   │   │   │   │   └── valid.uid
│   │   │   │   │   └── timit_unmatched/
│   │   │   │   │       ├── test.uid
│   │   │   │   │       ├── train.uid
│   │   │   │   │       ├── train_text.uid
│   │   │   │   │       └── valid.uid
│   │   │   │   ├── data/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── extracted_features_dataset.py
│   │   │   │   │   └── random_input_dataset.py
│   │   │   │   ├── kaldi_self_train/
│   │   │   │   │   ├── README.md
│   │   │   │   │   └── st/
│   │   │   │   │       ├── cmd.sh
│   │   │   │   │       ├── decode_phone.sh
│   │   │   │   │       ├── decode_word_step1.sh
│   │   │   │   │       ├── decode_word_step2.sh
│   │   │   │   │       ├── local/
│   │   │   │   │       │   ├── copy_aligned_text.py
│   │   │   │   │       │   ├── decode.sh
│   │   │   │   │       │   ├── prepare_data_from_w2v.py
│   │   │   │   │       │   ├── prepare_lang.sh
│   │   │   │   │       │   ├── prepare_lang_word.sh
│   │   │   │   │       │   ├── prepare_lm.sh
│   │   │   │   │       │   ├── score.sh
│   │   │   │   │       │   ├── show_wer.sh
│   │   │   │   │       │   ├── train_subset_lgbeam.sh
│   │   │   │   │       │   ├── unsup_select.py
│   │   │   │   │       │   ├── unsup_select_decode.sh
│   │   │   │   │       │   └── unsup_select_decode_word.sh
│   │   │   │   │       ├── path.sh
│   │   │   │   │       ├── steps
│   │   │   │   │       ├── steps_gan/
│   │   │   │   │       │   ├── train_deltas.sh
│   │   │   │   │       │   ├── train_lda_mllt.sh
│   │   │   │   │       │   └── train_sat.sh
│   │   │   │   │       ├── train.sh
│   │   │   │   │       └── utils
│   │   │   │   ├── models/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── wav2vec_u.py
│   │   │   │   ├── scripts/
│   │   │   │   │   ├── apply_pca.py
│   │   │   │   │   ├── copy_labels.py
│   │   │   │   │   ├── filter_lexicon.py
│   │   │   │   │   ├── filter_tsv.py
│   │   │   │   │   ├── g2p_wrd_to_phn.py
│   │   │   │   │   ├── ltr_to_wrd.py
│   │   │   │   │   ├── mean_pool.py
│   │   │   │   │   ├── merge_clusters.py
│   │   │   │   │   ├── normalize_and_filter_text.py
│   │   │   │   │   ├── normalize_text.py
│   │   │   │   │   ├── pca.py
│   │   │   │   │   ├── phonemize_with_sil.py
│   │   │   │   │   ├── prepare_audio.sh
│   │   │   │   │   ├── prepare_text.sh
│   │   │   │   │   ├── prepare_timit.sh
│   │   │   │   │   ├── remove_silence.py
│   │   │   │   │   ├── vads.py
│   │   │   │   │   ├── wav2vec_apply_cluster_faiss.py
│   │   │   │   │   ├── wav2vec_cluster_faiss.py
│   │   │   │   │   ├── wav2vec_extract_features.py
│   │   │   │   │   ├── wer.py
│   │   │   │   │   └── wrd_to_ltr.py
│   │   │   │   ├── tasks/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── unpaired_audio_text.py
│   │   │   │   └── w2vu_generate.py
│   │   │   ├── vq-wav2vec_featurize.py
│   │   │   ├── wav2vec_featurize.py
│   │   │   └── wav2vec_manifest.py
│   │   ├── wmt19/
│   │   │   └── README.md
│   │   ├── wmt20/
│   │   │   └── README.md
│   │   └── xlmr/
│   │       └── README.md
│   ├── fairseq/
│   │   ├── __init__.py
│   │   ├── benchmark/
│   │   │   ├── __init__.py
│   │   │   ├── 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
│   │   │       ├── wav2vec/
│   │   │       │   └── vq_wav2vec_gumbel.yaml
│   │   │       └── wav2vec2/
│   │   │           ├── wav2vec2_base.yaml
│   │   │           └── wav2vec2_large.yaml
│   │   ├── criterions/
│   │   │   ├── __init__.py
│   │   │   ├── adaptive_loss.py
│   │   │   ├── composite_loss.py
│   │   │   ├── cross_entropy.py
│   │   │   ├── ctc.py
│   │   │   ├── fairseq_criterion.py
│   │   │   ├── fastspeech2_loss.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
│   │   │   ├── tacotron2_loss.py
│   │   │   └── wav2vec_criterion.py
│   │   ├── data/
│   │   │   ├── __init__.py
│   │   │   ├── add_target_dataset.py
│   │   │   ├── append_token_dataset.py
│   │   │   ├── audio/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── audio_utils.py
│   │   │   │   ├── data_cfg.py
│   │   │   │   ├── feature_transforms/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── global_cmvn.py
│   │   │   │   │   ├── specaugment.py
│   │   │   │   │   └── utterance_cmvn.py
│   │   │   │   ├── frm_text_to_speech_dataset.py
│   │   │   │   ├── hubert_dataset.py
│   │   │   │   ├── multi_modality_dataset.py
│   │   │   │   ├── raw_audio_dataset.py
│   │   │   │   ├── speech_to_text_dataset.py
│   │   │   │   ├── speech_to_text_joint_dataset.py
│   │   │   │   └── text_to_speech_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.pyx
│   │   │   ├── denoising_dataset.py
│   │   │   ├── dictionary.py
│   │   │   ├── encoders/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── 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
│   │   │   ├── huffman/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── huffman_coder.py
│   │   │   │   └── huffman_mmap_indexed_dataset.py
│   │   │   ├── id_dataset.py
│   │   │   ├── indexed_dataset.py
│   │   │   ├── iterators.py
│   │   │   ├── language_pair_dataset.py
│   │   │   ├── legacy/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── 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
│   │   │   │   ├── 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
│   │   │   ├── squad/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── basic_tokenizer.py
│   │   │   │   ├── squad_extractor.py
│   │   │   │   └── squad_metrics.py
│   │   │   ├── strip_token_dataset.py
│   │   │   ├── subsample_dataset.py
│   │   │   ├── text_compressor.py
│   │   │   ├── token_block_dataset.py
│   │   │   ├── token_block_utils_fast.cpp
│   │   │   ├── token_block_utils_fast.pyx
│   │   │   ├── transform_eos_dataset.py
│   │   │   └── transform_eos_lang_pair_dataset.py
│   │   ├── dataclass/
│   │   │   ├── __init__.py
│   │   │   ├── configs.py
│   │   │   ├── constants.py
│   │   │   ├── initialize.py
│   │   │   └── utils.py
│   │   ├── distributed/
│   │   │   ├── __init__.py
│   │   │   ├── 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_chunker_utils.py
│   │   ├── file_io.py
│   │   ├── file_utils.py
│   │   ├── hub_utils.py
│   │   ├── incremental_decoding_utils.py
│   │   ├── iterative_refinement_generator.py
│   │   ├── logging/
│   │   │   ├── __init__.py
│   │   │   ├── meters.py
│   │   │   ├── metrics.py
│   │   │   └── progress_bar.py
│   │   ├── model_parallel/
│   │   │   ├── __init__.py
│   │   │   ├── criterions/
│   │   │   │   ├── __init__.py
│   │   │   │   └── vocab_parallel_cross_entropy.py
│   │   │   ├── megatron_trainer.py
│   │   │   ├── models/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── pipeline_parallel_transformer/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── layers.py
│   │   │   │   │   └── model.py
│   │   │   │   ├── roberta/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── model.py
│   │   │   │   ├── transformer.py
│   │   │   │   └── transformer_lm.py
│   │   │   └── modules/
│   │   │       ├── __init__.py
│   │   │       ├── multihead_attention.py
│   │   │       └── transformer_layer.py
│   │   ├── models/
│   │   │   ├── __init__.py
│   │   │   ├── bart/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── hub_interface.py
│   │   │   │   └── model.py
│   │   │   ├── composite_encoder.py
│   │   │   ├── distributed_fairseq_model.py
│   │   │   ├── ema/
│   │   │   │   ├── __init__.py
│   │   │   │   └── ema.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
│   │   │   │   ├── hubert.py
│   │   │   │   └── hubert_asr.py
│   │   │   ├── huggingface/
│   │   │   │   ├── __init__.py
│   │   │   │   └── 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
│   │   │   │   ├── 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
│   │   │   │   ├── 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
│   │   │   │   ├── berard.py
│   │   │   │   ├── convtransformer.py
│   │   │   │   ├── modules/
│   │   │   │   │   ├── augmented_memory_attention.py
│   │   │   │   │   └── emformer.py
│   │   │   │   ├── s2t_transformer.py
│   │   │   │   ├── utils.py
│   │   │   │   └── xm_transformer.py
│   │   │   ├── text_to_speech/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── fastspeech2.py
│   │   │   │   ├── hifigan.py
│   │   │   │   ├── tacotron2.py
│   │   │   │   ├── tts_transformer.py
│   │   │   │   └── vocoder.py
│   │   │   ├── transformer/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── transformer_base.py
│   │   │   │   ├── transformer_config.py
│   │   │   │   ├── transformer_decoder.py
│   │   │   │   ├── transformer_encoder.py
│   │   │   │   └── transformer_legacy.py
│   │   │   ├── transformer_align.py
│   │   │   ├── transformer_from_pretrained_xlm.py
│   │   │   ├── transformer_lm.py
│   │   │   └── wav2vec/
│   │   │       ├── __init__.py
│   │   │       ├── wav2vec.py
│   │   │       ├── wav2vec2.py
│   │   │       └── wav2vec2_asr.py
│   │   ├── modules/
│   │   │   ├── __init__.py
│   │   │   ├── adaptive_input.py
│   │   │   ├── adaptive_softmax.py
│   │   │   ├── base_layer.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_attention.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
│   │   │   ├── location_attention.py
│   │   │   ├── lora.py
│   │   │   ├── lstm_cell_with_zoneout.py
│   │   │   ├── multihead_attention.py
│   │   │   ├── positional_embedding.py
│   │   │   ├── quant_noise.py
│   │   │   ├── quantization/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── pq/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── em.py
│   │   │   │   │   ├── modules/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── qconv.py
│   │   │   │   │   │   ├── qemb.py
│   │   │   │   │   │   └── qlinear.py
│   │   │   │   │   ├── pq.py
│   │   │   │   │   └── utils.py
│   │   │   │   ├── quantization_options.py
│   │   │   │   └── scalar/
│   │   │   │       ├── __init__.py
│   │   │   │       ├── modules/
│   │   │   │       │   ├── __init__.py
│   │   │   │       │   ├── 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
│   │   │   ├── 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
│   │   │   │   ├── 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
│   │   │   │   ├── step_lr_scheduler.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
│   │   │   ├── bleu.py
│   │   │   ├── chrf.py
│   │   │   ├── tokenizer.py
│   │   │   └── wer.py
│   │   ├── search.py
│   │   ├── sequence_generator.py
│   │   ├── sequence_scorer.py
│   │   ├── speech_generator.py
│   │   ├── tasks/
│   │   │   ├── __init__.py
│   │   │   ├── audio_finetuning.py
│   │   │   ├── audio_pretraining.py
│   │   │   ├── cross_lingual_lm.py
│   │   │   ├── denoising.py
│   │   │   ├── fairseq_task.py
│   │   │   ├── frm_text_to_speech.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
│   │   │   ├── text_to_speech.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
│   │   ├── 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
│   │   │   ├── test_ema_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_dataclass_utils.py
│   │   ├── test_dataset.py
│   │   ├── test_dictionary.py
│   │   ├── test_ema.py
│   │   ├── test_export.py
│   │   ├── test_file_chunker_utils.py
│   │   ├── test_file_io.py
│   │   ├── test_fp16_optimizer.py
│   │   ├── test_huffman.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
├── glan/
│   └── README.md
├── infoxlm/
│   ├── README.md
│   ├── fairseq/
│   │   ├── .gitignore
│   │   ├── CODE_OF_CONDUCT.md
│   │   ├── CONTRIBUTING.md
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── docs/
│   │   │   ├── Makefile
│   │   │   ├── _static/
│   │   │   │   └── theme_overrides.css
│   │   │   ├── command_line_tools.rst
│   │   │   ├── conf.py
│   │   │   ├── criterions.rst
│   │   │   ├── data.rst
│   │   │   ├── docutils.conf
│   │   │   ├── getting_started.rst
│   │   │   ├── 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
│   │   ├── eval_lm.py
│   │   ├── examples/
│   │   │   ├── .gitignore
│   │   │   ├── __init__.py
│   │   │   ├── backtranslation/
│   │   │   │   └── README.md
│   │   │   ├── bart/
│   │   │   │   ├── README.cnn.md
│   │   │   │   ├── README.glue.md
│   │   │   │   └── README.md
│   │   │   ├── camembert/
│   │   │   │   └── README.md
│   │   │   ├── conv_seq2seq/
│   │   │   │   └── README.md
│   │   │   ├── cross_lingual_language_model/
│   │   │   │   └── README.md
│   │   │   ├── joint_alignment_translation/
│   │   │   │   ├── README.md
│   │   │   │   └── prepare-wmt18en2de_no_norm_no_escape_no_agressive.sh
│   │   │   ├── language_model/
│   │   │   │   ├── README.md
│   │   │   │   ├── conv_lm/
│   │   │   │   │   └── README.md
│   │   │   │   ├── prepare-wikitext-103.sh
│   │   │   │   └── transformer_lm/
│   │   │   │       └── README.md
│   │   │   ├── layerdrop/
│   │   │   │   └── README.md
│   │   │   ├── 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
│   │   │   ├── pay_less_attention_paper/
│   │   │   │   └── README.md
│   │   │   ├── roberta/
│   │   │   │   ├── README.custom_classification.md
│   │   │   │   ├── README.glue.md
│   │   │   │   ├── README.md
│   │   │   │   ├── README.pretraining.md
│   │   │   │   ├── README.race.md
│   │   │   │   ├── 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
│   │   │   ├── scaling_nmt/
│   │   │   │   └── README.md
│   │   │   ├── speech_recognition/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── criterions/
│   │   │   │   │   ├── ASG_loss.py
│   │   │   │   │   ├── CTC_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
│   │   │   │   ├── models/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── vggtransformer.py
│   │   │   │   │   └── w2l_conv_glu_enc.py
│   │   │   │   ├── tasks/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── speech_recognition.py
│   │   │   │   ├── utils/
│   │   │   │   │   └── wer_utils.py
│   │   │   │   └── w2l_decoder.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
│   │   │   ├── wav2vec/
│   │   │   │   └── README.md
│   │   │   ├── wmt19/
│   │   │   │   └── README.md
│   │   │   └── xlmr/
│   │   │       └── README.md
│   │   ├── fairseq/
│   │   │   ├── __init__.py
│   │   │   ├── binarizer.py
│   │   │   ├── bleu.py
│   │   │   ├── checkpoint_utils.py
│   │   │   ├── clib/
│   │   │   │   ├── libbleu/
│   │   │   │   │   ├── libbleu.cpp
│   │   │   │   │   └── module.cpp
│   │   │   │   └── libnat/
│   │   │   │       └── edit_dist.cpp
│   │   │   ├── criterions/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── adaptive_loss.py
│   │   │   │   ├── binary_cross_entropy.py
│   │   │   │   ├── composite_loss.py
│   │   │   │   ├── cross_entropy.py
│   │   │   │   ├── fairseq_criterion.py
│   │   │   │   ├── label_smoothed_cross_entropy.py
│   │   │   │   ├── label_smoothed_cross_entropy_with_alignment.py
│   │   │   │   ├── legacy_masked_lm.py
│   │   │   │   ├── masked_lm.py
│   │   │   │   ├── nat_loss.py
│   │   │   │   ├── sentence_prediction.py
│   │   │   │   └── sentence_ranking.py
│   │   │   ├── data/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── append_token_dataset.py
│   │   │   │   ├── audio/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── raw_audio_dataset.py
│   │   │   │   ├── backtranslation_dataset.py
│   │   │   │   ├── base_wrapper_dataset.py
│   │   │   │   ├── colorize_dataset.py
│   │   │   │   ├── concat_dataset.py
│   │   │   │   ├── concat_sentences_dataset.py
│   │   │   │   ├── data_utils.py
│   │   │   │   ├── data_utils_fast.pyx
│   │   │   │   ├── denoising_dataset.py
│   │   │   │   ├── dictionary.py
│   │   │   │   ├── encoders/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── fastbpe.py
│   │   │   │   │   ├── gpt2_bpe.py
│   │   │   │   │   ├── gpt2_bpe_utils.py
│   │   │   │   │   ├── hf_bert_bpe.py
│   │   │   │   │   ├── moses_tokenizer.py
│   │   │   │   │   ├── nltk_tokenizer.py
│   │   │   │   │   ├── sentencepiece_bpe.py
│   │   │   │   │   ├── space_tokenizer.py
│   │   │   │   │   ├── subword_nmt_bpe.py
│   │   │   │   │   └── utils.py
│   │   │   │   ├── fairseq_dataset.py
│   │   │   │   ├── id_dataset.py
│   │   │   │   ├── indexed_dataset.py
│   │   │   │   ├── iterators.py
│   │   │   │   ├── language_pair_dataset.py
│   │   │   │   ├── legacy/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── 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_sampled_dataset.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
│   │   │   │   ├── sharded_dataset.py
│   │   │   │   ├── sort_dataset.py
│   │   │   │   ├── strip_token_dataset.py
│   │   │   │   ├── subsample_dataset.py
│   │   │   │   ├── token_block_dataset.py
│   │   │   │   ├── token_block_utils_fast.pyx
│   │   │   │   ├── transform_eos_dataset.py
│   │   │   │   ├── transform_eos_lang_pair_dataset.py
│   │   │   │   └── truncate_dataset.py
│   │   │   ├── distributed_utils.py
│   │   │   ├── file_utils.py
│   │   │   ├── hub_utils.py
│   │   │   ├── iterative_refinement_generator.py
│   │   │   ├── legacy_distributed_data_parallel.py
│   │   │   ├── meters.py
│   │   │   ├── models/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── bart/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── hub_interface.py
│   │   │   │   │   └── model.py
│   │   │   │   ├── cmlm_transformer.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
│   │   │   │   ├── insertion_transformer.py
│   │   │   │   ├── iterative_nonautoregressive_transformer.py
│   │   │   │   ├── levenshtein_transformer.py
│   │   │   │   ├── lightconv.py
│   │   │   │   ├── lightconv_lm.py
│   │   │   │   ├── lstm.py
│   │   │   │   ├── masked_lm.py
│   │   │   │   ├── model_utils.py
│   │   │   │   ├── multilingual_transformer.py
│   │   │   │   ├── nonautoregressive_ensembles.py
│   │   │   │   ├── nonautoregressive_transformer.py
│   │   │   │   ├── roberta/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── alignment_utils.py
│   │   │   │   │   ├── hub_interface.py
│   │   │   │   │   └── model.py
│   │   │   │   ├── transformer.py
│   │   │   │   ├── transformer_from_pretrained_xlm.py
│   │   │   │   ├── transformer_lm.py
│   │   │   │   └── wav2vec.py
│   │   │   ├── modules/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── adaptive_input.py
│   │   │   │   ├── adaptive_softmax.py
│   │   │   │   ├── beamable_mm.py
│   │   │   │   ├── character_token_embedder.py
│   │   │   │   ├── conv_tbc.py
│   │   │   │   ├── cuda_utils.cu
│   │   │   │   ├── downsampled_multihead_attention.py
│   │   │   │   ├── dynamic_convolution.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
│   │   │   │   ├── gelu.py
│   │   │   │   ├── grad_multiply.py
│   │   │   │   ├── highway.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
│   │   │   │   ├── logsumexp_moe.py
│   │   │   │   ├── mean_pool_gating_network.py
│   │   │   │   ├── multihead_attention.py
│   │   │   │   ├── positional_embedding.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
│   │   │   │   ├── unfold.py
│   │   │   │   └── vggblock.py
│   │   │   ├── optim/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── adadelta.py
│   │   │   │   ├── adafactor.py
│   │   │   │   ├── adagrad.py
│   │   │   │   ├── adam.py
│   │   │   │   ├── adamax.py
│   │   │   │   ├── bmuf.py
│   │   │   │   ├── fairseq_optimizer.py
│   │   │   │   ├── fp16_optimizer.py
│   │   │   │   ├── lr_scheduler/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── cosine_lr_scheduler.py
│   │   │   │   │   ├── fairseq_lr_scheduler.py
│   │   │   │   │   ├── fixed_schedule.py
│   │   │   │   │   ├── inverse_square_root_schedule.py
│   │   │   │   │   ├── polynomial_decay_schedule.py
│   │   │   │   │   ├── reduce_lr_on_plateau.py
│   │   │   │   │   ├── tri_stage_lr_scheduler.py
│   │   │   │   │   └── triangular_lr_scheduler.py
│   │   │   │   ├── nag.py
│   │   │   │   └── sgd.py
│   │   │   ├── options.py
│   │   │   ├── pdb.py
│   │   │   ├── progress_bar.py
│   │   │   ├── registry.py
│   │   │   ├── search.py
│   │   │   ├── sequence_generator.py
│   │   │   ├── sequence_scorer.py
│   │   │   ├── tasks/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── audio_pretraining.py
│   │   │   │   ├── cross_lingual_lm.py
│   │   │   │   ├── denoising.py
│   │   │   │   ├── fairseq_task.py
│   │   │   │   ├── language_modeling.py
│   │   │   │   ├── legacy_masked_lm.py
│   │   │   │   ├── masked_lm.py
│   │   │   │   ├── multilingual_masked_lm.py
│   │   │   │   ├── multilingual_translation.py
│   │   │   │   ├── semisupervised_translation.py
│   │   │   │   ├── sentence_prediction.py
│   │   │   │   ├── sentence_ranking.py
│   │   │   │   ├── translation.py
│   │   │   │   ├── translation_from_pretrained_xlm.py
│   │   │   │   ├── translation_lev.py
│   │   │   │   └── translation_moe.py
│   │   │   ├── tokenizer.py
│   │   │   ├── trainer.py
│   │   │   └── utils.py
│   │   ├── fairseq_cli/
│   │   │   └── __init__.py
│   │   ├── generate.py
│   │   ├── hubconf.py
│   │   ├── interactive.py
│   │   ├── preprocess.py
│   │   ├── score.py
│   │   ├── scripts/
│   │   │   ├── __init__.py
│   │   │   ├── average_checkpoints.py
│   │   │   ├── build_sym_alignment.py
│   │   │   ├── compare_namespaces.py
│   │   │   ├── compound_split_bleu.sh
│   │   │   ├── convert_dictionary.lua
│   │   │   ├── convert_model.lua
│   │   │   ├── count_docs.py
│   │   │   ├── read_binarized.py
│   │   │   ├── rm_pt.py
│   │   │   ├── sacrebleu_pregen.sh
│   │   │   ├── shard_docs.py
│   │   │   ├── split_train_valid_docs.py
│   │   │   ├── spm_decode.py
│   │   │   ├── spm_encode.py
│   │   │   ├── spm_train.py
│   │   │   ├── wav2vec_featurize.py
│   │   │   └── wav2vec_manifest.py
│   │   ├── setup.py
│   │   ├── tests/
│   │   │   ├── __init__.py
│   │   │   ├── speech_recognition/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── asr_test_base.py
│   │   │   │   ├── test_collaters.py
│   │   │   │   ├── test_cross_entropy.py
│   │   │   │   └── test_vggtransformer.py
│   │   │   ├── test_average_checkpoints.py
│   │   │   ├── test_backtranslation_dataset.py
│   │   │   ├── test_binaries.py
│   │   │   ├── test_bmuf.py
│   │   │   ├── test_character_token_embedder.py
│   │   │   ├── test_concat_dataset.py
│   │   │   ├── test_convtbc.py
│   │   │   ├── test_dictionary.py
│   │   │   ├── test_iterators.py
│   │   │   ├── test_label_smoothing.py
│   │   │   ├── test_memory_efficient_fp16.py
│   │   │   ├── test_multi_corpus_sampled_dataset.py
│   │   │   ├── test_multihead_attention.py
│   │   │   ├── test_noising.py
│   │   │   ├── test_reproducibility.py
│   │   │   ├── test_resampling_dataset.py
│   │   │   ├── test_sequence_generator.py
│   │   │   ├── test_sequence_scorer.py
│   │   │   ├── test_sparse_multihead_attention.py
│   │   │   ├── test_token_block_dataset.py
│   │   │   ├── test_train.py
│   │   │   ├── test_utils.py
│   │   │   └── utils.py
│   │   ├── train.py
│   │   └── validate.py
│   ├── src-infoxlm/
│   │   ├── infoxlm/
│   │   │   ├── __init__.py
│   │   │   ├── criterions/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── xlco.py
│   │   │   │   └── xlm_align.py
│   │   │   ├── data/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── dict_dataset.py
│   │   │   │   ├── mlm_utils.py
│   │   │   │   ├── offset_dataset.py
│   │   │   │   ├── tlm_dataset.py
│   │   │   │   ├── xlco_dataset.py
│   │   │   │   └── xlm_align.py
│   │   │   ├── models/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── infoxlm.py
│   │   │   │   ├── roberta.py
│   │   │   │   └── xlm_align.py
│   │   │   ├── tasks/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── infoxlm.py
│   │   │   │   ├── mlm.py
│   │   │   │   ├── tlm.py
│   │   │   │   └── xlm_align.py
│   │   │   └── utils.py
│   │   ├── setup.py
│   │   └── train.py
│   └── tools/
│       ├── para2bin.py
│       ├── para2bin4xlco.py
│       └── txt2bin.py
├── kosmos-1/
│   └── README.md
├── kosmos-2/
│   ├── README.md
│   ├── data/
│   │   ├── dict.txt
│   │   ├── generate_config.py
│   │   ├── prepare_grit.py
│   │   ├── sentencepiece.bpe.model
│   │   └── visualize_grit.py
│   ├── demo/
│   │   ├── decode_string.py
│   │   ├── draw_box.py
│   │   └── gradio_app.py
│   ├── docs/
│   │   └── install.md
│   ├── evaluation/
│   │   ├── caption_obj_few_shot.py
│   │   ├── caption_obj_qa.py
│   │   ├── flickr_entities/
│   │   │   ├── README.md
│   │   │   ├── cook_data.py
│   │   │   ├── decode_string.py
│   │   │   └── flickr_entities_evaluate.py
│   │   ├── grd-zeroshot-flickr.sh
│   │   ├── grd-zeroshot-refcoco.sh
│   │   ├── refcoco/
│   │   │   ├── README.md
│   │   │   ├── box_ops.py
│   │   │   ├── cook_data.py
│   │   │   ├── decode_string.py
│   │   │   └── refexp_evaluate.py
│   │   ├── seed-bench/
│   │   │   ├── README.md
│   │   │   ├── cook_image_data.py
│   │   │   └── eval_ppl.py
│   │   └── zeroshot-seed-bench.sh
│   ├── fairseq/
│   │   ├── .circleci/
│   │   │   └── config.yml
│   │   ├── .github/
│   │   │   ├── ISSUE_TEMPLATE/
│   │   │   │   ├── bug_report.md
│   │   │   │   ├── documentation.md
│   │   │   │   ├── feature_request.md
│   │   │   │   └── how-to-question.md
│   │   │   ├── ISSUE_TEMPLATE.md
│   │   │   ├── PULL_REQUEST_TEMPLATE.md
│   │   │   ├── stale.yml
│   │   │   └── workflows/
│   │   │       ├── build.yml
│   │   │       └── build_wheels.yml
│   │   ├── .gitignore
│   │   ├── .gitmodules
│   │   ├── .isort.cfg
│   │   ├── .pre-commit-config.yaml
│   │   ├── CODE_OF_CONDUCT.md
│   │   ├── CONTRIBUTING.md
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── docs/
│   │   │   ├── Makefile
│   │   │   ├── _static/
│   │   │   │   └── theme_overrides.css
│   │   │   ├── command_line_tools.rst
│   │   │   ├── conf.py
│   │   │   ├── criterions.rst
│   │   │   ├── data.rst
│   │   │   ├── docutils.conf
│   │   │   ├── 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
│   │   │   ├── MMPT/
│   │   │   │   ├── .gitignore
│   │   │   │   ├── CONFIG.md
│   │   │   │   ├── DATASET.md
│   │   │   │   ├── README.md
│   │   │   │   ├── endtask.md
│   │   │   │   ├── locallaunch.py
│   │   │   │   ├── mmpt/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── datasets/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── fairseqmmdataset.py
│   │   │   │   │   │   └── mmdataset.py
│   │   │   │   │   ├── evaluators/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── evaluator.py
│   │   │   │   │   │   ├── metric.py
│   │   │   │   │   │   └── predictor.py
│   │   │   │   │   ├── losses/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── fairseqmmloss.py
│   │   │   │   │   │   ├── loss.py
│   │   │   │   │   │   └── nce.py
│   │   │   │   │   ├── models/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── fairseqmmmodel.py
│   │   │   │   │   │   ├── mmfusion.py
│   │   │   │   │   │   ├── mmfusionnlg.py
│   │   │   │   │   │   └── transformermodel.py
│   │   │   │   │   ├── modules/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── mm.py
│   │   │   │   │   │   ├── retri.py
│   │   │   │   │   │   └── vectorpool.py
│   │   │   │   │   ├── processors/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── dedupprocessor.py
│   │   │   │   │   │   ├── dsprocessor.py
│   │   │   │   │   │   ├── how2processor.py
│   │   │   │   │   │   ├── how2retriprocessor.py
│   │   │   │   │   │   ├── models/
│   │   │   │   │   │   │   └── s3dg.py
│   │   │   │   │   │   └── processor.py
│   │   │   │   │   ├── tasks/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── fairseqmmtask.py
│   │   │   │   │   │   ├── milncetask.py
│   │   │   │   │   │   ├── retritask.py
│   │   │   │   │   │   ├── task.py
│   │   │   │   │   │   └── vlmtask.py
│   │   │   │   │   └── utils/
│   │   │   │   │       ├── __init__.py
│   │   │   │   │       ├── load_config.py
│   │   │   │   │       └── shardedtensor.py
│   │   │   │   ├── mmpt_cli/
│   │   │   │   │   ├── localjob.py
│   │   │   │   │   └── predict.py
│   │   │   │   ├── pretraining.md
│   │   │   │   ├── projects/
│   │   │   │   │   ├── mfmmlm.yaml
│   │   │   │   │   ├── mtm/
│   │   │   │   │   │   ├── mmfusionmtm.yaml
│   │   │   │   │   │   ├── vlm/
│   │   │   │   │   │   │   ├── coin.yaml
│   │   │   │   │   │   │   ├── crosstask.yaml
│   │   │   │   │   │   │   ├── how2.yaml
│   │   │   │   │   │   │   ├── test_coin.yaml
│   │   │   │   │   │   │   ├── test_crosstask.yaml
│   │   │   │   │   │   │   ├── test_crosstask_zs.yaml
│   │   │   │   │   │   │   ├── test_vtt.yaml
│   │   │   │   │   │   │   ├── test_vttqa.yaml
│   │   │   │   │   │   │   ├── test_youcook.yaml
│   │   │   │   │   │   │   ├── test_youcookcap.yaml
│   │   │   │   │   │   │   ├── vtt.yaml
│   │   │   │   │   │   │   ├── vttqa.yaml
│   │   │   │   │   │   │   ├── youcook.yaml
│   │   │   │   │   │   │   └── youcookcap.yaml
│   │   │   │   │   │   └── vlm.yaml
│   │   │   │   │   ├── retri/
│   │   │   │   │   │   ├── videoclip/
│   │   │   │   │   │   │   ├── coin_videoclip.yaml
│   │   │   │   │   │   │   ├── crosstask_videoclip.yaml
│   │   │   │   │   │   │   ├── how2.yaml
│   │   │   │   │   │   │   ├── test_coin_videoclip.yaml
│   │   │   │   │   │   │   ├── test_coin_zs.yaml
│   │   │   │   │   │   │   ├── test_crosstask_videoclip.yaml
│   │   │   │   │   │   │   ├── test_crosstask_zs_videoclip.yaml
│   │   │   │   │   │   │   ├── test_didemo_zs.yaml
│   │   │   │   │   │   │   ├── test_vtt_videoclip.yaml
│   │   │   │   │   │   │   ├── test_vtt_zs.yaml
│   │   │   │   │   │   │   ├── test_vttqa_videoclip.yaml
│   │   │   │   │   │   │   ├── test_vttqa_zs.yaml
│   │   │   │   │   │   │   ├── test_youcook_videoclip.yaml
│   │   │   │   │   │   │   ├── test_youcook_zs.yaml
│   │   │   │   │   │   │   ├── vtt_videoclip.yaml
│   │   │   │   │   │   │   ├── vttqa_videoclip.yaml
│   │   │   │   │   │   │   └── youcook_videoclip.yaml
│   │   │   │   │   │   ├── videoclip.yaml
│   │   │   │   │   │   └── videoretri.yaml
│   │   │   │   │   └── task/
│   │   │   │   │       ├── coin.yaml
│   │   │   │   │       ├── coin_videoclip.yaml
│   │   │   │   │       ├── crosstask.yaml
│   │   │   │   │       ├── crosstask_videoclip.yaml
│   │   │   │   │       ├── default.yaml
│   │   │   │   │       ├── ft.yaml
│   │   │   │   │       ├── how2.yaml
│   │   │   │   │       ├── test.yaml
│   │   │   │   │       ├── test_coin.yaml
│   │   │   │   │       ├── test_coin_videoclip.yaml
│   │   │   │   │       ├── test_coin_zs.yaml
│   │   │   │   │       ├── test_crosstask.yaml
│   │   │   │   │       ├── test_crosstask_videoclip.yaml
│   │   │   │   │       ├── test_crosstask_zs.yaml
│   │   │   │   │       ├── test_crosstask_zs_videoclip.yaml
│   │   │   │   │       ├── test_didemo_zs.yaml
│   │   │   │   │       ├── test_vtt.yaml
│   │   │   │   │       ├── test_vtt_videoclip.yaml
│   │   │   │   │       ├── test_vtt_zs.yaml
│   │   │   │   │       ├── test_vttqa.yaml
│   │   │   │   │       ├── test_vttqa_videoclip.yaml
│   │   │   │   │       ├── test_vttqa_zs.yaml
│   │   │   │   │       ├── test_youcook.yaml
│   │   │   │   │       ├── test_youcook_videoclip.yaml
│   │   │   │   │       ├── test_youcook_zs.yaml
│   │   │   │   │       ├── test_youcookcap.yaml
│   │   │   │   │       ├── vtt.yaml
│   │   │   │   │       ├── vtt_videoclip.yaml
│   │   │   │   │       ├── vttqa.yaml
│   │   │   │   │       ├── vttqa_videoclip.yaml
│   │   │   │   │       ├── youcook.yaml
│   │   │   │   │       ├── youcook_videoclip.yaml
│   │   │   │   │       └── youcookcap.yaml
│   │   │   │   ├── scripts/
│   │   │   │   │   ├── text_token_extractor/
│   │   │   │   │   │   ├── configs/
│   │   │   │   │   │   │   └── bert-base-uncased.yaml
│   │   │   │   │   │   └── pretokenization.py
│   │   │   │   │   └── video_feature_extractor/
│   │   │   │   │       ├── extract.py
│   │   │   │   │       ├── how2/
│   │   │   │   │       │   └── s3d.sh
│   │   │   │   │       ├── model.py
│   │   │   │   │       ├── pathbuilder.py
│   │   │   │   │       ├── preprocessing.py
│   │   │   │   │       ├── random_sequence_shuffler.py
│   │   │   │   │       ├── shard_feature.py
│   │   │   │   │       └── videoreader.py
│   │   │   │   └── setup.py
│   │   │   ├── __init__.py
│   │   │   ├── 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
│   │   │   ├── attention_head_selection/
│   │   │   │   ├── README.md
│   │   │   │   └── src/
│   │   │   │       ├── __init__.py
│   │   │   │       ├── data/
│   │   │   │       │   ├── __init__.py
│   │   │   │       │   └── speech_to_text_dataset_with_domain.py
│   │   │   │       ├── loss/
│   │   │   │       │   ├── __init__.py
│   │   │   │       │   └── attention_head_selection.py
│   │   │   │       ├── models/
│   │   │   │       │   ├── __init__.py
│   │   │   │       │   ├── head_selection_s2t_transformer.py
│   │   │   │       │   └── head_selection_transformer.py
│   │   │   │       ├── modules/
│   │   │   │       │   ├── __init__.py
│   │   │   │       │   ├── attn_head_selector.py
│   │   │   │       │   ├── head_selection_transformer_layer.py
│   │   │   │       │   ├── multihead_attention_selection.py
│   │   │   │       │   └── multihead_functional.py
│   │   │   │       └── speech_to_text_head_selection.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
│   │   │   ├── discriminative_reranking_nmt/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── config/
│   │   │   │   │   └── deen.yaml
│   │   │   │   ├── criterions/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── discriminative_reranking_criterion.py
│   │   │   │   ├── drnmt_rerank.py
│   │   │   │   ├── models/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── discriminative_reranking_model.py
│   │   │   │   ├── scripts/
│   │   │   │   │   └── prep_data.py
│   │   │   │   └── tasks/
│   │   │   │       ├── __init__.py
│   │   │   │       └── discriminative_reranking_task.py
│   │   │   ├── fast_noisy_channel/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── noisy_channel_beam_search.py
│   │   │   │   ├── noisy_channel_sequence_generator.py
│   │   │   │   └── noisy_channel_translation.py
│   │   │   ├── flores101/
│   │   │   │   └── README.md
│   │   │   ├── 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
│   │   │   │   │   ├── dump_w2v2_feature.py
│   │   │   │   │   ├── feature_utils.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
│   │   │   ├── moe_lm/
│   │   │   │   ├── README.md
│   │   │   │   ├── data_card.md
│   │   │   │   └── model_card.md
│   │   │   ├── 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
│   │   │   ├── normformer/
│   │   │   │   ├── README.md
│   │   │   │   └── train_lm.sh
│   │   │   ├── operators/
│   │   │   │   ├── alignment_train_cpu.cpp
│   │   │   │   ├── alignment_train_cuda.cpp
│   │   │   │   ├── alignment_train_cuda.h
│   │   │   │   ├── alignment_train_kernel.cu
│   │   │   │   └── utils.h
│   │   │   ├── 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
│   │   │   │   ├── commonsense_qa/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── commonsense_qa_task.py
│   │   │   │   │   └── download_cqa_data.sh
│   │   │   │   ├── config/
│   │   │   │   │   ├── finetuning/
│   │   │   │   │   │   ├── cola.yaml
│   │   │   │   │   │   ├── mnli.yaml
│   │   │   │   │   │   ├── mrpc.yaml
│   │   │   │   │   │   ├── qnli.yaml
│   │   │   │   │   │   ├── qqp.yaml
│   │   │   │   │   │   ├── rte.yaml
│   │   │   │   │   │   ├── sst_2.yaml
│   │   │   │   │   │   └── sts_b.yaml
│   │   │   │   │   └── pretraining/
│   │   │   │   │       └── base.yaml
│   │   │   │   ├── 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
│   │   │   ├── shuffled_word_order/
│   │   │   │   ├── README.finetuning.md
│   │   │   │   └── README.md
│   │   │   ├── simultaneous_translation/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── docs/
│   │   │   │   │   ├── ende-mma.md
│   │   │   │   │   └── enja-waitk.md
│   │   │   │   ├── eval/
│   │   │   │   │   └── agents/
│   │   │   │   │       └── simul_t2t_enja.py
│   │   │   │   ├── models/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── convtransformer_simul_trans.py
│   │   │   │   │   └── transformer_monotonic_attention.py
│   │   │   │   ├── modules/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── fixed_pre_decision.py
│   │   │   │   │   ├── monotonic_multihead_attention.py
│   │   │   │   │   └── monotonic_transformer_layer.py
│   │   │   │   └── utils/
│   │   │   │       ├── __init__.py
│   │   │   │       ├── functions.py
│   │   │   │       ├── monotonic_attention.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_synthesis/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── data_utils.py
│   │   │   │   ├── docs/
│   │   │   │   │   ├── common_voice_example.md
│   │   │   │   │   ├── ljspeech_example.md
│   │   │   │   │   └── vctk_example.md
│   │   │   │   ├── evaluation/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── eval_asr.py
│   │   │   │   │   ├── eval_f0.py
│   │   │   │   │   ├── eval_sp.py
│   │   │   │   │   └── get_eval_manifest.py
│   │   │   │   ├── generate_waveform.py
│   │   │   │   ├── preprocessing/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── denoise_and_vad_audio.py
│   │   │   │   │   ├── denoiser/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── demucs.py
│   │   │   │   │   │   ├── pretrained.py
│   │   │   │   │   │   ├── resample.py
│   │   │   │   │   │   └── utils.py
│   │   │   │   │   ├── get_common_voice_audio_manifest.py
│   │   │   │   │   ├── get_feature_manifest.py
│   │   │   │   │   ├── get_ljspeech_audio_manifest.py
│   │   │   │   │   ├── get_speaker_embedding.py
│   │   │   │   │   ├── get_vctk_audio_manifest.py
│   │   │   │

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
Model I am using (UniLM, MiniLM, LayoutLM ...):

The problem arises when using:
* [ ] the official example scripts: (give details below)
* [ ] my own modified scripts: (give details below)

A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. 
2. 
3. 

**Expected behavior**
A clear and concise description of what you expected to happen.

- Platform:
- Python version:
- PyTorch version (GPU?):


================================================
FILE: .github/ISSUE_TEMPLATE/custom.md
================================================
---
name: Custom issue template
about: Describe this issue template's purpose here.
title: ''
labels: ''
assignees: ''

---

**Describe**
Model I am using (UniLM, MiniLM, LayoutLM ...):


================================================
FILE: .gitignore
================================================
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
speechlm/dataset/LibriSpeech/fast_phone2unit/dict.PHN.txt
speechlm/dataset/LibriSpeech/fast_phone2unit/dict.phn.txt


================================================
FILE: .gitmodules
================================================
[submodule "deltalm/fairseq"]
	path = deltalm/fairseq
	url = https://github.com/pytorch/fairseq.git
[submodule "speechlm/fairseq"]
	path = speechlm/fairseq
	url = https://github.com/facebookresearch/fairseq.git
[submodule "speecht5/fairseq"]
	path = speecht5/fairseq
	url = https://github.com/facebookresearch/fairseq.git


================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Microsoft Open Source Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).

Resources:

- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns


================================================
FILE: CONTRIBUTING.md
================================================
# Contributing

This project welcomes contributions and suggestions. Most contributions require you to
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
and actually do, grant us the rights to use your contribution. For details, visit
https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.


================================================
FILE: Diff-Transformer/Diff-Transformer-V2/README.md
================================================
# Differential Transformer V2 (DIFF V2)

[Read the blog post here](https://spiky-homegrown-4cb.notion.site/Differential-Transformer-V2-2e7baa052def80ecaa93d4d67d125417)

The implementation is provided in `multihead_flashdiffv2.py`.

## TL;DR

We introduce **Differential Transformer V2** (DIFF V2), an improved version of [Differential Transformer](https://arxiv.org/abs/2410.05258) (DIFF V1). This revision focuses on inference efficiency, training stability for production-level LLMs, and architectural elegance.

### Key Improvements

1. **Faster Inference & No Need of Custom Attention Kernels**  
   Instead of forcing the attention parameter count to match the baseline Transformer (as in DIFF V1), we introduce additional parameters for $Q_2$. This design allows DIFF V2 to match the baseline Transformer’s decoding speed and directly use [FlashAttention](https://github.com/Dao-AILab/flash-attention) without custom kernels.
   
2. **Improved Training Stability**  
   We remove the per-head RMSNorm after differential attention. We find the per-head RMSNorm can lead to instability in later stages of large-scale pretraining of LLM.

3. **Simpler Parameterization & Initialization**  
   We replace the globally shared $\lambda$ with a token-specific, head-wise projected $\lambda$. This eliminates the exponential re-parameterization and initialization complexity of $\lambda$ in V1.

## Implementation Details

### Pseudocode

In the script, `h` represents number of query heads, `h_kv`  represents number of key-value heads, and `d` means head dimension. The $\lambda$ in DIFF V2 is projected from $X$ for each token each head.

(For simplicity, we omit the batch dimension and assume that both the input and output of the following `flash_attn_func` are three-dimensional tensors `(tokens, heads, head dimension)`. Heads belonging to the same GQA group are arranged contiguously in the output)

```python
def DiffAttnV2(
	q, k, v, lam
):
   """
   q:   (N, 2h, d)
   k:   (N, h_kv, d)
   v:   (N, h_kv, d)
   lam: (N, h, 1)
   """

   attn = flash_attn_func(q, k, v)
   attn1, attn2 = (attn[:, 0::2], 
                     attn[:, 1::2])

   lam_val = sigmoid(lam)
   attn = attn1 - lam_val * attn2
   return attn
```

### Note

DIFF V2 subtracts two heads that are **in the same GQA group, which means they share the same key and value**.

```python
# Subtraction of two heads that are **not** in the same GQA group
# ❌ Wrong Implementation of DIFF V2!
...
attn = flash_attn_func(q, k, v)
nh = attn.size(1)
attn1, attn2 = (attn[:, :nh//2], 
		          attn[:, nh//2:])
# similarly, also wrong implementation:
# attn1, attn2 = attn.chunk(2, dim=1)
...
```

```python
# DIFF V2: Subtraction of two heads that are **in** the same GQA group
# ✅ Correct Implementation of DIFF V2
...
attn = flash_attn_func(q, k, v)

attn1, attn2 = (attn[:, 0::2], 
		          attn[:, 1::2])
...
```


================================================
FILE: Diff-Transformer/Diff-Transformer-V2/multihead_flashdiffv2.py
================================================
import torch
from torch import nn
from typing import Optional, Tuple
from ..kernel.rotary import apply_rotary_emb
from flash_attn import flash_attn_func


@torch.compile
def diff_func(attn1: torch.Tensor, attn2: torch.Tensor, lambda_val: torch.Tensor) -> torch.Tensor:
    return attn1 - torch.sigmoid(lambda_val).unsqueeze(-1) * attn2


class MultiheadFlashDiffV2(nn.Module):
    """
    Differential Attention Version 2 (DiffAttnV2) implementation using Flash Attention.
    """
    def __init__(
        self,
        use_diff_v2: bool, # If False, acts as a baseline Transformer attention
        d_model: int,      # Model dimension
        num_heads: int,    # Number of output heads
        num_kv_heads: Optional[int], # Number of KV heads for GQA
        head_dim: int,     # Dimension per head
    ):
        super().__init__()
        self.use_diff_v2 = use_diff_v2
        self.d_model = d_model
        self.num_heads = num_heads
        self.num_kv_heads = num_kv_heads if num_kv_heads is not None else num_heads
        self.head_dim = head_dim
        
        self.num_q_heads = 2 * self.num_heads if self.use_diff_v2 else self.num_heads
        self.q_proj = nn.Linear(self.d_model, self.num_q_heads * self.head_dim, bias=False)
        self.k_proj = nn.Linear(self.d_model, self.num_kv_heads * self.head_dim, bias=False)
        self.v_proj = nn.Linear(self.d_model, self.num_kv_heads * self.head_dim, bias=False)
        self.o_proj = nn.Linear(self.num_heads * self.head_dim, self.d_model, bias=False)
        self.lambda_proj = nn.Linear(self.d_model, self.num_heads, bias=False) if self.use_diff_v2 else None
    
    def forward(
        self,
        x: torch.Tensor,               # Input tensor [bsz, seq_len, d_model]
        rel_pos: Tuple[torch.Tensor, torch.Tensor], # Rotary embedding (cos, sin)
    ) -> torch.Tensor:
        """
        Forward pass for MultiheadFlashDiffV2.
        
        Args:
            x: Input hidden states of shape [batch, length, d_model]
            rel_pos: Tuple of (cos, sin) tensors for rotary positional embeddings
            
        Returns:
            Output tensor of shape [batch, length, d_model]
        """
        bsz, tgt_len, _ = x.size()
        src_len = tgt_len

        q = self.q_proj(x)
        k = self.k_proj(x)
        v = self.v_proj(x)

        q = q.view(bsz, tgt_len, self.num_q_heads, self.head_dim)
        k = k.view(bsz, src_len, self.num_kv_heads, self.head_dim)
        v = v.view(bsz, src_len, self.num_kv_heads, self.head_dim)

        q = apply_rotary_emb(q, *rel_pos, interleaved=True)
        k = apply_rotary_emb(k, *rel_pos, interleaved=True)

        attn = flash_attn_func(q, k, v, causal=True)
        if self.use_diff_v2:
            lambda_val = self.lambda_proj(x)
            attn1, attn2 = attn[:, :, 0::2], attn[:, :, 1::2]
            attn = diff_func(attn1, attn2, lambda_val)
        
        attn = attn.reshape(bsz, tgt_len, self.num_heads * self.head_dim)
        output = self.o_proj(attn)
        return output


================================================
FILE: Diff-Transformer/README.md
================================================
# Differential Transformer
## Approach
<div align="center">
  <img src="./imgs/arch.png" width=90%/>
</div>

## Contents
`multihead_diffattn.py` contains naive implementation of multi-head differential attention.

`multihead_flashdiff_1.py` contains multi-head differential attention implemented with FlashAttention, for packages that support different qk/v dimensions (e.g., our [customized-flash-attention](https://aka.ms/flash-diff) and [xformers](https://github.com/facebookresearch/xformers)). **(Recommended for faster training and inference)**

`multihead_flashdiff_2.py` contains multi-head differential attention implemented with FlashAttention, for packages that **do not** support different qk/v dimensions (e.g., [flash-attention](https://github.com/Dao-AILab/flash-attention)).

`multihead_attention.py` contains implementation of conventional multi-head attention.

`example.py` contains instantiation of differential attention and conventional attention in pair, which can be compared against each other.

Also refer to [PR](https://github.com/microsoft/unilm/pull/1633) for another implementation.

We recommend using models with a sufficiently large number of heads to minimize the impact of halving heads. For instance, using Diff Transformer with more than 8 heads (the minimum used in the paper, with the same number of parameters as Transformer with 16 heads) is advisable.

## Core Code 
<div align="center">
  <img src="./imgs/code_highlight.png" width=100%/>
</div>


================================================
FILE: Diff-Transformer/example.py
================================================
from multihead_diffattn import MultiheadDiffAttn
from multihead_attention import MultiheadAttention

if __name__ == "__main__":
    # Diff Attention with MHA, 1024 embed_dim, 8 heads, 8 kv_heads
    diff_attn_mha = MultiheadDiffAttn(embed_dim=1024, depth=0, num_heads=8, num_kv_heads=None)
    # can be compared against baseline Attention with MHA, 1024 embed_dim, 16 heads, 16 kv_heads
    attn_mha = MultiheadAttention(embed_dim=1024, depth=0, num_heads=16, num_kv_heads=None)
    # write code to print their number of parameters
    print("Number of parameters in 1 layer diff_attn_mha:", sum(p.numel() for p in diff_attn_mha.parameters()))
    print("Number of parameters in 1 layer attn_mha:", sum(p.numel() for p in attn_mha.parameters()))


    # Diff Attention with GQA, 1024 embed_dim, 8 heads, 4 kv_heads
    diff_attn_gqa = MultiheadDiffAttn(embed_dim=1024, depth=0, num_heads=8, num_kv_heads=4)
    # can be compared against baseline Attention with GQA, 1024 embed_dim, 16 heads, 8 kv_heads
    attn_gqa = MultiheadAttention(embed_dim=1024, depth=0, num_heads=16, num_kv_heads=8)
    print("Number of parameters in 1 layer diff_attn_gqa:", sum(p.numel() for p in diff_attn_gqa.parameters()))
    print("Number of parameters in 1 layer attn_gqa:", sum(p.numel() for p in attn_gqa.parameters()))


================================================
FILE: Diff-Transformer/kernel/rotary.py
================================================
# Copyright (c) 2023, Tri Dao.

from typing import Optional, Union

import torch

import triton
import triton.language as tl


# @triton.autotune(
#     configs=[
#         triton.Config({"BLOCK_M": 2}),
#         triton.Config({"BLOCK_M": 4}),
#         triton.Config({"BLOCK_M": 8}),
#         triton.Config({"BLOCK_M": 16}),
#     ],
#     key=["CACHE_KEY_SEQLEN", "BLOCK_K", "INTERLEAVED"],
# )
@triton.jit
def rotary_kernel(
    OUT,  # Pointers to matrices
    X,
    COS,
    SIN,
    CU_SEQLENS,
    SEQLEN_OFFSETS,  # this could be int or a pointer
    # Matrix dimensions
    seqlen,
    nheads,
    rotary_dim,
    seqlen_ro,
    CACHE_KEY_SEQLEN,
    # strides
    stride_out_batch,
    stride_out_seqlen,
    stride_out_nheads,
    stride_out_headdim,
    stride_x_batch,
    stride_x_seqlen,
    stride_x_nheads,
    stride_x_headdim,
    # Meta-parameters
    BLOCK_K: tl.constexpr,
    IS_SEQLEN_OFFSETS_TENSOR: tl.constexpr,
    IS_VARLEN: tl.constexpr,
    INTERLEAVED: tl.constexpr,
    CONJUGATE: tl.constexpr,
    BLOCK_M: tl.constexpr,
):
    pid_m = tl.program_id(axis=0)
    pid_batch = tl.program_id(axis=1)
    pid_head = tl.program_id(axis=2)
    rotary_dim_half = rotary_dim // 2

    if not IS_VARLEN:
        X = X + pid_batch * stride_x_batch + pid_head * stride_x_nheads
        OUT = OUT + pid_batch * stride_out_batch + pid_head * stride_out_nheads
    else:
        start_idx = tl.load(CU_SEQLENS + pid_batch)
        seqlen = tl.load(CU_SEQLENS + pid_batch + 1) - start_idx
        X = X + start_idx * stride_x_seqlen + pid_head * stride_x_nheads
        OUT = OUT + start_idx * stride_out_seqlen + pid_head * stride_out_nheads

    if pid_m * BLOCK_M >= seqlen:
        return
    rm = pid_m * BLOCK_M + tl.arange(0, BLOCK_M)
    if not IS_SEQLEN_OFFSETS_TENSOR:
        rm_cs = rm + SEQLEN_OFFSETS
    else:
        rm_cs = rm + tl.load(SEQLEN_OFFSETS + pid_batch)
    rk = tl.arange(0, BLOCK_K)
    rk_half = tl.arange(0, BLOCK_K // 2)

    if not INTERLEAVED:
        # Load the 1st and 2nd halves of X, do calculation, then store to 1st and 2nd halves of OUT
        X = X + (rm[:, None] * stride_x_seqlen + rk_half[None, :] * stride_x_headdim)
        COS = COS + (rm_cs[:, None] * rotary_dim_half + rk_half[None, :])
        SIN = SIN + (rm_cs[:, None] * rotary_dim_half + rk_half[None, :])
        cos = tl.load(
            COS, mask=(rm_cs[:, None] < seqlen_ro) & (rk_half[None, :] < rotary_dim_half), other=1.0
        ).to(tl.float32)
        sin = tl.load(
            SIN, mask=(rm_cs[:, None] < seqlen_ro) & (rk_half[None, :] < rotary_dim_half), other=0.0
        ).to(tl.float32)
        x0 = tl.load(
            X, mask=(rm[:, None] < seqlen) & (rk_half[None, :] < rotary_dim_half), other=0.0
        ).to(tl.float32)
        x1 = tl.load(
            X + rotary_dim_half * stride_x_headdim,
            mask=(rm[:, None] < seqlen) & (rk_half[None, :] < rotary_dim_half),
            other=0.0,
        ).to(tl.float32)
        if CONJUGATE:
            sin = -sin
        o0 = x0 * cos - x1 * sin
        o1 = x0 * sin + x1 * cos
        # write back result
        OUT = OUT + (rm[:, None] * stride_out_seqlen + rk_half[None, :] * stride_out_headdim)
        tl.store(OUT, o0, mask=(rm[:, None] < seqlen) & (rk_half[None, :] < rotary_dim_half))
        tl.store(
            OUT + rotary_dim_half * stride_out_headdim,
            o1,
            mask=(rm[:, None] < seqlen) & (rk_half[None, :] < rotary_dim_half),
        )
    else:
        # We don't want to load X[0, 2, 4, ...] and X[1, 3, 5, ...] separately since both are slow.
        # Instead, we load x0 = X[0, 1, 2, 3, ...] and x1 = X[1, 0, 3, 2, ...].
        # Loading x0 will be fast but x1 will be slow.
        # Then we load cos = COS[0, 0, 1, 1, ...] and sin = SIN[0, 0, 1, 1, ...].
        # Then we do the calculation and use tl.where to pick put the right outputs for the even
        # and for the odd indices.
        rk_swap = rk + ((rk + 1) % 2) * 2 - 1  # 1, 0, 3, 2, 5, 4, ...
        rk_repeat = tl.arange(0, BLOCK_K) // 2
        X0 = X + (rm[:, None] * stride_x_seqlen + rk[None, :] * stride_x_headdim)
        X1 = X + (rm[:, None] * stride_x_seqlen + rk_swap[None, :] * stride_x_headdim)
        COS = COS + (rm_cs[:, None] * rotary_dim_half + rk_repeat[None, :])
        SIN = SIN + (rm_cs[:, None] * rotary_dim_half + rk_repeat[None, :])
        cos = tl.load(
            COS,
            mask=(rm_cs[:, None] < seqlen_ro) & (rk_repeat[None, :] < rotary_dim_half),
            other=1.0,
        ).to(tl.float32)
        sin = tl.load(
            SIN,
            mask=(rm_cs[:, None] < seqlen_ro) & (rk_repeat[None, :] < rotary_dim_half),
            other=0.0,
        ).to(tl.float32)
        x0 = tl.load(X0, mask=(rm[:, None] < seqlen) & (rk[None, :] < rotary_dim), other=0.0).to(
            tl.float32
        )
        x1 = tl.load(
            X1, mask=(rm[:, None] < seqlen) & (rk_swap[None, :] < rotary_dim), other=0.0
        ).to(tl.float32)
        if CONJUGATE:
            sin = -sin
        x0_cos = x0 * cos
        x1_sin = x1 * sin
        out = tl.where(rk[None, :] % 2 == 0, x0_cos - x1_sin, x0_cos + x1_sin)
        OUT = OUT + (rm[:, None] * stride_out_seqlen + rk[None, :] * stride_out_headdim)
        tl.store(OUT, out, mask=(rm[:, None] < seqlen) & (rk[None, :] < rotary_dim))


def apply_rotary(
    x: torch.Tensor,
    cos: torch.Tensor,
    sin: torch.Tensor,
    seqlen_offsets: Union[int, torch.Tensor] = 0,
    cu_seqlens: Optional[torch.Tensor] = None,
    max_seqlen: Optional[int] = None,
    interleaved=False,
    inplace=False,
    conjugate=False,
) -> torch.Tensor:
    """
    Arguments:
        x: (batch, seqlen, nheads, headdim) if cu_seqlens is None
            else (total_seqlen, nheads, headdim).
        cos: (seqlen_ro, rotary_dim / 2)
        sin: (seqlen_ro, rotary_dim / 2)
        seqlen_offsets: integer or integer tensor of size (batch,)
        cu_seqlens: (batch + 1,) or None
        max_seqlen: int
    Returns:
        y: (batch, seqlen, nheads, headdim)
    """
    is_varlen = cu_seqlens is not None
    if not is_varlen:
        batch, seqlen, nheads, headdim = x.shape
    else:
        assert max_seqlen is not None, "If cu_seqlens is passed in, then max_seqlen must be passed"
        total_seqlen, nheads, headdim = x.shape
        batch_p_1 = cu_seqlens.shape[0]
        batch = batch_p_1 - 1
        seqlen = max_seqlen
    seqlen_ro, rotary_dim = cos.shape
    assert sin.shape == cos.shape
    rotary_dim *= 2
    assert rotary_dim <= headdim, "rotary_dim must be <= headdim"
    assert headdim <= 256, "Only support headdim <= 256"
    assert seqlen_ro >= seqlen, "seqlen_ro must be >= seqlen"

    assert (
        cos.dtype == sin.dtype
    ), f"cos and sin must have the same dtype, got {cos.dtype} and {sin.dtype}"
    assert (
        x.dtype == cos.dtype
    ), f"Input and cos/sin must have the same dtype, got {x.dtype} and {cos.dtype}"

    cos, sin = cos.contiguous(), sin.contiguous()
    if isinstance(seqlen_offsets, torch.Tensor):
        assert seqlen_offsets.shape == (batch,)
        assert seqlen_offsets.dtype in [torch.int32, torch.int64]
        seqlen_offsets = seqlen_offsets.contiguous()
    else:
        assert seqlen_offsets + seqlen <= seqlen_ro

    output = torch.empty_like(x) if not inplace else x
    if rotary_dim < headdim and not inplace:
        output[..., rotary_dim:].copy_(x[..., rotary_dim:])

    BLOCK_K = (
        32
        if rotary_dim <= 32
        else (64 if rotary_dim <= 64 else (128 if rotary_dim <= 128 else 256))
    )
    grid = lambda META: (triton.cdiv(seqlen, META["BLOCK_M"]), batch, nheads)  # noqa
    BLOCK_M = 4 if interleaved else (8 if rotary_dim <= 64 else 4)

    # Need this, otherwise Triton tries to launch from cuda:0 and we get
    # ValueError: Pointer argument (at 0) cannot be accessed from Triton (cpu tensor?)
    with torch.cuda.device(x.device.index):
        rotary_kernel[grid](
            output,  # data ptrs
            x,
            cos,
            sin,
            cu_seqlens,
            seqlen_offsets,
            seqlen,  # shapes
            nheads,
            rotary_dim,
            seqlen_ro,
            seqlen // 128,  # key for triton cache (limit number of compilations)
            output.stride(0) if not is_varlen else 0,  # batch_strides if not varlen else 0
            output.stride(-3),  # seqlen_stride or total_seqlen_stride
            output.stride(-2),  # nheads_stride
            output.stride(-1),  # headdim_stride
            x.stride(0) if not is_varlen else 0,  # batch_strides if not varlen else 0
            x.stride(-3),  # seqlen stride or total_seqlen_stride
            x.stride(-2),  # nheads stride
            x.stride(-1),  # headdim stride
            BLOCK_K,
            isinstance(seqlen_offsets, torch.Tensor),
            is_varlen,
            interleaved,
            conjugate,
            BLOCK_M,
        )
    return output

class ApplyRotaryEmb(torch.autograd.Function):
    @staticmethod
    def forward(
        ctx,
        x,
        cos,
        sin,
        interleaved=False,
        inplace=False,
        seqlen_offsets: Union[int, torch.Tensor] = 0,
        cu_seqlens: Optional[torch.Tensor] = None,
        max_seqlen: Optional[int] = None,
    ):
        out = apply_rotary(
            x,
            cos,
            sin,
            seqlen_offsets=seqlen_offsets,
            cu_seqlens=cu_seqlens,
            max_seqlen=max_seqlen,
            interleaved=interleaved,
            inplace=inplace,
        )
        if isinstance(seqlen_offsets, int):
            # Can't save int with save_for_backward
            ctx.save_for_backward(cos, sin, cu_seqlens)
            ctx.seqlen_offsets = seqlen_offsets
        else:
            ctx.save_for_backward(cos, sin, cu_seqlens, seqlen_offsets)
            ctx.seqlen_offsets = None
        ctx.interleaved = interleaved
        ctx.inplace = inplace
        ctx.max_seqlen = max_seqlen
        return out if not inplace else x

    @staticmethod
    def backward(ctx, do):
        seqlen_offsets = ctx.seqlen_offsets
        if seqlen_offsets is None:
            cos, sin, cu_seqlens, seqlen_offsets = ctx.saved_tensors
        else:
            cos, sin, cu_seqlens = ctx.saved_tensors
        # TD [2023-09-02]: For some reason Triton (2.0.0.post1) errors with
        # "[CUDA]: invalid device context", and cloning makes it work. Idk why. Triton 2.1.0 works.
        if not ctx.interleaved and not ctx.inplace:
            do = do.clone()
        dx = apply_rotary(
            do,
            cos,
            sin,
            seqlen_offsets=seqlen_offsets,
            cu_seqlens=cu_seqlens,
            max_seqlen=ctx.max_seqlen,
            interleaved=ctx.interleaved,
            inplace=ctx.inplace,
            conjugate=True,
        )
        return dx, None, None, None, None, None, None, None


def apply_rotary_emb(
    x,
    cos,
    sin,
    interleaved=False,
    inplace=False,
    seqlen_offsets: Union[int, torch.Tensor] = 0,
    cu_seqlens: Optional[torch.Tensor] = None,
    max_seqlen: Optional[int] = None,
):
    """
    Arguments:
        x: (batch_size, seqlen, nheads, headdim) if cu_seqlens is None
            else (total_seqlen, nheads, headdim)
        cos, sin: (seqlen_rotary, rotary_dim / 2)
        interleaved: if True, rotate pairs of even and odd dimensions (GPT-J style) instead
            of 1st half and 2nd half (GPT-NeoX style).
        inplace: if True, apply rotary embedding in-place.
        seqlen_offsets: (batch_size,) or int. Each sequence in x is shifted by this amount.
            Most commonly used in inference when we have KV cache.
        cu_seqlens: (batch + 1,) or None
        max_seqlen: int
    Return:
        out: (batch_size, seqlen, nheads, headdim) if cu_seqlens is None
            else (total_seqlen, nheads, headdim)
    rotary_dim must be <= headdim
    Apply rotary embedding to the first rotary_dim of x.
    """
    return ApplyRotaryEmb.apply(
        x, cos, sin, interleaved, inplace, seqlen_offsets, cu_seqlens, max_seqlen
    )

================================================
FILE: Diff-Transformer/multihead_attention.py
================================================
import math
import torch
import torch.nn.functional as F
from torch import nn

from kernel.rotary import apply_rotary_emb
from flash_attn import flash_attn_func
try:
    from apex.normalization import FusedRMSNorm as RMSNorm 
except ModuleNotFoundError:
    print("No fused RMSNorm")
    from rms_norm import RMSNorm


def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor:
    """torch.repeat_interleave(x, dim=1, repeats=n_rep)"""
    bs, n_kv_heads, slen, head_dim = x.shape
    if n_rep == 1:
        return x
    return (
        x[:, :, None, :, :]
        .expand(bs, n_kv_heads, n_rep, slen, head_dim)
        .reshape(bs, n_kv_heads * n_rep, slen, head_dim)
    )


class MultiheadAttention(nn.Module):
    def __init__(
        self,
        embed_dim,
        depth,
        num_heads,
        num_kv_heads=None,
    ):
        super().__init__()
        self.embed_dim = embed_dim
        
        self.num_heads = num_heads
        
        self.num_kv_heads = num_kv_heads if num_kv_heads is not None else num_heads
        self.n_rep = self.num_heads // self.num_kv_heads
        
        self.head_dim = embed_dim // num_heads
        self.scaling = self.head_dim ** -0.5
        
        self.q_proj = nn.Linear(embed_dim, embed_dim, bias=False)
        self.k_proj = nn.Linear(embed_dim, embed_dim // self.n_rep, bias=False)
        self.v_proj = nn.Linear(embed_dim, embed_dim // self.n_rep, bias=False)
        self.out_proj = nn.Linear(embed_dim, embed_dim, bias=False)
    
    def forward(
        self,
        x,
        rel_pos,
        attn_mask=None,
    ):
        bsz, tgt_len, embed_dim = x.size()
        src_len = tgt_len

        q = self.q_proj(x)
        k = self.k_proj(x)
        v = self.v_proj(x)

        q = q.view(bsz, tgt_len, self.num_heads, self.head_dim)
        k = k.view(bsz, src_len, self.num_kv_heads, self.head_dim)
        v = v.view(bsz, src_len, self.num_kv_heads, self.head_dim)

        q = apply_rotary_emb(q, *rel_pos, interleaved=True)
        k = apply_rotary_emb(k, *rel_pos, interleaved=True)

        offset = src_len - tgt_len
        q = q.transpose(1, 2)
        k = repeat_kv(k.transpose(1, 2), self.n_rep)
        v = repeat_kv(v.transpose(1, 2), self.n_rep)
        q *= self.scaling
        attn_weights = torch.matmul(q, k.transpose(-1, -2))
        if attn_mask is None:
            attn_mask = torch.triu(
                torch.zeros([tgt_len, src_len])
                .float()
                .fill_(float("-inf"))
                .type_as(attn_weights),
                1 + offset,
            )
        attn_weights = torch.nan_to_num(attn_weights)
        attn_weights += attn_mask   
        attn_weights = F.softmax(attn_weights, dim=-1, dtype=torch.float32).type_as(
            attn_weights
        )

        attn = torch.matmul(attn_weights, v)
        attn = attn.transpose(1, 2).reshape(bsz, tgt_len, self.num_heads * self.head_dim)

        attn = self.out_proj(attn)
        return attn


================================================
FILE: Diff-Transformer/multihead_diffattn.py
================================================
import math
import torch
import torch.nn.functional as F
from torch import nn

from kernel.rotary import apply_rotary_emb
from flash_attn import flash_attn_func
try:
    from apex.normalization import FusedRMSNorm as RMSNorm 
except ModuleNotFoundError:
    print("No fused RMSNorm")
    from rms_norm import RMSNorm


def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor:
    """torch.repeat_interleave(x, dim=1, repeats=n_rep)"""
    bs, n_kv_heads, slen, head_dim = x.shape
    if n_rep == 1:
        return x
    return (
        x[:, :, None, :, :]
        .expand(bs, n_kv_heads, n_rep, slen, head_dim)
        .reshape(bs, n_kv_heads * n_rep, slen, head_dim)
    )

def lambda_init_fn(depth):
    return 0.8 - 0.6 * math.exp(-0.3 * depth)


class MultiheadDiffAttn(nn.Module):
    def __init__(
        self,
        embed_dim,
        depth, # current layer index
        num_heads,
        num_kv_heads=None,
    ):
        super().__init__()
        self.embed_dim = embed_dim
        
        # arg num_heads set to half of baseline Transformer's num_heads
        # for e.g., to compare with a baseline Transformer with 16 heads, pass in num_heads=8 for DIFF Transformer
        self.num_heads = num_heads
        
        # arg num_kv_heads set to half of baseline Transformer's num_kv_heads if use GQA
        # for e.g., to compare with a baseline Transformer with 16 heads and 8 kv_heads, 
        # pass in num_heads=8, num_kv_heads=4 for DIFF Transformer
        # if use MHA, pass in num_kv_heads=None
        self.num_kv_heads = num_kv_heads if num_kv_heads is not None else num_heads
        self.n_rep = self.num_heads // self.num_kv_heads
        
        self.head_dim = embed_dim // num_heads // 2
        self.scaling = self.head_dim ** -0.5
        
        self.q_proj = nn.Linear(embed_dim, embed_dim, bias=False)
        self.k_proj = nn.Linear(embed_dim, embed_dim // self.n_rep, bias=False)
        self.v_proj = nn.Linear(embed_dim, embed_dim // self.n_rep, bias=False)
        self.out_proj = nn.Linear(embed_dim, embed_dim, bias=False)

        # depth means current layer index
        self.lambda_init = lambda_init_fn(depth)
        self.lambda_q1 = nn.Parameter(torch.zeros(self.head_dim, dtype=torch.float32).normal_(mean=0,std=0.1))
        self.lambda_k1 = nn.Parameter(torch.zeros(self.head_dim, dtype=torch.float32).normal_(mean=0,std=0.1))
        self.lambda_q2 = nn.Parameter(torch.zeros(self.head_dim, dtype=torch.float32).normal_(mean=0,std=0.1))
        self.lambda_k2 = nn.Parameter(torch.zeros(self.head_dim, dtype=torch.float32).normal_(mean=0,std=0.1))

        self.subln = RMSNorm(2 * self.head_dim, eps=1e-5, elementwise_affine=True)
    
    def forward(
        self,
        x,
        rel_pos,
        attn_mask=None,
    ):
        bsz, tgt_len, embed_dim = x.size()
        src_len = tgt_len

        q = self.q_proj(x)
        k = self.k_proj(x)
        v = self.v_proj(x)

        q = q.view(bsz, tgt_len, 2 * self.num_heads, self.head_dim)
        k = k.view(bsz, src_len, 2 * self.num_kv_heads, self.head_dim)
        v = v.view(bsz, src_len, self.num_kv_heads, 2 * self.head_dim)

        q = apply_rotary_emb(q, *rel_pos, interleaved=True)
        k = apply_rotary_emb(k, *rel_pos, interleaved=True)

        offset = src_len - tgt_len
        q = q.transpose(1, 2)
        k = repeat_kv(k.transpose(1, 2), self.n_rep)
        v = repeat_kv(v.transpose(1, 2), self.n_rep)
        q *= self.scaling
        attn_weights = torch.matmul(q, k.transpose(-1, -2))
        if attn_mask is None:
            attn_mask = torch.triu(
                torch.zeros([tgt_len, src_len])
                .float()
                .fill_(float("-inf"))
                .type_as(attn_weights),
                1 + offset,
            )
        attn_weights = torch.nan_to_num(attn_weights)
        attn_weights += attn_mask   
        attn_weights = F.softmax(attn_weights, dim=-1, dtype=torch.float32).type_as(
            attn_weights
        )

        lambda_1 = torch.exp(torch.sum(self.lambda_q1 * self.lambda_k1, dim=-1).float()).type_as(q)
        lambda_2 = torch.exp(torch.sum(self.lambda_q2 * self.lambda_k2, dim=-1).float()).type_as(q)
        lambda_full = lambda_1 - lambda_2 + self.lambda_init
        attn_weights = attn_weights.view(bsz, self.num_heads, 2, tgt_len, src_len)
        attn_weights = attn_weights[:, :, 0] - lambda_full * attn_weights[:, :, 1]
        
        attn = torch.matmul(attn_weights, v)
        attn = self.subln(attn)
        attn = attn * (1 - self.lambda_init)
        attn = attn.transpose(1, 2).reshape(bsz, tgt_len, self.num_heads * 2 * self.head_dim)

        attn = self.out_proj(attn)
        return attn


================================================
FILE: Diff-Transformer/multihead_flashdiff_1.py
================================================
import math
import torch
import torch.nn.functional as F
from torch import nn

from kernel.rotary import apply_rotary_emb
from flex_head_fa import flash_attn_func
try:
    from apex.normalization import FusedRMSNorm as RMSNorm 
except ModuleNotFoundError:
    print("No fused RMSNorm")
    from rms_norm import RMSNorm


def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor:
    """torch.repeat_interleave(x, dim=1, repeats=n_rep)"""
    bs, n_kv_heads, slen, head_dim = x.shape
    if n_rep == 1:
        return x
    return (
        x[:, :, None, :, :]
        .expand(bs, n_kv_heads, n_rep, slen, head_dim)
        .reshape(bs, n_kv_heads * n_rep, slen, head_dim)
    )

def lambda_init_fn(depth):
    return 0.8 - 0.6 * math.exp(-0.3 * depth)


class MultiheadFlashDiff1(nn.Module):
    """
    (Recommended)
    DiffAttn implemented with FlashAttention, for packages that support different qk/v dimensions
    e.g., our customized flex_head_fa (https://aka.ms/flash-diff) and xformers (https://github.com/facebookresearch/xformers)
    """
    def __init__(
        self,
        embed_dim,
        depth, # current layer index
        num_heads,
        num_kv_heads=None,
    ):
        super().__init__()
        self.embed_dim = embed_dim
        
        # arg num_heads set to half of baseline Transformer's num_heads
        # for e.g., to compare with a baseline Transformer with 16 heads, pass in num_heads=8 for DIFF Transformer
        self.num_heads = num_heads
        
        # arg num_kv_heads set to half of baseline Transformer's num_kv_heads if use GQA
        # for e.g., to compare with a baseline Transformer with 16 heads and 8 kv_heads, 
        # pass in num_heads=8, num_kv_heads=4 for DIFF Transformer
        # if use MHA, pass in num_kv_heads=None
        self.num_kv_heads = num_kv_heads if num_kv_heads is not None else num_heads
        self.n_rep = self.num_heads // self.num_kv_heads
        
        self.head_dim = embed_dim // num_heads // 2
        self.scaling = self.head_dim ** -0.5
        
        self.q_proj = nn.Linear(embed_dim, embed_dim, bias=False)
        self.k_proj = nn.Linear(embed_dim, embed_dim // self.n_rep, bias=False)
        self.v_proj = nn.Linear(embed_dim, embed_dim // self.n_rep, bias=False)
        self.out_proj = nn.Linear(embed_dim, embed_dim, bias=False)

        # depth means current layer index
        self.lambda_init = lambda_init_fn(depth)
        self.lambda_q1 = nn.Parameter(torch.zeros(self.head_dim, dtype=torch.float32).normal_(mean=0,std=0.1))
        self.lambda_k1 = nn.Parameter(torch.zeros(self.head_dim, dtype=torch.float32).normal_(mean=0,std=0.1))
        self.lambda_q2 = nn.Parameter(torch.zeros(self.head_dim, dtype=torch.float32).normal_(mean=0,std=0.1))
        self.lambda_k2 = nn.Parameter(torch.zeros(self.head_dim, dtype=torch.float32).normal_(mean=0,std=0.1))

        self.subln = RMSNorm(2 * self.head_dim, eps=1e-5, elementwise_affine=True)
    
    def forward(
        self,
        x,
        rel_pos,
        attn_mask=None,
    ):
        bsz, tgt_len, embed_dim = x.size()
        src_len = tgt_len

        q = self.q_proj(x)
        k = self.k_proj(x)
        v = self.v_proj(x)

        q = q.view(bsz, tgt_len, 2 * self.num_heads, self.head_dim)
        k = k.view(bsz, src_len, 2 * self.num_kv_heads, self.head_dim)
        v = v.view(bsz, src_len, self.num_kv_heads, 2 * self.head_dim)

        q = apply_rotary_emb(q, *rel_pos, interleaved=True)
        k = apply_rotary_emb(k, *rel_pos, interleaved=True)

        offset = src_len - tgt_len
        q = q.reshape(bsz, tgt_len, self.num_heads, 2, self.head_dim)
        k = k.reshape(bsz, src_len, self.num_kv_heads, 2, self.head_dim)
        q1, q2 = q[:, :, :, 0], q[:, :, :, 1]
        k1, k2 = k[:, :, :, 0], k[:, :, :, 1]
        attn1 = flash_attn_func(q1, k1, v, causal=True)
        attn2 = flash_attn_func(q2, k2, v, causal=True)
        
        lambda_1 = torch.exp(torch.sum(self.lambda_q1 * self.lambda_k1, dim=-1).float()).type_as(q)
        lambda_2 = torch.exp(torch.sum(self.lambda_q2 * self.lambda_k2, dim=-1).float()).type_as(q)
        lambda_full = lambda_1 - lambda_2 + self.lambda_init
        attn = attn1 - lambda_full * attn2

        attn = self.subln(attn)
        attn = attn * (1 - self.lambda_init)
        attn = attn.reshape(bsz, tgt_len, self.num_heads * 2 * self.head_dim)
        
        attn = self.out_proj(attn)
        return attn


================================================
FILE: Diff-Transformer/multihead_flashdiff_2.py
================================================
import math
import torch
import torch.nn.functional as F
from torch import nn

from kernel.rotary import apply_rotary_emb
from flash_attn import flash_attn_func
try:
    from apex.normalization import FusedRMSNorm as RMSNorm 
except ModuleNotFoundError:
    print("No fused RMSNorm")
    from rms_norm import RMSNorm


def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor:
    """torch.repeat_interleave(x, dim=1, repeats=n_rep)"""
    bs, n_kv_heads, slen, head_dim = x.shape
    if n_rep == 1:
        return x
    return (
        x[:, :, None, :, :]
        .expand(bs, n_kv_heads, n_rep, slen, head_dim)
        .reshape(bs, n_kv_heads * n_rep, slen, head_dim)
    )

def lambda_init_fn(depth):
    return 0.8 - 0.6 * math.exp(-0.3 * depth)


class MultiheadFlashDiff2(nn.Module):
    """
    DiffAttn implemented with FlashAttention, for packages that does not support different qk/v dimensions
    e.g., flash-attention (https://github.com/Dao-AILab/flash-attention)
    """
    def __init__(
        self,
        embed_dim,
        depth, # current layer index
        num_heads,
        num_kv_heads=None,
    ):
        super().__init__()
        self.embed_dim = embed_dim
        
        # arg num_heads set to half of baseline Transformer's num_heads
        # for e.g., to compare with a baseline Transformer with 16 heads, pass in num_heads=8 for DIFF Transformer
        self.num_heads = num_heads
        
        # arg num_kv_heads set to half of baseline Transformer's num_kv_heads if use GQA
        # for e.g., to compare with a baseline Transformer with 16 heads and 8 kv_heads, 
        # pass in num_heads=8, num_kv_heads=4 for DIFF Transformer
        # if use MHA, pass in num_kv_heads=None
        self.num_kv_heads = num_kv_heads if num_kv_heads is not None else num_heads
        self.n_rep = self.num_heads // self.num_kv_heads
        
        self.head_dim = embed_dim // num_heads // 2
        self.scaling = self.head_dim ** -0.5
        
        self.q_proj = nn.Linear(embed_dim, embed_dim, bias=False)
        self.k_proj = nn.Linear(embed_dim, embed_dim // self.n_rep, bias=False)
        self.v_proj = nn.Linear(embed_dim, embed_dim // self.n_rep, bias=False)
        self.out_proj = nn.Linear(embed_dim, embed_dim, bias=False)

        # depth means current layer index
        self.lambda_init = lambda_init_fn(depth)
        self.lambda_q1 = nn.Parameter(torch.zeros(self.head_dim, dtype=torch.float32).normal_(mean=0,std=0.1))
        self.lambda_k1 = nn.Parameter(torch.zeros(self.head_dim, dtype=torch.float32).normal_(mean=0,std=0.1))
        self.lambda_q2 = nn.Parameter(torch.zeros(self.head_dim, dtype=torch.float32).normal_(mean=0,std=0.1))
        self.lambda_k2 = nn.Parameter(torch.zeros(self.head_dim, dtype=torch.float32).normal_(mean=0,std=0.1))

        self.subln = RMSNorm(2 * self.head_dim, eps=1e-5, elementwise_affine=True)
    
    def forward(
        self,
        x,
        rel_pos,
        attn_mask=None,
    ):
        bsz, tgt_len, embed_dim = x.size()
        src_len = tgt_len

        q = self.q_proj(x)
        k = self.k_proj(x)
        v = self.v_proj(x)

        q = q.view(bsz, tgt_len, 2 * self.num_heads, self.head_dim)
        k = k.view(bsz, src_len, 2 * self.num_kv_heads, self.head_dim)
        v = v.view(bsz, src_len, self.num_kv_heads, 2, self.head_dim)

        q = apply_rotary_emb(q, *rel_pos, interleaved=True)
        k = apply_rotary_emb(k, *rel_pos, interleaved=True)

        offset = src_len - tgt_len
        q = q.reshape(bsz, tgt_len, self.num_heads, 2, self.head_dim)
        k = k.reshape(bsz, src_len, self.num_kv_heads, 2, self.head_dim)
        q1, q2 = q[:, :, :, 0], q[:, :, :, 1]
        k1, k2 = k[:, :, :, 0], k[:, :, :, 1]
        v1, v2 = v[:, :, :, 0], v[:, :, :, 1]

        attn11 = flash_attn_func(q1, k1, v1, causal=True)
        attn12 = flash_attn_func(q1, k1, v2, causal=True)
        attn1 = torch.cat([attn11, attn12], dim=-1)
        
        attn21 = flash_attn_func(q2, k2, v1, causal=True)
        attn22 = flash_attn_func(q2, k2, v2, causal=True)
        attn2 = torch.cat([attn21, attn22], dim=-1)
        
        lambda_1 = torch.exp(torch.sum(self.lambda_q1 * self.lambda_k1, dim=-1).float()).type_as(q)
        lambda_2 = torch.exp(torch.sum(self.lambda_q2 * self.lambda_k2, dim=-1).float()).type_as(q)
        lambda_full = lambda_1 - lambda_2 + self.lambda_init
        attn = attn1 - lambda_full * attn2

        attn = self.subln(attn)
        attn = attn * (1 - self.lambda_init)
        attn = attn.reshape(bsz, tgt_len, self.num_heads * 2 * self.head_dim)
        
        attn = self.out_proj(attn)
        return attn


================================================
FILE: Diff-Transformer/rms_norm.py
================================================
import torch
import torch.nn as nn

class RMSNorm(nn.Module):
    def __init__(self, dim: int, eps: float = 1e-6, elementwise_affine=True, memory_efficient=False):
        super().__init__()
        self.dim = dim
        self.eps = eps
        self.elementwise_affine = elementwise_affine
        if self.elementwise_affine:
            self.weight = nn.Parameter(torch.ones(dim))
        else:
            self.register_parameter('weight', None)

    def _norm(self, x):
        return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)

    def forward(self, x):
        output = self._norm(x.float()).type_as(x)
        if self.weight is not None:
            output = output * self.weight
        return output

    def extra_repr(self) -> str:
        return f'dim={self.dim}, eps={self.eps}, elementwise_affine={self.elementwise_affine}'
    

================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) Microsoft Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: LatentLM/README.md
================================================
# [Multimodal Latent Language Modeling with Next-Token Diffusion]

Official PyTorch implementation and pretrained models of LatentLM. 

---


<!-- ## Pretrained models -->

<!-- coming soon -->

## Setup & Usage

Coming soon!

## License
This project is licensed under the license found in the LICENSE file in the root directory of this source tree.

[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct)

### Contact Information

For help or issues using BEiT models, please submit a GitHub issue.

For other communications, please contact [Li Dong](https://dong.li/) (`lidong1@microsoft.com`), [Furu Wei](http://gitnlp.org/) (`fuwei@microsoft.com`).


================================================
FILE: LatentLM/evaluate_fid.py
================================================
import argparse
import json
import os
import sys
import math
import numpy as np
from tqdm import tqdm
import torch
import torch.distributed as dist
from accelerate.utils import set_seed

from safetensors.torch import load_file 
from tokenizer_models import AutoencoderKL, load_vae

from schedule.dpm_solver import DPMSolverMultistepScheduler
from models import All_models
from utils import safe_blob_dump
from metrics import compute_fid_without_store, compute_inception_score_from_tensor


def parse_args():
    parser = argparse.ArgumentParser(description="Simple example of a training script.")
    parser.add_argument(
        "--seed",
        type=int,
        default=0,
        help="A seed to use for the random number generator. Can be negative to not set a seed.",
    )
    parser.add_argument(
        "--model",
        type=str,
        default="Transformer-L",
        help="The config of the UNet model to train, leave as None to use standard DDPM configuration.",
    )
    parser.add_argument(
        "--vae",
        type=str,
        default=None,
    )
    parser.add_argument(
        "--train_data_dir",
        type=str,
        default="/tmp/ILSVRC/Data/CLS-LOC/train",
        help=(
            "A folder containing the training data. Folder contents must follow the structure described in"
            " https://huggingface.co/docs/datasets/image_dataset#imagefolder. In particular, a `metadata.jsonl` file"
            " must exist to provide the captions for the images. Ignored if `dataset_name` is specified."
        ),
    )
    parser.add_argument(
        "--ref_stat_path",
        type=str,
        default="/mnt/unilm/hangbo/beit3/t2i/assets/fid_stats/imagenet_256_val.npz",
    )
    parser.add_argument(
        "--image_size",
        type=int,
        default=256,
        help=(
            "The image_size for input images, all the images in the train/validation dataset will be resized to this"
            " image_size"
        ),
    )
    parser.add_argument("--num-classes", type=int, default=1000)
    parser.add_argument(
        "--mixed_precision",
        type=str,
        default="no",
        choices=["no", "fp16", "bf16"],
        help=(
            "Whether to use mixed precision. Choose"
            "between fp16 and bf16 (bfloat16). Bf16 requires PyTorch >= 1.10."
            "and an Nvidia Ampere GPU."
        ),
    )
    parser.add_argument(
        "--batch_size", type=int, default=32, help="Batch size (per device) for the training dataloader."
    )
    parser.add_argument(
        "--steps_per_class", type=int, default=50, help="Number of steps per class."
    )
    parser.add_argument("--force_diffusion", action="store_true", help="Whether to force the use of diffusion models.")  
    parser.add_argument("--use_ema", action="store_true", help="Whether to use Exponential Moving Average for the final model weights.")  
    parser.add_argument("--ddpm_num_steps", type=int, default=1000)
    parser.add_argument("--ddpm_num_inference_steps", type=int, default=250)
    parser.add_argument("--ddpm_beta_schedule", type=str, default="cosine", help="The beta schedule to use for DDPM.")
    parser.add_argument("--prediction_type", type=str, default="epsilon", help="Whether the model should predict the 'epsilon'/noise error or directly the reconstructed image 'x0'.")
    parser.add_argument("--cfg-scale", type=float, default=4.0)
    parser.add_argument(
        "--checkpoint",
        type=str,
        default=None,
        help=(
            "Whether training should be resumed from a previous checkpoint. Use a path saved by"
            ' `--checkpointing_steps`, or `"latest"` to automatically select the last available checkpoint.'
        ),
    )
    args = parser.parse_args()
    return args

def suppress_output(rank):  
    """Suppress output for all processes except the one with rank 0."""  
    if rank != 0:  
        sys.stdout = open(os.devnull, 'w')  

@torch.no_grad()
def main(args):
    set_seed(args.seed)
    dist.init_process_group(backend="gloo", init_method='env://')
    rank = dist.get_rank()
    suppress_output(rank)
    print(args)
    device = f"cuda:{rank}" if torch.cuda.is_available() else "cpu"
    if args.mixed_precision == "bf16":
        dtype = torch.bfloat16
    elif args.mixed_precision == "fp16":
        dtype = torch.float16
    else:
        dtype = torch.float32
    prefix = "ema" if args.use_ema else "standard"
    exp_name = f"{prefix}_{args.steps_per_class}_{args.cfg_scale}_{args.ddpm_beta_schedule}_{args.ddpm_num_inference_steps}"
    print(f"Exp_name {exp_name}")
    vae, input_size, latent_size, flatten_input = load_vae(args.vae, args.image_size)
        
    vae.eval()
    other_state = torch.load(os.path.join(args.checkpoint, "other_state.pth"), map_location="cpu")
    scaling_factor = other_state["scaling_factor"]
    bias_factor = other_state["bias_factor"]
    print(f"Scaling factor: {scaling_factor}, Bias factor: {bias_factor}")
    # Potentially load in the weights and states from a previous save
    latent_path = os.path.join(args.checkpoint, f"latent_{exp_name}.pth")
    if os.path.exists(latent_path) and not args.force_diffusion:
        all_latent_gather = torch.load(latent_path)
        print("Loaded latent from file.")
    else:
        model = All_models[args.model](
            input_size=input_size,
            in_channels=latent_size,
            num_classes=args.num_classes,
            flatten_input=flatten_input,
        ).to(device).to(dtype)
        noise_scheduler = DPMSolverMultistepScheduler(num_train_timesteps=args.ddpm_num_steps, beta_schedule=args.ddpm_beta_schedule, prediction_type=args.prediction_type)
        model.eval()
        if args.checkpoint:
            if args.use_ema and other_state["ema"] is not None:
                checkpoint = other_state["ema"]["shadow_params"]
                for model_param, ema_param in zip(model.parameters(), checkpoint):
                    model_param.data = ema_param.data.to(device).to(dtype)
                print(f"Loaded model from checkpoint {args.checkpoint}, EMA applied.")
            else:
                if os.path.exists(os.path.join(args.checkpoint, "model.safetensors")):
                    checkpoint = load_file(os.path.join(args.checkpoint, "model.safetensors"))
                elif os.path.exists(os.path.join(args.checkpoint, "pytorch_model")):
                    checkpoint = torch.load(os.path.join(args.checkpoint, "pytorch_model", "mp_rank_00_model_states.pt"), map_location="cpu")["module"]
                
                model.load_state_dict(checkpoint)
                print(f"Loaded model from checkpoint {args.checkpoint}.")

        def p_sample(model, image):
            noise_scheduler.set_timesteps(args.ddpm_num_inference_steps)
            for t in noise_scheduler.timesteps:
                model_output = model(image, t.repeat(image.shape[0]).to(image))
                image = noise_scheduler.step(model_output, t, image).prev_sample
            return image

        all_latent = []
        class_start, class_end = args.num_classes // dist.get_world_size() * rank, args.num_classes // dist.get_world_size() * (rank + 1)
        classes = torch.arange(class_start, class_end, device=device).repeat(args.steps_per_class)
        classes = classes.chunk(math.ceil(classes.size(0) / args.batch_size))
        for y in tqdm(classes, disable=rank != 0):
            y_null = torch.full_like(y, args.num_classes, device=device)
            y = torch.cat([y, y_null], 0)
            # Sample images:
            samples = model.sample_with_cfg(y, args.cfg_scale, p_sample)
            all_latent.append(samples.float().cpu())

        all_latent = torch.cat(all_latent, 0)
        all_latent_gather = [torch.zeros_like(all_latent) for _ in range(dist.get_world_size())]
        dist.all_gather(all_latent_gather, all_latent)
        all_latent_gather = torch.cat(all_latent_gather, 0)
        if rank == 0:
            torch.save(all_latent_gather, latent_path)
        
    if rank == 0:
        all_images = torch.zeros((all_latent_gather.size(0), 3, 256, 256))
        if args.image_size != 256:
            transform = torch.nn.Upsample(size=(256, 256), mode="bilinear")
        else:
            transform = torch.nn.Identity()
        idx = 0
        for samples in tqdm(all_latent_gather.chunk(math.ceil(all_latent_gather.size(0) / args.batch_size))):
            images = vae.decode(samples.to(device).to(dtype) / scaling_factor - bias_factor)
            images = transform(images)
            images = (torch.clamp(images.float(), -1.0, 1.0) * 0.5 + 0.5).cpu().float()
            all_images[idx:idx + images.shape[0]] = images
            idx += images.shape[0]

        print(all_images.shape)
        fid_score = compute_fid_without_store(all_images, args.ref_stat_path, batch_size=args.batch_size, device=device)
        print(fid_score)
        IS_mean, IS_std = compute_inception_score_from_tensor(
            all_images, 
            batch_size=args.batch_size, 
            device=device, 
        )
        print(IS_mean, IS_std)
        result_path = os.path.join(args.checkpoint, f"result_{exp_name}.json")
        result = {
            "fid": fid_score.item(),
            "IS_mean": IS_mean.item(),
            "IS_std": IS_std.item(),
        }
        safe_blob_dump(result_path, result)
        image_path = os.path.join(args.checkpoint, f"images_{exp_name}.npz")
        all_images = (all_images * 255.0).clamp(0, 255).to(torch.uint8).permute(0, 2, 3, 1).numpy()
        np.savez_compressed(image_path, all_images)


if __name__ == "__main__":
    args = parse_args()
    main(args)

================================================
FILE: LatentLM/evaluate_fid_fidelity.py
================================================
import argparse
import json
import os
import numpy as np
import torch
from torchvision import transforms
from torchvision.datasets import ImageFolder
import torch_fidelity
from utils import center_crop_arr, safe_blob_write

def parse_args():
    parser = argparse.ArgumentParser(description="Simple example of a training script.")
    parser.add_argument(
        "--seed",
        type=int,
        default=0,
        help="A seed to use for the random number generator. Can be negative to not set a seed.",
    )
    parser.add_argument(
        "--model",
        type=str,
        default="Transformer-L",
        help="The config of the UNet model to train, leave as None to use standard DDPM configuration.",
    )
    parser.add_argument(
        "--vae",
        type=str,
        default=None,
    )
    parser.add_argument("--train_data_dir", type=str, default="/tmp/ILSVRC/Data/CLS-LOC/train", help="A folder containing the training data.")  
    parser.add_argument(
        "--ref_stat_path",
        type=str,
        default="/mnt/unilm/hangbo/beit3/t2i/assets/fid_stats/imagenet_256_val.npz",
    )
    parser.add_argument(
        "--image_size",
        type=int,
        default=256,
        help=(
            "The image_size for input images, all the images in the train/validation dataset will be resized to this"
            " image_size"
        ),
    )
    parser.add_argument(
        "--batch_size", type=int, default=32, help="Batch size (per device) for the training dataloader."
    )
    parser.add_argument(
        "--steps_per_class", type=int, default=50, help="Number of steps per class."
    )
    parser.add_argument("--use_ema", action="store_true", help="Whether to use Exponential Moving Average for the final model weights.")  
    parser.add_argument("--ddpm_num_steps", type=int, default=1000)
    parser.add_argument("--ddpm_num_inference_steps", type=int, default=250)
    parser.add_argument("--ddpm_beta_schedule", type=str, default="cosine", help="The beta schedule to use for DDPM.")
    parser.add_argument("--prediction_type", type=str, default="epsilon", help="Whether the model should predict the 'epsilon'/noise error or directly the reconstructed image 'x0'.")
    parser.add_argument("--cfg-scale", type=float, default=4.0)
    parser.add_argument(
        "--checkpoint",
        type=str,
        default=None,
        help=(
            "Whether training should be resumed from a previous checkpoint. Use a path saved by"
            ' `--checkpointing_steps`, or `"latest"` to automatically select the last available checkpoint.'
        ),
    )
    args = parser.parse_args()
    return args  

class ImageDataset(torch.utils.data.Dataset):
    def __init__(self, images):
        self.images = images

    def __len__(self):
        return len(self.images)

    def __getitem__(self, idx):
        return self.images[idx]
    
class RefImageDataset(torch.utils.data.Dataset):
    def __init__(self, dataset):
        self.dataset = dataset

    def __len__(self):
        return len(self.dataset)

    def __getitem__(self, idx):
        item = self.dataset[idx]
        item = np.array(item[0])
        item = torch.from_numpy(item).permute(2, 0, 1)
        return item

@torch.no_grad()
def main(args):
    prefix = "ema" if args.use_ema else "standard"
    exp_name = f"{prefix}_{args.steps_per_class}_{args.cfg_scale}_{args.ddpm_beta_schedule}_{args.ddpm_num_inference_steps}"
    print(f"Exp_name {exp_name}")
    image_path = os.path.join(args.checkpoint, f"images_{exp_name}.npz")
    print(f"Computing fidelity metrics from {image_path}...")
    images = np.load(image_path)["arr_0"]
    images = torch.from_numpy(images).permute(0, 3, 1, 2)
    print(images.shape)
    dataset = ImageDataset(images)
    ref_dataset = ImageFolder(args.train_data_dir, transform=transforms.Lambda(lambda pil_image: center_crop_arr(pil_image, args.image_size)))
    ref_dataset = RefImageDataset(ref_dataset)
    metrics_dict = torch_fidelity.calculate_metrics(
        input1=dataset,
        input2=ref_dataset,
        batch_size=args.batch_size,
        cuda=True,
        isc=True,
        fid=True,
        kid=False,
        prc=False,
        save_cpu_ram=True,
        verbose=True,
    )
    print(metrics_dict)
    # metrics_dict = torch_fidelity.calculate_metrics(
    #     input1=dataset,
    #     input2=ref_dataset,
    #     batch_size=args.batch_size,
    #     cuda=True,
    #     prc=True,
    #     prc_batch_size=args.batch_size,
    #     save_cpu_ram=True,
    #     verbose=True,
    # )
    # print(metrics_dict)


if __name__ == "__main__":
    args = parse_args()
    main(args)

================================================
FILE: LatentLM/inference_speed.py
================================================
import argparse
import json
import os
import sys
import time
import torch
from tqdm import tqdm
from accelerate.utils import set_seed

from tokenizer_models import AutoencoderKL, load_vae

from schedule.dpm_solver import DPMSolverMultistepScheduler
from models import All_models


def parse_args():
    parser = argparse.ArgumentParser(description="Simple example of a training script.")
    parser.add_argument(
        "--seed",
        type=int,
        default=0,
        help="A seed to use for the random number generator. Can be negative to not set a seed.",
    )
    parser.add_argument(
        "--model",
        type=str,
        default="Transformer-L",
        help="The config of the model to train, leave as None to use standard DDPM configuration.",
    )
    parser.add_argument(
        "--num_kv_heads",
        type=int,
        default=None,
        help="The number of heads to use in the key/value attention in the model.",
    )
    parser.add_argument(
        "--vae",
        type=str,
        default=None,
    )
    parser.add_argument(
        "--train_data_dir",
        type=str,
        default="/tmp/ILSVRC/Data/CLS-LOC/train",
        help=(
            "A folder containing the training data. Folder contents must follow the structure described in"
            " https://huggingface.co/docs/datasets/image_dataset#imagefolder. In particular, a `metadata.jsonl` file"
            " must exist to provide the captions for the images. Ignored if `dataset_name` is specified."
        ),
    )
    parser.add_argument(
        "--ref_stat_path",
        type=str,
        default="/mnt/unilm/hangbo/beit3/t2i/assets/fid_stats/imagenet_256_val.npz",
    )
    parser.add_argument(
        "--image_size",
        type=int,
        default=256,
        help=(
            "The image_size for input images, all the images in the train/validation dataset will be resized to this"
            " image_size"
        ),
    )
    parser.add_argument("--num-classes", type=int, default=1000)
    parser.add_argument(
        "--mixed_precision",
        type=str,
        default="no",
        choices=["no", "fp16", "bf16"],
        help=(
            "Whether to use mixed precision. Choose"
            "between fp16 and bf16 (bfloat16). Bf16 requires PyTorch >= 1.10."
            "and an Nvidia Ampere GPU."
        ),
    )
    parser.add_argument(
        "--batch_size", type=int, default=32, help="Batch size (per device) for the training dataloader."
    )
    parser.add_argument(
        "--steps_per_class", type=int, default=50, help="Number of steps per class."
    )
    parser.add_argument("--force_diffusion", action="store_true", help="Whether to force the use of diffusion models.")  
    parser.add_argument("--use_ema", action="store_true", help="Whether to use Exponential Moving Average for the final model weights.")  
    parser.add_argument("--ddpm_num_steps", type=int, default=1000)
    parser.add_argument("--ddpm_num_inference_steps", type=int, default=250)
    parser.add_argument("--ddpm_beta_schedule", type=str, default="cosine", help="The beta schedule to use for DDPM.")
    parser.add_argument("--prediction_type", type=str, default="epsilon", help="Whether the model should predict the 'epsilon'/noise error or directly the reconstructed image 'x0'.")
    parser.add_argument("--cfg-scale", type=float, default=4.0)
    parser.add_argument(
        "--checkpoint",
        type=str,
        default=None,
        help=(
            "Whether training should be resumed from a previous checkpoint. Use a path saved by"
            ' `--checkpointing_steps`, or `"latest"` to automatically select the last available checkpoint.'
        ),
    )
    args = parser.parse_args()
    return args

def suppress_output(rank):  
    """Suppress output for all processes except the one with rank 0."""  
    if rank != 0:  
        sys.stdout = open(os.devnull, 'w')  

@torch.no_grad()
def main(args):
    set_seed(args.seed)
    print(args)
    device = "cuda" if torch.cuda.is_available() else "cpu"
    if args.mixed_precision == "bf16":
        dtype = torch.bfloat16
    elif args.mixed_precision == "fp16":
        dtype = torch.float16
    else:
        dtype = torch.float32
    prefix = "ema" if args.use_ema else "standard"
    exp_name = f"{prefix}_{args.steps_per_class}_{args.cfg_scale}_{args.ddpm_beta_schedule}_{args.ddpm_num_inference_steps}"
    print(f"Exp_name {exp_name}")
    vae, input_size, latent_size, flatten_input = load_vae(args.vae, args.image_size)
        
    vae.eval()
    # Potentially load in the weights and states from a previous save
    model = All_models[args.model](
        input_size=input_size,
        in_channels=latent_size,
        num_kv_heads=args.num_kv_heads,
        num_classes=args.num_classes,
        flatten_input=flatten_input,
    ).to(device).to(dtype)
    noise_scheduler = DPMSolverMultistepScheduler(num_train_timesteps=args.ddpm_num_steps, beta_schedule=args.ddpm_beta_schedule, prediction_type=args.prediction_type)
    model.eval()

    def p_sample(model, image):
        noise_scheduler.set_timesteps(args.ddpm_num_inference_steps)
        for t in noise_scheduler.timesteps:
            model_output = model(image, t.repeat(image.shape[0]).to(image))
            image = noise_scheduler.step(model_output, t, image).prev_sample
        return image
    
    start = time.time()
    for _ in tqdm(range(5)):
        y = torch.randint(0, args.num_classes, (args.batch_size,)).to(device)
        y_null = torch.full_like(y, args.num_classes, device=device)
        y = torch.cat([y, y_null], 0)
        # Sample images:
        samples = model.sample_with_cfg(y, args.cfg_scale, p_sample)
    end = time.time()
    print(args.model, args.batch_size)
    print(f"Time taken: {end - start}, FPS: {5 * args.batch_size / (end - start)}")


if __name__ == "__main__":
    args = parse_args()
    main(args)

================================================
FILE: LatentLM/metrics/IS.py
================================================
"""Utils for Inception Score calculation.
Borrowed from:
    PyTorch StudioGAN: https://github.com/POSTECH-CVLab/PyTorch-StudioGAN
    The MIT License (MIT)
    See license file or visit https://github.com/POSTECH-CVLab/PyTorch-StudioGAN for details
"""
from pathlib import Path

import torch
from torch.utils.data import DataLoader
from tqdm import tqdm

from .fid import get_inception_model, create_dataset_from_files


def inception_softmax(inception_model, images):
    with torch.no_grad():
        logits = inception_model.get_logits(images)
        ps = torch.nn.functional.softmax(logits, dim=1)
    return ps


@torch.no_grad()
def calculate_kl_div(ps, splits: int):
    scores = []
    num_samples = ps.shape[0]
    for j in range(splits):
        part = ps[(j * num_samples // splits):((j + 1) * num_samples // splits), :]
        kl = part * (torch.log(part) - torch.log(torch.unsqueeze(torch.mean(part, 0), 0)))
        kl = torch.mean(torch.sum(kl, 1))
        kl = torch.exp(kl)
        scores.append(kl.unsqueeze(0))
    scores = torch.cat(scores, 0)
    m_scores = torch.mean(scores).detach().cpu().numpy()
    m_std = torch.std(scores).detach().cpu().numpy()
    return m_scores, m_std


@torch.no_grad()
def compute_inception_score_from_dataset(dataset,
                                         splits,
                                         batch_size,
                                         device=torch.device('cuda'),
                                         inception_model=None,
                                         disable_tqdm=False):
    """
    Args:
        - dataset: dataset returning **float (0~1)** images
    """
    if inception_model is None:
        inception_model = get_inception_model().to(device)

    data_loader = DataLoader(dataset, shuffle=True, batch_size=batch_size, num_workers=16)

    inception_model.eval()
    probs_list = []

    for imgs in tqdm(data_loader, disable=disable_tqdm):
        imgs = imgs[0].to(device)
        logits = inception_model.get_logits(imgs)
        probs = torch.nn.functional.softmax(logits, dim=-1)
        probs_list.append(probs)

    probs_list = torch.cat(probs_list, 0)
    m_scores, m_std = calculate_kl_div(probs_list, splits=splits)

    return m_scores, m_std


def compute_inception_score_from_files(path,
                                       splits=10,
                                       batch_size=500,
                                       device=torch.device('cuda'),
                                       inception_model=None,
                                       disable_tqdm=False):

    dataset = create_dataset_from_files(path)
    return compute_inception_score_from_dataset(dataset,
                                                splits,
                                                batch_size,
                                                device,
                                                inception_model,
                                                disable_tqdm)


def compute_inception_score_from_tensor(tensor,
                                        splits=10,
                                        batch_size=500,
                                        device=torch.device('cuda'),
                                        inception_model=None,
                                        disable_tqdm=False):

    dataset = torch.utils.data.TensorDataset(tensor)
    return compute_inception_score_from_dataset(dataset,
                                                splits,
                                                batch_size,
                                                device,
                                                inception_model,
                                                disable_tqdm)


================================================
FILE: LatentLM/metrics/__init__.py
================================================
# Copyright (c) 2022-present, Kakao Brain Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from .fid import *
from .IS import *


================================================
FILE: LatentLM/metrics/fid.py
================================================
"""Adapted from https://github.com/mseitzer/pytorch-fid/blob/master/src/pytorch_fid/fid_score.py"""
import glob
import logging
import os
from pathlib import Path

import numpy as np
import torch
import torch.nn.functional as F
from scipy import linalg
from torch.utils.data import DataLoader
from tqdm import tqdm

from .inception import InceptionV3

import pickle


class InceptionWrapper(InceptionV3):

    def forward(self, inp):
        pred = super().forward(inp)[0]
        # If model output is not scalar, apply global spatial average pooling.
        # This happens if you choose a dimensionality not equal 2048.
        if pred.size(2) != 1 or pred.size(3) != 1:
            pred = F.adaptive_avg_pool2d(pred, output_size=(1, 1))
        pred = pred.reshape(pred.shape[0], -1)

        return pred

    def get_logits(self, inp):
        _, logits = super().forward(inp, return_logits=True)

        return logits


def get_inception_model(dims=2048):
    block_idx = InceptionV3.BLOCK_INDEX_BY_DIM[dims]
    model = InceptionWrapper([block_idx])
    return model


def mean_covar_torch(xs):
    mu = torch.mean(xs, dim=0, keepdim=True)
    ys = xs - mu
    unnormalized_sigma = (ys.T @ ys)
    sigma = unnormalized_sigma / (xs.shape[0] - 1)
    return mu, sigma


def mean_covar_numpy(xs):
    if isinstance(xs, torch.Tensor):
        xs = xs.cpu().numpy()
    return np.mean(xs, axis=0), np.cov(xs, rowvar=False)


def frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6):
    """Numpy implementation of the Frechet Distance.
    The Frechet distance between two multivariate Gaussians X_1 ~ N(mu_1, C_1)
    and X_2 ~ N(mu_2, C_2) is
            d^2 = ||mu_1 - mu_2||^2 + Tr(C_1 + C_2 - 2*sqrt(C_1*C_2)).

    Stable version by Dougal J. Sutherland.

    Params:
    -- mu1   : Numpy array containing the activations of a layer of the
               inception net (like returned by the function 'get_predictions')
               for generated samples.
    -- mu2   : The sample mean over activations, precalculated on an
               representative data set.
    -- sigma1: The covariance matrix over activations for generated samples.
    -- sigma2: The covariance matrix over activations, precalculated on an
               representative data set.

    Returns:
    --   : The Frechet Distance.
    """

    mu1 = np.atleast_1d(mu1)
    mu2 = np.atleast_1d(mu2)

    sigma1 = np.atleast_2d(sigma1)
    sigma2 = np.atleast_2d(sigma2)

    assert mu1.shape == mu2.shape, \
        'Training and test mean vectors have different lengths'
    assert sigma1.shape == sigma2.shape, \
        'Training and test covariances have different dimensions'

    diff = mu1 - mu2

    # Product might be almost singular
    covmean, _ = linalg.sqrtm(sigma1.dot(sigma2), disp=False)
    if not np.isfinite(covmean).all():
        msg = ('fid calculation produces singular product; '
               'adding %s to diagonal of cov estimates') % eps
        logging.warning(msg)
        offset = np.eye(sigma1.shape[0]) * eps
        covmean = linalg.sqrtm((sigma1 + offset).dot(sigma2 + offset))

    # Numerical error might give slight imaginary component
    if np.iscomplexobj(covmean):
        if not np.allclose(np.diagonal(covmean).imag, 0, atol=1e-3):
            m = np.max(np.abs(covmean.imag))
            raise ValueError('Imaginary component {}'.format(m))
        covmean = covmean.real

    tr_covmean = np.trace(covmean)

    return (diff.dot(diff) + np.trace(sigma1) +
            np.trace(sigma2) - 2 * tr_covmean)


@torch.no_grad()
def compute_statistics_dataset(dataset,
                               batch_size=64,
                               inception_model=None,
                               stage1_model=None,
                               device=torch.device('cuda'),
                               skip_original=False,
                               ):

    if skip_original and stage1_model is None:
        return None, None, None, None

    if inception_model is None:
        inception_model = get_inception_model().to(device)

    loader = DataLoader(dataset, shuffle=False, pin_memory=True, batch_size=batch_size, num_workers=16)

    inception_model.eval()
    if stage1_model:
        stage1_model.eval()

    acts = []
    acts_recon = []

    sample_size_sum = 0.0
    sample_sum = torch.tensor(0.0, device=device)
    sample_sq_sum = torch.tensor(0.0, device=device)
    sample_max = torch.tensor(float('-inf'), device=device)
    sample_min = torch.tensor(float('inf'), device=device)

    for xs, _ in tqdm(loader, desc="compute acts"):
        xs = xs.to(device, non_blocking=True)

        # we are assuming that dataset returns value in -1 ~ 1 -> remap to 0 ~ 1
        xs = torch.clamp(xs*0.5 + 0.5, 0, 1)

        sample_sum += xs.sum()
        sample_sq_sum += xs.pow(2.0).sum()
        sample_size_sum += xs.numel()
        sample_max = max(xs.max(), sample_max)
        sample_min = min(xs.min(), sample_min)

        act = inception_model(xs).cpu() if not skip_original else None
        acts.append(act)

        if stage1_model:
            # here we assume that stage1 model input & output values are in -1 ~ 1 range
            # this may not cover DiscreteVAE
            imgs = 2. * xs - 1.
            xs_recon = torch.cat([
                stage1_model(imgs[i:i+1])[0] for i in range(imgs.shape[0])
            ], dim=0)
            xs_recon = torch.clamp(xs_recon * 0.5 + 0.5, 0, 1)
            act_recon = inception_model(xs_recon).cpu()
            acts_recon.append(act_recon)

    sample_mean = sample_sum.item() / sample_size_sum
    sample_std = ((sample_sq_sum.item() / sample_size_sum) - (sample_mean ** 2.0)) ** 0.5
    logging.info(f'val imgs. stats :: '
                 f'max: {sample_max:.4f}, min: {sample_min:.4f}, mean: {sample_mean:.4f}, std: {sample_std:.4f}')

    acts = torch.cat(acts, dim=0) if not skip_original else None

    if skip_original:
        mu_acts, sigma_acts = None, None
    else:
        mu_acts, sigma_acts = mean_covar_numpy(acts)

    if stage1_model:
        acts_recon = torch.cat(acts_recon, dim=0)
        mu_acts_recon, sigma_acts_recon = mean_covar_numpy(acts_recon)
    else:
        mu_acts_recon, sigma_acts_recon = None, None

    return mu_acts, sigma_acts, mu_acts_recon, sigma_acts_recon


def create_dataset_from_files(path, verbose=False):
    samples = []
    pkl_lists = glob.glob(os.path.join(path, 'samples*.pkl'))
    first_file_name = os.path.basename(pkl_lists[0])
    last_file_name = os.path.basename(pkl_lists[-1])
    logging.info(f'loading generated images from {path}: [{first_file_name}, ..., {last_file_name}]')

    for pkl in tqdm(pkl_lists, desc='loading pickles'):
        with open(pkl, 'rb') as f:
            # samples.append(pickle.load(f).cpu().numpy())
            s = pickle.load(f)
            if isinstance(s, np.ndarray):
                s = torch.from_numpy(s)
            samples.append(s)

    datasets = [torch.utils.data.TensorDataset(sample) for sample in samples]
    dataset = torch.utils.data.ConcatDataset(datasets)

    if verbose:
        total_size = sum([sample.size for sample in samples])
        sample_mean = sum([sample.sum() for sample in samples]) / total_size
        sample_std = (sum([((sample - sample_mean)**2).sum() for sample in samples]) / total_size) ** 0.5
        sample_max = max([sample.max() for sample in samples])
        sample_min = min([sample.min() for sample in samples])
        logging.info(f'gen. imgs. stats :: '
                     f'max: {sample_max:.4f}, min: {sample_min:.4f}, mean: {sample_mean:.4f}, std: {sample_std:.4f}')

    return dataset


@torch.no_grad()
def compute_activations_from_dataset(dataset,
                                     batch_size=64,
                                     inception_model=None,
                                     device=torch.device('cuda'),
                                     normalized=False,
                                     ):
    if inception_model is None:
        inception_model = get_inception_model().to(device)

    loader = DataLoader(dataset, shuffle=False, pin_memory=True, batch_size=batch_size, num_workers=16)

    acts = []
    inception_model.eval()

    for xs in tqdm(loader, desc="compute acts (gen. imgs)"):
        xs = xs[0].to(device, non_blocking=True)
        if normalized:
            xs = 0.5 * xs + 0.5
        act = inception_model(xs)
        acts.append(act.cpu())

    acts = torch.cat(acts, dim=0)
    return acts


def compute_statistics_from_files(path,
                                  batch_size=64,
                                  inception_model=None,
                                  device=torch.device('cuda'),
                                  return_acts=False,
                                  ):
    dataset = create_dataset_from_files(path)
    acts = compute_activations_from_dataset(dataset,
                                            batch_size=batch_size,
                                            inception_model=inception_model,
                                            device=device)
    mu_acts, sigma_acts = mean_covar_numpy(acts)
    if return_acts:
        return mu_acts, sigma_acts, acts
    else:
        return mu_acts, sigma_acts


def compute_statistics_from_tensor(tensor,
                                   batch_size=64,
                                   inception_model=None,
                                   device=torch.device('cuda'),
                                   return_acts=False,
                                   ):
    dataset = torch.utils.data.TensorDataset(tensor)
    acts = compute_activations_from_dataset(dataset,
                                            batch_size=batch_size,
                                            inception_model=inception_model,
                                            device=device)
    mu_acts, sigma_acts = mean_covar_numpy(acts)
    if return_acts:
        return mu_acts, sigma_acts, acts
    else:
        return mu_acts, sigma_acts


def compute_rfid(dataset,
                 stage1_model,
                 batch_size=64,
                 device=torch.device('cuda'),
                 ):
    mu_orig, sigma_orig, mu_recon, sigma_recon = \
        compute_statistics_dataset(dataset,
                                   stage1_model=stage1_model,
                                   batch_size=batch_size,
                                   device=device,
                                   skip_original=False,
                                   )
    rfid = frechet_distance(mu_orig, sigma_orig, mu_recon, sigma_recon)
    return rfid


def compute_fid(fake_path,
                ref_stat_path,
                batch_size=64,
                device=torch.device('cuda'),
                ):
    act_path = Path(fake_path) / 'acts.npz'
    if not act_path.exists():
        mu, sigma, acts = compute_statistics_from_files(fake_path,
                                                        batch_size=batch_size,
                                                        device=device,
                                                        return_acts=True,
                                                        )
        np.savez(act_path, acts=acts, mu=mu, sigma=sigma)
        logging.info(f'activations saved to {act_path.as_posix()}')
    else:
        logging.info(f'precomputed activations found: {act_path.as_posix()}')

    acts_fake = np.load(act_path)

    stats_ref = np.load(ref_stat_path)
    mu_ref, sigma_ref = stats_ref['mu'], stats_ref['sigma']
    logging.info(f'reference batch stats loaded from {ref_stat_path}')

    mu_fake, sigma_fake = acts_fake['mu'], acts_fake['sigma']

    logging.info('computing fid...')
    fid = frechet_distance(mu_ref, sigma_ref, mu_fake, sigma_fake)
    logging.info('FID: {fid:.4f}'.format(fid=fid))

    return fid


def compute_fid_without_store(tensor, ref_stat_path, batch_size=64, device=torch.device('cuda')):
    print('Compute mu and sigma for fake images...')
    mu_fake, sigma_fake = compute_statistics_from_tensor(tensor, batch_size=batch_size, device=device)

    stats_ref = np.load(ref_stat_path)
    mu_ref, sigma_ref = stats_ref['mu'], stats_ref['sigma']
    print(f'reference batch stats loaded from {ref_stat_path}')

    print('computing fid...')
    fid = frechet_distance(mu_ref, sigma_ref, mu_fake, sigma_fake)
    print('FID: {fid:.4f}'.format(fid=fid))

    return fid


================================================
FILE: LatentLM/metrics/inception.py
================================================
"""https://github.com/mseitzer/pytorch-fid/blob/master/src/pytorch_fid/inception.py
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision

from torch.utils.model_zoo import load_url

# Inception weights ported to Pytorch from
# http://download.tensorflow.org/models/image/imagenet/inception-2015-12-05.tgz
FID_WEIGHTS_URL = 'https://github.com/mseitzer/pytorch-fid/releases/download/fid_weights/pt_inception-2015-12-05-6726825d.pth'  # noqa: E501


class InceptionV3(nn.Module):
    """Pretrained InceptionV3 network returning feature maps"""

    # Index of default block of inception to return,
    # corresponds to output of final average pooling
    DEFAULT_BLOCK_INDEX = 3

    # Maps feature dimensionality to their output blocks indices
    BLOCK_INDEX_BY_DIM = {
        64: 0,   # First max pooling features
        192: 1,  # Second max pooling featurs
        768: 2,  # Pre-aux classifier features
        2048: 3  # Final average pooling features
    }

    def __init__(self,
                 output_blocks=[DEFAULT_BLOCK_INDEX],
                 resize_input=True,
                 normalize_input=True,
                 requires_grad=False,
                 use_fid_inception=True):
        """Build pretrained InceptionV3

        Parameters
        ----------
        output_blocks : list of int
            Indices of blocks to return features of. Possible values are:
                - 0: corresponds to output of first max pooling
                - 1: corresponds to output of second max pooling
                - 2: corresponds to output which is fed to aux classifier
                - 3: corresponds to output of final average pooling
        resize_input : bool
            If true, bilinearly resizes input to width and height 299 before
            feeding input to model. As the network without fully connected
            layers is fully convolutional, it should be able to handle inputs
            of arbitrary size, so resizing might not be strictly needed
        normalize_input : bool
            If true, scales the input from range (0, 1) to the range the
            pretrained Inception network expects, namely (-1, 1)
        requires_grad : bool
            If true, parameters of the model require gradients. Possibly useful
            for finetuning the network
        use_fid_inception : bool
            If true, uses the pretrained Inception model used in Tensorflow's
            FID implementation. If false, uses the pretrained Inception model
            available in torchvision. The FID Inception model has different
            weights and a slightly different structure from torchvision's
            Inception model. If you want to compute FID scores, you are
            strongly advised to set this parameter to true to get comparable
            results.
        """
        super(InceptionV3, self).__init__()

        self.resize_input = resize_input
        self.normalize_input = normalize_input
        self.output_blocks = sorted(output_blocks)
        self.last_needed_block = max(output_blocks)

        assert self.last_needed_block <= 3, \
            'Last possible output block index is 3'

        self.blocks = nn.ModuleList()

        if use_fid_inception:
            inception = fid_inception_v3()
        else:
            inception = _inception_v3(pretrained=True)

        # Block 0: input to maxpool1
        block0 = [
            inception.Conv2d_1a_3x3,
            inception.Conv2d_2a_3x3,
            inception.Conv2d_2b_3x3,
            nn.MaxPool2d(kernel_size=3, stride=2)
        ]
        self.blocks.append(nn.Sequential(*block0))

        # Block 1: maxpool1 to maxpool2
        if self.last_needed_block >= 1:
            block1 = [
                inception.Conv2d_3b_1x1,
                inception.Conv2d_4a_3x3,
                nn.MaxPool2d(kernel_size=3, stride=2)
            ]
            self.blocks.append(nn.Sequential(*block1))

        # Block 2: maxpool2 to aux classifier
        if self.last_needed_block >= 2:
            block2 = [
                inception.Mixed_5b,
                inception.Mixed_5c,
                inception.Mixed_5d,
                inception.Mixed_6a,
                inception.Mixed_6b,
                inception.Mixed_6c,
                inception.Mixed_6d,
                inception.Mixed_6e,
            ]
            self.blocks.append(nn.Sequential(*block2))

        # Block 3: aux classifier to final avgpool
        if self.last_needed_block >= 3:
            block3 = [
                inception.Mixed_7a,
                inception.Mixed_7b,
                inception.Mixed_7c,
                nn.AdaptiveAvgPool2d(output_size=(1, 1))
            ]
            self.blocks.append(nn.Sequential(*block3))

        self.fc = nn.Linear(2048, 1008, bias=True)
        with torch.no_grad():
            self.fc.weight.copy_(inception.fc.weight)
            self.fc.bias.copy_(inception.fc.bias)

        for param in self.parameters():
            param.requires_grad = requires_grad

    def forward(self, inp, return_logits=False):
        """Get Inception feature maps

        Parameters
        ----------
        inp : torch.autograd.Variable
            Input tensor of shape Bx3xHxW. Values are expected to be in
            range (0, 1)

        Returns
        -------
        List of torch.autograd.Variable, corresponding to the selected output
        block, sorted ascending by index
        """
        outp = []
        x = inp

        if self.resize_input:
            x = F.interpolate(x,
                              size=(299, 299),
                              mode='bilinear',
                              align_corners=False)

        if self.normalize_input:
            x = 2 * x - 1  # Scale from range (0, 1) to range (-1, 1)

        for idx, block in enumerate(self.blocks):
            x = block(x)
            if idx in self.output_blocks:
                outp.append(x)

            # if idx == self.last_needed_block:
            #     break

        if return_logits:
            x = F.dropout(x, training=False)
            x = torch.flatten(x, 1)
            logit = self.fc(x)
            return outp, logit
        else:
            return outp


def _inception_v3(*args, **kwargs):
    """Wraps `torchvision.models.inception_v3`

    Skips default weight inititialization if supported by torchvision version.
    See https://github.com/mseitzer/pytorch-fid/issues/28.
    """
    kwargs['init_weights'] = False

    return torchvision.models.inception_v3(*args, **kwargs)


def fid_inception_v3():
    """Build pretrained Inception model for FID computation

    The Inception model for FID computation uses a different set of weights
    and has a slightly different structure than torchvision's Inception.

    This method first constructs torchvision's Inception and then patches the
    necessary parts that are different in the FID Inception model.
    """
    inception = _inception_v3(num_classes=1008,
                              aux_logits=False,
                              pretrained=False)
    inception.Mixed_5b = FIDInceptionA(192, pool_features=32)
    inception.Mixed_5c = FIDInceptionA(256, pool_features=64)
    inception.Mixed_5d = FIDInceptionA(288, pool_features=64)
    inception.Mixed_6b = FIDInceptionC(768, channels_7x7=128)
    inception.Mixed_6c = FIDInceptionC(768, channels_7x7=160)
    inception.Mixed_6d = FIDInceptionC(768, channels_7x7=160)
    inception.Mixed_6e = FIDInceptionC(768, channels_7x7=192)
    inception.Mixed_7b = FIDInceptionE_1(1280)
    inception.Mixed_7c = FIDInceptionE_2(2048)

    state_dict = load_url(FID_WEIGHTS_URL, progress=True)
    inception.load_state_dict(state_dict)
    return inception


class FIDInceptionA(torchvision.models.inception.InceptionA):
    """InceptionA block patched for FID computation"""
    def __init__(self, in_channels, pool_features):
        super(FIDInceptionA, self).__init__(in_channels, pool_features)

    def forward(self, x):
        branch1x1 = self.branch1x1(x)

        branch5x5 = self.branch5x5_1(x)
        branch5x5 = self.branch5x5_2(branch5x5)

        branch3x3dbl = self.branch3x3dbl_1(x)
        branch3x3dbl = self.branch3x3dbl_2(branch3x3dbl)
        branch3x3dbl = self.branch3x3dbl_3(branch3x3dbl)

        # Patch: Tensorflow's average pool does not use the padded zero's in
        # its average calculation
        branch_pool = F.avg_pool2d(x, kernel_size=3, stride=1, padding=1,
                                   count_include_pad=False)
        branch_pool = self.branch_pool(branch_pool)

        outputs = [branch1x1, branch5x5, branch3x3dbl, branch_pool]
        return torch.cat(outputs, 1)


class FIDInceptionC(torchvision.models.inception.InceptionC):
    """InceptionC block patched for FID computation"""
    def __init__(self, in_channels, channels_7x7):
        super(FIDInceptionC, self).__init__(in_channels, channels_7x7)

    def forward(self, x):
        branch1x1 = self.branch1x1(x)

        branch7x7 = self.branch7x7_1(x)
        branch7x7 = self.branch7x7_2(branch7x7)
        branch7x7 = self.branch7x7_3(branch7x7)

        branch7x7dbl = self.branch7x7dbl_1(x)
        branch7x7dbl = self.branch7x7dbl_2(branch7x7dbl)
        branch7x7dbl = self.branch7x7dbl_3(branch7x7dbl)
        branch7x7dbl = self.branch7x7dbl_4(branch7x7dbl)
        branch7x7dbl = self.branch7x7dbl_5(branch7x7dbl)

        # Patch: Tensorflow's average pool does not use the padded zero's in
        # its average calculation
        branch_pool = F.avg_pool2d(x, kernel_size=3, stride=1, padding=1,
                                   count_include_pad=False)
        branch_pool = self.branch_pool(branch_pool)

        outputs = [branch1x1, branch7x7, branch7x7dbl, branch_pool]
        return torch.cat(outputs, 1)


class FIDInceptionE_1(torchvision.models.inception.InceptionE):
    """First InceptionE block patched for FID computation"""
    def __init__(self, in_channels):
        super(FIDInceptionE_1, self).__init__(in_channels)

    def forward(self, x):
        branch1x1 = self.branch1x1(x)

        branch3x3 = self.branch3x3_1(x)
        branch3x3 = [
            self.branch3x3_2a(branch3x3),
            self.branch3x3_2b(branch3x3),
        ]
        branch3x3 = torch.cat(branch3x3, 1)

        branch3x3dbl = self.branch3x3dbl_1(x)
        branch3x3dbl = self.branch3x3dbl_2(branch3x3dbl)
        branch3x3dbl = [
            self.branch3x3dbl_3a(branch3x3dbl),
            self.branch3x3dbl_3b(branch3x3dbl),
        ]
        branch3x3dbl = torch.cat(branch3x3dbl, 1)

        # Patch: Tensorflow's average pool does not use the padded zero's in
        # its average calculation
        branch_pool = F.avg_pool2d(x, kernel_size=3, stride=1, padding=1,
                                   count_include_pad=False)
        branch_pool = self.branch_pool(branch_pool)

        outputs = [branch1x1, branch3x3, branch3x3dbl, branch_pool]
        return torch.cat(outputs, 1)


class FIDInceptionE_2(torchvision.models.inception.InceptionE):
    """Second InceptionE block patched for FID computation"""
    def __init__(self, in_channels):
        super(FIDInceptionE_2, self).__init__(in_channels)

    def forward(self, x):
        branch1x1 = self.branch1x1(x)

        branch3x3 = self.branch3x3_1(x)
        branch3x3 = [
            self.branch3x3_2a(branch3x3),
            self.branch3x3_2b(branch3x3),
        ]
        branch3x3 = torch.cat(branch3x3, 1)

        branch3x3dbl = self.branch3x3dbl_1(x)
        branch3x3dbl = self.branch3x3dbl_2(branch3x3dbl)
        branch3x3dbl = [
            self.branch3x3dbl_3a(branch3x3dbl),
            self.branch3x3dbl_3b(branch3x3dbl),
        ]
        branch3x3dbl = torch.cat(branch3x3dbl, 1)

        # Patch: The FID Inception model uses max pooling instead of average
        # pooling. This is likely an error in this specific Inception
        # implementation, as other Inception models use average pooling here
        # (which matches the description in the paper).
        branch_pool = F.max_pool2d(x, kernel_size=3, stride=1, padding=1)
        branch_pool = self.branch_pool(branch_pool)

        outputs = [branch1x1, branch3x3, branch3x3dbl, branch_pool]
        return torch.cat(outputs, 1)


================================================
FILE: LatentLM/models/DiT.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.

# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# --------------------------------------------------------
# References:
# GLIDE: https://github.com/openai/glide-text2im
# MAE: https://github.com/facebookresearch/mae/blob/main/models_mae.py
# --------------------------------------------------------
import functools
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import math
from timm.models.vision_transformer import PatchEmbed
from .RMSNorm import RMSNorm


def modulate(x, shift, scale):
    return x * (1 + scale) + shift


#################################################################################
#               Embedding Layers for Timesteps and Class Labels                 #
#################################################################################

class TimestepEmbedder(nn.Module):
    """
    Embeds scalar timesteps into vector representations.
    """
    def __init__(self, hidden_size, frequency_embedding_size=256):
        super().__init__()
        self.mlp = nn.Sequential(
            nn.Linear(frequency_embedding_size, hidden_size, bias=False),
            nn.SiLU(),
            nn.Linear(hidden_size, hidden_size, bias=False),
        )
        self.frequency_embedding_size = frequency_embedding_size

    @staticmethod
    def timestep_embedding(t, dim, max_period=10000):
        """
        Create sinusoidal timestep embeddings.
        :param t: a 1-D Tensor of N indices, one per batch element.
                          These may be fractional.
        :param dim: the dimension of the output.
        :param max_period: controls the minimum frequency of the embeddings.
        :return: an (N, D) Tensor of positional embeddings.
        """
        # https://github.com/openai/glide-text2im/blob/main/glide_text2im/nn.py
        half = dim // 2
        freqs = torch.exp(
            -math.log(max_period) * torch.arange(start=0, end=half, dtype=torch.float32) / half
        ).to(t.device)
        args = t[:, None].float() * freqs[None]
        embedding = torch.cat([torch.cos(args), torch.sin(args)], dim=-1)
        if dim % 2:
            embedding = torch.cat([embedding, torch.zeros_like(embedding[:, :1])], dim=-1)
        return embedding.to(t.dtype)

    def forward(self, t):
        t_freq = self.timestep_embedding(t, self.frequency_embedding_size)
        t_emb = self.mlp(t_freq)
        return t_emb


class LabelEmbedder(nn.Module):
    """
    Embeds class labels into vector representations. Also handles label dropout for classifier-free guidance.
    """
    def __init__(self, num_classes, hidden_size, dropout_prob):
        super().__init__()
        use_cfg_embedding = dropout_prob > 0
        self.embedding_table = nn.Embedding(num_classes + use_cfg_embedding, hidden_size)
        self.num_classes = num_classes
        self.dropout_prob = dropout_prob

    def token_drop(self, labels, force_drop_ids=None):
        """
        Drops labels to enable classifier-free guidance.
        """
        if force_drop_ids is None:
            drop_ids = torch.rand(labels.shape[0], device=labels.device) < self.dropout_prob
        else:
            drop_ids = force_drop_ids == 1
        labels = torch.where(drop_ids, self.num_classes, labels)
        return labels

    def forward(self, labels, train, force_drop_ids=None):
        use_dropout = self.dropout_prob > 0
        if (train and use_dropout) or (force_drop_ids is not None):
            labels = self.token_drop(labels, force_drop_ids)
        embeddings = self.embedding_table(labels)
        return embeddings


class SwiGLU(nn.Module):
    def __init__(
        self,
        embed_dim,
        ffn_dim,
        drop=0.,
    ):
        super().__init__()
        self.embed_dim = embed_dim
        self.fc1 = nn.Linear(self.embed_dim, ffn_dim, bias=False)
        self.gate = nn.Linear(self.embed_dim, ffn_dim, bias=False)
        self.fc2 = nn.Linear(ffn_dim, self.embed_dim, bias=False)
        self.drop = nn.Dropout(drop)

    def forward(self, x):
        x_shape = x.shape
        x = x.reshape(-1, x.size(-1))
        x = F.silu(self.fc1(x)) * self.gate(x)
        x = self.drop(x)
        x = self.fc2(x)
        x = self.drop(x)
        output = x.view(x_shape)
        return output
    
#################################################################################
#                                 Core DiT Model                                #
#################################################################################
class Attention(nn.Module):
    def __init__(self, dim, num_heads=8, num_kv_heads=8, qkv_bias=False, attn_drop=0., proj_drop=0.):
        super().__init__()
        self.dim = dim
        self.head_dim = dim // num_heads
        self.num_heads = num_heads
        self.num_kv_heads = num_kv_heads
        self.n_rep = num_heads // num_kv_heads
        head_dim = dim // num_heads
        self.scale = head_dim ** -0.5

        self.qkv = nn.Linear(dim, dim + 2 * self.num_kv_heads * self.head_dim, bias=qkv_bias)
        self.attn_drop = nn.Dropout(attn_drop)
        self.proj = nn.Linear(dim, dim, bias=False)
        self.proj_drop = nn.Dropout(proj_drop)

    def forward(self, x):
        B, N, C = x.shape
        qkv = self.qkv(x).reshape(B, N, self.num_heads + 2 * self.num_kv_heads, self.head_dim)
        q, k, v = torch.split(qkv, [self.num_heads, self.num_kv_heads, self.num_kv_heads], dim=2)
        q, k, v = q.transpose(1, 2), k.transpose(1, 2), v.transpose(1, 2)
        x = F.scaled_dot_product_attention(
            q, k, v,
            dropout_p=self.attn_drop.p if self.training else 0.,
        )

        x = x.transpose(1, 2).reshape(B, N, C)
        x = self.proj(x)
        x = self.proj_drop(x)
        return x
    
class DiTBlock(nn.Module):
    """
    A DiT block with adaptive layer norm zero (adaLN-Zero) conditioning.
    """
    def __init__(self, hidden_size, num_heads, num_kv_heads, mlp_ratio=4.0, proj_drop=0., attn_drop=0., **block_kwargs):
        super().__init__()
        self.norm1 = RMSNorm(hidden_size, elementwise_affine=False, eps=1e-6)
        self.attn = Attention(hidden_size, num_heads=num_heads, num_kv_heads=num_kv_heads, qkv_bias=False, proj_drop=proj_drop, attn_drop=attn_drop, **block_kwargs)
        self.norm2 = RMSNorm(hidden_size, elementwise_affine=False, eps=1e-6)
        mlp_hidden_dim = int(hidden_size * mlp_ratio * 2 / 3 / 64) * 64
        self.mlp = SwiGLU(hidden_size, mlp_hidden_dim, drop=proj_drop)
        self.adaLN_modulation = nn.Sequential(
            nn.SiLU(),
            nn.Linear(hidden_size, 6 * hidden_size, bias=False)
        )

    def forward(self, x, c):
        shift_msa, scale_msa, gate_msa, shift_mlp, scale_mlp, gate_mlp = self.adaLN_modulation(c).chunk(6, dim=-1)
        x = x + gate_msa * self.attn(modulate(self.norm1(x), shift_msa, scale_msa))
        x = x + gate_mlp * self.mlp(modulate(self.norm2(x), shift_mlp, scale_mlp))
        return x


class FinalLayer(nn.Module):
    """
    The final layer of DiT.
    """
    def __init__(self, hidden_size, output_size):
        super().__init__()
        self.norm_final = RMSNorm(hidden_size, elementwise_affine=False, eps=1e-6)
        self.linear = nn.Linear(hidden_size, output_size, bias=False)
        self.adaLN_modulation = nn.Sequential(
            nn.SiLU(),
            nn.Linear(hidden_size, 2 * hidden_size, bias=False)
        )

    def forward(self, x, c):
        shift, scale = self.adaLN_modulation(c).chunk(2, dim=-1)
        x = modulate(self.norm_final(x), shift, scale)
        x = self.linear(x)
        return x


class DiT(nn.Module):
    """
    Diffusion model with a Transformer backbone.
    """
    def __init__(
        self,
        input_size=32,
        patch_size=1,
        flatten_input=False,
        in_channels=4,
        hidden_size=1152,
        depth=28,
        num_heads=16,
        num_kv_heads=None,
        mlp_ratio=4.0,
        class_dropout_prob=0.1,
        num_classes=1000,
        drop=0.0,
        norm_layer=None
    ):
        super().__init__()
        self.in_channels = in_channels
        self.out_channels = in_channels
        self.input_size = input_size
        self.patch_size = patch_size if not flatten_input else 1
        self.num_heads = num_heads
        self.num_kv_heads = num_kv_heads if num_kv_heads is not None else num_heads
        self.flatten_input_size = input_size * input_size // self.patch_size // self.patch_size
        self.flatten_input = flatten_input

        self.x_embedder = PatchEmbed(input_size, patch_size, in_channels, hidden_size, strict_img_size=False, norm_layer=norm_layer) if not flatten_input else nn.Linear(in_channels, hidden_size, bias=False)
        self.t_embedder = TimestepEmbedder(hidden_size)
        self.y_embedder = LabelEmbedder(num_classes, hidden_size, class_dropout_prob)
        # Will use fixed sin-cos embedding:
        self.pos_embed = nn.Parameter(torch.zeros(1, self.flatten_input_size, hidden_size), requires_grad=False)

        self.blocks = nn.ModuleList([
            DiTBlock(hidden_size, self.num_heads, self.num_kv_heads, mlp_ratio=mlp_ratio, proj_drop=drop, attn_drop=drop) for _ in range(depth)
        ])
        self.final_layer = FinalLayer(hidden_size, self.patch_size * self.patch_size * self.out_channels)
        self.initialize_weights()
        
    @property
    def device(self):
        return next(self.parameters()).device

    @property
    def dtype(self):
        return next(self.parameters()).dtype

    def initialize_weights(self):
        # Initialize transformer layers:
        def _basic_init(module):
            if isinstance(module, nn.Linear):
                if module.bias is not None:
                    nn.init.constant_(module.bias, 0)
        self.apply(_basic_init)

        # Initialize (and freeze) pos_embed by sin-cos embedding:
        pos_embed = get_2d_sincos_pos_embed(self.pos_embed.shape[-1], int(self.x_embedder.num_patches ** 0.5)) if not self.flatten_input \
            else get_1d_sincos_pos_embed(self.pos_embed.shape[-1], self.flatten_input_size)
        self.pos_embed.data.copy_(torch.from_numpy(pos_embed).float().unsqueeze(0))

        # Initialize patch_embed like nn.Linear (instead of nn.Conv2d):
        if not self.flatten_input:
            nn.init.constant_(self.x_embedder.proj.bias, 0)

        # Initialize label embedding table:
        nn.init.normal_(self.y_embedder.embedding_table.weight, std=0.02)

        # Initialize timestep embedding MLP:
        nn.init.normal_(self.t_embedder.mlp[0].weight, std=0.02)
        nn.init.normal_(self.t_embedder.mlp[2].weight, std=0.02)

        # Zero-out adaLN modulation layers in DiT blocks:
        for block in self.blocks:
            nn.init.constant_(block.adaLN_modulation[-1].weight, 0)

        # Zero-out output layers:
        nn.init.constant_(self.final_layer.adaLN_modulation[-1].weight, 0)
        nn.init.constant_(self.final_layer.linear.weight, 0)

    def unpatchify(self, x):
        """
        x: (N, T, patch_size**2 * C)
        imgs: (N, H, W, C)
        """
        c = self.out_channels
        p = self.x_embedder.patch_size[0]
        h = w = int(x.shape[1] ** 0.5)
        assert h * w == x.shape[1]

        x = x.reshape(shape=(x.shape[0], h, w, p, p, c))
        x = torch.einsum('nhwpqc->nchpwq', x)
        imgs = x.reshape(shape=(x.shape[0], c, h * p, h * p))
        return imgs

    def forward(self, x_noise, t, y, **kwargs):
        """
        Forward pass of DiT.
        x: (N, C, H, W) tensor of spatial inputs (images or latent representations of images)
        t: (N,) tensor of diffusion timesteps
        y: (N,) tensor of class labels
        """
        x = self.x_embedder(x_noise) + self.pos_embed  # (N, T, D), where T = H * W / patch_size ** 2
        t = self.t_embedder(t)                   # (N, D)
        y = self.y_embedder(y, self.training)    # (N, D)
        c = (t + y).unsqueeze(1)                 # (N, D)
        for block in self.blocks:
            x = block(x, c)                      # (N, T, D)
        x = self.final_layer(x, c)               # (N, T, patch_size ** 2 * out_channels)
        if not self.flatten_input:
            x = self.unpatchify(x)               # (N, out_channels, H, W)
        return x
    
    def sample_with_cfg(self, y, cfg_scale, sample_func):
        bsz = y.shape[0]
        z = torch.randn(bsz, self.in_channels, self.input_size, self.input_size, device=self.device, dtype=self.dtype) if not self.flatten_input else torch.randn(bsz, self.flatten_input_size, self.in_channels, device=self.device, dtype=self.dtype)
        samples = sample_func(functools.partial(self.forward_with_cfg, y=y, cfg_scale=cfg_scale), z)
        samples, _ = samples.chunk(2, dim=0)
        return samples

    def forward_with_cfg(self, x, t, y, cfg_scale):
        """
        Forward pass of DiT, but also batches the unconditional forward pass for classifier-free guidance.
        """
        # https://github.com/openai/glide-text2im/blob/main/notebooks/text2im.ipynb
        half = x[: len(x) // 2]
        combined = torch.cat([half, half], dim=0)
        eps = self.forward(combined, t, y)
        cond_eps, uncond_eps = torch.split(eps, len(eps) // 2, dim=0)
        half_eps = uncond_eps + cfg_scale * (cond_eps - uncond_eps)
        eps = torch.cat([half_eps, half_eps], dim=0)
        return eps


#################################################################################
#                   Sine/Cosine Positional Embedding Functions                  #
#################################################################################
# https://github.com/facebookresearch/mae/blob/main/util/pos_embed.py

def get_2d_sincos_pos_embed(embed_dim, grid_size, cls_token=False, extra_tokens=0):
    """
    grid_size: int of the grid height and width
    return:
    pos_embed: [grid_size*grid_size, embed_dim] or [1+grid_size*grid_size, embed_dim] (w/ or w/o cls_token)
    """
    grid_h = np.arange(grid_size, dtype=np.float32)
    grid_w = np.arange(grid_size, dtype=np.float32)
    grid = np.meshgrid(grid_w, grid_h)  # here w goes first
    grid = np.stack(grid, axis=0)

    grid = grid.reshape([2, 1, grid_size, grid_size])
    pos_embed = get_2d_sincos_pos_embed_from_grid(embed_dim, grid)
    if cls_token and extra_tokens > 0:
        pos_embed = np.concatenate([np.zeros([extra_tokens, embed_dim]), pos_embed], axis=0)
    return pos_embed

def get_1d_sincos_pos_embed(embed_dim, seq_len, cls_token=False, extra_tokens=0):
    """
    seq_len: int of the sequence length
    return:
    pos_embed: [seq_len, embed_dim] or [1+seq_len, embed_dim] (w/ or w/o cls_token)
    """
    pos = np.arange(seq_len, dtype=np.float32)
    pos_embed = get_1d_sincos_pos_embed_from_grid(embed_dim, pos)
    if cls_token and extra_tokens > 0:
        pos_embed = np.concatenate([np.zeros([extra_tokens, embed_dim]), pos_embed], axis=0)
    return pos_embed

def get_2d_sincos_pos_embed_from_grid(embed_dim, grid):
    assert embed_dim % 2 == 0

    # use half of dimensions to encode grid_h
    emb_h = get_1d_sincos_pos_embed_from_grid(embed_dim // 2, grid[0])  # (H*W, D/2)
    emb_w = get_1d_sincos_pos_embed_from_grid(embed_dim // 2, grid[1])  # (H*W, D/2)

    emb = np.concatenate([emb_h, emb_w], axis=1) # (H*W, D)
    return emb


def get_1d_sincos_pos_embed_from_grid(embed_dim, pos):
    """
    embed_dim: output dimension for each position
    pos: a list of positions to be encoded: size (M,)
    out: (M, D)
    """
    assert embed_dim % 2 == 0
    omega = np.arange(embed_dim // 2, dtype=np.float64)
    omega /= embed_dim / 2.
    omega = 1. / 10000**omega  # (D/2,)

    pos = pos.reshape(-1)  # (M,)
    out = np.einsum('m,d->md', pos, omega)  # (M, D/2), outer product

    emb_sin = np.sin(out) # (M, D/2)
    emb_cos = np.cos(out) # (M, D/2)

    emb = np.concatenate([emb_sin, emb_cos], axis=1)  # (M, D)
    return emb


#################################################################################
#                                   DiT Configs                                  #
#################################################################################

def DiT_13B(**kwargs):
    return DiT(depth=40, hidden_size=5120, num_heads=40, **kwargs)

def DiT_7B(**kwargs):
    return DiT(depth=32, hidden_size=4096, num_heads=32, **kwargs)

def DiT_3B(**kwargs):
    return DiT(depth=32, hidden_size=2560, num_heads=20, **kwargs)

def DiT_XL(**kwargs):
    return DiT(depth=24, hidden_size=2048, num_heads=16, **kwargs)

def DiT_Large(**kwargs):
    return DiT(depth=24, hidden_size=1536, num_heads=12, **kwargs)

def DiT_Medium(**kwargs):
    return DiT(depth=24, hidden_size=1024, num_heads=16, **kwargs)

def DiT_Base(**kwargs):
    return DiT(depth=12, hidden_size=768, num_heads=12, **kwargs)

DiT_models = {
    'DiT-13B': DiT_13B, 'DiT-7B': DiT_7B, 'DiT-3B': DiT_3B, 'DiT-XL': DiT_XL, 'DiT-Large': DiT_Large,
    'DiT-Medium':  DiT_Medium, 'DiT-Base': DiT_Base
}

================================================
FILE: LatentLM/models/EMA.py
================================================
import copy
from typing import Any, Dict, Iterable, Optional, Union

import torch

# Adapted from torch-ema https://github.com/fadel/pytorch_ema/blob/master/torch_ema/ema.py#L14
class EMAModel:
    """
    Exponential Moving Average of models weights
    """

    def __init__(
        self,
        parameters: Iterable[torch.nn.Parameter],
        decay: float = 0.9999,
        min_decay: float = 0.0,
        update_after_step: int = 0,
        use_ema_warmup: bool = False,
        inv_gamma: Union[float, int] = 1.0,
        power: Union[float, int] = 2 / 3,
        model_cls: Optional[Any] = None,
        model_config: Dict[str, Any] = None,
        **kwargs,
    ):
        """
        Args:
            parameters (Iterable[torch.nn.Parameter]): The parameters to track.
            decay (float): The decay factor for the exponential moving average.
            min_decay (float): The minimum decay factor for the exponential moving average.
            update_after_step (int): The number of steps to wait before starting to update the EMA weights.
            use_ema_warmup (bool): Whether to use EMA warmup.
            inv_gamma (float):
                Inverse multiplicative factor of EMA warmup. Default: 1. Only used if `use_ema_warmup` is True.
            power (float): Exponential factor of EMA warmup. Default: 2/3. Only used if `use_ema_warmup` is True.
            device (Optional[Union[str, torch.device]]): The device to store the EMA weights on. If None, the EMA
                        weights will be stored on CPU.

        @crowsonkb's notes on EMA Warmup:
            If gamma=1 and power=1, implements a simple average. gamma=1, power=2/3 are good values for models you plan
            to train for a million or more steps (reaches decay factor 0.999 at 31.6K steps, 0.9999 at 1M steps),
            gamma=1, power=3/4 for models you plan to train for less (reaches decay factor 0.999 at 10K steps, 0.9999
            at 215.4k steps).
        """
        parameters = list(parameters)
        self.shadow_params = [p.clone().detach() for p in parameters]
        self.temp_stored_params = None

        self.decay = decay
        self.min_decay = min_decay
        self.update_after_step = update_after_step
        self.use_ema_warmup = use_ema_warmup
        self.inv_gamma = inv_gamma
        self.power = power
        self.optimization_step = 0
        self.cur_decay_value = None  # set in `step()`

        self.model_cls = model_cls
        self.model_config = model_config

    def get_decay(self, optimization_step: int) -> float:
        """
        Compute the decay factor for the exponential moving average.
        """
        step = max(0, optimization_step - self.update_after_step - 1)

        if step <= 0:
            return 0.0

        if self.use_ema_warmup:
            cur_decay_value = 1 - (1 + step / self.inv_gamma) ** -self.power
        else:
            cur_decay_value = (1 + step) / (10 + step)

        cur_decay_value = min(cur_decay_value, self.decay)
        # make sure decay is not smaller than min_decay
        cur_decay_value = max(cur_decay_value, self.min_decay)
        return cur_decay_value

    @torch.no_grad()
    def step(self, parameters: Iterable[torch.nn.Parameter]):
        parameters = list(parameters)

        self.optimization_step += 1

        # Compute the decay factor for the exponential moving average.
        decay = self.get_decay(self.optimization_step)
        self.cur_decay_value = decay
        one_minus_decay = 1 - decay
        for s_param, param in zip(self.shadow_params, parameters):
            if param.requires_grad:
                s_param.sub_(one_minus_decay * (s_param - param))
            else:
                s_param.copy_(param)

    def to(self, device=None, dtype=None) -> None:
        r"""Move internal buffers of the ExponentialMovingAverage to `device`.

        Args:
            device: like `device` argument to `torch.Tensor.to`
        """
        # .to() on the tensors handles None correctly
        self.shadow_params = [
            p.to(device=device, dtype=dtype) if p.is_floating_point() else p.to(device=device)
            for p in self.shadow_params
        ]

    def state_dict(self) -> dict:
        r"""
        Returns the state of the ExponentialMovingAverage as a dict. This method is used by accelerate during
        checkpointing to save the ema state dict.
        """
        return {
            "decay": self.decay,
            "min_decay": self.min_decay,
            "optimization_step": self.optimization_step,
            "update_after_step": self.update_after_step,
            "use_ema_warmup": self.use_ema_warmup,
            "inv_gamma": self.inv_gamma,
            "power": self.power,
            "shadow_params": self.shadow_params,
        }

    def load_state_dict(self, state_dict: dict) -> None:
        r"""
        Args:
        Loads the ExponentialMovingAverage state. This method is used by accelerate during checkpointing to save the
        ema state dict.
            state_dict (dict): EMA state. Should be an object returned
                from a call to :meth:`state_dict`.
        """
        # deepcopy, to be consistent with module API
        state_dict = copy.deepcopy(state_dict)

        self.decay = state_dict.get("decay", self.decay)
        if self.decay < 0.0 or self.decay > 1.0:
            raise ValueError("Decay must be between 0 and 1")

        self.min_decay = state_dict.get("min_decay", self.min_decay)
        if not isinstance(self.min_decay, float):
            raise ValueError("Invalid min_decay")

        self.optimization_step = state_dict.get("optimization_step", self.optimization_step)
        if not isinstance(self.optimization_step, int):
            raise ValueError("Invalid optimization_step")

        self.update_after_step = state_dict.get("update_after_step", self.update_after_step)
        if not isinstance(self.update_after_step, int):
            raise ValueError("Invalid update_after_step")

        self.use_ema_warmup = state_dict.get("use_ema_warmup", self.use_ema_warmup)
        if not isinstance(self.use_ema_warmup, bool):
            raise ValueError("Invalid use_ema_warmup")

        self.inv_gamma = state_dict.get("inv_gamma", self.inv_gamma)
        if not isinstance(self.inv_gamma, (float, int)):
            raise ValueError("Invalid inv_gamma")

        self.power = state_dict.get("power", self.power)
        if not isinstance(self.power, (float, int)):
            raise ValueError("Invalid power")

        shadow_params = state_dict.get("shadow_params", None)
        for model_param, ema_param in zip(self.shadow_params, shadow_params):
                model_param.data = ema_param.data.to(model_param)



================================================
FILE: LatentLM/models/RMSNorm.py
================================================
import torch
import torch.nn as nn

class RMSNorm(nn.Module):
    def __init__(self, dim: int, eps: float = 1e-6, elementwise_affine=True):
        super().__init__()
        self.dim = dim
        self.eps = eps
        self.elementwise_affine = elementwise_affine
        if self.elementwise_affine:
            self.weight = nn.Parameter(torch.ones(dim))
        else:
            self.register_parameter('weight', None)

    def _norm(self, x):
        return x * torch.rsqrt(x.pow(2).mean(-1, keepdim=True) + self.eps)

    def forward(self, x):
        output = self._norm(x.float()).type_as(x)
        if self.weight is not None:
            output = output * self.weight
        return output

    def extra_repr(self) -> str:
        return f'dim={self.dim}, eps={self.eps}, elementwise_affine={self.elementwise_affine}'
    

================================================
FILE: LatentLM/models/Transformer.py
================================================
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.

# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
# --------------------------------------------------------
# References:
# GLIDE: https://github.com/openai/glide-text2im
# MAE: https://github.com/facebookresearch/mae/blob/main/models_mae.py
# --------------------------------------------------------
import functools
import torch
import torch.nn as nn
import torch.nn.functional as F
from timm.models.vision_transformer import PatchEmbed
try:
    from flash_attn import flash_attn_func
    has_flash_attn2 = torch.cuda.get_device_properties(0).major >= 8
except ImportError:
    has_flash_attn2 = False
    print("flash_attn2 not found")

from .DiT import LabelEmbedder, TimestepEmbedder, FinalLayer, SwiGLU, modulate
from .kernel.rotary import apply_rotary_pos_emb as apply_rotary_emb
from .RMSNorm import RMSNorm

def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor:
    """torch.repeat_interleave(x, dim=1, repeats=n_rep)"""
    bs, n_kv_heads, slen, head_dim = x.shape
    if n_rep == 1:
        return x
    return (
        x[:, :, None, :, :]
        .expand(bs, n_kv_heads, n_rep, slen, head_dim)
        .reshape(bs, n_kv_heads * n_rep, slen, head_dim)
    )

class Attention(nn.Module):
    def __init__(self, dim, num_heads=8, num_kv_heads=8, qkv_bias=False, attn_drop=0., proj_drop=0.):
        super().__init__()
        self.dim = dim
        self.head_dim = dim // num_heads
        self.num_heads = num_heads
        self.num_kv_heads = num_kv_heads
        self.n_rep = num_heads // num_kv_heads
        head_dim = dim // num_heads
        self.scale = head_dim ** -0.5

        self.qkv = nn.Linear(dim, dim + 2 * self.num_kv_heads * self.head_dim, bias=qkv_bias)
        self.attn_drop = nn.Dropout(attn_drop)
        self.proj = nn.Linear(dim, dim, bias=False)
        self.proj_drop = nn.Dropout(proj_drop)

    def forward(self, x, start_pos, rel_pos, incremental_state=None):
        B, N, C = x.shape
        qkv = self.qkv(x).reshape(B, N, self.num_heads + 2 * self.num_kv_heads, self.head_dim)
        q, k, v = torch.split(qkv, [self.num_heads, self.num_kv_heads, self.num_kv_heads], dim=2)
        q = apply_rotary_emb(q, *rel_pos, interleaved=True)
        k = apply_rotary_emb(k, *rel_pos, interleaved=True)
        if incremental_state is not None:
            incremental_state["key"][:B, start_pos : start_pos + N] = k
            incremental_state["value"][:B, start_pos : start_pos + N] = v
            k = incremental_state["key"][:B, :start_pos + N]
            v = incremental_state["value"][:B, :start_pos + N]
        if has_flash_attn2 and (x.dtype == torch.float16 or x.dtype == torch.bfloat16):
            x = flash_attn_func(q, k, v, causal=True, dropout_p=self.attn_drop.p if self.training else 0.)
        else:
            q = q.transpose(1, 2)
            k = repeat_kv(k.transpose(1, 2), self.n_rep)
            v = repeat_kv(v.transpose(1, 2), self.n_rep)
            x = F.scaled_dot_product_attention(
                q, k, v,
                is_causal=incremental_state is None,
                dropout_p=self.attn_drop.p if self.training else 0.,
            )
            x = x.transpose(1, 2)

        x = self.proj(x.reshape(B, N, C))
        x = self.proj_drop(x)
        return x
    
class Block(nn.Module):
    def __init__(self, hidden_size, num_heads, num_kv_heads, mlp_ratio=4.0, proj_drop=0., attn_drop=0., **block_kwargs):
        super().__init__()
        self.norm1 = RMSNorm(hidden_size, elementwise_affine=False, eps=1e-6)
        self.attn = Attention(hidden_size, num_heads=num_heads, num_kv_heads=num_kv_heads, qkv_bias=False, proj_drop=proj_drop, attn_drop=attn_drop, **block_kwargs)
        self.norm2 = RMSNorm(hidden_size, elementwise_affine=False, eps=1e-6)
        mlp_hidden_dim = int(hidden_size * mlp_ratio * 2 / 3 / 64) * 64
        self.mlp = SwiGLU(hidden_size, mlp_hidden_dim, drop=proj_drop)

    def forward(self, x, start_pos, rel_pos, incremental_state=None):
        x = x + self.attn(self.norm1(x), start_pos, rel_pos, incremental_state)
        x = x + self.mlp(self.norm2(x))
        return x

class MLPBlock(nn.Module):
    def __init__(self, hidden_size,  mlp_ratio=4.0, drop=0.0, **block_kwargs):
        super().__init__()
        self.norm = RMSNorm(hidden_size, elementwise_affine=False, eps=1e-6)
        mlp_hidden_dim = int(hidden_size * mlp_ratio * 2 / 3 / 64) * 64
        self.mlp = SwiGLU(hidden_size, mlp_hidden_dim, drop=drop)
        self.adaLN_modulation = nn.Sequential(
            nn.SiLU(),
            nn.Linear(hidden_size, 3 * hidden_size, bias=False)
        )

    def forward(self, x, c):
        shift_mlp, scale_mlp, gate_mlp = self.adaLN_modulation(c).chunk(3, dim=-1)
        x = x + gate_mlp * self.mlp(modulate(self.norm(x), shift_mlp, scale_mlp))
        return x

class ConditionLayer(nn.Module):
    def __init__(self, hidden_size):
        super().__init__()
        self.norm_final = RMSNorm(hidden_size, elementwise_affine=False, eps=1e-6)
        self.linear = nn.Linear(hidden_size, hidden_size, bias=False)

    def forward(self, x):
        x = self.norm_final(x)
        x = self.linear(x)
        return x

class Transformer(nn.Module):
    def __init__(
        self,
        input_size=32,
        patch_size=1,
        flatten_input=False,
        in_channels=4,
        hidden_size=1152,
        depth=28,
        diffusion_depth=3,
        num_heads=16,
        num_kv_heads=None,
        mlp_ratio=4.0,
        class_dropout_prob=0.1,
        num_classes=1000,
        posi_scale=1,
        drop=0.0,
        norm_layer=None
    ):
        super().__init__()
        self.in_channels = in_channels
        self.out_channels = in_channels
        self.input_size = input_size
        self.patch_size = patch_size
        self.num_heads = num_heads
        self.num_kv_heads = num_kv_heads if num_kv_heads is not None else num_heads
        self.head_dim = hidden_size // num_heads
        self.hidden_size = hidden_size
        self.flatten_input_size = input_size * input_size
        self.flatten_input = flatten_input
        self.posi_scale = posi_scale

        self.x_embedder = PatchEmbed(input_size, patch_size, in_channels, hidden_size, strict_img_size=False, norm_layer=norm_layer) if not flatten_input else nn.Linear(in_channels, hidden_size, bias=False)
        self.noisy_x_embedder = PatchEmbed(input_size, patch_size, in_channels, hidden_size, strict_img_size=False, norm_layer=norm_layer) if not flatten_input else nn.Linear(in_channels, hidden_size, bias=False)
        self.t_embedder = TimestepEmbedder(hidden_size)
        self.y_embedder = LabelEmbedder(num_classes, hidden_size, class_dropout_prob)
        self._precomputed_freqs_cis = None

        self.blocks = nn.ModuleList([
            Block(hidden_size, self.num_heads, self.num_kv_heads, mlp_ratio=mlp_ratio, proj_drop=drop, attn_drop=drop) for _ in range(depth)
        ])
        self.diffusion_blocks = nn.ModuleList([
            MLPBlock(hidden_size, mlp_ratio=mlp_ratio) for _ in range(diffusion_depth)
        ])
        self.condition_layer = ConditionLayer(hidden_size)
        self.final_layer = FinalLayer(hidden_size, patch_size * patch_size * self.out_channels if not flatten_input else self.out_channels)

        self.initialize_weights()

    def initialize_weights(self):
        # Initialize transformer layers:
        def _basic_init(module):
            if isinstance(module, nn.Linear):
                if module.bias is not None:
                    nn.init.constant_(module.bias, 0)
        self.apply(_basic_init)
        # Initialize patch_embed like nn.Linear (instead of nn.Conv2d):
        if not self.flatten_input:
            nn.init.constant_(self.x_embedder.proj.bias, 0)

        # Initialize label embedding table, timestep embedding MLP, and CLS:
        nn.init.normal_(self.y_embedder.embedding_table.weight, std=0.02)
        nn.init.normal_(self.t_embedder.mlp[0].weight, std=0.02)
        nn.init.normal_(self.t_embedder.mlp[2].weight, std=0.02)

        # Zero-out adaLN modulation layers in DiT blocks:
        for block in self.diffusion_blocks:
            nn.init.constant_(block.adaLN_modulation[-1].weight, 0)

        # Zero-out output layers:
        nn.init.constant_(self.final_layer.adaLN_modulation[-1].weight, 0)
        nn.init.constant_(self.final_layer.linear.weight, 0)
        
    @property
    def device(self):
        return next(self.parameters()).device

    @property
    def dtype(self):
        return next(self.parameters()).dtype

    def unpatchify(self, x):
        """
        x: (N, T, patch_size**2 * C)
        imgs: (N, H, W, C)
        """
        c = self.out_channels
        p = self.x_embedder.patch_size[0]
        h = w = int(x.shape[1] ** 0.5)
        assert h * w == x.shape[1]

        x = x.reshape(shape=(x.shape[0], h, w, p, p, c))
        x = torch.einsum('nhwpqc->nchpwq', x)
        imgs = x.reshape(shape=(x.shape[0], c, h * p, h * p))
        return imgs

    def build_rel_pos(self, x, start_pos = 0):
        if self._precomputed_freqs_cis is None:
            angle = 1.0 / ((10000 * self.posi_scale) ** torch.linspace(0, 1, self.head_dim // 2, dtype=torch.float, device=x.device))
            index = torch.arange(self.flatten_input_size).to(angle)
            self._precomputed_freqs_cis = index[:, None] * angle

        cos = torch.cos(self._precomputed_freqs_cis[start_pos:start_pos+x.size(1)])
        sin = torch.sin(self._precomputed_freqs_cis[start_pos:start_pos+x.size(1)])
        rel_pos = (cos.to(x.dtype), sin.to(x.dtype))

        return rel_pos

    def forward(self, x_noise, t, x_start, y, batch_mul=1):
        """
        Forward pass of ransformer.
        x: (N, C, H, W) tensor of spatial inputs (images or latent representations of images)
        t: (N,) tensor of diffusion timesteps
        y: (N,) tensor of class labels
        """
        condition = self.forward_parallel(x_start, y)
        condition = condition.repeat_interleave(batch_mul, dim=0)
        x = self.forward_diffusion(x_noise, t, condition)
        return x
    
    def forward_parallel(self, x, y):
        x = self.x_embedder(x)
        y = self.y_embedder(y, self.training)
        x = torch.cat((y.unsqueeze(1), x[:, :-1]), dim=1)
        rel_pos = self.build_rel_pos(x)
        for block in self.blocks:
            x = block(x, 0, rel_pos)
 
        x = self.condition_layer(x)
        return x
    
    def forward_recurrent(self, x, start_pos = 0, incremental_state = None):
        start_pos = start_pos if start_pos != 0 else 0
        x = self.y_embedder(x, self.training).unsqueeze(1) if start_pos == 0 else self.x_embedder(x)
        rel_pos = self.build_rel_pos(x, start_pos)
        for idx, block in enumerate(self.blocks):
            if incremental_state is not None and idx not in incremental_state:
                incremental_state[idx] = {
                    "key": torch.empty(x.shape[0], self.flatten_input_size, self.num_kv_heads, self.head_dim, device=x.device, dtype=x.dtype),
                    "value": torch.empty(x.shape[0], self.flatten_input_size, self.num_kv_heads, self.head_dim, device=x.device, dtype=x.dtype),
                }
            x = block(x, start_pos, rel_pos, incremental_state[idx])
            
        x = self.condition_layer(x[:, -1:])
        return x
    
    def forward_diffusion(self, x, t, condition):
        bsz, seq_len = t.shape if t.dim() > 1 else (t.shape[0], 1)
        t = self.t_embedder(t.view(-1)).view(bsz, seq_len, -1)
        c = condition + t
        x = self.noisy_x_embedder(x)
        
        for block in self.diffusion_blocks:
            x = block(x, c)
            
        x = self.final_layer(x, c)
        if not self.flatten_input:
            x = self.unpatchify(x)         # (N, out_channels, H, W)
        return x
    
    def sample_with_cfg(self, prev_token, cfg_scale, sample_func):
        bsz, half_bsz = prev_token.shape[0], prev_token.shape[0] // 2
        incremental_state = {}
        samples = []
        for i in range(self.flatten_input_size):
            if self.flatten_input:
                z = torch.randn(bsz, 1, self.in_channels, device=self.device, dtype=self.dtype)
            else:
                p = self.noisy_x_embedder.patch_size[0]
                h = w = self.input_size // p
                z = torch.randn(bsz, self.in_channels, p, p, device=self.device, dtype=self.dtype)
            recurrent_input = torch.cat([prev_token, prev_token], dim=0) if i != 0 else prev_token
            condition = self.forward_recurrent(recurrent_input, start_pos = i, incremental_state=incremental_state)
            prev_token = sample_func(functools.partial(self.forward_with_cfg, condition=condition, cfg_scale=cfg_scale), z)
            prev_token, _ = prev_token.chunk(2, dim=0)  # Remove null class samples
            samples.append(prev_token)
        if self.flatten_input:
            samples = torch.cat(samples, 1)
        else:
            samples = torch.stack(samples, 2).view(half_bsz, self.in_channels, h, w, p, p).permute(0, 1, 2, 4, 3, 5).reshape(half_bsz, self.in_channels, h * p, w * p)
        return samples

    def forward_with_cfg(self, x, t, condition, cfg_scale):
        """
        Forward pass of ClassTransformer, but also batches the unconditional forward pass for classifier-free guidance.
        """
        # https://github.com/openai/glide-text2im/blob/main/notebooks/text2im.ipynb
        half = x[: len(x) // 2]
        combined = torch.cat([half, half], dim=0)
        eps = self.forward_diffusion(combined, t, condition)
        cond_eps, uncond_eps = torch.split(eps, len(eps) // 2, dim=0)
        half_eps = uncond_eps + cfg_scale * (cond_eps - uncond_eps)
        eps = torch.cat([half_eps, half_eps], dim=0)
        return eps

#################################################################################
#                                   Transformer Configs                                  #
#################################################################################

def Transformer_13B(**kwargs):
    return Transformer(depth=40, hidden_size=5120, num_heads=40, mlp_ratio=6, **kwargs)

def Transformer_7B(**kwargs):
    return Transformer(depth=32, hidden_size=4096, num_heads=32, mlp_ratio=6, **kwargs)

def Transformer_3B(**kwargs):
    return Transformer(depth=32, hidden_size=2560, num_heads=20, mlp_ratio=6, **kwargs)

def Transformer_XL(**kwargs):
    return Transformer(depth=24, hidden_size=2048, num_heads=16, mlp_ratio=6, **kwargs)

def Transformer_Large(**kwargs):
    return Transformer(depth=24, hidden_size=1536, num_heads=12, mlp_ratio=6, **kwargs)

def Transformer_Medium(**kwargs):
    return Transformer(depth=24, hidden_size=1024, num_heads=16, mlp_ratio=6, **kwargs)

def Transformer_Base(**kwargs):
    return Transformer(depth=12, hidden_size=768, num_heads=12, mlp_ratio=6, **kwargs)

def Transformer_H(**kwargs):
    return Transformer(depth=40, hidden_size=1280, num_heads=20, mlp_ratio=4, diffusion_depth=12, **kwargs)

def Transformer_L(**kwargs):
    return Transformer(depth=32, hidden_size=1024, num_heads=16, mlp_ratio=4, diffusion_depth=8, **kwargs)

def Transformer_B(**kwargs):
    return Transformer(depth=24, hidden_size=768, num_heads=12, mlp_ratio=4, diffusion_depth=6, **kwargs)

Transformer_models = {
    'Transformer-13B': Transformer_13B, 'Transformer-7B': Transformer_7B, 'Transformer-3B': Transformer_3B, 'Transformer-XL': Transformer_XL, 'Transformer-Large': Transformer_Large, 'Transformer-Medium':  Transformer_Medium, 'Transformer-Base': Transformer_Base,
    'Transformer-H': Transformer_H, 'Transformer-L': Transformer_L, 'Transformer-B': Transformer_B
}

================================================
FILE: LatentLM/models/__init__.py
================================================
from .DiT import DiT_models, DiT
from .Transformer import Transformer_models, Transformer
from .EMA import EMAModel

All_models = {**DiT_models, **Transformer_models}

================================================
FILE: LatentLM/models/kernel/rotary.py
================================================
# Copyright (c) 2023, Tri Dao.

from typing import Optional, Union

import torch

import triton
import triton.language as tl


# @triton.autotune(
#     configs=[
#         triton.Config({"BLOCK_M": 2}),
#         triton.Config({"BLOCK_M": 4}),
#         triton.Config({"BLOCK_M": 8}),
#         triton.Config({"BLOCK_M": 16}),
#     ],
#     key=["CACHE_KEY_SEQLEN", "BLOCK_K", "INTERLEAVED"],
# )
@triton.jit
def rotary_kernel(
    OUT,  # Pointers to matrices
    X,
    COS,
    SIN,
    CU_SEQLENS,
    SEQLEN_OFFSETS,  # this could be int or a pointer
    # Matrix dimensions
    seqlen,
    nheads,
    rotary_dim,
    seqlen_ro,
    CACHE_KEY_SEQLEN,
    # strides
    stride_out_batch,
    stride_out_seqlen,
    stride_out_nheads,
    stride_out_headdim,
    stride_x_batch,
    stride_x_seqlen,
    stride_x_nheads,
    stride_x_headdim,
    # Meta-parameters
    BLOCK_K: tl.constexpr,
    IS_SEQLEN_OFFSETS_TENSOR: tl.constexpr,
    IS_VARLEN: tl.constexpr,
    INTERLEAVED: tl.constexpr,
    CONJUGATE: tl.constexpr,
    BLOCK_M: tl.constexpr,
):
    pid_m = tl.program_id(axis=0)
    pid_batch = tl.program_id(axis=1)
    pid_head = tl.program_id(axis=2)
    rotary_dim_half = rotary_dim // 2

    if not IS_VARLEN:
        X = X + pid_batch * stride_x_batch + pid_head * stride_x_nheads
        OUT = OUT + pid_batch * stride_out_batch + pid_head * stride_out_nheads
    else:
        start_idx = tl.load(CU_SEQLENS + pid_batch)
        seqlen = tl.load(CU_SEQLENS + pid_batch + 1) - start_idx
        X = X + start_idx * stride_x_seqlen + pid_head * stride_x_nheads
        OUT = OUT + start_idx * stride_out_seqlen + pid_head * stride_out_nheads

    if pid_m * BLOCK_M >= seqlen:
        return
    rm = pid_m * BLOCK_M + tl.arange(0, BLOCK_M)
    if not IS_SEQLEN_OFFSETS_TENSOR:
        rm_cs = rm + SEQLEN_OFFSETS
    else:
        rm_cs = rm + tl.load(SEQLEN_OFFSETS + pid_batch)
    rk = tl.arange(0, BLOCK_K)
    rk_half = tl.arange(0, BLOCK_K // 2)

    if not INTERLEAVED:
        # Load the 1st and 2nd halves of X, do calculation, then store to 1st and 2nd halves of OUT
        X = X + (rm[:, None] * stride_x_seqlen + rk_half[None, :] * stride_x_headdim)
        COS = COS + (rm_cs[:, None] * rotary_dim_half + rk_half[None, :])
        SIN = SIN + (rm_cs[:, None] * rotary_dim_half + rk_half[None, :])
        cos = tl.load(
            COS, mask=(rm_cs[:, None] < seqlen_ro) & (rk_half[None, :] < rotary_dim_half), other=1.0
        ).to(tl.float32)
        sin = tl.load(
            SIN, mask=(rm_cs[:, None] < seqlen_ro) & (rk_half[None, :] < rotary_dim_half), other=0.0
        ).to(tl.float32)
        x0 = tl.load(
            X, mask=(rm[:, None] < seqlen) & (rk_half[None, :] < rotary_dim_half), other=0.0
        ).to(tl.float32)
        x1 = tl.load(
            X + rotary_dim_half * stride_x_headdim,
            mask=(rm[:, None] < seqlen) & (rk_half[None, :] < rotary_dim_half),
            other=0.0,
        ).to(tl.float32)
        if CONJUGATE:
            sin = -sin
        o0 = x0 * cos - x1 * sin
        o1 = x0 * sin + x1 * cos
        # write back result
        OUT = OUT + (rm[:, None] * stride_out_seqlen + rk_half[None, :] * stride_out_headdim)
        tl.store(OUT, o0, mask=(rm[:, None] < seqlen) & (rk_half[None, :] < rotary_dim_half))
        tl.store(
            OUT + rotary_dim_half * stride_out_headdim,
            o1,
            mask=(rm[:, None] < seqlen) & (rk_half[None, :] < rotary_dim_half),
        )
    else:
        # We don't want to load X[0, 2, 4, ...] and X[1, 3, 5, ...] separately since both are slow.
        # Instead, we load x0 = X[0, 1, 2, 3, ...] and x1 = X[1, 0, 3, 2, ...].
        # Loading x0 will be fast but x1 will be slow.
        # Then we load cos = COS[0, 0, 1, 1, ...] and sin = SIN[0, 0, 1, 1, ...].
        # Then we do the calculation and use tl.where to pick put the right outputs for the even
        # and for the odd indices.
        rk_swap = rk + ((rk + 1) % 2) * 2 - 1  # 1, 0, 3, 2, 5, 4, ...
        rk_repeat = tl.arange(0, BLOCK_K) // 2
        X0 = X + (rm[:, None] * stride_x_seqlen + rk[None, :] * stride_x_headdim)
        X1 = X + (rm[:, None] * stride_x_seqlen + rk_swap[None, :] * stride_x_headdim)
        COS = COS + (rm_cs[:, None] * rotary_dim_half + rk_repeat[None, :])
        SIN = SIN + (rm_cs[:, None] * rotary_dim_half + rk_repeat[None, :])
        cos = tl.load(
            COS,
            mask=(rm_cs[:, None] < seqlen_ro) & (rk_repeat[None, :] < rotary_dim_half),
            other=1.0,
        ).to(tl.float32)
        sin = tl.load(
            SIN,
            mask=(rm_cs[:, None] < seqlen_ro) & (rk_repeat[None, :] < rotary_dim_half),
            other=0.0,
        ).to(tl.float32)
        x0 = tl.load(X0, mask=(rm[:, None] < seqlen) & (rk[None, :] < rotary_dim), other=0.0).to(
            tl.float32
        )
        x1 = tl.load(
            X1, mask=(rm[:, None] < seqlen) & (rk_swap[None, :] < rotary_dim), other=0.0
        ).to(tl.float32)
        if CONJUGATE:
            sin = -sin
        x0_cos = x0 * cos
        x1_sin = x1 * sin
        out = tl.where(rk[None, :] % 2 == 0, x0_cos - x1_sin, x0_cos + x1_sin)
        OUT = OUT + (rm[:, None] * stride_out_seqlen + rk[None, :] * stride_out_headdim)
        tl.store(OUT, out, mask=(rm[:, None] < seqlen) & (rk[None, :] < rotary_dim))


def apply_rotary(
    x: torch.Tensor,
    cos: torch.Tensor,
    sin: torch.Tensor,
    seqlen_offsets: Union[int, torch.Tensor] = 0,
    cu_seqlens: Optional[torch.Tensor] = None,
    max_seqlen: Optional[int] = None,
    interleaved=False,
    inplace=False,
    conjugate=False,
) -> torch.Tensor:
    """
    Arguments:
        x: (batch, seqlen, nheads, headdim) if cu_seqlens is None
            else (total_seqlen, nheads, headdim).
        cos: (seqlen_ro, rotary_dim / 2)
        sin: (seqlen_ro, rotary_dim / 2)
        seqlen_offsets: integer or integer tensor of size (batch,)
        cu_seqlens: (batch + 1,) or None
        max_seqlen: int
    Returns:
        y: (batch, seqlen, nheads, headdim)
    """
    is_varlen = cu_seqlens is not None
    if not is_varlen:
        batch, seqlen, nheads, headdim = x.shape
    else:
        assert max_seqlen is not None, "If cu_seqlens is passed in, then max_seqlen must be passed"
        total_seqlen, nheads, headdim = x.shape
        batch_p_1 = cu_seqlens.shape[0]
        batch = batch_p_1 - 1
        seqlen = max_seqlen
    seqlen_ro, rotary_dim = cos.shape
    assert sin.shape == cos.shape
    rotary_dim *= 2
    assert rotary_dim <= headdim, "rotary_dim must be <= headdim"
    assert headdim <= 256, "Only support headdim <= 256"
    assert seqlen_ro >= seqlen, "seqlen_ro must be >= seqlen"

    assert (
        cos.dtype == sin.dtype
    ), f"cos and sin must have the same dtype, got {cos.dtype} and {sin.dtype}"
    assert (
        x.dtype == cos.dtype
    ), f"Input and cos/sin must have the same dtype, got {x.dtype} and {cos.dtype}"

    cos, sin = cos.contiguous(), sin.contiguous()
    if isinstance(seqlen_offsets, torch.Tensor):
        assert seqlen_offsets.shape == (batch,)
        assert seqlen_offsets.dtype in [torch.int32, torch.int64]
        seqlen_offsets = seqlen_offsets.contiguous()
    else:
        assert seqlen_offsets + seqlen <= seqlen_ro

    output = torch.empty_like(x) if not inplace else x
    if rotary_dim < headdim and not inplace:
        output[..., rotary_dim:].copy_(x[..., rotary_dim:])

    BLOCK_K = (
        32
        if rotary_dim <= 32
        else (64 if rotary_dim <= 64 else (128 if rotary_dim <= 128 else 256))
    )
    grid = lambda META: (triton.cdiv(seqlen, META["BLOCK_M"]), batch, nheads)  # noqa
    BLOCK_M = 4 if interleaved else (8 if rotary_dim <= 64 else 4)

    # Need this, otherwise Triton tries to launch from cuda:0 and we get
    # ValueError: Pointer argument (at 0) cannot be accessed from Triton (cpu tensor?)
    with torch.cuda.device(x.device.index):
        rotary_kernel[grid](
            output,  # data ptrs
            x,
            cos,
            sin,
            cu_seqlens,
            seqlen_offsets,
            seqlen,  # shapes
            nheads,
            rotary_dim,
            seqlen_ro,
            seqlen // 128,  # key for triton cache (limit number of compilations)
            output.stride(0) if not is_varlen else 0,  # batch_strides if not varlen else 0
            output.stride(-3),  # seqlen_stride or total_seqlen_stride
            output.stride(-2),  # nheads_stride
            output.stride(-1),  # headdim_stride
            x.stride(0) if not is_varlen else 0,  # batch_strides if not varlen else 0
            x.stride(-3),  # seqlen stride or total_seqlen_stride
            x.stride(-2),  # nheads stride
            x.stride(-1),  # headdim stride
            BLOCK_K,
            isinstance(seqlen_offsets, torch.Tensor),
            is_varlen,
            interleaved,
            conjugate,
            BLOCK_M,
        )
    return output

class ApplyRotaryEmb(torch.autograd.Function):
    @staticmethod
    def forward(
        ctx,
        x,
        cos,
        sin,
        interleaved=False,
        inplace=False,
        seqlen_offsets: Union[int, torch.Tensor] = 0,
        cu_seqlens: Optional[torch.Tensor] = None,
        max_seqlen: Optional[int] = None,
    ):
        out = apply_rotary(
            x,
            cos,
            sin,
            seqlen_offsets=seqlen_offsets,
            cu_seqlens=cu_seqlens,
            max_seqlen=max_seqlen,
            interleaved=interleaved,
            inplace=inplace,
        )
        if isinstance(seqlen_offsets, int):
            # Can't save int with save_for_backward
            ctx.save_for_backward(cos, sin, cu_seqlens)
            ctx.seqlen_offsets = seqlen_offsets
        else:
            ctx.save_for_backward(cos, sin, cu_seqlens, seqlen_offsets)
            ctx.seqlen_offsets = None
        ctx.interleaved = interleaved
        ctx.inplace = inplace
        ctx.max_seqlen = max_seqlen
        return out if not inplace else x

    @staticmethod
    def backward(ctx, do):
        seqlen_offsets = ctx.seqlen_offsets
        if seqlen_offsets is None:
            cos, sin, cu_seqlens, seqlen_offsets = ctx.saved_tensors
        else:
            cos, sin, cu_seqlens = ctx.saved_tensors
        # TD [2023-09-02]: For some reason Triton (2.0.0.post1) errors with
        # "[CUDA]: invalid device context", and cloning makes it work. Idk why. Triton 2.1.0 works.
        if not ctx.interleaved and not ctx.inplace:
            do = do.clone()
        dx = apply_rotary(
            do,
            cos,
            sin,
            seqlen_offsets=seqlen_offsets,
            cu_seqlens=cu_seqlens,
            max_seqlen=ctx.max_seqlen,
            interleaved=ctx.interleaved,
            inplace=ctx.inplace,
            conjugate=True,
        )
        return dx, None, None, None, None, None, None, None


def apply_rotary_emb(
    x,
    cos,
    sin,
    interleaved=False,
    inplace=False,
    seqlen_offsets: Union[int, torch.Tensor] = 0,
    cu_seqlens: Optional[torch.Tensor] = None,
    max_seqlen: Optional[int] = None,
):
    """
    Arguments:
        x: (batch_size, seqlen, nheads, headdim) if cu_seqlens is None
            else (total_seqlen, nheads, headdim)
        cos, sin: (seqlen_rotary, rotary_dim / 2)
        interleaved: if True, rotate pairs of even and odd dimensions (GPT-J style) instead
            of 1st half and 2nd half (GPT-NeoX style).
        inplace: if True, apply rotary embedding in-place.
        seqlen_offsets: (batch_size,) or int. Each sequence in x is shifted by this amount.
            Most commonly used in inference when we have KV cache.
        cu_seqlens: (batch + 1,) or None
        max_seqlen: int
    Return:
        out: (batch_size, seqlen, nheads, headdim) if cu_seqlens is None
            else (total_seqlen, nheads, headdim)
    rotary_dim must be <= headdim
    Apply rotary embedding to the first rotary_dim of x.
    """
    return ApplyRotaryEmb.apply(
        x, cos, sin, interleaved, inplace, seqlen_offsets, cu_seqlens, max_seqlen
    )

def rotate_every_two(x):
    x1 = x[:, :, :, ::2]
    x2 = x[:, :, :, 1::2]
    x = torch.stack((-x2, x1), dim=-1)
    return x.flatten(-2)

def apply_rotary_pos_emb(x, cos, sin, interleaved=False):
    cos, sin = map(lambda t: torch.repeat_interleave(t, 2, dim=-1).unsqueeze(1), (cos, sin))
    return (x * cos) + (rotate_every_two(x) * sin)

================================================
FILE: LatentLM/models/kernel/swiglu.py
================================================
import torch


swiglu_fwd_codestring = """
template <typename T> T swiglu_fwd(T x, T y) {
    return float(x) * float(y) / (1.0f + ::exp(-float(x)));
}
"""
swiglu_bwd_codestring = """
template <typename T> T swiglu_bwd(T x, T y, T g, T& dx, T& dy) {
    float x_sigmoid = 1.0f / (1.0f + ::exp(-float(x)));
    dx = x_sigmoid * (1 + float(x) * (1.0f - x_sigmoid)) * float(g) * float(y);
    dy = float(x) * x_sigmoid * float(g);
}
"""
swiglu_fwd = torch.cuda.jiterator._create_jit_fn(swiglu_fwd_codestring)
swiglu_bwd = torch.cuda.jiterator._create_multi_output_jit_fn(swiglu_bwd_codestring, num_outputs=2)


class SwiGLUFunction(torch.autograd.Function):

    @staticmethod
    def forward(ctx, x, y):
        ctx.save_for_backward(x, y)
        return swiglu_fwd(x, y)

    @staticmethod
    def backward(ctx, dout):
        x, y = ctx.saved_tensors
        return swiglu_bwd(x, y, dout)

swiglu = SwiGLUFunction.apply

================================================
FILE: LatentLM/sample_hf.py
================================================
import argparse
import os
from tqdm import tqdm

import torch
import torch.nn.functional as F
from torchvision.utils import save_image
from accelerate.utils import set_seed

from safetensors.torch import load_file 
from tokenizer_models import AutoencoderKL, load_vae

from schedule.dpm_solver import DPMSolverMultistepScheduler
from models import All_models


def parse_args():
    parser = argparse.ArgumentParser(description="Simple example of a training script.")
    parser.add_argument(
        "--seed",
        type=int,
        default=0,
        help="A seed to use for the random number generator. Can be negative to not set a seed.",
    )
    parser.add_argument(
        "--model",
        type=str,
        default="Transformer-L",
        help="The config of the UNet model to train, leave as None to use standard DDPM configuration.",
    )
    parser.add_argument(
        "--vae",
        type=str,
        default=None,
    )
    parser.add_argument(
        "--train_data_dir",
        type=str,
        default="/tmp/ILSVRC/Data/CLS-LOC/train",
        help=(
            "A folder containing the training data. Folder contents must follow the structure described in"
            " https://huggingface.co/docs/datasets/image_dataset#imagefolder. In particular, a `metadata.jsonl` file"
            " must exist to provide the captions for the images. Ignored if `dataset_name` is specified."
        ),
    )
    parser.add_argument(
        "--image_size",
        type=int,
        default=256,
        help=(
            "The image_size for input images, all the images in the train/validation dataset will be resized to this"
            " image_size"
        ),
    )
    parser.add_argument("--num-classes", type=int, default=1000)
    parser.add_argument(
        "--mixed_precision",
        type=str,
        default="no",
        choices=["no", "fp16", "bf16"],
        help=(
            "Whether to use mixed precision. Choose"
            "between fp16 and bf16 (bfloat16). Bf16 requires PyTorch >= 1.10."
            "and an Nvidia Ampere GPU."
        ),
    )
    parser.add_argument(
        "--prediction_type",
        type=str,
        default="epsilon",
        help="Whether the model should predict the 'epsilon'/noise error or directly the reconstructed image 'x0'.",
    )
    parser.add_argument("--use_ema", action="store_true", help="Whether to use Exponential Moving Average for the final model weights.")  
    parser.add_argument("--ddpm_num_steps", type=int, default=1000)
    parser.add_argument("--ddpm_num_inference_steps", type=int, default=250)
    parser.add_argument("--ddpm_beta_schedule", type=str, default="cosine", help="The beta schedule to use for DDPM.") 
    parser.add_argument("--cfg-scale", type=float, default=4.0)
    parser.add_argument(
        "--checkpoint",
        type=str,
        default=None,
        help=(
            "Whether training should be resumed from a previous checkpoint. Use a path saved by"
            ' `--checkpointing_steps`, or `"latest"` to automatically select the last available checkpoint.'
        ),
    )
    parser.add_argument("--image_name", type=str, default="sample.png")
    args = parser.parse_args()
    return args

@torch.no_grad()
def main(args):
    set_seed(args.seed)
    device = "cuda" if torch.cuda.is_available() else "cpu"
    if args.mixed_precision == "bf16":
        dtype = torch.bfloat16
    elif args.mixed_precision == "fp16":
        dtype = torch.float16
    else:
        dtype = torch.float32
    # Create model:
    vae, input_size, latent_size, flatten_input = load_vae(args.vae, args.image_size)
        
    model = All_models[args.model](
        input_size=input_size,
        in_channels=latent_size,
        num_classes=args.num_classes,
        flatten_input=flatten_input,
    ).to(device).to(dtype)
    # Initialize the scheduler
    noise_scheduler = DPMSolverMultistepScheduler(num_train_timesteps=args.ddpm_num_steps, beta_schedule=args.ddpm_beta_schedule, prediction_type=args.prediction_type)

    model.eval()
    vae.eval()
    # Potentially load in the weights and states from a previous save
    if args.checkpoint:
        other_state = torch.load(os.path.join(args.checkpoint, "other_state.pth"))
        scaling_factor = other_state["scaling_factor"]
        bias_factor = other_state["bias_factor"]
        print(f"Scaling factor: {scaling_factor}, Bias factor: {bias_factor}")
        if args.use_ema and other_state["ema"] is not None:
            checkpoint = other_state["ema"]["shadow_params"]
            for model_param, ema_param in zip(model.parameters(), checkpoint):
                model_param.data = ema_param.data.to(device).to(dtype)
            print(f"Loaded model from checkpoint {args.checkpoint}, EMA applied.")
        else:
            if os.path.exists(os.path.join(args.checkpoint, "model.safetensors")):
                checkpoint = load_file(os.path.join(args.checkpoint, "model.safetensors"))
            elif os.path.exists(os.path.join(args.checkpoint, "pytorch_model")):
                checkpoint = torch.load(os.path.join(args.checkpoint, "pytorch_model", "mp_rank_00_model_states.pt"))["module"]
            else:
                raise ValueError(f"Could not find model checkpoint in {args.checkpoint}.")
            
            model.load_state_dict(checkpoint)
            print(f"Loaded model from checkpoint {args.checkpoint}.")

    # Labels to condition the model with (feel free to change):
    class_labels = [281, 282, 283, 284, 285, 4, 7, 963]
    # class_labels = [207, 360, 387, 974, 88, 979, 417, 279]
    def p_sample(model, image):
        noise_scheduler.set_timesteps(args.ddpm_num_inference_steps)
        for t in noise_scheduler.timesteps:
            model_output = model(image, t.repeat(image.shape[0]).to(image))
            image = noise_scheduler.step(model_output, t, image).prev_sample
        return image

    # Create sampling noise:
    n = len(class_labels)
    y = torch.tensor(class_labels, device=device)
    # Setup classifier-free guidance:
    y_null = torch.tensor([1000] * n, device=device)
    y = torch.cat([y, y_null], 0)
    # Sample images:
    samples = model.sample_with_cfg(y, args.cfg_scale, p_sample)
    images = vae.decode(samples / scaling_factor - bias_factor)

    # Save and display images:
    save_image(images, f"visuals/{args.image_name}", nrow=4, normalize=True, value_range=(-1, 1))
    print(f"Saved image to visuals/{args.image_name}")


if __name__ == "__main__":
    args = parse_args()
    main(args)

================================================
FILE: LatentLM/sample_many.py
================================================
import argparse
import os
from tqdm import tqdm
import random

import torch
import torch.nn.functional as F
from torchvision.utils import save_image
from accelerate.utils import set_seed

from timm.models import create_model
from safetensors.torch import load_file 
from tokenizer_models import AutoencoderKL, load_vae

from schedule.dpm_solver import DPMSolverMultistepScheduler
from models import All_models

imagenet_indices = [
    1, 10, 84, 94, 97, 98, 100, 104, 107, 117, 151, 157, 161, 178, 182, 183,
    268, 322, 337, 354, 366, 380, 973, 975, 978, 980, 981, 983, 985, 986, 991,
    995, 996, 998, 999, 409, 453, 483, 497, 555, 648, 651, 690, 700, 701, 714,
    759, 762, 765, 780, 859, 861, 928, 929, 963
]

def parse_args():
    parser = argparse.ArgumentParser(description="Simple example of a training script.")
    parser.add_argument(
        "--seed",
        type=int,
        default=0,
        help="A seed to use for the random number generator. Can be negative to not set a seed.",
    )
    parser.add_argument(
        "--model",
        type=str,
        default="Transformer-L",
        help="The config of the UNet model to train, leave as None to use standard DDPM configuration.",
    )
    parser.add_argument(
        "--vae",
        type=str,
        default=None,
    )
    parser.add_argument(
        "--train_data_dir",
        type=str,
        default="/tmp/ILSVRC/Data/CLS-LOC/train",
        help=(
            "A folder containing the training data. Folder contents must follow the structure described in"
            " https://huggingface.co/docs/datasets/image_dataset#imagefolder. In particular, a `metadata.jsonl` file"
            " must exist to provide the captions for the images. Ignored if `dataset_name` is specified."
        ),
    )
    parser.add_argument(
        "--image_size",
        type=int,
        default=256,
        help=(
            "The image_size for input images, all the images in the train/validation dataset will be resized to this"
            " image_size"
        ),
    )
    parser.add_argument("--num-classes", type=int, default=1000)
    parser.add_argument(
        "--mixed_precision",
        type=str,
        default="no",
        choices=["no", "fp16", "bf16"],
        help=(
            "Whether to use mixed precision. Choose"
            "between fp16 and bf16 (bfloat16). Bf16 requires PyTorch >= 1.10."
            "and an Nvidia Ampere GPU."
        ),
    )
    parser.add_argument(
        "--prediction_type",
        type=str,
        default="epsilon",
        help="Whether the model should predict the 'epsilon'/noise error or directly the reconstructed image 'x0'.",
    )
    parser.add_argument("--use_ema", action="store_true", help="Whether to use Exponential Moving Average for the final model weights.")  
    parser.add_argument("--ddpm_num_steps", type=int, default=1000)
    parser.add_argument("--ddpm_num_inference_steps", type=int, default=250)
    parser.add_argument("--ddpm_beta_schedule", type=str, default="cosine", help="The beta schedule to use for DDPM.") 
    parser.add_argument("--cfg-scale", type=float, default=4.0)
    parser.add_argument(
        "--checkpoint",
        type=str,
        default=None,
        help=(
            "Whether training should be resumed from a previous checkpoint. Use a path saved by"
            ' `--checkpointing_steps`, or `"latest"` to automatically select the last available checkpoint.'
        ),
    )
    parser.add_argument(
        "--batch_size", type=int, default=32, help="Batch size (per device) for the training dataloader."
    )
    args = parser.parse_args()
    return args

@torch.no_grad()
def main(args):
    set_seed(args.seed)
    device = "cuda" if torch.cuda.is_available() else "cpu"
    if args.mixed_precision == "bf16":
        dtype = torch.bfloat16
    elif args.mixed_precision == "fp16":
        dtype = torch.float16
    else:
        dtype = torch.float32
    vae, input_size, latent_size, flatten_input = load_vae(args.vae, args.image_size)
        
    model = All_models[args.model](
        input_size=input_size,
        in_channels=latent_size,
        num_classes=args.num_classes,
        flatten_input=flatten_input,
    ).to(device).to(dtype)
    # Initialize the scheduler
    noise_scheduler = DPMSolverMultistepScheduler(num_train_timesteps=args.ddpm_num_steps, beta_schedule=args.ddpm_beta_schedule, prediction_type=args.prediction_type)

    model.eval()
    vae.eval()
    # Potentially load in the weights and states from a previous save
    if args.checkpoint:
        other_state = torch.load(os.path.join(args.checkpoint, "other_state.pth"))
        scaling_factor = other_state["scaling_factor"]
        bias_factor = other_state["bias_factor"]
        print(f"Scaling factor: {scaling_factor}, Bias factor: {bias_factor}")
        if args.use_ema and other_state["ema"] is not None:
            checkpoint = other_state["ema"]["shadow_params"]
            for model_param, ema_param in zip(model.parameters(), checkpoint):
                model_param.data = ema_param.data.to(device).to(dtype)
            print(f"Loaded model from checkpoint {args.checkpoint}, EMA applied.")
        else:
            if os.path.exists(os.path.join(args.checkpoint, "model.safetensors")):
                checkpoint = load_file(os.path.join(args.checkpoint, "model.safetensors"))
            elif os.path.exists(os.path.join(args.checkpoint, "pytorch_model")):
                checkpoint = torch.load(os.path.join(args.checkpoint, "pytorch_model", "mp_rank_00_model_states.pt"))["module"]
            else:
                raise ValueError(f"Could not find model checkpoint in {args.checkpoint}.")
            
            model.load_state_dict(checkpoint)
            print(f"Loaded model from checkpoint {args.checkpoint}.")

    image_id = 0
    for _ in tqdm(range(5)):
        def p_sample(model, image):
            noise_scheduler.set_timesteps(args.ddpm_num_inference_steps)
            for t in noise_scheduler.timesteps:
                model_output = model(image, t.repeat(image.shape[0]).to(image))
                image = noise_scheduler.step(model_output, t, image).prev_sample
            return image

        # Create sampling noise:
        n = args.batch_size
        y = torch.randint(0, args.num_classes, (n,), device=device)
        # y = torch.tensor(random.choices([281, 282, 283, 284, 285, 4, 7, 963], k=n), device=device)
        # Setup classifier-free guidance:
        y_null = torch.tensor([1000] * n, device=device)
        y = torch.cat([y, y_null], 0)
        # Sample images:
        samples = model.sample_with_cfg(y, args.cfg_scale, p_sample)
        images = vae.decode(samples / scaling_factor - bias_factor)

        # Save image one by one
        for i, image in enumerate(images):
            save_image(image, f"demo/{image_id}.png", normalize=True, value_range=(-1, 1))
            image_id += 1


if __name__ == "__main__":
    args = parse_args()
    main(args)

================================================
FILE: LatentLM/schedule/__init__.py
================================================
from .ddpm import DDPMScheduler
from .dpm_solver import DPMSolverMultistepScheduler

================================================
FILE: LatentLM/schedule/ddpm.py
================================================
# Copyright 2024 UC Berkeley Team and The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# DISCLAIMER: This file is strongly influenced by https://github.com/ermongroup/ddim

import math
from dataclasses import dataclass
from typing import List, Optional, Tuple, Union

import numpy as np
import torch

from diffusers.configuration_utils import ConfigMixin, register_to_config
from diffusers.utils import BaseOutput
from diffusers.utils.torch_utils import randn_tensor
from diffusers.schedulers.scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin


@dataclass
class DDPMSchedulerOutput(BaseOutput):
    """
    Output class for the scheduler's `step` function output.

    Args:
        prev_sample (`torch.Tensor` of shape `(batch_size, num_channels, height, width)` for images):
            Computed sample `(x_{t-1})` of previous timestep. `prev_sample` should be used as next model input in the
            denoising loop.
        pred_original_sample (`torch.Tensor` of shape `(batch_size, num_channels, height, width)` for images):
            The predicted denoised sample `(x_{0})` based on the model output from the current timestep.
            `pred_original_sample` can be used to preview progress or for guidance.
    """

    prev_sample: torch.Tensor
    pred_original_sample: Optional[torch.Tensor] = None


def betas_for_alpha_bar(
    num_diffusion_timesteps,
    max_beta=0.999,
    alpha_transform_type="cosine",
):
    """
    Create a beta schedule that discretizes the given alpha_t_bar function, which defines the cumulative product of
    (1-beta) over time from t = [0,1].

    Contains a function alpha_bar that takes an argument t and transforms it to the cumulative product of (1-beta) up
    to that part of the diffusion process.


    Args:
        num_diffusion_timesteps (`int`): the number of betas to produce.
        max_beta (`float`): the maximum beta to use; use values lower than 1 to
                     prevent singularities.
        alpha_transform_type (`str`, *optional*, default to `cosine`): the type of noise schedule for alpha_bar.
                     Choose from `cosine` or `exp`

    Returns:
        betas (`np.ndarray`): the betas used by the scheduler to step the model outputs
    """
    if alpha_transform_type == "cosine":

        def alpha_bar_fn(t):
            return math.cos((t + 0.008) / 1.008 * math.pi / 2) ** 2
            # return math.cos(t * math.pi / 2 * 0.95) ** 2

    elif alpha_transform_type == "exp":

        def alpha_bar_fn(t):
            return math.exp(t * -12.0)

    elif alpha_transform_type == "cauchy":
        # µ + γ tan (π (0.5 - x))  γ = 1, µ = 3
        # alpha^2 = 1-1/(exp(λ)+1)
        def alpha_bar_fn(t, gamma=1, mu=3):
            snr = mu + gamma * math.tan(math.pi * (0.5 - t) * 0.9)
            return 1 - 1 / (math.exp(snr) + 1.1)

    elif alpha_transform_type == "laplace":
        # µ − bsgn(0.5 − t) log(1 − 2|t − 0.5|) µ = 0, b = 1
        def alpha_bar_fn(t, mu=0, b=1):
            snr = mu - b * math.copysign(1, 0.5 - t) * math.log(1 - 2 * abs(t - 0.5) * 0.98)
            return 1 - 1 / (math.exp(snr) + 1.02)

    else:
        raise ValueError(f"Unsupported alpha_transform_type: {alpha_transform_type}")

    betas = []
    for i in range(num_diffusion_timesteps):
        t1 = i / num_diffusion_timesteps
        t2 = (i + 1) / num_diffusion_timesteps
        betas.append(min(1 - alpha_bar_fn(t2) / alpha_bar_fn(t1), max_beta))
    return torch.tensor(betas, dtype=torch.float32)


# Copied from diffusers.schedulers.scheduling_ddim.rescale_zero_terminal_snr
def rescale_zero_terminal_snr(betas):
    """
    Rescales betas to have zero terminal SNR Based on https://arxiv.org/pdf/2305.08891.pdf (Algorithm 1)


    Args:
        betas (`torch.Tensor`):
            the betas that the scheduler is being initialized with.

    Returns:
        `torch.Tensor`: rescaled betas with zero terminal SNR
    """
    # Convert betas to alphas_bar_sqrt
    alphas = 1.0 - betas
    alphas_cumprod = torch.cumprod(alphas, dim=0)
    alphas_bar_sqrt = alphas_cumprod.sqrt()

    # Store old values.
    alphas_bar_sqrt_0 = alphas_bar_sqrt[0].clone()
    alphas_bar_sqrt_T = alphas_bar_sqrt[-1].clone()

    # Shift so the last timestep is zero.
    alphas_bar_sqrt -= alphas_bar_sqrt_T

    # Scale so the first timestep is back to the old value.
    alphas_bar_sqrt *= alphas_bar_sqrt_0 / (alphas_bar_sqrt_0 - alphas_bar_sqrt_T)

    # Convert alphas_bar_sqrt to betas
    alphas_bar = alphas_bar_sqrt**2  # Revert sqrt
    alphas = alphas_bar[1:] / alphas_bar[:-1]  # Revert cumprod
    alphas = torch.cat([alphas_bar[0:1], alphas])
    betas = 1 - alphas

    return betas


class DDPMScheduler(SchedulerMixin, ConfigMixin):
    """
    `DDPMScheduler` explores the connections between denoising score matching and Langevin dynamics sampling.

    This model inherits from [`SchedulerMixin`] and [`ConfigMixin`]. Check the superclass documentation for the generic
    methods the library implements for all schedulers such as loading and saving.

    Args:
        num_train_timesteps (`int`, defaults to 1000):
            The number of diffusion steps to train the model.
        beta_start (`float`, defaults to 0.0001):
            The starting `beta` value of inference.
        beta_end (`float`, defaults to 0.02):
            The final `beta` value.
        beta_schedule (`str`, defaults to `"linear"`):
            The beta schedule, a mapping from a beta range to a sequence of betas for stepping the model. Choose from
            `linear`, `scaled_linear`, or `squaredcos_cap_v2`.
        trained_betas (`np.ndarray`, *optional*):
            An array of betas to pass directly to the constructor without using `beta_start` and `beta_end`.
        variance_type (`str`, defaults to `"fixed_small"`):
            Clip the variance when adding noise to the denoised sample. Choose from `fixed_small`, `fixed_small_log`,
            `fixed_large`, `fixed_large_log`, `learned` or `learned_range`.
        clip_sample (`bool`, defaults to `True`):
            Clip the predicted sample for numerical stability.
        clip_sample_range (`float`, defaults to 1.0):
            The maximum magnitude for sample clipping. Valid only when `clip_sample=True`.
        prediction_type (`str`, defaults to `epsilon`, *optional*):
            Prediction type of the scheduler function; can be `epsilon` (predicts the noise of the diffusion process),
            `sample` (directly predicts the noisy sample`) or `v_prediction` (see section 2.4 of [Imagen
            Video](https://imagen.research.google/video/paper.pdf) paper).
        thresholding (`bool`, defaults to `False`):
            Whether to use the "dynamic thresholding" method. This is unsuitable for latent-space diffusion models such
            as Stable Diffusion.
        dynamic_thresholding_ratio (`float`, defaults to 0.995):
            The ratio for the dynamic thresholding method. Valid only when `thresholding=True`.
        sample_max_value (`float`, defaults to 1.0):
            The threshold value for dynamic thresholding. Valid only when `thresholding=True`.
        timestep_spacing (`str`, defaults to `"leading"`):
            The way the timesteps should be scaled. Refer to Table 2 of the [Common Diffusion Noise Schedules and
            Sample Steps are Flawed](https://huggingface.co/papers/2305.08891) for more information.
        steps_offset (`int`, defaults to 0):
            An offset added to the inference steps, as required by some model families.
        rescale_betas_zero_snr (`bool`, defaults to `False`):
            Whether to rescale the betas to have zero terminal SNR. This enables the model to generate very bright and
            dark samples instead of limiting it to samples with medium brightness. Loosely related to
            [`--offset_noise`](https://github.com/huggingface/diffusers/blob/74fd735eb073eb1d774b1ab4154a0876eb82f055/examples/dreambooth/train_dreambooth.py#L506).
    """

    _compatibles = [e.name for e in KarrasDiffusionSchedulers]
    order = 1

    @register_to_config
    def __init__(
        self,
        num_train_timesteps: int = 1000,
        beta_start: float = 0.0001,
        beta_end: float = 0.02,
        beta_schedule: str = "linear",
        trained_betas: Optional[Union[np.ndarray, List[float]]] = None,
        variance_type: str = "fixed_large",
        clip_sample: bool = False,
        prediction_type: str = "epsilon",
        thresholding: bool = False,
        dynamic_thresholding_ratio: float = 0.995,
        clip_sample_range: float = 1.0,
        sample_max_value: float = 1.0,
        timestep_spacing: str = "leading",
        steps_offset: int = 0,
        rescale_betas_zero_snr: int = False,
    ):
        if trained_betas is not None:
            self.betas = torch.tensor(trained_betas, dtype=torch.float32)
        elif beta_schedule == "linear":
            self.betas = torch.linspace(beta_start, beta_end, num_train_timesteps, dtype=torch.float32)
        elif beta_schedule == "scaled_linear":
            # this schedule is very specific to the latent diffusion model.
            self.betas = torch.linspace(beta_start**0.5, beta_end**0.5, num_train_timesteps, dtype=torch.float32) ** 2
        elif beta_schedule == "squaredcos_cap_v2" or beta_schedule == "cosine":
            # Glide cosine schedule
            self.betas = betas_for_alpha_bar(num_train_timesteps, alpha_transform_type="cosine")
        elif beta_schedule == "cauchy":
            self.betas = betas_for_alpha_bar(num_train_timesteps, alpha_transform_type="cauchy")
        elif beta_schedule == "laplace":
            self.betas = betas_for_alpha_bar(num_train_timesteps, alpha_transform_type="laplace")
        elif beta_schedule == "sigmoid":
            # GeoDiff sigmoid schedule
            betas = torch.linspace(-6, 6, num_train_timesteps)
            self.betas = torch.sigmoid(betas) * (beta_end - beta_start) + beta_start
        else:
            raise NotImplementedError(f"{beta_schedule} is not implemented for {self.__class__}")

        # Rescale for zero SNR
        if rescale_betas_zero_snr:
            self.betas = rescale_zero_terminal_snr(self.betas)

        self.alphas = 1.0 - self.betas
        self.alphas_cumprod = torch.cumprod(self.alphas, dim=0)
        self.one = torch.tensor(1.0)

        # standard deviation of the initial noise distribution
        self.init_noise_sigma = 1.0

        # setable values
        self.custom_timesteps = False
        self.num_inference_steps = None
        self.timesteps = torch.from_numpy(np.arange(0, num_train_timesteps)[::-1].copy())

        self.variance_type = variance_type

    def scale_model_input(self, sample: torch.Tensor, timestep: Optional[int] = None) -> torch.Tensor:
        """
        Ensures interchangeability with schedulers that need to scale the denoising model input depending on the
        current timestep.

        Args:
            sample (`torch.Tensor`):
                The input sample.
            timestep (`int`, *optional*):
                The current timestep in the diffusion chain.

        Returns:
            `torch.Tensor`:
                A scaled input sample.
        """
        return sample

    def set_timesteps(
        self,
        num_inference_steps: Optional[int] = None,
        device: Union[str, torch.device] = None,
        timesteps: Optional[List[int]] = None,
    ):
        """
        Sets the discrete timesteps used for the diffusion chain (to be run before inference).

        Args:
            num_inference_steps (`int`):
                The number of diffusion steps used when generating samples with a pre-trained model. If used,
                `timesteps` must be `None`.
            device (`str` or `torch.device`, *optional*):
                The device to which the timesteps should be moved to. If `None`, the timesteps are not moved.
            timesteps (`List[int]`, *optional*):
                Custom timesteps used to support arbitrary spacing between timesteps. If `None`, then the default
                timestep spacing strategy of equal spacing between timesteps is used. If `timesteps` is passed,
                `num_inference_steps` must be `None`.

        """
        if num_inference_steps is not None and timesteps is not None:
            raise ValueError("Can only pass one of `num_inference_steps` or `custom_timesteps`.")

        if timesteps is not None:
            for i in range(1, len(timesteps)):
                if timesteps[i] >= timesteps[i - 1]:
                    raise ValueError("`custom_timesteps` must be in descending order.")

            if timesteps[0] >= self.config.num_train_timesteps:
                raise ValueError(
                    f"`timesteps` must start before `self.config.train_timesteps`:"
                    f" {self.config.num_train_timesteps}."
                )

            timesteps = np.array(timesteps, dtype=np.int64)
            self.custom_timesteps = True
        else:
            if num_inference_steps > self.config.num_train_timesteps:
                raise ValueError(
                    f"`num_inference_steps`: {num_inference_steps} cannot be larger than `self.config.train_timesteps`:"
                    f" {self.config.num_train_timesteps} as the unet model trained with this scheduler can only handle"
                    f" maximal {self.config.num_train_timesteps} timesteps."
                )

            self.num_inference_steps = num_inference_steps
            self.custom_timesteps = False

            # "linspace", "leading", "trailing" corresponds to annotation of Table 2. of https://arxiv.org/abs/2305.08891
            if self.config.timestep_spacing == "linspace":
                timesteps = (
                    np.linspace(0, self.config.num_train_timesteps - 1, num_inference_steps)
                    .round()[::-1]
                    .copy()
                    .astype(np.int64)
                )
            elif self.config.timestep_spacing == "leading":
                step_ratio = self.config.num_train_timesteps // self.num_inference_steps
                # creates integer timesteps by multiplying by ratio
                # casting to int to avoid issues when num_inference_step is power of 3
                timesteps = (np.arange(0, num_inference_steps) * step_ratio).round()[::-1].copy().astype(np.int64)
                timesteps += self.config.steps_offset
            elif self.config.timestep_spacing == "trailing":
                step_ratio = self.config.num_train_timesteps / self.num_inference_steps
                # creates integer timesteps by multiplying by ratio
                # casting to int to avoid issues when num_inference_step is power of 3
                timesteps = np.round(np.arange(self.config.num_train_timesteps, 0, -step_ratio)).astype(np.int64)
                timesteps -= 1
            else:
                raise ValueError(
                    f"{self.config.timestep_spacing} is not supported. Please make sure to choose one of 'linspace', 'leading' or 'trailing'."
                )

        self.timesteps = torch.from_numpy(timesteps).to(device)

    def _get_variance(self, t, predicted_variance=None, variance_type=None):
        prev_t = self.previous_timestep(t)

        alpha_prod_t = self.alphas_cumprod[t]
        alpha_prod_t_prev = self.alphas_cumprod[prev_t] if prev_t >= 0 else self.one
        current_beta_t = 1 - alpha_prod_t / alpha_prod_t_prev

        # For t > 0, compute predicted variance βt (see formula (6) and (7) from https://arxiv.org/pdf/2006.11239.pdf)
        # and sample from it to get previous sample
        # x_{t-1} ~ N(pred_prev_sample, variance) == add variance to pred_sample
        variance = (1 - alpha_prod_t_prev) / (1 - alpha_prod_t) * current_beta_t

        # we always take the log of variance, so clamp it to ensure it's not 0
        variance = torch.clamp(variance, min=1e-20)

        if variance_type is None:
            variance_type = self.config.variance_type

        # hacks - were probably added for training stability
        if variance_type == "fixed_small":
            variance = variance
        # for rl-diffuser https://arxiv.org/abs/2205.09991
        elif variance_type == "fixed_small_log":
            variance = torch.log(variance)
            variance = torch.exp(0.5 * variance)
        elif variance_type == "fixed_large":
            variance = current_beta_t
        elif variance_type == "fixed_large_log":
            # Glide max_log
            variance = torch.log(current_beta_t)
        elif variance_type == "learned":
            return predicted_variance
        elif variance_type == "learned_range":
            min_log = torch.log(variance)
            max_log = torch.log(current_beta_t)
            frac = (predicted_variance + 1) / 2
            variance = frac * max_log + (1 - frac) * min_log

        return variance

    def _threshold_sample(self, sample: torch.Tensor) -> torch.Tensor:
        """
        "Dynamic thresholding: At each sampling step we set s to a certain percentile absolute pixel value in xt0 (the
        prediction of x_0 at timestep t), and if s > 1, then we threshold xt0 to the range [-s, s] and then divide by
        s. Dynamic thresholding pushes saturated pixels (those near -1 and 1) inwards, thereby actively preventing
        pixels from saturation at each step. We find that dynamic thresholding results in significantly better
        photorealism as well as better image-text alignment, especially when using very large guidance weights."

        https://arxiv.org/abs/2205.11487
        """
        dtype = sample.dtype
        batch_size, channels, *remaining_dims = sample.shape

        if dtype not in (torch.float32, torch.float64):
            sample = sample.float()  # upcast for quantile calculation, and clamp not implemented for cpu half

        # Flatten sample for doing quantile calculation along each image
        sample = sample.reshape(batch_size, channels * np.prod(remaining_dims))

        abs_sample = sample.abs()  # "a certain percentile absolute pixel value"

        s = torch.quantile(abs_sample, self.config.dynamic_thresholding_ratio, dim=1)
        s = torch.clamp(
            s, min=1, max=self.config.sample_max_value
        )  # When clamped to min=1, equivalent to standard clipping to [-1, 1]
        s = s.unsqueeze(1)  # (batch_size, 1) because clamp will broadcast along dim=0
        sample = torch.clamp(sample, -s, s) / s  # "we threshold xt0 to the range [-s, s] and then divide by s"

        sample = sample.reshape(batch_size, channels, *remaining_dims)
        sample = sample.to(dtype)

        return sample

    def step(
        self,
        model_output: torch.Tensor,
        timestep: int,
        sample: torch.Tensor,
        generator=None,
        return_dict: bool = True,
    ) -> Union[DDPMSchedulerOutput, Tuple]:
        """
        Predict the sample from the previous timestep by reversing the SDE. This function propagates the diffusion
        process from the learned model outputs (most often the predicted noise).

        Args:
            model_output (`torch.Tensor`):
                The direct output from learned diffusion model.
            timestep (`float`):
                The current discrete timestep in the diffusion chain.
            sample (`torch.Tensor`):
                A current instance of a sample created by the diffusion process.
            generator (`torch.Generator`, *optional*):
                A random number generator.
            return_dict (`bool`, *optional*, defaults to `True`):
                Whether or not to return a [`~schedulers.scheduling_ddpm.DDPMSchedulerOutput`] or `tuple`.

        Returns:
            [`~schedulers.scheduling_ddpm.DDPMSchedulerOutput`] or `tuple`:
                If return_dict is `True`, [`~schedulers.scheduling_ddpm.DDPMSchedulerOutput`] is returned, otherwise a
                tuple is returned where the first element is the sample tensor.

        """
        t = timestep

        prev_t = self.previous_timestep(t)

        if model_output.shape[1] == sample.shape[1] * 2 and self.variance_type in ["learned", "learned_range"]:
            model_output, predicted_variance = torch.split(model_output, sample.shape[1], dim=1)
        else:
            predicted_variance = None

        # 1. compute alphas, betas
        alpha_prod_t = self.alphas_cumprod[t]
        alpha_prod_t_prev = self.alphas_cumprod[prev_t] if prev_t >= 0 else self.one
        beta_prod_t = 1 - alpha_prod_t
        beta_prod_t_prev = 1 - alpha_prod_t_prev
        current_alpha_t = alpha_prod_t / alpha_prod_t_prev
        current_beta_t = 1 - current_alpha_t

        # 2. compute predicted original sample from predicted noise also called
        # "predicted x_0" of formula (15) from https://arxiv.org/pdf/2006.11239.pdf
        if self.config.prediction_type == "epsilon":
            pred_original_sample = (sample - beta_prod_t ** (0.5) * model_output) / alpha_prod_t ** (0.5)
        elif self.config.prediction_type == "sample":
            pred_original_sample = model_output
        elif self.config.prediction_type == "v_prediction":
            pred_original_sample = (alpha_prod_t**0.5) * sample - (beta_prod_t**0.5) * model_output
        else:
            raise ValueError(
                f"prediction_type given as {self.config.prediction_type} must be one of `epsilon`, `sample` or"
                " `v_prediction`  for the DDPMScheduler."
            )

        # 3. Clip or threshold "predicted x_0"
        if self.config.thresholding:
            pred_original_sample = self._threshold_sample(pred_original_sample)
        elif self.config.clip_sample:
            pred_original_sample = pred_original_sample.clamp(
                -self.config.clip_sample_range, self.config.clip_sample_range
            )

        # 4. Compute coefficients for pred_original_sample x_0 and current sample x_t
        # See formula (7) from https://arxiv.org/pdf/2006.11239.pdf
        pred_original_sample_coeff = (alpha_prod_t_prev ** (0.5) * current_beta_t) / beta_prod_t
        current_sample_coeff = current_alpha_t ** (0.5) * beta_prod_t_prev / beta_prod_t

        # 5. Compute predicted previous sample µ_t
        # See formula (7) from https://arxiv.org/pdf/2006.11239.pdf
        pred_prev_sample = pred_original_sample_coeff * pred_original_sample + current_sample_coeff * sample

        # 6. Add noise
        variance = 0
        if t > 0:
            device = model_output.device
            variance_noise = randn_tensor(
                model_output.shape, generator=generator, device=device, dtype=model_output.dtype
            )
            if self.variance_type == "fixed_small_log":
                variance = self._get_variance(t, predicted_variance=predicted_variance) * variance_noise
            elif self.variance_type == "learned_range":
                variance = self._get_variance(t, predicted_variance=predicted_variance)
                variance = torch.exp(0.5 * variance) * variance_noise
            else:
                variance = (self._get_variance(t, predicted_variance=predicted_variance) ** 0.5) * variance_noise

        pred_prev_sample = pred_prev_sample + variance

        if not return_dict:
            return (pred_prev_sample,)

        return DDPMSchedulerOutput(prev_sample=pred_prev_sample, pred_original_sample=pred_original_sample)

    def add_noise(
        self,
        original_samples: torch.Tensor,
        noise: torch.Tensor,
        timesteps: torch.IntTensor,
    ) -> torch.Tensor:
        # Make sure alphas_cumprod and timestep have same device and dtype as original_samples
        # Move the self.alphas_cumprod to device to avoid redundant CPU to GPU data movement
        # for the subsequent add_noise calls
        self.alphas_cumprod = self.alphas_cumprod.to(device=original_samples.device)
        alphas_cumprod = self.alphas_cumprod.to(dtype=original_samples.dtype)
        timesteps = timesteps.to(original_samples.device)

        sqrt_alpha_prod = alphas_cumprod[timesteps] ** 0.5
        sqrt_alpha_prod = sqrt_alpha_prod.flatten()
        while len(sqrt_alpha_prod.shape) < len(original_samples.shape):
            sqrt_alpha_prod = sqrt_alpha_prod.unsqueeze(-1)

        sqrt_one_minus_alpha_prod = (1 - alphas_cumprod[timesteps]) ** 0.5
        sqrt_one_minus_alpha_prod = sqrt_one_minus_alpha_prod.flatten()
        while len(sqrt_one_minus_alpha_prod.shape) < len(original_samples.shape):
            sqrt_one_minus_alpha_prod = sqrt_one_minus_alpha_prod.unsqueeze(-1)

        noisy_samples = sqrt_alpha_prod * original_samples + sqrt_one_minus_alpha_prod * noise
        return noisy_samples

    def get_velocity(self, sample: torch.Tensor, noise: torch.Tensor, timesteps: torch.IntTensor) -> torch.Tensor:
        # Make sure alphas_cumprod and timestep have same device and dtype as sample
        self.alphas_cumprod = self.alphas_cumprod.to(device=sample.device)
        alphas_cumprod = self.alphas_cumprod.to(dtype=sample.dtype)
        timesteps = timesteps.to(sample.device)

        sqrt_alpha_prod = alphas_cumprod[timesteps] ** 0.5
        sqrt_alpha_prod = sqrt_alpha_prod.flatten()
        while len(sqrt_alpha_prod.shape) < len(sample.shape):
            sqrt_alpha_prod = sqrt_alpha_prod.unsqueeze(-1)

        sqrt_one_minus_alpha_prod = (1 - alphas_cumprod[timesteps]) ** 0.5
        sqrt_one_minus_alpha_prod = sqrt_one_minus_alpha_prod.flatten()
        while len(sqrt_one_minus_alpha_prod.shape) < len(sample.shape):
            sqrt_one_minus_alpha_prod = sqrt_one_minus_alpha_prod.unsqueeze(-1)

        velocity = sqrt_alpha_prod * noise - sqrt_one_minus_alpha_prod * sample
        return velocity

    def __len__(self):
        return self.config.num_train_timesteps

    def previous_timestep(self, timestep):
        if self.custom_timesteps:
            index = (self.timesteps == timestep).nonzero(as_tuple=True)[0][0]
            if index == self.timesteps.shape[0] - 1:
                prev_t = torch.tensor(-1)
            else:
                prev_t = self.timesteps[index + 1]
        else:
            num_inference_steps = (
                self.num_inference_steps if self.num_inference_steps else self.config.num_train_timesteps
            )
            prev_t = timestep - self.config.num_train_timesteps // num_inference_steps

        return prev_t


================================================
FILE: LatentLM/schedule/dpm_solver.py
================================================
# Copyright 2024 TSAIL Team and The HuggingFace Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# DISCLAIMER: This file is strongly influenced by https://github.com/LuChengTHU/dpm-solver

import math
from typing import List, Optional, Tuple, Union

import numpy as np
import torch

from diffusers.configuration_utils import ConfigMixin, register_to_config
from diffusers.utils import deprecate
from diffusers.utils.torch_utils import randn_tensor
from diffusers.schedulers.scheduling_utils import KarrasDiffusionSchedulers, SchedulerMixin, SchedulerOutput

from .ddpm import betas_for_alpha_bar, rescale_zero_terminal_snr


class DPMSolverMultistepScheduler(SchedulerMixin, ConfigMixin):
    """
    `DPMSolverMultistepScheduler` is a fast dedicated high-order solver for diffusion ODEs.

    This model inherits from [`SchedulerMixin`] and [`ConfigMixin`]. Check the superclass documentation for the generic
    methods the library implements for all schedulers such as loading and saving.

    Args:
        num_train_timesteps (`int`, defaults to 1000):
            The number of diffusion steps to train the model.
        beta_start (`float`, defaults to 0.0001):
            The starting `beta` value of inference.
        beta_end (`float`, defaults to 0.02):
            The final `beta` value.
        beta_schedule (`str`, defaults to `"linear"`):
            The beta schedule, a mapping from a beta range to a sequence of betas for stepping the model. Choose from
            `linear`, `scaled_linear`, or `squaredcos_cap_v2`.
        trained_betas (`np.ndarray`, *optional*):
            Pass an array of betas directly to the constructor to bypass `beta_start` and `beta_end`.
        solver_order (`int`, defaults to 2):
            The DPMSolver order which can be `1` or `2` or `3`. It is recommended to use `solver_order=2` for guided
            sampling, and `solver_order=3` for unconditional sampling.
        prediction_type (`str`, defaults to `epsilon`, *optional*):
            Prediction type of the scheduler function; can be `epsilon` (predicts the noise of the diffusion process),
            `sample` (directly predicts the noisy sample`) or `v_prediction` (see section 2.4 of [Imagen
            Video](https://imagen.research.google/video/paper.pdf) p
Download .txt
Showing preview only (270K chars total). Download the full file or copy to clipboard to get everything.
gitextract_cuit3xwy/

├── .github/
│   └── ISSUE_TEMPLATE/
│       ├── bug_report.md
│       └── custom.md
├── .gitignore
├── .gitmodules
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Diff-Transformer/
│   ├── Diff-Transformer-V2/
│   │   ├── README.md
│   │   └── multihead_flashdiffv2.py
│   ├── README.md
│   ├── example.py
│   ├── kernel/
│   │   └── rotary.py
│   ├── multihead_attention.py
│   ├── multihead_diffattn.py
│   ├── multihead_flashdiff_1.py
│   ├── multihead_flashdiff_2.py
│   └── rms_norm.py
├── LICENSE
├── LatentLM/
│   ├── README.md
│   ├── evaluate_fid.py
│   ├── evaluate_fid_fidelity.py
│   ├── inference_speed.py
│   ├── metrics/
│   │   ├── IS.py
│   │   ├── __init__.py
│   │   ├── fid.py
│   │   └── inception.py
│   ├── models/
│   │   ├── DiT.py
│   │   ├── EMA.py
│   │   ├── RMSNorm.py
│   │   ├── Transformer.py
│   │   ├── __init__.py
│   │   └── kernel/
│   │       ├── rotary.py
│   │       └── swiglu.py
│   ├── sample_hf.py
│   ├── sample_many.py
│   ├── schedule/
│   │   ├── __init__.py
│   │   ├── ddpm.py
│   │   └── dpm_solver.py
│   ├── tokenizer_models/
│   │   ├── __init__.py
│   │   ├── modeling_beit3_vision.py
│   │   ├── modeling_common.py
│   │   ├── modeling_sigma_vae.py
│   │   ├── modeling_utils.py
│   │   └── vae.py
│   ├── train_hf.py
│   └── utils.py
├── NOTICE.md
├── PFPO/
│   ├── README.md
│   ├── apps_train_sub_val_ids.json
│   ├── conf/
│   │   ├── api/
│   │   │   └── vllm/
│   │   │       ├── apps/
│   │   │       │   ├── deepseek_coder/
│   │   │       │   │   ├── dev_v1_0.yaml
│   │   │       │   │   ├── dev_v1_0_fix_bos.yaml
│   │   │       │   │   ├── dev_v1_1.yaml
│   │   │       │   │   ├── dev_v1_1_sample.yaml
│   │   │       │   │   ├── dev_v2_0.yaml
│   │   │       │   │   ├── r2c/
│   │   │       │   │   │   ├── dev_v1_0.yaml
│   │   │       │   │   │   ├── dev_v1_1.yaml
│   │   │       │   │   │   ├── dev_v1_1_sample.yaml
│   │   │       │   │   │   ├── dev_v2_0.yaml
│   │   │       │   │   │   ├── dev_v2_0_sample.yaml
│   │   │       │   │   │   ├── general_combine_train_v2_0.yaml
│   │   │       │   │   │   ├── general_combine_train_v2_0_prefix_completion.yaml
│   │   │       │   │   │   ├── general_combine_train_v2_1_4o_non_sc.yaml
│   │   │       │   │   │   ├── sub_dev_v1_1.yaml
│   │   │       │   │   │   ├── sub_dev_v2_0.yaml
│   │   │       │   │   │   ├── train_v1_0.yaml
│   │   │       │   │   │   ├── train_v1_0_s43.yaml
│   │   │       │   │   │   ├── train_v2_0.yaml
│   │   │       │   │   │   ├── train_v2_0_prefix_completion.yaml
│   │   │       │   │   │   └── xcode_train_v2_0.yaml
│   │   │       │   │   ├── sub_dev_v1_1.yaml
│   │   │       │   │   ├── sub_dev_v2_0.yaml
│   │   │       │   │   ├── test_inputs_gen/
│   │   │       │   │   │   ├── sub_dev_v1_0.yaml
│   │   │       │   │   │   └── test_v1_0.yaml
│   │   │       │   │   ├── train_v1_0.yaml
│   │   │       │   │   └── train_v2_0.yaml
│   │   │       │   └── general_eval/
│   │   │       │       ├── dev_v2_0.yaml
│   │   │       │       ├── dev_v2_1.yaml
│   │   │       │       └── dev_v2_2.yaml
│   │   │       ├── human_eval/
│   │   │       │   ├── ds_coder/
│   │   │       │   │   ├── r2c/
│   │   │       │   │   │   ├── test_v1_0.yaml
│   │   │       │   │   │   ├── test_v1_0_local.yaml
│   │   │       │   │   │   ├── test_v2_0_local.yaml
│   │   │       │   │   │   ├── test_v2_1_local.yaml
│   │   │       │   │   │   └── test_v2_2_local.yaml
│   │   │       │   │   ├── test_v1_0_local.yaml
│   │   │       │   │   └── test_v2_0.yaml
│   │   │       │   ├── test_v2_1.yaml
│   │   │       │   └── test_v2_2.yaml
│   │   │       ├── magicoder/
│   │   │       │   ├── llama3/
│   │   │       │   │   └── test_case_input_gen_v1_0.yaml
│   │   │       │   └── mistral/
│   │   │       │       ├── func_head_extract_v1_0.yaml
│   │   │       │       └── test_case_input_gen_v1_0.yaml
│   │   │       ├── mathscale/
│   │   │       │   ├── 4o_mathstral_train_0shot_v1_0.yaml
│   │   │       │   ├── 4o_mathstral_train_0shot_v1_0_completion.yaml
│   │   │       │   ├── 4o_mathstral_train_0shot_v1_1.yaml
│   │   │       │   ├── 4o_mathstral_train_0shot_v1_1_completion.yaml
│   │   │       │   ├── 4o_mathstral_train_half_0shot_v1_0.yaml
│   │   │       │   ├── 4o_mathstral_train_half_0shot_v1_0_completion.yaml
│   │   │       │   ├── mathstral/
│   │   │       │   │   ├── deepseek_test_0shot_tem_v1_1.yaml
│   │   │       │   │   ├── mistral_mathscale4o_labeling.yaml
│   │   │       │   │   ├── mistral_train_0shot_iter0_v1_0.yaml
│   │   │       │   │   ├── test_0shot_tem_v1_1.yaml
│   │   │       │   │   ├── test_0shot_tem_v1_1_step.yaml
│   │   │       │   │   ├── test_0shot_tem_v1_1_step_seed.yaml
│   │   │       │   │   ├── test_0shot_tem_v2_0_step.yaml
│   │   │       │   │   └── test_0shot_tem_v3_0_step.yaml
│   │   │       │   ├── mistral_train_0shot_v1_0.yaml
│   │   │       │   ├── mistral_train_0shot_v1_1.yaml
│   │   │       │   ├── mistral_train_0shot_v1_2.yaml
│   │   │       │   ├── numina_hard_train_0shot_v1_0_completion.yaml
│   │   │       │   ├── numina_hard_train_0shot_v1_0_seed.yaml
│   │   │       │   ├── numina_rewrite_qwen25_0shot_v1_0.yaml
│   │   │       │   ├── numina_train_0shot_v1_0.yaml
│   │   │       │   ├── numina_train_0shot_v1_0_completion.yaml
│   │   │       │   ├── test_0shot_tem_v1_1.yaml
│   │   │       │   └── test_0shot_tem_v1_1_step.yaml
│   │   │       ├── mbpp_sanitized/
│   │   │       │   ├── r2c/
│   │   │       │   │   ├── test_3shot_v2_0.yaml
│   │   │       │   │   ├── test_v1_0.yaml
│   │   │       │   │   └── test_v1_0_local.yaml
│   │   │       │   ├── test_3shot_v1_0.yaml
│   │   │       │   ├── test_3shot_v1_0_local.yaml
│   │   │       │   ├── test_v1_0_local.yaml
│   │   │       │   ├── test_v1_1_local.yaml
│   │   │       │   ├── test_v2_0_local.yaml
│   │   │       │   ├── test_v2_1_local.yaml
│   │   │       │   └── test_v2_2_local.yaml
│   │   │       ├── mwp-bench/
│   │   │       │   ├── deepseek_test_0shot_v1_1.yaml
│   │   │       │   ├── llama_base/
│   │   │       │   │   └── college_math_test_4shot_v1_0.yaml
│   │   │       │   ├── llama_chat/
│   │   │       │   │   ├── dev_0shot_v1_0.yaml
│   │   │       │   │   ├── math_test_0shot_v1_0.yaml
│   │   │       │   │   ├── math_test_0shot_v3_0.yaml
│   │   │       │   │   └── test_0shot_v1_0.yaml
│   │   │       │   ├── mathstral_dev_0shot_self_correct_v1_0.yaml
│   │   │       │   ├── mathstral_dev_0shot_v1_0.yaml
│   │   │       │   ├── mathstral_test_0shot_self_correct_v1_0.yaml
│   │   │       │   ├── mathstral_test_0shot_v1_0.yaml
│   │   │       │   ├── mathstral_test_gaokao_2023_0shot_v1_0.yaml
│   │   │       │   ├── mathstral_test_gsm8k_0shot_v1_0.yaml
│   │   │       │   ├── mistral/
│   │   │       │   │   ├── dev_0shot_v1_0.yaml
│   │   │       │   │   └── test_0shot_v1_0.yaml
│   │   │       │   └── mistral_dev_0shot_v1_0.yaml
│   │   │       └── vllm_params/
│   │   │           ├── sampling_param_greedy.yaml
│   │   │           └── sampling_param_sample.yaml
│   │   ├── deepspeed/
│   │   │   ├── fp16.yaml
│   │   │   ├── train_hybrid_engine_zero0.yaml
│   │   │   ├── train_hybrid_engine_zero1.yaml
│   │   │   ├── train_hybrid_engine_zero1_cosine.yaml
│   │   │   ├── train_hybrid_engine_zero1_lr.yaml
│   │   │   ├── train_hybrid_engine_zero1_optim_offload.yaml
│   │   │   ├── train_hybrid_engine_zero1_optim_offload_cosine.yaml
│   │   │   ├── train_hybrid_engine_zero1_optim_offload_lr.yaml
│   │   │   ├── train_hybrid_engine_zero1_wo_optim.yaml
│   │   │   ├── train_hybrid_engine_zero2.yaml
│   │   │   ├── train_hybrid_engine_zero2_cosine.yaml
│   │   │   ├── train_hybrid_engine_zero2_lr.yaml
│   │   │   ├── train_hybrid_engine_zero2_optim_offload.yaml
│   │   │   ├── train_hybrid_engine_zero2_optim_offload_cosine.yaml
│   │   │   ├── train_hybrid_engine_zero3.yaml
│   │   │   ├── train_hybrid_engine_zero3_cosine.yaml
│   │   │   ├── train_hybrid_engine_zero3_optim_offload.yaml
│   │   │   └── train_hybrid_engine_zero3_optim_offload_cosine.yaml
│   │   ├── exp/
│   │   │   ├── apps/
│   │   │   │   ├── code_gen/
│   │   │   │   │   └── deepseek_coder/
│   │   │   │   │       ├── dpo/
│   │   │   │   │       │   ├── orig-pseudo-v1.0-a100.yaml
│   │   │   │   │       │   ├── orig-v1.0-v100.yaml
│   │   │   │   │       │   ├── orig-v1.1-v100-tp2.yaml
│   │   │   │   │       │   ├── orig-v1.1-v100-tp4.yaml
│   │   │   │   │       │   ├── orig-v1.1-v100.yaml
│   │   │   │   │       │   ├── orig-v1.2-v100-tp4.yaml
│   │   │   │   │       │   ├── orig-v1.3-a100.yaml
│   │   │   │   │       │   ├── orig-v1.3-v100-tp4.yaml
│   │   │   │   │       │   ├── orig-v1.4-a100.yaml
│   │   │   │   │       │   ├── orig-v1.4-v100-tp4.yaml
│   │   │   │   │       │   ├── pseudo-sc-dpo-v1.0-v100-tp8.yaml
│   │   │   │   │       │   ├── pseudo-sc-dpo-v1.1-h100.yaml
│   │   │   │   │       │   ├── pseudo-sc-dpo-v1.1-v100-tp8.yaml
│   │   │   │   │       │   ├── pseudo-sc-dpo-v1.2-a100.yaml
│   │   │   │   │       │   └── pseudo-sc-dpo-v1.2-v100-tp8.yaml
│   │   │   │   │       └── sft/
│   │   │   │   │           ├── v1.0-a100.yaml
│   │   │   │   │           └── v1.0-v100.yaml
│   │   │   │   ├── r2c_generation/
│   │   │   │   │   └── deepseek_coder/
│   │   │   │   │       ├── dpo/
│   │   │   │   │       │   ├── deprecated/
│   │   │   │   │       │   │   └── sft-v1.0-v100-tp4.yaml
│   │   │   │   │       │   ├── gpt4o-distil-4o-ps-test-pdpo-h100-v1.0.yaml
│   │   │   │   │       │   ├── gpt4o-distil-4o-ps-test-pdpo-h100-v1.1.yaml
│   │   │   │   │       │   ├── gpt4o-distil-4o-self-mix-ps-test-v1.0-mi300x-dp16.yaml
│   │   │   │   │       │   ├── gpt4o-distil-4o-self-mix-ps-test-v1.0-mi300x.yaml
│   │   │   │   │       │   ├── gpt4o-distil-4o-self-mix-ps-test-v1.1-mi300x.yaml
│   │   │   │   │       │   ├── gpt4o-distil-ps-pdpo-ctr-ts-num-v1.0-mi300x-dp32.yaml
│   │   │   │   │       │   ├── gpt4o-distil-pseudo-v1.0-a100.yaml
│   │   │   │   │       │   ├── gpt4o-distil-self-pseudo-v1.0-a100.yaml
│   │   │   │   │       │   ├── gpt4o-distil-self-pseudo-v1.0-v100.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v1.0-H100-4o-ps-test.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v2.0-v100.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v3.0-a100.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v3.1-rm-a100.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v3.2-v100.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.0-v100-ps-test.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.1-H100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.10-V100-ps-pdpo-rerun.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.2-H100-gd-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.2-v100-gd-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.3-H100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.3-V100-ps-pdpo-rerun.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.3-v100-gd-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.4-H100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.4-V100-ps-pdpo-rerun.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.5-A100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.5-v100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.6-v100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.7-A100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.8-A100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.9-V100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.9.1-V100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.9.2-V100-ps-pdpo.yaml
│   │   │   │   │       │   ├── gpt4o-distil-v4.9.3-A100-ps-pdpo.yaml
│   │   │   │   │       │   ├── iter1/
│   │   │   │   │       │   │   ├── gpt4o-distil-apps-mc-v1.0-mi300x-hybrid.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-apps-mc-v1.1-mi300x-hybrid.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.0-a100-40-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.1-v100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.2-h100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.0-H100-4o-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.0-v100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.1-H100-4o-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.1-a100-40-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.1-v100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.2-H100-4o-ps-test.yaml
│   │   │   │   │       │   │   └── gpt4o-distil-combine-v1.2-a100-40-ps-test.yaml
│   │   │   │   │       │   ├── iter2/
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-dpo-n64sc-v1.0-A100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-dpo-n64sc-v1.1-A100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-dpo-n64sc-v1.2-A100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-dpo-n64sc-v1.2-V100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-dpo-n64sc-v1.3-A100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-dpo-n64sc-v1.4-A100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.0-h100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.1-h100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.1-v100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.2-v100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.3-h100-fix-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.3-v100-fix-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v1.3-v100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v2.0-h100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-pdpo-v2.1-h100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.0-H100-ps-test.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.0-mi300x-hybrid.yaml
│   │   │   │   │       │   │   ├── gpt4o-distil-combine-v1.1-mi300x-hybrid.yaml
│   │   │   │   │       │   │   └── gpt4o-distil-combine-v1.2-mi300x-hybrid.yaml
│   │   │   │   │       │   └── iter3/
│   │   │   │   │       │       ├── gpt4o-distil-combine-pdpo-v1.0-h100-ps-test.yaml
│   │   │   │   │       │       ├── gpt4o-distil-combine-pdpo-v1.1-h100-ps-test.yaml
│   │   │   │   │       │       └── gpt4o-distil-combine-pdpo-v1.2-h100-ps-test.yaml
│   │   │   │   │       └── sft/
│   │   │   │   │           ├── deprecated/
│   │   │   │   │           │   ├── gpt4o-distil-v1.0-v100.yaml
│   │   │   │   │           │   ├── gpt4o-distil-v1.1-v100.yaml
│   │   │   │   │           │   ├── gpt4o-distil-v2.0-v100.yaml
│   │   │   │   │           │   ├── gpt4o-distil-v2.1-v100-tp.yaml
│   │   │   │   │           │   ├── gpt4o-distil-v2.1-v100.yaml
│   │   │   │   │           │   ├── gpt4o-distil-v2.2-v100.yaml
│   │   │   │   │           │   ├── gpt4o-distil-v2.3-v100.yaml
│   │   │   │   │           │   ├── gpt4o-distil-v2.5-v100.yaml
│   │   │   │   │           │   └── gpt4o-distil-v2.6-v100.yaml
│   │   │   │   │           ├── gpt4o-distil-v2.4-a100.yaml
│   │   │   │   │           ├── gpt4o-distil-v2.4-v100-fix-2node-test.yaml
│   │   │   │   │           ├── gpt4o-distil-v2.4-v100-fix.yaml
│   │   │   │   │           ├── gpt4o-distil-v2.4-v100.yaml
│   │   │   │   │           ├── gpt4o-distil-v3.0-a100.yaml
│   │   │   │   │           ├── gpt4o-distil-v3.0-v100.yaml
│   │   │   │   │           ├── gpt4o-distil-v3.1-v100-test.yaml
│   │   │   │   │           └── gpt4o-distil-v3.1-v100.yaml
│   │   │   │   └── test_input_gen/
│   │   │   │       └── deepseek_coder/
│   │   │   │           └── sft/
│   │   │   │               └── v1.0-a100.yaml
│   │   │   └── mathscale/
│   │   │       ├── llama/
│   │   │       │   ├── dpo/
│   │   │       │   │   ├── iter1/
│   │   │       │   │   │   ├── llama3.1-dpo-4o-iter0-v1.0-H100.yaml
│   │   │       │   │   │   ├── llama3.1-dpo-4o-iter0-v1.1-A100-40.yaml
│   │   │       │   │   │   ├── llama3.1-pdpo-4o-iter1-1.0-A100.yaml
│   │   │       │   │   │   └── llama3.1-pdpo-4o-iter1-1.1-v100.yaml
│   │   │       │   │   ├── llama3.1-dpo-4o-iter0-v1.0-v100.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v1.0-v100.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v1.1-H100.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v1.2-V100.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v1.2-a100-40.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v2.0-v100.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v2.1-a100-40.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v2.1-v100.yaml
│   │   │       │   │   ├── llama3.1-pdpo-4o-iter0-v2.2-A100.yaml
│   │   │       │   │   └── numina-co/
│   │   │       │   │       ├── llama3.1-pdpo-iter1-1.0-split01-p0.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-1.0-split01-p0.5-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split0123-cross2-p0.5-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split0123-cross2-p0.5-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split0123-p0.5-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split0123-p0.5-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split23-p0.0-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split23-p0.0-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split23-p0.5-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter1-split23-p0.5-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter2-split01-23-p0.5-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter2-split01-23-p0.5-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter2-split01-23-p0.5-v1.2-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter2-split01-23-p0.5-v1.3-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter2-split01-23-p0.5-v1.4-a100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter2-split01-23-p0.5-v1.4-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter2-split01-23-p0.5-v1.4-v100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter3-split01-23-45-p0.5-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter3-split01-23-45-p0.5-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter3-split01-23-45-p0.5-v1.2-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter3-split01-23-45-p0.5-v1.3-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter3-split01-23-45-p0.5-v1.3-v100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter3-split01-23-45-p0.5-v1.4-a100-dp16.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter3-split01-23-45-p0.5-v1.4-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.2-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.3-v100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.4-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.5-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.6-a100-40.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.6-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-67-p0.0-v1.7-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-6789-p0.0-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-6789-p0.0-v1.2-a100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-6789-p0.0-v1.3-v100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-6789-p0.0-v1.5-h100-dp16.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-6789-p0.0-v1.5-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-6789-p0.0-v1.5-v100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter4-split01-23-45-p0.0-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter5-split01-23-45-67-89-p0.2-v1.0-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter5-split01-23-45-67-89-p0.2-v1.1-h100.yaml
│   │   │       │   │       ├── llama3.1-pdpo-iter5-split01-23-45-67-89-p0.4-v1.2-h100.yaml
│   │   │       │   │       └── llama3.1-pdpo-iter5-split01-23-45-67-89-p0.5-v1.3-a100-40.yaml
│   │   │       │   └── sft/
│   │   │       │       ├── 70b-sft-v1.0-mi300x.yaml
│   │   │       │       ├── 70b-sft-v1.1-mi300x.yaml
│   │   │       │       ├── 70b-sft-v1.2-mi300x.yaml
│   │   │       │       └── 70b-sft-v2.0-mi300x.yaml
│   │   │       └── mistral/
│   │   │           ├── dpo/
│   │   │           │   ├── co-half-0/
│   │   │           │   │   ├── mathstral-co-pdpo-half0-iter0-v1.0-a100.yaml
│   │   │           │   │   ├── mathstral-co-pdpo-half0-iter0-v1.1-h100.yaml
│   │   │           │   │   ├── mathstral-co-pdpo-half0-iter0-v1.2-h100.yaml
│   │   │           │   │   ├── mathstral-co-pdpo-half0-iter0-v1.3-a100.yaml
│   │   │           │   │   └── mathstral-co-pdpo-sc-half0-iter0-p0.0-v1.0-a100.yaml
│   │   │           │   ├── co-half-1/
│   │   │           │   │   ├── mathstral-co-pdpo-half1-iter0-v1.0-a100.yaml
│   │   │           │   │   └── mathstral-co-pdpo-sc-half1-iter1-p0.0-v1.0-a100.yaml
│   │   │           │   ├── iter-2-mscale-v0.1/
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.0-A100-40.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.0-V100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.1-A100-40.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.1-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.1-V100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.2-V100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.3-A100-40.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.3-A100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.3-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter2-v1.3-V100.yaml
│   │   │           │   │   └── mathstral-pdpo-mscale300k-iter2-v1.3.1-A100-40.yaml
│   │   │           │   ├── iter-3-mscale-v0.1/
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter3-v1.0-V100.yaml
│   │   │           │   │   └── mathstral-pdpo-mscale300k-iter3-v1.1-A100.yaml
│   │   │           │   ├── iter1/
│   │   │           │   │   ├── mathstral-dpo-4o-iter1-v1.0-v100.yaml
│   │   │           │   │   ├── mathstral-dpo-4o-iter1-v1.1-a100.yaml
│   │   │           │   │   ├── mathstral-dpo-4o-iter1-v1.2-h100.yaml
│   │   │           │   │   ├── mathstral-dpo-4o-iter1-v1.3-h100.yaml
│   │   │           │   │   ├── mathstral-dpo-4o-iter1-v1.4-v100.yaml
│   │   │           │   │   ├── mathstral-dpo-4o-iter1-v1.5-h100.yaml
│   │   │           │   │   ├── mathstral-pdpo-4o-iter1-v1.0-H100.yaml
│   │   │           │   │   ├── mathstral-raft-dpo-4o-iter1-v2.0-h100.yaml
│   │   │           │   │   ├── mathstral-raft-dpo-4o-iter1-v2.1-h100.yaml
│   │   │           │   │   ├── mathstral-sc-dpo-4o-iter1-v1.0-a100-40.yaml
│   │   │           │   │   ├── mathstral-sc-dpo-4o-iter1-v1.1-a100.yaml
│   │   │           │   │   ├── mathstral-sc-dpo-4o-iter1-v1.2-a100-40.yaml
│   │   │           │   │   ├── mathstral-sc-dpo-numina-iter1-v1.0-h100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v1.0-H100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v1.1-H100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v1.2-A100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v1.3-A100-40.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v1.4-A100-40.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v1.4-H100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v2.0-H100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v2.1-H100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-4o-iter1-v2.2-H100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-numina-iter1-v2.0-h100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-numina-iter1-v2.1-A100-40.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-numina-iter1-v2.1-a100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-numina-iter1-v2.2-h100.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-numina-iter1-v2.3-A100-40.yaml
│   │   │           │   │   ├── mathstral-sc-pdpo-numina-iter1-v2.4-A100-40.yaml
│   │   │           │   │   ├── mathstral-sc-prm-4o-iter1-v1.0-H100.yaml
│   │   │           │   │   └── mathstral-sc-prm-4o-iter1-v1.1-A100-40.yaml
│   │   │           │   ├── iter1-mscale-v0.1/
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-4o-iter1-v1.0-MI300x.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.0-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.1-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.2-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.3-A100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.4-A100-40.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.4-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.5-A100-40.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.5-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.6-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v1.7-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v2.0-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v2.1-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v3.0-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v3.1-A100-40.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v3.1-H100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v3.1-V100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v3.2-A100.yaml
│   │   │           │   │   ├── mathstral-pdpo-mscale300k-iter1-v3.2-v100.yaml
│   │   │           │   │   └── mathstral-sc-dpo-mscale300k-iter1-v1.0-H100.yaml
│   │   │           │   ├── mathstral-dpo-4o-iter0-v1.0-a100.yaml
│   │   │           │   ├── mathstral-dpo-4o-iter0-v1.1-a100.yaml
│   │   │           │   ├── mathstral-dpo-4o-iter0-v1.2-a100.yaml
│   │   │           │   ├── mathstral-dpo-full-v1.0-a100.yaml
│   │   │           │   ├── mathstral-dpo-split1-v1.0-a100.yaml
│   │   │           │   ├── mathstral-dpo-split1-v1.0-v100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v1.1-a100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v1.2-a100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v1.3-a100-40.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.0-A100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.1-A100-40-tp2.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.1-A100-40.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.1-H100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.1-V100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.2-V100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.2.1-H100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.2.2-A100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.3-H100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.4-H100.yaml
│   │   │           │   ├── mathstral-pdpo-4o-iter0-v2.4-V100.yaml
│   │   │           │   ├── mathstral-pdpo-sc-iter0-v1.0-H100.yaml
│   │   │           │   ├── mathstral-pdpo-sc-iter0-v1.1-H100.yaml
│   │   │           │   ├── mathstral-pdpo-sc-iter0-v2.0-H100.yaml
│   │   │           │   ├── mathstral-pdpo-sc-iter0-v2.1-A100.yaml
│   │   │           │   ├── ms-mistral-dpo-split1-v1.0-v100.yaml
│   │   │           │   ├── ms-mistral-dpo-split1-v1.1-v100.yaml
│   │   │           │   ├── ms-mistral-dpo-split1-v1.2-v100.yaml
│   │   │           │   ├── ms-mistral-dpo-split2-v1.0-v100.yaml
│   │   │           │   ├── ms-mistral-dpo-split2-v1.1-v100.yaml
│   │   │           │   └── reverse_order/
│   │   │           │       ├── mathstral-pre-sc-pdpo-4o-iter1-v1.0-H100.yaml
│   │   │           │       ├── mathstral-pre-sc-pdpo-4o-iter1-v1.0-V100.yaml
│   │   │           │       ├── mathstral-pre-sc-pdpo-mscale-iter1-v1.0-H100.yaml
│   │   │           │       ├── mathstral-pre-sc-pdpo-mscale-iter1-v1.1-H100.yaml
│   │   │           │       ├── mathstral-pre-sc-pdpo-mscale-iter1-v1.2-H100.yaml
│   │   │           │       ├── mathstral-pre-sc-pdpo-mscale-iter1-v1.3-H100-dp8.yaml
│   │   │           │       ├── mathstral-pre-sc-pdpo-mscale-iter1-v1.3-H100.yaml
│   │   │           │       ├── mathstral-pre-sc-pdpo-mscale-iter2-4o-gd-v1.0-H100-dp16.yaml
│   │   │           │       └── mathstral-pre-sc-pdpo-mscale-iter2-4o-gd-v1.1-H100-dp16.yaml
│   │   │           ├── reward/
│   │   │           │   └── iter1/
│   │   │           │       ├── mathstral-sc-prm-4o-iter1-v1.0-h100.yaml
│   │   │           │       ├── mathstral-sc-prm-4o-iter1-v1.0-v100.yaml
│   │   │           │       ├── mathstral-sc-prm-mscale-iter2-v1.0-v100.yaml
│   │   │           │       ├── mathstral-sc-prm-mscale-iter3-v1.0-v100.yaml
│   │   │           │       ├── process-rm-predict-flat.yaml
│   │   │           │       └── process-rm-predict-single.yaml
│   │   │           └── sft/
│   │   │               ├── co-half-0/
│   │   │               │   └── mathstral-mathscale4o-sft-v1.0-v100.yaml
│   │   │               ├── co-half-1/
│   │   │               │   └── mathstral-mathscale4o-sft-v1.0-v100.yaml
│   │   │               ├── iter1/
│   │   │               │   ├── mathstral-mathscale4o-raft-v1.0-h100.yaml
│   │   │               │   ├── mathstral-mathscale4o-raft-v1.1-a100-40.yaml
│   │   │               │   └── mathstral-mathscale4o-raft-v1.1-h100.yaml
│   │   │               ├── mathstral-mathscale4o-sft-v1.0-a100.yaml
│   │   │               ├── mathstral-mathscale4o-sft-v1.1-v100.yaml
│   │   │               ├── mathstral-mathscale4o-sft-v1.2-v100.yaml
│   │   │               ├── mathstral-mathscale4o-sft-v2.0-v100.yaml
│   │   │               └── mistral-mathscale4o-sft-v1.0-v100.yaml
│   │   ├── hydra/
│   │   │   └── default.yaml
│   │   └── post_process/
│   │       ├── deepseek.yaml
│   │       ├── gsm8k.yaml
│   │       ├── math.yaml
│   │       ├── openai_cot.yaml
│   │       └── openai_react.yaml
│   ├── data/
│   │   ├── apps.py
│   │   ├── code_contest.py
│   │   ├── combine_dataset.py
│   │   ├── deepseek_math_utils/
│   │   │   ├── answer_extraction.py
│   │   │   ├── eval_script.py
│   │   │   ├── eval_utils.py
│   │   │   └── ocwcourses_eval_utils.py
│   │   ├── general_collator.py
│   │   ├── human_eval.py
│   │   ├── input_aligner.py
│   │   ├── input_utils.py
│   │   ├── math.py
│   │   ├── math_reader.py
│   │   ├── math_util.py
│   │   ├── mathscale/
│   │   │   └── util.py
│   │   ├── numina_math.py
│   │   ├── openai_api_caller.py
│   │   ├── qwen25math/
│   │   │   ├── LICENSE
│   │   │   ├── README.md
│   │   │   ├── data_loader.py
│   │   │   ├── evaluate.py
│   │   │   ├── examples.py
│   │   │   ├── grader.py
│   │   │   ├── math_eval.py
│   │   │   ├── math_utils.py
│   │   │   ├── model_utils.py
│   │   │   ├── parser.py
│   │   │   ├── python_executor.py
│   │   │   ├── requirements.txt
│   │   │   ├── trajectory.py
│   │   │   └── utils.py
│   │   └── vllm.py
│   ├── eval/
│   │   ├── codex_humaneval/
│   │   │   ├── data.py
│   │   │   ├── evaluation.py
│   │   │   ├── execution.py
│   │   │   └── run_eval.py
│   │   ├── dispatch_openai_requests.py
│   │   ├── mbpp_eval/
│   │   │   ├── execute.py
│   │   │   ├── run_eval.py
│   │   │   └── utils.py
│   │   └── utils.py
│   ├── general_util/
│   │   ├── __init__.py
│   │   ├── average_meter.py
│   │   ├── dist_utils.py
│   │   ├── evaluator.py
│   │   ├── fs_tp_utils.py
│   │   ├── fsdp_utils.py
│   │   ├── lightseq_utils.py
│   │   ├── logger.py
│   │   ├── mixin.py
│   │   ├── mpu_proxy.py
│   │   ├── tensorboard_helper.py
│   │   ├── tokenization_utils.py
│   │   ├── torch_fsdp_utils.py
│   │   ├── training_utils.py
│   │   └── transformer_engine.py
│   ├── models/
│   │   ├── dpo_utils.py
│   │   ├── ds_utils.py
│   │   ├── fs_tp_mixin.py
│   │   ├── llama.py
│   │   ├── llama_megatron_tp.py
│   │   ├── llama_tp.py
│   │   ├── megatron_tp_mixin.py
│   │   ├── mistral.py
│   │   ├── mistral_tp.py
│   │   ├── mixin.py
│   │   ├── qwen2.py
│   │   ├── qwen2_megatron_tp.py
│   │   ├── qwen2_tp.py
│   │   └── utils.py
│   ├── openai_api_caller_v1.py
│   ├── post_inference.py
│   ├── post_processors/
│   │   ├── code/
│   │   │   ├── clean.py
│   │   │   ├── code.py
│   │   │   └── evaluator.py
│   │   ├── dist_mixin.py
│   │   ├── dpo.py
│   │   ├── openai_api_callback.py
│   │   ├── pattern/
│   │   │   └── tags.py
│   │   └── qwen25_math_callback.py
│   ├── prompts/
│   │   ├── apps/
│   │   │   ├── critique_0shot_v1.0.txt
│   │   │   ├── magicoder_cls_2shot.txt
│   │   │   ├── r2c_prompt_0shot_v1.0.txt
│   │   │   ├── r2c_prompt_1shot_v1.0.txt
│   │   │   ├── test_case_simulate.v1.0.txt
│   │   │   ├── test_input_gen_0shot_v1.0.txt
│   │   │   ├── test_input_gen_2shot_v2.0.txt
│   │   │   ├── test_input_gen_2shot_v2.1.txt
│   │   │   ├── worsen_0shot_v1.0.txt
│   │   │   └── worsen_from_feedback_0shot_v1.0.txt
│   │   ├── human_eval/
│   │   │   ├── ds_coder_prompt_v1_0.txt
│   │   │   ├── r2c_prompt_0shot_v1.0.txt
│   │   │   ├── r2c_prompt_0shot_v1.1.txt
│   │   │   ├── r2c_prompt_0shot_v1.2.txt
│   │   │   └── r2c_prompt_0shot_v1.3.txt
│   │   ├── magicoder/
│   │   │   ├── oss_has_function_head_v1_0.txt
│   │   │   └── test_input_gen_2shot_v1.0.txt
│   │   ├── math/
│   │   │   └── college_math_4shot.txt
│   │   └── mbpp/
│   │       ├── r2c_prompt_0shot_v1.0.txt
│   │       ├── r2c_prompt_3shot_v1.0.txt
│   │       └── r2c_prompt_3shot_v2.0.txt
│   ├── requirements.txt
│   ├── scripts/
│   │   ├── __init__.py
│   │   ├── apps/
│   │   │   ├── __init__.py
│   │   │   ├── analyze/
│   │   │   │   ├── freq2image.py
│   │   │   │   ├── get_output_frequency.py
│   │   │   │   └── pipeline.sh
│   │   │   ├── code_flaw/
│   │   │   │   └── pipeline_v1.0.sh
│   │   │   ├── construct_prefer_pair.py
│   │   │   ├── construct_prefer_pair_rm.py
│   │   │   ├── construct_prefer_pair_soft.py
│   │   │   ├── eval_gpt4_outputs.py
│   │   │   ├── execute_gold_sol_on_test_case.py
│   │   │   ├── execute_gold_sol_on_test_case.sh
│   │   │   ├── extract_pseudo_outputs_as_label.py
│   │   │   ├── get_output_frequency.py
│   │   │   ├── gpt4o_to_normal_pred_format.py
│   │   │   ├── merge_dp_predictions.py
│   │   │   ├── merge_dp_solutions.sh
│   │   │   ├── pp_critique_difficulty.py
│   │   │   ├── pp_eval_gpt4.py
│   │   │   ├── pp_eval_gpt4_general_combine.py
│   │   │   ├── pp_solution_gen_inputs.py
│   │   │   ├── pp_test_case.py
│   │   │   ├── pp_test_case_gen_inputs.py
│   │   │   ├── pp_test_case_gen_inputs_v2.0.py
│   │   │   ├── pp_test_case_gen_outputs.py
│   │   │   ├── pp_test_case_gen_public_outputs.py
│   │   │   ├── pp_test_case_gen_public_outputs_few_shot.py
│   │   │   ├── pp_test_case_gen_public_outputs_few_shot_verify.py
│   │   │   ├── pp_worsen_inputs.py
│   │   │   ├── prm/
│   │   │   │   ├── construct_process_rm_sample.py
│   │   │   │   ├── construct_process_rm_sample_fix.py
│   │   │   │   └── sample_steps.py
│   │   │   ├── pseudo_test_cases/
│   │   │   │   ├── 4o_pseudo_baseline.sh
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── clean_oss_mistral_data.py
│   │   │   │   ├── clean_xcode_4o_test_inputs_data.py
│   │   │   │   ├── collect_pseudo_outputs.py
│   │   │   │   ├── combine_gpt_raw_requests.py
│   │   │   │   ├── combine_pseudo_test_inputs.py
│   │   │   │   ├── construct_dpo_pairs.sh
│   │   │   │   ├── control_test_case_num_baseline.sh
│   │   │   │   ├── control_test_case_num_baseline_pipeline.sh
│   │   │   │   ├── extract_4o_combine_outputs_as_label.sh
│   │   │   │   ├── oss_combine_collect_pseudo_outputs.py
│   │   │   │   ├── oss_combine_collect_pseudo_outputs_mp.py
│   │   │   │   ├── oss_combine_collect_pseudo_outputs_mp_compress.py
│   │   │   │   ├── oss_combine_collect_pseudo_outputs_takes_extra.py
│   │   │   │   ├── oss_combine_prefix_fail_extract_pseudo_label.py
│   │   │   │   ├── oss_combine_run_extract_pseudo_label.py
│   │   │   │   ├── pipeline.sh
│   │   │   │   ├── pp_inputs_pick_problem_evol.py
│   │   │   │   ├── pp_inputs_pick_problem_oss.py
│   │   │   │   ├── prefix_fail_extract_pseudo_label.py
│   │   │   │   ├── prefix_fail_extract_pseudo_label_align_ts_num.py
│   │   │   │   ├── run_outputs_local.sh
│   │   │   │   ├── xcode_pipeline.sh
│   │   │   │   └── xcode_pp_test_case_gen.py
│   │   │   ├── re_verify_solutions.py
│   │   │   ├── rerank_code_rm.py
│   │   │   ├── solution_fail_extract.py
│   │   │   ├── solution_fail_extract_critique.py
│   │   │   ├── solution_fail_extract_pseudo_label.py
│   │   │   ├── solution_run_outputs.py
│   │   │   ├── solution_run_outputs_local.py
│   │   │   ├── solution_run_pseudo_outputs_local.py
│   │   │   ├── utils_execute.py
│   │   │   └── worsen_gpt4_combine.py
│   │   ├── collect_mbpp_test_cases_outputs_sc_v1.0.py
│   │   ├── eval_mbpp_judgement.py
│   │   ├── eval_mbpp_judgement_v2.py
│   │   ├── execute_mbpp_intermediate_res.py
│   │   ├── execute_mbpp_intermediate_res_mp.py
│   │   ├── inference/
│   │   │   └── vllm_dp_mul_node.sh
│   │   ├── math/
│   │   │   ├── analyze_sc.py
│   │   │   ├── deepseek_math_sample_steps.py
│   │   │   ├── estimate_state_value.py
│   │   │   ├── merge_dp_multi_solution.py
│   │   │   ├── merge_dp_predictions.py
│   │   │   ├── merge_dp_predictions.sh
│   │   │   ├── merge_incomplete_predictions.py
│   │   │   ├── merge_rm_dp_multi_solution.py
│   │   │   ├── rerank_w_orm.py
│   │   │   ├── rerank_w_prm.py
│   │   │   └── rerank_w_prm_combine.py
│   │   ├── math_scale/
│   │   │   ├── __init__.py
│   │   │   ├── analyze/
│   │   │   │   ├── compute_acc_by_id.py
│   │   │   │   ├── draw_sc.py
│   │   │   │   ├── extract_hard_questions.py
│   │   │   │   ├── freq2image.py
│   │   │   │   ├── get_output_frequency.py
│   │   │   │   ├── hard_change.sh
│   │   │   │   └── pipeline.sh
│   │   │   ├── concat_data.py
│   │   │   ├── construct_prefer_pair.py
│   │   │   ├── construct_prefer_pair_sc.py
│   │   │   ├── construct_prm_pair.sh
│   │   │   ├── construct_process_rm_sample_gd.py
│   │   │   ├── construct_process_rm_sample_sc.py
│   │   │   ├── exclude_unused_data.py
│   │   │   ├── extract_content_from_orig_format.py
│   │   │   ├── extract_mathscale_v2_box_answer.py
│   │   │   ├── extract_numina_math_box_answer.py
│   │   │   ├── fix_answer_extract_and_verify.py
│   │   │   ├── fix_answer_extract_and_verify_v2.py
│   │   │   ├── llama_numina_co_train/
│   │   │   │   ├── construct_prm_sc_pair.sh
│   │   │   │   └── pipeline.sh
│   │   │   ├── math_scale_offline_gpt_eval.py
│   │   │   ├── mathstral_mathscale_co_train/
│   │   │   │   ├── construct_prm_gd_pair.sh
│   │   │   │   ├── construct_prm_sc_pair.sh
│   │   │   │   └── pipeline.sh
│   │   │   ├── merge_dp_predictions.py
│   │   │   ├── merge_dp_predictions.sh
│   │   │   ├── merge_dp_seed_predictions.py
│   │   │   ├── merge_dp_seed_predictions_by_split.sh
│   │   │   ├── merge_math500_predictions.sh
│   │   │   ├── merge_mwpbench_predictions.sh
│   │   │   ├── merge_mwpbench_sympy_predictions.sh
│   │   │   ├── merge_qwen2_dp_math_dev_predictions_v0.0.sh
│   │   │   ├── merge_qwen2_dp_math_dev_predictions_v1.3.sh
│   │   │   ├── merge_qwen2_dp_predictions_v1.1.sh
│   │   │   ├── merge_qwen2_dp_predictions_v1.2.sh
│   │   │   ├── merge_qwen2_dp_predictions_v1.3.sh
│   │   │   ├── mscale/
│   │   │   │   ├── 4o_pipeline.sh
│   │   │   │   ├── construct_prm_sc_pair.sh
│   │   │   │   ├── pipeline.sh
│   │   │   │   └── rerank.sh
│   │   │   ├── pipeline.sh
│   │   │   ├── pp_gpt_inputs.py
│   │   │   ├── process_4o.py
│   │   │   ├── process_raw_4o.py
│   │   │   ├── process_raw_4o_labeling.py
│   │   │   ├── qwen25math_style_eval.py
│   │   │   ├── qwen25math_style_eval.sh
│   │   │   ├── qwen25math_style_eval_math.py
│   │   │   ├── qwen25math_style_eval_v2.0.py
│   │   │   ├── qwen25math_style_preprocess_pred_label.py
│   │   │   ├── reject_sampling_pipeline.sh
│   │   │   ├── rerank_w_prm_math.py
│   │   │   ├── rerank_w_prm_math_scale_save.py
│   │   │   ├── rerank_w_prm_math_scale_save_pair.py
│   │   │   ├── rerank_w_prm_math_scale_save_pair_margin.py
│   │   │   └── split_data.py
│   │   ├── mbpp/
│   │   │   ├── eval_human_eval_gpt_outputs.py
│   │   │   ├── eval_mbpp_gpt_outputs.py
│   │   │   ├── pp_eval_gpt4_human_eval.py
│   │   │   ├── pp_eval_gpt4_mbpp.py
│   │   │   ├── prepare_mbpp_test_cases_inputs_v1.0.py
│   │   │   ├── print_human_eval_mbpp_res.sh
│   │   │   ├── process_mbpp_test_cases_inputs.py
│   │   │   └── run_test_case_v1.0.py
│   │   ├── model_converts/
│   │   │   ├── llama_hf_mp_split.py
│   │   │   └── pad_model_embedding.py
│   │   ├── prepare_code_contests_decompose.py
│   │   ├── prepare_code_contests_decompose_verification.py
│   │   ├── prepare_code_contests_decompose_verification_v2.0.py
│   │   ├── prepare_code_contests_judgement.py
│   │   ├── prepare_mbpp_desc2code_inputs_v1.0.py
│   │   ├── prepare_mbpp_inputs_v1.0.py
│   │   ├── prepare_mbpp_intermediate_print_v1.0.py
│   │   ├── prepare_mbpp_predict_judgement.py
│   │   ├── prepare_mbpp_test_cases_inputs_v1.0.py
│   │   ├── prepare_mbpp_test_cases_outputs_v1.0.py
│   │   ├── prepare_mbpp_test_cases_outputs_v1.1.py
│   │   ├── split_data_according_to_id.py
│   │   └── verify_mbpp_test_cases.py
│   ├── service_api_caller_v1.py
│   ├── trainer_base_ds_mul_fs_tp.py
│   ├── trainer_ds_megatron_mul.py
│   ├── visualize/
│   │   ├── length_distribution.py
│   │   ├── reward_histogram.py
│   │   └── test_response_length.py
│   ├── vllm_inference.py
│   └── vllm_inference_dp.py
├── README.md
├── ReSA/
│   ├── README.md
│   ├── figures/
│   │   └── figure.py
│   ├── llm/
│   │   ├── __init__.py
│   │   ├── arch/
│   │   │   ├── __init__.py
│   │   │   ├── context_manager.py
│   │   │   └── model.py
│   │   ├── config.py
│   │   ├── data/
│   │   │   └── tokenizer.py
│   │   ├── eval.py
│   │   ├── eval_math.py
│   │   ├── kernel/
│   │   │   ├── __init__.py
│   │   │   ├── flash_attention_with_kv_cache.py
│   │   │   ├── flash_sparse_decoding.py
│   │   │   ├── rotary.py
│   │   │   ├── tilelang_attention_with_kv_cache.py
│   │   │   └── tilelang_sparse_decoding.py
│   │   └── utils/
│   │       └── math_utils.py
│   ├── math_data/
│   │   ├── aime24/
│   │   │   └── test.jsonl
│   │   ├── amc23/
│   │   │   └── test.jsonl
│   │   ├── aqua/
│   │   │   └── test.jsonl
│   │   ├── asdiv/
│   │   │   └── test.jsonl
│   │   ├── carp_en/
│   │   │   ├── demo.json
│   │   │   └── test.jsonl
│   │   ├── cmath/
│   │   │   └── test.jsonl
│   │   ├── cn_middle_school/
│   │   │   └── test.jsonl
│   │   ├── college_math/
│   │   │   └── test.jsonl
│   │   ├── eval_rm_maj_example/
│   │   │   └── math_cot_100.jsonl
│   │   ├── gaokao2023en/
│   │   │   └── test.jsonl
│   │   ├── gaokao2024_I/
│   │   │   └── test.jsonl
│   │   ├── gaokao2024_II/
│   │   │   └── test.jsonl
│   │   ├── gaokao2024_mix/
│   │   │   └── test.jsonl
│   │   ├── gaokao_math_cloze/
│   │   │   └── test.jsonl
│   │   ├── gaokao_math_qa/
│   │   │   └── test.jsonl
│   │   ├── gsm8k/
│   │   │   ├── test.jsonl
│   │   │   └── train.jsonl
│   │   ├── math/
│   │   │   ├── test.jsonl
│   │   │   └── train.jsonl
│   │   ├── mawps/
│   │   │   ├── addsub.jsonl
│   │   │   ├── multiarith.jsonl
│   │   │   ├── singleeq.jsonl
│   │   │   ├── singleop.jsonl
│   │   │   └── test.jsonl
│   │   ├── minerva_math/
│   │   │   ├── README.md
│   │   │   └── test.jsonl
│   │   ├── mmlu_stem/
│   │   │   └── test.jsonl
│   │   ├── olympiadbench/
│   │   │   ├── test.json
│   │   │   └── test.jsonl
│   │   ├── sat_math/
│   │   │   └── test.jsonl
│   │   ├── svamp/
│   │   │   └── test.jsonl
│   │   └── tabmwp/
│   │       └── test.jsonl
│   └── scripts/
│       ├── local_eval_math.sh
│       ├── math_eval_result.sh
│       ├── math_eval_result_length.py
│       ├── math_utils.py
│       └── setup_math_eval.sh
├── SECURITY.md
├── YOCO/
│   ├── README.md
│   ├── requirements.txt
│   ├── scripts/
│   │   ├── eval_needle.sh
│   │   ├── eval_task.sh
│   │   └── train.sh
│   └── yoco/
│       ├── __init__.py
│       ├── criterions/
│       │   ├── __init__.py
│       │   ├── harness_eval.py
│       │   ├── multi_needle.py
│       │   └── needle_haystack.py
│       ├── models/
│       │   ├── __init__.py
│       │   ├── decoder/
│       │   │   ├── __init__.py
│       │   │   ├── cross_attention.py
│       │   │   ├── feedforward_network.py
│       │   │   ├── gate_retention.py
│       │   │   ├── kernel/
│       │   │   │   ├── gate_recurrent.py
│       │   │   │   ├── rotary.py
│       │   │   │   └── swiglu.py
│       │   │   ├── model_parallel_init.py
│       │   │   ├── rms_norm.py
│       │   │   ├── sliding_window_attention.py
│       │   │   ├── transformer.py
│       │   │   └── yoco.py
│       │   ├── transformer.py
│       │   └── yoco.py
│       ├── tasks/
│       │   ├── __init__.py
│       │   ├── data/
│       │   │   ├── __init__.py
│       │   │   ├── basic_loader.py
│       │   │   ├── llama_tokenizer.py
│       │   │   ├── lm_loader.py
│       │   │   ├── tiktoken_tokenizer.py
│       │   │   └── utils.py
│       │   ├── gpt.py
│       │   ├── harness_eval.py
│       │   ├── harness_task.py
│       │   ├── mmlu_task.py
│       │   └── pseudo.py
│       ├── train.py
│       └── validate.py
├── adalm/
│   ├── README.md
│   ├── finetune/
│   │   ├── __init__.py
│   │   ├── run_classifier.py
│   │   ├── run_ner.py
│   │   ├── run_pico.py
│   │   ├── utils_for_glue.py
│   │   └── utils_ner.py
│   ├── incr_bpe/
│   │   ├── README.md
│   │   ├── subword_builder.py
│   │   ├── test_data/
│   │   │   ├── chem.txt
│   │   │   └── vocab.txt
│   │   ├── text_encoder.py
│   │   ├── tokenizer.py
│   │   └── vocab_extend.py
│   ├── requirements.txt
│   └── setup.py
├── beats/
│   ├── BEATs.py
│   ├── README.md
│   ├── Tokenizers.py
│   ├── backbone.py
│   ├── beats_README.md
│   ├── modules.py
│   └── quantizer.py
├── beit/
│   ├── .gitignore
│   ├── README.md
│   ├── dall_e/
│   │   ├── __init__.py
│   │   ├── decoder.py
│   │   ├── encoder.py
│   │   └── utils.py
│   ├── dataset_folder.py
│   ├── datasets.py
│   ├── engine_for_finetuning.py
│   ├── engine_for_pretraining.py
│   ├── get_started_for_image_classification.md
│   ├── masking_generator.py
│   ├── modeling_discrete_vae.py
│   ├── modeling_finetune.py
│   ├── modeling_pretrain.py
│   ├── optim_factory.py
│   ├── requirements.txt
│   ├── run_beit_pretraining.py
│   ├── run_class_finetuning.py
│   ├── run_linear_eval.py
│   ├── semantic_segmentation/
│   │   ├── README.md
│   │   ├── backbone/
│   │   │   └── beit.py
│   │   ├── configs/
│   │   │   ├── _base_/
│   │   │   │   ├── datasets/
│   │   │   │   │   ├── ade20k.py
│   │   │   │   │   └── ade20k_640x640.py
│   │   │   │   ├── default_runtime.py
│   │   │   │   ├── models/
│   │   │   │   │   └── upernet_beit.py
│   │   │   │   └── schedules/
│   │   │   │       ├── schedule_160k.py
│   │   │   │       └── schedule_320k.py
│   │   │   └── beit/
│   │   │       └── upernet/
│   │   │           ├── upernet_beit_base_12_512_slide_160k_ade20k_ms.py
│   │   │           ├── upernet_beit_base_12_512_slide_160k_ade20k_pt.py
│   │   │           ├── upernet_beit_base_12_512_slide_160k_ade20k_pt2ft.py
│   │   │           ├── upernet_beit_base_12_640_slide_160k_ade20k_ms.py
│   │   │           ├── upernet_beit_base_12_640_slide_160k_ade20k_pt2ft.py
│   │   │           ├── upernet_beit_large_24_512_slide_160k_ade20k_ms.py
│   │   │           ├── upernet_beit_large_24_512_slide_160k_ade20k_pt2ft.py
│   │   │           ├── upernet_beit_large_24_640_slide_160k_ade20k_ms.py
│   │   │           └── upernet_beit_large_24_640_slide_160k_ade20k_pt2ft.py
│   │   ├── mmcv_custom/
│   │   │   ├── __init__.py
│   │   │   ├── apex_runner/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── apex_iter_based_runner.py
│   │   │   │   ├── checkpoint.py
│   │   │   │   └── optimizer.py
│   │   │   ├── checkpoint.py
│   │   │   ├── layer_decay_optimizer_constructor.py
│   │   │   ├── resize_transform.py
│   │   │   └── train_api.py
│   │   └── tools/
│   │       ├── dist_test.sh
│   │       ├── dist_train.sh
│   │       ├── test.py
│   │       └── train.py
│   ├── transforms.py
│   └── utils.py
├── beit2/
│   ├── .gitignore
│   ├── PRETRAINING.md
│   ├── README.md
│   ├── TOKENIZER.md
│   ├── dataset_folder.py
│   ├── datasets.py
│   ├── engine_for_finetuning.py
│   ├── engine_for_pretraining.py
│   ├── engine_for_vqkd.py
│   ├── get_started_for_image_classification.md
│   ├── imagenet_a_r_indices.py
│   ├── masking_generator.py
│   ├── modeling_finetune.py
│   ├── modeling_pretrain.py
│   ├── modeling_vqkd.py
│   ├── norm_ema_quantizer.py
│   ├── optim_factory.py
│   ├── requirements.txt
│   ├── run_beitv2_pretraining.py
│   ├── run_class_finetuning.py
│   ├── run_vqkd_training.py
│   ├── semantic_segmentation/
│   │   ├── README.md
│   │   ├── backbone/
│   │   │   └── beit.py
│   │   ├── configs/
│   │   │   ├── _base_/
│   │   │   │   ├── datasets/
│   │   │   │   │   ├── ade20k.py
│   │   │   │   │   └── ade20k_640x640.py
│   │   │   │   ├── default_runtime.py
│   │   │   │   ├── models/
│   │   │   │   │   └── upernet_beit.py
│   │   │   │   └── schedules/
│   │   │   │       ├── schedule_160k.py
│   │   │   │       └── schedule_320k.py
│   │   │   └── beit/
│   │   │       └── upernet/
│   │   │           ├── upernet_beit_base_12_512_slide_160k_21ktoade20k.py
│   │   │           ├── upernet_beit_base_12_512_slide_160k_ade20k.py
│   │   │           ├── upernet_beit_large_24_512_slide_160k_21ktoade20k.py
│   │   │           └── upernet_beit_large_24_512_slide_160k_ade20k.py
│   │   ├── mmcv_custom/
│   │   │   ├── __init__.py
│   │   │   ├── apex_runner/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── apex_iter_based_runner.py
│   │   │   │   ├── checkpoint.py
│   │   │   │   └── optimizer.py
│   │   │   ├── checkpoint.py
│   │   │   ├── layer_decay_optimizer_constructor.py
│   │   │   ├── resize_transform.py
│   │   │   └── train_api.py
│   │   └── tools/
│   │       ├── dist_test.sh
│   │       ├── dist_train.sh
│   │       ├── test.py
│   │       └── train.py
│   ├── test_get_code.py
│   ├── transforms.py
│   ├── utils.py
│   ├── visualize_attention.py
│   └── vqkd_teacher/
│       ├── __init__.py
│       ├── clip/
│       │   ├── __init__.py
│       │   ├── clip.py
│       │   ├── model.py
│       │   └── simple_tokenizer.py
│       └── dino.py
├── beit3/
│   ├── README.md
│   ├── datasets.py
│   ├── engine_for_finetuning.py
│   ├── get_started/
│   │   ├── get_started_for_captioning.md
│   │   ├── get_started_for_image_classification.md
│   │   ├── get_started_for_nlvr2.md
│   │   ├── get_started_for_retrieval.md
│   │   └── get_started_for_vqav2.md
│   ├── glossary.py
│   ├── modeling_finetune.py
│   ├── modeling_utils.py
│   ├── optim_factory.py
│   ├── randaug.py
│   ├── requirements.txt
│   ├── run_beit3_finetuning.py
│   └── utils.py
├── bitnet/
│   └── README.md
├── decoding/
│   ├── GAD/
│   │   ├── block_plugins/
│   │   │   ├── __init__.py
│   │   │   ├── criterions/
│   │   │   │   ├── __init__.py
│   │   │   │   └── glat_loss.py
│   │   │   ├── models/
│   │   │   │   ├── BlockNAT.py
│   │   │   │   └── __init__.py
│   │   │   └── tasks/
│   │   │       ├── __init__.py
│   │   │       └── translation_lev_modified.py
│   │   ├── data/
│   │   │   ├── test.de.compound.ref
│   │   │   ├── wmt14.en-de/
│   │   │   │   ├── bpe.32000
│   │   │   │   ├── dict.de.txt
│   │   │   │   └── dict.en.txt
│   │   │   └── wmt16.en-ro/
│   │   │       ├── dict.en.txt
│   │   │       ├── dict.ro.txt
│   │   │       └── get_data.sh
│   │   ├── fairseq/
│   │   │   ├── __init__.py
│   │   │   ├── benchmark/
│   │   │   │   ├── __init__.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
│   │   │   │   ├── 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
│   │   │   │       ├── wav2vec/
│   │   │   │       │   └── vq_wav2vec_gumbel.yaml
│   │   │   │       └── wav2vec2/
│   │   │   │           ├── wav2vec2_base.yaml
│   │   │   │           └── wav2vec2_large.yaml
│   │   │   ├── criterions/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── adaptive_loss.py
│   │   │   │   ├── composite_loss.py
│   │   │   │   ├── cross_entropy.py
│   │   │   │   ├── ctc.py
│   │   │   │   ├── fairseq_criterion.py
│   │   │   │   ├── label_smoothed_cross_entropy.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
│   │   │   ├── data/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── add_target_dataset.py
│   │   │   │   ├── append_token_dataset.py
│   │   │   │   ├── audio/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── audio_utils.py
│   │   │   │   │   ├── feature_transforms/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── global_cmvn.py
│   │   │   │   │   │   ├── specaugment.py
│   │   │   │   │   │   └── utterance_cmvn.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.pyx
│   │   │   │   ├── denoising_dataset.py
│   │   │   │   ├── dictionary.py
│   │   │   │   ├── encoders/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── 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
│   │   │   │   │   ├── 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
│   │   │   │   │   ├── 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.pyx
│   │   │   │   ├── transform_eos_dataset.py
│   │   │   │   └── transform_eos_lang_pair_dataset.py
│   │   │   ├── dataclass/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── configs.py
│   │   │   │   ├── constants.py
│   │   │   │   ├── initialize.py
│   │   │   │   └── utils.py
│   │   │   ├── distributed/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── distributed_timeout_wrapper.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
│   │   │   ├── logging/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── meters.py
│   │   │   │   ├── metrics.py
│   │   │   │   └── progress_bar.py
│   │   │   ├── model_parallel/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── criterions/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── vocab_parallel_cross_entropy.py
│   │   │   │   ├── megatron_trainer.py
│   │   │   │   ├── models/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── pipeline_parallel_transformer/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── layers.py
│   │   │   │   │   │   └── model.py
│   │   │   │   │   ├── roberta/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   └── model.py
│   │   │   │   │   ├── transformer.py
│   │   │   │   │   └── transformer_lm.py
│   │   │   │   └── modules/
│   │   │   │       ├── __init__.py
│   │   │   │       ├── multihead_attention.py
│   │   │   │       └── transformer_layer.py
│   │   │   ├── models/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── bart/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── 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
│   │   │   │   ├── huggingface/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── 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
│   │   │   │   │   ├── fairseq_nat_model.py
│   │   │   │   │   ├── nonautoregressive_ensembles.py
│   │   │   │   │   └── nonautoregressive_transformer.py
│   │   │   │   ├── roberta/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── alignment_utils.py
│   │   │   │   │   ├── hub_interface.py
│   │   │   │   │   ├── model.py
│   │   │   │   │   ├── model_camembert.py
│   │   │   │   │   ├── model_gottbert.py
│   │   │   │   │   └── model_xlmr.py
│   │   │   │   ├── speech_to_text/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── berard.py
│   │   │   │   │   ├── convtransformer.py
│   │   │   │   │   └── s2t_transformer.py
│   │   │   │   ├── transformer.py
│   │   │   │   ├── transformer_align.py
│   │   │   │   ├── transformer_from_pretrained_xlm.py
│   │   │   │   ├── transformer_lm.py
│   │   │   │   └── wav2vec/
│   │   │   │       ├── __init__.py
│   │   │   │       ├── wav2vec.py
│   │   │   │       ├── wav2vec2.py
│   │   │   │       └── wav2vec2_asr.py
│   │   │   ├── modules/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── 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
│   │   │   │   ├── multihead_attention.py
│   │   │   │   ├── positional_embedding.py
│   │   │   │   ├── quant_noise.py
│   │   │   │   ├── quantization/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── pq/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── em.py
│   │   │   │   │   │   ├── modules/
│   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   ├── qconv.py
│   │   │   │   │   │   │   ├── qemb.py
│   │   │   │   │   │   │   └── qlinear.py
│   │   │   │   │   │   ├── pq.py
│   │   │   │   │   │   └── utils.py
│   │   │   │   │   ├── quantization_options.py
│   │   │   │   │   └── scalar/
│   │   │   │   │       ├── __init__.py
│   │   │   │   │       ├── modules/
│   │   │   │   │       │   ├── __init__.py
│   │   │   │   │       │   ├── 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
│   │   │   │   ├── adadelta.py
│   │   │   │   ├── adafactor.py
│   │   │   │   ├── adagrad.py
│   │   │   │   ├── adam.py
│   │   │   │   ├── adamax.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
│   │   │   │   │   ├── 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
│   │   │   │   ├── bleu.py
│   │   │   │   ├── chrf.py
│   │   │   │   ├── tokenizer.py
│   │   │   │   └── wer.py
│   │   │   ├── search.py
│   │   │   ├── sequence_generator.py
│   │   │   ├── sequence_scorer.py
│   │   │   ├── tasks/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── audio_pretraining.py
│   │   │   │   ├── cross_lingual_lm.py
│   │   │   │   ├── denoising.py
│   │   │   │   ├── fairseq_task.py
│   │   │   │   ├── language_modeling.py
│   │   │   │   ├── legacy_masked_lm.py
│   │   │   │   ├── masked_lm.py
│   │   │   │   ├── multilingual_denoising.py
│   │   │   │   ├── multilingual_masked_lm.py
│   │   │   │   ├── multilingual_translation.py
│   │   │   │   ├── semisupervised_translation.py
│   │   │   │   ├── sentence_prediction.py
│   │   │   │   ├── sentence_ranking.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
│   │   │   ├── eval_lm.py
│   │   │   ├── generate.py
│   │   │   ├── hydra_train.py
│   │   │   ├── interactive.py
│   │   │   ├── preprocess.py
│   │   │   ├── score.py
│   │   │   ├── train.py
│   │   │   └── validate.py
│   │   ├── hubconf.py
│   │   ├── inference.py
│   │   ├── inference.sh
│   │   ├── inference_paper.py
│   │   ├── pyproject.toml
│   │   ├── readme.md
│   │   ├── ref.sh
│   │   ├── 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
│   │   ├── setup.py
│   │   ├── train.py
│   │   └── train.sh
│   ├── IAD/
│   │   ├── README.md
│   │   ├── fairseq/
│   │   │   ├── .github/
│   │   │   │   ├── ISSUE_TEMPLATE/
│   │   │   │   │   ├── bug_report.md
│   │   │   │   │   ├── documentation.md
│   │   │   │   │   ├── feature_request.md
│   │   │   │   │   └── how-to-question.md
│   │   │   │   ├── ISSUE_TEMPLATE.md
│   │   │   │   ├── PULL_REQUEST_TEMPLATE.md
│   │   │   │   ├── stale.yml
│   │   │   │   └── workflows/
│   │   │   │       ├── build.yml
│   │   │   │       └── build_wheels.yml
│   │   │   ├── .gitignore
│   │   │   ├── .gitmodules
│   │   │   ├── CODE_OF_CONDUCT.md
│   │   │   ├── CONTRIBUTING.md
│   │   │   ├── LICENSE
│   │   │   ├── README.md
│   │   │   ├── README_FAIRSEQ.md
│   │   │   ├── docs/
│   │   │   │   ├── Makefile
│   │   │   │   ├── _static/
│   │   │   │   │   └── theme_overrides.css
│   │   │   │   ├── command_line_tools.rst
│   │   │   │   ├── conf.py
│   │   │   │   ├── criterions.rst
│   │   │   │   ├── data.rst
│   │   │   │   ├── docutils.conf
│   │   │   │   ├── 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
│   │   │   │   ├── 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
│   │   │   │   ├── 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
│   │   │   │   ├── gottbert/
│   │   │   │   │   └── README.md
│   │   │   │   ├── 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
│   │   │   │   ├── 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
│   │   │   │   │   ├── 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
│   │   │   │   │   ├── criterions/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   └── label_smoothed_cross_entropy_latency_augmented.py
│   │   │   │   │   ├── docs/
│   │   │   │   │   │   ├── baseline.md
│   │   │   │   │   │   └── evaluation.md
│   │   │   │   │   ├── eval/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── agents/
│   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   ├── agent.py
│   │   │   │   │   │   │   ├── simul_trans_agent.py
│   │   │   │   │   │   │   ├── simul_trans_text_agent.py
│   │   │   │   │   │   │   └── word_splitter.py
│   │   │   │   │   │   ├── client.py
│   │   │   │   │   │   ├── eval_latency.py
│   │   │   │   │   │   ├── evaluate.py
│   │   │   │   │   │   ├── scorers/
│   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   ├── scorer.py
│   │   │   │   │   │   │   └── text_scorer.py
│   │   │   │   │   │   └── server.py
│   │   │   │   │   ├── models/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   └── transformer_monotonic_attention.py
│   │   │   │   │   ├── modules/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── monotonic_multihead_attention.py
│   │   │   │   │   │   └── monotonic_transformer_layer.py
│   │   │   │   │   └── utils/
│   │   │   │   │       ├── __init__.py
│   │   │   │   │       ├── functions.py
│   │   │   │   │       └── latency.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
│   │   │   │   │   ├── models/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── vggtransformer.py
│   │   │   │   │   │   └── w2l_conv_glu_enc.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
│   │   │   │   │   │   └── mustc_example.md
│   │   │   │   │   ├── prep_covost_data.py
│   │   │   │   │   ├── prep_librispeech_data.py
│   │   │   │   │   └── prep_mustc_data.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
│   │   │   │   ├── wav2vec/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── config/
│   │   │   │   │   │   ├── finetuning/
│   │   │   │   │   │   │   ├── base_100h.yaml
│   │   │   │   │   │   │   ├── base_10h.yaml
│   │   │   │   │   │   │   ├── base_10m.yaml
│   │   │   │   │   │   │   ├── base_1h.yaml
│   │   │   │   │   │   │   ├── base_960h.yaml
│   │   │   │   │   │   │   ├── vox_100h.yaml
│   │   │   │   │   │   │   ├── vox_10h.yaml
│   │   │   │   │   │   │   ├── vox_10m.yaml
│   │   │   │   │   │   │   ├── vox_1h.yaml
│   │   │   │   │   │   │   └── vox_960h.yaml
│   │   │   │   │   │   └── pretraining/
│   │   │   │   │   │       ├── wav2vec2_base_librispeech.yaml
│   │   │   │   │   │       └── wav2vec2_large_librivox.yaml
│   │   │   │   │   ├── libri_labels.py
│   │   │   │   │   ├── vq-wav2vec_featurize.py
│   │   │   │   │   ├── wav2vec_featurize.py
│   │   │   │   │   └── wav2vec_manifest.py
│   │   │   │   ├── wmt19/
│   │   │   │   │   └── README.md
│   │   │   │   ├── wmt20/
│   │   │   │   │   └── README.md
│   │   │   │   └── xlmr/
│   │   │   │       └── README.md
│   │   │   ├── fairseq/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── benchmark/
│   │   │   │   │   ├── __init__.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
│   │   │   │   │   ├── 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
│   │   │   │   │       ├── wav2vec/
│   │   │   │   │       │   └── vq_wav2vec_gumbel.yaml
│   │   │   │   │       └── wav2vec2/
│   │   │   │   │           ├── wav2vec2_base.yaml
│   │   │   │   │           └── wav2vec2_large.yaml
│   │   │   │   ├── criterions/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── adaptive_loss.py
│   │   │   │   │   ├── composite_loss.py
│   │   │   │   │   ├── cross_entropy.py
│   │   │   │   │   ├── ctc.py
│   │   │   │   │   ├── fairseq_criterion.py
│   │   │   │   │   ├── label_smoothed_cross_entropy.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
│   │   │   │   ├── data/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── add_target_dataset.py
│   │   │   │   │   ├── append_token_dataset.py
│   │   │   │   │   ├── audio/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── audio_utils.py
│   │   │   │   │   │   ├── feature_transforms/
│   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   ├── global_cmvn.py
│   │   │   │   │   │   │   ├── specaugment.py
│   │   │   │   │   │   │   └── utterance_cmvn.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.pyx
│   │   │   │   │   ├── denoising_dataset.py
│   │   │   │   │   ├── dictionary.py
│   │   │   │   │   ├── encoders/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── 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
│   │   │   │   │   │   ├── 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
│   │   │   │   │   │   ├── 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.pyx
│   │   │   │   │   ├── transform_eos_dataset.py
│   │   │   │   │   └── transform_eos_lang_pair_dataset.py
│   │   │   │   ├── dataclass/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── configs.py
│   │   │   │   │   ├── constants.py
│   │   │   │   │   ├── initialize.py
│   │   │   │   │   └── utils.py
│   │   │   │   ├── distributed_utils.py
│   │   │   │   ├── file_io.py
│   │   │   │   ├── file_utils.py
│   │   │   │   ├── hub_utils.py
│   │   │   │   ├── incremental_decoding_utils.py
│   │   │   │   ├── iterative_refinement_generator.py
│   │   │   │   ├── legacy_distributed_data_parallel.py
│   │   │   │   ├── logging/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── meters.py
│   │   │   │   │   ├── metrics.py
│   │   │   │   │   └── progress_bar.py
│   │   │   │   ├── model_parallel/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── criterions/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   └── vocab_parallel_cross_entropy.py
│   │   │   │   │   ├── megatron_trainer.py
│   │   │   │   │   ├── models/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── pipeline_parallel_transformer/
│   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   ├── layers.py
│   │   │   │   │   │   │   └── model.py
│   │   │   │   │   │   ├── roberta/
│   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   └── model.py
│   │   │   │   │   │   ├── transformer.py
│   │   │   │   │   │   └── transformer_lm.py
│   │   │   │   │   └── modules/
│   │   │   │   │       ├── __init__.py
│   │   │   │   │       ├── multihead_attention.py
│   │   │   │   │       ├── transformer_layer.py
│   │   │   │   │       ├── transformer_sentence_encoder.py
│   │   │   │   │       └── transformer_sentence_encoder_layer.py
│   │   │   │   ├── models/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── bart/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── 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
│   │   │   │   │   ├── huggingface/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   └── 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
│   │   │   │   │   │   ├── 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
│   │   │   │   │   │   ├── alignment_utils.py
│   │   │   │   │   │   ├── hub_interface.py
│   │   │   │   │   │   ├── model.py
│   │   │   │   │   │   ├── model_camembert.py
│   │   │   │   │   │   ├── model_gottbert.py
│   │   │   │   │   │   └── model_xlmr.py
│   │   │   │   │   ├── speech_to_text/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── berard.py
│   │   │   │   │   │   └── s2t_transformer.py
│   │   │   │   │   ├── transformer.py
│   │   │   │   │   ├── transformer_align.py
│   │   │   │   │   ├── transformer_from_pretrained_xlm.py
│   │   │   │   │   ├── transformer_lm.py
│   │   │   │   │   └── wav2vec/
│   │   │   │   │       ├── __init__.py
│   │   │   │   │       ├── wav2vec.py
│   │   │   │   │       ├── wav2vec2.py
│   │   │   │   │       └── wav2vec2_asr.py
│   │   │   │   ├── modules/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── 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
│   │   │   │   │   ├── multihead_attention.py
│   │   │   │   │   ├── positional_embedding.py
│   │   │   │   │   ├── quant_noise.py
│   │   │   │   │   ├── quantization/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── pq/
│   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   ├── em.py
│   │   │   │   │   │   │   ├── modules/
│   │   │   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   │   │   ├── qconv.py
│   │   │   │   │   │   │   │   ├── qemb.py
│   │   │   │   │   │   │   │   └── qlinear.py
│   │   │   │   │   │   │   ├── pq.py
│   │   │   │   │   │   │   └── utils.py
│   │   │   │   │   │   ├── quantization_options.py
│   │   │   │   │   │   └── scalar/
│   │   │   │   │   │       ├── __init__.py
│   │   │   │   │   │       ├── modules/
│   │   │   │   │   │       │   ├── __init__.py
│   │   │   │   │   │       │   ├── 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
│   │   │   │   │   ├── adadelta.py
│   │   │   │   │   ├── adafactor.py
│   │   │   │   │   ├── adagrad.py
│   │   │   │   │   ├── adam.py
│   │   │   │   │   ├── adamax.py
│   │   │   │   │   ├── bmuf.py
│   │   │   │   │   ├── composite.py
│   │   │   │   │   ├── dynamic_loss_scaler.py
│   │   │   │   │   ├── fairseq_optimizer.py
│   │   │   │   │   ├── fp16_optimizer.py
│   │   │   │   │   ├── fused_adam.py
│   │   │   │   │   ├── fused_lamb.py
│   │   │   │   │   ├── lr_scheduler/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── 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
│   │   │   │   │   ├── bleu.py
│   │   │   │   │   ├── chrf.py
│   │   │   │   │   ├── tokenizer.py
│   │   │   │   │   └── wer.py
│   │   │   │   ├── search.py
│   │   │   │   ├── sequence_generator.py
│   │   │   │   ├── sequence_scorer.py
│   │   │   │   ├── tasks/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── audio_pretraining.py
│   │   │   │   │   ├── cross_lingual_lm.py
│   │   │   │   │   ├── denoising.py
│   │   │   │   │   ├── fairseq_task.py
│   │   │   │   │   ├── language_modeling.py
│   │   │   │   │   ├── legacy_masked_lm.py
│   │   │   │   │   ├── masked_lm.py
│   │   │   │   │   ├── multilingual_denoising.py
│   │   │   │   │   ├── multilingual_masked_lm.py
│   │   │   │   │   ├── multilingual_translation.py
│   │   │   │   │   ├── semisupervised_translation.py
│   │   │   │   │   ├── sentence_prediction.py
│   │   │   │   │   ├── sentence_ranking.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.txt
│   │   │   ├── fairseq_cli/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── 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
│   │   │   ├── setup.py
│   │   │   ├── tests/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── distributed/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── test_distributed_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_average_checkpoints.py
│   │   │   │   ├── test_backtranslation_dataset.py
│   │   │   │   ├── test_binaries.py
│   │   │   │   ├── test_bmuf.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_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_sampled_dataset.py
│   │   │   │   ├── test_multihead_attention.py
│   │   │   │   ├── test_noising.py
│   │   │   │   ├── test_reproducibility.py
│   │   │   │   ├── test_resampling_dataset.py
│   │   │   │   ├── test_sequence_generator.py
│   │   │   │   ├── test_sequence_scorer.py
│   │   │   │   ├── test_sparse_multihead_attention.py
│   │   │   │   ├── test_token_block_dataset.py
│   │   │   │   ├── test_train.py
│   │   │   │   ├── test_utils.py
│   │   │   │   └── utils.py
│   │   │   ├── tmp.txt
│   │   │   └── train.py
│   │   ├── inference.py
│   │   ├── inference_batch.py
│   │   └── interactive.sh
│   └── readme.md
├── deepnet/
│   └── README.md
├── deltalm/
│   ├── README.md
│   ├── deltalm/
│   │   ├── __init__.py
│   │   └── models/
│   │       ├── __init__.py
│   │       └── deltalm.py
│   ├── examples/
│   │   ├── binary_iwslt14.sh
│   │   ├── evaluate_iwslt14.sh
│   │   ├── prepare_iwslt14.sh
│   │   ├── spm_iwslt14.sh
│   │   └── train_iwslt14.sh
│   ├── generate.py
│   ├── interactive.py
│   ├── preprocess.py
│   └── train.py
├── dit/
│   ├── README.md
│   ├── classification/
│   │   ├── README.md
│   │   ├── dataset_folder.py
│   │   ├── datasets.py
│   │   ├── deepspeed_configs/
│   │   │   └── config.json
│   │   ├── engine_for_finetuning.py
│   │   ├── modeling_finetune.py
│   │   ├── optim_factory.py
│   │   ├── requirements.txt
│   │   ├── run_class_finetuning.py
│   │   ├── transforms.py
│   │   └── utils.py
│   ├── object_detection/
│   │   ├── README.md
│   │   ├── adaptive_binarize.py
│   │   ├── convert_to_coco_format.py
│   │   ├── ditod/
│   │   │   ├── __init__.py
│   │   │   ├── backbone.py
│   │   │   ├── beit.py
│   │   │   ├── config.py
│   │   │   ├── dataset_mapper.py
│   │   │   ├── deit.py
│   │   │   ├── icdar_evaluation.py
│   │   │   ├── mycheckpointer.py
│   │   │   ├── mytrainer.py
│   │   │   └── table_evaluation/
│   │   │       ├── __init__.py
│   │   │       ├── data_structure.py
│   │   │       └── evaluate.py
│   │   ├── icdar19_configs/
│   │   │   ├── Base-RCNN-FPN.yaml
│   │   │   ├── cascade/
│   │   │   │   ├── cascade_dit_base.yaml
│   │   │   │   └── cascade_dit_large.yaml
│   │   │   └── maskrcnn/
│   │   │       ├── maskrcnn_dit_base.yaml
│   │   │       └── maskrcnn_dit_large.yaml
│   │   ├── inference.py
│   │   ├── publaynet_configs/
│   │   │   ├── Base-RCNN-FPN.yaml
│   │   │   ├── cascade/
│   │   │   │   ├── cascade_dit_base.yaml
│   │   │   │   └── cascade_dit_large.yaml
│   │   │   └── maskrcnn/
│   │   │       ├── maskrcnn_dit_base.yaml
│   │   │       └── maskrcnn_dit_large.yaml
│   │   └── train_net.py
│   ├── requirements.txt
│   └── text_detection/
│       ├── README.md
│       ├── configs/
│       │   ├── Base-RCNN-FPN.yaml
│       │   ├── mask_rcnn_dit_base.yaml
│       │   └── mask_rcnn_dit_large.yaml
│       ├── ditod/
│       │   ├── __init__.py
│       │   ├── backbone.py
│       │   ├── beit.py
│       │   ├── concern/
│       │   │   ├── __init__.py
│       │   │   ├── average_meter.py
│       │   │   ├── box2seg.py
│       │   │   ├── config.py
│       │   │   ├── convert.py
│       │   │   ├── icdar2015_eval/
│       │   │   │   ├── __init__.py
│       │   │   │   └── detection/
│       │   │   │       ├── __init__.py
│       │   │   │       ├── deteval.py
│       │   │   │       ├── icdar2013.py
│       │   │   │       ├── iou.py
│       │   │   │       └── mtwi2018.py
│       │   │   ├── log.py
│       │   │   ├── signal_monitor.py
│       │   │   ├── visualizer.py
│       │   │   └── webcv2/
│       │   │       ├── __init__.py
│       │   │       ├── manager.py
│       │   │       ├── server.py
│       │   │       └── templates/
│       │   │           └── index.html
│       │   ├── config.py
│       │   ├── dataset_mapper.py
│       │   ├── deit.py
│       │   ├── funsd_evaluation.py
│       │   ├── mycheckpointer.py
│       │   └── mytrainer.py
│       └── train_net.py
├── e5/
│   ├── README.md
│   ├── model_config.py
│   ├── mteb_beir_eval.py
│   ├── mteb_except_retrieval_eval.py
│   ├── requirements.txt
│   ├── scripts/
│   │   ├── eval_mteb_beir.sh
│   │   └── eval_mteb_except_retrieval.sh
│   └── utils.py
├── edgelm/
│   ├── CODE_OF_CONDUCT.md
│   ├── CONTRIBUTING.md
│   ├── LICENSE
│   ├── README.md
│   ├── docs/
│   │   ├── Makefile
│   │   ├── _static/
│   │   │   └── theme_overrides.css
│   │   ├── command_line_tools.rst
│   │   ├── conf.py
│   │   ├── criterions.rst
│   │   ├── data.rst
│   │   ├── docutils.conf
│   │   ├── 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
│   │   ├── MMPT/
│   │   │   ├── .gitignore
│   │   │   ├── CONFIG.md
│   │   │   ├── DATASET.md
│   │   │   ├── README.md
│   │   │   ├── endtask.md
│   │   │   ├── locallaunch.py
│   │   │   ├── mmpt/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── datasets/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── fairseqmmdataset.py
│   │   │   │   │   └── mmdataset.py
│   │   │   │   ├── evaluators/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── evaluator.py
│   │   │   │   │   ├── metric.py
│   │   │   │   │   └── predictor.py
│   │   │   │   ├── losses/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── fairseqmmloss.py
│   │   │   │   │   ├── loss.py
│   │   │   │   │   └── nce.py
│   │   │   │   ├── models/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── fairseqmmmodel.py
│   │   │   │   │   ├── mmfusion.py
│   │   │   │   │   ├── mmfusionnlg.py
│   │   │   │   │   └── transformermodel.py
│   │   │   │   ├── modules/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── mm.py
│   │   │   │   │   ├── retri.py
│   │   │   │   │   └── vectorpool.py
│   │   │   │   ├── processors/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── dedupprocessor.py
│   │   │   │   │   ├── dsprocessor.py
│   │   │   │   │   ├── how2processor.py
│   │   │   │   │   ├── how2retriprocessor.py
│   │   │   │   │   ├── models/
│   │   │   │   │   │   └── s3dg.py
│   │   │   │   │   └── processor.py
│   │   │   │   ├── tasks/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── fairseqmmtask.py
│   │   │   │   │   ├── milncetask.py
│   │   │   │   │   ├── retritask.py
│   │   │   │   │   ├── task.py
│   │   │   │   │   └── vlmtask.py
│   │   │   │   └── utils/
│   │   │   │       ├── __init__.py
│   │   │   │       ├── load_config.py
│   │   │   │       └── shardedtensor.py
│   │   │   ├── mmpt_cli/
│   │   │   │   ├── localjob.py
│   │   │   │   └── predict.py
│   │   │   ├── pretraining.md
│   │   │   ├── projects/
│   │   │   │   ├── mfmmlm.yaml
│   │   │   │   ├── mtm/
│   │   │   │   │   ├── mmfusionmtm.yaml
│   │   │   │   │   ├── vlm/
│   │   │   │   │   │   ├── coin.yaml
│   │   │   │   │   │   ├── crosstask.yaml
│   │   │   │   │   │   ├── how2.yaml
│   │   │   │   │   │   ├── test_coin.yaml
│   │   │   │   │   │   ├── test_crosstask.yaml
│   │   │   │   │   │   ├── test_crosstask_zs.yaml
│   │   │   │   │   │   ├── test_vtt.yaml
│   │   │   │   │   │   ├── test_vttqa.yaml
│   │   │   │   │   │   ├── test_youcook.yaml
│   │   │   │   │   │   ├── test_youcookcap.yaml
│   │   │   │   │   │   ├── vtt.yaml
│   │   │   │   │   │   ├── vttqa.yaml
│   │   │   │   │   │   ├── youcook.yaml
│   │   │   │   │   │   └── youcookcap.yaml
│   │   │   │   │   └── vlm.yaml
│   │   │   │   ├── retri/
│   │   │   │   │   ├── videoclip/
│   │   │   │   │   │   ├── coin_videoclip.yaml
│   │   │   │   │   │   ├── crosstask_videoclip.yaml
│   │   │   │   │   │   ├── how2.yaml
│   │   │   │   │   │   ├── test_coin_videoclip.yaml
│   │   │   │   │   │   ├── test_coin_zs.yaml
│   │   │   │   │   │   ├── test_crosstask_videoclip.yaml
│   │   │   │   │   │   ├── test_crosstask_zs_videoclip.yaml
│   │   │   │   │   │   ├── test_didemo_zs.yaml
│   │   │   │   │   │   ├── test_vtt_videoclip.yaml
│   │   │   │   │   │   ├── test_vtt_zs.yaml
│   │   │   │   │   │   ├── test_vttqa_videoclip.yaml
│   │   │   │   │   │   ├── test_vttqa_zs.yaml
│   │   │   │   │   │   ├── test_youcook_videoclip.yaml
│   │   │   │   │   │   ├── test_youcook_zs.yaml
│   │   │   │   │   │   ├── vtt_videoclip.yaml
│   │   │   │   │   │   ├── vttqa_videoclip.yaml
│   │   │   │   │   │   └── youcook_videoclip.yaml
│   │   │   │   │   ├── videoclip.yaml
│   │   │   │   │   └── videoretri.yaml
│   │   │   │   └── task/
│   │   │   │       ├── coin.yaml
│   │   │   │       ├── coin_videoclip.yaml
│   │   │   │       ├── crosstask.yaml
│   │   │   │       ├── crosstask_videoclip.yaml
│   │   │   │       ├── default.yaml
│   │   │   │       ├── ft.yaml
│   │   │   │       ├── how2.yaml
│   │   │   │       ├── test.yaml
│   │   │   │       ├── test_coin.yaml
│   │   │   │       ├── test_coin_videoclip.yaml
│   │   │   │       ├── test_coin_zs.yaml
│   │   │   │       ├── test_crosstask.yaml
│   │   │   │       ├── test_crosstask_videoclip.yaml
│   │   │   │       ├── test_crosstask_zs.yaml
│   │   │   │       ├── test_crosstask_zs_videoclip.yaml
│   │   │   │       ├── test_didemo_zs.yaml
│   │   │   │       ├── test_vtt.yaml
│   │   │   │       ├── test_vtt_videoclip.yaml
│   │   │   │       ├── test_vtt_zs.yaml
│   │   │   │       ├── test_vttqa.yaml
│   │   │   │       ├── test_vttqa_videoclip.yaml
│   │   │   │       ├── test_vttqa_zs.yaml
│   │   │   │       ├── test_youcook.yaml
│   │   │   │       ├── test_youcook_videoclip.yaml
│   │   │   │       ├── test_youcook_zs.yaml
│   │   │   │       ├── test_youcookcap.yaml
│   │   │   │       ├── vtt.yaml
│   │   │   │       ├── vtt_videoclip.yaml
│   │   │   │       ├── vttqa.yaml
│   │   │   │       ├── vttqa_videoclip.yaml
│   │   │   │       ├── youcook.yaml
│   │   │   │       ├── youcook_videoclip.yaml
│   │   │   │       └── youcookcap.yaml
│   │   │   ├── scripts/
│   │   │   │   ├── text_token_extractor/
│   │   │   │   │   ├── configs/
│   │   │   │   │   │   └── bert-base-uncased.yaml
│   │   │   │   │   └── pretokenization.py
│   │   │   │   └── video_feature_extractor/
│   │   │   │       ├── extract.py
│   │   │   │       ├── how2/
│   │   │   │       │   └── s3d.sh
│   │   │   │       ├── model.py
│   │   │   │       ├── pathbuilder.py
│   │   │   │       ├── preprocessing.py
│   │   │   │       ├── random_sequence_shuffler.py
│   │   │   │       ├── shard_feature.py
│   │   │   │       └── videoreader.py
│   │   │   └── setup.py
│   │   ├── __init__.py
│   │   ├── 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
│   │   ├── discriminative_reranking_nmt/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   ├── config/
│   │   │   │   └── deen.yaml
│   │   │   ├── criterions/
│   │   │   │   ├── __init__.py
│   │   │   │   └── discriminative_reranking_criterion.py
│   │   │   ├── drnmt_rerank.py
│   │   │   ├── models/
│   │   │   │   ├── __init__.py
│   │   │   │   └── discriminative_reranking_model.py
│   │   │   ├── scripts/
│   │   │   │   └── prep_data.py
│   │   │   └── tasks/
│   │   │       ├── __init__.py
│   │   │       └── discriminative_reranking_task.py
│   │   ├── fast_noisy_channel/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   ├── noisy_channel_beam_search.py
│   │   │   ├── noisy_channel_sequence_generator.py
│   │   │   └── noisy_channel_translation.py
│   │   ├── flores101/
│   │   │   └── README.md
│   │   ├── 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
│   │   │   │   ├── dump_w2v2_feature.py
│   │   │   │   ├── feature_utils.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
│   │   ├── normformer/
│   │   │   ├── README.md
│   │   │   └── train_lm.sh
│   │   ├── operators/
│   │   │   ├── alignment_train_cpu.cpp
│   │   │   ├── alignment_train_cuda.cpp
│   │   │   ├── alignment_train_cuda.h
│   │   │   ├── alignment_train_kernel.cu
│   │   │   └── utils.h
│   │   ├── 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
│   │   │   ├── commonsense_qa/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── commonsense_qa_task.py
│   │   │   │   └── download_cqa_data.sh
│   │   │   ├── config/
│   │   │   │   ├── finetuning/
│   │   │   │   │   ├── cola.yaml
│   │   │   │   │   ├── mnli.yaml
│   │   │   │   │   ├── mrpc.yaml
│   │   │   │   │   ├── qnli.yaml
│   │   │   │   │   ├── qqp.yaml
│   │   │   │   │   ├── rte.yaml
│   │   │   │   │   ├── sst_2.yaml
│   │   │   │   │   └── sts_b.yaml
│   │   │   │   └── pretraining/
│   │   │   │       └── base.yaml
│   │   │   ├── 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
│   │   ├── shuffled_word_order/
│   │   │   ├── README.finetuning.md
│   │   │   └── README.md
│   │   ├── simultaneous_translation/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   ├── docs/
│   │   │   │   ├── ende-mma.md
│   │   │   │   └── enja-waitk.md
│   │   │   ├── eval/
│   │   │   │   └── agents/
│   │   │   │       └── simul_t2t_enja.py
│   │   │   ├── models/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── convtransformer_simul_trans.py
│   │   │   │   └── transformer_monotonic_attention.py
│   │   │   ├── modules/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── fixed_pre_decision.py
│   │   │   │   ├── monotonic_multihead_attention.py
│   │   │   │   └── monotonic_transformer_layer.py
│   │   │   ├── tests/
│   │   │   │   ├── test_alignment_train.py
│   │   │   │   └── test_text_models.py
│   │   │   └── utils/
│   │   │       ├── __init__.py
│   │   │       ├── functions.py
│   │   │       ├── monotonic_attention.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_synthesis/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   ├── data_utils.py
│   │   │   ├── docs/
│   │   │   │   ├── common_voice_example.md
│   │   │   │   ├── ljspeech_example.md
│   │   │   │   └── vctk_example.md
│   │   │   ├── evaluation/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── eval_asr.py
│   │   │   │   ├── eval_f0.py
│   │   │   │   ├── eval_sp.py
│   │   │   │   └── get_eval_manifest.py
│   │   │   ├── generate_waveform.py
│   │   │   ├── preprocessing/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── denoise_and_vad_audio.py
│   │   │   │   ├── denoiser/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── demucs.py
│   │   │   │   │   ├── pretrained.py
│   │   │   │   │   ├── resample.py
│   │   │   │   │   └── utils.py
│   │   │   │   ├── get_common_voice_audio_manifest.py
│   │   │   │   ├── get_feature_manifest.py
│   │   │   │   ├── get_ljspeech_audio_manifest.py
│   │   │   │   ├── get_speaker_embedding.py
│   │   │   │   ├── get_vctk_audio_manifest.py
│   │   │   │   ├── speaker_embedder/
│   │   │   │   │   └── __init__.py
│   │   │   │   └── vad/
│   │   │   │       └── __init__.py
│   │   │   └── utils.py
│   │   ├── speech_text_joint_to_text/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   ├── configs/
│   │   │   │   └── mustc_noise.list
│   │   │   ├── criterions/
│   │   │   │   ├── __init__.py
│   │   │   │   └── text_guide_cross_entropy_acc.py
│   │   │   ├── docs/
│   │   │   │   ├── ende-mustc.md
│   │   │   │   └── iwslt2021.md
│   │   │   ├── models/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── s2t_dualinputtransformer.py
│   │   │   │   └── s2t_dualinputxmtransformer.py
│   │   │   ├── scripts/
│   │   │   │   └── g2p_encode.py
│   │   │   └── tasks/
│   │   │       ├── __init__.py
│   │   │       └── speech_text_joint.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
│   │   ├── textless_nlp/
│   │   │   └── gslm/
│   │   │       ├── README.md
│   │   │       ├── metrics/
│   │   │       │   ├── README.md
│   │   │       │   ├── abx_metrics/
│   │   │       │   │   ├── README.md
│   │   │       │   │   └── dump_abx_feats.py
│   │   │       │   └── asr_metrics/
│   │   │       │       ├── README.md
│   │   │       │       ├── continuation_eval.py
│   │   │       │       ├── misc/
│   │   │       │       │   ├── bleu_utils.py
│   │   │       │       │   ├── cut_as.py
│   │   │       │       │   └── dict.ltr.txt
│   │   │       │       ├── ppx.py
│   │   │       │       └── self_auto_bleu.py
│   │   │       ├── speech2unit/
│   │   │       │   ├── README.md
│   │   │       │   ├── __init__.py
│   │   │       │   ├── clustering/
│   │   │       │   │   ├── __init__.py
│   │   │       │   │   ├── cluster_kmeans.py
│   │   │       │   │   ├── dump_feats.py
│   │   │       │   │   ├── quantize_with_kmeans.py
│   │   │       │   │   └── utils.py
│   │   │       │   └── pretrained/
│   │   │       │       ├── cpc_feature_reader.py
│   │   │       │       ├── hubert_feature_reader.py
│   │   │       │       ├── logmel_feature_reader.py
│   │   │       │       ├── utils.py
│   │   │       │       └── w2v2_feature_reader.py
│   │   │       ├── tools/
│   │   │       │   ├── README.md
│   │   │       │   └── resynthesize_speech.py
│   │   │       ├── ulm/
│   │   │       │   ├── README.md
│   │   │       │   └── sample.py
│   │   │       └── unit2speech/
│   │   │           ├── README.md
│   │   │           ├── convert_to_16k.py
│   │   │           ├── glow.py
│   │   │           ├── multiproc.py
│   │   │           ├── synthesize_audio_from_units.py
│   │   │           ├── tacotron2/
│   │   │           │   ├── __init__.py
│   │   │           │   ├── audio_processing.py
│   │   │           │   ├── cleaners.py
│   │   │           │   ├── cmudict.py
│   │   │           │   ├── layers.py
│   │   │           │   ├── model.py
│   │   │           │   ├── numbers.py
│   │   │           │   ├── stft.py
│   │   │           │   ├── symbols.py
│   │   │           │   ├── text.py
│   │   │           │   ├── utils.py
│   │   │           │   └── waveglow_denoiser.py
│   │   │           ├── tts_data.py
│   │   │           └── utils.py
│   │   ├── 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
│   │   ├── wav2vec/
│   │   │   ├── README.md
│   │   │   ├── __init__.py
│   │   │   ├── config/
│   │   │   │   ├── finetuning/
│   │   │   │   │   ├── base_100h.yaml
│   │   │   │   │   ├── base_10h.yaml
│   │   │   │   │   ├── base_10m.yaml
│   │   │   │   │   ├── base_1h.yaml
│   │   │   │   │   ├── base_960h.yaml
│   │   │   │   │   ├── vox_100h.yaml
│   │   │   │   │   ├── vox_10h.yaml
│   │   │   │   │   ├── vox_10m.yaml
│   │   │   │   │   ├── vox_1h.yaml
│   │   │   │   │   └── vox_960h.yaml
│   │   │   │   └── pretraining/
│   │   │   │       ├── wav2vec2_base_librispeech.yaml
│   │   │   │       ├── wav2vec2_large_librivox.yaml
│   │   │   │       ├── wav2vec2_large_librivox_tpu-pod.yaml
│   │   │   │       └── wav2vec2_large_librivox_tpu.yaml
│   │   │   ├── libri_labels.py
│   │   │   ├── scripts/
│   │   │   │   └── binarize_manifest.sh
│   │   │   ├── unsupervised/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── config/
│   │   │   │   │   ├── finetuning/
│   │   │   │   │   │   └── w2v_finetune.yaml
│   │   │   │   │   ├── gan/
│   │   │   │   │   │   └── w2vu.yaml
│   │   │   │   │   ├── generate/
│   │   │   │   │   │   └── viterbi.yaml
│   │   │   │   │   ├── timit_matched/
│   │   │   │   │   │   ├── test.uid
│   │   │   │   │   │   ├── train.uid
│   │   │   │   │   │   ├── train_text.uid
│   │   │   │   │   │   └── valid.uid
│   │   │   │   │   └── timit_unmatched/
│   │   │   │   │       ├── test.uid
│   │   │   │   │       ├── train.uid
│   │   │   │   │       ├── train_text.uid
│   │   │   │   │       └── valid.uid
│   │   │   │   ├── data/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── extracted_features_dataset.py
│   │   │   │   │   └── random_input_dataset.py
│   │   │   │   ├── kaldi_self_train/
│   │   │   │   │   ├── README.md
│   │   │   │   │   └── st/
│   │   │   │   │       ├── cmd.sh
│   │   │   │   │       ├── decode_phone.sh
│   │   │   │   │       ├── decode_word_step1.sh
│   │   │   │   │       ├── decode_word_step2.sh
│   │   │   │   │       ├── local/
│   │   │   │   │       │   ├── copy_aligned_text.py
│   │   │   │   │       │   ├── decode.sh
│   │   │   │   │       │   ├── prepare_data_from_w2v.py
│   │   │   │   │       │   ├── prepare_lang.sh
│   │   │   │   │       │   ├── prepare_lang_word.sh
│   │   │   │   │       │   ├── prepare_lm.sh
│   │   │   │   │       │   ├── score.sh
│   │   │   │   │       │   ├── show_wer.sh
│   │   │   │   │       │   ├── train_subset_lgbeam.sh
│   │   │   │   │       │   ├── unsup_select.py
│   │   │   │   │       │   ├── unsup_select_decode.sh
│   │   │   │   │       │   └── unsup_select_decode_word.sh
│   │   │   │   │       ├── path.sh
│   │   │   │   │       ├── steps
│   │   │   │   │       ├── steps_gan/
│   │   │   │   │       │   ├── train_deltas.sh
│   │   │   │   │       │   ├── train_lda_mllt.sh
│   │   │   │   │       │   └── train_sat.sh
│   │   │   │   │       ├── train.sh
│   │   │   │   │       └── utils
│   │   │   │   ├── models/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── wav2vec_u.py
│   │   │   │   ├── scripts/
│   │   │   │   │   ├── apply_pca.py
│   │   │   │   │   ├── copy_labels.py
│   │   │   │   │   ├── filter_lexicon.py
│   │   │   │   │   ├── filter_tsv.py
│   │   │   │   │   ├── g2p_wrd_to_phn.py
│   │   │   │   │   ├── ltr_to_wrd.py
│   │   │   │   │   ├── mean_pool.py
│   │   │   │   │   ├── merge_clusters.py
│   │   │   │   │   ├── normalize_and_filter_text.py
│   │   │   │   │   ├── normalize_text.py
│   │   │   │   │   ├── pca.py
│   │   │   │   │   ├── phonemize_with_sil.py
│   │   │   │   │   ├── prepare_audio.sh
│   │   │   │   │   ├── prepare_text.sh
│   │   │   │   │   ├── prepare_timit.sh
│   │   │   │   │   ├── remove_silence.py
│   │   │   │   │   ├── vads.py
│   │   │   │   │   ├── wav2vec_apply_cluster_faiss.py
│   │   │   │   │   ├── wav2vec_cluster_faiss.py
│   │   │   │   │   ├── wav2vec_extract_features.py
│   │   │   │   │   ├── wer.py
│   │   │   │   │   └── wrd_to_ltr.py
│   │   │   │   ├── tasks/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── unpaired_audio_text.py
│   │   │   │   └── w2vu_generate.py
│   │   │   ├── vq-wav2vec_featurize.py
│   │   │   ├── wav2vec_featurize.py
│   │   │   └── wav2vec_manifest.py
│   │   ├── wmt19/
│   │   │   └── README.md
│   │   ├── wmt20/
│   │   │   └── README.md
│   │   └── xlmr/
│   │       └── README.md
│   ├── fairseq/
│   │   ├── __init__.py
│   │   ├── benchmark/
│   │   │   ├── __init__.py
│   │   │   ├── 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
│   │   │       ├── wav2vec/
│   │   │       │   └── vq_wav2vec_gumbel.yaml
│   │   │       └── wav2vec2/
│   │   │           ├── wav2vec2_base.yaml
│   │   │           └── wav2vec2_large.yaml
│   │   ├── criterions/
│   │   │   ├── __init__.py
│   │   │   ├── adaptive_loss.py
│   │   │   ├── composite_loss.py
│   │   │   ├── cross_entropy.py
│   │   │   ├── ctc.py
│   │   │   ├── fairseq_criterion.py
│   │   │   ├── fastspeech2_loss.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
│   │   │   ├── tacotron2_loss.py
│   │   │   └── wav2vec_criterion.py
│   │   ├── data/
│   │   │   ├── __init__.py
│   │   │   ├── add_target_dataset.py
│   │   │   ├── append_token_dataset.py
│   │   │   ├── audio/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── audio_utils.py
│   │   │   │   ├── data_cfg.py
│   │   │   │   ├── feature_transforms/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── global_cmvn.py
│   │   │   │   │   ├── specaugment.py
│   │   │   │   │   └── utterance_cmvn.py
│   │   │   │   ├── frm_text_to_speech_dataset.py
│   │   │   │   ├── hubert_dataset.py
│   │   │   │   ├── multi_modality_dataset.py
│   │   │   │   ├── raw_audio_dataset.py
│   │   │   │   ├── speech_to_text_dataset.py
│   │   │   │   ├── speech_to_text_joint_dataset.py
│   │   │   │   └── text_to_speech_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.pyx
│   │   │   ├── denoising_dataset.py
│   │   │   ├── dictionary.py
│   │   │   ├── encoders/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── 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
│   │   │   ├── huffman/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── huffman_coder.py
│   │   │   │   └── huffman_mmap_indexed_dataset.py
│   │   │   ├── id_dataset.py
│   │   │   ├── indexed_dataset.py
│   │   │   ├── iterators.py
│   │   │   ├── language_pair_dataset.py
│   │   │   ├── legacy/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── 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
│   │   │   │   ├── 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
│   │   │   ├── squad/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── basic_tokenizer.py
│   │   │   │   ├── squad_extractor.py
│   │   │   │   └── squad_metrics.py
│   │   │   ├── strip_token_dataset.py
│   │   │   ├── subsample_dataset.py
│   │   │   ├── text_compressor.py
│   │   │   ├── token_block_dataset.py
│   │   │   ├── token_block_utils_fast.cpp
│   │   │   ├── token_block_utils_fast.pyx
│   │   │   ├── transform_eos_dataset.py
│   │   │   └── transform_eos_lang_pair_dataset.py
│   │   ├── dataclass/
│   │   │   ├── __init__.py
│   │   │   ├── configs.py
│   │   │   ├── constants.py
│   │   │   ├── initialize.py
│   │   │   └── utils.py
│   │   ├── distributed/
│   │   │   ├── __init__.py
│   │   │   ├── 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_chunker_utils.py
│   │   ├── file_io.py
│   │   ├── file_utils.py
│   │   ├── hub_utils.py
│   │   ├── incremental_decoding_utils.py
│   │   ├── iterative_refinement_generator.py
│   │   ├── logging/
│   │   │   ├── __init__.py
│   │   │   ├── meters.py
│   │   │   ├── metrics.py
│   │   │   └── progress_bar.py
│   │   ├── model_parallel/
│   │   │   ├── __init__.py
│   │   │   ├── criterions/
│   │   │   │   ├── __init__.py
│   │   │   │   └── vocab_parallel_cross_entropy.py
│   │   │   ├── megatron_trainer.py
│   │   │   ├── models/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── pipeline_parallel_transformer/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── layers.py
│   │   │   │   │   └── model.py
│   │   │   │   ├── roberta/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── model.py
│   │   │   │   ├── transformer.py
│   │   │   │   └── transformer_lm.py
│   │   │   └── modules/
│   │   │       ├── __init__.py
│   │   │       ├── multihead_attention.py
│   │   │       └── transformer_layer.py
│   │   ├── models/
│   │   │   ├── __init__.py
│   │   │   ├── bart/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── hub_interface.py
│   │   │   │   └── model.py
│   │   │   ├── composite_encoder.py
│   │   │   ├── distributed_fairseq_model.py
│   │   │   ├── ema/
│   │   │   │   ├── __init__.py
│   │   │   │   └── ema.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
│   │   │   │   ├── hubert.py
│   │   │   │   └── hubert_asr.py
│   │   │   ├── huggingface/
│   │   │   │   ├── __init__.py
│   │   │   │   └── 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
│   │   │   │   ├── 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
│   │   │   │   ├── 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
│   │   │   │   ├── berard.py
│   │   │   │   ├── convtransformer.py
│   │   │   │   ├── modules/
│   │   │   │   │   ├── augmented_memory_attention.py
│   │   │   │   │   └── emformer.py
│   │   │   │   ├── s2t_transformer.py
│   │   │   │   ├── utils.py
│   │   │   │   └── xm_transformer.py
│   │   │   ├── text_to_speech/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── fastspeech2.py
│   │   │   │   ├── hifigan.py
│   │   │   │   ├── tacotron2.py
│   │   │   │   ├── tts_transformer.py
│   │   │   │   └── vocoder.py
│   │   │   ├── transformer/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── transformer_base.py
│   │   │   │   ├── transformer_config.py
│   │   │   │   ├── transformer_decoder.py
│   │   │   │   ├── transformer_encoder.py
│   │   │   │   └── transformer_legacy.py
│   │   │   ├── transformer_align.py
│   │   │   ├── transformer_from_pretrained_xlm.py
│   │   │   ├── transformer_lm.py
│   │   │   └── wav2vec/
│   │   │       ├── __init__.py
│   │   │       ├── wav2vec.py
│   │   │       ├── wav2vec2.py
│   │   │       └── wav2vec2_asr.py
│   │   ├── modules/
│   │   │   ├── __init__.py
│   │   │   ├── adaptive_input.py
│   │   │   ├── adaptive_softmax.py
│   │   │   ├── base_layer.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_attention.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
│   │   │   ├── location_attention.py
│   │   │   ├── lora.py
│   │   │   ├── lstm_cell_with_zoneout.py
│   │   │   ├── multihead_attention.py
│   │   │   ├── positional_embedding.py
│   │   │   ├── quant_noise.py
│   │   │   ├── quantization/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── pq/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── em.py
│   │   │   │   │   ├── modules/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── qconv.py
│   │   │   │   │   │   ├── qemb.py
│   │   │   │   │   │   └── qlinear.py
│   │   │   │   │   ├── pq.py
│   │   │   │   │   └── utils.py
│   │   │   │   ├── quantization_options.py
│   │   │   │   └── scalar/
│   │   │   │       ├── __init__.py
│   │   │   │       ├── modules/
│   │   │   │       │   ├── __init__.py
│   │   │   │       │   ├── 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
│   │   │   ├── 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
│   │   │   │   ├── 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
│   │   │   │   ├── step_lr_scheduler.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
│   │   │   ├── bleu.py
│   │   │   ├── chrf.py
│   │   │   ├── tokenizer.py
│   │   │   └── wer.py
│   │   ├── search.py
│   │   ├── sequence_generator.py
│   │   ├── sequence_scorer.py
│   │   ├── speech_generator.py
│   │   ├── tasks/
│   │   │   ├── __init__.py
│   │   │   ├── audio_finetuning.py
│   │   │   ├── audio_pretraining.py
│   │   │   ├── cross_lingual_lm.py
│   │   │   ├── denoising.py
│   │   │   ├── fairseq_task.py
│   │   │   ├── frm_text_to_speech.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
│   │   │   ├── text_to_speech.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
│   │   ├── 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
│   │   │   ├── test_ema_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_dataclass_utils.py
│   │   ├── test_dataset.py
│   │   ├── test_dictionary.py
│   │   ├── test_ema.py
│   │   ├── test_export.py
│   │   ├── test_file_chunker_utils.py
│   │   ├── test_file_io.py
│   │   ├── test_fp16_optimizer.py
│   │   ├── test_huffman.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
├── glan/
│   └── README.md
├── infoxlm/
│   ├── README.md
│   ├── fairseq/
│   │   ├── .gitignore
│   │   ├── CODE_OF_CONDUCT.md
│   │   ├── CONTRIBUTING.md
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── docs/
│   │   │   ├── Makefile
│   │   │   ├── _static/
│   │   │   │   └── theme_overrides.css
│   │   │   ├── command_line_tools.rst
│   │   │   ├── conf.py
│   │   │   ├── criterions.rst
│   │   │   ├── data.rst
│   │   │   ├── docutils.conf
│   │   │   ├── getting_started.rst
│   │   │   ├── 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
│   │   ├── eval_lm.py
│   │   ├── examples/
│   │   │   ├── .gitignore
│   │   │   ├── __init__.py
│   │   │   ├── backtranslation/
│   │   │   │   └── README.md
│   │   │   ├── bart/
│   │   │   │   ├── README.cnn.md
│   │   │   │   ├── README.glue.md
│   │   │   │   └── README.md
│   │   │   ├── camembert/
│   │   │   │   └── README.md
│   │   │   ├── conv_seq2seq/
│   │   │   │   └── README.md
│   │   │   ├── cross_lingual_language_model/
│   │   │   │   └── README.md
│   │   │   ├── joint_alignment_translation/
│   │   │   │   ├── README.md
│   │   │   │   └── prepare-wmt18en2de_no_norm_no_escape_no_agressive.sh
│   │   │   ├── language_model/
│   │   │   │   ├── README.md
│   │   │   │   ├── conv_lm/
│   │   │   │   │   └── README.md
│   │   │   │   ├── prepare-wikitext-103.sh
│   │   │   │   └── transformer_lm/
│   │   │   │       └── README.md
│   │   │   ├── layerdrop/
│   │   │   │   └── README.md
│   │   │   ├── 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
│   │   │   ├── pay_less_attention_paper/
│   │   │   │   └── README.md
│   │   │   ├── roberta/
│   │   │   │   ├── README.custom_classification.md
│   │   │   │   ├── README.glue.md
│   │   │   │   ├── README.md
│   │   │   │   ├── README.pretraining.md
│   │   │   │   ├── README.race.md
│   │   │   │   ├── 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
│   │   │   ├── scaling_nmt/
│   │   │   │   └── README.md
│   │   │   ├── speech_recognition/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── criterions/
│   │   │   │   │   ├── ASG_loss.py
│   │   │   │   │   ├── CTC_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
│   │   │   │   ├── models/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── vggtransformer.py
│   │   │   │   │   └── w2l_conv_glu_enc.py
│   │   │   │   ├── tasks/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── speech_recognition.py
│   │   │   │   ├── utils/
│   │   │   │   │   └── wer_utils.py
│   │   │   │   └── w2l_decoder.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
│   │   │   ├── wav2vec/
│   │   │   │   └── README.md
│   │   │   ├── wmt19/
│   │   │   │   └── README.md
│   │   │   └── xlmr/
│   │   │       └── README.md
│   │   ├── fairseq/
│   │   │   ├── __init__.py
│   │   │   ├── binarizer.py
│   │   │   ├── bleu.py
│   │   │   ├── checkpoint_utils.py
│   │   │   ├── clib/
│   │   │   │   ├── libbleu/
│   │   │   │   │   ├── libbleu.cpp
│   │   │   │   │   └── module.cpp
│   │   │   │   └── libnat/
│   │   │   │       └── edit_dist.cpp
│   │   │   ├── criterions/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── adaptive_loss.py
│   │   │   │   ├── binary_cross_entropy.py
│   │   │   │   ├── composite_loss.py
│   │   │   │   ├── cross_entropy.py
│   │   │   │   ├── fairseq_criterion.py
│   │   │   │   ├── label_smoothed_cross_entropy.py
│   │   │   │   ├── label_smoothed_cross_entropy_with_alignment.py
│   │   │   │   ├── legacy_masked_lm.py
│   │   │   │   ├── masked_lm.py
│   │   │   │   ├── nat_loss.py
│   │   │   │   ├── sentence_prediction.py
│   │   │   │   └── sentence_ranking.py
│   │   │   ├── data/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── append_token_dataset.py
│   │   │   │   ├── audio/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── raw_audio_dataset.py
│   │   │   │   ├── backtranslation_dataset.py
│   │   │   │   ├── base_wrapper_dataset.py
│   │   │   │   ├── colorize_dataset.py
│   │   │   │   ├── concat_dataset.py
│   │   │   │   ├── concat_sentences_dataset.py
│   │   │   │   ├── data_utils.py
│   │   │   │   ├── data_utils_fast.pyx
│   │   │   │   ├── denoising_dataset.py
│   │   │   │   ├── dictionary.py
│   │   │   │   ├── encoders/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── fastbpe.py
│   │   │   │   │   ├── gpt2_bpe.py
│   │   │   │   │   ├── gpt2_bpe_utils.py
│   │   │   │   │   ├── hf_bert_bpe.py
│   │   │   │   │   ├── moses_tokenizer.py
│   │   │   │   │   ├── nltk_tokenizer.py
│   │   │   │   │   ├── sentencepiece_bpe.py
│   │   │   │   │   ├── space_tokenizer.py
│   │   │   │   │   ├── subword_nmt_bpe.py
│   │   │   │   │   └── utils.py
│   │   │   │   ├── fairseq_dataset.py
│   │   │   │   ├── id_dataset.py
│   │   │   │   ├── indexed_dataset.py
│   │   │   │   ├── iterators.py
│   │   │   │   ├── language_pair_dataset.py
│   │   │   │   ├── legacy/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── 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_sampled_dataset.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
│   │   │   │   ├── sharded_dataset.py
│   │   │   │   ├── sort_dataset.py
│   │   │   │   ├── strip_token_dataset.py
│   │   │   │   ├── subsample_dataset.py
│   │   │   │   ├── token_block_dataset.py
│   │   │   │   ├── token_block_utils_fast.pyx
│   │   │   │   ├── transform_eos_dataset.py
│   │   │   │   ├── transform_eos_lang_pair_dataset.py
│   │   │   │   └── truncate_dataset.py
│   │   │   ├── distributed_utils.py
│   │   │   ├── file_utils.py
│   │   │   ├── hub_utils.py
│   │   │   ├── iterative_refinement_generator.py
│   │   │   ├── legacy_distributed_data_parallel.py
│   │   │   ├── meters.py
│   │   │   ├── models/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── bart/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── hub_interface.py
│   │   │   │   │   └── model.py
│   │   │   │   ├── cmlm_transformer.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
│   │   │   │   ├── insertion_transformer.py
│   │   │   │   ├── iterative_nonautoregressive_transformer.py
│   │   │   │   ├── levenshtein_transformer.py
│   │   │   │   ├── lightconv.py
│   │   │   │   ├── lightconv_lm.py
│   │   │   │   ├── lstm.py
│   │   │   │   ├── masked_lm.py
│   │   │   │   ├── model_utils.py
│   │   │   │   ├── multilingual_transformer.py
│   │   │   │   ├── nonautoregressive_ensembles.py
│   │   │   │   ├── nonautoregressive_transformer.py
│   │   │   │   ├── roberta/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── alignment_utils.py
│   │   │   │   │   ├── hub_interface.py
│   │   │   │   │   └── model.py
│   │   │   │   ├── transformer.py
│   │   │   │   ├── transformer_from_pretrained_xlm.py
│   │   │   │   ├── transformer_lm.py
│   │   │   │   └── wav2vec.py
│   │   │   ├── modules/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── adaptive_input.py
│   │   │   │   ├── adaptive_softmax.py
│   │   │   │   ├── beamable_mm.py
│   │   │   │   ├── character_token_embedder.py
│   │   │   │   ├── conv_tbc.py
│   │   │   │   ├── cuda_utils.cu
│   │   │   │   ├── downsampled_multihead_attention.py
│   │   │   │   ├── dynamic_convolution.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
│   │   │   │   ├── gelu.py
│   │   │   │   ├── grad_multiply.py
│   │   │   │   ├── highway.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
│   │   │   │   ├── logsumexp_moe.py
│   │   │   │   ├── mean_pool_gating_network.py
│   │   │   │   ├── multihead_attention.py
│   │   │   │   ├── positional_embedding.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
│   │   │   │   ├── unfold.py
│   │   │   │   └── vggblock.py
│   │   │   ├── optim/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── adadelta.py
│   │   │   │   ├── adafactor.py
│   │   │   │   ├── adagrad.py
│   │   │   │   ├── adam.py
│   │   │   │   ├── adamax.py
│   │   │   │   ├── bmuf.py
│   │   │   │   ├── fairseq_optimizer.py
│   │   │   │   ├── fp16_optimizer.py
│   │   │   │   ├── lr_scheduler/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── cosine_lr_scheduler.py
│   │   │   │   │   ├── fairseq_lr_scheduler.py
│   │   │   │   │   ├── fixed_schedule.py
│   │   │   │   │   ├── inverse_square_root_schedule.py
│   │   │   │   │   ├── polynomial_decay_schedule.py
│   │   │   │   │   ├── reduce_lr_on_plateau.py
│   │   │   │   │   ├── tri_stage_lr_scheduler.py
│   │   │   │   │   └── triangular_lr_scheduler.py
│   │   │   │   ├── nag.py
│   │   │   │   └── sgd.py
│   │   │   ├── options.py
│   │   │   ├── pdb.py
│   │   │   ├── progress_bar.py
│   │   │   ├── registry.py
│   │   │   ├── search.py
│   │   │   ├── sequence_generator.py
│   │   │   ├── sequence_scorer.py
│   │   │   ├── tasks/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── audio_pretraining.py
│   │   │   │   ├── cross_lingual_lm.py
│   │   │   │   ├── denoising.py
│   │   │   │   ├── fairseq_task.py
│   │   │   │   ├── language_modeling.py
│   │   │   │   ├── legacy_masked_lm.py
│   │   │   │   ├── masked_lm.py
│   │   │   │   ├── multilingual_masked_lm.py
│   │   │   │   ├── multilingual_translation.py
│   │   │   │   ├── semisupervised_translation.py
│   │   │   │   ├── sentence_prediction.py
│   │   │   │   ├── sentence_ranking.py
│   │   │   │   ├── translation.py
│   │   │   │   ├── translation_from_pretrained_xlm.py
│   │   │   │   ├── translation_lev.py
│   │   │   │   └── translation_moe.py
│   │   │   ├── tokenizer.py
│   │   │   ├── trainer.py
│   │   │   └── utils.py
│   │   ├── fairseq_cli/
│   │   │   └── __init__.py
│   │   ├── generate.py
│   │   ├── hubconf.py
│   │   ├── interactive.py
│   │   ├── preprocess.py
│   │   ├── score.py
│   │   ├── scripts/
│   │   │   ├── __init__.py
│   │   │   ├── average_checkpoints.py
│   │   │   ├── build_sym_alignment.py
│   │   │   ├── compare_namespaces.py
│   │   │   ├── compound_split_bleu.sh
│   │   │   ├── convert_dictionary.lua
│   │   │   ├── convert_model.lua
│   │   │   ├── count_docs.py
│   │   │   ├── read_binarized.py
│   │   │   ├── rm_pt.py
│   │   │   ├── sacrebleu_pregen.sh
│   │   │   ├── shard_docs.py
│   │   │   ├── split_train_valid_docs.py
│   │   │   ├── spm_decode.py
│   │   │   ├── spm_encode.py
│   │   │   ├── spm_train.py
│   │   │   ├── wav2vec_featurize.py
│   │   │   └── wav2vec_manifest.py
│   │   ├── setup.py
│   │   ├── tests/
│   │   │   ├── __init__.py
│   │   │   ├── speech_recognition/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── asr_test_base.py
│   │   │   │   ├── test_collaters.py
│   │   │   │   ├── test_cross_entropy.py
│   │   │   │   └── test_vggtransformer.py
│   │   │   ├── test_average_checkpoints.py
│   │   │   ├── test_backtranslation_dataset.py
│   │   │   ├── test_binaries.py
│   │   │   ├── test_bmuf.py
│   │   │   ├── test_character_token_embedder.py
│   │   │   ├── test_concat_dataset.py
│   │   │   ├── test_convtbc.py
│   │   │   ├── test_dictionary.py
│   │   │   ├── test_iterators.py
│   │   │   ├── test_label_smoothing.py
│   │   │   ├── test_memory_efficient_fp16.py
│   │   │   ├── test_multi_corpus_sampled_dataset.py
│   │   │   ├── test_multihead_attention.py
│   │   │   ├── test_noising.py
│   │   │   ├── test_reproducibility.py
│   │   │   ├── test_resampling_dataset.py
│   │   │   ├── test_sequence_generator.py
│   │   │   ├── test_sequence_scorer.py
│   │   │   ├── test_sparse_multihead_attention.py
│   │   │   ├── test_token_block_dataset.py
│   │   │   ├── test_train.py
│   │   │   ├── test_utils.py
│   │   │   └── utils.py
│   │   ├── train.py
│   │   └── validate.py
│   ├── src-infoxlm/
│   │   ├── infoxlm/
│   │   │   ├── __init__.py
│   │   │   ├── criterions/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── xlco.py
│   │   │   │   └── xlm_align.py
│   │   │   ├── data/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── dict_dataset.py
│   │   │   │   ├── mlm_utils.py
│   │   │   │   ├── offset_dataset.py
│   │   │   │   ├── tlm_dataset.py
│   │   │   │   ├── xlco_dataset.py
│   │   │   │   └── xlm_align.py
│   │   │   ├── models/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── infoxlm.py
│   │   │   │   ├── roberta.py
│   │   │   │   └── xlm_align.py
│   │   │   ├── tasks/
│   │   │   │   ├── __init__.py
│   │   │   │   ├── infoxlm.py
│   │   │   │   ├── mlm.py
│   │   │   │   ├── tlm.py
│   │   │   │   └── xlm_align.py
│   │   │   └── utils.py
│   │   ├── setup.py
│   │   └── train.py
│   └── tools/
│       ├── para2bin.py
│       ├── para2bin4xlco.py
│       └── txt2bin.py
├── kosmos-1/
│   └── README.md
├── kosmos-2/
│   ├── README.md
│   ├── data/
│   │   ├── dict.txt
│   │   ├── generate_config.py
│   │   ├── prepare_grit.py
│   │   ├── sentencepiece.bpe.model
│   │   └── visualize_grit.py
│   ├── demo/
│   │   ├── decode_string.py
│   │   ├── draw_box.py
│   │   └── gradio_app.py
│   ├── docs/
│   │   └── install.md
│   ├── evaluation/
│   │   ├── caption_obj_few_shot.py
│   │   ├── caption_obj_qa.py
│   │   ├── flickr_entities/
│   │   │   ├── README.md
│   │   │   ├── cook_data.py
│   │   │   ├── decode_string.py
│   │   │   └── flickr_entities_evaluate.py
│   │   ├── grd-zeroshot-flickr.sh
│   │   ├── grd-zeroshot-refcoco.sh
│   │   ├── refcoco/
│   │   │   ├── README.md
│   │   │   ├── box_ops.py
│   │   │   ├── cook_data.py
│   │   │   ├── decode_string.py
│   │   │   └── refexp_evaluate.py
│   │   ├── seed-bench/
│   │   │   ├── README.md
│   │   │   ├── cook_image_data.py
│   │   │   └── eval_ppl.py
│   │   └── zeroshot-seed-bench.sh
│   ├── fairseq/
│   │   ├── .circleci/
│   │   │   └── config.yml
│   │   ├── .github/
│   │   │   ├── ISSUE_TEMPLATE/
│   │   │   │   ├── bug_report.md
│   │   │   │   ├── documentation.md
│   │   │   │   ├── feature_request.md
│   │   │   │   └── how-to-question.md
│   │   │   ├── ISSUE_TEMPLATE.md
│   │   │   ├── PULL_REQUEST_TEMPLATE.md
│   │   │   ├── stale.yml
│   │   │   └── workflows/
│   │   │       ├── build.yml
│   │   │       └── build_wheels.yml
│   │   ├── .gitignore
│   │   ├── .gitmodules
│   │   ├── .isort.cfg
│   │   ├── .pre-commit-config.yaml
│   │   ├── CODE_OF_CONDUCT.md
│   │   ├── CONTRIBUTING.md
│   │   ├── LICENSE
│   │   ├── README.md
│   │   ├── docs/
│   │   │   ├── Makefile
│   │   │   ├── _static/
│   │   │   │   └── theme_overrides.css
│   │   │   ├── command_line_tools.rst
│   │   │   ├── conf.py
│   │   │   ├── criterions.rst
│   │   │   ├── data.rst
│   │   │   ├── docutils.conf
│   │   │   ├── 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
│   │   │   ├── MMPT/
│   │   │   │   ├── .gitignore
│   │   │   │   ├── CONFIG.md
│   │   │   │   ├── DATASET.md
│   │   │   │   ├── README.md
│   │   │   │   ├── endtask.md
│   │   │   │   ├── locallaunch.py
│   │   │   │   ├── mmpt/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── datasets/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── fairseqmmdataset.py
│   │   │   │   │   │   └── mmdataset.py
│   │   │   │   │   ├── evaluators/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── evaluator.py
│   │   │   │   │   │   ├── metric.py
│   │   │   │   │   │   └── predictor.py
│   │   │   │   │   ├── losses/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── fairseqmmloss.py
│   │   │   │   │   │   ├── loss.py
│   │   │   │   │   │   └── nce.py
│   │   │   │   │   ├── models/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── fairseqmmmodel.py
│   │   │   │   │   │   ├── mmfusion.py
│   │   │   │   │   │   ├── mmfusionnlg.py
│   │   │   │   │   │   └── transformermodel.py
│   │   │   │   │   ├── modules/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── mm.py
│   │   │   │   │   │   ├── retri.py
│   │   │   │   │   │   └── vectorpool.py
│   │   │   │   │   ├── processors/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── dedupprocessor.py
│   │   │   │   │   │   ├── dsprocessor.py
│   │   │   │   │   │   ├── how2processor.py
│   │   │   │   │   │   ├── how2retriprocessor.py
│   │   │   │   │   │   ├── models/
│   │   │   │   │   │   │   └── s3dg.py
│   │   │   │   │   │   └── processor.py
│   │   │   │   │   ├── tasks/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── fairseqmmtask.py
│   │   │   │   │   │   ├── milncetask.py
│   │   │   │   │   │   ├── retritask.py
│   │   │   │   │   │   ├── task.py
│   │   │   │   │   │   └── vlmtask.py
│   │   │   │   │   └── utils/
│   │   │   │   │       ├── __init__.py
│   │   │   │   │       ├── load_config.py
│   │   │   │   │       └── shardedtensor.py
│   │   │   │   ├── mmpt_cli/
│   │   │   │   │   ├── localjob.py
│   │   │   │   │   └── predict.py
│   │   │   │   ├── pretraining.md
│   │   │   │   ├── projects/
│   │   │   │   │   ├── mfmmlm.yaml
│   │   │   │   │   ├── mtm/
│   │   │   │   │   │   ├── mmfusionmtm.yaml
│   │   │   │   │   │   ├── vlm/
│   │   │   │   │   │   │   ├── coin.yaml
│   │   │   │   │   │   │   ├── crosstask.yaml
│   │   │   │   │   │   │   ├── how2.yaml
│   │   │   │   │   │   │   ├── test_coin.yaml
│   │   │   │   │   │   │   ├── test_crosstask.yaml
│   │   │   │   │   │   │   ├── test_crosstask_zs.yaml
│   │   │   │   │   │   │   ├── test_vtt.yaml
│   │   │   │   │   │   │   ├── test_vttqa.yaml
│   │   │   │   │   │   │   ├── test_youcook.yaml
│   │   │   │   │   │   │   ├── test_youcookcap.yaml
│   │   │   │   │   │   │   ├── vtt.yaml
│   │   │   │   │   │   │   ├── vttqa.yaml
│   │   │   │   │   │   │   ├── youcook.yaml
│   │   │   │   │   │   │   └── youcookcap.yaml
│   │   │   │   │   │   └── vlm.yaml
│   │   │   │   │   ├── retri/
│   │   │   │   │   │   ├── videoclip/
│   │   │   │   │   │   │   ├── coin_videoclip.yaml
│   │   │   │   │   │   │   ├── crosstask_videoclip.yaml
│   │   │   │   │   │   │   ├── how2.yaml
│   │   │   │   │   │   │   ├── test_coin_videoclip.yaml
│   │   │   │   │   │   │   ├── test_coin_zs.yaml
│   │   │   │   │   │   │   ├── test_crosstask_videoclip.yaml
│   │   │   │   │   │   │   ├── test_crosstask_zs_videoclip.yaml
│   │   │   │   │   │   │   ├── test_didemo_zs.yaml
│   │   │   │   │   │   │   ├── test_vtt_videoclip.yaml
│   │   │   │   │   │   │   ├── test_vtt_zs.yaml
│   │   │   │   │   │   │   ├── test_vttqa_videoclip.yaml
│   │   │   │   │   │   │   ├── test_vttqa_zs.yaml
│   │   │   │   │   │   │   ├── test_youcook_videoclip.yaml
│   │   │   │   │   │   │   ├── test_youcook_zs.yaml
│   │   │   │   │   │   │   ├── vtt_videoclip.yaml
│   │   │   │   │   │   │   ├── vttqa_videoclip.yaml
│   │   │   │   │   │   │   └── youcook_videoclip.yaml
│   │   │   │   │   │   ├── videoclip.yaml
│   │   │   │   │   │   └── videoretri.yaml
│   │   │   │   │   └── task/
│   │   │   │   │       ├── coin.yaml
│   │   │   │   │       ├── coin_videoclip.yaml
│   │   │   │   │       ├── crosstask.yaml
│   │   │   │   │       ├── crosstask_videoclip.yaml
│   │   │   │   │       ├── default.yaml
│   │   │   │   │       ├── ft.yaml
│   │   │   │   │       ├── how2.yaml
│   │   │   │   │       ├── test.yaml
│   │   │   │   │       ├── test_coin.yaml
│   │   │   │   │       ├── test_coin_videoclip.yaml
│   │   │   │   │       ├── test_coin_zs.yaml
│   │   │   │   │       ├── test_crosstask.yaml
│   │   │   │   │       ├── test_crosstask_videoclip.yaml
│   │   │   │   │       ├── test_crosstask_zs.yaml
│   │   │   │   │       ├── test_crosstask_zs_videoclip.yaml
│   │   │   │   │       ├── test_didemo_zs.yaml
│   │   │   │   │       ├── test_vtt.yaml
│   │   │   │   │       ├── test_vtt_videoclip.yaml
│   │   │   │   │       ├── test_vtt_zs.yaml
│   │   │   │   │       ├── test_vttqa.yaml
│   │   │   │   │       ├── test_vttqa_videoclip.yaml
│   │   │   │   │       ├── test_vttqa_zs.yaml
│   │   │   │   │       ├── test_youcook.yaml
│   │   │   │   │       ├── test_youcook_videoclip.yaml
│   │   │   │   │       ├── test_youcook_zs.yaml
│   │   │   │   │       ├── test_youcookcap.yaml
│   │   │   │   │       ├── vtt.yaml
│   │   │   │   │       ├── vtt_videoclip.yaml
│   │   │   │   │       ├── vttqa.yaml
│   │   │   │   │       ├── vttqa_videoclip.yaml
│   │   │   │   │       ├── youcook.yaml
│   │   │   │   │       ├── youcook_videoclip.yaml
│   │   │   │   │       └── youcookcap.yaml
│   │   │   │   ├── scripts/
│   │   │   │   │   ├── text_token_extractor/
│   │   │   │   │   │   ├── configs/
│   │   │   │   │   │   │   └── bert-base-uncased.yaml
│   │   │   │   │   │   └── pretokenization.py
│   │   │   │   │   └── video_feature_extractor/
│   │   │   │   │       ├── extract.py
│   │   │   │   │       ├── how2/
│   │   │   │   │       │   └── s3d.sh
│   │   │   │   │       ├── model.py
│   │   │   │   │       ├── pathbuilder.py
│   │   │   │   │       ├── preprocessing.py
│   │   │   │   │       ├── random_sequence_shuffler.py
│   │   │   │   │       ├── shard_feature.py
│   │   │   │   │       └── videoreader.py
│   │   │   │   └── setup.py
│   │   │   ├── __init__.py
│   │   │   ├── 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
│   │   │   ├── attention_head_selection/
│   │   │   │   ├── README.md
│   │   │   │   └── src/
│   │   │   │       ├── __init__.py
│   │   │   │       ├── data/
│   │   │   │       │   ├── __init__.py
│   │   │   │       │   └── speech_to_text_dataset_with_domain.py
│   │   │   │       ├── loss/
│   │   │   │       │   ├── __init__.py
│   │   │   │       │   └── attention_head_selection.py
│   │   │   │       ├── models/
│   │   │   │       │   ├── __init__.py
│   │   │   │       │   ├── head_selection_s2t_transformer.py
│   │   │   │       │   └── head_selection_transformer.py
│   │   │   │       ├── modules/
│   │   │   │       │   ├── __init__.py
│   │   │   │       │   ├── attn_head_selector.py
│   │   │   │       │   ├── head_selection_transformer_layer.py
│   │   │   │       │   ├── multihead_attention_selection.py
│   │   │   │       │   └── multihead_functional.py
│   │   │   │       └── speech_to_text_head_selection.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
│   │   │   ├── discriminative_reranking_nmt/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── config/
│   │   │   │   │   └── deen.yaml
│   │   │   │   ├── criterions/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── discriminative_reranking_criterion.py
│   │   │   │   ├── drnmt_rerank.py
│   │   │   │   ├── models/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   └── discriminative_reranking_model.py
│   │   │   │   ├── scripts/
│   │   │   │   │   └── prep_data.py
│   │   │   │   └── tasks/
│   │   │   │       ├── __init__.py
│   │   │   │       └── discriminative_reranking_task.py
│   │   │   ├── fast_noisy_channel/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── noisy_channel_beam_search.py
│   │   │   │   ├── noisy_channel_sequence_generator.py
│   │   │   │   └── noisy_channel_translation.py
│   │   │   ├── flores101/
│   │   │   │   └── README.md
│   │   │   ├── 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
│   │   │   │   │   ├── dump_w2v2_feature.py
│   │   │   │   │   ├── feature_utils.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
│   │   │   ├── moe_lm/
│   │   │   │   ├── README.md
│   │   │   │   ├── data_card.md
│   │   │   │   └── model_card.md
│   │   │   ├── 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
│   │   │   ├── normformer/
│   │   │   │   ├── README.md
│   │   │   │   └── train_lm.sh
│   │   │   ├── operators/
│   │   │   │   ├── alignment_train_cpu.cpp
│   │   │   │   ├── alignment_train_cuda.cpp
│   │   │   │   ├── alignment_train_cuda.h
│   │   │   │   ├── alignment_train_kernel.cu
│   │   │   │   └── utils.h
│   │   │   ├── 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
│   │   │   │   ├── commonsense_qa/
│   │   │   │   │   ├── README.md
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── commonsense_qa_task.py
│   │   │   │   │   └── download_cqa_data.sh
│   │   │   │   ├── config/
│   │   │   │   │   ├── finetuning/
│   │   │   │   │   │   ├── cola.yaml
│   │   │   │   │   │   ├── mnli.yaml
│   │   │   │   │   │   ├── mrpc.yaml
│   │   │   │   │   │   ├── qnli.yaml
│   │   │   │   │   │   ├── qqp.yaml
│   │   │   │   │   │   ├── rte.yaml
│   │   │   │   │   │   ├── sst_2.yaml
│   │   │   │   │   │   └── sts_b.yaml
│   │   │   │   │   └── pretraining/
│   │   │   │   │       └── base.yaml
│   │   │   │   ├── 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
│   │   │   ├── shuffled_word_order/
│   │   │   │   ├── README.finetuning.md
│   │   │   │   └── README.md
│   │   │   ├── simultaneous_translation/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── docs/
│   │   │   │   │   ├── ende-mma.md
│   │   │   │   │   └── enja-waitk.md
│   │   │   │   ├── eval/
│   │   │   │   │   └── agents/
│   │   │   │   │       └── simul_t2t_enja.py
│   │   │   │   ├── models/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── convtransformer_simul_trans.py
│   │   │   │   │   └── transformer_monotonic_attention.py
│   │   │   │   ├── modules/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── fixed_pre_decision.py
│   │   │   │   │   ├── monotonic_multihead_attention.py
│   │   │   │   │   └── monotonic_transformer_layer.py
│   │   │   │   └── utils/
│   │   │   │       ├── __init__.py
│   │   │   │       ├── functions.py
│   │   │   │       ├── monotonic_attention.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_synthesis/
│   │   │   │   ├── README.md
│   │   │   │   ├── __init__.py
│   │   │   │   ├── data_utils.py
│   │   │   │   ├── docs/
│   │   │   │   │   ├── common_voice_example.md
│   │   │   │   │   ├── ljspeech_example.md
│   │   │   │   │   └── vctk_example.md
│   │   │   │   ├── evaluation/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── eval_asr.py
│   │   │   │   │   ├── eval_f0.py
│   │   │   │   │   ├── eval_sp.py
│   │   │   │   │   └── get_eval_manifest.py
│   │   │   │   ├── generate_waveform.py
│   │   │   │   ├── preprocessing/
│   │   │   │   │   ├── __init__.py
│   │   │   │   │   ├── denoise_and_vad_audio.py
│   │   │   │   │   ├── denoiser/
│   │   │   │   │   │   ├── __init__.py
│   │   │   │   │   │   ├── demucs.py
│   │   │   │   │   │   ├── pretrained.py
│   │   │   │   │   │   ├── resample.py
│   │   │   │   │   │   └── utils.py
│   │   │   │   │   ├── get_common_voice_audio_manifest.py
│   │   │   │   │   ├── get_feature_manifest.py
│   │   │   │   │   ├── get_ljspeech_audio_manifest.py
│   │   │   │   │   ├── get_speaker_embedding.py
│   │   │   │   │   ├── get_vctk_audio_manifest.py
│   │   │   │   │   ├── speaker_embedder/
│   │   │   │   │   │   └── __init__.py
│   │   │   │   │   └── vad/
│   │   │   │   │    
Download .txt
SYMBOL INDEX (1686 symbols across 245 files)

FILE: Diff-Transformer/Diff-Transformer-V2/multihead_flashdiffv2.py
  function diff_func (line 9) | def diff_func(attn1: torch.Tensor, attn2: torch.Tensor, lambda_val: torc...
  class MultiheadFlashDiffV2 (line 13) | class MultiheadFlashDiffV2(nn.Module):
    method __init__ (line 17) | def __init__(
    method forward (line 39) | def forward(

FILE: Diff-Transformer/kernel/rotary.py
  function rotary_kernel (line 21) | def rotary_kernel(
  function apply_rotary (line 144) | def apply_rotary(
  class ApplyRotaryEmb (line 242) | class ApplyRotaryEmb(torch.autograd.Function):
    method forward (line 244) | def forward(
    method backward (line 278) | def backward(ctx, do):
  function apply_rotary_emb (line 302) | def apply_rotary_emb(

FILE: Diff-Transformer/multihead_attention.py
  function repeat_kv (line 15) | def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor:
  class MultiheadAttention (line 27) | class MultiheadAttention(nn.Module):
    method __init__ (line 28) | def __init__(
    method forward (line 51) | def forward(

FILE: Diff-Transformer/multihead_diffattn.py
  function repeat_kv (line 15) | def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor:
  function lambda_init_fn (line 26) | def lambda_init_fn(depth):
  class MultiheadDiffAttn (line 30) | class MultiheadDiffAttn(nn.Module):
    method __init__ (line 31) | def __init__(
    method forward (line 69) | def forward(

FILE: Diff-Transformer/multihead_flashdiff_1.py
  function repeat_kv (line 15) | def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor:
  function lambda_init_fn (line 26) | def lambda_init_fn(depth):
  class MultiheadFlashDiff1 (line 30) | class MultiheadFlashDiff1(nn.Module):
    method __init__ (line 36) | def __init__(
    method forward (line 74) | def forward(

FILE: Diff-Transformer/multihead_flashdiff_2.py
  function repeat_kv (line 15) | def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor:
  function lambda_init_fn (line 26) | def lambda_init_fn(depth):
  class MultiheadFlashDiff2 (line 30) | class MultiheadFlashDiff2(nn.Module):
    method __init__ (line 35) | def __init__(
    method forward (line 73) | def forward(

FILE: Diff-Transformer/rms_norm.py
  class RMSNorm (line 4) | class RMSNorm(nn.Module):
    method __init__ (line 5) | def __init__(self, dim: int, eps: float = 1e-6, elementwise_affine=Tru...
    method _norm (line 15) | def _norm(self, x):
    method forward (line 18) | def forward(self, x):
    method extra_repr (line 24) | def extra_repr(self) -> str:

FILE: LatentLM/evaluate_fid.py
  function parse_args (line 21) | def parse_args():
  function suppress_output (line 101) | def suppress_output(rank):
  function main (line 107) | def main(args):

FILE: LatentLM/evaluate_fid_fidelity.py
  function parse_args (line 11) | def parse_args():
  class ImageDataset (line 69) | class ImageDataset(torch.utils.data.Dataset):
    method __init__ (line 70) | def __init__(self, images):
    method __len__ (line 73) | def __len__(self):
    method __getitem__ (line 76) | def __getitem__(self, idx):
  class RefImageDataset (line 79) | class RefImageDataset(torch.utils.data.Dataset):
    method __init__ (line 80) | def __init__(self, dataset):
    method __len__ (line 83) | def __len__(self):
    method __getitem__ (line 86) | def __getitem__(self, idx):
  function main (line 93) | def main(args):

FILE: LatentLM/inference_speed.py
  function parse_args (line 16) | def parse_args():
  function suppress_output (line 102) | def suppress_output(rank):
  function main (line 108) | def main(args):

FILE: LatentLM/metrics/IS.py
  function inception_softmax (line 16) | def inception_softmax(inception_model, images):
  function calculate_kl_div (line 24) | def calculate_kl_div(ps, splits: int):
  function compute_inception_score_from_dataset (line 40) | def compute_inception_score_from_dataset(dataset,
  function compute_inception_score_from_files (line 70) | def compute_inception_score_from_files(path,
  function compute_inception_score_from_tensor (line 86) | def compute_inception_score_from_tensor(tensor,

FILE: LatentLM/metrics/fid.py
  class InceptionWrapper (line 19) | class InceptionWrapper(InceptionV3):
    method forward (line 21) | def forward(self, inp):
    method get_logits (line 31) | def get_logits(self, inp):
  function get_inception_model (line 37) | def get_inception_model(dims=2048):
  function mean_covar_torch (line 43) | def mean_covar_torch(xs):
  function mean_covar_numpy (line 51) | def mean_covar_numpy(xs):
  function frechet_distance (line 57) | def frechet_distance(mu1, sigma1, mu2, sigma2, eps=1e-6):
  function compute_statistics_dataset (line 115) | def compute_statistics_dataset(dataset,
  function create_dataset_from_files (line 191) | def create_dataset_from_files(path, verbose=False):
  function compute_activations_from_dataset (line 222) | def compute_activations_from_dataset(dataset,
  function compute_statistics_from_files (line 247) | def compute_statistics_from_files(path,
  function compute_statistics_from_tensor (line 265) | def compute_statistics_from_tensor(tensor,
  function compute_rfid (line 283) | def compute_rfid(dataset,
  function compute_fid (line 299) | def compute_fid(fake_path,
  function compute_fid_without_store (line 331) | def compute_fid_without_store(tensor, ref_stat_path, batch_size=64, devi...

FILE: LatentLM/metrics/inception.py
  class InceptionV3 (line 15) | class InceptionV3(nn.Module):
    method __init__ (line 30) | def __init__(self,
    method forward (line 133) | def forward(self, inp, return_logits=False):
  function _inception_v3 (line 176) | def _inception_v3(*args, **kwargs):
  function fid_inception_v3 (line 187) | def fid_inception_v3():
  class FIDInceptionA (line 214) | class FIDInceptionA(torchvision.models.inception.InceptionA):
    method __init__ (line 216) | def __init__(self, in_channels, pool_features):
    method forward (line 219) | def forward(self, x):
  class FIDInceptionC (line 239) | class FIDInceptionC(torchvision.models.inception.InceptionC):
    method __init__ (line 241) | def __init__(self, in_channels, channels_7x7):
    method forward (line 244) | def forward(self, x):
  class FIDInceptionE_1 (line 267) | class FIDInceptionE_1(torchvision.models.inception.InceptionE):
    method __init__ (line 269) | def __init__(self, in_channels):
    method forward (line 272) | def forward(self, x):
  class FIDInceptionE_2 (line 300) | class FIDInceptionE_2(torchvision.models.inception.InceptionE):
    method __init__ (line 302) | def __init__(self, in_channels):
    method forward (line 305) | def forward(self, x):

FILE: LatentLM/models/DiT.py
  function modulate (line 21) | def modulate(x, shift, scale):
  class TimestepEmbedder (line 29) | class TimestepEmbedder(nn.Module):
    method __init__ (line 33) | def __init__(self, hidden_size, frequency_embedding_size=256):
    method timestep_embedding (line 43) | def timestep_embedding(t, dim, max_period=10000):
    method forward (line 63) | def forward(self, t):
  class LabelEmbedder (line 69) | class LabelEmbedder(nn.Module):
    method __init__ (line 73) | def __init__(self, num_classes, hidden_size, dropout_prob):
    method token_drop (line 80) | def token_drop(self, labels, force_drop_ids=None):
    method forward (line 91) | def forward(self, labels, train, force_drop_ids=None):
  class SwiGLU (line 99) | class SwiGLU(nn.Module):
    method __init__ (line 100) | def __init__(
    method forward (line 113) | def forward(self, x):
  class Attention (line 126) | class Attention(nn.Module):
    method __init__ (line 127) | def __init__(self, dim, num_heads=8, num_kv_heads=8, qkv_bias=False, a...
    method forward (line 142) | def forward(self, x):
  class DiTBlock (line 157) | class DiTBlock(nn.Module):
    method __init__ (line 161) | def __init__(self, hidden_size, num_heads, num_kv_heads, mlp_ratio=4.0...
    method forward (line 173) | def forward(self, x, c):
  class FinalLayer (line 180) | class FinalLayer(nn.Module):
    method __init__ (line 184) | def __init__(self, hidden_size, output_size):
    method forward (line 193) | def forward(self, x, c):
  class DiT (line 200) | class DiT(nn.Module):
    method __init__ (line 204) | def __init__(
    method device (line 243) | def device(self):
    method dtype (line 247) | def dtype(self):
    method initialize_weights (line 250) | def initialize_weights(self):
    method unpatchify (line 282) | def unpatchify(self, x):
    method forward (line 297) | def forward(self, x_noise, t, y, **kwargs):
    method sample_with_cfg (line 315) | def sample_with_cfg(self, y, cfg_scale, sample_func):
    method forward_with_cfg (line 322) | def forward_with_cfg(self, x, t, y, cfg_scale):
  function get_2d_sincos_pos_embed (line 341) | def get_2d_sincos_pos_embed(embed_dim, grid_size, cls_token=False, extra...
  function get_1d_sincos_pos_embed (line 358) | def get_1d_sincos_pos_embed(embed_dim, seq_len, cls_token=False, extra_t...
  function get_2d_sincos_pos_embed_from_grid (line 370) | def get_2d_sincos_pos_embed_from_grid(embed_dim, grid):
  function get_1d_sincos_pos_embed_from_grid (line 381) | def get_1d_sincos_pos_embed_from_grid(embed_dim, pos):
  function DiT_13B (line 406) | def DiT_13B(**kwargs):
  function DiT_7B (line 409) | def DiT_7B(**kwargs):
  function DiT_3B (line 412) | def DiT_3B(**kwargs):
  function DiT_XL (line 415) | def DiT_XL(**kwargs):
  function DiT_Large (line 418) | def DiT_Large(**kwargs):
  function DiT_Medium (line 421) | def DiT_Medium(**kwargs):
  function DiT_Base (line 424) | def DiT_Base(**kwargs):

FILE: LatentLM/models/EMA.py
  class EMAModel (line 7) | class EMAModel:
    method __init__ (line 12) | def __init__(
    method get_decay (line 60) | def get_decay(self, optimization_step: int) -> float:
    method step (line 80) | def step(self, parameters: Iterable[torch.nn.Parameter]):
    method to (line 95) | def to(self, device=None, dtype=None) -> None:
    method state_dict (line 107) | def state_dict(self) -> dict:
    method load_state_dict (line 123) | def load_state_dict(self, state_dict: dict) -> None:

FILE: LatentLM/models/RMSNorm.py
  class RMSNorm (line 4) | class RMSNorm(nn.Module):
    method __init__ (line 5) | def __init__(self, dim: int, eps: float = 1e-6, elementwise_affine=True):
    method _norm (line 15) | def _norm(self, x):
    method forward (line 18) | def forward(self, x):
    method extra_repr (line 24) | def extra_repr(self) -> str:

FILE: LatentLM/models/Transformer.py
  function repeat_kv (line 27) | def repeat_kv(x: torch.Tensor, n_rep: int) -> torch.Tensor:
  class Attention (line 38) | class Attention(nn.Module):
    method __init__ (line 39) | def __init__(self, dim, num_heads=8, num_kv_heads=8, qkv_bias=False, a...
    method forward (line 54) | def forward(self, x, start_pos, rel_pos, incremental_state=None):
  class Block (line 82) | class Block(nn.Module):
    method __init__ (line 83) | def __init__(self, hidden_size, num_heads, num_kv_heads, mlp_ratio=4.0...
    method forward (line 91) | def forward(self, x, start_pos, rel_pos, incremental_state=None):
  class MLPBlock (line 96) | class MLPBlock(nn.Module):
    method __init__ (line 97) | def __init__(self, hidden_size,  mlp_ratio=4.0, drop=0.0, **block_kwar...
    method forward (line 107) | def forward(self, x, c):
  class ConditionLayer (line 112) | class ConditionLayer(nn.Module):
    method __init__ (line 113) | def __init__(self, hidden_size):
    method forward (line 118) | def forward(self, x):
  class Transformer (line 123) | class Transformer(nn.Module):
    method __init__ (line 124) | def __init__(
    method initialize_weights (line 172) | def initialize_weights(self):
    method device (line 197) | def device(self):
    method dtype (line 201) | def dtype(self):
    method unpatchify (line 204) | def unpatchify(self, x):
    method build_rel_pos (line 219) | def build_rel_pos(self, x, start_pos = 0):
    method forward (line 231) | def forward(self, x_noise, t, x_start, y, batch_mul=1):
    method forward_parallel (line 243) | def forward_parallel(self, x, y):
    method forward_recurrent (line 254) | def forward_recurrent(self, x, start_pos = 0, incremental_state = None):
    method forward_diffusion (line 269) | def forward_diffusion(self, x, t, condition):
    method sample_with_cfg (line 283) | def sample_with_cfg(self, prev_token, cfg_scale, sample_func):
    method forward_with_cfg (line 305) | def forward_with_cfg(self, x, t, condition, cfg_scale):
  function Transformer_13B (line 322) | def Transformer_13B(**kwargs):
  function Transformer_7B (line 325) | def Transformer_7B(**kwargs):
  function Transformer_3B (line 328) | def Transformer_3B(**kwargs):
  function Transformer_XL (line 331) | def Transformer_XL(**kwargs):
  function Transformer_Large (line 334) | def Transformer_Large(**kwargs):
  function Transformer_Medium (line 337) | def Transformer_Medium(**kwargs):
  function Transformer_Base (line 340) | def Transformer_Base(**kwargs):
  function Transformer_H (line 343) | def Transformer_H(**kwargs):
  function Transformer_L (line 346) | def Transformer_L(**kwargs):
  function Transformer_B (line 349) | def Transformer_B(**kwargs):

FILE: LatentLM/models/kernel/rotary.py
  function rotary_kernel (line 21) | def rotary_kernel(
  function apply_rotary (line 144) | def apply_rotary(
  class ApplyRotaryEmb (line 242) | class ApplyRotaryEmb(torch.autograd.Function):
    method forward (line 244) | def forward(
    method backward (line 278) | def backward(ctx, do):
  function apply_rotary_emb (line 302) | def apply_rotary_emb(
  function rotate_every_two (line 334) | def rotate_every_two(x):
  function apply_rotary_pos_emb (line 340) | def apply_rotary_pos_emb(x, cos, sin, interleaved=False):

FILE: LatentLM/models/kernel/swiglu.py
  class SwiGLUFunction (line 20) | class SwiGLUFunction(torch.autograd.Function):
    method forward (line 23) | def forward(ctx, x, y):
    method backward (line 28) | def backward(ctx, dout):

FILE: LatentLM/sample_hf.py
  function parse_args (line 17) | def parse_args():
  function main (line 92) | def main(args):

FILE: LatentLM/sample_many.py
  function parse_args (line 25) | def parse_args():
  function main (line 102) | def main(args):

FILE: LatentLM/schedule/ddpm.py
  class DDPMSchedulerOutput (line 31) | class DDPMSchedulerOutput(BaseOutput):
  function betas_for_alpha_bar (line 48) | def betas_for_alpha_bar(
  function rescale_zero_terminal_snr (line 107) | def rescale_zero_terminal_snr(betas):
  class DDPMScheduler (line 143) | class DDPMScheduler(SchedulerMixin, ConfigMixin):
    method __init__ (line 195) | def __init__(
    method scale_model_input (line 252) | def scale_model_input(self, sample: torch.Tensor, timestep: Optional[i...
    method set_timesteps (line 269) | def set_timesteps(
    method _get_variance (line 344) | def _get_variance(self, t, predicted_variance=None, variance_type=None):
    method _threshold_sample (line 384) | def _threshold_sample(self, sample: torch.Tensor) -> torch.Tensor:
    method step (line 417) | def step(
    method add_noise (line 517) | def add_noise(
    method get_velocity (line 543) | def get_velocity(self, sample: torch.Tensor, noise: torch.Tensor, time...
    method __len__ (line 562) | def __len__(self):
    method previous_timestep (line 565) | def previous_timestep(self, timestep):

FILE: LatentLM/schedule/dpm_solver.py
  class DPMSolverMultistepScheduler (line 31) | class DPMSolverMultistepScheduler(SchedulerMixin, ConfigMixin):
    method __init__ (line 112) | def __init__(
    method step_index (line 207) | def step_index(self):
    method begin_index (line 214) | def begin_index(self):
    method set_begin_index (line 220) | def set_begin_index(self, begin_index: int = 0):
    method set_timesteps (line 230) | def set_timesteps(
    method _threshold_sample (line 335) | def _threshold_sample(self, sample: torch.Tensor) -> torch.Tensor:
    method _sigma_to_t (line 369) | def _sigma_to_t(self, sigma, log_sigmas):
    method _sigma_to_alpha_sigma_t (line 392) | def _sigma_to_alpha_sigma_t(self, sigma):
    method _convert_to_karras (line 399) | def _convert_to_karras(self, in_sigmas: torch.Tensor, num_inference_st...
    method _convert_to_lu (line 424) | def _convert_to_lu(self, in_lambdas: torch.Tensor, num_inference_steps...
    method convert_model_output (line 437) | def convert_model_output(
    method dpm_solver_first_order_update (line 536) | def dpm_solver_first_order_update(
    method multistep_dpm_solver_second_order_update (line 605) | def multistep_dpm_solver_second_order_update(
    method multistep_dpm_solver_third_order_update (line 728) | def multistep_dpm_solver_third_order_update(
    method index_for_timestep (line 813) | def index_for_timestep(self, timestep, schedule_timesteps=None):
    method _init_step_index (line 832) | def _init_step_index(self, timestep):
    method step (line 844) | def step(
    method add_noise (line 933) | def add_noise(
    method get_velocity (line 953) | def get_velocity(self, original_samples: torch.Tensor, noise: torch.Te...
    method __len__ (line 968) | def __len__(self):

FILE: LatentLM/tokenizer_models/modeling_beit3_vision.py
  class BEiT3Vision (line 14) | class BEiT3Vision(nn.Module):
    method __init__ (line 15) | def __init__(self, args, **kwargs):
    method forward (line 38) | def forward(
  function beit3_base_vision (line 60) | def beit3_base_vision(image_size):

FILE: LatentLM/tokenizer_models/modeling_common.py
  function trunc_normal_ (line 12) | def trunc_normal_(tensor, mean=0., std=1.):
  class EncoderDecoderArchForImageReconstrction (line 16) | class EncoderDecoderArchForImageReconstrction(nn.Module):
    method __init__ (line 20) | def __init__(
    method init_weights (line 38) | def init_weights(self):
    method _init_weights (line 46) | def _init_weights(self, m):
    method build_encoder (line 56) | def build_encoder(config):
    method build_decoder (line 66) | def build_decoder(config):
    method encode (line 70) | def encode(self, img):
    method decode (line 74) | def decode(self, quantize, **decoder_kwargs):
  function get_model_default_params (line 79) | def get_model_default_params(
  function get_basic_config (line 91) | def get_basic_config(

FILE: LatentLM/tokenizer_models/modeling_sigma_vae.py
  class DecodeHeadBLC (line 9) | class DecodeHeadBLC(nn.Module):
    method __init__ (line 10) | def __init__(self, decoder_output_dim, patch_size, output_channels, pa...
    method forward (line 21) | def forward(self, x):
  class GaussianDistribution (line 38) | class GaussianDistribution(object):
    method __init__ (line 39) | def __init__(self, parameters, std):
    method sample (line 44) | def sample(self, sampling_std=None):
    method kl (line 59) | def kl(self):
    method mode (line 63) | def mode(self):
  class EncodeHeadBLC (line 67) | class EncodeHeadBLC(nn.Module):
    method __init__ (line 68) | def __init__(self, output_dim, latent_size, patches_shape, std):
    method forward (line 75) | def forward(self, x):
  class SigmaVAE (line 85) | class SigmaVAE(EncoderDecoderArchForImageReconstrction):
    method __init__ (line 87) | def __init__(
  function sigma_vae (line 124) | def sigma_vae(latent_size, std, **kwargs):

FILE: LatentLM/tokenizer_models/modeling_utils.py
  function trunc_normal_ (line 9) | def trunc_normal_(tensor, mean=0., std=1.):
  class Attention (line 13) | class Attention(nn.Module):
    method __init__ (line 14) | def __init__(
    method forward (line 38) | def forward(self, x, is_causal=False, attn_mask=None):
  class Block (line 59) | class Block(nn.Module):
    method __init__ (line 61) | def __init__(
    method forward (line 86) | def forward(self, x, attn_mask=None, is_causal=False):
  class VisionTransformer (line 91) | class VisionTransformer(nn.Module):
    method __init__ (line 94) | def __init__(
    method fix_init_weight (line 132) | def fix_init_weight(self):
    method _init_weights (line 140) | def _init_weights(self, m):
    method forward_features (line 149) | def forward_features(self, x, return_patch_tokens=False, **kwargs):
    method forward (line 169) | def forward(self, x, **kwargs):

FILE: LatentLM/tokenizer_models/vae.py
  function nonlinearity (line 8) | def nonlinearity(x):
  function Normalize (line 13) | def Normalize(in_channels, num_groups=32):
  class Upsample (line 19) | class Upsample(nn.Module):
    method __init__ (line 20) | def __init__(self, in_channels, with_conv):
    method forward (line 28) | def forward(self, x):
  class Downsample (line 35) | class Downsample(nn.Module):
    method __init__ (line 36) | def __init__(self, in_channels, with_conv):
    method forward (line 45) | def forward(self, x):
  class ResnetBlock (line 55) | class ResnetBlock(nn.Module):
    method __init__ (line 56) | def __init__(
    method forward (line 92) | def forward(self, x, temb):
  class AttnBlock (line 115) | class AttnBlock(nn.Module):
    method __init__ (line 116) | def __init__(self, in_channels):
    method forward (line 134) | def forward(self, x):
  class Encoder (line 161) | class Encoder(nn.Module):
    method __init__ (line 162) | def __init__(
    method forward (line 245) | def forward(self, x):
  class Decoder (line 275) | class Decoder(nn.Module):
    method __init__ (line 276) | def __init__(
    method forward (line 365) | def forward(self, z):
  class DiagonalGaussianDistribution (line 399) | class DiagonalGaussianDistribution(object):
    method __init__ (line 400) | def __init__(self, parameters, deterministic=False):
    method sample (line 412) | def sample(self):
    method kl (line 418) | def kl(self, other=None):
    method nll (line 437) | def nll(self, sample, dims=[1, 2, 3]):
    method mode (line 446) | def mode(self):
  class AutoencoderKL (line 450) | class AutoencoderKL(nn.Module):
    method __init__ (line 451) | def __init__(self, embed_dim, ch_mult, use_variational=True, ckpt_path...
    method init_from_ckpt (line 463) | def init_from_ckpt(self, path):
    method encode (line 473) | def encode(self, x):
    method decode (line 481) | def decode(self, z):
    method forward (line 486) | def forward(self, inputs, disable=True, train=True, optimizer_idx=0):

FILE: LatentLM/train_hf.py
  function parse_args (line 34) | def parse_args():
  function main (line 106) | def main(args):

FILE: LatentLM/utils.py
  function update_ema (line 18) | def update_ema(ema_model, model, decay=0.9999):
  function requires_grad (line 30) | def requires_grad(model, flag=True):
  function cleanup (line 38) | def cleanup():
  function create_logger (line 45) | def create_logger(logging_dir):
  function center_crop_arr (line 62) | def center_crop_arr(pil_image, image_size):
  function download_pretrained_vae (line 82) | def download_pretrained_vae(overwrite=False):
  function safe_blob_write (line 93) | def safe_blob_write(fn, text):
  function safe_blob_dump (line 102) | def safe_blob_dump(fn, result):
  function load_vae (line 111) | def load_vae(vae_model_path, image_size):

FILE: PFPO/data/apps.py
  class APPsReader (line 12) | class APPsReader:
    method __init__ (line 13) | def __init__(self, split: str = "train", train_sub_split: str = ""):
    method __call__ (line 18) | def __call__(self, file_path):
  class APPsWithFunctionName (line 51) | class APPsWithFunctionName:
    method __init__ (line 52) | def __init__(self, split: str = "train", train_sub_split: str = "", us...
    method __call__ (line 58) | def __call__(self, file_path):
  class APPsFlatTestCasesReader (line 98) | class APPsFlatTestCasesReader(APPsWithFunctionName):
    method __call__ (line 99) | def __call__(self, file_path):
  class PseudoInputsWithFunctionName (line 112) | class PseudoInputsWithFunctionName:
    method __init__ (line 113) | def __init__(self, use_starter_code: bool = False, train_sub_split: st...
    method __call__ (line 118) | def __call__(self, file_path):
  class PseudoInputsWithFunctionNameFixStarterCode (line 156) | class PseudoInputsWithFunctionNameFixStarterCode:
    method __init__ (line 157) | def __init__(self, use_starter_code: bool = False, train_sub_split: st...
    method __call__ (line 162) | def __call__(self, file_path):

FILE: PFPO/data/code_contest.py
  class CodeContestReader (line 8) | class CodeContestReader:
    method __call__ (line 9) | def __call__(self, file_path):
  class CodeContestFlatReader (line 43) | class CodeContestFlatReader:
    method __call__ (line 44) | def __call__(self, file_path):

FILE: PFPO/data/combine_dataset.py
  class ResponseAlignDataset (line 19) | class ResponseAlignDataset(Dataset):
    method __init__ (line 20) | def __init__(self,
    method __len__ (line 91) | def __len__(self):
    method api_getitem (line 96) | def api_getitem(self, index):
    method service_getitem (line 113) | def service_getitem(self, index):
    method __getitem__ (line 119) | def __getitem__(self, idx):
  class PromptResponseDataset (line 139) | class PromptResponseDataset(Dataset):
    method __init__ (line 140) | def __init__(self,
    method __len__ (line 197) | def __len__(self):
    method api_getitem (line 202) | def api_getitem(self, index):
    method service_getitem (line 205) | def service_getitem(self, index):
    method __getitem__ (line 208) | def __getitem__(self, idx):
  class MultiMappingDataset (line 231) | class MultiMappingDataset(Dataset):
    method __init__ (line 232) | def __init__(self,
    method __len__ (line 289) | def __len__(self):
    method api_getitem (line 294) | def api_getitem(self, index):
    method service_getitem (line 297) | def service_getitem(self, index):
    method __getitem__ (line 300) | def __getitem__(self, idx):
  class MultiMappingDatasetGrouping (line 329) | class MultiMappingDatasetGrouping(MultiMappingDataset):
    method __init__ (line 330) | def __init__(self,
  class ReplayDataset (line 375) | class ReplayDataset(Dataset):
    method __init__ (line 376) | def __init__(self, file_path: str, tokenizer: PreTrainedTokenizer, new...
    method __len__ (line 385) | def __len__(self):
    method __getitem__ (line 388) | def __getitem__(self, index):

FILE: PFPO/data/deepseek_math_utils/answer_extraction.py
  function _fix_fracs (line 6) | def _fix_fracs(string):
  function _fix_a_slash_b (line 38) | def _fix_a_slash_b(string):
  function _fix_sqrt (line 55) | def _fix_sqrt(string):
  function _fix_tan (line 61) | def _fix_tan(string):
  function strip_string (line 67) | def strip_string(string):
  function extract_boxed_answers (line 180) | def extract_boxed_answers(text):
  function extract_program_output (line 198) | def extract_program_output(pred_str):
  function extract_answer (line 212) | def extract_answer(pred_str, exhaust=False):
  function extract_math_answer (line 251) | def extract_math_answer(question, reasoning, task):
  function extract_math_few_shot_cot_answer (line 263) | def extract_math_few_shot_cot_answer(question, reasoning, task):
  function extract_last_single_answer (line 269) | def extract_last_single_answer(question, reasoning, task):
  function extract_gsm_few_shot_cot_answer (line 273) | def extract_gsm_few_shot_cot_answer(question, reasoning, task):
  function extract_agieval_gaokao_mathcloze_few_shot_cot_test (line 283) | def extract_agieval_gaokao_mathcloze_few_shot_cot_test(question, reasoni...
  function extract_agieval_gaokao_mathqa_few_shot_cot_test (line 295) | def extract_agieval_gaokao_mathqa_few_shot_cot_test(question, reasoning,...
  function extract_sat_few_shot_answer (line 306) | def extract_sat_few_shot_answer(question, reasoning, task):
  function extract_ocwcourses_few_shot_answer (line 315) | def extract_ocwcourses_few_shot_answer(question, reasoning, task):
  function extract_mmlu_stem (line 327) | def extract_mmlu_stem(question, reasoning, task):
  function extract_minif2f_isabelle (line 333) | def extract_minif2f_isabelle(question, reasoning, task):
  function extract_cmath_few_shot_test (line 339) | def extract_cmath_few_shot_test(question, reasoning, task):

FILE: PFPO/data/deepseek_math_utils/eval_script.py
  function is_correct (line 7) | def is_correct(item, pred_key='prediction', prec=1e-3):
  function eval_math (line 48) | def eval_math(item, pred_key='prediction', prec=1e-3):
  function eval_last_single_answer (line 75) | def eval_last_single_answer(item, pred_key='prediction', prec=1e-3):
  function eval_agieval_gaokao_math_cloze (line 81) | def eval_agieval_gaokao_math_cloze(item, pred_key='prediction', prec=1e-3):
  function eval_agieval_gaokao_mathqa (line 117) | def eval_agieval_gaokao_mathqa(item, pred_key='prediction', prec=1e-3):
  function eval_math_sat (line 131) | def eval_math_sat(item, pred_key='prediction', prec=1e-3):
  function eval_mmlu_stem (line 137) | def eval_mmlu_stem(item, pred_key='prediction', prec=1e-3):
  function eval_ocwcourses (line 141) | def eval_ocwcourses(item, pred_key='prediction', prec=1e-3):
  function eval_minif2f_isabelle (line 180) | def eval_minif2f_isabelle(item, pred_key='prediction', prec=1e-3):

FILE: PFPO/data/deepseek_math_utils/eval_utils.py
  function extract_program (line 15) | def extract_program(result: str, last_only=True):
  function parse_ground_truth (line 35) | def parse_ground_truth(example: Dict[str, Any], data_name):
  function parse_question (line 76) | def parse_question(example, data_name):
  function run_execute (line 100) | def run_execute(executor, result, prompt_type, execute=False):
  function parse_digits (line 117) | def parse_digits(num):
  function is_digit (line 134) | def is_digit(num):
  function normalize_prediction (line 139) | def normalize_prediction(prediction):
  function math_equal (line 183) | def math_equal(prediction: Union[bool, float, str],
  function math_equal_process (line 283) | def math_equal_process(param):
  function symbolic_equal (line 287) | def symbolic_equal(a, b):
  function symbolic_equal_process (line 313) | def symbolic_equal_process(a, b, output_queue):
  function call_with_timeout (line 318) | def call_with_timeout(func, *args, timeout=1, **kwargs):

FILE: PFPO/data/deepseek_math_utils/ocwcourses_eval_utils.py
  class timeout (line 12) | class timeout:
    method __init__ (line 13) | def __init__(self, seconds=1, error_message="Timeout"):
    method handle_timeout (line 17) | def handle_timeout(self, signum, frame):
    method __enter__ (line 20) | def __enter__(self):
    method __exit__ (line 24) | def __exit__(self, type, value, traceback):
  function normalize_numeric (line 28) | def normalize_numeric(s):
  function numeric_equality (line 72) | def numeric_equality(n1, n2, threshold=0.01):
  function normalize_symbolic_equation (line 81) | def normalize_symbolic_equation(s):
  class SymbolicMathMixin (line 104) | class SymbolicMathMixin:
    method normalize_tex (line 166) | def normalize_tex(self, final_answer: str) -> str:
    method parse_tex (line 204) | def parse_tex(self, text: str, time_limit: int = 5) -> sympy.Basic:
    method is_exp_equiv (line 222) | def is_exp_equiv(self, x1: sympy.Basic, x2: sympy.Basic, time_limit=5)...
    method is_tex_equiv (line 251) | def is_tex_equiv(self, x1: str, x2: str, time_limit=5) -> bool:

FILE: PFPO/data/general_collator.py
  class DPOCollator (line 21) | class DPOCollator:
    method __init__ (line 22) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int...
    method __call__ (line 27) | def __call__(self, batch):
  class DPODataSFTCollator (line 75) | class DPODataSFTCollator:
    method __init__ (line 80) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int):
    method __call__ (line 84) | def __call__(self, batch):
  class DPOCollatorWithExtraInputs (line 120) | class DPOCollatorWithExtraInputs:
    method __init__ (line 121) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int...
    method __call__ (line 127) | def __call__(self, batch):
  class Trajectory2ValueCollator (line 181) | class Trajectory2ValueCollator:
    method __init__ (line 182) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int):
    method __call__ (line 186) | def __call__(self, batch):
  class StepEndingsCollator (line 223) | class StepEndingsCollator:
    method __init__ (line 224) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int):
    method __call__ (line 228) | def __call__(self, batch):
  function iterative_mask (line 274) | def iterative_mask(text_segment_list: List[List[str]], masks: List[int],...
  class SFTFoldAttnMaskCollator (line 306) | class SFTFoldAttnMaskCollator:
    method __init__ (line 307) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int...
    method __call__ (line 313) | def __call__(self, batch):
  class TextPromptCollator (line 353) | class TextPromptCollator:
    method __init__ (line 354) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int...
    method __call__ (line 363) | def __call__(self, batch):

FILE: PFPO/data/human_eval.py
  class HumanEvalReader (line 12) | class HumanEvalReader:
    method __call__ (line 13) | def __call__(self, file_path: str = "openai_humaneval"):
  class MBPPReader (line 20) | class MBPPReader:
    method __init__ (line 21) | def __init__(self, sanitized: bool = True):
    method __call__ (line 24) | def __call__(self, file_path: str = "mbpp"):
  class MBPPReaderFixed (line 36) | class MBPPReaderFixed:
    method __init__ (line 37) | def __init__(self, sanitized: bool = True):
    method __call__ (line 40) | def __call__(self, file_path: str = "mbpp"):

FILE: PFPO/data/input_aligner.py
  function _format_option_list (line 18) | def _format_option_list(option_list: List[str], _rank2option: List[str])...
  function option_id2str_aligner (line 25) | def option_id2str_aligner():
  function key_based_filter_aligner (line 36) | def key_based_filter_aligner(key, value):
  function dpo_confidence_ratio_filter (line 48) | def dpo_confidence_ratio_filter(lower_bound: float, upper_bound: float, ...
  function filter_aligner (line 60) | def filter_aligner(filter_func: Callable):
  function json_field2str (line 67) | def json_field2str(key, val: str = None, indent: int = 4):
  function starts_with_filter (line 79) | def starts_with_filter(key, value):
  function not_none_filter (line 86) | def not_none_filter(key):
  function rename_field_aligner (line 93) | def rename_field_aligner(kv_pair: Dict):
  function field_extract_aligner (line 104) | def field_extract_aligner(input_index_field: str, extract_index_field: s...
  function flat_aligner (line 147) | def flat_aligner(input_index_field: str, extract_field: Union[str, List[...
  function option_flatten_aligner (line 191) | def option_flatten_aligner():
  function empty_aligner (line 200) | def empty_aligner(data: List[Dict]):
  function add_id_aligner (line 204) | def add_id_aligner(id_field: str = "id"):
  function concat_aligner (line 213) | def concat_aligner(aligners: List[Callable]):
  function dpo_pair_aligner_cleaned (line 222) | def dpo_pair_aligner_cleaned(response_field: str = "response",
  function dpo_pair_aligner (line 280) | def dpo_pair_aligner(pos_field: Union[str, ListConfig], neg_field: Union...
  function eval_multiple_choice (line 320) | def eval_multiple_choice(item):
  function prompt_fill_aligner (line 341) | def prompt_fill_aligner(prompt_file: str, mapping: Dict[str, str], promp...
  function value2pair_aligner (line 356) | def value2pair_aligner(field: str, pos_field: str, neg_field: str, value...
  function return_threshold_mapping (line 377) | def return_threshold_mapping(value_threshold: float):
  function return_binary_mapping (line 386) | def return_binary_mapping():
  function value_mapping_aligner (line 395) | def value_mapping_aligner(value_field: str, value_mapping_func: Callable...
  function dpo_pair2value_aligner (line 407) | def dpo_pair2value_aligner(pos_field: str, neg_field: str, seq_field: st...
  function value2pair_mapping_aligner (line 434) | def value2pair_mapping_aligner(field: str, pos_field: str, neg_field: st...
  function dpo_random_choice_aligner (line 455) | def dpo_random_choice_aligner(anchor_field: str, paired_field: str):
  function dpo_flat_random_choice_aligner (line 473) | def dpo_flat_random_choice_aligner(paired_field: str):
  function dpo_paired_random_choice_aligner (line 487) | def dpo_paired_random_choice_aligner(anchor_field: str, paired_field, so...
  function sample_steps (line 537) | def sample_steps(response: str):
  function _sort_worker (line 543) | def _sort_worker(item, _pos_field: str, _neg_field: str, _top_k: int = 5):
  function dpo_bi_random_choice_aligner (line 553) | def dpo_bi_random_choice_aligner(pos_field: str, neg_field: str, sort_ac...

FILE: PFPO/data/input_utils.py
  function read_text (line 7) | def read_text(file_path: str):
  function json_read_fn (line 11) | def json_read_fn(file_path: str):
  function hf_datasets_load_fn (line 15) | def hf_datasets_load_fn(**kwargs):
  function jsonl_read_fn (line 22) | def jsonl_read_fn():
  function compose_message (line 29) | def compose_message(system_prompt: str = ""):
  function recompose_template (line 41) | def recompose_template(units: Dict[str, str], compositions: Dict[str, st...
  function compose_template (line 48) | def compose_template(units: Dict[str, str], composition: str) -> str:

FILE: PFPO/data/math.py
  function is_number (line 19) | def is_number(s):
  function extract_answer_number (line 34) | def extract_answer_number(completion, separator: str = "The answer is: "):
  function gsk8k_answer_cleaner (line 63) | def gsk8k_answer_cleaner(separator: str = "The answer is: "):
  function number_answer_extractor (line 73) | def number_answer_extractor(separator: str = "The answer is: ", completi...
  function gsm8k_gold_answer_extractor (line 86) | def gsm8k_gold_answer_extractor(response_field: str = "response"):
  function remove_boxed (line 99) | def remove_boxed(s):
  function math_gold_answer_extractor (line 109) | def math_gold_answer_extractor(response_field: str = "output", kv_mappin...
  function math_boxed_answer_cleaner (line 123) | def math_boxed_answer_cleaner():
  function math_boxed_answer_cleaner_proxy (line 130) | def math_boxed_answer_cleaner_proxy():
  function math_gold_answer_extractor_deepseek (line 137) | def math_gold_answer_extractor_deepseek(query_field: str = "instruction"...
  function gsm8k_gold_answer_extractor_deepseek (line 151) | def gsm8k_gold_answer_extractor_deepseek(query_field: str = "instruction...
  function process_results (line 166) | def process_results(doc, completion, answer):
  function math_answer_cleaner (line 187) | def math_answer_cleaner(separator: str = "The answer is: "):
  function meta_math_gold_answer_extractor (line 213) | def meta_math_gold_answer_extractor(response_field: str = "response"):
  function decompose_rap (line 233) | def decompose_rap(prompt: str, response: str, max_seq_length: int, token...
  function decompose_cot (line 259) | def decompose_cot(prompt: str, response: str, max_seq_length: int, token...
  function decompose_deepseek_math_cot_v2 (line 276) | def decompose_deepseek_math_cot_v2(prompt: str, response: str, max_seq_l...
  class RAPResponseStepRewardCollator (line 312) | class RAPResponseStepRewardCollator:
    method __init__ (line 318) | def __init__(self, tokenizer: PreTrainedTokenizer, max_seq_length: int...
    method __call__ (line 323) | def __call__(self, batch):

FILE: PFPO/data/math_reader.py
  class MetaMathReaderHF (line 6) | class MetaMathReaderHF:
    method __init__ (line 7) | def __init__(self, category: str):
    method __call__ (line 10) | def __call__(self, file_path: str = "meta-math/MetaMathQA"):
  class MetaMathReader (line 25) | class MetaMathReader:
    method __init__ (line 26) | def __init__(self, category: str = "math"):
    method __call__ (line 29) | def __call__(self, file_path: str = "meta-math/MetaMathQA"):

FILE: PFPO/data/math_util.py
  function last_boxed_only (line 6) | def last_boxed_only(sample):
  function last_boxed_only_string (line 14) | def last_boxed_only_string(string):
  function only_until_first_boxed_from_tokens (line 42) | def only_until_first_boxed_from_tokens(string, tokens):
  function clean_numbers (line 58) | def clean_numbers(sample):
  function _clean_numbers (line 68) | def _clean_numbers(string):
  function fix_fracs (line 101) | def fix_fracs(string):
  function fix_a_slash_b (line 133) | def fix_a_slash_b(string):
  function remove_right_units (line 148) | def remove_right_units(string):
  function fix_sqrt (line 158) | def fix_sqrt(string):
  function strip_string (line 173) | def strip_string(string):
  function is_equiv (line 238) | def is_equiv(str1, str2, verbose=False):
  class NotEqual (line 256) | class NotEqual:
    method __eq__ (line 257) | def __eq__(self, other):

FILE: PFPO/data/mathscale/util.py
  function fix_fracs (line 8) | def fix_fracs(string):
  function fix_a_slash_b (line 40) | def fix_a_slash_b(string):
  function remove_right_units (line 55) | def remove_right_units(string):
  function fix_sqrt (line 65) | def fix_sqrt(string):
  function is_number (line 80) | def is_number(s):
  function unbox_and_extract (line 96) | def unbox_and_extract(text):
  function convert_to_latex_fraction (line 115) | def convert_to_latex_fraction(text: str) -> str:
  function strip_string (line 131) | def strip_string(string):
  function is_single_inline_math (line 204) | def is_single_inline_math(expression: str) -> bool:
  function mathscale_is_equiv (line 214) | def mathscale_is_equiv(prediction_ans, reference_ans, verbose=False):
  function mathscale_is_equiv_proxy (line 250) | def mathscale_is_equiv_proxy(prediction_ans, reference_ans, verbose=False):
  function is_correct (line 254) | def is_correct(completion, answer, verbose=False):
  function mathscale_extract_answer (line 315) | def mathscale_extract_answer():
  function mathscale_extract_answer_fn_v2_list (line 370) | def mathscale_extract_answer_fn_v2_list(separator: str = "The answer is:...
  function mathscale_extract_answer_v2 (line 387) | def mathscale_extract_answer_v2(completion: str):
  function mathscale_extract_answer_v3 (line 444) | def mathscale_extract_answer_v3(completion: str):
  function mathscale_extract_answer_fn_v3 (line 506) | def mathscale_extract_answer_fn_v3(completion_field: str = "response"):
  function mathscale_extract_answer_fn_v4 (line 519) | def mathscale_extract_answer_fn_v4(completion_field: str = "response"):
  function extract_pure_prompt_aligner (line 532) | def extract_pure_prompt_aligner():

FILE: PFPO/data/numina_math.py
  class NuminaMathReader (line 10) | class NuminaMathReader:
    method __init__ (line 11) | def __init__(self, id_field: str = "id", split: str = "train"):
    method __call__ (line 15) | def __call__(self, file_path):

FILE: PFPO/data/openai_api_caller.py
  class GPTAPIInterface (line 13) | class GPTAPIInterface:
    method __init__ (line 14) | def __init__(self, model: str, max_tokens: int, api_time_interval: int...
    method __call__ (line 29) | def __call__(self, text: str):
  class GPTTurbo (line 33) | class GPTTurbo(GPTAPIInterface):
    method __init__ (line 34) | def __init__(self,
    method __call__ (line 53) | def __call__(self, text: Union[str, List[str]]):
  class AzureGPTEndpoint (line 109) | class AzureGPTEndpoint:
    method __init__ (line 110) | def __init__(self,
    method __call__ (line 146) | def __call__(self, text: Union[str, List[str]]):

FILE: PFPO/data/qwen25math/data_loader.py
  function load_data (line 9) | def load_data(data_name, split, data_dir="./data"):

FILE: PFPO/data/qwen25math/evaluate.py
  function evaluate (line 14) | def evaluate(data_name, prompt_type, samples: list=None, file_path: str=...
  function parse_args (line 96) | def parse_args():

FILE: PFPO/data/qwen25math/examples.py
  function get_examples (line 4) | def get_examples():

FILE: PFPO/data/qwen25math/grader.py
  function choice_answer_clean (line 25) | def choice_answer_clean(pred: str):
  function parse_digits (line 39) | def parse_digits(num):
  function is_digit (line 55) | def is_digit(num):
  function str_to_pmatrix (line 60) | def str_to_pmatrix(input_str):
  function math_equal (line 73) | def math_equal(
  function math_equal_process (line 262) | def math_equal_process(param):
  function numeric_equal (line 266) | def numeric_equal(prediction: float, reference: float):
  function symbolic_equal (line 276) | def symbolic_equal(a, b):
  function symbolic_equal_process (line 332) | def symbolic_equal_process(a, b, output_queue):
  function call_with_timeout (line 337) | def call_with_timeout(func, *args, timeout=1, **kwargs):
  function _test_math_equal (line 351) | def _test_math_equal():

FILE: PFPO/data/qwen25math/math_eval.py
  function parse_args (line 21) | def parse_args():
  function prepare_data (line 61) | def prepare_data(data_name, args):
  function setup (line 108) | def setup(args):
  function is_multi_choice (line 151) | def is_multi_choice(answer):
  function main (line 158) | def main(llm, tokenizer, data_name, args):

FILE: PFPO/data/qwen25math/math_utils.py
  function compare_numerical_ans (line 29) | def compare_numerical_ans(ans_p, ans_l):
  function my_parse_latex (line 46) | def my_parse_latex(expr_str):
  function is_number (line 55) | def is_number(element: str) -> bool:
  function percentage_to_fraction (line 63) | def percentage_to_fraction(text):
  function clean_expr_str (line 74) | def clean_expr_str(expr_str):
  function parse_latex_answer (line 116) | def parse_latex_answer(sample):
  function my_equals (line 129) | def my_equals(ans_p, ans_l):
  function is_expr_equal (line 133) | def is_expr_equal(ans_p, ans_l, is_strict=False):
  function extract_answer_number (line 201) | def extract_answer_number(sentence: str) -> float:
  function compare_ans (line 210) | def compare_ans(ans_p_str, ans_l_str, is_strict=False):
  function vote (line 236) | def vote(answers):
  function contains_number (line 241) | def contains_number(s):
  function rough_compare_ans (line 245) | def rough_compare_ans(generation, answer):

FILE: PFPO/data/qwen25math/model_utils.py
  class KeywordsStoppingCriteria (line 9) | class KeywordsStoppingCriteria(StoppingCriteria):
    method __init__ (line 10) | def __init__(self, keywords_str, tokenizer):
    method __call__ (line 15) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen...
  class KeyWordsCriteriaTrunc (line 34) | class KeyWordsCriteriaTrunc(StoppingCriteria):
    method __init__ (line 35) | def __init__(self, stop_id_sequences, prompt_length):
    method __call__ (line 40) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen...
  class KeyWordsCriteria (line 60) | class KeyWordsCriteria(StoppingCriteria):
    method __init__ (line 61) | def __init__(self, stop_id_sequences):
    method __call__ (line 65) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen...
  function generate_completions (line 78) | def generate_completions(model, tokenizer, prompts, batch_size=1, stop_i...
  function load_hf_lm_and_tokenizer (line 140) | def load_hf_lm_and_tokenizer(
  function _test_generate_completions (line 203) | def _test_generate_completions():

FILE: PFPO/data/qwen25math/parser.py
  function _fix_fracs (line 11) | def _fix_fracs(string):
  function _fix_a_slash_b (line 43) | def _fix_a_slash_b(string):
  function _fix_sqrt (line 60) | def _fix_sqrt(string):
  function convert_word_number (line 65) | def convert_word_number(text: str) -> str:
  function strip_string (line 212) | def strip_string(string, skip_unit=False):
  function extract_multi_choice_answer (line 353) | def extract_multi_choice_answer(pred_str):
  function choice_answer_clean (line 367) | def choice_answer_clean(pred: str):
  function find_box (line 411) | def find_box(pred_str: str):
  function clean_units (line 434) | def clean_units(pred_str: str):
  function extract_theoremqa_answer (line 459) | def extract_theoremqa_answer(pred: str, answer_flag: bool = True):
  function extract_answer (line 499) | def extract_answer(pred_str, data_name, use_last_number=True):
  function parse_ground_truth (line 575) | def parse_ground_truth(example: Dict[str, Any], data_name):
  function parse_question (line 654) | def parse_question(example, data_name):
  function run_execute (line 722) | def run_execute(executor, result, prompt_type, data_name, execute=False):
  function _test_extract_answer (line 740) | def _test_extract_answer():

FILE: PFPO/data/qwen25math/python_executor.py
  class GenericRuntime (line 20) | class GenericRuntime:
    method __init__ (line 24) | def __init__(self):
    method exec_code (line 31) | def exec_code(self, code_piece: str) -> None:
    method eval_code (line 48) | def eval_code(self, expr: str) -> Any:
    method inject (line 51) | def inject(self, var_dict: Dict[str, Any]) -> None:
    method answer (line 56) | def answer(self):
  class DateRuntime (line 59) | class DateRuntime(GenericRuntime):
  class CustomDict (line 67) | class CustomDict(dict):
    method __iter__ (line 68) | def __iter__(self):
  class ColorObjectRuntime (line 71) | class ColorObjectRuntime(GenericRuntime):
  class PythonExecutor (line 75) | class PythonExecutor:
    method __init__ (line 76) | def __init__(
    method process_generation_to_code (line 91) | def process_generation_to_code(self, gens: str):
    method execute (line 95) | def execute(
    method apply (line 140) | def apply(self, code):
    method truncate (line 144) | def truncate(s, max_length=400):
    method batch_apply (line 150) | def batch_apply(self, batch_code):
  function _test (line 202) | def _test():

FILE: PFPO/data/qwen25math/trajectory.py
  function text_to_trajectory (line 13) | def text_to_trajectory(traj_str: str) -> None:
  function trajectory_to_text (line 51) | def trajectory_to_text(trajectory: list) -> str:
  function is_execution_success (line 63) | def is_execution_success(output):
  function extract_program (line 69) | def extract_program(text:str=None, trajectory:list=None, last_only=False...
  function extract_program_output (line 109) | def extract_program_output(pred_str, last_only=True):
  function _test_str_to_trajectory (line 120) | def _test_str_to_trajectory():

FILE: PFPO/data/qwen25math/utils.py
  function set_seed (line 13) | def set_seed(seed: int = 42) -> None:
  function load_jsonl (line 20) | def load_jsonl(file: Union[str, Path]) -> Iterable[Any]:
  function save_jsonl (line 30) | def save_jsonl(samples, save_path):
  function lower_keys (line 41) | def lower_keys(example):
  function load_prompt (line 55) | def load_prompt(data_name, prompt_type, num_shots):
  function construct_prompt (line 168) | def construct_prompt(example, data_name, args):
  function show_sample (line 251) | def show_sample(sample, print_all_preds=False):

FILE: PFPO/data/vllm.py
  function post_http_request (line 11) | def post_http_request(api_url: str,
  function get_streaming_response (line 40) | def get_streaming_response(response: requests.Response) -> Iterable[List...
  function get_response (line 50) | def get_response(response: requests.Response) -> Tuple[str, str]:
  class VLLMRequestGenerator (line 56) | class VLLMRequestGenerator:
    method __init__ (line 57) | def __init__(self, api_url: str, n: int = 1, max_tokens: int = 1024, u...
    method __call__ (line 70) | def __call__(self, prompt: str) -> str:

FILE: PFPO/eval/codex_humaneval/data.py
  function read_problems (line 10) | def read_problems(evalset_file: str = HUMAN_EVAL) -> Dict[str, Dict]:
  function stream_jsonl (line 14) | def stream_jsonl(filename: str) -> Iterable[Dict]:
  function write_jsonl (line 31) | def write_jsonl(filename: str, data: Iterable[Dict], append: bool = False):

FILE: PFPO/eval/codex_humaneval/evaluation.py
  function estimate_pass_at_k (line 13) | def estimate_pass_at_k(
  function evaluate_functional_correctness (line 39) | def evaluate_functional_correctness(

FILE: PFPO/eval/codex_humaneval/execution.py
  function check_correctness (line 13) | def check_correctness(problem: Dict, completion: str, timeout: float, co...
  function time_limit (line 90) | def time_limit(seconds: float):
  function swallow_io (line 103) | def swallow_io():
  function create_tempdir (line 112) | def create_tempdir():
  class TimeoutException (line 118) | class TimeoutException(Exception):
  class WriteOnlyStringIO (line 122) | class WriteOnlyStringIO(io.StringIO):
    method read (line 125) | def read(self, *args, **kwargs):
    method readline (line 128) | def readline(self, *args, **kwargs):
    method readlines (line 131) | def readlines(self, *args, **kwargs):
    method readable (line 134) | def readable(self, *args, **kwargs):
  class redirect_stdin (line 139) | class redirect_stdin(contextlib._RedirectStream):  # type: ignore
  function chdir (line 144) | def chdir(root):
  function reliability_guard (line 158) | def reliability_guard(maximum_memory_bytes: Optional[int] = None):

FILE: PFPO/eval/codex_humaneval/run_eval.py
  function main (line 17) | def main(args):

FILE: PFPO/eval/dispatch_openai_requests.py
  function dispatch_openai_chat_requests (line 12) | async def dispatch_openai_chat_requests(
  function dispatch_openai_prompt_requests (line 37) | async def dispatch_openai_prompt_requests(

FILE: PFPO/eval/mbpp_eval/execute.py
  function check_correctness (line 28) | def check_correctness(check_program, timeout, task_id, completion_id):
  function unsafe_execute (line 56) | def unsafe_execute(check_program, result, timeout):
  function time_limit (line 90) | def time_limit(seconds):
  function swallow_io (line 103) | def swallow_io():
  function create_tempdir (line 112) | def create_tempdir():
  class TimeoutException (line 118) | class TimeoutException(Exception):
  class WriteOnlyStringIO (line 122) | class WriteOnlyStringIO(io.StringIO):
    method read (line 125) | def read(self, *args, **kwargs):
    method readline (line 128) | def readline(self, *args, **kwargs):
    method readlines (line 131) | def readlines(self, *args, **kwargs):
    method readable (line 134) | def readable(self, *args, **kwargs):
  class redirect_stdin (line 139) | class redirect_stdin(contextlib._RedirectStream):  # type: ignore
  function chdir (line 144) | def chdir(root):
  function reliability_guard (line 158) | def reliability_guard(maximum_memory_bytes=None):

FILE: PFPO/eval/mbpp_eval/run_eval.py
  function get_fewshot (line 11) | def get_fewshot():
  function remove_extra_symbols (line 62) | def remove_extra_symbols(code):
  function extract_code (line 79) | def extract_code(raw_completions):
  function main (line 110) | def main():

FILE: PFPO/eval/mbpp_eval/utils.py
  function compute_code_eval (line 127) | def compute_code_eval(predictions, references, k=[1, 10, 100], num_worke...
  function estimate_pass_at_k (line 172) | def estimate_pass_at_k(num_samples, num_correct, k):

FILE: PFPO/eval/utils.py
  class KeyWordsCriteria (line 12) | class KeyWordsCriteria(StoppingCriteria):
    method __init__ (line 13) | def __init__(self, stop_id_sequences):
    method __call__ (line 17) | def __call__(self, input_ids: torch.LongTensor, scores: torch.FloatTen...
  function generate_completions (line 30) | def generate_completions(model, tokenizer, prompts, batch_size=1, stop_i...
  function get_next_word_predictions (line 99) | def get_next_word_predictions(model, tokenizer, prompts, candidate_token...
  function score_completions (line 139) | def score_completions(model, tokenizer, scoring_examples, batch_size=1, ...
  function load_hf_lm_and_tokenizer (line 213) | def load_hf_lm_and_tokenizer(
  function query_openai_chat_model (line 272) | def query_openai_chat_model(engine, instances, output_path=None, batch_s...
  function query_openai_model (line 339) | def query_openai_model(engine, instances, output_path=None, batch_size=1...
  function dynamic_import_function (line 406) | def dynamic_import_function(function_path):
  function get_multichoice_predictions (line 417) | def get_multichoice_predictions(model, tokenizer, prompts, prompt_starts...

FILE: PFPO/general_util/average_meter.py
  class AverageMeter (line 7) | class AverageMeter(object):
    method __init__ (line 10) | def __init__(self):
    method reset (line 16) | def reset(self):
    method update (line 22) | def update(self, val, n=1):
    method save (line 36) | def save(self):
    method load (line 44) | def load(self, value: dict):
    method gather (line 52) | def gather(self, device):
  class LogMetric (line 68) | class LogMetric(object):
    method __init__ (line 73) | def __init__(self, *metric_names):
    method update (line 79) | def update(self, metric_name, val, n=1):
    method reset (line 83) | def reset(self, metric_name=None):
    method get_log (line 91) | def get_log(self):

FILE: PFPO/general_util/dist_utils.py
  function vanilla_torch_dist (line 19) | def vanilla_torch_dist(cfg: DictConfig, backend="nccl"):
  function setup_slurm_distributed (line 35) | def setup_slurm_distributed(cfg: DictConfig, backend="nccl", port=None):
  function print_rank_0 (line 89) | def print_rank_0(msg, rank=0):
  function print_all_ranks (line 94) | def print_all_ranks(tag, value, rank):
  function get_pipeline_parallel_world_size (line 102) | def get_pipeline_parallel_world_size() -> int:
  function get_pipeline_parallel_rank (line 107) | def get_pipeline_parallel_rank() -> int:
  function prepare_distributed_sampler (line 112) | def prepare_distributed_sampler(dataset: torch.utils.data.Dataset, rando...

FILE: PFPO/general_util/evaluator.py
  function evaluate (line 21) | def evaluate(cfg: DictConfig, model: torch.nn.Module, tokenizer: PreTrai...
  function build_dataloader (line 140) | def build_dataloader(dataset, cfg):
  function retriever_inference_fn (line 159) | def retriever_inference_fn(cfg: DictConfig, model: torch.nn.Module, toke...
  class DefaultForwardFn (line 279) | class DefaultForwardFn:
    method __init__ (line 280) | def __init__(self, cfg: DictConfig, model: torch.nn.Module, tokenizer:...
    method __call__ (line 285) | def __call__(self, batch):
  class DiscriminatorForwardFn (line 290) | class DiscriminatorForwardFn:
    method __init__ (line 291) | def __init__(self, cfg: DictConfig, model: torch.nn.Module, tokenizer:...
    method __call__ (line 296) | def __call__(self, batch):
  class AutoRegressiveDiscriminatorForwardFn (line 304) | class AutoRegressiveDiscriminatorForwardFn:
    method __init__ (line 305) | def __init__(self, cfg: DictConfig, model: torch.nn.Module, tokenizer:...
    method __call__ (line 310) | def __call__(self, batch):
  class GeneratorForwardFn (line 318) | class GeneratorForwardFn:
    method __init__ (line 319) | def __init__(self, cfg: DictConfig, model: torch.nn.Module, tokenizer:...
    method __call__ (line 328) | def __call__(self, batch):
  class GeneratorCLSForwardFn (line 358) | class GeneratorCLSForwardFn(GeneratorForwardFn):
    method __call__ (line 359) | def __call__(self, batch):

FILE: PFPO/general_util/fs_tp_utils.py
  function broadcast_data (line 7) | def broadcast_data(keys, data, datatype):

FILE: PFPO/general_util/fsdp_utils.py
  function default_initialize (line 13) | def default_initialize(model: torch.nn.Module,
  function vae_specific_initialize (line 42) | def vae_specific_initialize(model: torch.nn.Module,
  function recursive_initialize (line 79) | def recursive_initialize(model: torch.nn.Module,
  function default_initialize_v2 (line 113) | def default_initialize_v2(model: torch.nn.Module,

FILE: PFPO/general_util/lightseq_utils.py
  class LSHFTransformerEncoderLayer (line 12) | class LSHFTransformerEncoderLayer(LSTransformerEncoderLayer):
    method __init__ (line 13) | def __init__(self, *args, **kwargs):
    method forward (line 16) | def forward(self, hidden_states, encoder_padding_mask, *args, **kwargs):
  function gen_bert_config (line 23) | def gen_bert_config(cfg: DictConfig, config):
  function get_hf_bert_enc_layer_params (line 41) | def get_hf_bert_enc_layer_params(layer):
  function inject_ls_enc_layer (line 66) | def inject_ls_enc_layer(model, cfg, config):
  function inject_ls_roberta_enc_layer (line 75) | def inject_ls_roberta_enc_layer(model, cfg, config):

FILE: PFPO/general_util/logger.py
  function get_child_logger (line 9) | def get_child_logger(child_name):
  function setting_logger (line 18) | def setting_logger(log_file: str, local_rank: int = -1):

FILE: PFPO/general_util/mixin.py
  class LogMixin (line 12) | class LogMixin:
    method init_metric (line 15) | def init_metric(self, *metric_names):
    method get_eval_log (line 18) | def get_eval_log(self, reset=False, ddp=False, device='cpu'):
  class MetricMixin (line 37) | class MetricMixin:
    method __init__ (line 39) | def __init__(self, metrics: List[Tuple[str, str, str, str]]):
  class PredictionMixin (line 50) | class PredictionMixin:
    method reset_predict_tensors (line 53) | def reset_predict_tensors(self):
    method concat_predict_tensors (line 56) | def concat_predict_tensors(self, **tensors: torch.Tensor):
    method get_predict_tensors (line 60) | def get_predict_tensors(self):

FILE: PFPO/general_util/mpu_proxy.py
  function get_model_parallel_group (line 10) | def get_model_parallel_group():
  function get_model_parallel_rank (line 14) | def get_model_parallel_rank():
  function get_model_parallel_world_size (line 18) | def get_model_parallel_world_size():
  function get_data_parallel_group (line 22) | def get_data_parallel_group():
  function get_data_parallel_rank (line 26) | def get_data_parallel_rank():
  function get_data_parallel_world_size (line 30) | def get_data_parallel_world_size():
  function prepare_distributed_sampler (line 34) | def prepare_distributed_sampler(dataset: torch.utils.data.Dataset, rando...

FILE: PFPO/general_util/tensorboard_helper.py
  class SummaryWriterHelper (line 11) | class SummaryWriterHelper:
    method __init__ (line 12) | def __init__(self,
    method __call__ (line 29) | def __call__(self, step: int, last_batch: Union[Dict, Tuple] = None, l...
  class WandbWriter (line 48) | class WandbWriter:
    method __init__ (line 49) | def __init__(self,
    method update (line 65) | def update(self, last_batch: Union[Dict, Tuple] = None, last_outputs: ...
    method __call__ (line 93) | def __call__(self, clear: bool = True) -> Dict[str, Any]:

FILE: PFPO/general_util/tokenization_utils.py
  function tokenizer_get_name (line 13) | def tokenizer_get_name(_tokenizer: PreTrainedTokenizer):
  function expand_special_tokenizer (line 20) | def expand_special_tokenizer(tokenizer: PreTrainedTokenizer):
  function init_tokenizer (line 64) | def init_tokenizer(tokenizer_path: str, **kwargs) -> PreTrainedTokenizer:
  function is_seq2seq_tokenizer (line 70) | def is_seq2seq_tokenizer(tokenizer: PreTrainedTokenizer):

FILE: PFPO/general_util/torch_fsdp_utils.py
  function torch_fsdp_initialize_default (line 20) | def torch_fsdp_initialize_default(model,
  function torch_fsdp_init_decoder_freeze (line 52) | def torch_fsdp_init_decoder_freeze(model,
  function torch_fsdp_init_quantizer_ignore (line 84) | def torch_fsdp_init_quantizer_ignore(model,
  function torch_fsdp_size_auto_wrap (line 117) | def torch_fsdp_size_auto_wrap(model,
  function torch_fsdp_peft_auto_wrap (line 150) | def torch_fsdp_peft_auto_wrap(model,
  function torch_fsdp_transformer_init (line 175) | def torch_fsdp_transformer_init(model,

FILE: PFPO/general_util/training_utils.py
  function set_seed (line 22) | def set_seed(args):
  function set_seed_int (line 30) | def set_seed_int(seed):
  function get_rank (line 36) | def get_rank():
  function to_list (line 43) | def to_list(tensor):
  function unwrap_model (line 47) | def unwrap_model(model: torch.nn.Module) -> torch.nn.Module:
  function get_zero_stage (line 60) | def get_zero_stage(cfg: DictConfig):
  function return_torch_dtype (line 66) | def return_torch_dtype(dtype: str):
  function batch_to_device (line 79) | def batch_to_device(batch: Dict[str, torch.Tensor], device):
  function initialize_dataset (line 94) | def initialize_dataset(cfg: DictConfig, file_path: str, tokenizer: PreTr...
  function load_and_cache_examples (line 104) | def load_and_cache_examples(cfg, tokenizer: PreTrainedTokenizer, _split=...
  function organize_multiple_dataset (line 141) | def organize_multiple_dataset(cfg, tokenizer: PreTrainedTokenizer, _spli...
  function if_cancel_sync (line 190) | def if_cancel_sync(cfg: DictConfig, step: int):
  function initialize_optimizer (line 197) | def initialize_optimizer(cfg: DictConfig, grouped_parameters: List[Dict]...
  function get_optimizer_grouped_parameters (line 270) | def get_optimizer_grouped_parameters(
  function initialize_lr_scheduler (line 317) | def initialize_lr_scheduler(cfg: DictConfig, optimizer, num_warmup_steps...
  function note_best_checkpoint (line 345) | def note_best_checkpoint(cfg: DictConfig, results: Dict[str, float], sub...
  function get_last_checkpoint (line 360) | def get_last_checkpoint(folder):

FILE: PFPO/general_util/transformer_engine.py
  function convert_model (line 23) | def convert_model(model, to_transformer_engine=True, _convert_linear=Tru...
  function has_transformer_engine_layers (line 74) | def has_transformer_engine_layers(model):

FILE: PFPO/models/dpo_utils.py
  function sft_loss_on_logits (line 18) | def sft_loss_on_logits(logits: torch.FloatTensor, labels: torch.LongTens...
  function llama_dpo_batch_forward (line 48) | def llama_dpo_batch_forward(model: Union[LlamaForCausalLM, GemmaForCausa...
  function llama_batch_forward (line 77) | def llama_batch_forward(model: Union[LlamaForCausalLM, GemmaForCausalLM,...
  function tdpo_get_batch_logps (line 89) | def tdpo_get_batch_logps(logits: torch.FloatTensor, reference_logits: to...
  function llama_last_token_cls_batch_forward (line 137) | def llama_last_token_cls_batch_forward(model: Union[LlamaModel, GemmaFor...
  function llama_token_batch_forward (line 158) | def llama_token_batch_forward(model: Union[LlamaModel, GemmaModel], line...
  function llama_last_token_forward_value (line 182) | def llama_last_token_forward_value(model: Union[LlamaModel, GemmaForCaus...

FILE: PFPO/models/ds_utils.py
  function init_ds_training_engine (line 8) | def init_ds_training_engine(model: PreTrainedModel, ds_cfg: DictConfig, ...
  function init_ds_eval_engine (line 28) | def init_ds_eval_engine(model: PreTrainedModel, ds_cfg: DictConfig):

FILE: PFPO/models/fs_tp_mixin.py
  class PretrainedModelParallelPreSplitMixin (line 11) | class PretrainedModelParallelPreSplitMixin(PreTrainedModelPeftMixin):
    method from_pretrained (line 13) | def from_pretrained(
    method save_pretrained (line 25) | def save_pretrained(
    method from_pretrained_with_ref_model (line 37) | def from_pretrained_with_ref_model(cls, pretrained_model_name_or_path:...

FILE: PFPO/models/llama.py
  function return_single_device_map (line 32) | def return_single_device_map():
  class LlamaForCausalLMDPO (line 36) | class LlamaForCausalLMDPO(PreTrainedModelPeftMixin, HfLlamaForCausalLM):
    method __init__ (line 37) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =...
    method dpo_loss (line 52) | def dpo_loss(
    method forward (line 98) | def forward(
    method save_pretrained (line 144) | def save_pretrained(
  class LlamaForCausalLMKTO (line 168) | class LlamaForCausalLMKTO(PreTrainedModelPeftMixin, HfLlamaForCausalLM):
    method __init__ (line 169) | def __init__(self, config, beta: float = 0.1, desirable_weight: float ...
    method kto_loss (line 179) | def kto_loss(
    method forward (line 190) | def forward(
    method save_pretrained (line 229) | def save_pretrained(
  class LlamaForCausalLMSimPO (line 253) | class LlamaForCausalLMSimPO(PreTrainedModelPeftMixin, HfLlamaForCausalLM):
    method __init__ (line 254) | def __init__(self, config, gamma: float, beta: float = 0.1, label_smoo...
    method simpo_loss (line 270) | def simpo_loss(
    method forward (line 306) | def forward(
    method save_pretrained (line 344) | def save_pretrained(
  class LlamaForCausalLMTDPO (line 368) | class LlamaForCausalLMTDPO(PreTrainedModelPeftMixin, HfLlamaForCausalLM):
    method __init__ (line 369) | def __init__(self, config, beta: float, alpha: float = 0.5, sft_loss: ...
    method tdpo_loss (line 382) | def tdpo_loss(self, chosen_logps_margin: torch.FloatTensor,
    method forward (line 422) | def forward(
    method save_pretrained (line 469) | def save_pretrained(
  class LlamaRewardModel (line 493) | class LlamaRewardModel(PreTrainedModelPeftMixin, LlamaPreTrainedModel):
    method __init__ (line 494) | def __init__(self, config: LlamaConfig, use_token_avg: bool = False):
    method pair_wise_loss (line 504) | def pair_wise_loss(self,
    method forward (line 510) | def forward(
  class LlamaRewardModelForEval (line 543) | class LlamaRewardModelForEval(LlamaRewardModel):
    method forward (line 544) | def forward(
  class LlamaModelForSequenceClassification (line 565) | class LlamaModelForSequenceClassification(PreTrainedModelPeftMixin, Llam...
    method __init__ (line 566) | def __init__(self, config: LlamaConfig):
    method forward (line 574) | def forward(
  class LlamaModelForSequenceClassificationForEval (line 597) | class LlamaModelForSequenceClassificationForEval(LlamaModelForSequenceCl...
    method __init__ (line 598) | def __init__(self, config: LlamaConfig, return_full_logits: bool = True):
    method forward (line 608) | def forward(
  class LlamaModelForSequenceClassificationForRL (line 625) | class LlamaModelForSequenceClassificationForRL(LlamaModelForSequenceClas...
    method __init__ (line 626) | def __init__(self, config: LlamaConfig, reduce_func: Callable):
    method forward (line 631) | def forward(
  class LlamaForCausalLM (line 651) | class LlamaForCausalLM(PreTrainedModelPeftMixin, HfLlamaForCausalLM):
    method forward (line 652) | def forward(self,

FILE: PFPO/models/llama_megatron_tp.py
  class ColumnParallelLinear (line 43) | class ColumnParallelLinear(ColumnParallelLinearMP):
    method forward (line 44) | def forward(self, input_: torch.Tensor, weight: Optional[torch.Tensor]...
  class RowParallelLinear (line 48) | class RowParallelLinear(RowParallelLinearMP):
    method forward (line 49) | def forward(self, input_):
  function init_megatron_mp_config (line 53) | def init_megatron_mp_config(*args, **kwargs):
  function attention_tp_init (line 64) | def attention_tp_init(self: LlamaAttention, config: LlamaConfig):
  class LlamaAttentionParallel (line 107) | class LlamaAttentionParallel(LlamaAttention):
    method __init__ (line 108) | def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None):
  class LlamaFlashAttention2Parallel (line 114) | class LlamaFlashAttention2Parallel(LlamaFlashAttention2):
    method __init__ (line 115) | def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None):
  class LlamaSdpaAttentionParallel (line 123) | class LlamaSdpaAttentionParallel(LlamaSdpaAttention):
    method __init__ (line 131) | def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None):
  class LlamaMLPParallel (line 137) | class LlamaMLPParallel(LlamaMLP):
    method __init__ (line 138) | def __init__(self, config: LlamaConfig):
  class LlamaModelParallel (line 175) | class LlamaModelParallel(LlamaModel):
    method __init__ (line 176) | def __init__(self, config: LlamaConfig):
  class LlamaForCausalLM (line 207) | class LlamaForCausalLM(PretrainedModelParallelPreSplitMixin, HfLlamaForC...
    method __init__ (line 208) | def __init__(self, config: LlamaConfig):
    method forward (line 233) | def forward(self,
  class LlamaModelForSequenceClassification (line 299) | class LlamaModelForSequenceClassification(PretrainedModelParallelPreSpli...
    method __init__ (line 300) | def __init__(self, config: LlamaConfig):
    method forward (line 308) | def forward(
  class LlamaModelForSequenceClassificationForRL (line 326) | class LlamaModelForSequenceClassificationForRL(PretrainedModelParallelPr...
    method __init__ (line 327) | def __init__(self, config: LlamaConfig, reduce_func: Callable):
    method forward (line 334) | def forward(
  class LlamaForCausalLMDPO (line 354) | class LlamaForCausalLMDPO(LlamaForCausalLM):
    method __init__ (line 355) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =...
    method dpo_loss (line 370) | def dpo_loss(
    method forward (line 416) | def forward(
    method save_pretrained (line 462) | def save_pretrained(

FILE: PFPO/models/llama_tp.py
  function attention_tp_init (line 35) | def attention_tp_init(self: LlamaAttention, config: LlamaConfig):
  class LlamaAttentionParallel (line 73) | class LlamaAttentionParallel(LlamaAttention):
    method __init__ (line 74) | def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None):
  class LlamaFlashAttention2Parallel (line 80) | class LlamaFlashAttention2Parallel(LlamaFlashAttention2):
    method __init__ (line 81) | def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None):
  class LlamaSdpaAttentionParallel (line 89) | class LlamaSdpaAttentionParallel(LlamaSdpaAttention):
    method __init__ (line 97) | def __init__(self, config: LlamaConfig, layer_idx: Optional[int] = None):
  class LlamaMLPParallel (line 103) | class LlamaMLPParallel(LlamaMLP):
    method __init__ (line 104) | def __init__(self, config: LlamaConfig):
  class LlamaModelParallel (line 137) | class LlamaModelParallel(LlamaModel):
    method __init__ (line 138) | def __init__(self, config: LlamaConfig):
  class LlamaForCausalLM (line 167) | class LlamaForCausalLM(PretrainedModelParallelPreSplitMixin, HfLlamaForC...
    method __init__ (line 168) | def __init__(self, config: LlamaConfig):
    method forward (line 175) | def forward(self,
  class LlamaModelForSequenceClassification (line 240) | class LlamaModelForSequenceClassification(PretrainedModelParallelPreSpli...
    method __init__ (line 241) | def __init__(self, config: LlamaConfig):
    method forward (line 249) | def forward(
  class LlamaModelForSequenceClassificationForRL (line 267) | class LlamaModelForSequenceClassificationForRL(PretrainedModelParallelPr...
    method __init__ (line 268) | def __init__(self, config: LlamaConfig, reduce_func: Callable):
    method forward (line 275) | def forward(
  class LlamaForCausalLMDPO (line 295) | class LlamaForCausalLMDPO(LlamaForCausalLM):
    method __init__ (line 296) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =...
    method dpo_loss (line 311) | def dpo_loss(
    method forward (line 357) | def forward(
    method save_pretrained (line 403) | def save_pretrained(

FILE: PFPO/models/megatron_tp_mixin.py
  class PretrainedModelParallelPreSplitMixin (line 12) | class PretrainedModelParallelPreSplitMixin(PreTrainedModelPeftMixin):
    method from_pretrained (line 14) | def from_pretrained(
    method save_pretrained (line 26) | def save_pretrained(
    method from_pretrained_with_ref_model (line 38) | def from_pretrained_with_ref_model(cls, pretrained_model_name_or_path:...
    method state_dict (line 48) | def state_dict(self, *args, **kwargs):

FILE: PFPO/models/mistral.py
  class MistralForCausalLMDPO (line 30) | class MistralForCausalLMDPO(PreTrainedModelPeftMixin, HfMistralForCausal...
    method __init__ (line 31) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =...
    method dpo_loss (line 46) | def dpo_loss(
    method forward (line 92) | def forward(
    method save_pretrained (line 138) | def save_pretrained(
  class MistralForCausalLMTDPO (line 162) | class MistralForCausalLMTDPO(PreTrainedModelPeftMixin, HfMistralForCausa...
    method __init__ (line 163) | def __init__(self, config, beta: float, alpha: float = 0.5, sft_loss: ...
    method tdpo_loss (line 175) | def tdpo_loss(self, chosen_logps_margin: torch.FloatTensor,
    method forward (line 215) | def forward(
    method save_pretrained (line 262) | def save_pretrained(
  class MistralForCausalLM (line 286) | class MistralForCausalLM(PreTrainedModelPeftMixin, HfMistralForCausalLM):
    method forward (line 287) | def forward(
  class MistralForSequenceClassification (line 351) | class MistralForSequenceClassification(PreTrainedModelPeftMixin, Mistral...
    method __init__ (line 352) | def __init__(self, config: MistralConfig):
    method forward (line 360) | def forward(
  class MistralForSequenceClassificationForEval (line 383) | class MistralForSequenceClassificationForEval(MistralForSequenceClassifi...
    method __init__ (line 384) | def __init__(self, config: MistralConfig, return_full_logits: bool = T...
    method forward (line 394) | def forward(

FILE: PFPO/models/mistral_tp.py
  function attention_tp_init (line 36) | def attention_tp_init(self: MistralAttention, config: MistralConfig):
  class MistralAttentionTensorParallel (line 71) | class MistralAttentionTensorParallel(MistralAttention):
    method __init__ (line 72) | def __init__(self, config: MistralConfig, layer_idx: Optional[int] = N...
  class MistralFlashAttentionTensorParallel (line 78) | class MistralFlashAttentionTensorParallel(MistralFlashAttention2):
    method __init__ (line 79) | def __init__(self, config: MistralConfig, layer_idx: Optional[int] = N...
  class MistralSdpaAttentionTensorParallel (line 87) | class MistralSdpaAttentionTensorParallel(MistralSdpaAttention):
    method __init__ (line 88) | def __init__(self, config: MistralConfig, layer_idx: Optional[int] = N...
  class MistralMLPTensorParallel (line 94) | class MistralMLPTensorParallel(MistralMLP):
    method __init__ (line 95) | def __init__(self, config: MistralConfig):
  class MistralModelTensorParallel (line 127) | class MistralModelTensorParallel(MistralModel):
    method __init__ (line 128) | def __init__(self, config: MistralConfig):
  class MistralForCausalLM (line 147) | class MistralForCausalLM(PretrainedModelParallelPreSplitMixin, HfMistral...
    method __init__ (line 148) | def __init__(self, config: MistralConfig):
    method forward (line 157) | def forward(
  class MistralForCausalLMDPO (line 220) | class MistralForCausalLMDPO(MistralForCausalLM):
    method __init__ (line 221) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =...
    method dpo_loss (line 236) | def dpo_loss(
    method forward (line 282) | def forward(
    method save_pretrained (line 328) | def save_pretrained(
  class MistralForCausalLMTDPO (line 356) | class MistralForCausalLMTDPO(MistralForCausalLM):
    method __init__ (line 357) | def __init__(self, config, beta: float, alpha: float = 0.5, sft_loss: ...
    method tdpo_loss (line 369) | def tdpo_loss(self, chosen_logps_margin: torch.FloatTensor,
    method forward (line 409) | def forward(
    method save_pretrained (line 456) | def save_pretrained(

FILE: PFPO/models/mixin.py
  function return_single_device_map (line 15) | def return_single_device_map():
  function return_reference_model (line 19) | def return_reference_model():
  function set_reference_model (line 23) | def set_reference_model(model: PreTrainedModel):
  class PreTrainedModelPeftMixin (line 28) | class PreTrainedModelPeftMixin(PreTrainedModel):
    method from_pretrained (line 32) | def from_pretrained(cls, pretrained_model_name_or_path: Optional[Union...
    method from_pretrained_with_ref_model (line 42) | def from_pretrained_with_ref_model(cls, pretrained_model_name_or_path:...
    method deepspeed_set_ref_engine_lazy (line 58) | def deepspeed_set_ref_engine_lazy(ref_model):

FILE: PFPO/models/qwen2.py
  class Qwen2ForCausalLM (line 23) | class Qwen2ForCausalLM(PreTrainedModelPeftMixin, HfQwen2ForCausalLM):
    method forward (line 25) | def forward(
  class Qwen2RewardModel (line 89) | class Qwen2RewardModel(PreTrainedModelPeftMixin, HfQwen2ForCausalLM):
    method __init__ (line 90) | def __init__(self, config: Qwen2Config):
    method pair_wise_loss (line 99) | def pair_wise_loss(chosen_rewards: torch.FloatTensor,
    method forward (line 104) | def forward(
  class Qwen2ForSequenceClassification (line 134) | class Qwen2ForSequenceClassification(PreTrainedModelPeftMixin, HfQwen2Fo...
    method __init__ (line 135) | def __init__(self, config: Qwen2Config):
    method forward (line 143) | def forward(
  class Qwen2ForCausalLMDPO (line 168) | class Qwen2ForCausalLMDPO(PreTrainedModelPeftMixin, HfQwen2ForCausalLM):
    method __init__ (line 169) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =...
    method dpo_loss (line 187) | def dpo_loss(
    method forward (line 233) | def forward(
    method save_pretrained (line 297) | def save_pretrained(

FILE: PFPO/models/qwen2_megatron_tp.py
  class ColumnParallelLinear (line 43) | class ColumnParallelLinear(ColumnParallelLinearMP):
    method forward (line 44) | def forward(self, input_: torch.Tensor, weight: Optional[torch.Tensor]...
  class RowParallelLinear (line 48) | class RowParallelLinear(RowParallelLinearMP):
    method forward (line 49) | def forward(self, input_):
  function init_megatron_mp_config (line 53) | def init_megatron_mp_config(*args, **kwargs):
  function attention_tp_init (line 64) | def attention_tp_init(self: Qwen2Attention, config: Qwen2Config):
  class Qwen2AttentionParallel (line 107) | class Qwen2AttentionParallel(Qwen2Attention):
    method __init__ (line 108) | def __init__(self, config: Qwen2Config, layer_idx: Optional[int] = None):
  class Qwen2FlashAttention2Parallel (line 114) | class Qwen2FlashAttention2Parallel(Qwen2FlashAttention2):
    method __init__ (line 115) | def __init__(self, config: Qwen2Config, layer_idx: Optional[int] = None):
  class Qwen2SdpaAttentionParallel (line 123) | class Qwen2SdpaAttentionParallel(Qwen2SdpaAttention):
    method __init__ (line 131) | def __init__(self, config: Qwen2Config, layer_idx: Optional[int] = None):
  class Qwen2MLPParallel (line 137) | class Qwen2MLPParallel(Qwen2MLP):
    method __init__ (line 138) | def __init__(self, config: Qwen2Config):
  class Qwen2ModelParallel (line 175) | class Qwen2ModelParallel(Qwen2Model):
    method __init__ (line 176) | def __init__(self, config: Qwen2Config):
  class Qwen2ForCausalLM (line 207) | class Qwen2ForCausalLM(PretrainedModelParallelPreSplitMixin, HfQwen2ForC...
    method __init__ (line 208) | def __init__(self, config: Qwen2Config):
    method forward (line 217) | def forward(self,
  class Qwen2ModelForSequenceClassification (line 283) | class Qwen2ModelForSequenceClassification(PretrainedModelParallelPreSpli...
    method __init__ (line 284) | def __init__(self, config: Qwen2Config):
    method forward (line 292) | def forward(
  class Qwen2ModelForSequenceClassificationForRL (line 310) | class Qwen2ModelForSequenceClassificationForRL(PretrainedModelParallelPr...
    method __init__ (line 311) | def __init__(self, config: Qwen2Config, reduce_func: Callable):
    method forward (line 318) | def forward(
  class Qwen2ForCausalLMDPO (line 338) | class Qwen2ForCausalLMDPO(Qwen2ForCausalLM):
    method __init__ (line 339) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =...
    method dpo_loss (line 354) | def dpo_loss(
    method forward (line 400) | def forward(
    method save_pretrained (line 446) | def save_pretrained(

FILE: PFPO/models/qwen2_tp.py
  function attention_tp_init (line 35) | def attention_tp_init(self: Qwen2Attention, config: Qwen2Config):
  class Qwen2AttentionParallel (line 71) | class Qwen2AttentionParallel(Qwen2Attention):
    method __init__ (line 72) | def __init__(self, config: Qwen2Config, layer_idx: Optional[int] = None):
  class Qwen2FlashAttention2Parallel (line 78) | class Qwen2FlashAttention2Parallel(Qwen2FlashAttention2):
    method __init__ (line 79) | def __init__(self, config: Qwen2Config, layer_idx: Optional[int] = None):
  class Qwen2SdpaAttentionParallel (line 87) | class Qwen2SdpaAttentionParallel(Qwen2SdpaAttention):
    method __init__ (line 95) | def __init__(self, config: Qwen2Config, layer_idx: Optional[int] = None):
  class Qwen2MLPParallel (line 101) | class Qwen2MLPParallel(Qwen2MLP):
    method __init__ (line 102) | def __init__(self, config: Qwen2Config):
  class Qwen2ModelParallel (line 135) | class Qwen2ModelParallel(Qwen2Model):
    method __init__ (line 136) | def __init__(self, config: Qwen2Config):
  class Qwen2ForCausalLM (line 165) | class Qwen2ForCausalLM(PretrainedModelParallelPreSplitMixin, HfQwen2ForC...
    method __init__ (line 166) | def __init__(self, config: Qwen2Config):
    method forward (line 173) | def forward(self,
  class Qwen2ModelForSequenceClassification (line 239) | class Qwen2ModelForSequenceClassification(PretrainedModelParallelPreSpli...
    method __init__ (line 240) | def __init__(self, config: Qwen2Config):
    method forward (line 248) | def forward(
  class Qwen2ModelForSequenceClassificationForRL (line 266) | class Qwen2ModelForSequenceClassificationForRL(PretrainedModelParallelPr...
    method __init__ (line 267) | def __init__(self, config: Qwen2Config, reduce_func: Callable):
    method forward (line 274) | def forward(
  class Qwen2ForCausalLMDPO (line 294) | class Qwen2ForCausalLMDPO(Qwen2ForCausalLM):
    method __init__ (line 295) | def __init__(self, config, beta: float = 0.1, label_smoothing: float =...
    method dpo_loss (line 311) | def dpo_loss(
    method forward (line 357) | def forward(
    method save_pretrained (line 410) | def save_pretrained(

FILE: PFPO/models/utils.py
  function find_all_linear_names (line 35) | def find_all_linear_names(model, bits: int, add_lm_head: bool = False):
  function initialize_peft_model (line 50) | def initialize_peft_model(model: PreTrainedModel, lora_config: DictConfi...
  function enable_gradient_checkpointing (line 93) | def enable_gradient_checkpointing(model: PreTrainedModel):
  class DPOModelOutput (line 100) | class DPOModelOutput(ModelOutput):
  class RewardModelOutput (line 113) | class RewardModelOutput(ModelOutput):
  function return_single_device_map (line 119) | def return_single_device_map():
  function reward_logit2prob (line 123) | def reward_logit2prob(reduction_ids):
  function reward_logit (line 140) | def reward_logit(reduction_ids):
  function squeeze_reduce_return_fn (line 156) | def squeeze_reduce_return_fn():

FILE: PFPO/openai_api_caller_v1.py
  function default_collate_fn (line 39) | def default_collate_fn(batch):
  function run_inference (line 42) | def run_inference(cfg: DictConfig, model: torch.nn.Module, dataset):
  function main (line 87) | def main(cfg: DictConfig):

FILE: PFPO/post_inference.py
  function evaluate (line 39) | def evaluate(cfg: DictConfig, model, prefix="", _split="dev"):
  function main (line 84) | def main(cfg: DictConfig):

FILE: PFPO/post_processors/code/clean.py
  function standard_cleaner (line 4) | def standard_cleaner(completion: str):
  function standard_cleaner_default (line 14) | def standard_cleaner_default(completion: str):
  function tag_cleaner (line 24) | def tag_cleaner(completion: str):
  function get (line 42) | def get(name: str):

FILE: PFPO/post_processors/code/code.py
  function _mp_init_ (line 21) | def _mp_init_(_eval_func: Callable):
  function _eval_worker (line 26) | def _eval_worker(_input):
  class APPsEvaluator (line 47) | class APPsEvaluator:
    method __init__ (line 48) | def __init__(self, ):
    method __call__ (line 51) | def __call__(self, predictions, num_workers: int = 16):
  class CodeExtractor (line 153) | class CodeExtractor:
    method __init__ (line 154) | def __init__(self, output_file: str, answer_clean: Callable, resume: b...
    method __call__ (line 189) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic...
    method batch_call (line 236) | def batch_call(self, meta_data: List[Dict[str, Any]], batch_model_outp...
    method eval_single_response (line 241) | def eval_single_response(self, response: str, test_cases):
    method get_results (line 248) | def get_results(self):

FILE: PFPO/post_processors/code/evaluator.py
  function return_apps_evaluator (line 12) | def return_apps_evaluator(timeout: int = 10, debug: bool = False):
  class HumanEvaluator (line 16) | class HumanEvaluator:
    method __init__ (line 17) | def __init__(self, ):
    method __call__ (line 20) | def __call__(self, predictions, num_workers: int = 16):
  class MBPPEvaluator (line 100) | class MBPPEvaluator:
    method __init__ (line 101) | def __init__(self, ):
    method __call__ (line 104) | def __call__(self, predictions, num_workers: int = 16):

FILE: PFPO/post_processors/dist_mixin.py
  class DistGatherMixin (line 7) | class DistGatherMixin:
    method gather (line 8) | def gather(self):
    method gather_object (line 12) | def gather_object(objects: List[Any]):
  class SFTLossOnlyPostProcessor (line 24) | class SFTLossOnlyPostProcessor(DistGatherMixin):
    method __init__ (line 25) | def __init__(self):
    method __call__ (line 29) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic...
    method get_results (line 39) | def get_results(self, output_dir: str):

FILE: PFPO/post_processors/dpo.py
  class DPOEvalPostProcessor (line 16) | class DPOEvalPostProcessor(DistGatherMixin):
    method __init__ (line 17) | def __init__(self):
    method __call__ (line 24) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic...
    method get_results (line 66) | def get_results(self, output_dir: str):
  class DPORewardPostProcessor (line 91) | class DPORewardPostProcessor(DistGatherMixin):
    method __init__ (line 92) | def __init__(self):
    method __call__ (line 97) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic...
    method get_results (line 139) | def get_results(self, output_dir: str):
  class ResponseClsPostProcessor (line 161) | class ResponseClsPostProcessor(DistGatherMixin):
    method __init__ (line 162) | def __init__(self):
    method __call__ (line 166) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic...
    method get_results (line 200) | def get_results(self, output_dir: str):
  function process_response (line 225) | def process_response(response: str):
  function process_response_v2 (line 231) | def process_response_v2(response: str):
  class ResponseProcessRewardPostProcessor (line 297) | class ResponseProcessRewardPostProcessor(DistGatherMixin):
    method __init__ (line 298) | def __init__(self, reduction: str = "product", prob_labels: str = "(2,...
    method logit2prob (line 308) | def logit2prob(self, logits):
    method __call__ (line 313) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic...
    method get_results (line 360) | def get_results(self, output_dir: str):
  class ResponseProcessRewardPostProcessorV2 (line 385) | class ResponseProcessRewardPostProcessorV2(DistGatherMixin):
    method __init__ (line 386) | def __init__(self, reduction: str = "product", prob_labels: str = "(2,...
    method logit2prob (line 396) | def logit2prob(self, logits):
    method __call__ (line 401) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic...
    method get_results (line 452) | def get_results(self, output_dir: str):
  class DPORewardSinglePostProcessor (line 480) | class DPORewardSinglePostProcessor(DistGatherMixin):
    method __init__ (line 481) | def __init__(self):
    method __call__ (line 485) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic...
    method get_results (line 515) | def get_results(self, output_dir: str):

FILE: PFPO/post_processors/openai_api_callback.py
  class PlaceholderClean (line 19) | class PlaceholderClean:
    method __call__ (line 20) | def __call__(self, pred: str):
  class MCQAAnswerClean (line 24) | class MCQAAnswerClean:
    method __init__ (line 25) | def __init__(self, prompt: str = "zero-shot"):
    method __call__ (line 28) | def __call__(self, pred: str):
  class SeparatorClean (line 41) | class SeparatorClean:
    method __init__ (line 42) | def __init__(self, separator: str = "Finish", separate_idx: int = 1, r...
    method __call__ (line 47) | def __call__(self, pred: str):
  class ReActSeparatorClean (line 64) | class ReActSeparatorClean:  # FIXED@2024-01-03: Add hard constraint.
    method __init__ (line 65) | def __init__(self, separator: str = "Context:", separate_idx: int = 0,...
    method __call__ (line 70) | def __call__(self, pred: str):
  class BinaryAnswerClean (line 88) | class BinaryAnswerClean:
    method __init__ (line 89) | def __init__(self, prompt: str = "zero-shot"):
    method __call__ (line 92) | def __call__(self, pred: str):
  class TagCleaner (line 104) | class TagCleaner:
    method __call__ (line 105) | def __call__(self, pred: str):
  class OpenAICallBack (line 115) | class OpenAICallBack:
    method __init__ (line 116) | def __init__(self, output_file: str, answer_clean: Union[MCQAAnswerCle...
    method __call__ (line 149) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic...
    method batch_call (line 190) | def batch_call(self, meta_data: List[Dict[str, Any]], batch_model_outp...
    method eval_single_item (line 196) | def eval_single_item(pred, label):
    method get_results (line 211) | def get_results(self):
  class SaveOnlyCallBack (line 274) | class SaveOnlyCallBack(OpenAICallBack):
    method __call__ (line 275) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic...
    method get_results (line 310) | def get_results(self):
  function majority_voting_predict (line 319) | def majority_voting_predict(preds):
  class OpenAIMATHCallBack (line 343) | class OpenAIMATHCallBack(OpenAICallBack):
    method __init__ (line 348) | def __init__(self, *args, eval_fn: str = "meta_math", **kwargs):
    method get_results (line 352) | def get_results(self):
  class DeepSeekMathCallBack (line 416) | class DeepSeekMathCallBack(OpenAICallBack):
    method __init__ (line 427) | def __init__(self, *args, eval_fn: str = "gsm8k", **kwargs):
    method __call__ (line 435) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic...
    method get_results (line 475) | def get_results(self):
  class MathScaleCallBack (line 575) | class MathScaleCallBack(OpenAICallBack):
    method __call__ (line 577) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic...
    method get_results (line 645) | def get_results(self):
  function fix_trailing_comma (line 687) | def fix_trailing_comma(json_string):
  function extract_json_content_rep (line 693) | def extract_json_content_rep(input_str):
  function extract_json_content (line 709) | def extract_json_content(input_str):
  class JsonObjEvalCallBack (line 727) | class JsonObjEvalCallBack(OpenAICallBack):
    method json_parse_and_eval (line 729) | def json_parse_and_eval(response: str, label: dict):
    method __call__ (line 748) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic...
    method get_results (line 802) | def get_results(self):

FILE: PFPO/post_processors/pattern/tags.py
  function think_tag_cleaner (line 4) | def think_tag_cleaner(completion: str):
  function solution_tag_cleaner (line 18) | def solution_tag_cleaner(completion: str):
  function output_tag_cleaner (line 31) | def output_tag_cleaner(completion: str):
  function get (line 51) | def get(name: str):

FILE: PFPO/post_processors/qwen25_math_callback.py
  function _annotate (line 20) | def _annotate(param):
  class Qwen25MathCallBack (line 24) | class Qwen25MathCallBack(OpenAICallBack):
    method __init__ (line 25) | def __init__(self, *args, num_workers: int = 16, **kwargs):
    method __call__ (line 29) | def __call__(self, meta_data: Dict[str, Any], batch_model_outputs: Dic...
    method get_results (line 79) | def get_results(self):

FILE: PFPO/scripts/apps/analyze/freq2image.py
  function draw_double_histogram (line 10) | def draw_double_histogram(correct_data, incorrect_data, file_path):
  function draw_histogram (line 27) | def draw_histogram(data, labels, file_path):
  function draw_line_plot (line 52) | def draw_line_plot(correct_data, incorrect_data, file_path):
  function main (line 81) | def main():

FILE: PFPO/scripts/apps/analyze/get_output_frequency.py
  function worker (line 15) | def worker(x):
  function load_files (line 131) | def load_files(file_path):
  function merge_key (line 149) | def merge_key(item, value):
  function merge_seed_sampled_data (line 158) | def merge_seed_sampled_data(data):
  function main (line 189) | def main():

FILE: PFPO/scripts/apps/construct_prefer_pair.py
  function main (line 11) | def main():

FILE: PFPO/scripts/apps/construct_prefer_pair_rm.py
  function main (line 11) | def main():

FILE: PFPO/scripts/apps/construct_prefer_pair_soft.py
  function main (line 16) | def main():

FILE: PFPO/scripts/apps/eval_gpt4_outputs.py
  function main (line 14) | def main():

FILE: PFPO/scripts/apps/execute_gold_sol_on_test_case.py
  function extract_solution_between_tags (line 21) | def extract_solution_between_tags(text):
  function extract_test_cases (line 32) | def extract_test_cases(text):
  function _worker (line 45) | def _worker(item):
  function main (line 63) | def main():

FILE: PFPO/scripts/apps/extract_pseudo_outputs_as_label.py
  function main (line 9) | def main():

FILE: PFPO/scripts/apps/get_output_frequency.py
  function main (line 11) | def main():

FILE: PFPO/scripts/apps/gpt4o_to_normal_pred_format.py
  function main (line 13) | def main():

FILE: PFPO/scripts/apps/merge_dp_predictions.py
  function main (line 12) | def main():

FILE: PFPO/scripts/apps/pp_critique_difficulty.py
  function main (line 15) | def main():

FILE: PFPO/scripts/apps/pp_eval_gpt4.py
  function main (line 13) | def main():

FILE: PFPO/scripts/apps/pp_eval_gpt4_general_combine.py
  function main (line 13) | def main():

FILE: PFPO/scripts/apps/pp_solution_gen_inputs.py
  function main (line 36) | def main():

FILE: PFPO/scripts/apps/pp_test_case.py
  function extract_content_between_tags (line 20) | def extract_content_between_tags(text):
  function extract_test_cases (line 31) | def extract_test_cases(text):
  function main (line 44) | def main():

FILE: PFPO/scripts/apps/pp_test_case_gen_inputs.py
  function main (line 34) | def main():

FILE: PFPO/scripts/apps/pp_test_case_gen_inputs_v2.0.py
  function main (line 11) | def main():

FILE: PFPO/scripts/apps/pp_test_case_gen_outputs.py
  function extract_test_cases (line 63) | def extract_test_cases(text):
  function main (line 76) | def main():

FILE: PFPO/scripts/apps/pp_test_case_gen_public_outputs.py
  function main (line 86) | def main():

FILE: PFPO/scripts/apps/pp_test_case_gen_public_outputs_few_shot.py
  function main (line 14) | def main():

FILE: PFPO/scripts/apps/pp_test_case_gen_public_outputs_few_shot_verify.py
  function extract_content_between_tags (line 17) | def extract_content_between_tags(text):
  function main (line 29) | def main():

FILE: PFPO/scripts/apps/pp_worsen_inputs.py
  function main (line 19) | def main():

FILE: PFPO/scripts/apps/prm/construct_process_rm_sample.py
  function counting_partial_response_value (line 23) | def counting_partial_response_value(res):
  function parse_value (line 27) | def parse_value(v, binary: bool):
  function _process_trajectories_worker (line 33) | def _process_trajectories_worker(item, top_k: int, binary: bool):
  function _annotate (line 56) | def _annotate(file):
  function multiprocessing_loading (line 60) | def multiprocessing_loading(files, num_workers: int = 8):
  function main (line 73) | def main():

FILE: PFPO/scripts/apps/prm/construct_process_rm_sample_fix.py
  function counting_partial_response_value (line 23) | def counting_partial_response_value(full_res):
  function annotate (line 36) | def annotate(file, exclude: str = ""):
  function multiprocessing_loading (line 44) | def multiprocessing_loading(files, exclude: str = "", num_workers: int =...
  function main (line 59) | def main():

FILE: PFPO/scripts/apps/prm/sample_steps.py
  function sample_step (line 14) | def sample_step(response: str, code: str, upper_step_ratio: float, sampl...
  function load_files (line 46) | def load_files(file_path):
  function merge_key (line 65) | def merge_key(item, value):
  function merge_seed_sampled_data (line 74) | def merge_seed_sampled_data(data):
  function main (line 98) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/clean_oss_mistral_data.py
  function load_file (line 8) | def load_file(file_path):
  function extract_json (line 25) | def extract_json(completion: str):
  function load_test_cases (line 42) | def load_test_cases(item):
  function load_func_head (line 67) | def load_func_head(item) -> str:
  function main (line 84) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/clean_xcode_4o_test_inputs_data.py
  function load_file (line 8) | def load_file(file_path):
  function load_test_cases (line 25) | def load_test_cases(item):
  function main (line 63) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/collect_pseudo_outputs.py
  function worker (line 20) | def worker(item, pseudo_test_case_field):
  function main (line 91) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/combine_gpt_raw_requests.py
  function main (line 15) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/combine_pseudo_test_inputs.py
  function extract_test_case_inputs (line 13) | def extract_test_case_inputs(item):
  function main (line 50) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/oss_combine_collect_pseudo_outputs.py
  function worker (line 26) | def worker(item, min_success_test_num: int = 1):
  function main (line 104) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/oss_combine_collect_pseudo_outputs_mp.py
  function worker (line 24) | def worker(item, min_success_test_num: int = 1, top_p: float = 0.0):
  function load_files (line 128) | def load_files(file_path):
  function merge_key (line 147) | def merge_key(item, value):
  function merge_seed_sampled_data (line 156) | def merge_seed_sampled_data(data):
  function main (line 208) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/oss_combine_collect_pseudo_outputs_mp_compress.py
  function worker (line 26) | def worker(item, min_success_test_num: int = 1, top_p: float = 0.0):
  function load_files (line 113) | def load_files(file_path):
  function merge_key (line 132) | def merge_key(item, value):
  function merge_seed_sampled_data (line 141) | def merge_seed_sampled_data(data):
  function main (line 193) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/oss_combine_collect_pseudo_outputs_takes_extra.py
  function worker (line 22) | def worker(_input, min_success_test_num: int = 1, top_p: float = 0.0):
  function load_files (line 129) | def load_files(file_path):
  function merge_key (line 148) | def merge_key(item, value):
  function merge_seed_sampled_data (line 157) | def merge_seed_sampled_data(data):
  function main (line 219) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/oss_combine_prefix_fail_extract_pseudo_label.py
  function _worker (line 19) | def _worker(item):
  function main (line 86) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/oss_combine_run_extract_pseudo_label.py
  function _worker (line 19) | def _worker(item):
  function main (line 56) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/pp_inputs_pick_problem_evol.py
  function main (line 5) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/pp_inputs_pick_problem_oss.py
  function main (line 5) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/prefix_fail_extract_pseudo_label.py
  function _worker (line 22) | def _worker(item):
  function main (line 59) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/prefix_fail_extract_pseudo_label_align_ts_num.py
  function _worker (line 23) | def _worker(item):
  function main (line 60) | def main():

FILE: PFPO/scripts/apps/pseudo_test_cases/xcode_pp_test_case_gen.py
  function main (line 30) | def main():

FILE: PFPO/scripts/apps/re_verify_solutions.py
  function main (line 5) | def main():

FILE: PFPO/scripts/apps/rerank_code_rm.py
  function main (line 11) | def main():

FILE: PFPO/scripts/apps/solution_fail_extract.py
  function extract_solution_between_tags (line 21) | def extract_solution_between_tags(text):
  function extract_test_cases (line 32) | def extract_test_cases(text):
  function _worker (line 45) | def _worker(item):
  function main (line 98) | def main():

FILE: PFPO/scripts/apps/solution_fail_extract_critique.py
  function _worker (line 21) | def _worker(item):
  function main (line 75) | def main():

FILE: PFPO/scripts/apps/solution_fail_extract_pseudo_label.py
  function _worker (line 23) | def _worker(item):
  function main (line 60) | def main():

FILE: PFPO/scripts/apps/solution_run_outputs.py
  function extract_solution_between_tags (line 21) | def extract_solution_between_tags(text):
  function extract_test_cases (line 32) | def extract_test_cases(text):
  function _worker (line 45) | def _worker(item):
  function main (line 103) | def main():

FILE: PFPO/scripts/apps/solution_run_outputs_local.py
  function _worker (line 25) | def _worker(item, test_case_field: str):
  function has_surrogate_characters (line 89) | def has_surrogate_characters(text):
  function load_files (line 93) | def load_files(file_path):
  function merge_key (line 112) | def merge_key(item, value):
  function merge_seed_sampled_data (line 121) | def merge_seed_sampled_data(data, id_field: str = "id"):
  function main (line 144) | def main():

FILE: PFPO/scripts/apps/solution_run_pseudo_outputs_local.py
  function extract_test_case_inputs (line 21) | def extract_test_case_inputs(item):
  function _worker (line 68) | def _worker(item):
  function main (line 124) | def main():

FILE: PFPO/scripts/apps/utils_execute.py
  class CODE_TYPE (line 34) | class CODE_TYPE(Enum):
  class TimeoutException (line 40) | class TimeoutException(Exception):
  function timeout_handler (line 44) | def timeout_handler(signum, frame):
  class Capturing (line 57) | class Capturing(list):
    method __enter__ (line 58) | def __enter__(self):
    method __exit__ (line 65) | def __exit__(self, *args):
  function parse_args (line 71) | def parse_args():
  function check_correctness (line 88) | def check_correctness(in_outs: Dict, generation, timeout, debug, return_...
  function run_inference_process (line 130) | def run_inference_process(in_outs: Dict, generation, timeout, debug, ret...
  function run_test (line 182) | def run_test(in_outs: Dict = None, test: str = None, debug: bool = False...
  function run_inference (line 579) | def run_inference(in_outs: Dict = None, test: str = None, debug: bool = ...
  function custom_compare_ (line 995) | def custom_compare_(output, ground_truth):
  function stripped_string_compare (line 1010) | def stripped_string_compare(s1, s2):
  function call_method (line 1016) | def call_method(method, inputs):
  function reliability_guard (line 1042) | def reliability_guard(maximum_memory_bytes=None):
  function main (line 1123) | def main():

FILE: PFPO/scripts/apps/worsen_gpt4_combine.py
  function main (line 18) | def main():

FILE: PFPO/scripts/collect_mbpp_test_cases_outputs_sc_v1.0.py
  function process_completion (line 10) | def process_completion(completion: str):
  function main (line 33) | def main():

FILE: PFPO/scripts/eval_mbpp_judgement.py
  function mbpp_prediction_eval_judge (line 9) | def mbpp_prediction_eval_judge(prediction):
  function mbpp_judge (line 25) | def mbpp_judge(file_path, prompt2passed):
  function main (line 48) | def main():

FILE: PFPO/scripts/eval_mbpp_judgement_v2.py
  function mbpp_prediction_eval_judge (line 9) | def mbpp_prediction_eval_judge(prediction):
  function mbpp_judge (line 25) | def mbpp_judge(file_path):
  function main (line 49) | def main():

FILE: PFPO/scripts/execute_mbpp_intermediate_res.py
  function capture_print_output (line 68) | def capture_print_output(code):
  function _process_item (line 92) | def _process_item(item):
  function main (line 124) | def main():

FILE: PFPO/scripts/execute_mbpp_intermediate_res_mp.py
  function check_correctness (line 28) | def check_correctness(check_program, timeout, task_id, completion_id):
  function capture_print_output (line 61) | def capture_print_output(code):
  function unsafe_execute (line 87) | def unsafe_execute(check_program, result, timeout):
  function time_limit (line 121) | def time_limit(seconds):
  function swallow_io (line 134) | def swallow_io():
  function create_tempdir (line 143) | def create_tempdir():
  class TimeoutException (line 149) | class TimeoutException(Exception):
  class WriteOnlyStringIO (line 153) | class WriteOnlyStringIO(io.StringIO):
    method read (line 156) | def read(self, *args, **kwargs):
    method readline (line 159) | def readline(self, *args, **kwargs):
    method readlines (line 162) | def readlines(self, *args, **kwargs):
    method readable (line 165) | def readable(self, *args, **kwargs):
  class redirect_stdin (line 170) | class redirect_stdin(contextlib._RedirectStream):  # type: ignore
  function chdir (line 175) | def chdir(root):
  function reliability_guard (line 189) | def reliability_guard(maximum_memory_bytes=None):

FILE: PFPO/scripts/math/analyze_sc.py
  function majority_voting_predict (line 10) | def majority_voting_predict(preds):
  function plot_histogram (line 34) | def plot_histogram(data, bins=10, x_label="Value", y_label="Frequency", ...
  function main (line 44) | def main():

FILE: PFPO/scripts/math/deepseek_math_sample_steps.py
  function sample_step (line 10) | def sample_step(response: str, upper_step_ratio: float, sample_ratio: fl...
  function get_pred_set (line 37) | def get_pred_set(preds):
  function main (line 50) | def main():

FILE: PFPO/scripts/math/estimate_state_value.py
  function main (line 25) | def main():

FILE: PFPO/scripts/math/merge_dp_multi_solution.py
  function main (line 14) | def main():

FILE: PFPO/scripts/math/merge_dp_predictions.py
  function pred2str (line 15) | def pred2str(pred):
  function main (line 25) | def main():

FILE: PFPO/scripts/math/merge_incomplete_predictions.py
  function pred2str (line 15) | def pred2str(pred):
  function load_data (line 25) | def load_data(file_path):
  function main (line 37) | def main():

FILE: PFPO/scripts/math/merge_rm_dp_multi_solution.py
  function main (line 7) | def main():

FILE: PFPO/scripts/math/rerank_w_orm.py
  function load_rewards (line 18) | def load_rewards(reward_file):
  function _init (line 30) | def _init(id2reward):
  function _worker (line 35) | def _worker(item, sc_top_k=None):
  function main (line 84) | def main():

FILE: PFPO/scripts/math/rerank_w_prm.py
  function load_rewards (line 17) | def load_rewards(reward_file, re_index):
  function reward_reduction (line 33) | def reward_reduction(ending_logits, reduction: str = "min", norm: bool =...
  function weighted_majority_voting_predict (line 53) | def weighted_majority_voting_predict(preds, weights):
  function _init (line 62) | def _init(id2reward):
  function _worker (line 67) | def _worker(item, reduction, norm, sc_top_k=None):
  function main (line 148) | def main():

FILE: PFPO/scripts/math/rerank_w_prm_combine.py
  function load_rewards (line 10) | def load_rewards(reward_file):
  function reward_reduction (line 22) | def reward_reduction(ending_logits, reduction: str = "min", norm: bool =...
  function merge_rewards (line 42) | def merge_rewards(group_logits, weights, reduction: str = "min", norm: b...
  function main (line 102) | def main():

FILE: PFPO/scripts/math_scale/analyze/compute_acc_by_id.py
  function majority_voting_frequency (line 18) | def majority_voting_frequency(preds):
  function merge_key (line 36) | def merge_key(item, value):
  function merge_seed_sampled_data (line 45) | def merge_seed_sampled_data(data):
  function main (line 69) | def main():

FILE: PFPO/scripts/math_scale/analyze/draw_sc.py
  function draw_line_plot (line 9) | def draw_line_plot(data, file_path, baseline, baseline_label):
  function main (line 40) | def main():

FILE: PFPO/scripts/math_scale/analyze/extract_hard_questions.py
  function majority_voting_frequency (line 18) | def majority_voting_frequency(preds):
  function merge_key (line 36) | def merge_key(item, value):
  function merge_seed_sampled_data (line 45) | def merge_seed_sampled_data(data):
  function main (line 69) | def main():

FILE: PFPO/scripts/math_scale/analyze/freq2image.py
  function plot_bar_chart (line 8) | def plot_bar_chart(data, file_path):
  function draw_line_plot (line 41) | def draw_line_plot(data, file_path):
  function main (line 63) | def main():

FILE: PFPO/scripts/math_scale/analyze/get_output_frequency.py
  function majority_voting_frequency (line 17) | def majority_voting_frequency(preds):
  function worker (line 35) | def worker(item, n: int):
  function merge_key (line 46) | def merge_key(item, value):
  function merge_seed_sampled_data (line 55) | def merge_seed_sampled_data(data):
  function main (line 79) | def main():

FILE: PFPO/scripts/math_scale/concat_data.py
  function main (line 9) | def main():

FILE: PFPO/scripts/math_scale/construct_prefer_pair.py
  function merge_key (line 13) | def merge_key(item, value):
  function merge_seed_sampled_data (line 22) | def merge_seed_sampled_data(data):
  function main (line 46) | def main():

FILE: PFPO/scripts/math_scale/construct_prefer_pair_sc.py
  function evaluate_by_sc (line 14) | def evaluate_by_sc(item, external_sc: str = None):
  function majority_voting_frequency (line 34) | def majority_voting_frequency(preds):
  function get_pred_frequency (line 52) | def get_pred_frequency(preds, target_pred):
  function merge_key (line 68) | def merge_key(item, value):
  function merge_seed_sampled_data (line 77) | def merge_seed_sampled_data(data):
  function load_data (line 101) | def load_data(file_path):
  function main (line 125) | def main():

FILE: PFPO/scripts/math_scale/construct_process_rm_sample_gd.py
  function counting_partial_response_value (line 16) | def counting_partial_response_value(preds, label):
  function parse_value (line 26) | def parse_value(v, binary: bool):
  function _process_response_worker (line 32) | def _process_response_worker(item):
  function _process_trajectories_worker (line 52) | def _process_trajectories_worker(item, binary: bool):
  function merge_key (line 74) | def merge_key(item, value):
  function merge_seed_sampled_data (line 83) | def merge_seed_sampled_data(data, id_field="id"):
  function main (line 107) | def main():

FILE: PFPO/scripts/math_scale/construct_process_rm_sample_sc.py
  function majority_voting_frequency (line 16) | def majority_voting_frequency(preds):
  function extract_sc_mul_labels (line 34) | def extract_sc_mul_labels(response_data, id_field: str):
  function counting_partial_response_value (line 54) | def counting_partial_response_value(preds, label):
  function parse_value (line 64) | def parse_value(v, binary: bool):
  function _process_response_init (line 70) | def _process_response_init(id2sc_preds):
  function _process_response_worker (line 75) | def _process_response_worker(item, top_p: float = 0.0):
  function _process_trajectories_worker (line 97) | def _process_trajectories_worker(item, binary: bool):
  function merge_key (line 119) | def merge_key(item, value):
  function merge_seed_sampled_data (line 128) | def merge_seed_sampled_data(data, id_field="id"):
  function main (line 152) | def main():

FILE: PFPO/scripts/math_scale/exclude_unused_data.py
  function main (line 6) | def main():

FILE: PFPO/scripts/math_scale/extract_content_from_orig_format.py
  function main (line 6) | def main():

FILE: PFPO/scripts/math_scale/extract_mathscale_v2_box_answer.py
  function main (line 12) | def main():

FILE: PFPO/scripts/math_scale/extract_numina_math_box_answer.py
  function main (line 12) | def main():

FILE: PFPO/scripts/math_scale/fix_answer_extract_and_verify.py
  function main (line 19) | def main():

FILE: PFPO/scripts/math_scale/fix_answer_extract_and_verify_v2.py
  function main (line 19) | def main():

FILE: PFPO/scripts/math_scale/math_scale_offline_gpt_eval.py
  function majority_voting_predict (line 14) | def majority_voting_predict(preds):
  function main (line 38) | def main():

FILE: PFPO/scripts/math_scale/merge_dp_seed_predictions.py
  function majority_voting_frequency (line 18) | def majority_voting_frequency(preds):
  function merge_key (line 36) | def merge_key(item, value):
  function merge_seed_sampled_data (line 45) | def merge_seed_sampled_data(data):
  function main (line 69) | def main():

FILE: PFPO/scripts/math_scale/pp_gpt_inputs.py
  function main (line 6) | def main():

FILE: PFPO/scripts/math_scale/process_4o.py
  function remove_suffix (line 8) | def remove_suffix(solution: str):
  function main (line 12) | def main():

FILE: PFPO/scripts/math_scale/process_raw_4o.py
  function extract_qa (line 8) | def extract_qa(completion: str, remove_suffix: bool = False):
  function remove_suffix (line 26) | def remove_suffix(solution: str):
  function main (line 30) | def main():

FILE: PFPO/scripts/math_scale/process_raw_4o_labeling.py
  function main (line 9) | def main():

FILE: PFPO/scripts/math_scale/qwen25math_style_eval.py
  function extract_content_from_tag (line 20) | def extract_content_from_tag(pred: str):
  function majority_voting_predict (line 30) | def majority_voting_predict(preds):
  function _annotate (line 58) | def _annotate(param):
  function preprocess_item (line 62) | def preprocess_item(item, args):
  function main (line 110) | def main():

FILE: PFPO/scripts/math_scale/qwen25math_style_eval_math.py
  function extract_content_from_tag (line 18) | def extract_content_from_tag(pred: str):
  function majority_voting_predict (line 28) | def majority_voting_predict(preds):
  function _annotate (line 52) | def _annotate(param):
  function main (line 56) | def main():

FILE: PFPO/scripts/math_scale/qwen25math_style_eval_v2.0.py
  function extract_content_from_tag (line 20) | def extract_content_from_tag(pred: str):
  function majority_voting_predict (line 30) | def majority_voting_predict(preds):
  function _annotate (line 58) | def _annotate(param):
  function preprocess_item (line 62) | def preprocess_item(item, args):
  function main (line 110) | def main():

FILE: PFPO/scripts/math_scale/qwen25math_style_preprocess_pred_label.py
  function extract_content_from_tag (line 20) | def extract_content_from_tag(pred: str):
  function majority_voting_predict (line 30) | def majority_voting_predict(preds):
  function _annotate (line 58) | def _annotate(param):
  function preprocess_item (line 62) | def preprocess_item(item, args):
  function main (line 110) | def main():

FILE: PFPO/scripts/math_scale/rerank_w_prm_math.py
  function load_rewards (line 17) | def load_rewards(reward_file, re_index):
  function softmax (line 33) | def softmax(x):
  function reward_reduction (line 38) | def reward_reduction(ending_logits, reduction: str = "min", norm: bool =...
  function weighted_majority_voting_predict (line 59) | def weighted_majority_voting_predict(preds, weights):
  function _init (line 68) | def _init(id2reward):
  function _worker (line 73) | def _worker(item, reduction, norm, sc_top_k=None):
  function merge_key (line 155) | def merge_key(item, value):
  function merge_seed_sampled_data (line 164) | def merge_seed_sampled_data(data):
  function main (line 188) | def main():

FILE: PFPO/scripts/math_scale/rerank_w_prm_math_scale_save.py
  function load_rewards (line 21) | def load_rewards(reward_file, re_index):
  function softmax (line 42) | def softmax(x):
  function reward_reduction (line 47) | def reward_reduction(ending_logits, reduction: str = "min", norm: bool =...
  function weighted_majority_voting_predict (line 68) | def weighted_majority_voting_predict(preds, weights):
  function _init (line 77) | def _init(id2reward):
  function _worker (line 82) | def _worker(item, reduction, norm, sc_type: str, include_incorrect: bool...
  function main (line 156) | def main():

FILE: PFPO/scripts/math_scale/rerank_w_prm_math_scale_save_pair.py
  function load_rewards (line 21) | def load_rewards(reward_file, re_index):
  function softmax (line 42) | def softmax(x):
  function reward_reduction (line 47) | def reward_reduction(ending_logits, reduction: str = "min", norm: bool =...
  function weighted_majority_voting_predict (line 68) | def weighted_majority_voting_predict(preds, weights):
  function _init (line 77) | def _init(id2reward):
  function _worker (line 82) | def _worker(item, reduction, norm, sc_type: str, include_incorrect: bool...
  function main (line 166) | def main():

FILE: PFPO/scripts/math_scale/rerank_w_prm_math_scale_save_pair_margin.py
  function load_rewards (line 21) | def load_rewards(reward_file, re_index):
  function softmax (line 42) | def softmax(x):
  function reward_reduction (line 47) | def reward_reduction(ending_logits, reduction: str = "min", norm: bool =...
  function weighted_majority_voting_predict (line 66) | def weighted_majority_voting_predict(preds, weights):
  function _init (line 75) | def _init(id2reward):
  function _worker (line 80) | def _worker(item, reduction, norm, sc_type: str, include_incorrect: bool...
  function main (line 171) | def main():

FILE: PFPO/scripts/math_scale/split_data.py
  function main (line 5) | def main():

FILE: PFPO/scripts/mbpp/eval_human_eval_gpt_outputs.py
  function main (line 15) | def main():

FILE: PFPO/scripts/mbpp/eval_mbpp_gpt_outputs.py
  function main (line 15) | def main():

FILE: PFPO/scripts/mbpp/pp_eval_gpt4_human_eval.py
  function main (line 13) | def main():

FILE: PFPO/scripts/mbpp/pp_eval_gpt4_mbpp.py
  function main (line 13) | def main():

FILE: PFPO/scripts/mbpp/prepare_mbpp_test_cases_inputs_v1.0.py
  function main (line 40) | def main():

FILE: PFPO/scripts/mbpp/process_mbpp_test_cases_inputs.py
  function extract_test_case_inputs (line 12) | def extract_test_case_inputs(text):
  function main (line 23) | def main():

FILE: PFPO/scripts/mbpp/run_test_case_v1.0.py
  function set_memory_limit (line 20) | def set_memory_limit(memory_limit_mb):
  function unsafe_execute (line 25) | def unsafe_execute(check_program, result, timeout):
  function capture_print_output (line 84) | def capture_print_output(code, timeout=2):
  function test_single_case (line 104) | def test_single_case(program, test_case):
  function _worker (line 113) | def _worker(_input):
  function main (line 119) | def main():

FILE: PFPO/scripts/model_converts/llama_hf_mp_split.py
  function permute (line 14) | def permute(w, n_heads, dim1, dim2):
  function split_weights (line 21) | def split_weights(state_dict: OrderedDict, tp_size: int):
  function merge_weights (line 44) | def merge_weights(state_dicts: list, merge_avg: bool = False):
  function write_model (line 68) | def write_model(input_base_path, tp_size: int):
  function merge_model (line 96) | def merge_model(input_base_path, tp_size: int, merge_avg: bool = False):
  function main (line 140) | def main():

FILE: PFPO/scripts/model_converts/pad_model_embedding.py
  function main (line 13) | def main():

FILE: PFPO/scripts/prepare_code_contests_decompose.py
  function main (line 44) | def main():

FILE: PFPO/scripts/prepare_code_contests_decompose_verification.py
  function completion_parsing (line 47) | def completion_parsing(completion: str):
  function main (line 61) | def main():

FILE: PFPO/scripts/prepare_code_contests_decompose_verification_v2.0.py
  function completion_parsing (line 47) | def completion_parsing(completion: str):
  function main (line 61) | def main():

FILE: PFPO/scripts/prepare_code_contests_judgement.py
  function main (line 28) | def main():

FILE: PFPO/scripts/prepare_mbpp_desc2code_inputs_v1.0.py
  function load_descriptions (line 81) | def load_descriptions(desc_file):
  function main (line 99) | def main():

FILE: PFPO/scripts/prepare_mbpp_inputs_v1.0.py
  function main (line 50) | def main():

FILE: PFPO/scripts/prepare_mbpp_intermediate_print_v1.0.py
  function main (line 69) | def main():

FILE: PFPO/scripts/prepare_mbpp_predict_judgement.py
  function main (line 20) | def main():

FILE: PFPO/scripts/prepare_mbpp_test_cases_inputs_v1.0.py
  function main (line 74) | def main():

FILE: PFPO/scripts/prepare_mbpp_test_cases_outputs_v1.0.py
  function extract_test_case_inputs (line 81) | def extract_test_case_inputs(item):
  function main (line 91) | def main():

FILE: PFPO/scripts/prepare_mbpp_test_cases_outputs_v1.1.py
  function extract_test_case_inputs (line 78) | def extract_test_case_inputs(item):
  function main (line 88) | def main():

FILE: PFPO/scripts/verify_mbpp_test_cases.py
  function capture_print_output (line 9) | def capture_print_output(code):
  function _extract_test_case (line 35) | def _extract_test_case(item):
  function extract_test_cases (line 57) | def extract_test_cases(file_path):
  function _extract_function_names (line 74) | def _extract_function_names(code):
  function clean_orig_test_cases_and_extract_func_name (line 84) | def clean_orig_test_cases_and_extract_func_name(program):
  function filter_passed_programs (line 109) | def filter_passed_programs(prediction_file):
  function verify_program (line 128) | def verify_program(program, test_cases):
  function main (line 144) | def main():

FILE: PFPO/service_api_caller_v1.py
  function default_collate_fn (line 38) | def default_collate_fn(batch):
  function run_inference (line 42) | def run_inference(cfg: DictConfig, dataset):
  function main (line 82) | def main(cfg: DictConfig):

FILE: PFPO/trainer_base_ds_mul_fs_tp.py
  function get_zero_stage (line 56) | def get_zero_stage(cfg: DictConfig):
  function worker_init_fn (line 62) | def worker_init_fn(worker_id):
  function save_model (line 68) | def save_model(model: Union[deepspeed.DeepSpeedEngine, deepspeed.Pipelin...
  function forward_step (line 114) | def forward_step(model, inputs: Dict[str, torch.Tensor]):
  function train (line 126) | def train(cfg, model, tokenizer, continue_from_global_step=0):
  function main (line 334) | def main(cfg: DictConfig):

FILE: PFPO/trainer_ds_megatron_mul.py
  function get_zero_stage (line 55) | def get_zero_stage(cfg: DictConfig):
  function worker_init_fn (line 61) | def worker_init_fn(worker_id):
  function save_model (line 67) | def save_model(model: Union[deepspeed.DeepSpeedEngine, deepspeed.Pipelin...
  function forward_step (line 113) | def forward_step(model, inputs: Dict[str, torch.Tensor]):
  function train (line 125) | def train(cfg, model, tokenizer, continue_from_global_step=0):
  function main (line 315) | def main(cfg: DictConfig):

FILE: PFPO/visualize/length_distribution.py
  function plot_histogram (line 15) | def plot_histogram(data, bins=10, x_label="Value", y_label="Frequency", ...
  function main (line 25) | def main():

FILE: PFPO/visualize/reward_histogram.py
  function plot_histogram (line 9) | def plot_histogram(data, bins=10, x_label="Value", y_label="Frequency", ...
  function main (line 19) | def main():

FILE: PFPO/visualize/test_response_length.py
  function _init_ (line 13) | def _init_(tokenizer):
  function plot_histogram (line 18) | def plot_histogram(data, bins=10, x_label="Value", y_label="Frequency", ...
  function merge_key (line 30) | def merge_key(item, value):
  function merge_seed_sampled_data (line 39) | def merge_seed_sampled_data(data, key_field="response"):
  function worker (line 56) | def worker(item):
  function main (line 65) | def main():

FILE: PFPO/vllm_inference.py
  function evaluate (line 44) | def evaluate(cfg: DictConfig, model: vllm.LLM, prefix="", _split="dev"):
  function main (line 132) | def main(cfg: DictConfig):

FILE: PFPO/vllm_inference_dp.py
  function evaluate (line 45) | def evaluate(cfg: DictConfig, model: vllm.LLM, prefix="", _split="dev"):
  function main_worker (line 132) | def main_worker(cfg: DictConfig):
  function main_worker_wrap (line 194) | def main_worker_wrap(_input):
  function main (line 205) | def main(cfg: DictConfig):

FILE: ReSA/llm/arch/context_manager.py
  function block_attn_decoding_kernel (line 15) | def block_attn_decoding_kernel(
  function block_attn_decoding (line 47) | def block_attn_decoding(q, k_min, k_max, num_blocks, local_block_num):
  function get_topk_indices (line 64) | def get_topk_indices(block_attn_score, block_index_mask, max_num_selecte...
  function get_num_blocks (line 71) | def get_num_blocks(cache_seqlens, block_size, sparse_ratio, min_block_num):
  class KVManager (line 77) | class KVManager:
    method __init__ (line 78) | def __init__(self, num_heads, block_size, sparse_ratio, local_block_nu...
    method init_centeroids (line 89) | def init_centeroids(self, key, cache_seqlens):
    method update_centeroids (line 109) | def update_centeroids(self, key, cache_seqlens):
    method clear_centeroids (line 115) | def clear_centeroids(self):
    method get_kv_cache_indices (line 120) | def get_kv_cache_indices(self, query, cache_seqlens):
    method get_kv_cache_indices_fast (line 139) | def get_kv_cache_indices_fast(self, query, cache_seqlens):

FILE: ReSA/llm/arch/model.py
  class ModelArgs (line 21) | class ModelArgs:
  class RMSNorm (line 46) | class RMSNorm(nn.Module):
    method __init__ (line 47) | def __init__(self, dim: int, eps: float = 1e-5):
    method forward (line 52) | def forward(self, x):
  function precompute_freqs_cis (line 56) | def precompute_freqs_cis(dim: int, end: int, theta: float = 10000.0):
  class Attention (line 62) | class Attention(nn.Module):
    method __init__ (line 63) | def __init__(self, index: int, args: ModelArgs):
    method forward (line 75) | def forward(
  class FeedForwardNetwork (line 122) | class FeedForwardNetwork(nn.Module):
    method __init__ (line 123) | def __init__(
    method forward (line 134) | def forward(self, x):
  class Block (line 138) | class Block(nn.Module):
    method __init__ (line 140) | def __init__(self, index: int, args: ModelArgs):
    method forward (line 148) | def forward(
  class Model (line 161) | class Model(nn.Module):
    method __init__ (line 162) | def __init__(self, args: ModelArgs):
    method _precompute_freqs_cis (line 179) | def _precompute_freqs_cis(self, max_seqlen):
    method forward (line 184) | def forward(
  function create_kv_cache (line 213) | def create_kv_cache(args: ModelArgs, batch_size: int, dtype: torch.dtype...

FILE: ReSA/llm/config.py
  function parse_eval_args (line 3) | def parse_eval_args():

FILE: ReSA/llm/data/tokenizer.py
  class Tokenizer (line 7) | class Tokenizer:
    method __init__ (line 8) | def __init__(self, tokenizer_path: str):
    method n_words (line 12) | def n_words(self) -> int:
    method bos_id (line 16) | def bos_id(self) -> int:
    method eos_id (line 20) | def eos_id(self) -> int:
    method pad_id (line 24) | def pad_id(self) -> int:
    method unk_id (line 28) | def unk_id(self) -> int:
    method encode (line 31) | def encode(self, s: str, bos: bool = True, eos: bool = False):
    method encode_batch (line 39) | def encode_batch(self, s: List[str], bos: bool = True, eos: bool = Fal...
    method decode (line 42) | def decode(self, t: List[int]) -> str:
    method decode_batch (line 46) | def decode_batch(self, t: List[List[int]]) -> List[str]:

FILE: ReSA/llm/eval.py
  function sample_top_p (line 21) | def sample_top_p(probs, p):
  class EvalWrapper (line 31) | class EvalWrapper(eval_wrapper):
    method __init__ (line 32) | def __init__(
    method eot_token_id (line 49) | def eot_token_id(self):
    method eos_token_id (line 53) | def eos_token_id(self):
    method pad_token_id (line 57) | def pad_token_id(self):
    method max_length (line 61) | def max_length(self):
    method max_gen_toks (line 65) | def max_gen_toks(self):
    method batch_size (line 69) | def batch_size(self):
    method device (line 73) | def device(self):
    method model (line 77) | def model(self):
    method tok_encode (line 80) | def tok_encode(self, string: str, **kwargs):
    method tok_decode (line 84) | def tok_decode(self, tokens, **kwargs):
    method tok_batch_encode (line 90) | def tok_batch_encode(self, strings, left_truncate_len=None, **kwargs):
    method _model_call (line 99) | def _model_call(self, inps):
    method _model_generate (line 103) | def _model_generate(self, context, max_length, kv_cache=None, **genera...
  function _adjust_config (line 162) | def _adjust_config(task_dict):
  function eval_end_task (line 181) | def eval_end_task(
  function eval_downstream_task (line 208) | def eval_downstream_task(
  function load_qwen2_model (line 235) | def load_qwen2_model(state_dict):
  function load_model (line 246) | def load_model(args):
  function evaluate_one_checkpoint (line 293) | def evaluate_one_checkpoint(args):

FILE: ReSA/llm/eval_math.py
  class MathArgs (line 13) | class MathArgs:
  function get_rank (line 21) | def get_rank():
  function first_print (line 25) | def first_print(*args):
  function load_data (line 30) | def load_data(data_name, split, data_dir):
  function prepare_data (line 44) | def prepare_data(data_name, args, limit):
  function model_generation (line 60) | def model_generation(model, prompts, max_length, math_args):
  function evaluate (line 83) | def evaluate(args, model, limit):
  function eval_math_save_part (line 126) | def eval_math_save_part(model, data_name, examples, math_args, max_length):

FILE: ReSA/llm/kernel/flash_attention_with_kv_cache.py
  function is_hip (line 7) | def is_hip():
  function num_splits_heuristic (line 11) | def num_splits_heuristic(total_mblocks, num_SMs, num_n_blocks, num_m_blo...
  function _fwd_kernel_with_kv_cache (line 72) | def _fwd_kernel_with_kv_cache(
  function combine (line 174) | def combine(
  function flash_attention_with_kv_cache (line 205) | def flash_attention_with_kv_cache(
  function ref_program_fa (line 281) | def ref_program_fa(query, key, value, cache_seqlens):
  function debug (line 290) | def debug(name,expect, actual, atol=1e-3, rtol=1e-3):

FILE: ReSA/llm/kernel/flash_sparse_decoding.py
  function is_hip (line 7) | def is_hip():
  function num_splits_heuristic (line 11) | def num_splits_heuristic(total_mblocks, num_SMs, num_n_blocks, num_m_blo...
  function _fwd_kernel_decoding (line 72) | def _fwd_kernel_decoding(
  function combine (line 164) | def combine(
  function flash_block_sparse_decoding (line 190) | def flash_block_sparse_decoding(
  function main (line 267) | def main():

FILE: ReSA/llm/kernel/rotary.py
  function rotate_half (line 14) | def rotate_half(x, interleaved=False):
  function apply_rotary_emb_torch (line 23) | def apply_rotary_emb_torch(x, cos, sin, interleaved=False, inplace=False):
  function rotary_kernel (line 38) | def rotary_kernel(
  function apply_rotary (line 159) | def apply_rotary(
  class ApplyRotaryEmb (line 255) | class ApplyRotaryEmb(torch.autograd.Function):
    method forward (line 257) | def forward(
    method backward (line 290) | def backward(ctx, do):
  function apply_rotary_emb_triton (line 314) | def apply_rotary_emb_triton(

FILE: ReSA/llm/kernel/tilelang_attention_with_kv_cache.py
  function num_splits_heuristic (line 13) | def num_splits_heuristic(total_mblocks, num_SMs, num_n_blocks, num_m_blo...
  function flashattn (line 66) | def flashattn(heads, heads_kv, dim, dim_v):
  class AttentionWithKVCache (line 240) | class AttentionWithKVCache(torch.nn.Module):
    method __init__ (line 241) | def __init__(self, heads, heads_kv, dim, dim_v, seqlen_q):
    method forward (line 273) | def forward(self, query, key, value, cache_seqlens):
  function ref_program_fa (line 303) | def ref_program_fa(query, key, value, cache_seqlens):
  function debug (line 312) | def debug(name,expect, actual, atol=1e-3, rtol=1e-3):

FILE: ReSA/llm/kernel/tilelang_sparse_decoding.py
  function num_splits_heuristic (line 14) | def num_splits_heuristic(total_mblocks, num_SMs, num_n_blocks, num_m_blo...
  function flashattn (line 67) | def flashattn(heads, heads_kv, dim, dim_v):
  class SparseFlashAttn (line 245) | class SparseFlashAttn(torch.nn.Module):
    method __init__ (line 246) | def __init__(self, heads, heads_kv, dim, dim_v, block_size):
    method forward (line 277) | def forward(self, query, key, value, block_indices, cache_seqlens):
  function sparse_gqa_decode_varlen_indice (line 320) | def sparse_gqa_decode_varlen_indice(query, key, value, block_indices, ca...
  function ref_program_torch (line 369) | def ref_program_torch(query, key, value,  block_indices, cache_seqlens, ...
  function ref_program_fa (line 412) | def ref_program_fa(query, key, value,  block_indices, cache_seqlens, max...
  function debug (line 423) | def debug(name,expect, actual, atol=1e-3, rtol=1e-3):

FILE: ReSA/llm/utils/math_utils.py
  function get_examples (line 38) | def get_examples():
  function is_multi_choice (line 415) | def is_multi_choice(answer):
  function load_jsonl (line 422) | def load_jsonl(file: Union[str, Path]) -> Iterable[Any]:
  function save_jsonl (line 432) | def save_jsonl(samples, save_path):
  function load_prompt (line 446) | def load_prompt(data_name, prompt_type, num_shots):
  function construct_prompt (line 486) | def construct_prompt(example, data_name, args):
  function _fix_fracs (line 536) | def _fix_fracs(string):
  function _fix_a_slash_b (line 568) | def _fix_a_slash_b(string):
  function _fix_sqrt (line 585) | def _fix_sqrt(string):
  function convert_word_number (line 590) | def convert_word_number(text: str) -> str:
  function strip_string (line 737) | def strip_string(string, skip_unit=False):
  function extract_multi_choice_answer (line 878) | def extract_multi_choice_answer(pred_str):
  function choice_answer_clean (line 892) | def choice_answer_clean(pred: str):
  function find_box (line 936) | def find_box(pred_str: str):
  function clean_units (line 959) | def clean_units(pred_str: str):
  function extract_theoremqa_answer (line 984) | def extract_theoremqa_answer(pred: str, answer_flag: bool = True):
  function extract_answer (line 1024) | def extract_answer(pred_str, data_name, use_last_number=True):
  function parse_ground_truth (line 1100) | def parse_ground_truth(example: Dict[str, Any], data_name):
  function parse_question (line 1179) | def parse_question(example, data_name):
  function run_execute (line 1247) | def run_execute(executor, result, prompt_type, data_name, execute=False):
  function text_to_trajectory (line 1286) | def text_to_trajectory(traj_str: str) -> None:
  function trajectory_to_text (line 1324) | def trajectory_to_text(trajectory: list) -> str:
  function is_execution_success (line 1336) | def is_execution_success(output):
  function extract_program (line 1342) | def extract_program(text:str=None, trajectory:list=None, last_only=False...
  function extract_program_output (line 1382) | def extract_program_output(pred_str, last_only=True):
  function choice_answer_clean (line 1403) | def choice_answer_clean(pred: str):
  function parse_digits (line 1417) | def parse_digits(num):
  function is_digit (line 1433) | def is_digit(num):
  function str_to_pmatrix (line 1438) | def str_to_pmatrix(input_str):
  function math_equal (line 1450) | def math_equal(
  function math_equal_process (line 1639) | def math_equal_process(param):
  function numeric_equal (line 1643) | def numeric_equal(prediction: float, reference: float):
  function symbolic_equal (line 1653) | def symbolic_equal(a, b):
  function symbolic_equal_process (line 1709) | def symbolic_equal_process(a, b, output_queue):
  function call_with_timeout (line 1714) | def call_with_timeout(func, *args, timeout=1, **kwargs):
  function evaluate (line 1739) | def evaluate(data_name, prompt_type, samples: list=None, file_path: str=...
  class GenericRuntime (line 1831) | class GenericRuntime:
    method __init__ (line 1835) | def __init__(self):
    method exec_code (line 1842) | def exec_code(self, code_piece: str) -> None:
    method eval_code (line 1859) | def eval_code(self, expr: str) -> Any:
    method inject (line 1862) | def inject(self, var_dict: Dict[str, Any]) -> None:
    method answer (line 1867) | def answer(self):
  class DateRuntime (line 1870) | class DateRuntime(GenericRuntime):
  class CustomDict (line 1878) | class CustomDict(dict):
    method __iter__ (line 1879) | def __iter__(self):
  class ColorObjectRuntime (line 1882) | class ColorObjectRuntime(GenericRuntime):
  class PythonExecutor (line 1886) | class PythonExecutor:
    method __init__ (line 1887) | def __init__(
    method process_generation_to_code (line 1902) | def process_generation_to_code(self, gens: str):
    method execute (line 1906) | def execute(
    method apply (line 1951) | def apply(self, code):
    method truncate (line 1955) | def truncate(s, max_length=400):
    method batch_apply (line 1961) | def batch_apply(self, batch_code):
Copy disabled (too large) Download .json
Condensed preview — 5915 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (19,548K chars).
[
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "chars": 574,
    "preview": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Describe the b"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/custom.md",
    "chars": 186,
    "preview": "---\nname: Custom issue template\nabout: Describe this issue template's purpose here.\ntitle: ''\nlabels: ''\nassignees: ''\n\n"
  },
  {
    "path": ".gitignore",
    "chars": 1319,
    "preview": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packagi"
  },
  {
    "path": ".gitmodules",
    "chars": 322,
    "preview": "[submodule \"deltalm/fairseq\"]\n\tpath = deltalm/fairseq\n\turl = https://github.com/pytorch/fairseq.git\n[submodule \"speechlm"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "chars": 453,
    "preview": "# Microsoft Open Source Code of Conduct\r\n\r\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://"
  },
  {
    "path": "CONTRIBUTING.md",
    "chars": 921,
    "preview": "# Contributing\n\nThis project welcomes contributions and suggestions. Most contributions require you to\nagree to a Contri"
  },
  {
    "path": "Diff-Transformer/Diff-Transformer-V2/README.md",
    "chars": 2894,
    "preview": "# Differential Transformer V2 (DIFF V2)\n\n[Read the blog post here](https://spiky-homegrown-4cb.notion.site/Differential-"
  },
  {
    "path": "Diff-Transformer/Diff-Transformer-V2/multihead_flashdiffv2.py",
    "chars": 3036,
    "preview": "import torch\nfrom torch import nn\nfrom typing import Optional, Tuple\nfrom ..kernel.rotary import apply_rotary_emb\nfrom f"
  },
  {
    "path": "Diff-Transformer/README.md",
    "chars": 1490,
    "preview": "# Differential Transformer\n## Approach\n<div align=\"center\">\n  <img src=\"./imgs/arch.png\" width=90%/>\n</div>\n\n## Contents"
  },
  {
    "path": "Diff-Transformer/example.py",
    "chars": 1306,
    "preview": "from multihead_diffattn import MultiheadDiffAttn\nfrom multihead_attention import MultiheadAttention\n\nif __name__ == \"__m"
  },
  {
    "path": "Diff-Transformer/kernel/rotary.py",
    "chars": 12150,
    "preview": "# Copyright (c) 2023, Tri Dao.\n\nfrom typing import Optional, Union\n\nimport torch\n\nimport triton\nimport triton.language a"
  },
  {
    "path": "Diff-Transformer/multihead_attention.py",
    "chars": 2982,
    "preview": "import math\nimport torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom kernel.rotary import apply_rotary_em"
  },
  {
    "path": "Diff-Transformer/multihead_diffattn.py",
    "chars": 4712,
    "preview": "import math\nimport torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom kernel.rotary import apply_rotary_em"
  },
  {
    "path": "Diff-Transformer/multihead_flashdiff_1.py",
    "chars": 4453,
    "preview": "import math\nimport torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom kernel.rotary import apply_rotary_em"
  },
  {
    "path": "Diff-Transformer/multihead_flashdiff_2.py",
    "chars": 4668,
    "preview": "import math\nimport torch\nimport torch.nn.functional as F\nfrom torch import nn\n\nfrom kernel.rotary import apply_rotary_em"
  },
  {
    "path": "Diff-Transformer/rms_norm.py",
    "chars": 858,
    "preview": "import torch\nimport torch.nn as nn\n\nclass RMSNorm(nn.Module):\n    def __init__(self, dim: int, eps: float = 1e-6, elemen"
  },
  {
    "path": "LICENSE",
    "chars": 1104,
    "preview": "The MIT License (MIT)\r\n\r\nCopyright (c) Microsoft Corporation\r\n\r\nPermission is hereby granted, free of charge, to any per"
  },
  {
    "path": "LatentLM/README.md",
    "chars": 711,
    "preview": "# [Multimodal Latent Language Modeling with Next-Token Diffusion]\r\n\r\nOfficial PyTorch implementation and pretrained mode"
  },
  {
    "path": "LatentLM/evaluate_fid.py",
    "chars": 9910,
    "preview": "import argparse\r\nimport json\r\nimport os\r\nimport sys\r\nimport math\r\nimport numpy as np\r\nfrom tqdm import tqdm\r\nimport torc"
  },
  {
    "path": "LatentLM/evaluate_fid_fidelity.py",
    "chars": 4795,
    "preview": "import argparse\r\nimport json\r\nimport os\r\nimport numpy as np\r\nimport torch\r\nfrom torchvision import transforms\r\nfrom torc"
  },
  {
    "path": "LatentLM/inference_speed.py",
    "chars": 6079,
    "preview": "import argparse\r\nimport json\r\nimport os\r\nimport sys\r\nimport time\r\nimport torch\r\nfrom tqdm import tqdm\r\nfrom accelerate.u"
  },
  {
    "path": "LatentLM/metrics/IS.py",
    "chars": 3861,
    "preview": "\"\"\"Utils for Inception Score calculation.\r\nBorrowed from:\r\n    PyTorch StudioGAN: https://github.com/POSTECH-CVLab/PyTor"
  },
  {
    "path": "LatentLM/metrics/__init__.py",
    "chars": 648,
    "preview": "# Copyright (c) 2022-present, Kakao Brain Corp.\r\n#\r\n# Licensed under the Apache License, Version 2.0 (the \"License\");\r\n#"
  },
  {
    "path": "LatentLM/metrics/fid.py",
    "chars": 12789,
    "preview": "\"\"\"Adapted from https://github.com/mseitzer/pytorch-fid/blob/master/src/pytorch_fid/fid_score.py\"\"\"\r\nimport glob\r\nimport"
  },
  {
    "path": "LatentLM/metrics/inception.py",
    "chars": 12655,
    "preview": "\"\"\"https://github.com/mseitzer/pytorch-fid/blob/master/src/pytorch_fid/inception.py\r\n\"\"\"\r\nimport torch\r\nimport torch.nn "
  },
  {
    "path": "LatentLM/models/DiT.py",
    "chars": 17609,
    "preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\r\n# All rights reserved.\r\n\r\n# This source code is licensed under the"
  },
  {
    "path": "LatentLM/models/EMA.py",
    "chars": 6939,
    "preview": "import copy\r\nfrom typing import Any, Dict, Iterable, Optional, Union\r\n\r\nimport torch\r\n\r\n# Adapted from torch-ema https:/"
  },
  {
    "path": "LatentLM/models/RMSNorm.py",
    "chars": 859,
    "preview": "import torch\r\nimport torch.nn as nn\r\n\r\nclass RMSNorm(nn.Module):\r\n    def __init__(self, dim: int, eps: float = 1e-6, el"
  },
  {
    "path": "LatentLM/models/Transformer.py",
    "chars": 16216,
    "preview": "# Copyright (c) Meta Platforms, Inc. and affiliates.\r\n# All rights reserved.\r\n\r\n# This source code is licensed under the"
  },
  {
    "path": "LatentLM/models/__init__.py",
    "chars": 170,
    "preview": "from .DiT import DiT_models, DiT\r\nfrom .Transformer import Transformer_models, Transformer\r\nfrom .EMA import EMAModel\r\n\r"
  },
  {
    "path": "LatentLM/models/kernel/rotary.py",
    "chars": 12835,
    "preview": "# Copyright (c) 2023, Tri Dao.\r\n\r\nfrom typing import Optional, Union\r\n\r\nimport torch\r\n\r\nimport triton\r\nimport triton.lan"
  },
  {
    "path": "LatentLM/models/kernel/swiglu.py",
    "chars": 950,
    "preview": "import torch\r\n\r\n\r\nswiglu_fwd_codestring = \"\"\"\r\ntemplate <typename T> T swiglu_fwd(T x, T y) {\r\n    return float(x) * flo"
  },
  {
    "path": "LatentLM/sample_hf.py",
    "chars": 6728,
    "preview": "import argparse\r\nimport os\r\nfrom tqdm import tqdm\r\n\r\nimport torch\r\nimport torch.nn.functional as F\r\nfrom torchvision.uti"
  },
  {
    "path": "LatentLM/sample_many.py",
    "chars": 7186,
    "preview": "import argparse\r\nimport os\r\nfrom tqdm import tqdm\r\nimport random\r\n\r\nimport torch\r\nimport torch.nn.functional as F\r\nfrom "
  },
  {
    "path": "LatentLM/schedule/__init__.py",
    "chars": 84,
    "preview": "from .ddpm import DDPMScheduler\r\nfrom .dpm_solver import DPMSolverMultistepScheduler"
  },
  {
    "path": "LatentLM/schedule/ddpm.py",
    "chars": 27693,
    "preview": "# Copyright 2024 UC Berkeley Team and The HuggingFace Team. All rights reserved.\r\n#\r\n# Licensed under the Apache License"
  },
  {
    "path": "LatentLM/schedule/dpm_solver.py",
    "chars": 47263,
    "preview": "# Copyright 2024 TSAIL Team and The HuggingFace Team. All rights reserved.\r\n#\r\n# Licensed under the Apache License, Vers"
  },
  {
    "path": "LatentLM/tokenizer_models/__init__.py",
    "chars": 73,
    "preview": "from .modeling_sigma_vae import sigma_vae\r\nfrom .vae import AutoencoderKL"
  },
  {
    "path": "LatentLM/tokenizer_models/modeling_beit3_vision.py",
    "chars": 2168,
    "preview": "# Copyright (c) 2022 Microsoft\r\n# Licensed under The MIT License [see LICENSE for details]\r\n\r\nimport torch.nn as nn\r\n\r\nf"
  },
  {
    "path": "LatentLM/tokenizer_models/modeling_common.py",
    "chars": 4326,
    "preview": "import torch\r\nfrom torch import nn\r\n\r\nfrom timm.models.layers import trunc_normal_ as __call_trunc_normal_\r\n\r\nfrom .mode"
  },
  {
    "path": "LatentLM/tokenizer_models/modeling_sigma_vae.py",
    "chars": 4788,
    "preview": "import torch\r\nfrom torch import nn\r\nfrom torch.nn import functional as F\r\nfrom timm.models.registry import register_mode"
  },
  {
    "path": "LatentLM/tokenizer_models/modeling_utils.py",
    "chars": 6607,
    "preview": "import math\r\nimport torch\r\nimport torch.nn as nn\r\nimport torch.nn.functional as F\r\nimport torch.utils.checkpoint as chec"
  },
  {
    "path": "LatentLM/tokenizer_models/vae.py",
    "chars": 15998,
    "preview": "# Adopted from LDM's KL-VAE: https://github.com/CompVis/latent-diffusion\r\nimport torch\r\nimport torch.nn as nn\r\n\r\nimport "
  },
  {
    "path": "LatentLM/train_hf.py",
    "chars": 19791,
    "preview": "import argparse\r\nimport functools\r\nimport logging\r\nimport math\r\nimport os\r\nfrom datetime import timedelta\r\n\r\nimport data"
  },
  {
    "path": "LatentLM/utils.py",
    "chars": 4476,
    "preview": "from PIL import Image\r\nimport numpy as np\r\nimport json\r\nfrom collections import OrderedDict\r\nimport torch\r\nimport torch."
  },
  {
    "path": "NOTICE.md",
    "chars": 12138,
    "preview": "NOTICES AND INFORMATION\n\nDo Not Translate or Localize\n\nThis software incorporates material from third parties. Microsoft"
  },
  {
    "path": "PFPO/README.md",
    "chars": 38611,
    "preview": "# Preference Optimization for Reasoning with Pseudo Feedback\n\nThis repo contains the source code for **Preference Optimi"
  },
  {
    "path": "PFPO/apps_train_sub_val_ids.json",
    "chars": 3869,
    "preview": "[\n  1143,\n  2406,\n  807,\n  3729,\n  4301,\n  2434,\n  4976,\n  4826,\n  1769,\n  1651,\n  3434,\n  2517,\n  1616,\n  4625,\n  4411,"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/dev_v1_0.yaml",
    "chars": 2827,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"codeparrot/apps\"\ndev_file"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/dev_v1_0_fix_bos.yaml",
    "chars": 2773,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"codeparrot/apps\"\ndev_file"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/dev_v1_1.yaml",
    "chars": 3014,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/dev_v1_1_sample.yaml",
    "chars": 3016,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/dev_v2_0.yaml",
    "chars": 3112,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/r2c/dev_v1_0.yaml",
    "chars": 3327,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/r2c/dev_v1_1.yaml",
    "chars": 3303,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/r2c/dev_v1_1_sample.yaml",
    "chars": 3276,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/r2c/dev_v2_0.yaml",
    "chars": 3188,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/r2c/dev_v2_0_sample.yaml",
    "chars": 3197,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/r2c/general_combine_train_v2_0.yaml",
    "chars": 3535,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/r2c/general_combine_train_v2_0_prefix_completion.yaml",
    "chars": 5128,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/r2c/general_combine_train_v2_1_4o_non_sc.yaml",
    "chars": 3490,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/r2c/sub_dev_v1_1.yaml",
    "chars": 3332,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/r2c/sub_dev_v2_0.yaml",
    "chars": 3217,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/r2c/train_v1_0.yaml",
    "chars": 3139,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/r2c/train_v1_0_s43.yaml",
    "chars": 3143,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/r2c/train_v2_0.yaml",
    "chars": 3175,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/r2c/train_v2_0_prefix_completion.yaml",
    "chars": 3976,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/r2c/xcode_train_v2_0.yaml",
    "chars": 3074,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/sub_dev_v1_1.yaml",
    "chars": 3043,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/sub_dev_v2_0.yaml",
    "chars": 3141,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/test_inputs_gen/sub_dev_v1_0.yaml",
    "chars": 3063,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/test_inputs_gen/test_v1_0.yaml",
    "chars": 3034,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/train_v1_0.yaml",
    "chars": 3367,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/deepseek_coder/train_v2_0.yaml",
    "chars": 2898,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/general_eval/dev_v2_0.yaml",
    "chars": 2652,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/general_eval/dev_v2_1.yaml",
    "chars": 2681,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/apps/general_eval/dev_v2_2.yaml",
    "chars": 2754,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: \"\"\nmodel_path_prefix"
  },
  {
    "path": "PFPO/conf/api/vllm/human_eval/ds_coder/r2c/test_v1_0.yaml",
    "chars": 3039,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/human_eval/ds_coder/r2c/test_v1_0_local.yaml",
    "chars": 3029,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"openai_humaneval\"\ndev_fil"
  },
  {
    "path": "PFPO/conf/api/vllm/human_eval/ds_coder/r2c/test_v2_0_local.yaml",
    "chars": 3090,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"openai_humaneval\"\ndev_fil"
  },
  {
    "path": "PFPO/conf/api/vllm/human_eval/ds_coder/r2c/test_v2_1_local.yaml",
    "chars": 3091,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"openai_humaneval\"\ndev_fil"
  },
  {
    "path": "PFPO/conf/api/vllm/human_eval/ds_coder/r2c/test_v2_2_local.yaml",
    "chars": 2973,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"openai_humaneval\"\ndev_fil"
  },
  {
    "path": "PFPO/conf/api/vllm/human_eval/ds_coder/test_v1_0_local.yaml",
    "chars": 2680,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"openai_humaneval\"\ndev_fil"
  },
  {
    "path": "PFPO/conf/api/vllm/human_eval/ds_coder/test_v2_0.yaml",
    "chars": 2545,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"openai_humaneval\"\ndev_fil"
  },
  {
    "path": "PFPO/conf/api/vllm/human_eval/test_v2_1.yaml",
    "chars": 2518,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"openai_humaneval\"\ndev_fil"
  },
  {
    "path": "PFPO/conf/api/vllm/human_eval/test_v2_2.yaml",
    "chars": 2654,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"openai_humaneval\"\ndev_fil"
  },
  {
    "path": "PFPO/conf/api/vllm/magicoder/llama3/test_case_input_gen_v1_0.yaml",
    "chars": 2376,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/magicoder/mistral/func_head_extract_v1_0.yaml",
    "chars": 2422,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/magicoder/mistral/test_case_input_gen_v1_0.yaml",
    "chars": 2393,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/4o_mathstral_train_0shot_v1_0.yaml",
    "chars": 2870,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/4o_mathstral_train_0shot_v1_0_completion.yaml",
    "chars": 4114,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/4o_mathstral_train_0shot_v1_1.yaml",
    "chars": 2381,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/4o_mathstral_train_0shot_v1_1_completion.yaml",
    "chars": 4106,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/4o_mathstral_train_half_0shot_v1_0.yaml",
    "chars": 2543,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/4o_mathstral_train_half_0shot_v1_0_completion.yaml",
    "chars": 3775,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/mathstral/deepseek_test_0shot_tem_v1_1.yaml",
    "chars": 2537,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/mathstral/mistral_mathscale4o_labeling.yaml",
    "chars": 2662,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/mathstral/mistral_train_0shot_iter0_v1_0.yaml",
    "chars": 2710,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/mathstral/test_0shot_tem_v1_1.yaml",
    "chars": 2312,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/mathstral/test_0shot_tem_v1_1_step.yaml",
    "chars": 2328,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/mathstral/test_0shot_tem_v1_1_step_seed.yaml",
    "chars": 2380,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/mathstral/test_0shot_tem_v2_0_step.yaml",
    "chars": 2290,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/mathstral/test_0shot_tem_v3_0_step.yaml",
    "chars": 2512,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/mistral_train_0shot_v1_0.yaml",
    "chars": 2621,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/mistral_train_0shot_v1_1.yaml",
    "chars": 2465,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/mistral_train_0shot_v1_2.yaml",
    "chars": 2690,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/numina_hard_train_0shot_v1_0_completion.yaml",
    "chars": 2865,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/numina_hard_train_0shot_v1_0_seed.yaml",
    "chars": 2338,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/numina_rewrite_qwen25_0shot_v1_0.yaml",
    "chars": 2522,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/numina_train_0shot_v1_0.yaml",
    "chars": 2408,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/numina_train_0shot_v1_0_completion.yaml",
    "chars": 5122,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/test_0shot_tem_v1_1.yaml",
    "chars": 2353,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mathscale/test_0shot_tem_v1_1_step.yaml",
    "chars": 2345,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ndata_path_prefix: /mnt/fangkai_blob/sh"
  },
  {
    "path": "PFPO/conf/api/vllm/mbpp_sanitized/r2c/test_3shot_v2_0.yaml",
    "chars": 2964,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mbpp_sanitized/r2c/test_v1_0.yaml",
    "chars": 2964,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mbpp_sanitized/r2c/test_v1_0_local.yaml",
    "chars": 2756,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"mbpp\"\ndev_file: ${train_f"
  },
  {
    "path": "PFPO/conf/api/vllm/mbpp_sanitized/test_3shot_v1_0.yaml",
    "chars": 2964,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mbpp_sanitized/test_3shot_v1_0_local.yaml",
    "chars": 2768,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"mbpp\"\ndev_file: ${train_f"
  },
  {
    "path": "PFPO/conf/api/vllm/mbpp_sanitized/test_v1_0_local.yaml",
    "chars": 2609,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"mbpp\"\ndev_file: ${train_f"
  },
  {
    "path": "PFPO/conf/api/vllm/mbpp_sanitized/test_v1_1_local.yaml",
    "chars": 2556,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"mbpp\"\ndev_file: ${train_f"
  },
  {
    "path": "PFPO/conf/api/vllm/mbpp_sanitized/test_v2_0_local.yaml",
    "chars": 2529,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"mbpp\"\ndev_file: ${train_f"
  },
  {
    "path": "PFPO/conf/api/vllm/mbpp_sanitized/test_v2_1_local.yaml",
    "chars": 2633,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"mbpp\"\ndev_file: ${train_f"
  },
  {
    "path": "PFPO/conf/api/vllm/mbpp_sanitized/test_v2_2_local.yaml",
    "chars": 2663,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\ntrain_file: \"mbpp\"\ndev_file: ${train_f"
  },
  {
    "path": "PFPO/conf/api/vllm/mwp-bench/deepseek_test_0shot_v1_1.yaml",
    "chars": 2326,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mwp-bench/llama_base/college_math_test_4shot_v1_0.yaml",
    "chars": 2869,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mwp-bench/llama_chat/dev_0shot_v1_0.yaml",
    "chars": 2704,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mwp-bench/llama_chat/math_test_0shot_v1_0.yaml",
    "chars": 2814,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mwp-bench/llama_chat/math_test_0shot_v3_0.yaml",
    "chars": 3189,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mwp-bench/llama_chat/test_0shot_v1_0.yaml",
    "chars": 2619,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mwp-bench/mathstral_dev_0shot_self_correct_v1_0.yaml",
    "chars": 2711,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mwp-bench/mathstral_dev_0shot_v1_0.yaml",
    "chars": 2587,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mwp-bench/mathstral_test_0shot_self_correct_v1_0.yaml",
    "chars": 2705,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mwp-bench/mathstral_test_0shot_v1_0.yaml",
    "chars": 2788,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mwp-bench/mathstral_test_gaokao_2023_0shot_v1_0.yaml",
    "chars": 2528,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mwp-bench/mathstral_test_gsm8k_0shot_v1_0.yaml",
    "chars": 2508,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mwp-bench/mistral/dev_0shot_v1_0.yaml",
    "chars": 2600,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mwp-bench/mistral/test_0shot_v1_0.yaml",
    "chars": 2515,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob/\ndata_pat"
  },
  {
    "path": "PFPO/conf/api/vllm/mwp-bench/mistral_dev_0shot_v1_0.yaml",
    "chars": 2910,
    "preview": "defaults:\n  - hydra: default\n  - _self_\n\nhydra:\n  searchpath:\n    - file://conf/\n\nmount_dir: /mnt/fangkai_blob\ndata_path"
  },
  {
    "path": "PFPO/conf/api/vllm/vllm_params/sampling_param_greedy.yaml",
    "chars": 98,
    "preview": "_target_: vllm.SamplingParams\nn: 1\ntemperature: 0.0\nstop: [ \"</s>\", \"\\n\\n\\n\\n\" ]\nmax_tokens: 2048\n"
  },
  {
    "path": "PFPO/conf/api/vllm/vllm_params/sampling_param_sample.yaml",
    "chars": 98,
    "preview": "_target_: vllm.SamplingParams\nn: 5\ntemperature: 1.0\nstop: [ \"</s>\", \"\\n\\n\\n\\n\" ]\nmax_tokens: 2048\n"
  },
  {
    "path": "PFPO/conf/deepspeed/fp16.yaml",
    "chars": 200,
    "preview": "bf16:\n  enabled: False\nfp16:\n  enabled: True\n  auto_cast: False\n  loss_scale: 0\n  initial_scale_power: 16\n  loss_scale_w"
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero0.yaml",
    "chars": 1377,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupDecayLR\n  params:\n    total_num_st"
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero1.yaml",
    "chars": 1373,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupDecayLR\n  params:\n    total_num_st"
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero1_cosine.yaml",
    "chars": 1407,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupCosineLR  # requires deepspeed >= "
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero1_lr.yaml",
    "chars": 1347,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupLR\n  params:\n    warmup_max_lr: ${"
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero1_optim_offload.yaml",
    "chars": 1370,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupDecayLR\n  params:\n    total_num_st"
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero1_optim_offload_cosine.yaml",
    "chars": 1404,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupCosineLR  # requires deepspeed >= "
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero1_optim_offload_lr.yaml",
    "chars": 1344,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupLR\n  params:\n    warmup_max_lr: ${"
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero1_wo_optim.yaml",
    "chars": 1299,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupDecayLR\n  params:\n    total_num_st"
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero2.yaml",
    "chars": 1373,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupDecayLR\n  params:\n    total_num_st"
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero2_cosine.yaml",
    "chars": 1407,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupCosineLR  # requires deepspeed >= "
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero2_lr.yaml",
    "chars": 1369,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupLR\n  params:\n#    total_num_steps:"
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero2_optim_offload.yaml",
    "chars": 1370,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupDecayLR\n  params:\n    total_num_st"
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero2_optim_offload_cosine.yaml",
    "chars": 1404,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupCosineLR  # requires deepspeed >= "
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero3.yaml",
    "chars": 1373,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupDecayLR\n  params:\n    total_num_st"
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero3_cosine.yaml",
    "chars": 1407,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupCosineLR  # requires deepspeed >= "
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero3_optim_offload.yaml",
    "chars": 1447,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupDecayLR\n  params:\n    total_num_st"
  },
  {
    "path": "PFPO/conf/deepspeed/train_hybrid_engine_zero3_optim_offload_cosine.yaml",
    "chars": 1404,
    "preview": "train_micro_batch_size_per_gpu:\ngradient_accumulation_steps:\nscheduler:\n  type: WarmupCosineLR  # requires deepspeed >= "
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/dpo/orig-pseudo-v1.0-a100.yaml",
    "chars": 5371,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/dpo/orig-v1.0-v100.yaml",
    "chars": 5412,
    "preview": "defaults:\n  - hydra: default\n  - deepspeed@ds_cfg: train_hybrid_engine_zero3_optim_offload\n#  - deepspeed@ds_cfg: train_"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/dpo/orig-v1.1-v100-tp2.yaml",
    "chars": 5329,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/dpo/orig-v1.1-v100-tp4.yaml",
    "chars": 5329,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/dpo/orig-v1.1-v100.yaml",
    "chars": 5404,
    "preview": "defaults:\n  - hydra: default\n  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n#  - deepspeed@ds_cfg: train_hybrid_engine_"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/dpo/orig-v1.2-v100-tp4.yaml",
    "chars": 5341,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/dpo/orig-v1.3-a100.yaml",
    "chars": 5339,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/dpo/orig-v1.3-v100-tp4.yaml",
    "chars": 5368,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/dpo/orig-v1.4-a100.yaml",
    "chars": 5413,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/dpo/orig-v1.4-v100-tp4.yaml",
    "chars": 5390,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/dpo/pseudo-sc-dpo-v1.0-v100-tp8.yaml",
    "chars": 5497,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/dpo/pseudo-sc-dpo-v1.1-h100.yaml",
    "chars": 5488,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/dpo/pseudo-sc-dpo-v1.1-v100-tp8.yaml",
    "chars": 5661,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/dpo/pseudo-sc-dpo-v1.2-a100.yaml",
    "chars": 5488,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/dpo/pseudo-sc-dpo-v1.2-v100-tp8.yaml",
    "chars": 5647,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/sft/v1.0-a100.yaml",
    "chars": 4560,
    "preview": "defaults:\n  - hydra: default\n#  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engine_"
  },
  {
    "path": "PFPO/conf/exp/apps/code_gen/deepseek_coder/sft/v1.0-v100.yaml",
    "chars": 4528,
    "preview": "defaults:\n  - hydra: default\n#  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engine_"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/deprecated/sft-v1.0-v100-tp4.yaml",
    "chars": 5417,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-4o-ps-test-pdpo-h100-v1.0.yaml",
    "chars": 7281,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-4o-ps-test-pdpo-h100-v1.1.yaml",
    "chars": 7289,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-4o-self-mix-ps-test-v1.0-mi300x-dp16.yaml",
    "chars": 5703,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-4o-self-mix-ps-test-v1.0-mi300x.yaml",
    "chars": 5703,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-4o-self-mix-ps-test-v1.1-mi300x.yaml",
    "chars": 5703,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-ps-pdpo-ctr-ts-num-v1.0-mi300x-dp32.yaml",
    "chars": 5720,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-pseudo-v1.0-a100.yaml",
    "chars": 5475,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-self-pseudo-v1.0-a100.yaml",
    "chars": 5485,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-self-pseudo-v1.0-v100.yaml",
    "chars": 5482,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-v1.0-H100-4o-ps-test.yaml",
    "chars": 5685,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-v2.0-v100.yaml",
    "chars": 5462,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-v3.0-a100.yaml",
    "chars": 5456,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-v3.1-rm-a100.yaml",
    "chars": 5518,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-v3.2-v100.yaml",
    "chars": 5606,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-v4.0-v100-ps-test.yaml",
    "chars": 5708,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-v4.1-H100-ps-pdpo.yaml",
    "chars": 5896,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-v4.10-V100-ps-pdpo-rerun.yaml",
    "chars": 7490,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-v4.2-H100-gd-pdpo.yaml",
    "chars": 5866,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-v4.2-v100-gd-pdpo.yaml",
    "chars": 5959,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-v4.3-H100-ps-pdpo.yaml",
    "chars": 5757,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-v4.3-V100-ps-pdpo-rerun.yaml",
    "chars": 5910,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-v4.3-v100-gd-pdpo.yaml",
    "chars": 5969,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-v4.4-H100-ps-pdpo.yaml",
    "chars": 5757,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  },
  {
    "path": "PFPO/conf/exp/apps/r2c_generation/deepseek_coder/dpo/gpt4o-distil-v4.4-V100-ps-pdpo-rerun.yaml",
    "chars": 5885,
    "preview": "defaults:\n  - hydra: default\n  #  - deepspeed@ds_cfg: train_hybrid_engine_zero3\n  - deepspeed@ds_cfg: train_hybrid_engin"
  }
]

// ... and 5715 more files (download for full content)

About this extraction

This page contains the full source code of the microsoft/unilm GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 5915 files (112.5 MB), approximately 5.0M tokens, and a symbol index with 1686 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!