Repository Analysis

hiyouga/LlamaFactory

Unified Efficient Fine-Tuning of 100+ LLMs & VLMs (ACL 2024)

12.6 Low AI signal View on GitHub
12.6
Adjusted Score
12.6
Raw Score
100%
Time Factor
2026-05-26
Last Push
71,708
Stars
Python
Language
102,042
Lines of Code
497
Files
1084
Pattern Hits
2026-05-31
Scan Date

Score History

Severity Breakdown

CRITICAL 0HIGH 22MEDIUM 81LOW 981

Pattern Findings

1084 matches across 17 categories. Click a row to expand file-level details.

Unused Imports357 hits · 357 pts
SeverityFileLineSnippet
LOWtests/data/test_mm_plugin.py30
LOWtests/data/test_mm_plugin.py30
LOWtests/data/test_mm_plugin.py33
LOWtests/data/test_mm_plugin.py34
LOWtests/data/test_template.py28
LOWdocs/zh/conf.py8
LOWdocs/en/conf.py8
LOWsrc/llamafactory/v1/config/__init__.py15
LOWsrc/llamafactory/v1/config/__init__.py16
LOWsrc/llamafactory/v1/config/__init__.py16
LOWsrc/llamafactory/v1/config/__init__.py17
LOWsrc/llamafactory/v1/config/__init__.py17
LOWsrc/llamafactory/v1/config/__init__.py17
LOWsrc/llamafactory/v1/config/__init__.py18
LOWsrc/llamafactory/v1/config/__init__.py19
LOWsrc/llamafactory/v1/config/__init__.py20
LOWsrc/llamafactory/v1/config/__init__.py21
LOW…afactory/v1/plugins/trainer_plugins/distributed/hub.py15
LOW…/llamafactory/v1/plugins/model_plugins/quantization.py31
LOW…/llamafactory/v1/plugins/model_plugins/quantization.py31
LOW…y/v1/plugins/model_plugins/kernels/liger_kernel_ops.py27
LOW…y/v1/plugins/model_plugins/kernels/liger_kernel_ops.py53
LOW…ins/model_plugins/kernels/ops/rms_norm/npu_rms_norm.py30
LOW…/v1/plugins/model_plugins/kernels/ops/rope/npu_rope.py29
LOW…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py373
LOW…v1/plugins/model_plugins/kernels/ops/mlp/npu_swiglu.py29
LOWsrc/llamafactory/v1/utils/packages.py34
LOWsrc/llamafactory/v1/utils/callbacks/__init__.py15
LOWsrc/llamafactory/v1/utils/callbacks/__init__.py16
LOWsrc/llamafactory/v1/utils/callbacks/__init__.py16
LOWsrc/llamafactory/v1/utils/callbacks/__init__.py16
LOWsrc/llamafactory/v1/utils/callbacks/logging_callback.py15
LOWsrc/llamafactory/v1/utils/callbacks/trainer_callback.py15
LOWsrc/llamafactory/v1/samplers/cli_sampler.py88
LOWsrc/llamafactory/chat/hf_engine.py33
LOWsrc/llamafactory/chat/hf_engine.py33
LOWsrc/llamafactory/chat/hf_engine.py33
LOWsrc/llamafactory/chat/hf_engine.py34
LOWsrc/llamafactory/chat/hf_engine.py36
LOWsrc/llamafactory/chat/hf_engine.py37
LOWsrc/llamafactory/chat/hf_engine.py37
LOWsrc/llamafactory/chat/hf_engine.py37
LOWsrc/llamafactory/chat/hf_engine.py38
LOWsrc/llamafactory/chat/hf_engine.py38
LOWsrc/llamafactory/chat/hf_engine.py38
LOWsrc/llamafactory/chat/hf_engine.py38
LOWsrc/llamafactory/chat/vllm_engine.py34
LOWsrc/llamafactory/chat/vllm_engine.py39
LOWsrc/llamafactory/chat/vllm_engine.py39
LOWsrc/llamafactory/chat/vllm_engine.py39
LOWsrc/llamafactory/chat/vllm_engine.py40
LOWsrc/llamafactory/chat/vllm_engine.py40
LOWsrc/llamafactory/chat/vllm_engine.py40
LOWsrc/llamafactory/chat/vllm_engine.py40
LOWsrc/llamafactory/chat/sglang_engine.py29
LOWsrc/llamafactory/chat/sglang_engine.py29
LOWsrc/llamafactory/chat/sglang_engine.py29
LOWsrc/llamafactory/chat/sglang_engine.py29
LOWsrc/llamafactory/chat/sglang_engine.py40
LOWsrc/llamafactory/chat/sglang_engine.py40
297 more matches not shown…
Over-Commented Block289 hits · 289 pts
SeverityFileLineSnippet
LOWtests/conftest.py1# Copyright 2025 the LlamaFactory team.
LOWtests/check_license.py1# Copyright 2025 the LlamaFactory team.
LOWtests/model/test_freeze.py1# Copyright 2025 the LlamaFactory team.
LOWtests/model/test_pissa.py1# Copyright 2025 the LlamaFactory team.
LOWtests/model/test_full.py1# Copyright 2025 the LlamaFactory team.
LOWtests/model/test_base.py1# Copyright 2025 the LlamaFactory team.
LOWtests/model/test_lora.py1# Copyright 2025 the LlamaFactory team.
LOWtests/model/model_utils/test_misc.py1# Copyright 2025 the LlamaFactory team.
LOWtests/model/model_utils/test_visual.py1# Copyright 2025 the LlamaFactory team.
LOWtests/model/model_utils/test_add_tokens.py1# Copyright 2025 the LlamaFactory team.
LOWtests/model/model_utils/test_attention.py1# Copyright 2025 the LlamaFactory team.
LOWtests/model/model_utils/test_packing.py1# Copyright 2025 the LlamaFactory team.
LOWtests/model/model_utils/test_checkpointing.py1# Copyright 2025 the LlamaFactory team.
LOWtests/train/test_sft_trainer.py1# Copyright 2025 the LlamaFactory team.
LOWtests/eval/test_eval_template.py1# Copyright 2025 the LlamaFactory team.
LOWtests/e2e/test_train.py1# Copyright 2025 the LlamaFactory team.
LOWtests/e2e/test_sglang.py1# Copyright 2025 the LlamaFactory team.
LOWtests/e2e/test_chat.py1# Copyright 2025 the LlamaFactory team.
LOWtests/data/test_collator.py1# Copyright 2025 the LlamaFactory team.
LOWtests/data/test_loader.py1# Copyright 2025 the LlamaFactory team.
LOWtests/data/test_mm_plugin.py1# Copyright 2025 the LlamaFactory team.
LOWtests/data/test_formatter.py1# Copyright 2025 the LlamaFactory team.
LOWtests/data/test_converter.py1# Copyright 2025 the LlamaFactory team.
LOWtests/data/test_template.py1# Copyright 2025 the LlamaFactory team.
LOWtests/data/processor/test_feedback.py1# Copyright 2025 the LlamaFactory team.
LOWtests/data/processor/test_supervised.py1# Copyright 2025 the LlamaFactory team.
LOWtests/data/processor/test_pairwise.py1# Copyright 2025 the LlamaFactory team.
LOWtests/data/processor/test_unsupervised.py1# Copyright 2025 the LlamaFactory team.
LOWtests/data/processor/test_processor_utils.py1# Copyright 2025 the LlamaFactory team.
LOWtests_v1/conftest.py1# Copyright 2025 the LlamaFactory team.
LOWtests_v1/core/test_data_engine.py1# Copyright 2025 the LlamaFactory team.
LOWtests_v1/core/test_model_loader.py1# Copyright 2025 the LlamaFactory team.
LOWtests_v1/core/utils/test_batching.py1# Copyright 2025 the LlamaFactory team.
LOWtests_v1/core/utils/test_rendering.py1# Copyright 2025 the LlamaFactory team.
LOWtests_v1/config/test_args_parser.py1# Copyright 2025 the LlamaFactory team.
LOW…s_v1/plugins/trainer_plugins/distributed/test_fsdp2.py1# Copyright 2025 the LlamaFactory team.
LOW…ainer_plugins/distributed/test_fsdp2_weight_convert.py1# Copyright 2025 the LlamaFactory team.
LOW…s_v1/plugins/model_plugins/test_quantization_plugin.py1# Copyright 2025 the LlamaFactory team.
LOWtests_v1/plugins/model_plugins/test_peft.py1# Copyright 2025 the LlamaFactory team.
LOWtests_v1/plugins/model_plugins/test_kernel_plugin.py1# Copyright 2025 the LlamaFactory team.
LOWtests_v1/plugins/model_plugins/test_init_plugin.py1# Copyright 2025 the LlamaFactory team.
LOWtests_v1/plugins/model_plugins/test_ulysses_cp.py1# Copyright 2025 the LlamaFactory team.
LOWtests_v1/plugins/data_plugins/test_converter.py1# Copyright 2025 the LlamaFactory team.
LOWtests_v1/trainers/test_fsdp2_sft_trainer.py1# Copyright 2025 the LlamaFactory team.
LOWtests_v1/accelerator/test_interface.py1# Copyright 2025 the LlamaFactory team.
LOWtests_v1/sampler/test_cli_sampler.py1# Copyright 2025 the LlamaFactory team.
LOWexamples/train_full/qwen3vl_full_sft.yaml41ddp_timeout: 180000000
LOWexamples/train_full/qwen3_full_sft.yaml41# val_size: 0.1
LOWexamples/train_qlora/llama3_lora_sft_gptq.yaml41# per_device_eval_batch_size: 1
LOWexamples/train_qlora/llama3_lora_sft_awq.yaml41# per_device_eval_batch_size: 1
LOWexamples/train_qlora/llama3_lora_sft_aqlm.yaml41# per_device_eval_batch_size: 1
LOWexamples/train_qlora/qwen3_lora_sft_otfq.yaml41### eval
LOWexamples/train_qlora/qwen3_lora_sft_bnb_npu.yaml41
LOWexamples/train_lora/qwen3_lora_dpo.yaml41
LOWexamples/train_lora/qwen3_lora_sft_ds3.yaml41### eval
LOWexamples/train_lora/qwen3vl_lora_dpo.yaml41ddp_timeout: 180000000
LOWexamples/train_lora/qwen3_lora_pretrain.yaml41# val_size: 0.1
LOWexamples/train_lora/qwen3_lora_reward.yaml41# eval_dataset: dpo_en_demo
LOWexamples/train_lora/qwen3vl_lora_sft.yaml41
LOWexamples/train_lora/qwen3_lora_kto.yaml41# per_device_eval_batch_size: 1
229 more matches not shown…
Hyper-Verbose Identifiers175 hits · 184 pts
SeverityFileLineSnippet
LOWtests/conftest.py85def _handle_device_visibility(items: list[Item]):
LOWtests/conftest.py109def pytest_collection_modifyitems(config: Config, items: list[Item]):
LOWtests/conftest.py123def _cleanup_distributed_state():
LOWtests/conftest.py166def fix_valuehead_cpu_loading():
LOWtests/conftest.py172def bypass_mistral_regex_check():
LOWtests/model/test_freeze.py46def test_freeze_train_all_modules():
LOWtests/model/test_freeze.py57def test_freeze_train_extra_modules():
LOWtests/model/test_lora.py58def test_lora_train_qv_modules():
LOWtests/model/test_lora.py64def test_lora_train_all_modules():
LOWtests/model/test_lora.py70def test_lora_train_extra_modules():
LOWtests/model/test_lora.py76def test_lora_train_old_adapters():
LOWtests/model/test_lora.py82def test_lora_train_new_adapters():
LOWtests/model/test_lora.py91def test_lora_train_valuehead():
LOWtests/model/model_utils/test_visual.py84def test_visual_model_save_load():
LOWtests/model/model_utils/test_packing.py37def test_get_seqlens_in_batch(attention_mask, golden_seq_lens):
LOWtests/model/model_utils/test_checkpointing.py43def test_vanilla_checkpointing(disable_gradient_checkpointing: bool):
LOWtests/model/model_utils/test_checkpointing.py49def test_unsloth_gradient_checkpointing():
LOWtests/model/model_utils/test_checkpointing.py62def test_upcast_lmhead_output():
LOWtests/data/test_collator.py234def _get_expected_position_ids(
LOWtests/data/test_collator.py274def test_multimodal_collator_with_packing():
LOWtests/data/test_mm_plugin.py316def test_llava_next_video_plugin():
LOWtests/data/test_formatter.py64def test_multi_function_formatter():
LOWtests/data/test_formatter.py75def test_default_tool_formatter():
LOWtests/data/test_formatter.py94def test_default_tool_extractor():
LOWtests/data/test_formatter.py101def test_default_multi_tool_extractor():
LOWtests/data/test_formatter.py193def test_mistral_function_formatter():
LOWtests/data/test_formatter.py203def test_mistral_multi_function_formatter():
LOWtests/data/test_formatter.py215def test_mistral_tool_formatter():
LOWtests/data/test_formatter.py224def test_mistral_tool_extractor():
LOWtests/data/test_formatter.py231def test_mistral_multi_tool_extractor():
LOWtests/data/test_formatter.py244def test_qwen_function_formatter():
LOWtests/data/test_formatter.py253def test_qwen_multi_function_formatter():
LOWtests/data/test_formatter.py285def test_qwen_multi_tool_extractor():
LOWtests/data/test_template.py133def test_reasoning_encode_oneturn(cot_messages: bool, enable_thinking: bool):
LOWtests/data/test_template.py159def test_reasoning_encode_multiturn(cot_messages: bool, enable_thinking: bool):
LOWtests/data/test_template.py188def test_reasoning_encode_multiturn_discarding_history_cot(enable_thinking: bool, discarding_history_cot: bool):
LOWtests/data/processor/test_supervised.py48def test_supervised_single_turn(num_samples: int):
LOWtests/data/processor/test_supervised.py77def test_supervised_multi_turn(num_samples: int):
LOWtests/data/processor/test_supervised.py95def test_supervised_train_on_prompt(num_samples: int):
LOWtests/data/processor/test_supervised.py113def test_supervised_mask_history(num_samples: int):
LOWtests/data/processor/test_pairwise.py46def _convert_sharegpt_to_openai(messages: list[dict[str, str]]) -> list[dict[str, str]]:
LOWtests_v1/conftest.py86def _handle_device_visibility(items: list[Item]):
LOWtests_v1/conftest.py110def pytest_collection_modifyitems(config: Config, items: list[Item]):
LOWtests_v1/conftest.py135def _cleanup_distributed_state():
LOWtests_v1/conftest.py178def bypass_mistral_regex_check():
LOWtests_v1/core/test_model_loader.py30def test_tiny_qwen_with_kernel_plugin():
LOWtests_v1/core/utils/test_batching.py72def test_batching_plugin_data_provider_batch_sizes():
LOWtests_v1/core/utils/test_batching.py121def test_dynamic_batching_returns_none_when_token_budget_is_incomplete():
LOWtests_v1/core/utils/test_batching.py138def test_dynamic_batching_fill_buffer_restarts_until_micro_batch_is_complete():
LOWtests_v1/core/utils/test_batching.py206def test_dynamic_padding_free():
LOWtests_v1/core/utils/test_batching.py311def test_dynamic_padding_free_returns_none_when_token_budget_is_incomplete():
LOWtests_v1/core/utils/test_batching.py323def test_dynamic_padding_free_fill_buffer_restarts_until_micro_batch_is_complete():
LOWtests_v1/core/utils/test_rendering.py118def test_chatml_rendering_remote(num_samples: int):
LOW…s_v1/plugins/trainer_plugins/distributed/test_fsdp2.py33def collect_non_persistent_buffers(model):
LOW…s_v1/plugins/model_plugins/test_quantization_plugin.py24def check_quantization_status(model):
LOWtests_v1/plugins/model_plugins/test_peft.py60def test_find_all_linear_modules(model):
LOWtests_v1/plugins/model_plugins/test_peft.py76def test_get_freeze_model_layers(model):
LOWtests_v1/plugins/model_plugins/test_peft.py94def test_get_freeze_model_modules(model):
LOWtests_v1/plugins/model_plugins/test_peft.py109def test_load_adapter_single_for_inference(model, adapter_path):
LOWtests_v1/plugins/model_plugins/test_peft.py116def test_load_adapter_resume_train(model, adapter_path):
115 more matches not shown…
Slop Phrases54 hits · 92 pts
SeverityFileLineSnippet
MEDIUMdata/kto_en_demo.json67 "content": "Certainly, measuring the results of a marketing strategy and making adjustments based on those metri
MEDIUMdata/kto_en_demo.json394 "content": "Using Unreal's Gameplay Ability System (GAS) in conjunction with interpolation and prediction can pr
LOWdata/kto_en_demo.json903 "content": "I apologize for the confusion. The `unique_id` parameter in the `momepy.Tessellation` function expec
MEDIUMdata/kto_en_demo.json2012 "content": "Two-factor authentication (2FA) adds an extra layer of security by requiring users to provide two fo
MEDIUMdata/kto_en_demo.json2114 "content": "To adapt the program to handle in-place modification or the creation of new objects based on a boole
MEDIUMdata/kto_en_demo.json2449 "content": "I'm not sure where you've heard that information, but as an AI language model, I can share some fact
MEDIUMdata/kto_en_demo.json2790 "content": "To derive the original matrix from the rotated one, you would need to perform a 90 degrees counter-c
MEDIUMdata/kto_en_demo.json3013 "content": "The genetic factors that contribute to the intricate design of the peacock's tail feathers are quite
MEDIUMdata/kto_en_demo.json3585 "content": "As an AI language model,I cannot determine the sentiment of the product review without further conte
MEDIUMdata/kto_en_demo.json3611 "content": "I'm unable to provide you with a real-time percentage of population living in poverty in Marlborough
LOWdata/kto_en_demo.json3690 "content": "Firstly, as a fitness trainer, I highly recommend consulting with a healthcare professional before e
MEDIUMdata/kto_en_demo.json3850 "content": "Since each medium-sized box measures 2 feet on all sides, its volume will be: 2*2*2 = 8 cubic feet.
MEDIUMdata/kto_en_demo.json4774 "content": "In Feng Shui, the five elements—wood, fire, earth, metal, and water—are believed to interact in cert
MEDIUMdata/kto_en_demo.json4897 "content": "Sure, I understand the problem. However, I'm a large language model, I cannot provide a correct answ
MEDIUMdata/kto_en_demo.json4923 "content": "As an AI language model, I am not able to provide program codes or algorithms. However, I can provid
MEDIUMdata/alpaca_en_demo.json405 "output": "I am sorry, but as an AI language model, I do not have the data or access to real-time information to det
MEDIUMdata/alpaca_en_demo.json930 "output": "I'm sorry, but I don't have access to external articles or news sources so I'm unable to read or summariz
LOWdata/alpaca_en_demo.json1175 "output": "Here is an example of HTML code that can be used to create a web page that displays the temperature of th
MEDIUMdata/alpaca_en_demo.json3330 "output": "As an AI, I don't have a physical house, so I cannot provide a description of it. Can I help you with som
MEDIUMdata/alpaca_en_demo.json3900 "output": "Thank you for considering my request. Please let me know if you need any additional information, and I lo
MEDIUMdata/alpaca_en_demo.json3905 "output": "I'm sorry, but I'm unable to come into work today due to unforeseen medical issues. I woke up with a seve
MEDIUMdata/alpaca_en_demo.json3975 "output": "As an AI, I don’t have access to real-time information such as pricing, and due to the fact that movie ti
MEDIUMdata/alpaca_en_demo.json4090 "output": "I am sorry, but as an AI language model, I do not have access to up-to-date information on housing prices
MEDIUMdata/alpaca_en_demo.json4505 "output": "Sure, here is a simple example of a class for a car:\n\n```python\n\nclass Car:\n \n def __init__(sel
MEDIUMdata/alpaca_en_demo.json4715 "output": "I'm sorry, but as an AI language model, I'm unable to create or display graphical content. However, I can
MEDIUMdata/alpaca_en_demo.json4715 "output": "I'm sorry, but as an AI language model, I'm unable to create or display graphical content. However, I can
MEDIUMdata/alpaca_en_demo.json4870 "output": "As an AI, I can assist you in coming up with design ideas and concepts for the logo. However, I'm unable
MEDIUMdata/alpaca_zh_demo.json4470 "output": "As an AI language model I am capable of analyzing text and identifying emotions, however, the sentence pr
MEDIUMdata/glaive_toolcall_en_demo.json1232 "value": "I'm sorry, but I'm unable to perform external tasks like ordering a pizza. My capabilities are current
MEDIUMdata/glaive_toolcall_en_demo.json1295 "value": "Analyzing the motivations of a protagonist in a narrative can be a complex task that requires a deep u
MEDIUMdata/glaive_toolcall_en_demo.json3349 "value": "To create a stacked bar chart in D3.js, you can modify the code to use the D3.js `stack()` function to
MEDIUMdata/glaive_toolcall_en_demo.json3452 "value": "I'm sorry, but I'm unable to assist with booking flights as it's an external task. My current capabili
MEDIUMdata/glaive_toolcall_en_demo.json4143 "value": "I'm sorry, but I'm unable to assist with that. My current capabilities allow me to calculate Body Mass
MEDIUMdata/glaive_toolcall_en_demo.json4328 "value": "I'm sorry, but I'm unable to assist with that. My current capabilities are limited to generating invoi
MEDIUMdata/glaive_toolcall_en_demo.json5069 "value": "I'm sorry, but I'm unable to assist with booking flights. My current capabilities are limited to calcu
MEDIUMdata/glaive_toolcall_en_demo.json5818 "value": "I'm sorry, but I'm unable to perform external tasks like ordering a pizza. My current capabilities are
MEDIUMdata/glaive_toolcall_en_demo.json6538 "value": "I'm sorry, but I'm unable to perform external tasks such as ordering a pizza. My current capabilities
MEDIUMdata/glaive_toolcall_en_demo.json6667 "value": "I'm sorry, but I'm unable to assist with that. My current capabilities are limited to calculating the
MEDIUMdata/glaive_toolcall_en_demo.json6725 "value": "I'm sorry, but I'm unable to assist with that. Booking a flight is an external task and I don't have a
MEDIUMdata/glaive_toolcall_en_demo.json6809 "value": "I'm sorry, but I'm unable to perform external tasks like ordering a pizza. My capabilities are limited
MEDIUMdata/glaive_toolcall_en_demo.json6901 "value": "Sure, here is how you can compile the recipe from the JSON data:\nRecipe: Tomato Spaghetti\nIngredient
MEDIUMdata/glaive_toolcall_en_demo.json7020 "value": "I'm sorry, but I'm unable to assist with that. My current capabilities are limited to the functions pr
MEDIUMdata/glaive_toolcall_en_demo.json7592 "value": "I'm sorry, but I'm unable to assist with booking flights. My current capabilities are limited to gener
MEDIUMdata/glaive_toolcall_en_demo.json8510 "value": "I'm sorry, but I'm unable to assist with that. Booking a flight is an external task and I don't have a
MEDIUMdata/glaive_toolcall_en_demo.json8557 "value": "I'm sorry, but I'm unable to book movie tickets as it's an external task and I don't have a function p
MEDIUMdata/glaive_toolcall_en_demo.json8823 "value": "I'm sorry, but I'm unable to assist with booking flights. My current capabilities are limited to calcu
MEDIUMdata/glaive_toolcall_en_demo.json8984 "value": "I'm sorry, but I'm unable to assist with that. My current capabilities are limited to the functions pr
LOWdata/glaive_toolcall_en_demo.json1198 "value": "Here is your new password: a9B7$#fG3&Z1. Please make sure to save it in a secure place."
LOWdata/glaive_toolcall_en_demo.json1538 "value": "Here is your new password: aB3#fG7!kL9@. Please make sure to save it in a secure place."
LOWdata/glaive_toolcall_en_demo.json3130 "value": "Here is your new password: aB3#fG7!kL9@. Please make sure to save it in a secure place."
LOWdata/glaive_toolcall_en_demo.json3307 "value": "Here is your new password: aB3#fG7!kL9@. Please make sure to save it in a secure place."
LOWdata/glaive_toolcall_en_demo.json5718 "value": "Here is your new password: aB3#fG7!kL9@. Please make sure to save it in a secure place."
LOWdata/glaive_toolcall_en_demo.json6775 "value": "Here is your new password: aB3#fG7!kL9@. Please make sure to save it in a secure place."
LOWsrc/llamafactory/chat/sglang_engine.py127 self._cleanup_server() # make sure to clean up any started process
Deep Nesting83 hits · 82 pts
SeverityFileLineSnippet
LOWtests/data/test_collator.py140
LOWtests/data/test_mm_plugin.py117
LOWscripts/vllm_infer.py47
LOWscripts/llama_pro.py40
LOWscripts/convert_ckpt/llamafy_qwen.py39
LOWscripts/stat_utils/cal_mfu.py86
LOWsrc/llamafactory/launcher.py38
LOWsrc/llamafactory/v1/launcher.py34
LOWsrc/llamafactory/v1/core/base_trainer.py235
LOWsrc/llamafactory/v1/core/utils/rendering.py136
LOWsrc/llamafactory/v1/config/arg_utils.py61
LOWsrc/llamafactory/v1/plugins/trainer_plugins/batching.py118
LOW…actory/v1/plugins/trainer_plugins/distributed/fsdp2.py76
LOW…actory/v1/plugins/trainer_plugins/distributed/fsdp2.py193
LOW…actory/v1/plugins/trainer_plugins/distributed/fsdp2.py437
LOWsrc/llamafactory/v1/plugins/model_plugins/peft.py191
LOW…/v1/plugins/model_plugins/kernels/ops/rope/npu_rope.py136
LOW…ry/v1/plugins/model_plugins/templates/qwen3_nothink.py61
LOW…ry/v1/plugins/model_plugins/templates/qwen3_nothink.py170
LOW…amafactory/v1/plugins/model_plugins/templates/qwen3.py86
LOW…amafactory/v1/plugins/model_plugins/templates/qwen3.py111
LOW…amafactory/v1/plugins/model_plugins/templates/qwen3.py220
LOW…ins/model_plugins/parallelization/sequence_parallel.py129
LOWsrc/llamafactory/v1/plugins/data_plugins/converter.py104
LOWsrc/llamafactory/chat/hf_engine.py73
LOWsrc/llamafactory/chat/chat_model.py47
LOWsrc/llamafactory/hparams/parser.py304
LOWsrc/llamafactory/model/adapter.py141
LOWsrc/llamafactory/model/loader.py131
LOWsrc/llamafactory/model/model_utils/attention.py31
LOWsrc/llamafactory/model/model_utils/quantization.py82
LOWsrc/llamafactory/model/model_utils/liger_kernel.py30
LOWsrc/llamafactory/model/model_utils/moe.py160
LOWsrc/llamafactory/train/trainer_utils.py151
LOWsrc/llamafactory/train/trainer_utils.py200
LOWsrc/llamafactory/train/trainer_utils.py288
LOWsrc/llamafactory/train/trainer_utils.py372
LOWsrc/llamafactory/train/tuner.py68
LOWsrc/llamafactory/train/dpo/trainer.py45
LOWsrc/llamafactory/train/pt/workflow.py36
LOWsrc/llamafactory/train/sft/trainer.py50
LOWsrc/llamafactory/train/ppo/trainer.py311
LOWsrc/llamafactory/train/kto/trainer.py44
LOWsrc/llamafactory/train/rm/trainer.py113
LOWsrc/llamafactory/api/chat.py73
LOWsrc/llamafactory/webui/chatter.py101
LOWsrc/llamafactory/webui/control.py160
LOWsrc/llamafactory/webui/control.py209
LOWsrc/llamafactory/webui/components/export.py47
LOWsrc/llamafactory/webui/components/chatbot.py34
LOWsrc/llamafactory/webui/components/chatbot.py49
LOWsrc/llamafactory/data/formatter.py72
LOWsrc/llamafactory/data/mm_plugin.py257
LOWsrc/llamafactory/data/mm_plugin.py278
LOWsrc/llamafactory/data/mm_plugin.py624
LOWsrc/llamafactory/data/mm_plugin.py1015
LOWsrc/llamafactory/data/mm_plugin.py1118
LOWsrc/llamafactory/data/mm_plugin.py1158
LOWsrc/llamafactory/data/mm_plugin.py1930
LOWsrc/llamafactory/data/mm_plugin.py2358
23 more matches not shown…
Decorative Section Separators20 hits · 63 pts
SeverityFileLineSnippet
MEDIUM…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py45# ---------------------------------------------------------------------------
MEDIUM…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py47# ---------------------------------------------------------------------------
MEDIUM…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py245# ---------------------------------------------------------------------------
MEDIUM…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py247# ---------------------------------------------------------------------------
MEDIUM…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py267# ---------------------------------------------------------------------------
MEDIUM…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py269# ---------------------------------------------------------------------------
MEDIUM…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py328# ---------------------------------------------------------------------------
MEDIUM…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py330# ---------------------------------------------------------------------------
MEDIUM…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py349# ---------------------------------------------------------------------------
MEDIUM…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py351# ---------------------------------------------------------------------------
MEDIUM…s/model_plugins/kernels/ops/mlp/triton_grouped_gemm.py32# ---------------------------------------------------------------------------
MEDIUM…s/model_plugins/kernels/ops/mlp/triton_grouped_gemm.py34# ---------------------------------------------------------------------------
MEDIUM…s/model_plugins/kernels/ops/mlp/triton_grouped_gemm.py50# ---------------------------------------------------------------------------
MEDIUM…s/model_plugins/kernels/ops/mlp/triton_grouped_gemm.py53# ---------------------------------------------------------------------------
MEDIUM…s/model_plugins/kernels/ops/mlp/triton_grouped_gemm.py181# ---------------------------------------------------------------------------
MEDIUM…s/model_plugins/kernels/ops/mlp/triton_grouped_gemm.py184# ---------------------------------------------------------------------------
MEDIUM…s/model_plugins/kernels/ops/mlp/triton_grouped_gemm.py285# ---------------------------------------------------------------------------
MEDIUM…s/model_plugins/kernels/ops/mlp/triton_grouped_gemm.py287# ---------------------------------------------------------------------------
MEDIUM…s/model_plugins/kernels/ops/mlp/triton_grouped_gemm.py352# ---------------------------------------------------------------------------
MEDIUM…s/model_plugins/kernels/ops/mlp/triton_grouped_gemm.py354# ---------------------------------------------------------------------------
Cross-File Repetition10 hits · 50 pts
SeverityFileLineSnippet
HIGHsrc/llamafactory/v1/core/base_sampler.py0batch infer samples. args: dataset: torch dataset. returns: list of samples.
HIGHsrc/llamafactory/v1/core/utils/inference_engine.py0batch infer samples. args: dataset: torch dataset. returns: list of samples.
HIGHsrc/llamafactory/v1/core/utils/inference_engine.py0batch infer samples. args: dataset: torch dataset. returns: list of samples.
HIGHsrc/llamafactory/data/template.py0[tool_results] {"content": {{content}}}[/tool_results]
HIGHsrc/llamafactory/data/template.py0[tool_results] {"content": {{content}}}[/tool_results]
HIGHsrc/llamafactory/data/template.py0[tool_results] {"content": {{content}}}[/tool_results]
HIGHsrc/llamafactory/data/template.py0[tool_results]{"content": {{content}}}[/tool_results]
HIGHsrc/llamafactory/data/template.py0[tool_results]{"content": {{content}}}[/tool_results]
HIGHsrc/llamafactory/data/template.py0[tool_results]{"content": {{content}}}[/tool_results]
HIGHsrc/llamafactory/data/template.py0[tool_results]{"content": {{content}}}[/tool_results]
Excessive Try-Catch Wrapping48 hits · 48 pts
SeverityFileLineSnippet
LOWscripts/qwen_omni_merge.py86 except Exception:
LOWscripts/qwen_omni_merge.py135 except Exception:
LOWscripts/convert_ckpt/llamafy_qwen.py32except Exception:
LOWscripts/convert_ckpt/llamafy_qwen.py157 except Exception as e:
LOWscripts/convert_ckpt/llamafy_baichuan2.py104 except Exception as e:
LOW…actory/v1/plugins/trainer_plugins/distributed/fsdp2.py408 except Exception as e:
LOWsrc/llamafactory/v1/plugins/model_plugins/rendering.py36 except Exception as exc:
LOWsrc/llamafactory/v1/plugins/model_plugins/peft.py334 except Exception as e:
LOW…afactory/v1/plugins/model_plugins/kernels/interface.py71 except Exception as e:
LOW…/v1/plugins/model_plugins/kernels/ops/rope/npu_rope.py184 except Exception as e:
LOWsrc/llamafactory/v1/utils/packages.py44 except Exception:
LOWsrc/llamafactory/v1/samplers/cli_sampler.py101 except Exception:
LOWsrc/llamafactory/chat/sglang_engine.py122 except Exception as e:
LOWsrc/llamafactory/chat/sglang_engine.py125 except Exception as e:
LOWsrc/llamafactory/chat/sglang_engine.py137 except Exception as e:
LOWsrc/llamafactory/chat/sglang_engine.py288 except Exception:
LOWsrc/llamafactory/chat/chat_model.py180 except Exception:
LOWsrc/llamafactory/hparams/model_args.py250 except Exception as e:
LOWsrc/llamafactory/model/loader.py92 except Exception as e:
LOWsrc/llamafactory/model/loader.py109 except Exception as e:
LOWsrc/llamafactory/model/patcher.py426 except Exception:
LOWsrc/llamafactory/model/model_utils/valuehead.py47 except Exception as err:
LOWsrc/llamafactory/model/model_utils/valuehead.py53 except Exception as err:
LOWsrc/llamafactory/train/fp8_utils.py103 except Exception as e:
LOWsrc/llamafactory/train/trainer_utils.py876 except Exception:
LOWsrc/llamafactory/train/callbacks.py394 except Exception:
LOWsrc/llamafactory/train/tuner.py135 except Exception as e:
LOWsrc/llamafactory/train/tuner.py250 except Exception as e:
LOWsrc/llamafactory/train/ppo/trainer.py279 except Exception:
LOWsrc/llamafactory/train/mca/workflow.py156 except Exception:
LOWsrc/llamafactory/train/mca/workflow.py158 except Exception as exc:
LOWsrc/llamafactory/api/common.py66 except Exception:
LOWsrc/llamafactory/api/common.py95 except Exception as e:
LOWsrc/llamafactory/webui/common.py55 except Exception:
LOWsrc/llamafactory/webui/common.py79 except Exception:
LOWsrc/llamafactory/webui/common.py149 except Exception as err:
LOWsrc/llamafactory/webui/common.py159 except Exception:
LOWsrc/llamafactory/webui/components/chatbot.py45 except Exception:
LOWsrc/llamafactory/webui/components/data.py47 except Exception:
LOWsrc/llamafactory/data/parser.py111 except Exception as err:
LOWsrc/llamafactory/data/data_utils.py194 except Exception:
LOWsrc/llamafactory/extras/misc.py44except Exception:
LOWsrc/llamafactory/extras/env.py64 except Exception:
LOWsrc/llamafactory/extras/env.py71 except Exception:
LOWsrc/llamafactory/extras/env.py78 except Exception:
LOWsrc/llamafactory/extras/env.py85 except Exception:
LOWsrc/llamafactory/extras/env.py94 except Exception:
LOWsrc/llamafactory/extras/packages.py38 except Exception:
Docstring Block Structure7 hits · 35 pts
SeverityFileLineSnippet
HIGH…mafactory/v1/plugins/model_plugins/kernels/registry.py40Decorator to register a kernel class. The class must inherit from :class:`BaseKernel` and specify ``_kernel_id`
HIGH…y/v1/plugins/model_plugins/kernels/liger_kernel_ops.py64Applies the Liger kernel to the model. Args: **kwargs: Must include ``model``. Optional ``use_kerne
HIGH…/llamafactory/v1/plugins/model_plugins/kernels/base.py68Applies the kernel optimization to the model. Args: **kwargs: Arbitrary keyword arguments, usually
HIGH…ins/model_plugins/kernels/ops/rms_norm/npu_rms_norm.py135Iterate the model and apply NPU-optimized forward to matched RMSNorm modules. Matches modules whose class name
HIGH…/v1/plugins/model_plugins/kernels/ops/rope/npu_rope.py137Apply RoPE acceleration by monkey-patching ``apply_rotary_pos_emb``. Iterates through the model's modules to fi
HIGH…v1/plugins/model_plugins/kernels/ops/mlp/npu_swiglu.py129Applies the NPU fused SwiGLU kernel to the model. Args: **kwargs: Keyword arguments containing the
HIGH…plugins/model_plugins/kernels/ops/mlp/npu_fused_moe.py308Applies the NPU fused MoE kernel to the model. Args: **kwargs: Keyword arguments containing the mod
Self-Referential Comments15 hits · 34 pts
SeverityFileLineSnippet
MEDIUMtests_v1/plugins/model_plugins/test_peft.py43 # Create a dummy adapter
MEDIUMdata/kto_en_demo.json887 "content": "To smoothen the output polygons without creating gaps or overlaps, you can use a combination of libr
MEDIUMdata/kto_en_demo.json895 "content": "I apologize for the confusion. Let's try a different approach using the `TopologicalPreserveSimplifi
MEDIUMdata/kto_en_demo.json907 "content": "I have the following code:\n#%% Generate geoTiffs with index values based on one large geotiff with
MEDIUMdata/kto_en_demo.json919 "content": "To smoothen the output polygons without creating gaps or overlays between the polygons, you can use
MEDIUMdata/alpaca_en_demo.json2655 "output": "In order to build a random forest regression model to predict house prices, we need to organize the data
MEDIUMdata/alpaca_en_demo.json4405 "output": "The most efficient way to implement a sparse matrix in Python depends on the specifics of the matrix and
MEDIUMdata/glaive_toolcall_zh_demo.json7807 "value": "Sure, here's a sample Python code to generate the Excel table and some SQL queries to filter the anima
MEDIUMdata/glaive_toolcall_en_demo.json567 "value": "Yes, I can help you with that. Here's a sample code snippet that should do what you're looking for:\n`
MEDIUMdata/glaive_toolcall_en_demo.json575 "value": "Yes, you can modify the code snippet to rank the cities in ascending order by changing the `reverse` p
MEDIUMdata/glaive_toolcall_en_demo.json1625 "value": "To examine real-time usage patterns of public electric vehicle charging stations in a specific city us
MEDIUMdata/glaive_toolcall_en_demo.json2422 "value": "There are several algorithms that can be used to solve a Rubik's cube puzzle in Ruby programming langu
MEDIUMdata/glaive_toolcall_en_demo.json5185 "value": "Sure, here's a Python code that can generate a sequence of clues that reveal the identity of the grand
MEDIUMsrc/llamafactory/data/collator.py123 # Create a non-padding mask.
MEDIUMsrc/llamafactory/data/collator.py128 # Create a lower triangular mask.
Magic Placeholder Names3 hits · 15 pts
SeverityFileLineSnippet
HIGHREADME.md8211. Add `swanlab_api_key=<your_api_key>` to the yaml file, and set it to your [API key](https://swanlab.cn/settings).
HIGHREADME_zh.md825方式一:在 yaml 文件中添加 `swanlab_api_key=<your_api_key>` ,并设置为你的 [API 密钥](https://swanlab.cn/settings)。
HIGHdata/dpo_zh_demo.json3735 "value": "创建一个完整的程序像这样将是一个复杂且漫长的过程,涉及图形和音频处理。然而,我可以指导您完成初始步骤,并为您提供资源,帮助您构建项目的简单文本版本。\n\n要获取天气数据,您可以使用OpenWeatherMa
Verbosity Indicators7 hits · 12 pts
SeverityFileLineSnippet
LOWdata/glaive_toolcall_zh_demo.json7017 "value": "计算抛掷三颗骰子得到9点或以上的概率,其中至少有一颗骰子是质数,我们可以使用包含与排除原则。\n首先,我们需要计算在没有限制的情况下抛掷三颗骰子得到9点或以上的概率。这可以通过计算得到9点或以上的方式数,
LOW…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py167 # Step 1: Scatter grad_output to expert buffer
LOW…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py170 # Step 2: FC2 backward
LOW…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py191 # Step 3: Routing weight backward
LOW…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py200 # Step 4: SiLU gate backward
LOW…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py210 # Step 5: FC1 backward
LOW…lugins/model_plugins/kernels/ops/mlp/cuda_fused_moe.py231 # Step 6: Gather gradients back to original positions
Redundant / Tautological Comments7 hits · 8 pts
SeverityFileLineSnippet
LOWdata/alpaca_en_demo.json4535 "output": "Here is a function in Python that takes in a year as an input parameter and returns whether it is a leap
LOWdata/glaive_toolcall_zh_demo.json4859 "value": "```python\ndef calculate_summary(array, divisor):\n # Sort the array in descending order\n array
LOWdata/glaive_toolcall_zh_demo.json4859 "value": "```python\ndef calculate_summary(array, divisor):\n # Sort the array in descending order\n array
LOWdata/alpaca_zh_demo.json275 "output": "def calculate_sum(numbers):\n if not isinstance(numbers, list): # Check if input is a list\n r
LOWsrc/llamafactory/v1/core/base_trainer.py326 # Check if max_steps is reached
LOWsrc/llamafactory/train/ppo/trainer.py86 # Check if TRL version is compatible (0.8.6 <= version <= 0.9.6)
LOWsrc/llamafactory/data/collator.py310 # Check if position_ids shape matches expected shape.
Fake / Example Data4 hits · 6 pts
SeverityFileLineSnippet
LOWdata/glaive_toolcall_zh_demo.json664 "value": "在LaTeX中,你可以通过使用`endfloat`包来实现这一点。以下是方法:\n1. 在你的LaTeX文档的预览部分添加`usepackage{endfloat}`。\n2. 在你希望图表出现在文档中的
LOWdata/glaive_toolcall_zh_demo.json664 "value": "在LaTeX中,你可以通过使用`endfloat`包来实现这一点。以下是方法:\n1. 在你的LaTeX文档的预览部分添加`usepackage{endfloat}`。\n2. 在你希望图表出现在文档中的
LOWdata/glaive_toolcall_zh_demo.json672 "value": "在您的LaTeX文档中,您可以通过使用`tableofcontents`命令来创建目录。以下是方法:\n1. 在您希望目录出现在文档中的位置添加`tableofcontents`命令。\n2. 编译您的L
LOWdata/glaive_toolcall_zh_demo.json672 "value": "在您的LaTeX文档中,您可以通过使用`tableofcontents`命令来创建目录。以下是方法:\n1. 在您希望目录出现在文档中的位置添加`tableofcontents`命令。\n2. 编译您的L
Synthetic Comment Markers2 hits · 5 pts
SeverityFileLineSnippet
HIGHtests/data/test_template.py236 "# ollama modelfile auto-generated by llamafactory\n\n"
HIGHsrc/llamafactory/data/template.py323 modelfile = "# ollama modelfile auto-generated by llamafactory\n\n"
AI Slop Vocabulary2 hits · 4 pts
SeverityFileLineSnippet
MEDIUMdata/kto_en_demo.json2769 "content": "As an Azure Cloud Engineer working with Microsoft Azure, you can indeed utilize Azure Active Directo
MEDIUMdata/alpaca_en_demo.json3485 "output": "John Smith's Resume\n\nSummary:\n\nAn experienced and highly skilled software engineer with over 5 years
Example Usage Blocks1 hit · 2 pts
SeverityFileLineSnippet
LOWexamples/ascend/qwen3_5_full_sft_fsdp2.yaml2# Usage: