├── api ├── rag │ ├── r1rag │ │ └── __init__.py │ ├── .gitignore │ ├── configs │ │ └── egolife.yaml │ └── pyproject.toml └── visual_tools │ ├── configs.yaml │ ├── egoschema_videollm_llava │ └── video_llm.py │ ├── videomme_videollm_llava │ └── video_llm.py │ ├── egoschema_vlm │ ├── vlm.py │ └── api.py │ ├── videomme_vlm │ ├── vlm.py │ └── api.py │ ├── egor1_vlm │ ├── vlm.py │ └── api.py │ └── egor1_videollm_llava │ └── video_llm.py ├── Ego-R1-Agent ├── verl │ ├── version │ │ └── version │ ├── single_controller │ │ ├── version │ │ │ └── version │ │ ├── base │ │ │ ├── megatron │ │ │ │ ├── __init__.py │ │ │ │ └── worker.py │ │ │ ├── register_center │ │ │ │ ├── __init__.py │ │ │ │ └── ray.py │ │ │ └── __init__.py │ │ ├── ray │ │ │ └── __init__.py │ │ └── __init__.py │ ├── trainer │ │ ├── runtime_env.yaml │ │ ├── config │ │ │ ├── evaluation.yaml │ │ │ ├── generation.yaml │ │ │ └── sft_trainer.yaml │ │ ├── __init__.py │ │ └── ppo │ │ │ └── __init__.py │ ├── models │ │ ├── __init__.py │ │ ├── llama │ │ │ ├── __init__.py │ │ │ └── megatron │ │ │ │ ├── checkpoint_utils │ │ │ │ └── __init__.py │ │ │ │ ├── layers │ │ │ │ ├── __init__.py │ │ │ │ └── parallel_rmsnorm.py │ │ │ │ └── __init__.py │ │ ├── transformers │ │ │ └── __init__.py │ │ ├── weight_loader_registry.py │ │ └── README.md │ ├── workers │ │ ├── __init__.py │ │ ├── reward_model │ │ │ ├── __init__.py │ │ │ ├── megatron │ │ │ │ └── __init__.py │ │ │ └── base.py │ │ ├── rollout │ │ │ ├── naive │ │ │ │ └── __init__.py │ │ │ ├── vllm_rollout │ │ │ │ └── __init__.py │ │ │ ├── __init__.py │ │ │ └── base.py │ │ ├── actor │ │ │ └── __init__.py │ │ ├── critic │ │ │ ├── __init__.py │ │ │ └── base.py │ │ └── sharding_manager │ │ │ ├── base.py │ │ │ └── __init__.py │ ├── third_party │ │ ├── __init__.py │ │ └── vllm │ │ │ ├── vllm_v_0_3_1 │ │ │ └── __init__.py │ │ │ ├── vllm_v_0_4_2 │ │ │ └── __init__.py │ │ │ ├── vllm_v_0_5_4 │ │ │ ├── __init__.py │ │ │ └── hf_weight_loader.py │ │ │ ├── vllm_v_0_6_3 │ │ │ ├── __init__.py │ │ │ ├── tokenizer.py │ │ │ └── hf_weight_loader.py │ │ │ └── __init__.py │ ├── utils │ │ ├── logger │ │ │ ├── __init__.py │ │ │ └── aggregate_logger.py │ │ ├── megatron │ │ │ ├── __init__.py │ │ │ ├── memory.py │ │ │ └── sequence_parallel.py │ │ ├── rendezvous │ │ │ └── __init__.py │ │ ├── reward_score │ │ │ └── __init__.py │ │ ├── debug │ │ │ ├── __init__.py │ │ │ └── performance.py │ │ ├── dataset │ │ │ ├── __init__.py │ │ │ └── README.md │ │ ├── __init__.py │ │ ├── config.py │ │ ├── logging_utils.py │ │ ├── distributed.py │ │ ├── import_utils.py │ │ ├── ray_utils.py │ │ └── py_functional.py │ └── __init__.py ├── ego_r1 │ ├── llm_agent │ │ └── __init__.py │ └── search │ │ ├── retrieval_request.py │ │ ├── build_index.sh │ │ └── retrieval.sh ├── utils │ └── serve.sh ├── README.md ├── eval │ └── infer_bench_summ.sh ├── .gitignore └── setup.py ├── LLaMA-Factory ├── src │ ├── llamafactory │ │ ├── api │ │ │ ├── __init__.py │ │ │ └── common.py │ │ ├── eval │ │ │ └── __init__.py │ │ ├── train │ │ │ ├── __init__.py │ │ │ ├── pt │ │ │ │ └── __init__.py │ │ │ ├── rm │ │ │ │ ├── __init__.py │ │ │ │ └── metric.py │ │ │ ├── dpo │ │ │ │ └── __init__.py │ │ │ ├── kto │ │ │ │ └── __init__.py │ │ │ ├── ppo │ │ │ │ └── __init__.py │ │ │ └── sft │ │ │ │ └── __init__.py │ │ ├── webui │ │ │ ├── __init__.py │ │ │ ├── components │ │ │ │ └── __init__.py │ │ │ └── css.py │ │ ├── extras │ │ │ └── __init__.py │ │ ├── third_party │ │ │ ├── __init__.py │ │ │ └── muon │ │ │ │ └── __init__.py │ │ ├── model │ │ │ ├── model_utils │ │ │ │ ├── __init__.py │ │ │ │ ├── mod.py │ │ │ │ └── kv_cache.py │ │ │ └── __init__.py │ │ ├── chat │ │ │ └── __init__.py │ │ ├── launcher.py │ │ ├── __init__.py │ │ ├── data │ │ │ ├── processor │ │ │ │ └── __init__.py │ │ │ └── __init__.py │ │ └── hparams │ │ │ └── __init__.py │ ├── train.py │ ├── api.py │ └── webui.py ├── MANIFEST.in ├── .github │ ├── ISSUE_TEMPLATE │ │ ├── config.yml │ │ └── 2-feature-request.yml │ ├── PULL_REQUEST_TEMPLATE.md │ ├── SECURITY.md │ └── workflows │ │ ├── publish.yml │ │ └── label_issue.yml ├── .gitattributes ├── data │ ├── mllm_demo_data │ │ ├── 1.jpg │ │ ├── 1.mp3 │ │ ├── 1.mp4 │ │ ├── 2.avi │ │ ├── 2.jpg │ │ ├── 2.wav │ │ ├── 3.flac │ │ ├── 3.jpg │ │ ├── 3.mp4 │ │ ├── 4.mp3 │ │ └── 4.mp4 │ ├── mllm_video_demo.json │ ├── mllm_audio_demo.json │ └── mllm_video_audio_demo.json ├── examples │ ├── extras │ │ ├── pissa │ │ │ ├── init.sh │ │ │ └── llama3_lora_sft.yaml │ │ ├── llama_pro │ │ │ ├── expand.sh │ │ │ └── llama3_freeze_sft.yaml │ │ ├── fsdp_qlora │ │ │ ├── train.sh │ │ │ └── llama3_lora_sft.yaml │ │ ├── nlg_eval │ │ │ └── llama3_lora_predict.yaml │ │ ├── muon │ │ │ └── qwen2_full_sft.yaml │ │ ├── adam_mini │ │ │ └── qwen2_full_sft.yaml │ │ ├── mod │ │ │ └── llama3_full_sft.yaml │ │ ├── loraplus │ │ │ └── llama3_lora_sft.yaml │ │ ├── badam │ │ │ └── llama3_full_sft.yaml │ │ ├── galore │ │ │ └── llama3_full_sft.yaml │ │ └── apollo │ │ │ └── llama3_full_sft.yaml │ ├── inference │ │ ├── llama3_full_sft.yaml │ │ ├── qwen2_vl.yaml │ │ ├── llama3.yaml │ │ └── llama3_lora_sft.yaml │ ├── merge_lora │ │ ├── llama3_full_sft.yaml │ │ ├── llama3_gptq.yaml │ │ ├── llama3_lora_sft.yaml │ │ └── qwen2vl_lora_sft.yaml │ ├── train_lora │ │ ├── llama3_lora_eval.yaml │ │ ├── llama3_preprocess.yaml │ │ ├── llama3_lora_ppo.yaml │ │ ├── llama3_lora_kto.yaml │ │ ├── llama3_lora_sft.sh │ │ ├── llama3_lora_pretrain.yaml │ │ ├── llama3_lora_reward.yaml │ │ ├── llama3_lora_sft.yaml │ │ ├── qwen2vl_lora_sft.yaml │ │ ├── llama3_lora_dpo.yaml │ │ ├── qwen2vl_lora_dpo.yaml │ │ ├── llama3_lora_sft_ds3.yaml │ │ ├── llama4_lora_sft_ds3.yaml │ │ └── llama3_lora_sft_ray.yaml │ ├── accelerate │ │ ├── fsdp_config.yaml │ │ └── fsdp_config_offload.yaml │ ├── train_qlora │ │ ├── llama3_lora_sft_awq.yaml │ │ ├── llama3_lora_sft_gptq.yaml │ │ ├── llama3_lora_sft_aqlm.yaml │ │ ├── llama3_lora_sft_bnb_npu.yaml │ │ └── llama3_lora_sft_otfq.yaml │ └── train_full │ │ ├── llama3_full_sft.yaml │ │ ├── qwen2vl_full_sft.yaml │ │ └── qwen.yaml ├── .dockerignore ├── Makefile ├── .pre-commit-config.yaml ├── .env.local ├── docker │ ├── docker-npu │ │ └── docker-compose.yml │ ├── docker-cuda │ │ └── docker-compose.yml │ └── docker-rocm │ │ └── docker-compose.yml ├── tests │ ├── data │ │ ├── processor │ │ │ └── test_processor_utils.py │ │ └── test_loader.py │ ├── check_license.py │ ├── e2e │ │ └── test_chat.py │ └── model │ │ ├── test_base.py │ │ ├── model_utils │ │ ├── test_misc.py │ │ ├── test_add_tokens.py │ │ └── test_attention.py │ │ └── test_full.py ├── CITATION.cff └── scripts │ ├── convert_ckpt │ └── tiny_llama4.py │ └── stat_utils │ └── cal_flops.py ├── assets └── teaser.png ├── .gitignore └── cott_gen └── __init__.py /api/rag/r1rag/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/version/version: -------------------------------------------------------------------------------- 1 | 0.1 -------------------------------------------------------------------------------- /Ego-R1-Agent/ego_r1/llm_agent/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/api/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/eval/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/train/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/webui/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/extras/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/single_controller/version/version: -------------------------------------------------------------------------------- 1 | 0.0.2 -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/third_party/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /LLaMA-Factory/MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE requirements.txt 2 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/model/model_utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /LLaMA-Factory/.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | -------------------------------------------------------------------------------- /assets/teaser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egolife-ai/Ego-R1/HEAD/assets/teaser.png -------------------------------------------------------------------------------- /LLaMA-Factory/.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /LLaMA-Factory/data/mllm_demo_data/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egolife-ai/Ego-R1/HEAD/LLaMA-Factory/data/mllm_demo_data/1.jpg -------------------------------------------------------------------------------- /LLaMA-Factory/data/mllm_demo_data/1.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egolife-ai/Ego-R1/HEAD/LLaMA-Factory/data/mllm_demo_data/1.mp3 -------------------------------------------------------------------------------- /LLaMA-Factory/data/mllm_demo_data/1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egolife-ai/Ego-R1/HEAD/LLaMA-Factory/data/mllm_demo_data/1.mp4 -------------------------------------------------------------------------------- /LLaMA-Factory/data/mllm_demo_data/2.avi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egolife-ai/Ego-R1/HEAD/LLaMA-Factory/data/mllm_demo_data/2.avi -------------------------------------------------------------------------------- /LLaMA-Factory/data/mllm_demo_data/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egolife-ai/Ego-R1/HEAD/LLaMA-Factory/data/mllm_demo_data/2.jpg -------------------------------------------------------------------------------- /LLaMA-Factory/data/mllm_demo_data/2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egolife-ai/Ego-R1/HEAD/LLaMA-Factory/data/mllm_demo_data/2.wav -------------------------------------------------------------------------------- /LLaMA-Factory/data/mllm_demo_data/3.flac: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egolife-ai/Ego-R1/HEAD/LLaMA-Factory/data/mllm_demo_data/3.flac -------------------------------------------------------------------------------- /LLaMA-Factory/data/mllm_demo_data/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egolife-ai/Ego-R1/HEAD/LLaMA-Factory/data/mllm_demo_data/3.jpg -------------------------------------------------------------------------------- /LLaMA-Factory/data/mllm_demo_data/3.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egolife-ai/Ego-R1/HEAD/LLaMA-Factory/data/mllm_demo_data/3.mp4 -------------------------------------------------------------------------------- /LLaMA-Factory/data/mllm_demo_data/4.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egolife-ai/Ego-R1/HEAD/LLaMA-Factory/data/mllm_demo_data/4.mp3 -------------------------------------------------------------------------------- /LLaMA-Factory/data/mllm_demo_data/4.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/egolife-ai/Ego-R1/HEAD/LLaMA-Factory/data/mllm_demo_data/4.mp4 -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/trainer/runtime_env.yaml: -------------------------------------------------------------------------------- 1 | working_dir: ./ 2 | excludes: ["/.git/"] 3 | env_vars: 4 | TORCH_NCCL_AVOID_RECORD_STREAMS: "1" 5 | VLLM_ATTENTION_BACKEND: "XFORMERS" -------------------------------------------------------------------------------- /LLaMA-Factory/examples/extras/pissa/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python scripts/pissa_init.py \ 4 | --model_name_or_path meta-llama/Meta-Llama-3-8B-Instruct \ 5 | --output_dir models/llama3-8b-pissa 6 | -------------------------------------------------------------------------------- /LLaMA-Factory/examples/inference/llama3_full_sft.yaml: -------------------------------------------------------------------------------- 1 | model_name_or_path: saves/llama3-8b/full/sft 2 | template: llama3 3 | infer_backend: huggingface # choices: [huggingface, vllm, sglang] 4 | trust_remote_code: true 5 | -------------------------------------------------------------------------------- /LLaMA-Factory/examples/inference/qwen2_vl.yaml: -------------------------------------------------------------------------------- 1 | model_name_or_path: Qwen/Qwen2.5-VL-7B-Instruct 2 | template: qwen2_vl 3 | infer_backend: huggingface # choices: [huggingface, vllm, sglang] 4 | trust_remote_code: true 5 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/trainer/config/evaluation.yaml: -------------------------------------------------------------------------------- 1 | data: 2 | path: /tmp/math_Qwen2-7B-Instruct.parquet 3 | prompt_key: prompt 4 | response_key: responses 5 | data_source_key: data_source 6 | reward_model_key: reward_model -------------------------------------------------------------------------------- /LLaMA-Factory/.dockerignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | .git 3 | .github 4 | .venv 5 | cache 6 | data 7 | docker 8 | saves 9 | hf_cache 10 | ms_cache 11 | om_cache 12 | output 13 | .dockerignore 14 | .gitattributes 15 | .gitignore 16 | -------------------------------------------------------------------------------- /LLaMA-Factory/examples/inference/llama3.yaml: -------------------------------------------------------------------------------- 1 | model_name_or_path: meta-llama/Meta-Llama-3-8B-Instruct 2 | template: llama3 3 | infer_backend: huggingface # choices: [huggingface, vllm, sglang] 4 | trust_remote_code: true 5 | -------------------------------------------------------------------------------- /LLaMA-Factory/examples/extras/llama_pro/expand.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | python scripts/llama_pro.py \ 4 | --model_name_or_path meta-llama/Meta-Llama-3-8B-Instruct \ 5 | --output_dir models/llama3-8b-pro \ 6 | --num_expand 8 7 | -------------------------------------------------------------------------------- /LLaMA-Factory/examples/inference/llama3_lora_sft.yaml: -------------------------------------------------------------------------------- 1 | model_name_or_path: meta-llama/Meta-Llama-3-8B-Instruct 2 | adapter_name_or_path: saves/llama3-8b/lora/sft 3 | template: llama3 4 | infer_backend: huggingface # choices: [huggingface, vllm, sglang] 5 | trust_remote_code: true 6 | -------------------------------------------------------------------------------- /LLaMA-Factory/examples/extras/fsdp_qlora/train.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # DO NOT use GPTQ/AWQ model in FSDP+QLoRA 3 | 4 | CUDA_VISIBLE_DEVICES=0,1 accelerate launch \ 5 | --config_file examples/accelerate/fsdp_config.yaml \ 6 | src/train.py examples/extras/fsdp_qlora/llama3_lora_sft.yaml 7 | -------------------------------------------------------------------------------- /LLaMA-Factory/.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # What does this PR do? 2 | 3 | Fixes # (issue) 4 | 5 | ## Before submitting 6 | 7 | - [ ] Did you read the [contributor guideline](https://github.com/hiyouga/LLaMA-Factory/blob/main/.github/CONTRIBUTING.md)? 8 | - [ ] Did you write any new necessary tests? 9 | -------------------------------------------------------------------------------- /LLaMA-Factory/examples/merge_lora/llama3_full_sft.yaml: -------------------------------------------------------------------------------- 1 | ### model 2 | model_name_or_path: saves/llama3-8b/full/sft 3 | template: llama3 4 | trust_remote_code: true 5 | 6 | ### export 7 | export_dir: output/llama3_full_sft 8 | export_size: 5 9 | export_device: cpu # choices: [cpu, auto] 10 | export_legacy_format: false 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.json 2 | *.jpg 3 | *.png 4 | *.mp4 5 | *.pt 6 | *.pth 7 | *.safetensors 8 | __pycache__ 9 | *.pyc 10 | *.log 11 | *.txt 12 | *.csv 13 | *.jsonl 14 | *.sample 15 | *.xlsx 16 | *.avi 17 | *.mp3 18 | *.wav 19 | *.flac 20 | *.zip 21 | *.tar 22 | *.gz 23 | api/hmguo/NVIDIA-Linux-x86_64-*.run 24 | api/hmguo/fastrag/database/JAKE/*.pkl 25 | Search_R1/tmp 26 | api/ -------------------------------------------------------------------------------- /Ego-R1-Agent/utils/serve.sh: -------------------------------------------------------------------------------- 1 | export CUDA_VISIBLE_DEVICES=0,1 2 | 3 | # vllm serve Qwen/Qwen2.5-3B-Instruct --port=23332 \ 4 | # --tensor-parallel-size=2 \ 5 | # --gpu-memory-utilization=0.7 \ 6 | # --disable-custom-all-reduce 7 | 8 | 9 | vllm serve Ego-R1/Ego-R1-Agent-3B --port=23333 \ 10 | --tensor-parallel-size=2 \ 11 | --gpu-memory-utilization=0.7 \ 12 | --disable-custom-all-reduce -------------------------------------------------------------------------------- /LLaMA-Factory/examples/merge_lora/llama3_gptq.yaml: -------------------------------------------------------------------------------- 1 | ### model 2 | model_name_or_path: meta-llama/Meta-Llama-3-8B-Instruct 3 | template: llama3 4 | trust_remote_code: true 5 | 6 | ### export 7 | export_dir: output/llama3_gptq 8 | export_quantization_bit: 4 9 | export_quantization_dataset: data/c4_demo.jsonl 10 | export_size: 5 11 | export_device: cpu # choices: [cpu, auto] 12 | export_legacy_format: false 13 | -------------------------------------------------------------------------------- /api/rag/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore logs directory 2 | logs/ 3 | logs/* 4 | 5 | # Ignore data directory 6 | data/ 7 | data/* 8 | 9 | # Python specific ignores 10 | __pycache__/ 11 | *.py[cod] 12 | *$py.class 13 | *.so 14 | .Python 15 | build/ 16 | develop-eggs/ 17 | dist/ 18 | downloads/ 19 | eggs/ 20 | .eggs/ 21 | lib/ 22 | lib64/ 23 | parts/ 24 | sdist/ 25 | var/ 26 | wheels/ 27 | *.egg-info/ 28 | .installed.cfg 29 | *.egg -------------------------------------------------------------------------------- /api/rag/configs/egolife.yaml: -------------------------------------------------------------------------------- 1 | # API configurations 2 | apis: 3 | A1: 4 | identity: JAKE 5 | port: 8001 6 | A2: 7 | identity: ALICE 8 | port: 8002 9 | A3: 10 | identity: TASHA 11 | port: 8003 12 | A4: 13 | identity: LUCIA 14 | port: 8004 15 | A5: 16 | identity: KATRINA 17 | port: 8005 18 | A6: 19 | identity: SHURE 20 | port: 8006 21 | 22 | # Base settings 23 | base: 24 | data_dir: data/egolife 25 | -------------------------------------------------------------------------------- /LLaMA-Factory/examples/merge_lora/llama3_lora_sft.yaml: -------------------------------------------------------------------------------- 1 | ### Note: DO NOT use quantized model or quantization_bit when merging lora adapters 2 | 3 | ### model 4 | model_name_or_path: meta-llama/Meta-Llama-3-8B-Instruct 5 | adapter_name_or_path: saves/llama3-8b/lora/sft 6 | template: llama3 7 | trust_remote_code: true 8 | 9 | ### export 10 | export_dir: output/llama3_lora_sft 11 | export_size: 5 12 | export_device: cpu # choices: [cpu, auto] 13 | export_legacy_format: false 14 | -------------------------------------------------------------------------------- /LLaMA-Factory/examples/merge_lora/qwen2vl_lora_sft.yaml: -------------------------------------------------------------------------------- 1 | ### Note: DO NOT use quantized model or quantization_bit when merging lora adapters 2 | 3 | ### model 4 | model_name_or_path: Qwen/Qwen2.5-VL-7B-Instruct 5 | adapter_name_or_path: saves/qwen2_vl-7b/lora/sft 6 | template: qwen2_vl 7 | trust_remote_code: true 8 | 9 | ### export 10 | export_dir: output/qwen2_vl_lora_sft 11 | export_size: 5 12 | export_device: cpu # choices: [cpu, auto] 13 | export_legacy_format: false 14 | -------------------------------------------------------------------------------- /LLaMA-Factory/examples/train_lora/llama3_lora_eval.yaml: -------------------------------------------------------------------------------- 1 | ### model 2 | model_name_or_path: meta-llama/Meta-Llama-3-8B-Instruct 3 | adapter_name_or_path: saves/llama3-8b/lora/sft 4 | trust_remote_code: true 5 | 6 | ### method 7 | finetuning_type: lora 8 | 9 | ### dataset 10 | task: mmlu_test # choices: [mmlu_test, ceval_validation, cmmlu_test] 11 | template: fewshot 12 | lang: en 13 | n_shot: 5 14 | 15 | ### output 16 | save_dir: saves/llama3-8b/lora/eval 17 | 18 | ### eval 19 | batch_size: 4 20 | -------------------------------------------------------------------------------- /LLaMA-Factory/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: build commit license quality style test 2 | 3 | check_dirs := scripts src tests setup.py 4 | 5 | build: 6 | pip3 install build && python3 -m build 7 | 8 | commit: 9 | pre-commit install 10 | pre-commit run --all-files 11 | 12 | license: 13 | python3 tests/check_license.py $(check_dirs) 14 | 15 | quality: 16 | ruff check $(check_dirs) 17 | ruff format --check $(check_dirs) 18 | 19 | style: 20 | ruff check $(check_dirs) --fix 21 | ruff format $(check_dirs) 22 | 23 | test: 24 | CUDA_VISIBLE_DEVICES= WANDB_DISABLED=true pytest -vv tests/ 25 | -------------------------------------------------------------------------------- /LLaMA-Factory/.github/SECURITY.md: -------------------------------------------------------------------------------- 1 | # Reporting Security Issues 2 | 3 | To report a security issue, please use the GitHub Security Advisory ["Report a Vulnerability"](https://github.com/hiyouga/LLaMA-Factory/security/advisories/new) tab. 4 | 5 | We will send a response indicating the next steps in handling your report. After the initial reply to your report, the security team will keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance. 6 | 7 | Report security bugs in third-party modules to the person or team maintaining the module. 8 | -------------------------------------------------------------------------------- /LLaMA-Factory/examples/train_lora/llama3_preprocess.yaml: -------------------------------------------------------------------------------- 1 | ### model 2 | model_name_or_path: meta-llama/Meta-Llama-3-8B-Instruct 3 | trust_remote_code: true 4 | 5 | ### method 6 | stage: sft 7 | do_train: true 8 | finetuning_type: lora 9 | lora_rank: 8 10 | lora_target: all 11 | 12 | ### dataset 13 | dataset: identity,alpaca_en_demo 14 | template: llama3 15 | cutoff_len: 2048 16 | max_samples: 1000 17 | overwrite_cache: true 18 | preprocessing_num_workers: 16 19 | tokenized_path: saves/llama3-8b/dataset/sft 20 | 21 | ### output 22 | output_dir: saves/llama3-8b/lora/sft 23 | overwrite_output_dir: true 24 | -------------------------------------------------------------------------------- /Ego-R1-Agent/ego_r1/search/retrieval_request.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | # URL for your local FastAPI server 4 | url = "http://127.0.0.1:8000/retrieve" 5 | 6 | # Example payload 7 | payload = { 8 | "queries": ["What is the capital of France?", "Explain neural networks."] * 200, 9 | "topk": 5, 10 | "return_scores": True 11 | } 12 | 13 | # Send POST request 14 | response = requests.post(url, json=payload) 15 | 16 | # Raise an exception if the request failed 17 | response.raise_for_status() 18 | 19 | # Get the JSON response 20 | retrieved_data = response.json() 21 | 22 | print("Response from server:") 23 | print(retrieved_data) 24 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/models/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/trainer/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/workers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/models/llama/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/third_party/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/trainer/ppo/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/utils/logger/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/utils/megatron/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/utils/rendezvous/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/models/transformers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/utils/reward_score/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/single_controller/base/megatron/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/third_party/vllm/vllm_v_0_3_1/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/third_party/vllm/vllm_v_0_4_2/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/third_party/vllm/vllm_v_0_5_4/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/third_party/vllm/vllm_v_0_6_3/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/models/llama/megatron/checkpoint_utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/single_controller/base/register_center/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/utils/debug/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .performance import log_gpu_memory_usage -------------------------------------------------------------------------------- /api/rag/pyproject.toml: -------------------------------------------------------------------------------- 1 | [build-system] 2 | requires = ["hatchling"] 3 | build-backend = "hatchling.build" 4 | 5 | [project] 6 | name = "r1rag" 7 | version = "0.1.0" 8 | description = "A RAG system for video captions with temporal indexing" 9 | requires-python = ">=3.8" 10 | license = "MIT" 11 | authors = [ 12 | { name = "Hongming", email = "ghm0221@bupt.edu.cn" } 13 | ] 14 | dependencies = [ 15 | "numpy>=1.21.0,<1.27.0", 16 | "pandas>=1.3.0,<2.0.0", 17 | "nltk>=3.6.0", 18 | "fastapi", 19 | "uvicorn[standard]", 20 | "pillow>=9.2.0", 21 | "PyYAML", 22 | "psutil", 23 | "openai>=1.0.0", 24 | "requests", 25 | "google-genai", 26 | "ffmpeg-python", 27 | "opencv-python" 28 | ] 29 | 30 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/workers/reward_model/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .base import BasePPORewardModel 16 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/workers/rollout/naive/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .naive_rollout import NaiveRollout 16 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/workers/rollout/vllm_rollout/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .vllm_rollout import vLLMRollout -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/workers/reward_model/megatron/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .reward_model import MegatronRewardModel 16 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/third_party/muon/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 the LlamaFactory team. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .muon import Muon 16 | 17 | 18 | __all__ = ["Muon"] 19 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/train/pt/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 the LlamaFactory team. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .workflow import run_pt 16 | 17 | 18 | __all__ = ["run_pt"] 19 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/train/rm/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 the LlamaFactory team. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .workflow import run_rm 16 | 17 | 18 | __all__ = ["run_rm"] 19 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/train/dpo/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 the LlamaFactory team. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .workflow import run_dpo 16 | 17 | 18 | __all__ = ["run_dpo"] 19 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/train/kto/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 the LlamaFactory team. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .workflow import run_kto 16 | 17 | 18 | __all__ = ["run_kto"] 19 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/train/ppo/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 the LlamaFactory team. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .workflow import run_ppo 16 | 17 | 18 | __all__ = ["run_ppo"] 19 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/train/sft/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 the LlamaFactory team. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .workflow import run_sft 16 | 17 | 18 | __all__ = ["run_sft"] 19 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/utils/dataset/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .rl_dataset import RLHFDataset 16 | from .rm_dataset import RMDataset -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from . import tokenizer 16 | from .tokenizer import * 17 | 18 | __all__ = tokenizer.__all__ -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/single_controller/base/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .worker import Worker 16 | from .worker_group import WorkerGroup, ClassWithInitArgs, ResourcePool 17 | -------------------------------------------------------------------------------- /LLaMA-Factory/.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: publish 2 | 3 | on: 4 | workflow_dispatch: 5 | release: 6 | types: 7 | - published 8 | 9 | jobs: 10 | publish: 11 | name: Upload release to PyPI 12 | 13 | runs-on: ubuntu-latest 14 | 15 | environment: 16 | name: release 17 | url: https://pypi.org/p/llamafactory 18 | 19 | permissions: 20 | id-token: write 21 | 22 | steps: 23 | - name: Checkout 24 | uses: actions/checkout@v4 25 | 26 | - name: Set up Python 27 | uses: actions/setup-python@v5 28 | with: 29 | python-version: "3.9" 30 | 31 | - name: Build package 32 | run: | 33 | make build 34 | 35 | - name: Publish package 36 | uses: pypa/gh-action-pypi-publish@release/v1 37 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/chat/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 the LlamaFactory team. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .base_engine import BaseEngine 16 | from .chat_model import ChatModel 17 | 18 | 19 | __all__ = ["BaseEngine", "ChatModel"] 20 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/workers/actor/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .base import BasePPOActor 16 | from .dp_actor import DataParallelPPOActor 17 | 18 | __all__ = ["BasePPOActor", "DataParallelPPOActor"] 19 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/workers/critic/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .base import BasePPOCritic 16 | from .dp_critic import DataParallelPPOCritic 17 | 18 | __all__ = ["BasePPOCritic", "DataParallelPPOCritic"] 19 | -------------------------------------------------------------------------------- /Ego-R1-Agent/ego_r1/search/build_index.sh: -------------------------------------------------------------------------------- 1 | 2 | corpus_file=example/corpus.jsonl 3 | save_dir=data 4 | retriever_name=e5 # this is for indexing naming 5 | retriever_model=intfloat/e5-base-v2 6 | 7 | <<<<<<< HEAD 8 | CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python search_r1/search/index_builder.py \ 9 | ======= 10 | # change faiss_type to HNSW32/64/128 for ANN indexing 11 | # change retriever_name to bm25 for BM25 indexing 12 | CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python index_builder.py \ 13 | >>>>>>> 573ed7e86a4143bb13d69752c3a0745cd184bc54 14 | --retrieval_method $retriever_name \ 15 | --model_path $retriever_model \ 16 | --corpus_path $corpus_file \ 17 | --save_dir $save_dir \ 18 | --use_fp16 \ 19 | --max_length 256 \ 20 | --batch_size 512 \ 21 | --pooling_method mean \ 22 | --faiss_type Flat \ 23 | --save_embedding 24 | -------------------------------------------------------------------------------- /LLaMA-Factory/examples/accelerate/fsdp_config.yaml: -------------------------------------------------------------------------------- 1 | compute_environment: LOCAL_MACHINE 2 | debug: false 3 | distributed_type: FSDP 4 | downcast_bf16: 'no' 5 | fsdp_config: 6 | fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP 7 | fsdp_backward_prefetch: BACKWARD_PRE 8 | fsdp_forward_prefetch: false 9 | fsdp_cpu_ram_efficient_loading: true 10 | fsdp_offload_params: false 11 | fsdp_sharding_strategy: FULL_SHARD 12 | fsdp_state_dict_type: FULL_STATE_DICT 13 | fsdp_sync_module_states: true 14 | fsdp_use_orig_params: true 15 | machine_rank: 0 16 | main_training_function: main 17 | mixed_precision: bf16 # or fp16 18 | num_machines: 1 # the number of nodes 19 | num_processes: 2 # the number of GPUs in all nodes 20 | rdzv_backend: static 21 | same_network: true 22 | tpu_env: [] 23 | tpu_use_cluster: false 24 | tpu_use_sudo: false 25 | use_cpu: false 26 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/llamafactory/launcher.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 the LlamaFactory team. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from llamafactory.train.tuner import run_exp # use absolute import 16 | 17 | 18 | def launch(): 19 | run_exp() 20 | 21 | 22 | if __name__ == "__main__": 23 | launch() 24 | -------------------------------------------------------------------------------- /LLaMA-Factory/.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v5.0.0 4 | hooks: 5 | - id: check-ast 6 | - id: check-added-large-files 7 | args: ['--maxkb=25000'] 8 | - id: check-merge-conflict 9 | - id: check-yaml 10 | - id: debug-statements 11 | - id: end-of-file-fixer 12 | - id: trailing-whitespace 13 | args: [--markdown-linebreak-ext=md] 14 | - id: no-commit-to-branch 15 | args: ['--branch', 'main'] 16 | 17 | - repo: https://github.com/asottile/pyupgrade 18 | rev: v3.17.0 19 | hooks: 20 | - id: pyupgrade 21 | args: [--py38-plus] 22 | 23 | - repo: https://github.com/astral-sh/ruff-pre-commit 24 | rev: v0.6.9 25 | hooks: 26 | - id: ruff 27 | args: [--fix] 28 | - id: ruff-format 29 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/workers/rollout/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .base import BaseRollout 16 | from .naive import NaiveRollout 17 | from .hf_rollout import HFRollout 18 | 19 | __all__ = ["BaseRollout", "NaiveRollout", "HFRollout"] 20 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/single_controller/ray/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .base import RayResourcePool, RayClassWithInitArgs, RayWorkerGroup, create_colocated_worker_cls 16 | from .megatron import (MegatronRayWorkerGroup, DistRankInfo, DistGlobalInfo) -------------------------------------------------------------------------------- /api/visual_tools/configs.yaml: -------------------------------------------------------------------------------- 1 | 2 | egolife: 3 | videollm: 4 | gemini_api_keys: ["your-gemini-api-key-1", "your-gemini-api-key-2","..."] 5 | data_dir: "/path/to/egolife" 6 | gemini_port: 8060 7 | llava_port: 8010 8 | vlm: 9 | data_dir: "/path/to/egolife" 10 | vlm_port: 8080 11 | 12 | videomme: 13 | videollm: 14 | gemini_api_keys: ["your-gemini-api-key-1", "your-gemini-api-key-2","..."] 15 | data_dir: "/path/to/videomme" 16 | gemini_port: 7060 17 | llava_port: 7010 18 | vlm: 19 | data_dir: "/path/to/videomme" 20 | vlm_port: 7080 21 | 22 | egoschema: 23 | videollm: 24 | gemini_api_keys: ["your-gemini-api-key-1", "your-gemini-api-key-2","..."] 25 | data_dir: "/path/to/egoschema" 26 | gemini_port: 6060 27 | llava_port: 6010 28 | vlm: 29 | data_dir: "/path/to/egoschema" 30 | vlm_port: 6080 31 | 32 | 33 | -------------------------------------------------------------------------------- /LLaMA-Factory/.env.local: -------------------------------------------------------------------------------- 1 | # Note: actually we do not support .env, just for reference 2 | # api 3 | API_HOST= 4 | API_PORT= 5 | API_KEY= 6 | API_MODEL_NAME= 7 | API_VERBOSE= 8 | FASTAPI_ROOT_PATH= 9 | MAX_CONCURRENT= 10 | # general 11 | DISABLE_VERSION_CHECK= 12 | FORCE_CHECK_IMPORTS= 13 | ALLOW_EXTRA_ARGS= 14 | LLAMAFACTORY_VERBOSITY= 15 | USE_MODELSCOPE_HUB= 16 | USE_OPENMIND_HUB= 17 | USE_RAY= 18 | RECORD_VRAM= 19 | OPTIM_TORCH= 20 | NPU_JIT_COMPILE= 21 | # torchrun 22 | FORCE_TORCHRUN= 23 | MASTER_ADDR= 24 | MASTER_PORT= 25 | NNODES= 26 | NODE_RANK= 27 | NPROC_PER_NODE= 28 | # wandb 29 | WANDB_DISABLED= 30 | WANDB_PROJECT= 31 | WANDB_API_KEY= 32 | # gradio ui 33 | GRADIO_SHARE= 34 | GRADIO_SERVER_NAME= 35 | GRADIO_SERVER_PORT= 36 | GRADIO_ROOT_PATH= 37 | GRADIO_IPV6= 38 | # setup 39 | ENABLE_SHORT_CONSOLE= 40 | # reserved (do not use) 41 | LLAMABOARD_ENABLED= 42 | LLAMABOARD_WORKDIR= 43 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/utils/dataset/README.md: -------------------------------------------------------------------------------- 1 | # Dataset Format 2 | ## RLHF dataset 3 | We combine all the data sources into a single parquet files. We directly organize the prompt into the chat format so that multi-turn chats can be easily incorporated. In the prompt, we may add instruction following texts to guide the model output the answers in a particular format so that we can extract the answers. 4 | 5 | Math problems 6 | ```json 7 | { 8 | "data_source": "openai/gsm8k", 9 | "prompt": [{"role": "user", "content": "Natalia sold clips to 48 of her friends in April, and then she sold half as many clips in May. How many clips did Natalia sell altogether in April and May? Let's think step by step and output the final answer after \"####\""}], 10 | "ability": "math", 11 | "reward_model": { 12 | "style": "rule", 13 | "ground_truth": ["72"] 14 | }, 15 | } 16 | ``` 17 | -------------------------------------------------------------------------------- /LLaMA-Factory/examples/accelerate/fsdp_config_offload.yaml: -------------------------------------------------------------------------------- 1 | compute_environment: LOCAL_MACHINE 2 | debug: false 3 | distributed_type: FSDP 4 | downcast_bf16: 'no' 5 | fsdp_config: 6 | fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP 7 | fsdp_backward_prefetch: BACKWARD_PRE 8 | fsdp_forward_prefetch: false 9 | fsdp_cpu_ram_efficient_loading: true 10 | fsdp_offload_params: true # offload may affect training speed 11 | fsdp_sharding_strategy: FULL_SHARD 12 | fsdp_state_dict_type: FULL_STATE_DICT 13 | fsdp_sync_module_states: true 14 | fsdp_use_orig_params: true 15 | machine_rank: 0 16 | main_training_function: main 17 | mixed_precision: bf16 # or fp16 18 | num_machines: 1 # the number of nodes 19 | num_processes: 2 # the number of GPUs in all nodes 20 | rdzv_backend: static 21 | same_network: true 22 | tpu_env: [] 23 | tpu_use_cluster: false 24 | tpu_use_sudo: false 25 | use_cpu: false 26 | -------------------------------------------------------------------------------- /LLaMA-Factory/src/train.py: -------------------------------------------------------------------------------- 1 | # Copyright 2025 the LlamaFactory team. 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from llamafactory.train.tuner import run_exp 16 | 17 | 18 | def main(): 19 | run_exp() 20 | 21 | 22 | def _mp_fn(index): 23 | # For xla_spawn (TPUs) 24 | run_exp() 25 | 26 | 27 | if __name__ == "__main__": 28 | main() 29 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/single_controller/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | version_folder = os.path.dirname(os.path.join(os.path.abspath(__file__))) 18 | 19 | with open(os.path.join(version_folder, 'version/version')) as f: 20 | __version__ = f.read().strip() 21 | -------------------------------------------------------------------------------- /LLaMA-Factory/examples/extras/nlg_eval/llama3_lora_predict.yaml: -------------------------------------------------------------------------------- 1 | # The batch generation can be SLOW using this config. 2 | # For faster inference, we recommend to use `scripts/vllm_infer.py`. 3 | 4 | ### model 5 | model_name_or_path: meta-llama/Meta-Llama-3-8B-Instruct 6 | adapter_name_or_path: saves/llama3-8b/lora/sft 7 | trust_remote_code: true 8 | 9 | ### method 10 | stage: sft 11 | do_predict: true 12 | finetuning_type: lora 13 | 14 | ### dataset 15 | eval_dataset: identity,alpaca_en_demo 16 | template: llama3 17 | cutoff_len: 2048 18 | max_samples: 50 19 | overwrite_cache: true 20 | preprocessing_num_workers: 16 21 | dataloader_num_workers: 4 22 | 23 | ### output 24 | output_dir: saves/llama3-8b/lora/predict 25 | overwrite_output_dir: true 26 | report_to: none # choices: [none, wandb, tensorboard, swanlab, mlflow] 27 | 28 | ### eval 29 | per_device_eval_batch_size: 1 30 | predict_with_generate: true 31 | ddp_timeout: 180000000 32 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/models/llama/megatron/layers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from .parallel_attention import ParallelLlamaAttention 16 | from .parallel_decoder import ParallelLlamaDecoderLayer, ParallelLlamaDecoderLayerRmPad 17 | from .parallel_mlp import ParallelLlamaMLP 18 | from .parallel_rmsnorm import ParallelLlamaRMSNorm 19 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/utils/config.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | from typing import Dict 16 | 17 | from omegaconf import DictConfig 18 | 19 | 20 | def update_dict_with_config(dictionary: Dict, config: DictConfig): 21 | for key in dictionary: 22 | if hasattr(config, key): 23 | dictionary[key] = getattr(config, key) 24 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/trainer/config/generation.yaml: -------------------------------------------------------------------------------- 1 | trainer: 2 | nnodes: 1 3 | n_gpus_per_node: 8 4 | 5 | data: 6 | path: ~/data/rlhf/math/test.parquet 7 | prompt_key: prompt 8 | n_samples: 5 9 | output_path: /opt/tiger/math_Qwen2-7B-Instruct.parquet 10 | batch_size: 128 11 | 12 | model: 13 | path: ~/models/Qwen2-7B-Instruct 14 | external_lib: null 15 | rollout: 16 | name: vllm 17 | temperature: 1.0 18 | top_k: 50 # 0 for hf rollout, -1 for vllm rollout 19 | top_p: 0.7 20 | prompt_length: 1536 21 | response_length: 512 22 | # for vllm rollout 23 | dtype: bfloat16 # should align with FSDP 24 | gpu_memory_utilization: 0.5 25 | ignore_eos: False 26 | micro_batch_size: 256 27 | enforce_eager: True 28 | free_cache_engine: True 29 | load_format: dummy_dtensor 30 | tensor_model_parallel_size: 1 31 | max_num_batched_tokens: 8192 32 | max_num_seqs: 1024 33 | log_prob_micro_batch_size: 8 34 | # for hf rollout 35 | do_sample: True -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/utils/logging_utils.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import logging 16 | 17 | 18 | def set_basic_config(level): 19 | """ 20 | This function sets the global logging format and level. It will be called when import verl 21 | """ 22 | logging.basicConfig(format='%(levelname)s:%(asctime)s:%(message)s', level=level) 23 | -------------------------------------------------------------------------------- /LLaMA-Factory/.github/workflows/label_issue.yml: -------------------------------------------------------------------------------- 1 | name: label_issue 2 | 3 | on: 4 | issues: 5 | types: 6 | - opened 7 | 8 | jobs: 9 | label_issue: 10 | runs-on: ubuntu-latest 11 | 12 | permissions: 13 | issues: write 14 | 15 | steps: 16 | - env: 17 | GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} 18 | ISSUE_URL: ${{ github.event.issue.html_url }} 19 | ISSUE_TITLE: ${{ github.event.issue.title }} 20 | run: | 21 | LABEL="" 22 | NPU_KEYWORDS=(npu huawei ascend 华为 昇腾) 23 | ISSUE_TITLE_LOWER=$(echo $ISSUE_TITLE | tr '[:upper:]' '[:lower:]') 24 | for KEYWORD in ${NPU_KEYWORDS[@]}; do 25 | if [[ $ISSUE_TITLE_LOWER == *$KEYWORD* ]] && [[ $ISSUE_TITLE_LOWER != *input* ]]; then 26 | LABEL="npu" 27 | break 28 | fi 29 | done 30 | if [ -n "$LABEL" ]; then 31 | gh issue edit $ISSUE_URL --add-label $LABEL 32 | fi 33 | -------------------------------------------------------------------------------- /Ego-R1-Agent/ego_r1/search/retrieval.sh: -------------------------------------------------------------------------------- 1 | 2 | DATA_NAME=nq 3 | 4 | DATASET_PATH="/home/peterjin/mnt/data/$DATA_NAME" 5 | 6 | SPLIT='test' 7 | TOPK=3 8 | 9 | INDEX_PATH=/home/peterjin/mnt/index/wiki-18 10 | CORPUS_PATH=/home/peterjin/mnt/data/retrieval-corpus/wiki-18.jsonl 11 | SAVE_NAME=e5_${TOPK}_wiki18.json 12 | 13 | # INDEX_PATH=/home/peterjin/rm_retrieval_corpus/index/wiki-21 14 | # CORPUS_PATH=/home/peterjin/rm_retrieval_corpus/corpora/wiki/enwiki-dec2021/text-list-100-sec.jsonl 15 | # SAVE_NAME=e5_${TOPK}_wiki21.json 16 | 17 | CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python retrieval.py --retrieval_method e5 \ 18 | --retrieval_topk $TOPK \ 19 | --index_path $INDEX_PATH \ 20 | --corpus_path $CORPUS_PATH \ 21 | --dataset_path $DATASET_PATH \ 22 | --data_split $SPLIT \ 23 | --retrieval_model_path "intfloat/e5-base-v2" \ 24 | --retrieval_pooling_method "mean" \ 25 | --retrieval_batch_size 512 \ 26 | -------------------------------------------------------------------------------- /Ego-R1-Agent/verl/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright 2024 Bytedance Ltd. and/or its affiliates 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | import os 16 | 17 | version_folder = os.path.dirname(os.path.join(os.path.abspath(__file__))) 18 | 19 | with open(os.path.join(version_folder, 'version/version')) as f: 20 | __version__ = f.read().strip() 21 | 22 | from .protocol import DataProto 23 | 24 | from .utils.logging_utils import set_basic_config 25 | import logging 26 | 27 | set_basic_config(level=logging.WARNING) 28 | -------------------------------------------------------------------------------- /LLaMA-Factory/data/mllm_video_demo.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "messages": [ 4 | { 5 | "content": "