Use PEFT or Full-parameter to CPT/SFT/DPO/GRPO 600+ LLMs (Qwen3.6, DeepSeek-V4, GLM-5.1, InternLM3, Llama4, ...) and 300+ MLLMs (Qwen3-VL, Qwen3-Omni, InternVL3.5, Ovis2.5, GLM4.5v, Gemma4, Llava, Phi4, ...) (AAAI 2025).
1935 matches across 17 categories. Click a row to expand file-level details.
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | setup.py | 7 | |
| LOW | tests/llm/test_template.py | 49 | |
| LOW | tests/models/test_mllm.py | 7 | |
| LOW | tests/models/test_mllm.py | 7 | |
| LOW | tests/train/test_resume_from_checkpoint.py | 29 | |
| LOW | tests/train/test_resume_from_checkpoint.py | 29 | |
| LOW | tests/train/test_freeze.py | 17 | |
| LOW | tests/train/test_freeze.py | 17 | |
| LOW | tests/train/test_freeze.py | 34 | |
| LOW | tests/train/test_freeze.py | 34 | |
| LOW | tests/train/test_freeze.py | 51 | |
| LOW | tests/train/test_freeze.py | 51 | |
| LOW | tests/train/test_freeze.py | 68 | |
| LOW | tests/train/test_freeze.py | 68 | |
| LOW | tests/test_align/test_padding_side.py | 50 | |
| LOW | tests/hub/test_check_model.py | 17 | |
| LOW | swift/__init__.py | 7 | |
| LOW | swift/__init__.py | 7 | |
| LOW | swift/__init__.py | 8 | |
| LOW | swift/__init__.py | 8 | |
| LOW | swift/__init__.py | 8 | |
| LOW | swift/__init__.py | 8 | |
| LOW | swift/__init__.py | 8 | |
| LOW | swift/__init__.py | 8 | |
| LOW | swift/__init__.py | 8 | |
| LOW | swift/__init__.py | 8 | |
| LOW | swift/__init__.py | 8 | |
| LOW | swift/__init__.py | 8 | |
| LOW | swift/__init__.py | 8 | |
| LOW | swift/__init__.py | 11 | |
| LOW | swift/__init__.py | 11 | |
| LOW | swift/__init__.py | 12 | |
| LOW | swift/__init__.py | 12 | |
| LOW | swift/__init__.py | 13 | |
| LOW | swift/__init__.py | 13 | |
| LOW | swift/__init__.py | 13 | |
| LOW | swift/__init__.py | 13 | |
| LOW | swift/__init__.py | 13 | |
| LOW | swift/__init__.py | 13 | |
| LOW | swift/__init__.py | 13 | |
| LOW | swift/__init__.py | 13 | |
| LOW | swift/__init__.py | 13 | |
| LOW | swift/__init__.py | 13 | |
| LOW | swift/__init__.py | 15 | |
| LOW | swift/__init__.py | 15 | |
| LOW | swift/__init__.py | 16 | |
| LOW | swift/__init__.py | 16 | |
| LOW | swift/__init__.py | 16 | |
| LOW | swift/__init__.py | 16 | |
| LOW | swift/__init__.py | 16 | |
| LOW | swift/__init__.py | 17 | |
| LOW | swift/__init__.py | 17 | |
| LOW | swift/__init__.py | 17 | |
| LOW | swift/__init__.py | 18 | |
| LOW | swift/__init__.py | 18 | |
| LOW | swift/__init__.py | 19 | |
| LOW | swift/__init__.py | 19 | |
| LOW | swift/__init__.py | 20 | |
| LOW | swift/__init__.py | 20 | |
| LOW | swift/__init__.py | 20 | |
| 817 more matches not shown… | |||
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | tests/test_utils.py | 74 | def create_dummy_test_dataset(feat, label, num): |
| LOW | tests/run.py | 77 | def gather_test_suites_in_files(test_dir, case_file_list, list_tests): |
| LOW | tests/run.py | 132 | def async_run_command_with_popen(cmd, device_id): |
| LOW | tests/run.py | 315 | def run_non_parallelizable_test_suites(suites, result_dir): |
| LOW | tests/utils/test_async_rewards.py | 17 | def test_start_and_shutdown_event_loop_in_daemon(self): |
| LOW | tests/utils/test_async_rewards.py | 38 | def test_run_async_function_in_daemon_loop(self): |
| LOW | tests/utils/test_async_rewards.py | 57 | def test_async_orm_base_class(self): |
| LOW | tests/utils/test_async_rewards.py | 80 | def test_async_reward_is_detected(self): |
| LOW | tests/utils/test_async_rewards.py | 106 | def test_parallel_async_execution(self): |
| LOW | tests/utils/test_async_rewards.py | 153 | def test_async_reward_function_batch_performance(self): |
| LOW | tests/utils/test_rewards.py | 38 | def test_multiple_steps_with_boxed(self): |
| LOW | tests/utils/test_rewards.py | 62 | def test_batch_processing_no_tag(self): |
| LOW | tests/utils/test_rewards.py | 73 | def test_answer_tag_with_plain_number(self): |
| LOW | tests/utils/test_rewards.py | 82 | def test_answer_tag_with_latex(self): |
| LOW | tests/utils/test_rewards.py | 91 | def test_long_text_with_answer_tag(self): |
| LOW | tests/utils/test_rewards.py | 106 | def test_answer_tag_with_complex_expression(self): |
| LOW | tests/utils/test_rewards.py | 115 | def test_solution_with_answer_tag(self): |
| LOW | tests/utils/test_rewards.py | 124 | def test_answer_tag_wrong_answer(self): |
| LOW | tests/utils/test_rewards.py | 133 | def test_mixed_batch_with_and_without_tags(self): |
| LOW | tests/utils/test_rewards.py | 170 | def test_answer_tag_with_extra_whitespace(self): |
| LOW | tests/utils/test_rewards.py | 179 | def test_multiple_answer_tags(self): |
| LOW | tests/utils/test_rewards.py | 188 | def test_real_world_example_from_user(self): |
| LOW | tests/utils/test_rewards.py | 212 | def test_equivalent_fractions(self): |
| LOW | tests/utils/test_rewards.py | 221 | def test_different_forms_same_answer(self): |
| LOW | tests/utils/test_rewards.py | 230 | def test_latex_inline_math_delimiters(self): |
| LOW | tests/utils/test_rewards.py | 240 | def test_latex_display_math_delimiters(self): |
| LOW | tests/utils/test_rewards.py | 249 | def test_mixed_latex_delimiters(self): |
| LOW | tests/tuners/test_swift_device_map.py | 25 | def test_swift_multiple_adapters(self): |
| LOW | tests/tuners/test_swift_base.py | 73 | def test_swift_adapter_forward(self): |
| LOW | tests/tuners/test_swift_base.py | 93 | def test_swift_prompt_forward(self): |
| LOW | tests/tuners/test_swift_base.py | 110 | def test_swift_restuner_forward(self): |
| LOW | tests/tuners/test_swift_base.py | 133 | def lora_injection_with_dtype(self, dtype=torch.float32): |
| LOW | tests/tuners/test_swift_base.py | 185 | def test_swift_lora_injection(self): |
| LOW | tests/tuners/test_swift_base.py | 257 | def test_swift_multiple_adapters(self): |
| LOW | tests/tuners/test_swift_base.py | 382 | def test_swift_multiple_adapters_switching(self): |
| LOW | tests/tuners/test_peft.py | 120 | def test_peft_adalora_injection(self): |
| LOW | tests/tuners/test_extra_state_dict.py | 26 | def test_swift_extra_state_dict(self): |
| LOW | tests/tuners/test_extra_state_dict.py | 42 | def test_swift_modules_to_save(self): |
| LOW | tests/tuners/test_swift_restuning.py | 95 | def test_swift_restuning_diffusers_sd(self): |
| LOW | tests/tuners/test_scetuning.py | 64 | def test_scetuning_part_mixin(self): |
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 32 | def _compute_sequence_level_ratios(self, is_ratio: torch.Tensor, completion_mask: torch.Tensor) -> torch.Tensor: |
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 49 | def _apply_rollout_importance_sampling(self, rollout_log_ratio: torch.Tensor, |
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 99 | def _compute_is_correction_metrics( |
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 166 | def test_token_truncate_basic(self): |
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 199 | def test_sequence_truncate_basic(self): |
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 237 | def test_threshold_sensitivity(self): |
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 345 | def test_clipped_frac_token_truncate(self): |
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 359 | def test_clipped_frac_token_mask(self): |
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 373 | def test_clipped_frac_sequence_level(self): |
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 391 | def test_kl_divergence_same_policy(self): |
| LOW | tests/train/test_resume_from_checkpoint.py | 28 | def test_resume_from_checkpoint(): |
| LOW | tests/train/test_sft.py | 162 | def test_mllm_streaming_mp_ddp(): |
| LOW | tests/train/test_sft.py | 215 | def test_resume_from_checkpoint(): |
| LOW | tests/train/test_sft.py | 275 | def test_predict_with_generate(): |
| LOW | tests/train/test_export_cached_dataset.py | 1 | def test_export_cached_dataset(): |
| LOW | tests/test_align/test_template/test_vision.py | 1063 | def _infer_ernie_vl_thinking_hf(model, processor, messages): |
| LOW | tests/test_align/test_template/test_gene.py | 7 | def test_deepseek_janus_pro_gene(): |
| LOW | docs/source/BestPractices/MLLM-Registration.md | 218 | def _get_new_tokens_use_audio_in_video(self, i, *, video_grid_thw, video_second_per_grid, audio_lengths, |
| LOW | docs/source_en/BestPractices/MLLM-Registration.md | 221 | def _get_new_tokens_use_audio_in_video(self, i, *, video_grid_thw, video_second_per_grid, audio_lengths, |
| LOW | swift/metrics/reranker.py | 111 | def calculate_ndcg_single_query(relevance_scores, ranking): |
| 302 more matches not shown… | |||
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | setup.py | 24 | |
| LOW | setup.py | 44 | |
| LOW | setup.py | 78 | |
| LOW | setup.py | 96 | |
| LOW | tests/test_utils.py | 124 | |
| LOW | tests/run.py | 33 | |
| LOW | tests/run.py | 77 | |
| LOW | tests/run.py | 185 | |
| LOW | tests/run.py | 204 | |
| LOW | tests/run.py | 341 | |
| LOW | tests/run.py | 454 | |
| LOW | tests/general/test_arch.py | 1 | |
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 49 | |
| LOW | swift/ui/base.py | 268 | |
| LOW | swift/ui/base.py | 314 | |
| LOW | swift/ui/llm_export/llm_export.py | 101 | |
| LOW | swift/ui/llm_grpo/llm_grpo.py | 216 | |
| LOW | swift/ui/llm_grpo/external_rollout.py | 145 | |
| LOW | swift/ui/llm_grpo/tuner.py | 18 | |
| LOW | swift/ui/llm_rlhf/llm_rlhf.py | 232 | |
| LOW | swift/ui/llm_rlhf/tuner.py | 18 | |
| LOW | swift/ui/llm_sample/llm_sample.py | 166 | |
| LOW | swift/ui/llm_eval/llm_eval.py | 104 | |
| LOW | swift/ui/llm_infer/runtime.py | 133 | |
| LOW | swift/ui/llm_infer/runtime.py | 265 | |
| LOW | swift/ui/llm_infer/llm_infer.py | 124 | |
| LOW | swift/ui/llm_infer/llm_infer.py | 189 | |
| LOW | swift/ui/llm_train/task.py | 64 | |
| LOW | swift/ui/llm_train/runtime.py | 295 | |
| LOW | swift/ui/llm_train/runtime.py | 374 | |
| LOW | swift/ui/llm_train/runtime.py | 407 | |
| LOW | swift/ui/llm_train/runtime.py | 542 | |
| LOW | swift/ui/llm_train/runtime.py | 600 | |
| LOW | swift/ui/llm_train/llm_train.py | 242 | |
| LOW | swift/ui/llm_train/llm_train.py | 325 | |
| LOW | swift/ui/llm_train/llm_train.py | 551 | |
| LOW | swift/ui/llm_train/optimizer.py | 121 | |
| LOW | swift/ui/llm_train/tuner.py | 290 | |
| LOW | swift/loss/embedding.py | 88 | |
| LOW | swift/loss/embedding.py | 115 | |
| LOW | swift/callbacks/activation_cpu_offload.py | 330 | |
| LOW | swift/callbacks/activation_cpu_offload.py | 597 | |
| LOW | swift/dataset/dataset_meta.py | 120 | |
| LOW | swift/dataset/packing.py | 32 | |
| LOW | swift/dataset/loader.py | 70 | |
| LOW | swift/dataset/dataset/mllm.py | 567 | |
| LOW | swift/dataset/dataset/mllm.py | 239 | |
| LOW | swift/dataset/dataset/mllm.py | 715 | |
| LOW | swift/dataset/dataset/mllm.py | 791 | |
| LOW | swift/dataset/dataset/mllm.py | 952 | |
| LOW | swift/dataset/dataset/mllm.py | 1233 | |
| LOW | swift/dataset/dataset/llm.py | 764 | |
| LOW | swift/dataset/preprocessor/core.py | 170 | |
| LOW | swift/dataset/preprocessor/core.py | 491 | |
| LOW | swift/rewards/orm.py | 238 | |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 194 | |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 334 | |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 471 | |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 703 | |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 757 | |
| 266 more matches not shown… | |||
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | tests/run.py | 349 | except Exception: |
| LOW | tests/model_tag.py | 66 | except Exception as e: |
| LOW | tests/model_tag.py | 94 | except Exception as e: |
| LOW | tests/model_tag.py | 115 | except Exception as e: |
| LOW | tests/model_tag.py | 131 | except Exception as e: |
| MEDIUM | tests/model_tag.py | 53 | def _post_request(self, url, param): |
| MEDIUM | tests/model_tag.py | 72 | def batch_commit_result(self): |
| MEDIUM | tests/model_tag.py | 100 | def batch_refresh_stage(self): |
| MEDIUM | tests/model_tag.py | 121 | def query_model_stage(self): |
| LOW | tests/general/test_arch.py | 18 | except Exception: |
| LOW | tests/deploy/test_dataset.py | 12 | except Exception: |
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 477 | except Exception as e: |
| LOW | docs/source/BestPractices/GRPO.md | 78 | except Exception as e: |
| LOW | docs/source/BestPractices/GRPO-Multi-Modal-Training.md | 79 | except Exception: |
| LOW | docs/source/BestPractices/GRPO-Multi-Modal-Training.md | 96 | except Exception: |
| LOW | …source/Instruction/GRPO/DeveloperGuide/reward_model.md | 118 | except Exception as e: |
| LOW | docs/source_en/BestPractices/GRPO.md | 82 | except Exception as e: |
| LOW | …s/source_en/BestPractices/GRPO-Multi-Modal-Training.md | 85 | except Exception: |
| LOW | …s/source_en/BestPractices/GRPO-Multi-Modal-Training.md | 102 | except Exception: |
| LOW | …rce_en/Instruction/GRPO/DeveloperGuide/reward_model.md | 117 | except Exception as e: |
| LOW | swift/ui/base.py | 347 | except Exception as e: |
| LOW | swift/ui/base.py | 368 | except Exception: |
| LOW | swift/ui/llm_grpo/external_runtime.py | 135 | except Exception as e: |
| LOW | swift/ui/llm_eval/eval.py | 103 | except Exception as e: |
| LOW | swift/ui/llm_infer/runtime.py | 259 | except Exception as e: |
| LOW | swift/ui/llm_train/runtime.py | 590 | except Exception as e: |
| LOW | swift/ui/llm_train/llm_train.py | 406 | except Exception as e: |
| LOW | swift/ui/llm_train/llm_train.py | 530 | except Exception as err: |
| LOW | swift/dataset/utils.py | 95 | except Exception as e: |
| LOW | swift/dataset/packing.py | 151 | except Exception as e: |
| LOW | swift/dataset/loader.py | 116 | except Exception as e: |
| LOW | swift/dataset/dataset/mllm.py | 796 | except Exception: |
| LOW | swift/dataset/preprocessor/core.py | 192 | except Exception as e: |
| LOW | swift/rewards/prm.py | 90 | except Exception: |
| LOW | swift/rewards/prm.py | 148 | except Exception: |
| LOW | swift/rewards/orm.py | 114 | except Exception: |
| LOW | swift/rewards/orm.py | 251 | except Exception: |
| LOW | swift/rewards/orm.py | 258 | except Exception: |
| LOW | swift/rewards/orm.py | 300 | except Exception: |
| LOW | swift/rewards/orm.py | 374 | except Exception: |
| LOW | swift/rewards/orm.py | 419 | except Exception: |
| LOW | swift/rewards/rm_plugin.py | 224 | except Exception as e: |
| MEDIUM | swift/rlhf_trainers/rollout_mixin.py | 1563 | def infer_task(): |
| MEDIUM | swift/rlhf_trainers/rollout_mixin.py | 1573 | def done(future): |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 1567 | except Exception as e: |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 1577 | except Exception as e: |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 1760 | except Exception as e: |
| LOW | swift/rlhf_trainers/reward_trainer.py | 102 | except Exception as e: |
| LOW | swift/rlhf_trainers/gkd_trainer.py | 1221 | except Exception: |
| LOW | swift/rlhf_trainers/gkd_trainer.py | 1273 | except Exception as e: |
| MEDIUM | swift/rlhf_trainers/gkd_trainer.py | 1230 | def _fetch_one(idx): |
| LOW | swift/rlhf_trainers/utils.py | 1012 | except Exception as e: # noqa: BLE001 |
| LOW | swift/rlhf_trainers/utils.py | 1099 | except Exception as e: |
| LOW | swift/rlhf_trainers/vllm_client.py | 98 | except Exception: |
| LOW | swift/rlhf_trainers/vllm_client.py | 172 | except Exception as e: |
| LOW | swift/rlhf_trainers/vllm_client.py | 244 | except Exception as e: |
| LOW | swift/rlhf_trainers/vllm_client.py | 292 | except Exception as e: |
| LOW | swift/rlhf_trainers/vllm_client.py | 354 | except Exception as e: |
| LOW | swift/rlhf_trainers/vllm_client.py | 397 | except Exception as e: |
| LOW | swift/rlhf_trainers/vllm_client.py | 421 | except Exception as e: |
| 111 more matches not shown… | |||
| Severity | File | Line | Snippet |
|---|---|---|---|
| HIGH | docs/source/BestPractices/GRPO.md | 0 | evaluates completions based on mathematical correctness of the answer args: completions (list[str]): generated outputs t |
| HIGH | docs/source_en/BestPractices/GRPO.md | 0 | evaluates completions based on mathematical correctness of the answer args: completions (list[str]): generated outputs t |
| HIGH | examples/train/grpo/plugin/plugin.py | 0 | evaluates completions based on mathematical correctness of the answer args: completions (list[str]): generated outputs t |
| HIGH | docs/source/BestPractices/GRPO-Multi-Modal-Training.md | 0 | reward function that checks if the completion is correct. args: completions (list[str]): generated outputs solution (lis |
| HIGH | …s/source_en/BestPractices/GRPO-Multi-Modal-Training.md | 0 | reward function that checks if the completion is correct. args: completions (list[str]): generated outputs solution (lis |
| HIGH | examples/train/grpo/plugin/plugin.py | 0 | reward function that checks if the completion is correct. args: completions (list[str]): generated outputs solution (lis |
| HIGH | docs/source/BestPractices/AMD-support.md | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. |
| HIGH | docs/source/BestPractices/Qwen3_5-Best-Practice.md | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. |
| HIGH | docs/source/BestPractices/Qwen3_5-Best-Practice.md | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. |
| HIGH | docs/source_en/BestPractices/AMD-support.md | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. |
| HIGH | docs/source_en/BestPractices/Qwen3_5-Best-Practice.md | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. |
| HIGH | docs/source_en/BestPractices/Qwen3_5-Best-Practice.md | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. |
| HIGH | examples/models/qwen3_5/mcore_grpo_moe.sh | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. |
| HIGH | examples/train/grpo/plugin/gsm8k/gsm8k.sh | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. |
| HIGH | examples/train/grpo/internal/fipo.sh | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. |
| HIGH | examples/train/grpo/internal/real.sh | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. |
| HIGH | examples/megatron/grpo/real.sh | 0 | you are a helpful math assistant. solve the problem step by step and put your final answer within \\boxed{}. |
| HIGH | docs/source/Instruction/GRPO/DeveloperGuide/gym_env.md | 0 | rolloutinferrequest( messages=[ {'role': 'system', 'content': 'a conversation between user and assistant. the user asks |
| HIGH | …s/source/Instruction/GRPO/DeveloperGuide/multi_turn.md | 0 | rolloutinferrequest( messages=[ {'role': 'system', 'content': 'a conversation between user and assistant. the user asks |
| HIGH | …s/source_en/Instruction/GRPO/DeveloperGuide/gym_env.md | 0 | rolloutinferrequest( messages=[ {'role': 'system', 'content': 'a conversation between user and assistant. the user asks |
| HIGH | …ource_en/Instruction/GRPO/DeveloperGuide/multi_turn.md | 0 | rolloutinferrequest( messages=[ {'role': 'system', 'content': 'a conversation between user and assistant. the user asks |
| Severity | File | Line | Snippet |
|---|---|---|---|
| MEDIUM | swift/rlhf_trainers/utils.py | 1588 | # ============================================================================ |
| MEDIUM | swift/rlhf_trainers/utils.py | 1590 | # ============================================================================ |
| MEDIUM | swift/rlhf_trainers/grpo_trainer.py | 493 | # -------------------------------------------------- |
| MEDIUM | swift/rlhf_trainers/grpo_trainer.py | 495 | # -------------------------------------------------- |
| MEDIUM | swift/rlhf_trainers/grpo_trainer.py | 579 | # -------------------------------------------------- |
| MEDIUM | swift/rlhf_trainers/grpo_trainer.py | 581 | # -------------------------------------------------- |
| MEDIUM | swift/pipelines/infer/rollout.py | 308 | # ------------------------------------------------------------------ |
| MEDIUM | swift/pipelines/infer/rollout.py | 310 | # ------------------------------------------------------------------ |
| MEDIUM | swift/pipelines/infer/rollout.py | 433 | # ── Step 1: receive + rebuild IPC handle (with reuse) ──────── |
| MEDIUM | swift/pipelines/infer/rollout.py | 471 | # ── Step 2: stream buckets and load_weights per bucket ────── |
| MEDIUM | swift/model/npu_patch/model.py | 18 | # --------------------------------------------------------------------------- |
| MEDIUM | swift/model/npu_patch/model.py | 20 | # --------------------------------------------------------------------------- |
| MEDIUM | swift/model/npu_patch/model.py | 177 | # --------------------------------------------------------------------------- |
| MEDIUM | swift/model/npu_patch/model.py | 179 | # --------------------------------------------------------------------------- |
| MEDIUM | swift/model/npu_patch/model.py | 209 | # --------------------------------------------------------------------------- |
| MEDIUM | swift/model/npu_patch/model.py | 211 | # --------------------------------------------------------------------------- |
| MEDIUM | swift/model/npu_patch/model.py | 293 | # --------------------------------------------------------------------------- |
| MEDIUM | swift/model/npu_patch/model.py | 295 | # --------------------------------------------------------------------------- |
| MEDIUM | swift/model/npu_patch/model.py | 383 | # --------------------------------------------------------------------------- |
| MEDIUM | swift/model/npu_patch/model.py | 385 | # --------------------------------------------------------------------------- |
| MEDIUM | swift/model/npu_patch/model.py | 429 | # --------------------------------------------------------------------------- |
| MEDIUM | swift/model/npu_patch/model.py | 431 | # --------------------------------------------------------------------------- |
| MEDIUM | swift/model/npu_patch/model.py | 483 | # --------------------------------------------------------------------------- |
| MEDIUM | swift/model/npu_patch/model.py | 485 | # --------------------------------------------------------------------------- |
| MEDIUM | swift/ray/megatron/rollout/ray_vllm_engine.py | 136 | # ------------------------------------------------------------------ |
| MEDIUM | swift/ray/megatron/rollout/ray_vllm_engine.py | 138 | # ------------------------------------------------------------------ |
| MEDIUM | swift/ray/megatron/checkpoint_engine/nccl.py | 240 | # ── Send / Receive ─────────────────────────────────────────────────── |
| MEDIUM | swift/ray/megatron/checkpoint_engine/hccl.py | 168 | # ── Core lifecycle ─────────────────────────────────────────────────── |
| MEDIUM | swift/ray/megatron/checkpoint_engine/hccl.py | 276 | # ── Metadata exchange ──────────────────────────────────────────────── |
| MEDIUM | swift/ray/megatron/checkpoint_engine/hccl.py | 310 | # ── Send / Receive ─────────────────────────────────────────────────── |
| MEDIUM | swift/megatron/arguments/megatron_args.py | 170 | # ─────────────────────────── Not Supported Yet ─────────────────────────── |
| MEDIUM | examples/train/rlhf/gkd/teacher_server.sh | 10 | # ======================================================================== |
| Severity | File | Line | Snippet |
|---|---|---|---|
| HIGH | docs/README.md | 18 | Load data from json/yaml/pickle files. This method provides a unified api for loading data from serialized file |
| HIGH | swift/dataset/loader.py | 239 | Load and preprocess datasets. This function provides a unified interface to load datasets from various sources (Hug |
| HIGH | swift/rewards/rm_plugin.py | 123 | Extract the reward score from the model's output. Args: model_output (str): The model's ou |
| HIGH | swift/rlhf_trainers/rollout_mixin.py | 335 | Split model parameters into batches for synchronized weight transfer. This method divides model parameters into |
| HIGH | swift/rlhf_trainers/rollout_mixin.py | 1709 | Attempt to encode each input using the template. If encoding fails, resample from a backup iterator unt |
| HIGH | swift/template/register.py | 81 | Get or create a template instance for model input/output formatting. This function retrieves the appropriate templa |
| HIGH | swift/loss_scale/mapping.py | 20 | Factory function to create a loss scale object from a string specification. The loss_scale string can be in three f |
| HIGH | swift/utils/hub_utils.py | 27 | Download model snapshot safely with DDP context protection. This function attempts to download a model from Hugging |
| HIGH | swift/utils/torch_utils.py | 167 | Get the last valid (non-padding) token position indices for each sample. This function correctly handles seque |
| HIGH | swift/rollout/multi_turn.py | 30 | Perform asynchronous batched inference for multiple rollout requests. This method serves as the main e |
| HIGH | swift/rollout/multi_turn.py | 183 | Execute multi-turn conversation rollout with built-in turn management logic. This implements the default multi- |
| HIGH | swift/model/chunk_gated_delta_rule.py | 256 | Args: q (torch.Tensor): queries of shape `[B, T, H, K]`. k (torch.Tensor): |
| HIGH | swift/model/register.py | 539 | Load a pretrained model and its processor from a model hub or local path. Args: model_id_or_path: The model |
| HIGH | swift/megatron/trainers/grpo_trainer.py | 1576 | Attempt to encode each input using the template. If encoding fails, resample from a backup iterator unt |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | tests/utils/test_rewards.py | 193 | '### Step 1: Recall the formula\n\n' |
| LOW | tests/utils/test_rewards.py | 195 | '### Step 2: Use the given terms\n\n' |
| LOW | tests/utils/test_rewards.py | 200 | '### Step 3: Find $a_9$\n\n' |
| LOW | swift/metrics/reranker.py | 61 | # Step 1: Find all positive sample indices (query boundaries) |
| LOW | swift/metrics/reranker.py | 67 | # Step 2: Split into groups (queries) |
| LOW | swift/metrics/reranker.py | 85 | # Step 3: Calculate metrics for each query independently |
| LOW | swift/metrics/reranker.py | 135 | # Step 4: Calculate mean metrics across all valid queries |
| LOW | swift/template/templates/minicpm.py | 429 | # Step 1: Base encode — produces input_ids with -100 for images |
| LOW | swift/template/templates/minicpm.py | 443 | # Step 2: Process images — replace -100 tokens with image placeholders |
| LOW | swift/template/templates/minicpm.py | 457 | # Step 3: Process audios — expand audio_start/audio_end pairs with <unk> tokens |
| LOW | swift/template/templates/minicpm.py | 495 | # Step 4: Compute image_bound using start/end token boundaries |
| LOW | swift/template/templates/minicpm.py | 520 | # Step 5: Compute audio_bounds |
| LOW | swift/sequence_parallel/ulysses.py | 511 | # Step 1: Gather from all sequence parallel ranks |
| LOW | swift/sequence_parallel/ulysses.py | 519 | # Step 2: Gather all rp chunks |
| LOW | swift/megatron/trainers/vocab_parallel_utils.py | 41 | # Step 1: Find global max for numerical stability |
| LOW | swift/megatron/trainers/vocab_parallel_utils.py | 45 | # Step 2: Compute exp(logits - max) and sum across all TP ranks |
| LOW | swift/megatron/trainers/vocab_parallel_utils.py | 50 | # Step 3: Compute log_softmax |
| LOW | swift/megatron/trainers/grpo_trainer.py | 387 | # Step 2: Compute KL from logps if kl_in_reward is enabled |
| LOW | swift/megatron/trainers/grpo_trainer.py | 392 | # Step 3: Compute advantages (with KL penalty if kl_in_reward is enabled) |
| LOW | swift/megatron/trainers/grpo_trainer.py | 396 | # Step 4: Add advantages to encoded batches |
| LOW | swift/megatron/trainers/grpo_trainer.py | 557 | # Step 1: Update or append assistant message |
| LOW | swift/megatron/trainers/grpo_trainer.py | 565 | # Step 2: Add token IDs and loss mask |
| LOW | swift/megatron/trainers/grpo_trainer.py | 574 | # Step 3: Attach rollout extra info |
| LOW | swift/megatron/trainers/grpo_trainer.py | 578 | # Step 4: Store finish reason (used for truncation filters etc.) |
| LOW | swift/megatron/trainers/grpo_trainer.py | 583 | # Step 5: Store rollout logprobs for importance sampling correction |
| LOW | swift/megatron/trainers/grpo_trainer.py | 591 | # Step 6: Store rollout routed_experts for routing replay |
| LOW | swift/megatron/trainers/grpo_trainer.py | 375 | # Step 1: Encode batches and compute logps first (unified flow like GRPOTrainer) |
| LOW | swift/megatron/trainers/grpo_trainer.py | 489 | # Step 1: Wake up the engine if it's sleeping (vLLM colocate mode) |
| LOW | swift/megatron/trainers/grpo_trainer.py | 496 | # Step 2: Load model weights |
| Severity | File | Line | Snippet |
|---|---|---|---|
| MEDIUM | swift/rewards/rm_plugin.py | 3 | # This module provides plugins for integrating external reward models, |
| MEDIUM | swift/rewards/rm_plugin.py | 169 | # Define a mapping for role capitalization if needed |
| MEDIUM | swift/rlhf_trainers/utils.py | 356 | # Create a DeepSpeedPlugin with the processed config |
| MEDIUM | swift/rlhf_trainers/grpo_trainer.py | 2014 | # Create a copy to avoid modifying the original table used by other loggers. |
| MEDIUM | swift/template/base.py | 461 | # This function is only used to handle scenarios where the model needs |
| MEDIUM | swift/template/base.py | 1587 | """This function is important for multi-modal training, as it registers the post_encode method |
| MEDIUM | swift/pipelines/train/tuner.py | 127 | """This function is only useful on the vera tuner""" |
| MEDIUM | swift/pipelines/infer/rollout.py | 144 | # Create a stateless process group to manage communication between training processes and vLLM workers. |
| MEDIUM | swift/pipelines/eval/utils.py | 140 | # Create a future to receive the result asynchronously |
| MEDIUM | swift/utils/hf_config.py | 13 | """This class is used to read config from config.json(maybe params.json also)""" |
| MEDIUM | swift/rollout/multi_turn.py | 478 | # Create a RolloutOutput for the current round |
| MEDIUM | swift/rollout/multi_turn.py | 543 | # Create a mock inputs object to use the template's _swift_prepare_inputs method |
| MEDIUM | examples/train/grpo/plugin/plugin.py | 73 | # Define a regex pattern that only allows numbers, operators, parentheses, and whitespace |
| MEDIUM | examples/train/grpo/plugin/plugin.py | 220 | # Create the sandbox by hand, currently there's no context manager for this version |
| MEDIUM | examples/train/grpo/plugin/plugin.py | 226 | # Create a list of tasks for running scripts concurrently |
| MEDIUM | examples/train/grpo/plugin/plugin.py | 205 | # Create a new event loop and set it |
| MEDIUM | examples/train/think_model/qwen3_demo1.sh | 3 | # This method is also applicable to the Deepseek-R1 series of models. |
| MEDIUM | examples/custom/my_qwen2_5_omni/my_register.py | 307 | """This function is typically used to solve the zero2/zero3 hanging issue in mixed model training, |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | tests/general/test_dataset.py | 21 | 'AI-ModelScope/LongAlpaca-12k#1000' |
| LOW | tests/general/test_dataset.py | 81 | |
| LOW | tests/train/test_sft.py | 421 | # test_llm_hqq() |
| LOW | tests/test_align/test_vllm_vlm.py | 201 | # test_ovis2() |
| LOW | tests/test_align/test_template/test_agent.py | 721 | print(f'labels: {template.safe_decode(encoded2["labels"])}') |
| LOW | tests/test_align/test_template/test_agent.py | 741 | # test_glm4_5() |
| LOW | tests/test_align/test_template/test_llm.py | 741 | # test_qwen1_5() |
| LOW | tests/test_align/test_template/test_llm.py | 761 | # test_phi4() |
| LOW | tests/test_align/test_template/test_llm.py | 781 | # test_glm4_5() |
| LOW | tests/test_align/test_template/test_video.py | 401 | # test_qwen2_vl() |
| LOW | tests/test_align/test_template/test_vision.py | 1261 | |
| LOW | tests/test_align/test_template/test_vision.py | 1281 | # test_deepseek_vl() |
| LOW | tests/test_align/test_template/test_vision.py | 1301 | # test_internvl2_5_mpo() |
| LOW | tests/test_align/test_template/test_vision.py | 1321 | # test_glyph() |
| LOW | tests/test_align/test_template/test_vision.py | 1341 | # test_mistral_2506() |
| LOW | tests/test_align/test_template/test_template.py | 161 | |
| LOW | tests/eval/test_eval.py | 61 | test_eval_llm() |
| LOW | docs/source/conf.py | 1 | # Configuration file for the Sphinx documentation builder. |
| LOW | docs/source/conf.py | 81 | |
| LOW | docs/source_en/conf.py | 1 | # Configuration file for the Sphinx documentation builder. |
| LOW | docs/source_en/conf.py | 81 | |
| LOW | docs/source_en/Megatron-SWIFT/LoRA-Training.md | 141 | # swift export |
| LOW | swift/rlhf_trainers/args_mixin.py | 441 | log_rollout_offpolicy_metrics: bool = False # Log off-policy metrics even when IS correction is disabled |
| LOW | swift/rlhf_trainers/grpo_trainer.py | 181 | ) |
| LOW | swift/rlhf_trainers/grpo_trainer.py | 2601 | # 2d. Log PPL difference (sequence-level perplexity difference) |
| LOW | swift/pipelines/infer/rollout.py | 301 | """ |
| LOW | swift/infer_engine/vllm_engine.py | 481 | else: |
| LOW | examples/ascend/activation_cpu_offload/train.sh | 41 | # {'train_runtime': 79.7064, 'train_samples_per_second': 6.311, 'train_steps_per_second': 0.201, 'train_loss': 1.9164841 |
| LOW | examples/deploy/vllm_dp.sh | 1 | CUDA_VISIBLE_DEVICES=0,1 swift deploy \ |
| LOW | examples/deploy/vllm_dp.sh | 21 | # "temperature": 0 |
| LOW | examples/deploy/vllm.sh | 1 | CUDA_VISIBLE_DEVICES=0 swift deploy \ |
| LOW | examples/models/gpt_oss/internvl3_5_gpt.sh | 41 | --moe_expert_capacity_factor 2 \ |
| LOW | examples/models/qwen3_next/mtp.sh | 41 | --sequence_parallel true \ |
| LOW | examples/models/qwen3_5/mcore.sh | 61 | # CUDA_VISIBLE_DEVICES=0,1,2,3 \ |
| LOW | examples/models/qwen3_5/transformers.sh | 41 | # IMAGE_MAX_TOKEN_NUM=1024 \ |
| LOW | examples/models/qwen3_5/fp8.sh | 61 | # swift infer \ |
| LOW | …mples/train/multimodal/lora_llm_full_vit/merge_lora.sh | 1 | CUDA_VISIBLE_DEVICES=0 \ |
| LOW | …s/train/sequence_parallel/sequence_parallel_qwen3_5.sh | 21 | --logging_steps 1 \ |
| LOW | examples/train/rlhf/opsd/opsd.sh | 1 | # OPSD Training Script |
| LOW | examples/train/grpo/plugin/run_external_scheduler.sh | 1 | # This script require main branch ms-swift |
| LOW | examples/train/grpo/plugin/deepeyes/deepeyes.sh | 1 | # 8 * 80G |
| LOW | examples/train/grpo/internal/full_lmdeploy.sh | 1 | # The LMDeploy backend in GRPO has been deprecated in Swift 3.5. |
| LOW | examples/train/grpo/external/vllm_multi_turn.sh | 1 | # Exp: https://github.com/modelscope/ms-swift/pull/5307#issuecomment-3219803922 |
| LOW | examples/megatron/mcore_bridge/full/dense.sh | 41 | # VIDEO_MAX_TOKEN_NUM=128 \ |
| LOW | examples/megatron/mcore_bridge/lora/seq_cls.sh | 41 | --no_save_rng true \ |
| LOW | examples/megatron/multimodal/lora_llm_vit_full/sft.sh | 61 | # IMAGE_MAX_TOKEN_NUM=1024 \ |
| LOW | examples/megatron/grpo/dense_server.sh | 1 | # MAX_PIXELS=602112 \ |
| LOW | examples/megatron/lora/mtp.sh | 41 | --dataloader_num_workers 8 \ |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | swift/callbacks/activation_cpu_offload.py | 603 | # Check if model is wrapped with FSDP |
| LOW | swift/callbacks/activation_cpu_offload.py | 607 | # Check if fsdp_config is a dictionary and has activation_cpu_offload enabled |
| LOW | swift/callbacks/lisa.py | 43 | # Check if it's time to switch active layers, including at step 0 |
| LOW | swift/rlhf_trainers/rollout_mixin.py | 985 | # Check if the number of logprobs matches the number of loss_mask=1 tokens |
| LOW | swift/rlhf_trainers/utils.py | 932 | # Check if already patched (idempotent). |
| LOW | swift/rlhf_trainers/utils.py | 964 | # Check if inner_model has layers attribute |
| LOW | swift/rlhf_trainers/grpo_trainer.py | 2323 | # Set max_length to None to disable truncation, as the input length has already been truncated earlier. |
| LOW | swift/pipelines/eval/utils.py | 168 | # Check if we've reached the desired batch size |
| LOW | swift/trainers/mixin.py | 406 | # Check if we should delete older checkpoint(s) |
| LOW | swift/trainers/reranker_trainer.py | 18 | # Check if we have a custom loss function |
| LOW | swift/rollout/multi_turn.py | 289 | # Check if the number of logprobs matches the number of loss_mask=1 tokens |
| LOW | swift/infer_engine/utils.py | 539 | # Check if we have a cached last_output from the previous iteration. |
| LOW | swift/infer_engine/utils.py | 606 | # Check if need to run the usual non-async path |
| LOW | swift/hub/hub.py | 351 | # Write the file if it has changed |
| LOW | swift/arguments/rlhf_args.py | 559 | # Check if teacher_deepspeed is a predefined name |
| LOW | swift/megatron/utils/megatron_lm_utils.py | 520 | # Set bucket_size to infinity if overlap_grad_reduce is False. |
| LOW | swift/megatron/trainers/grpo_trainer.py | 1103 | # Check if this is the PP last stage (only last stage has labels and computes loss) |
| LOW | swift/agent_template/minimax_m2.py | 72 | # Check if using react format |
| LOW | examples/train/grpo/plugin/plugin.py | 69 | # Check if all numbers are used exactly once |
| LOW | examples/train/grpo/plugin/plugin.py | 81 | # Check if the equation is correct and matches the ground truth |
| LOW | examples/train/grpo/plugin/plugin.py | 57 | # Check if the format is correct |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | swift/model/models/qwen.py | 1687 | loss.device) # make sure to reside in the same device |
| MEDIUM | examples/train/multi-gpu/fsdp2_lora/train.sh | 2 | # NOTE: for swift>=3.12, you can use --fsdp fsdp2 instead of accelerate launch |
| MEDIUM | examples/train/multi-gpu/fsdp_qlora/train.sh | 2 | # NOTE: for swift>=3.12, you can use --fsdp fsdp2 instead of accelerate launch |
| MEDIUM | examples/megatron/fp8/lora.sh | 3 | # However, you can use BF16 weights to perform Merge-LoRA. |
| MEDIUM | examples/megatron/fp8/lora.sh | 64 | # Alternatively, you can use BF16 base model + BF16 LoRA for inference |
| Severity | File | Line | Snippet |
|---|---|---|---|
| HIGH | swift/rlhf_trainers/grpo_trainer.py | 2535 | - kl: Direct KL divergence estimator KL(π_rollout || π_training) |
| HIGH | swift/hub/hub.py | 357 | repo.push(commit_message) |
| HIGH | swift/megatron/trainers/vocab_parallel_utils.py | 108 | KL(target || input) = sum(target_prob * (target_log_prob - input_log_prob)) |
| Severity | File | Line | Snippet |
|---|---|---|---|
| HIGH | docs/source/Instruction/Sample.md | 80 | OPENAI_API_KEY="your_api_key" \ |
| HIGH | docs/source_en/Instruction/Sample.md | 84 | OPENAI_API_KEY="your_api_key" \ |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | tests/train/test_vllm_importance_sampling_basic.py | 20 | # In testing, just return the tensor as-is |
| MEDIUM | swift/callbacks/perf_log.py | 58 | # TODO Collect comprehensive TFLOPS data. Then provide a fallback strategy based on lookup tables. |
| MEDIUM | swift/template/templates/minicpm.py | 496 | # This is more robust than finding consecutive <unk> tokens, especially |
| LOW | examples/megatron/export/lora.sh | 3 | # simply set `--merge_lora true` |
| Severity | File | Line | Snippet |
|---|---|---|---|
| HIGH | …s/source_en/BestPractices/GRPO-Multi-Modal-Training.md | 278 | This task is based on the experiments in [open-r1-multimodal](https://github.com/EvolvingLMMs-Lab/open-r1-multimodal.git |
| Severity | File | Line | Snippet |
|---|---|---|---|
| LOW | swift/callbacks/activation_cpu_offload.py | 490 | def my_function(*inputs): |