├── README.md ├── data_prepare ├── format_tokenize.py ├── generate_longpo_pair.py ├── generate_qa.py ├── merge_datasets.py ├── postprocess_longpo_pair.py ├── postprocess_qa.py └── readme.md ├── playground └── accelerate_single_node_zero3.yaml ├── requirements.txt ├── scripts ├── format_tokenize.sh ├── generate_longpo_pair.sh ├── generate_qa.sh ├── postprocess_longpo_pair.sh └── postprocess_qa.sh └── train ├── argument.py ├── hybrid ├── __init__.py ├── comm │ ├── __init__.py │ ├── all_to_all.py │ └── extract_local.py ├── globals.py ├── monkey_patch copy.py ├── monkey_patch.py ├── ring │ ├── __init__.py │ ├── ring_flash_attn.py │ ├── ring_flash_attn_varlen.py │ ├── stripe_flash_attn.py │ ├── triton_utils.py │ ├── utils.py │ ├── zigzag_ring_flash_attn.py │ └── zigzag_ring_flash_attn_varlen.py ├── ulysses │ ├── __init__.py │ ├── all_to_all.py │ └── attn_layer.py └── utils.py ├── longdpo_trainer.py ├── train_longpo.py ├── ulysses ├── all_to_all.py ├── attn_layer.py ├── layer.py ├── monkey_patch_mistral.py └── ulysses_forward.py └── zigzag_ring_flash_attn ├── __init__.py ├── ring_flash_attn.py ├── stripe_flash_attn.py ├── utils.py ├── zigzag_ring_flash_attn.py └── zigzag_ring_flash_attn_varlen.py /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/README.md -------------------------------------------------------------------------------- /data_prepare/format_tokenize.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/data_prepare/format_tokenize.py -------------------------------------------------------------------------------- /data_prepare/generate_longpo_pair.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/data_prepare/generate_longpo_pair.py -------------------------------------------------------------------------------- /data_prepare/generate_qa.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/data_prepare/generate_qa.py -------------------------------------------------------------------------------- /data_prepare/merge_datasets.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/data_prepare/merge_datasets.py -------------------------------------------------------------------------------- /data_prepare/postprocess_longpo_pair.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/data_prepare/postprocess_longpo_pair.py -------------------------------------------------------------------------------- /data_prepare/postprocess_qa.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/data_prepare/postprocess_qa.py -------------------------------------------------------------------------------- /data_prepare/readme.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/data_prepare/readme.md -------------------------------------------------------------------------------- /playground/accelerate_single_node_zero3.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/playground/accelerate_single_node_zero3.yaml -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | transformers==4.45.2 2 | flash-attn 3 | trl == 0.8.6 4 | -------------------------------------------------------------------------------- /scripts/format_tokenize.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/scripts/format_tokenize.sh -------------------------------------------------------------------------------- /scripts/generate_longpo_pair.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/scripts/generate_longpo_pair.sh -------------------------------------------------------------------------------- /scripts/generate_qa.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/scripts/generate_qa.sh -------------------------------------------------------------------------------- /scripts/postprocess_longpo_pair.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/scripts/postprocess_longpo_pair.sh -------------------------------------------------------------------------------- /scripts/postprocess_qa.sh: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/scripts/postprocess_qa.sh -------------------------------------------------------------------------------- /train/argument.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/argument.py -------------------------------------------------------------------------------- /train/hybrid/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /train/hybrid/comm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/comm/__init__.py -------------------------------------------------------------------------------- /train/hybrid/comm/all_to_all.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/comm/all_to_all.py -------------------------------------------------------------------------------- /train/hybrid/comm/extract_local.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/comm/extract_local.py -------------------------------------------------------------------------------- /train/hybrid/globals.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/globals.py -------------------------------------------------------------------------------- /train/hybrid/monkey_patch copy.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/monkey_patch copy.py -------------------------------------------------------------------------------- /train/hybrid/monkey_patch.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/monkey_patch.py -------------------------------------------------------------------------------- /train/hybrid/ring/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/ring/__init__.py -------------------------------------------------------------------------------- /train/hybrid/ring/ring_flash_attn.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/ring/ring_flash_attn.py -------------------------------------------------------------------------------- /train/hybrid/ring/ring_flash_attn_varlen.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/ring/ring_flash_attn_varlen.py -------------------------------------------------------------------------------- /train/hybrid/ring/stripe_flash_attn.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/ring/stripe_flash_attn.py -------------------------------------------------------------------------------- /train/hybrid/ring/triton_utils.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/ring/triton_utils.py -------------------------------------------------------------------------------- /train/hybrid/ring/utils.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/ring/utils.py -------------------------------------------------------------------------------- /train/hybrid/ring/zigzag_ring_flash_attn.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/ring/zigzag_ring_flash_attn.py -------------------------------------------------------------------------------- /train/hybrid/ring/zigzag_ring_flash_attn_varlen.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/ring/zigzag_ring_flash_attn_varlen.py -------------------------------------------------------------------------------- /train/hybrid/ulysses/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/ulysses/__init__.py -------------------------------------------------------------------------------- /train/hybrid/ulysses/all_to_all.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/ulysses/all_to_all.py -------------------------------------------------------------------------------- /train/hybrid/ulysses/attn_layer.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/ulysses/attn_layer.py -------------------------------------------------------------------------------- /train/hybrid/utils.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/hybrid/utils.py -------------------------------------------------------------------------------- /train/longdpo_trainer.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/longdpo_trainer.py -------------------------------------------------------------------------------- /train/train_longpo.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/train_longpo.py -------------------------------------------------------------------------------- /train/ulysses/all_to_all.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/ulysses/all_to_all.py -------------------------------------------------------------------------------- /train/ulysses/attn_layer.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/ulysses/attn_layer.py -------------------------------------------------------------------------------- /train/ulysses/layer.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/ulysses/layer.py -------------------------------------------------------------------------------- /train/ulysses/monkey_patch_mistral.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/ulysses/monkey_patch_mistral.py -------------------------------------------------------------------------------- /train/ulysses/ulysses_forward.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/ulysses/ulysses_forward.py -------------------------------------------------------------------------------- /train/zigzag_ring_flash_attn/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/zigzag_ring_flash_attn/__init__.py -------------------------------------------------------------------------------- /train/zigzag_ring_flash_attn/ring_flash_attn.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/zigzag_ring_flash_attn/ring_flash_attn.py -------------------------------------------------------------------------------- /train/zigzag_ring_flash_attn/stripe_flash_attn.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/zigzag_ring_flash_attn/stripe_flash_attn.py -------------------------------------------------------------------------------- /train/zigzag_ring_flash_attn/utils.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/zigzag_ring_flash_attn/utils.py -------------------------------------------------------------------------------- /train/zigzag_ring_flash_attn/zigzag_ring_flash_attn.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/zigzag_ring_flash_attn/zigzag_ring_flash_attn.py -------------------------------------------------------------------------------- /train/zigzag_ring_flash_attn/zigzag_ring_flash_attn_varlen.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DAMO-NLP-SG/LongPO/HEAD/train/zigzag_ring_flash_attn/zigzag_ring_flash_attn_varlen.py --------------------------------------------------------------------------------