SYMBOL INDEX (1376 symbols across 213 files) FILE: docs/_static/js/switcher.js function buildSwitcher (line 9) | function buildSwitcher() { function hideOtherLanguageToc (line 41) | function hideOtherLanguageToc() { FILE: scripts/api_example/test_image.py function main (line 24) | def main(): FILE: scripts/api_example/test_toolcall.py function calculate_gpa (line 25) | def calculate_gpa(grades: list[str], hours: list[int]) -> float: function main (line 34) | def main(): FILE: scripts/bench_qwen.py class DummyDataset (line 32) | class DummyDataset(Dataset): method __init__ (line 33) | def __init__(self, size: int = 1000, seq_length: int = 1024, processor... method __len__ (line 54) | def __len__(self): method __getitem__ (line 57) | def __getitem__(self, index: int): class MultiModalDataCollatorForSeq2Seq (line 79) | class MultiModalDataCollatorForSeq2Seq(DataCollatorForSeq2Seq): method __post_init__ (line 80) | def __post_init__(self): method __call__ (line 91) | def __call__(self, features: list[dict[str, Any]]) -> dict[str, "torch... function bench_qwen (line 119) | def bench_qwen( FILE: scripts/convert_ckpt/llamafy_baichuan2.py function save_weight (line 31) | def save_weight(input_dir: str, output_dir: str, shard_size: str, save_s... function save_config (line 76) | def save_config(input_dir: str, output_dir: str): function llamafy_baichuan2 (line 91) | def llamafy_baichuan2( FILE: scripts/convert_ckpt/llamafy_qwen.py function save_weight (line 39) | def save_weight(input_dir: str, output_dir: str, shard_size: str, save_s... function save_config (line 113) | def save_config(input_dir: str, output_dir: str, torch_dtype: str): function llamafy_qwen (line 144) | def llamafy_qwen( FILE: scripts/eval_bleu_rouge.py function compute_metrics (line 35) | def compute_metrics(sample): function main (line 61) | def main(filename: str): FILE: scripts/hf2dcp.py function convert (line 31) | def convert(hf_path: str, dcp_path: str) -> None: function help (line 49) | def help() -> None: FILE: scripts/llama_pro.py function change_name (line 36) | def change_name(name: str, old_index: int, new_index: int) -> str: function block_expansion (line 40) | def block_expansion( FILE: scripts/loftq_init.py function quantize_loftq (line 30) | def quantize_loftq( FILE: scripts/megatron_merge.py function convert_mca_to_hf (line 31) | def convert_mca_to_hf( function convert (line 64) | def convert( function main (line 125) | def main(): FILE: scripts/pissa_init.py function quantize_pissa (line 30) | def quantize_pissa( FILE: scripts/qwen_omni_merge.py function merge_lora (line 36) | def merge_lora( function save_full_model (line 90) | def save_full_model( FILE: scripts/stat_utils/cal_flops.py function calculate_flops (line 26) | def calculate_flops( FILE: scripts/stat_utils/cal_lr.py function calculate_lr (line 37) | def calculate_lr( FILE: scripts/stat_utils/cal_mfu.py function compute_model_flops (line 29) | def compute_model_flops( function compute_device_flops (line 86) | def compute_device_flops(world_size: int) -> float: function calculate_mfu (line 101) | def calculate_mfu( FILE: scripts/stat_utils/cal_ppl.py class PairwiseDataCollatorWithPadding (line 32) | class PairwiseDataCollatorWithPadding(MultiModalDataCollatorForSeq2Seq): method __call__ (line 37) | def __call__(self, features: list[dict[str, Any]]) -> dict[str, torch.... function calculate_ppl (line 55) | def calculate_ppl( FILE: scripts/stat_utils/length_cdf.py function length_cdf (line 25) | def length_cdf( FILE: scripts/vllm_infer.py function _need_video_kwargs (line 39) | def _need_video_kwargs(template): function vllm_infer (line 47) | def vllm_infer( FILE: src/api.py function main (line 23) | def main(): FILE: src/llamafactory/api/app.py function sweeper (line 54) | async def sweeper() -> None: function lifespan (line 61) | async def lifespan(app: "FastAPI", chat_model: "ChatModel"): # collects... function create_app (line 69) | def create_app(chat_model: "ChatModel") -> "FastAPI": function run_api (line 127) | def run_api() -> None: FILE: src/llamafactory/api/chat.py function _process_request (line 73) | def _process_request( function _create_stream_chat_completion_chunk (line 181) | def _create_stream_chat_completion_chunk( function create_chat_completion_response (line 193) | async def create_chat_completion_response( function create_stream_chat_completion_response (line 247) | async def create_stream_chat_completion_response( function create_score_evaluation_response (line 286) | async def create_score_evaluation_response( FILE: src/llamafactory/api/common.py function dictify (line 38) | def dictify(data: "BaseModel") -> dict[str, Any]: function jsonify (line 45) | def jsonify(data: "BaseModel") -> str: function check_lfi_path (line 52) | def check_lfi_path(path: str) -> None: function check_ssrf_url (line 70) | def check_ssrf_url(url: str) -> None: FILE: src/llamafactory/api/protocol.py class Role (line 23) | class Role(StrEnum): class Finish (line 32) | class Finish(StrEnum): class ModelCard (line 38) | class ModelCard(BaseModel): class ModelList (line 45) | class ModelList(BaseModel): class Function (line 50) | class Function(BaseModel): class FunctionDefinition (line 55) | class FunctionDefinition(BaseModel): class FunctionAvailable (line 61) | class FunctionAvailable(BaseModel): class FunctionCall (line 66) | class FunctionCall(BaseModel): class URL (line 72) | class URL(BaseModel): class MultimodalInputItem (line 77) | class MultimodalInputItem(BaseModel): class ChatMessage (line 85) | class ChatMessage(BaseModel): class ChatCompletionMessage (line 91) | class ChatCompletionMessage(BaseModel): class ChatCompletionRequest (line 97) | class ChatCompletionRequest(BaseModel): class ChatCompletionResponseChoice (line 111) | class ChatCompletionResponseChoice(BaseModel): class ChatCompletionStreamResponseChoice (line 117) | class ChatCompletionStreamResponseChoice(BaseModel): class ChatCompletionResponseUsage (line 123) | class ChatCompletionResponseUsage(BaseModel): class ChatCompletionResponse (line 129) | class ChatCompletionResponse(BaseModel): class ChatCompletionStreamResponse (line 138) | class ChatCompletionStreamResponse(BaseModel): class ScoreEvaluationRequest (line 146) | class ScoreEvaluationRequest(BaseModel): class ScoreEvaluationResponse (line 152) | class ScoreEvaluationResponse(BaseModel): FILE: src/llamafactory/chat/base_engine.py class Response (line 32) | class Response: class BaseEngine (line 39) | class BaseEngine(ABC): method __init__ (line 53) | def __init__( method chat (line 64) | async def chat( method stream_chat (line 78) | async def stream_chat( method get_scores (line 92) | async def get_scores( FILE: src/llamafactory/chat/chat_model.py function _start_background_loop (line 34) | def _start_background_loop(loop: "asyncio.AbstractEventLoop") -> None: class ChatModel (line 39) | class ChatModel: method __init__ (line 47) | def __init__(self, args: Optional[dict[str, Any]] = None) -> None: method chat (line 91) | def chat( method achat (line 107) | async def achat( method stream_chat (line 120) | def stream_chat( method astream_chat (line 139) | async def astream_chat( method get_scores (line 155) | def get_scores( method aget_scores (line 164) | async def aget_scores( function run_chat (line 173) | def run_chat() -> None: FILE: src/llamafactory/chat/hf_engine.py class HuggingfaceEngine (line 44) | class HuggingfaceEngine(BaseEngine): method __init__ (line 45) | def __init__( method _process_args (line 73) | def _process_args( method _chat (line 212) | def _chat( method _stream_chat (line 267) | def _stream_chat( method _get_scores (line 314) | def _get_scores( method chat (line 335) | async def chat( method stream_chat (line 366) | async def stream_chat( method get_scores (line 402) | async def get_scores( FILE: src/llamafactory/chat/kt_engine.py class KTransformersEngine (line 51) | class KTransformersEngine(BaseEngine): method __init__ (line 52) | def __init__( method _get_scores (line 88) | def _get_scores( method _generate (line 108) | async def _generate( method chat (line 220) | async def chat( method stream_chat (line 254) | async def stream_chat( method get_scores (line 275) | async def get_scores( FILE: src/llamafactory/chat/sglang_engine.py class SGLangEngine (line 46) | class SGLangEngine(BaseEngine): method __init__ (line 58) | def __init__( method _cleanup_server (line 130) | def _cleanup_server(self): method _generate (line 140) | async def _generate( method chat (line 232) | async def chat( method stream_chat (line 258) | async def stream_chat( method get_scores (line 276) | async def get_scores( method __del__ (line 283) | def __del__(self): FILE: src/llamafactory/chat/vllm_engine.py class VllmEngine (line 46) | class VllmEngine(BaseEngine): method __init__ (line 47) | def __init__( method _generate (line 111) | async def _generate( method chat (line 216) | async def chat( method stream_chat (line 245) | async def stream_chat( method get_scores (line 263) | async def get_scores( FILE: src/llamafactory/cli.py function main (line 16) | def main(): FILE: src/llamafactory/data/collator.py function prepare_4d_attention_mask (line 42) | def prepare_4d_attention_mask(attention_mask_with_indices: "torch.Tensor... class MultiModalDataCollatorForSeq2Seq (line 86) | class MultiModalDataCollatorForSeq2Seq(DataCollatorForSeq2Seq): method __post_init__ (line 95) | def __post_init__(self): method __call__ (line 109) | def __call__(self, features: list[dict[str, Any]]) -> dict[str, "torch... class SFTDataCollatorWith4DAttentionMask (line 258) | class SFTDataCollatorWith4DAttentionMask(MultiModalDataCollatorForSeq2Seq): method __call__ (line 265) | def __call__(self, features: list[dict[str, Any]]) -> dict[str, "torch... class PairwiseDataCollatorWithPadding (line 278) | class PairwiseDataCollatorWithPadding(MultiModalDataCollatorForSeq2Seq): method __call__ (line 281) | def __call__(self, features: list[dict[str, Any]]) -> dict[str, "torch... class KTODataCollatorWithPadding (line 304) | class KTODataCollatorWithPadding(MultiModalDataCollatorForSeq2Seq): method __call__ (line 307) | def __call__(self, features: list[dict[str, Any]]) -> dict[str, "torch... FILE: src/llamafactory/data/converter.py class DatasetConverter (line 39) | class DatasetConverter: method _find_medias (line 43) | def _find_medias(self, medias: Union["MediaType", list["MediaType"], N... method __call__ (line 79) | def __call__(self, example: dict[str, Any]) -> dict[str, Any]: class AlpacaDatasetConverter (line 85) | class AlpacaDatasetConverter(DatasetConverter): method __call__ (line 86) | def __call__(self, example: dict[str, Any]) -> dict[str, Any]: class SharegptDatasetConverter (line 135) | class SharegptDatasetConverter(DatasetConverter): method __call__ (line 136) | def __call__(self, example: dict[str, Any]) -> dict[str, Any]: class OpenAIDatasetConverter (line 231) | class OpenAIDatasetConverter(DatasetConverter): method __call__ (line 232) | def __call__(self, example: dict[str, Any]) -> dict[str, Any]: function register_dataset_converter (line 377) | def register_dataset_converter(name: str, dataset_converter: type["Datas... function get_dataset_converter (line 385) | def get_dataset_converter(name: str, dataset_attr: "DatasetAttr", data_a... function align_dataset (line 393) | def align_dataset( FILE: src/llamafactory/data/data_utils.py class Role (line 38) | class Role(StrEnum): class DatasetModule (line 46) | class DatasetModule(TypedDict): function merge_dataset (line 51) | def merge_dataset( function split_dataset (line 85) | def split_dataset( function get_dataset_module (line 134) | def get_dataset_module(dataset: Union["Dataset", "DatasetDict"]) -> "Dat... function setup_fs (line 158) | def setup_fs(path: str, anon: bool = False) -> "fsspec.AbstractFileSystem": function _read_json_with_fs (line 174) | def _read_json_with_fs(fs: "fsspec.AbstractFileSystem", path: str) -> li... function read_cloud_json (line 183) | def read_cloud_json(cloud_path: str) -> list[Any]: FILE: src/llamafactory/data/formatter.py class Formatter (line 27) | class Formatter(ABC): method apply (line 32) | def apply(self, **kwargs) -> SLOTS: method extract (line 36) | def extract(self, content: str) -> str | list["FunctionCall"]: class EmptyFormatter (line 45) | class EmptyFormatter(Formatter): method __post_init__ (line 46) | def __post_init__(self): method apply (line 56) | def apply(self, **kwargs) -> SLOTS: class StringFormatter (line 61) | class StringFormatter(Formatter): method __post_init__ (line 62) | def __post_init__(self): method apply (line 72) | def apply(self, **kwargs) -> SLOTS: class FunctionFormatter (line 91) | class FunctionFormatter(StringFormatter): method __post_init__ (line 92) | def __post_init__(self): method apply (line 97) | def apply(self, **kwargs) -> SLOTS: class ToolFormatter (line 144) | class ToolFormatter(Formatter): method __post_init__ (line 145) | def __post_init__(self): method apply (line 149) | def apply(self, **kwargs) -> SLOTS: method extract (line 158) | def extract(self, content: str) -> str | list["FunctionCall"]: FILE: src/llamafactory/data/loader.py function _load_single_dataset (line 51) | def _load_single_dataset( function _get_merged_dataset (line 164) | def _get_merged_dataset( function _get_dataset_processor (line 189) | def _get_dataset_processor( function _get_preprocessed_dataset (line 229) | def _get_preprocessed_dataset( function get_dataset (line 276) | def get_dataset( FILE: src/llamafactory/data/mm_plugin.py class EncodedImage (line 65) | class EncodedImage(TypedDict): class RegularizedImageOutput (line 73) | class RegularizedImageOutput(TypedDict): class RegularizedVideoOutput (line 76) | class RegularizedVideoOutput(TypedDict): class RegularizedAudioOutput (line 81) | class RegularizedAudioOutput(TypedDict): class MMProcessor (line 85) | class MMProcessor(ProcessorMixin): method _get_number_of_features (line 91) | def _get_number_of_features(self, orig_height: int, orig_width: int, h... function _get_paligemma_token_type_ids (line 95) | def _get_paligemma_token_type_ids(imglens: list[int], seqlens: list[int]... function _get_gemma3_token_type_ids (line 112) | def _get_gemma3_token_type_ids(batch_ids: list[list[int]], processor: "M... function _make_batched_images (line 130) | def _make_batched_images(images: list["ImageObject"], imglens: list[int]... function _check_video_is_nested_images (line 140) | def _check_video_is_nested_images(video: "VideoInput") -> bool: class MMPluginMixin (line 146) | class MMPluginMixin: method _validate_input (line 152) | def _validate_input( method _validate_messages (line 194) | def _validate_messages( method _preprocess_image (line 223) | def _preprocess_image( method _get_video_sample_indices (line 242) | def _get_video_sample_indices( method _regularize_images (line 254) | def _regularize_images(self, images: list["ImageInput"], **kwargs) -> ... method _regularize_videos (line 275) | def _regularize_videos(self, videos: list["VideoInput"], **kwargs) -> ... method _regularize_audios (line 306) | def _regularize_audios( method _get_mm_inputs (line 327) | def _get_mm_inputs( class BasePlugin (line 417) | class BasePlugin(MMPluginMixin): method process_messages (line 418) | def process_messages( method process_token_ids (line 430) | def process_token_ids( method get_mm_inputs (line 444) | def get_mm_inputs( class ErnieVLPlugin (line 473) | class ErnieVLPlugin(BasePlugin): method process_messages (line 475) | def process_messages( class Gemma3Plugin (line 524) | class Gemma3Plugin(BasePlugin): method process_messages (line 526) | def process_messages( method get_mm_inputs (line 565) | def get_mm_inputs( class Gemma3nPlugin (line 583) | class Gemma3nPlugin(Gemma3Plugin): method process_messages (line 585) | def process_messages( class InternVLPlugin (line 617) | class InternVLPlugin(BasePlugin): method _get_mm_inputs (line 619) | def _get_mm_inputs( method process_messages (line 703) | def process_messages( method get_mm_inputs (line 748) | def get_mm_inputs( class KimiVLPlugin (line 767) | class KimiVLPlugin(BasePlugin): method process_messages (line 769) | def process_messages(self, messages, images, videos, audios, processor): class Llama4Plugin (line 799) | class Llama4Plugin(BasePlugin): method process_messages (line 801) | def process_messages( method get_mm_inputs (line 848) | def get_mm_inputs( class LlavaPlugin (line 866) | class LlavaPlugin(BasePlugin): method process_messages (line 868) | def process_messages( class LlavaNextPlugin (line 902) | class LlavaNextPlugin(BasePlugin): method process_messages (line 904) | def process_messages( class LlavaNextVideoPlugin (line 942) | class LlavaNextVideoPlugin(BasePlugin): method process_messages (line 944) | def process_messages( class MiniCPMVPlugin (line 997) | class MiniCPMVPlugin(BasePlugin): method _get_mm_inputs (line 999) | def _get_mm_inputs( method process_messages (line 1071) | def process_messages( method get_mm_inputs (line 1162) | def get_mm_inputs( class MllamaPlugin (line 1231) | class MllamaPlugin(BasePlugin): method process_messages (line 1233) | def process_messages( method get_mm_inputs (line 1253) | def get_mm_inputs( class PaliGemmaPlugin (line 1286) | class PaliGemmaPlugin(BasePlugin): method process_messages (line 1288) | def process_messages( method process_token_ids (line 1311) | def process_token_ids( method get_mm_inputs (line 1332) | def get_mm_inputs( class PixtralPlugin (line 1351) | class PixtralPlugin(BasePlugin): method process_messages (line 1353) | def process_messages( method get_mm_inputs (line 1398) | def get_mm_inputs( class Qwen2AudioPlugin (line 1420) | class Qwen2AudioPlugin(BasePlugin): method process_messages (line 1422) | def process_messages( method get_mm_inputs (line 1459) | def get_mm_inputs( class Qwen2VLPlugin (line 1475) | class Qwen2VLPlugin(BasePlugin): method _preprocess_image (line 1480) | def _preprocess_image(self, image: "ImageObject", **kwargs) -> "ImageO... method _regularize_videos (line 1497) | def _regularize_videos(self, videos: list["VideoInput"], **kwargs) -> ... method _get_mm_inputs (line 1534) | def _get_mm_inputs( method process_messages (line 1568) | def process_messages( class Qwen3VLPlugin (line 1617) | class Qwen3VLPlugin(Qwen2VLPlugin): method _get_mm_inputs (line 1619) | def _get_mm_inputs( method process_messages (line 1664) | def process_messages( class GLM4VPlugin (line 1740) | class GLM4VPlugin(Qwen2VLPlugin): method _get_mm_inputs (line 1742) | def _get_mm_inputs( method process_messages (line 1778) | def process_messages( method get_mm_inputs (line 1853) | def get_mm_inputs( class Qwen2OmniPlugin (line 1871) | class Qwen2OmniPlugin(Qwen2VLPlugin): method _get_mm_inputs (line 1876) | def _get_mm_inputs( method process_messages (line 1930) | def process_messages( class VideoLlavaPlugin (line 2052) | class VideoLlavaPlugin(BasePlugin): method process_messages (line 2054) | def process_messages( class LFMVLPlugin (line 2105) | class LFMVLPlugin(BasePlugin): method _get_mm_inputs (line 2114) | def _get_mm_inputs( method process_messages (line 2133) | def process_messages( class YoutuVLPlugin (line 2172) | class YoutuVLPlugin(BasePlugin): method process_messages (line 2179) | def process_messages( function register_mm_plugin (line 2231) | def register_mm_plugin(name: str, plugin_class: type["BasePlugin"]) -> N... function get_mm_plugin (line 2239) | def get_mm_plugin( FILE: src/llamafactory/data/parser.py class DatasetAttr (line 27) | class DatasetAttr: method __repr__ (line 66) | def __repr__(self) -> str: method set_attr (line 69) | def set_attr(self, key: str, obj: dict[str, Any], default: Any | None ... method join (line 72) | def join(self, attr: dict[str, Any]) -> None: function get_dataset_list (line 93) | def get_dataset_list(dataset_names: list[str] | None, dataset_dir: str |... FILE: src/llamafactory/data/processor/feedback.py class FeedbackDatasetProcessor (line 30) | class FeedbackDatasetProcessor(DatasetProcessor): method _encode_data_example (line 31) | def _encode_data_example( method preprocess_dataset (line 85) | def preprocess_dataset(self, examples: dict[str, list[Any]]) -> dict[s... method print_data_example (line 124) | def print_data_example(self, example: dict[str, list[int]]) -> None: FILE: src/llamafactory/data/processor/pairwise.py class PairwiseDatasetProcessor (line 30) | class PairwiseDatasetProcessor(DatasetProcessor): method _encode_data_example (line 31) | def _encode_data_example( method preprocess_dataset (line 71) | def preprocess_dataset(self, examples: dict[str, list[Any]]) -> dict[s... method print_data_example (line 102) | def print_data_example(self, example: dict[str, list[int]]) -> None: FILE: src/llamafactory/data/processor/pretrain.py class PretrainDatasetProcessor (line 26) | class PretrainDatasetProcessor(DatasetProcessor): method preprocess_dataset (line 27) | def preprocess_dataset(self, examples: dict[str, list[Any]]) -> dict[s... method print_data_example (line 55) | def print_data_example(self, example: dict[str, list[int]]) -> None: FILE: src/llamafactory/data/processor/processor_utils.py class DatasetProcessor (line 29) | class DatasetProcessor(ABC): method preprocess_dataset (line 38) | def preprocess_dataset(self, examples: dict[str, list[Any]]) -> dict[s... method print_data_example (line 43) | def print_data_example(self, example: dict[str, list[int]]) -> None: function search_for_fit (line 48) | def search_for_fit(numbers: list[int], capacity: int) -> int: function greedy_knapsack (line 54) | def greedy_knapsack(numbers: list[int], capacity: int) -> list[list[int]]: function infer_seqlen (line 76) | def infer_seqlen(source_len: int, target_len: int, cutoff_len: int) -> t... FILE: src/llamafactory/data/processor/supervised.py class SupervisedDatasetProcessor (line 32) | class SupervisedDatasetProcessor(DatasetProcessor): method _encode_data_example (line 33) | def _encode_data_example( method preprocess_dataset (line 88) | def preprocess_dataset(self, examples: dict[str, list[Any]]) -> dict[s... method print_data_example (line 117) | def print_data_example(self, example: dict[str, list[int]]) -> None: class PackedSupervisedDatasetProcessor (line 126) | class PackedSupervisedDatasetProcessor(SupervisedDatasetProcessor): method preprocess_dataset (line 127) | def preprocess_dataset(self, examples: dict[str, list[Any]]) -> dict[s... FILE: src/llamafactory/data/processor/unsupervised.py class UnsupervisedDatasetProcessor (line 30) | class UnsupervisedDatasetProcessor(DatasetProcessor): method _encode_data_example (line 31) | def _encode_data_example( method preprocess_dataset (line 59) | def preprocess_dataset(self, examples: dict[str, list[Any]]) -> dict[s... method print_data_example (line 87) | def print_data_example(self, example: dict[str, list[int]]) -> None: FILE: src/llamafactory/data/template.py class Template (line 41) | class Template: method encode_oneturn (line 59) | def encode_oneturn( method encode_multiturn (line 75) | def encode_multiturn( method extract_tool (line 86) | def extract_tool(self, content: str) -> Union[str, list["FunctionCall"]]: method get_stop_token_ids (line 90) | def get_stop_token_ids(self, tokenizer: "PreTrainedTokenizer") -> list... method add_thought (line 98) | def add_thought(self, content: str = "") -> str: method remove_thought (line 102) | def remove_thought(self, content: str) -> str: method get_thought_word_ids (line 107) | def get_thought_word_ids(self, tokenizer: "PreTrainedTokenizer") -> li... method _convert_elements_to_ids (line 111) | def _convert_elements_to_ids(self, tokenizer: "PreTrainedTokenizer", e... method _encode (line 130) | def _encode( method _add_or_replace_eos_token (line 171) | def _add_or_replace_eos_token(tokenizer: "PreTrainedTokenizer", eos_to... method fix_special_tokens (line 187) | def fix_special_tokens(self, tokenizer: "PreTrainedTokenizer") -> None: method _jinja_escape (line 216) | def _jinja_escape(content: str) -> str: method _convert_slots_to_jinja (line 221) | def _convert_slots_to_jinja(slots: "SLOTS", tokenizer: "PreTrainedToke... method _get_jinja_template (line 243) | def _get_jinja_template(self, tokenizer: "PreTrainedTokenizer") -> str: method fix_jinja_template (line 271) | def fix_jinja_template(self, tokenizer: "PreTrainedTokenizer") -> None: method _convert_slots_to_ollama (line 280) | def _convert_slots_to_ollama( method _get_ollama_template (line 304) | def _get_ollama_template(self, tokenizer: "PreTrainedTokenizer") -> str: method get_ollama_modelfile (line 316) | def get_ollama_modelfile(self, tokenizer: "PreTrainedTokenizer") -> str: class Llama2Template (line 335) | class Llama2Template(Template): method _encode (line 339) | def _encode( method _get_jinja_template (line 373) | def _get_jinja_template(self, tokenizer: "PreTrainedTokenizer") -> str: class ReasoningTemplate (line 405) | class ReasoningTemplate(Template): method encode_oneturn (line 409) | def encode_oneturn( method encode_multiturn (line 436) | def encode_multiturn( class Glm47ReasoningTemplate (line 463) | class Glm47ReasoningTemplate(ReasoningTemplate): method add_thought (line 467) | def add_thought(self, content: str = "") -> str: function register_template (line 477) | def register_template( function parse_template (line 550) | def parse_template(tokenizer: "PreTrainedTokenizer") -> "Template": function get_template_and_fix_tokenizer (line 612) | def get_template_and_fix_tokenizer(tokenizer: "PreTrainedTokenizer", dat... FILE: src/llamafactory/data/tool_utils.py class FunctionCall (line 26) | class FunctionCall(NamedTuple): class ToolUtils (line 124) | class ToolUtils(ABC): method tool_formatter (line 129) | def tool_formatter(tools: list[dict[str, Any]]) -> str: method function_formatter (line 135) | def function_formatter(functions: list["FunctionCall"]) -> str: method tool_extractor (line 141) | def tool_extractor(content: str) -> Union[str, list["FunctionCall"]]: class DefaultToolUtils (line 149) | class DefaultToolUtils(ToolUtils): method tool_formatter (line 154) | def tool_formatter(tools: list[dict[str, Any]]) -> str: method function_formatter (line 189) | def function_formatter(functions: list["FunctionCall"]) -> str: method tool_extractor (line 194) | def tool_extractor(content: str) -> Union[str, list["FunctionCall"]]: class GLM4ToolUtils (line 213) | class GLM4ToolUtils(ToolUtils): method tool_formatter (line 218) | def tool_formatter(tools: list[dict[str, Any]]) -> str: method function_formatter (line 230) | def function_formatter(functions: list["FunctionCall"]) -> str: method tool_extractor (line 238) | def tool_extractor(content: str) -> Union[str, list["FunctionCall"]]: class Llama3ToolUtils (line 251) | class Llama3ToolUtils(ToolUtils): method tool_formatter (line 259) | def tool_formatter(tools: list[dict[str, Any]]) -> str: method function_formatter (line 270) | def function_formatter(functions: list["FunctionCall"]) -> str: method tool_extractor (line 276) | def tool_extractor(content: str) -> Union[str, list["FunctionCall"]]: class MiniMaxM1ToolUtils (line 289) | class MiniMaxM1ToolUtils(ToolUtils): method tool_formatter (line 294) | def tool_formatter(tools: list[dict[str, Any]]) -> str: method function_formatter (line 304) | def function_formatter(functions: list["FunctionCall"]) -> str: method tool_extractor (line 314) | def tool_extractor(content: str) -> Union[str, list["FunctionCall"]]: class MiniMaxM2ToolUtils (line 336) | class MiniMaxM2ToolUtils(ToolUtils): method tool_formatter (line 341) | def tool_formatter(tools: list[dict[str, Any]]) -> str: method function_formatter (line 351) | def function_formatter(functions: list["FunctionCall"]) -> str: method tool_extractor (line 366) | def tool_extractor(content: str) -> Union[str, list["FunctionCall"]]: class MistralToolUtils (line 392) | class MistralToolUtils(ToolUtils): method tool_formatter (line 397) | def tool_formatter(tools: list[dict[str, Any]]) -> str: method function_formatter (line 406) | def function_formatter(functions: list["FunctionCall"]) -> str: method tool_extractor (line 413) | def tool_extractor(content: str) -> Union[str, list["FunctionCall"]]: class QwenToolUtils (line 426) | class QwenToolUtils(ToolUtils): method tool_formatter (line 431) | def tool_formatter(tools: list[dict[str, Any]]) -> str: method function_formatter (line 441) | def function_formatter(functions: list["FunctionCall"]) -> str: method tool_extractor (line 450) | def tool_extractor(content: str) -> Union[str, list["FunctionCall"]]: class Qwen35ToolUtils (line 471) | class Qwen35ToolUtils(ToolUtils): method tool_formatter (line 476) | def tool_formatter(tools: list[dict[str, Any]]) -> str: method function_formatter (line 486) | def function_formatter(functions: list["FunctionCall"]) -> str: method tool_extractor (line 503) | def tool_extractor(content: str) -> Union[str, list["FunctionCall"]]: class GLM4MOEToolUtils (line 522) | class GLM4MOEToolUtils(QwenToolUtils): method tool_formatter (line 527) | def tool_formatter(tools: list[dict[str, Any]]) -> str: method function_formatter (line 537) | def function_formatter(functions: list["FunctionCall"]) -> str: class SeedToolUtils (line 554) | class SeedToolUtils(ToolUtils): method tool_formatter (line 559) | def tool_formatter(tools: list[dict[str, Any]]) -> str: method function_formatter (line 564) | def function_formatter(functions: list["FunctionCall"]) -> str: method tool_extractor (line 583) | def tool_extractor(content: str) -> Union[str, list["FunctionCall"]]: class LingToolUtils (line 604) | class LingToolUtils(QwenToolUtils): method tool_formatter (line 609) | def tool_formatter(tools: list[dict[str, Any]]) -> str: class LFM2ToolUtils (line 618) | class LFM2ToolUtils(ToolUtils): method tool_formatter (line 623) | def tool_formatter(tools: list[dict[str, Any]]) -> str: method function_formatter (line 633) | def function_formatter(functions: list["FunctionCall"]) -> str: method _ast_to_value (line 649) | def _ast_to_value(node: ast.AST) -> Any: method tool_extractor (line 667) | def tool_extractor(content: str) -> Union[str, list["FunctionCall"]]: function get_tool_utils (line 738) | def get_tool_utils(name: str) -> "ToolUtils": FILE: src/llamafactory/eval/evaluator.py class Evaluator (line 61) | class Evaluator: method __init__ (line 62) | def __init__(self, args: Optional[dict[str, Any]] = None) -> None: method batch_inference (line 72) | def batch_inference(self, batch_input: dict[str, "torch.Tensor"]) -> l... method eval (line 79) | def eval(self) -> None: method _save_results (line 139) | def _save_results(self, category_corrects: dict[str, "NDArray"], resul... function run_eval (line 157) | def run_eval() -> None: FILE: src/llamafactory/eval/template.py class EvalTemplate (line 22) | class EvalTemplate: method _parse_example (line 27) | def _parse_example(self, example: dict[str, str]) -> tuple[str, str]: method format_example (line 36) | def format_example( function _register_eval_template (line 56) | def _register_eval_template(name: str, system: str, choice: str, answer:... function get_eval_template (line 60) | def get_eval_template(name: str) -> "EvalTemplate": FILE: src/llamafactory/extras/constants.py class AttentionFunction (line 116) | class AttentionFunction(StrEnum): class EngineName (line 124) | class EngineName(StrEnum): class DownloadSource (line 131) | class DownloadSource(StrEnum): class QuantizationMethod (line 138) | class QuantizationMethod(StrEnum): class RopeScaling (line 152) | class RopeScaling(StrEnum): function register_model_group (line 159) | def register_model_group( FILE: src/llamafactory/extras/env.py function print_env (line 25) | def print_env() -> None: FILE: src/llamafactory/extras/logging.py class LoggerHandler (line 34) | class LoggerHandler(logging.Handler): method __init__ (line 37) | def __init__(self, output_dir: str) -> None: method _write_log (line 52) | def _write_log(self, log_entry: str) -> None: method emit (line 56) | def emit(self, record) -> None: method close (line 63) | def close(self) -> None: class _Logger (line 68) | class _Logger(logging.Logger): method info_rank0 (line 71) | def info_rank0(self, *args, **kwargs) -> None: method warning_rank0 (line 74) | def warning_rank0(self, *args, **kwargs) -> None: method warning_rank0_once (line 77) | def warning_rank0_once(self, *args, **kwargs) -> None: function _get_default_logging_level (line 81) | def _get_default_logging_level() -> "logging._Level": function _get_library_name (line 93) | def _get_library_name() -> str: function _get_library_root_logger (line 97) | def _get_library_root_logger() -> "_Logger": function _configure_library_root_logger (line 101) | def _configure_library_root_logger() -> None: function get_logger (line 121) | def get_logger(name: str | None = None) -> "_Logger": function add_handler (line 130) | def add_handler(handler: "logging.Handler") -> None: function remove_handler (line 136) | def remove_handler(handler: logging.Handler) -> None: function info_rank0 (line 142) | def info_rank0(self: "logging.Logger", *args, **kwargs) -> None: function warning_rank0 (line 147) | def warning_rank0(self: "logging.Logger", *args, **kwargs) -> None: function warning_rank0_once (line 153) | def warning_rank0_once(self: "logging.Logger", *args, **kwargs) -> None: FILE: src/llamafactory/extras/misc.py class AverageMeter (line 57) | class AverageMeter: method __init__ (line 60) | def __init__(self): method reset (line 63) | def reset(self): method update (line 69) | def update(self, val, n=1): function check_version (line 76) | def check_version(requirement: str, mandatory: bool = False) -> None: function check_dependencies (line 95) | def check_dependencies() -> None: function calculate_tps (line 104) | def calculate_tps(dataset: list[dict[str, Any]], metrics: dict[str, floa... function count_parameters (line 117) | def count_parameters(model: "torch.nn.Module") -> tuple[int, int]: function get_current_device (line 144) | def get_current_device() -> "torch.device": function get_device_name (line 160) | def get_device_name() -> str: function get_torch_device (line 176) | def get_torch_device(): function get_device_count (line 187) | def get_device_count() -> int: function get_logits_processor (line 201) | def get_logits_processor() -> "LogitsProcessorList": function get_current_memory (line 208) | def get_current_memory() -> tuple[int, int]: function get_peak_memory (line 222) | def get_peak_memory() -> tuple[int, int]: function has_tokenized_data (line 236) | def has_tokenized_data(path: "os.PathLike") -> bool: function infer_optim_dtype (line 241) | def infer_optim_dtype(model_dtype: Optional["torch.dtype"]) -> "torch.dt... function is_accelerator_available (line 251) | def is_accelerator_available() -> bool: function is_env_enabled (line 258) | def is_env_enabled(env_var: str, default: str = "0") -> bool: function numpify (line 263) | def numpify(inputs: Union["NDArray", "torch.Tensor"]) -> "NDArray": function skip_check_imports (line 275) | def skip_check_imports() -> None: function torch_gc (line 281) | def torch_gc() -> None: function try_download_model_from_other_hub (line 294) | def try_download_model_from_other_hub(model_args: "ModelArguments") -> str: function use_modelscope (line 331) | def use_modelscope() -> bool: function use_openmind (line 335) | def use_openmind() -> bool: function use_ray (line 339) | def use_ray() -> bool: function use_kt (line 343) | def use_kt() -> bool: function find_available_port (line 347) | def find_available_port() -> int: function fix_proxy (line 356) | def fix_proxy(ipv6_enabled: bool = False) -> None: FILE: src/llamafactory/extras/packages.py function _is_package_available (line 30) | def _is_package_available(name: str) -> bool: function _get_package_version (line 34) | def _get_package_version(name: str) -> "Version": function is_pyav_available (line 41) | def is_pyav_available(): function is_librosa_available (line 45) | def is_librosa_available(): function is_fastapi_available (line 49) | def is_fastapi_available(): function is_galore_available (line 53) | def is_galore_available(): function is_apollo_available (line 57) | def is_apollo_available(): function is_jieba_available (line 61) | def is_jieba_available(): function is_gradio_available (line 65) | def is_gradio_available(): function is_matplotlib_available (line 69) | def is_matplotlib_available(): function is_mcore_adapter_available (line 73) | def is_mcore_adapter_available(): function is_pillow_available (line 77) | def is_pillow_available(): function is_ray_available (line 81) | def is_ray_available(): function is_kt_available (line 85) | def is_kt_available(): function is_requests_available (line 89) | def is_requests_available(): function is_rouge_available (line 93) | def is_rouge_available(): function is_safetensors_available (line 97) | def is_safetensors_available(): function is_sglang_available (line 101) | def is_sglang_available(): function is_starlette_available (line 105) | def is_starlette_available(): function is_transformers_version_greater_than (line 110) | def is_transformers_version_greater_than(content: str): function is_torch_version_greater_than (line 115) | def is_torch_version_greater_than(content: str): function is_uvicorn_available (line 119) | def is_uvicorn_available(): function is_vllm_available (line 123) | def is_vllm_available(): FILE: src/llamafactory/extras/ploting.py function smooth (line 34) | def smooth(scalars: list[float]) -> list[float]: function gen_loss_plot (line 49) | def gen_loss_plot(trainer_log: list[dict[str, Any]]) -> "matplotlib.figu... function plot_loss (line 69) | def plot_loss(save_dictionary: str, keys: list[str] = ["loss"]) -> None: FILE: src/llamafactory/hparams/data_args.py class DataArguments (line 23) | class DataArguments: method __post_init__ (line 143) | def __post_init__(self): method to_dict (line 187) | def to_dict(self) -> dict[str, Any]: FILE: src/llamafactory/hparams/evaluation_args.py class EvaluationArguments (line 23) | class EvaluationArguments: method __post_init__ (line 58) | def __post_init__(self): FILE: src/llamafactory/hparams/finetuning_args.py class FreezeArguments (line 20) | class FreezeArguments: class LoraArguments (line 56) | class LoraArguments: class OFTArguments (line 126) | class OFTArguments: class RLHFArguments (line 168) | class RLHFArguments: class GaloreArguments (line 263) | class GaloreArguments: class ApolloArguments (line 302) | class ApolloArguments: class BAdamArgument (line 353) | class BAdamArgument: class SwanLabArguments (line 404) | class SwanLabArguments: class FinetuningArguments (line 444) | class FinetuningArguments( method __post_init__ (line 542) | def __post_init__(self): method to_dict (line 599) | def to_dict(self) -> dict[str, Any]: FILE: src/llamafactory/hparams/generating_args.py class GeneratingArguments (line 22) | class GeneratingArguments: method to_dict (line 70) | def to_dict(self, obey_generation_config: bool = False) -> dict[str, A... FILE: src/llamafactory/hparams/model_args.py class BaseModelArguments (line 34) | class BaseModelArguments: method __post_init__ (line 205) | def __post_init__(self): class QuantizationArguments (line 275) | class QuantizationArguments: class ProcessorArguments (line 301) | class ProcessorArguments: method __post_init__ (line 345) | def __post_init__(self): class ExportArguments (line 354) | class ExportArguments: method __post_init__ (line 394) | def __post_init__(self): class VllmArguments (line 400) | class VllmArguments: method __post_init__ (line 424) | def __post_init__(self): class SGLangArguments (line 430) | class SGLangArguments: method __post_init__ (line 456) | def __post_init__(self): class KTransformersArguments (line 462) | class KTransformersArguments: class ModelArguments (line 507) | class ModelArguments( method __post_init__ (line 542) | def __post_init__(self): method copyfrom (line 550) | def copyfrom(cls, source: "Self", **kwargs) -> "Self": method to_dict (line 565) | def to_dict(self) -> dict[str, Any]: FILE: src/llamafactory/hparams/parser.py function read_args (line 69) | def read_args(args: dict[str, Any] | list[str] | None = None) -> dict[st... function _parse_args (line 86) | def _parse_args( function _verify_trackio_args (line 103) | def _verify_trackio_args(training_args: "TrainingArguments") -> None: function _set_transformers_logging (line 149) | def _set_transformers_logging() -> None: function _set_env_vars (line 156) | def _set_env_vars() -> None: function _verify_model_args (line 164) | def _verify_model_args( function _check_extra_dependencies (line 189) | def _check_extra_dependencies( function _parse_train_args (line 241) | def _parse_train_args(args: dict[str, Any] | list[str] | None = None) ->... function _parse_train_mca_args (line 247) | def _parse_train_mca_args(args: dict[str, Any] | list[str] | None = None... function _configure_mca_training_args (line 259) | def _configure_mca_training_args(training_args, data_args, finetuning_ar... function _parse_infer_args (line 268) | def _parse_infer_args(args: dict[str, Any] | list[str] | None = None) ->... function _parse_eval_args (line 274) | def _parse_eval_args(args: dict[str, Any] | list[str] | None = None) -> ... function get_ray_args (line 280) | def get_ray_args(args: dict[str, Any] | list[str] | None = None) -> RayA... function get_train_args (line 286) | def get_train_args(args: dict[str, Any] | list[str] | None = None) -> _T... function get_infer_args (line 519) | def get_infer_args(args: dict[str, Any] | list[str] | None = None) -> _I... function get_eval_args (line 554) | def get_eval_args(args: dict[str, Any] | list[str] | None = None) -> _EV... FILE: src/llamafactory/hparams/training_args.py class RayArguments (line 39) | class RayArguments: method __post_init__ (line 59) | def __post_init__(self): class Fp8Arguments (line 67) | class Fp8Arguments: class TrainingArguments (line 90) | class TrainingArguments(Fp8Arguments, RayArguments, BaseTrainingArguments): method __post_init__ (line 98) | def __post_init__(self): FILE: src/llamafactory/launcher.py function launch (line 38) | def launch(): FILE: src/llamafactory/model/adapter.py function _setup_full_tuning (line 40) | def _setup_full_tuning( function _setup_freeze_tuning (line 59) | def _setup_freeze_tuning( function _setup_lora_tuning (line 143) | def _setup_lora_tuning( function init_adapter (line 321) | def init_adapter( FILE: src/llamafactory/model/loader.py class TokenizerModule (line 52) | class TokenizerModule(TypedDict): function _get_init_kwargs (line 57) | def _get_init_kwargs(model_args: "ModelArguments") -> dict[str, Any]: function load_tokenizer (line 72) | def load_tokenizer(model_args: "ModelArguments") -> "TokenizerModule": function load_config (line 126) | def load_config(model_args: "ModelArguments") -> "PretrainedConfig": function load_model (line 132) | def load_model( FILE: src/llamafactory/model/model_utils/attention.py function configure_attn_implementation (line 31) | def configure_attn_implementation(config: "PretrainedConfig", model_args... function print_attn_implementation (line 104) | def print_attn_implementation(config: "PretrainedConfig") -> None: FILE: src/llamafactory/model/model_utils/checkpointing.py function get_unsloth_gradient_checkpointing_func (line 43) | def get_unsloth_gradient_checkpointing_func() -> Callable: function get_custom_gradient_checkpointing_func (line 80) | def get_custom_gradient_checkpointing_func(gradient_checkpointing_func: ... function _gradient_checkpointing_enable (line 106) | def _gradient_checkpointing_enable( function _fp32_forward_post_hook (line 137) | def _fp32_forward_post_hook( function prepare_model_for_training (line 143) | def prepare_model_for_training(model: "PreTrainedModel", model_args: "Mo... FILE: src/llamafactory/model/model_utils/embedding.py function _noisy_mean_initialization (line 32) | def _noisy_mean_initialization(embed_weight: "torch.Tensor", num_new_tok... function _description_based_initialization (line 48) | def _description_based_initialization( function _initialize_embeddings (line 114) | def _initialize_embeddings( function resize_embedding_layer (line 153) | def resize_embedding_layer( FILE: src/llamafactory/model/model_utils/ktransformers.py function _get_kt_kwargs (line 48) | def _get_kt_kwargs( function load_kt_pretrained_model (line 69) | def load_kt_pretrained_model(config: "PretrainedConfig", model_args: "Mo... function get_kt_peft_model (line 117) | def get_kt_peft_model(model: "PreTrainedModel", peft_kwargs: dict[str, A... function load_kt_peft_model (line 124) | def load_kt_peft_model(model_args: "ModelArguments", model: "PreTrainedM... FILE: src/llamafactory/model/model_utils/kv_cache.py function configure_kv_cache (line 29) | def configure_kv_cache(config: "PretrainedConfig", model_args: "ModelArg... FILE: src/llamafactory/model/model_utils/liger_kernel.py function apply_liger_kernel (line 30) | def apply_liger_kernel( FILE: src/llamafactory/model/model_utils/longlora.py function llama_attention_forward (line 56) | def llama_attention_forward( function llama_flash_attention_2_forward (line 141) | def llama_flash_attention_2_forward( function llama_sdpa_attention_forward (line 249) | def llama_sdpa_attention_forward( function _apply_llama_patch (line 352) | def _apply_llama_patch() -> None: function configure_longlora (line 359) | def configure_longlora(config: "PretrainedConfig", model_args: "ModelArg... FILE: src/llamafactory/model/model_utils/misc.py function find_all_linear_modules (line 28) | def find_all_linear_modules(model: "PreTrainedModel", freeze_vision_towe... function find_expanded_modules (line 55) | def find_expanded_modules(model: "PreTrainedModel", target_modules: list... function register_autoclass (line 80) | def register_autoclass(config: "PretrainedConfig", model: "PreTrainedMod... FILE: src/llamafactory/model/model_utils/mod.py function load_mod_pretrained_model (line 26) | def load_mod_pretrained_model(**init_kwargs) -> "PreTrainedModel": function convert_pretrained_model_to_mod (line 32) | def convert_pretrained_model_to_mod( FILE: src/llamafactory/model/model_utils/moe.py function _set_z3_leaf_modules (line 36) | def _set_z3_leaf_modules(model: "PreTrainedModel", leaf_modules: list[Un... function add_z3_leaf_module (line 43) | def add_z3_leaf_module(model: "PreTrainedModel") -> None: function configure_moe (line 151) | def configure_moe(config: "PretrainedConfig", model_args: "ModelArgument... class Qwen3OmniMoeThinkerTextSparseMoeBlock (line 202) | class Qwen3OmniMoeThinkerTextSparseMoeBlock(nn.Module): method __init__ (line 203) | def __init__(self, config): method forward (line 220) | def forward(self, hidden_states: torch.Tensor) -> torch.Tensor: FILE: src/llamafactory/model/model_utils/packing.py function get_seqlens_in_batch (line 55) | def get_seqlens_in_batch(attention_mask: "torch.Tensor") -> "torch.Tensor": function get_unpad_data (line 81) | def get_unpad_data(attention_mask: "torch.Tensor") -> tuple["torch.Tenso... function configure_packing (line 110) | def configure_packing(model_args: "ModelArguments", is_trainable: bool) ... FILE: src/llamafactory/model/model_utils/quantization.py function _get_quantization_dataset (line 43) | def _get_quantization_dataset(tokenizer: "PreTrainedTokenizer", model_ar... function configure_quantization (line 82) | def configure_quantization( FILE: src/llamafactory/model/model_utils/rope.py function configure_rope (line 35) | def configure_rope(config: "PretrainedConfig", model_args: "ModelArgumen... FILE: src/llamafactory/model/model_utils/unsloth.py function _get_unsloth_kwargs (line 30) | def _get_unsloth_kwargs( function load_unsloth_pretrained_model (line 51) | def load_unsloth_pretrained_model( function get_unsloth_peft_model (line 68) | def get_unsloth_peft_model( function load_unsloth_peft_model (line 82) | def load_unsloth_peft_model( FILE: src/llamafactory/model/model_utils/valuehead.py function load_valuehead_params (line 33) | def load_valuehead_params(path_or_repo_id: str, model_args: "ModelArgume... function prepare_valuehead_model (line 61) | def prepare_valuehead_model(model: "PreTrainedModel") -> None: FILE: src/llamafactory/model/model_utils/visual.py class CompositeModel (line 41) | class CompositeModel: method get_projector (line 48) | def get_projector(self, module: "torch.nn.Module") -> "torch.nn.Module": function _register_composite_model (line 58) | def _register_composite_model( class LlavaMultiModalProjectorForYiVL (line 84) | class LlavaMultiModalProjectorForYiVL(torch.nn.Module): method __init__ (line 85) | def __init__(self, config: "LlavaConfig") -> None: method forward (line 98) | def forward(self, image_features: "torch.Tensor") -> "torch.Tensor": class LlavaMultiModalProjectorForYiVLForVLLM (line 118) | class LlavaMultiModalProjectorForYiVLForVLLM(LlavaMultiModalProjectorFor... method __init__ (line 119) | def __init__(self, vision_hidden_size: int, text_hidden_size: int, pro... function autocast_projector_dtype (line 129) | def autocast_projector_dtype(model: "PreTrainedModel", model_args: "Mode... function configure_visual_model (line 148) | def configure_visual_model(config: "PretrainedConfig") -> None: function get_forbidden_modules (line 159) | def get_forbidden_modules(config: "PretrainedConfig", finetuning_args: "... function patch_target_modules (line 182) | def patch_target_modules( FILE: src/llamafactory/model/patcher.py function patch_qwen3_omni_moe_thinker_text_sparse_moe_block (line 53) | def patch_qwen3_omni_moe_thinker_text_sparse_moe_block(): function patch_youtu_vl_model (line 64) | def patch_youtu_vl_model(model: "PreTrainedModel") -> None: function patch_tokenizer (line 84) | def patch_tokenizer(tokenizer: "PreTrainedTokenizer", model_args: "Model... function patch_processor (line 108) | def patch_processor( function patch_config (line 126) | def patch_config( function patch_model (line 195) | def patch_model( function patch_valuehead_model (line 246) | def patch_valuehead_model(model: "AutoModelForCausalLMWithValueHead") ->... FILE: src/llamafactory/third_party/muon/muon.py function zeropower_via_newtonschulz5 (line 48) | def zeropower_via_newtonschulz5(G: "torch.Tensor", steps: int) -> "torch... class Muon (line 76) | class Muon(torch.optim.Optimizer): method __init__ (line 102) | def __init__( method adjust_lr_for_muon (line 137) | def adjust_lr_for_muon(self, lr: float, param_shape: list[int]) -> float: method step (line 145) | def step(self, closure=None): FILE: src/llamafactory/train/callbacks.py function fix_valuehead_checkpoint (line 53) | def fix_valuehead_checkpoint( class FixValueHeadModelCallback (line 98) | class FixValueHeadModelCallback(TrainerCallback): method on_save (line 102) | def on_save(self, args: "TrainingArguments", state: "TrainerState", co... class SaveProcessorCallback (line 112) | class SaveProcessorCallback(TrainerCallback): method __init__ (line 115) | def __init__(self, processor: "ProcessorMixin") -> None: method on_save (line 119) | def on_save(self, args: "TrainingArguments", state: "TrainerState", co... method on_train_end (line 125) | def on_train_end(self, args: "TrainingArguments", state: "TrainerState... class PissaConvertCallback (line 130) | class PissaConvertCallback(TrainerCallback): method on_train_begin (line 134) | def on_train_begin(self, args: "TrainingArguments", state: "TrainerSta... method on_train_end (line 146) | def on_train_end(self, args: "TrainingArguments", state: "TrainerState... class LogCallback (line 172) | class LogCallback(TrainerCallback): method __init__ (line 175) | def __init__(self) -> None: method _set_abort (line 194) | def _set_abort(self, signum, frame) -> None: method _reset (line 197) | def _reset(self, max_steps: int = 0) -> None: method _timing (line 204) | def _timing(self, cur_steps: int) -> None: method _write_log (line 213) | def _write_log(self, output_dir: str, logs: dict[str, Any]) -> None: method _create_thread_pool (line 217) | def _create_thread_pool(self, output_dir: str) -> None: method _close_thread_pool (line 221) | def _close_thread_pool(self) -> None: method on_init_end (line 227) | def on_init_end(self, args: "TrainingArguments", state: "TrainerState"... method on_train_begin (line 237) | def on_train_begin(self, args: "TrainingArguments", state: "TrainerSta... method on_train_end (line 244) | def on_train_end(self, args: "TrainingArguments", state: "TrainerState... method on_substep_end (line 248) | def on_substep_end(self, args: "TrainingArguments", state: "TrainerSta... method on_step_end (line 254) | def on_step_end(self, args: "TrainingArguments", state: "TrainerState"... method on_evaluate (line 260) | def on_evaluate(self, args: "TrainingArguments", state: "TrainerState"... method on_predict (line 265) | def on_predict(self, args: "TrainingArguments", state: "TrainerState",... method on_log (line 270) | def on_log(self, args: "TrainingArguments", state: "TrainerState", con... method on_prediction_step (line 311) | def on_prediction_step( class ReporterCallback (line 341) | class ReporterCallback(TrainerCallback): method __init__ (line 344) | def __init__( method on_train_begin (line 358) | def on_train_begin(self, args: "TrainingArguments", state: "TrainerSta... FILE: src/llamafactory/train/dpo/ktrainer.py class KDPOTrainer (line 32) | class KDPOTrainer(KTrainer, CustomDPOTrainer): method concatenated_forward (line 34) | def concatenated_forward( FILE: src/llamafactory/train/dpo/trainer.py class CustomDPOTrainer (line 44) | class CustomDPOTrainer(DPOTrainer): method __init__ (line 45) | def __init__( method create_optimizer (line 126) | def create_optimizer(self) -> "torch.optim.Optimizer": method create_scheduler (line 132) | def create_scheduler( method _get_train_sampler (line 139) | def _get_train_sampler(self, *args, **kwargs) -> Optional["torch.utils... method get_batch_samples (line 146) | def get_batch_samples(self, *args, **kwargs): method odds_ratio_loss (line 150) | def odds_ratio_loss(self, chosen_logps: "torch.Tensor", rejected_logps... method simpo_loss (line 160) | def simpo_loss(self, chosen_logps: "torch.Tensor", rejected_logps: "to... method bco_loss (line 168) | def bco_loss( method compute_preference_loss (line 187) | def compute_preference_loss( method concatenated_forward (line 219) | def concatenated_forward( method compute_reference_log_probs (line 255) | def compute_reference_log_probs( method get_batch_loss_metrics (line 277) | def get_batch_loss_metrics( method compute_loss (line 320) | def compute_loss( method log (line 327) | def log(self, logs: dict[str, float], *args, **kwargs) -> None: FILE: src/llamafactory/train/dpo/workflow.py function run_dpo (line 35) | def run_dpo( FILE: src/llamafactory/train/fp8_utils.py function create_fp8_kwargs (line 29) | def create_fp8_kwargs(training_args: "TrainingArguments") -> list[Any]: function get_fp8_mixed_precision (line 108) | def get_fp8_mixed_precision(training_args: "TrainingArguments") -> Optio... function configure_fp8_environment (line 120) | def configure_fp8_environment(training_args: "TrainingArguments") -> None: function verify_fp8_status (line 155) | def verify_fp8_status(accelerator, training_args: "TrainingArguments") -... function patch_accelerator_for_fp8 (line 185) | def patch_accelerator_for_fp8() -> None: FILE: src/llamafactory/train/kto/trainer.py class CustomKTOTrainer (line 43) | class CustomKTOTrainer(KTOTrainer): method __init__ (line 44) | def __init__( method create_optimizer (line 123) | def create_optimizer(self) -> "torch.optim.Optimizer": method create_scheduler (line 129) | def create_scheduler( method _get_train_sampler (line 136) | def _get_train_sampler(self, *args, **kwargs) -> Optional["torch.utils... method get_batch_samples (line 144) | def get_batch_samples(self, *args, **kwargs): method forward (line 149) | def forward( method concatenated_forward (line 184) | def concatenated_forward( method compute_reference_log_probs (line 202) | def compute_reference_log_probs( method get_batch_loss_metrics (line 221) | def get_batch_loss_metrics( method compute_loss (line 271) | def compute_loss( method log (line 278) | def log(self, logs: dict[str, float], *args, **kwargs) -> None: FILE: src/llamafactory/train/kto/workflow.py function run_kto (line 35) | def run_kto( FILE: src/llamafactory/train/mca/workflow.py function _data_collator_wrapper (line 60) | def _data_collator_wrapper(data_collator: Any): function _check_model_support (line 80) | def _check_model_support(model_args: "ModelArguments"): function _freeze_model_parameters (line 98) | def _freeze_model_parameters(model: Any, finetuning_args: "FinetuningArg... function run_pt (line 121) | def run_pt( function run_sft (line 173) | def run_sft( function run_dpo (line 237) | def run_dpo( FILE: src/llamafactory/train/ppo/ppo_utils.py function get_rewards_from_server (line 34) | def get_rewards_from_server(server_url: str, messages: list[str]) -> lis... function replace_model (line 43) | def replace_model(model: "AutoModelForCausalLMWithValueHead", target: Li... function dump_layernorm (line 65) | def dump_layernorm(model: "PreTrainedModel") -> dict[str, "torch.Tensor"]: function restore_layernorm (line 76) | def restore_layernorm(model: "PreTrainedModel", layernorm_params: Option... FILE: src/llamafactory/train/ppo/trainer.py class CustomPPOTrainer (line 64) | class CustomPPOTrainer(PPOTrainer, Trainer): method __init__ (line 67) | def __init__( method ppo_train (line 200) | def ppo_train(self, resume_from_checkpoint: Optional[str] = None) -> N... method create_optimizer (line 311) | def create_optimizer( method create_scheduler (line 338) | def create_scheduler( method get_inputs (line 351) | def get_inputs(self, batch: dict[str, "torch.Tensor"]) -> tuple[list["... method get_rewards (line 389) | def get_rewards( method batched_forward_pass (line 422) | def batched_forward_pass( method save_model (line 492) | def save_model(self, output_dir: Optional[str] = None) -> None: FILE: src/llamafactory/train/ppo/workflow.py function run_ppo (line 34) | def run_ppo( FILE: src/llamafactory/train/pt/trainer.py class CustomTrainer (line 33) | class CustomTrainer(Trainer): method __init__ (line 36) | def __init__( method create_optimizer (line 72) | def create_optimizer(self) -> "torch.optim.Optimizer": method create_scheduler (line 78) | def create_scheduler( method _get_train_sampler (line 85) | def _get_train_sampler(self, *args, **kwargs) -> Optional["torch.utils... method compute_loss (line 92) | def compute_loss(self, model, inputs, *args, **kwargs): FILE: src/llamafactory/train/pt/workflow.py function run_pt (line 36) | def run_pt( FILE: src/llamafactory/train/rm/metric.py class ComputeAccuracy (line 28) | class ComputeAccuracy: method _dump (line 31) | def _dump(self) -> dict[str, float] | None: method __post_init__ (line 39) | def __post_init__(self): method __call__ (line 42) | def __call__(self, eval_preds: "EvalPrediction", compute_result: bool ... FILE: src/llamafactory/train/rm/trainer.py class PairwiseTrainer (line 43) | class PairwiseTrainer(Trainer): method __init__ (line 46) | def __init__( method create_optimizer (line 68) | def create_optimizer(self) -> "torch.optim.Optimizer": method create_scheduler (line 74) | def create_scheduler( method _get_train_sampler (line 81) | def _get_train_sampler(self, *args, **kwargs) -> Optional["torch.utils... method compute_loss (line 88) | def compute_loss( method _save (line 113) | def _save(self, output_dir: Optional[str] = None, state_dict=None): method save_predictions (line 133) | def save_predictions(self, predict_results: "PredictionOutput") -> None: FILE: src/llamafactory/train/rm/workflow.py function run_rm (line 35) | def run_rm( FILE: src/llamafactory/train/sft/metric.py function eval_logit_processor (line 47) | def eval_logit_processor(logits: "torch.Tensor", labels: "torch.Tensor")... class ComputeAccuracy (line 62) | class ComputeAccuracy: method _dump (line 65) | def _dump(self) -> Optional[dict[str, float]]: method __post_init__ (line 73) | def __post_init__(self): method __call__ (line 76) | def __call__(self, eval_preds: "EvalPrediction", compute_result: bool ... class ComputeSimilarity (line 88) | class ComputeSimilarity: method _dump (line 96) | def _dump(self) -> Optional[dict[str, float]]: method __post_init__ (line 104) | def __post_init__(self): method __call__ (line 107) | def __call__(self, eval_preds: "EvalPrediction", compute_result: bool ... FILE: src/llamafactory/train/sft/trainer.py class CustomSeq2SeqTrainer (line 47) | class CustomSeq2SeqTrainer(Seq2SeqTrainer): method __init__ (line 50) | def __init__( method create_optimizer (line 131) | def create_optimizer(self) -> "torch.optim.Optimizer": method create_scheduler (line 137) | def create_scheduler( method _get_train_sampler (line 144) | def _get_train_sampler(self, *args, **kwargs) -> Optional["torch.utils... method compute_loss (line 151) | def compute_loss(self, model, inputs, *args, **kwargs): method prediction_step (line 165) | def prediction_step( method save_predictions (line 191) | def save_predictions( FILE: src/llamafactory/train/sft/workflow.py function run_sft (line 41) | def run_sft( FILE: src/llamafactory/train/test_utils.py function compare_model (line 34) | def compare_model(model_a: "torch.nn.Module", model_b: "torch.nn.Module"... function check_lora_model (line 45) | def check_lora_model(model: "LoraModel") -> tuple[set[str], set[str]]: function load_train_model (line 63) | def load_train_model(add_valuehead: bool = False, **kwargs) -> "PreTrain... function load_infer_model (line 69) | def load_infer_model(add_valuehead: bool = False, **kwargs) -> "PreTrain... function load_reference_model (line 75) | def load_reference_model( function load_dataset_module (line 101) | def load_dataset_module(**kwargs) -> "DatasetModule": function patch_valuehead_model (line 109) | def patch_valuehead_model() -> None: FILE: src/llamafactory/train/trainer_utils.py class DummyOptimizer (line 68) | class DummyOptimizer(torch.optim.Optimizer): method __init__ (line 71) | def __init__( method zero_grad (line 79) | def zero_grad(self, set_to_none: bool = True) -> None: method step (line 83) | def step(self, closure: Optional[Callable[[], float]] = None) -> Optio... function create_modelcard_and_push (line 87) | def create_modelcard_and_push( function create_ref_model (line 116) | def create_ref_model( function create_reward_model (line 151) | def create_reward_model( function _get_decay_parameter_names (line 193) | def _get_decay_parameter_names(model: "PreTrainedModel") -> list[str]: function _create_galore_optimizer (line 200) | def _create_galore_optimizer( function _create_apollo_optimizer (line 288) | def _create_apollo_optimizer( function _create_loraplus_optimizer (line 372) | def _create_loraplus_optimizer( function _create_badam_optimizer (line 412) | def _create_badam_optimizer( function _create_adam_mini_optimizer (line 473) | def _create_adam_mini_optimizer( function _create_muon_optimizer (line 498) | def _create_muon_optimizer( function create_custom_optimizer (line 527) | def create_custom_optimizer( function create_custom_scheduler (line 551) | def create_custom_scheduler( function get_batch_logps (line 592) | def get_batch_logps( function dft_loss_func (line 639) | def dft_loss_func( function _dft_cross_entropy (line 658) | def _dft_cross_entropy( function asft_loss_func (line 686) | def asft_loss_func( function _asft_cross_entropy (line 720) | def _asft_cross_entropy( function _kl_divergence (line 743) | def _kl_divergence( function eaft_loss_func (line 768) | def eaft_loss_func( function _eaft_cross_entropy (line 790) | def _eaft_cross_entropy( function nested_detach (line 829) | def nested_detach( function get_swanlab_callback (line 848) | def get_swanlab_callback(finetuning_args: "FinetuningArguments") -> "Tra... function get_placement_group (line 894) | def get_placement_group(num_workers: int) -> tuple["PlacementGroup", dic... function get_ray_remote_config_for_worker (line 906) | def get_ray_remote_config_for_worker( function get_ray_head_node_ip (line 943) | def get_ray_head_node_ip() -> str: function sort_placement_group_by_node_ip (line 949) | def sort_placement_group_by_node_ip(placement_group: "PlacementGroup", m... FILE: src/llamafactory/train/tuner.py function _training_function (line 57) | def _training_function(config: dict[str, Any]) -> None: function run_exp (line 115) | def run_exp(args: Optional[dict[str, Any]] = None, callbacks: Optional[l... function export_model (line 128) | def export_model(args: Optional[dict[str, Any]] = None) -> None: class Worker (line 227) | class Worker: method __init__ (line 228) | def __init__(self): method _setup_env_visible_devices (line 234) | def _setup_env_visible_devices(self) -> None: method _training_function (line 247) | def _training_function(self, config: dict[str, Any]) -> None: function _ray_training_function (line 251) | def _ray_training_function(ray_args: "RayArguments", config: dict[str, A... FILE: src/llamafactory/v1/accelerator/helper.py class DeviceType (line 42) | class DeviceType(StrEnum): class ReduceOp (line 52) | class ReduceOp(StrEnum): function requires_accelerator (line 59) | def requires_accelerator(fn): function is_distributed (line 75) | def is_distributed() -> bool: function get_rank (line 80) | def get_rank() -> int: function get_world_size (line 85) | def get_world_size() -> int: function get_local_rank (line 90) | def get_local_rank() -> int: function get_local_world_size (line 95) | def get_local_world_size() -> int: function get_current_accelerator (line 102) | def get_current_accelerator(check_available: bool = True) -> torch.device: function get_device_count (line 110) | def get_device_count() -> int: function synchronize (line 116) | def synchronize() -> None: function set_device_index (line 122) | def set_device_index() -> None: function get_current_device (line 129) | def get_current_device() -> torch.device: function is_torch_cuda_available (line 137) | def is_torch_cuda_available(): function is_torch_mps_available (line 142) | def is_torch_mps_available(): function is_torch_npu_available (line 147) | def is_torch_npu_available(): function is_torch_xpu_available (line 152) | def is_torch_xpu_available(): function operate_tensorlike (line 157) | def operate_tensorlike(fn: Callable[[...], Tensor], data: TensorLike, **... function get_process_group_backend (line 183) | def get_process_group_backend() -> str: function all_gather (line 193) | def all_gather(tensor: Tensor, group: Optional[ProcessGroup] = None) -> ... function all_reduce (line 201) | def all_reduce(tensor: Tensor, op: ReduceOp = ReduceOp.MEAN, group: Opti... function broadcast (line 216) | def broadcast(tensor: Tensor, src: int = 0, group: Optional[ProcessGroup... function main_process_first (line 223) | def main_process_first(local_only: bool = True) -> None: FILE: src/llamafactory/v1/accelerator/interface.py class Dim (line 45) | class Dim(StrEnum): class DistributedStrategy (line 55) | class DistributedStrategy: method __post_init__ (line 67) | def __post_init__(self) -> None: method model_mesh_shape (line 89) | def model_mesh_shape(self) -> tuple[int, int]: method model_mesh_dim_names (line 94) | def model_mesh_dim_names(self) -> tuple[str, str]: method data_mesh_shape (line 99) | def data_mesh_shape(self) -> tuple[int, int]: method data_mesh_dim_names (line 104) | def data_mesh_dim_names(self) -> tuple[str, str]: class DistributedInterface (line 109) | class DistributedInterface: method __new__ (line 115) | def __new__(cls, *args: Any, **kwargs: Any) -> "DistributedInterface": method __init__ (line 122) | def __init__(self, config: DistributedConfig | None = None) -> None: method __str__ (line 166) | def __str__(self) -> str: method get_device_mesh (line 173) | def get_device_mesh(self, dim: Dim | None = None) -> DeviceMesh | None: method get_group (line 184) | def get_group(self, dim: Dim | None = None) -> Optional[ProcessGroup]: method get_rank (line 191) | def get_rank(self, dim: Dim | None = None) -> int: method get_world_size (line 200) | def get_world_size(self, dim: Dim | None = None) -> int: method get_local_rank (line 209) | def get_local_rank(self) -> int: method get_local_world_size (line 213) | def get_local_world_size(self) -> int: method all_gather (line 217) | def all_gather(self, data: TensorLike, dim: Dim | None = Dim.DP) -> Te... method all_reduce (line 224) | def all_reduce( method broadcast (line 233) | def broadcast(self, data: TensorLike, src: int = 0, dim: Dim | None = ... method sync (line 240) | def sync(self) -> None: method barrier (line 245) | def barrier(self) -> None: method destroy (line 250) | def destroy(self) -> None: FILE: src/llamafactory/v1/config/arg_parser.py function get_args (line 34) | def get_args(args: InputArgument = None) -> tuple[ModelArguments, DataAr... FILE: src/llamafactory/v1/config/arg_utils.py class PluginConfig (line 23) | class PluginConfig(dict): method name (line 27) | def name(self) -> str: class ModelClass (line 39) | class ModelClass(StrEnum): class SampleBackend (line 48) | class SampleBackend(StrEnum): class BatchingStrategy (line 54) | class BatchingStrategy(StrEnum): function _convert_str_dict (line 61) | def _convert_str_dict(data: dict) -> dict: function get_plugin_config (line 84) | def get_plugin_config(config: PluginArgument) -> PluginConfig | None: FILE: src/llamafactory/v1/config/data_args.py class DataArguments (line 20) | class DataArguments: FILE: src/llamafactory/v1/config/model_args.py class ModelArguments (line 22) | class ModelArguments: method __post_init__ (line 56) | def __post_init__(self) -> None: FILE: src/llamafactory/v1/config/sample_args.py class SampleArguments (line 22) | class SampleArguments: FILE: src/llamafactory/v1/config/training_args.py class TrainingArguments (line 23) | class TrainingArguments: method __post_init__ (line 89) | def __post_init__(self) -> None: FILE: src/llamafactory/v1/core/base_sampler.py class BaseSampler (line 23) | class BaseSampler: method __init__ (line 33) | def __init__( method generate (line 45) | async def generate(self, messages: list[Message], tools: str | None = ... method batch_infer (line 58) | async def batch_infer(self, dataset: TorchDataset) -> list[Sample]: FILE: src/llamafactory/v1/core/base_trainer.py class BaseTrainer (line 48) | class BaseTrainer: method __init__ (line 49) | def __init__( method _create_batch_generator (line 102) | def _create_batch_generator(self) -> None: method _shard_model (line 114) | def _shard_model(self) -> None: method _init_optimizer (line 132) | def _init_optimizer(self) -> None: method _init_lr_scheduler (line 142) | def _init_lr_scheduler(self) -> None: method compute_log_probs (line 153) | def compute_log_probs(self, model: HFModel, batch: BatchInput) -> Tensor: method compute_loss (line 170) | def compute_loss(self, batch: BatchInput) -> Tensor: method fit (line 174) | def fit(self) -> None: method save_model (line 224) | def save_model(self) -> None: FILE: src/llamafactory/v1/core/data_engine.py class DataEngine (line 47) | class DataEngine(Dataset): method __init__ (line 54) | def __init__(self, dataset_path: str) -> None: method _get_dataset_info (line 69) | def _get_dataset_info(self) -> None: method _load_dataset (line 82) | def _load_dataset(self) -> None: method _build_data_index (line 100) | def _build_data_index(self) -> None: method _convert_data_sample (line 117) | def _convert_data_sample(self, raw_sample: dict[str, Any], dataset_nam... method __len__ (line 135) | def __len__(self) -> int: method __getitem__ (line 146) | def __getitem__(self, index: int | Any) -> Sample | list[Sample]: method __iter__ (line 174) | def __iter__(self) -> Iterable[Sample]: FILE: src/llamafactory/v1/core/model_engine.py class ModelEngine (line 47) | class ModelEngine: method __init__ (line 55) | def __init__(self, model_args: ModelArguments, is_train: bool = False)... method _init_processor (line 69) | def _init_processor(self) -> Processor: method _init_model_config (line 80) | def _init_model_config(self) -> HFConfig: method _init_model (line 87) | def _init_model(self) -> HFModel: FILE: src/llamafactory/v1/core/utils/batching.py function default_collate_fn (line 46) | def default_collate_fn(buffer: StatefulBuffer, batch_info: BatchInfo) ->... class BatchGenerator (line 63) | class BatchGenerator(Iterator): method __init__ (line 64) | def __init__( method _init_data_provider (line 127) | def _init_data_provider(self) -> None: method __len__ (line 162) | def __len__(self) -> int: method __iter__ (line 165) | def __iter__(self): method __next__ (line 174) | def __next__(self): method _fill_buffer (line 182) | def _fill_buffer(self) -> None: method _generate_batch (line 196) | def _generate_batch(self) -> list[BatchInput] | None: method state_dict (line 204) | def state_dict(self) -> dict[str, Any]: method load_state_dict (line 211) | def load_state_dict(self, state: dict[str, Any]) -> None: method set_epoch (line 217) | def set_epoch(self, epoch: int) -> None: FILE: src/llamafactory/v1/core/utils/inference_engine.py class BaseEngine (line 31) | class BaseEngine(ABC): method __init__ (line 33) | def __init__( method generate (line 51) | async def generate(self, messages: list[Message], tools: str | None = ... method batch_infer (line 64) | async def batch_infer(self, dataset: TorchDataset) -> list[Sample]: class HuggingFaceEngine (line 76) | class HuggingFaceEngine(BaseEngine): method __init__ (line 77) | def __init__( method generate (line 91) | async def generate(self, messages: list[Message], tools: str | None = ... method batch_infer (line 112) | async def batch_infer(self, dataset: TorchDataset) -> list[Sample]: FILE: src/llamafactory/v1/core/utils/rendering.py function render_chatml_messages (line 31) | def render_chatml_messages( function parse_chatml_message (line 76) | def parse_chatml_message(generated_text: str) -> Message: class Renderer (line 88) | class Renderer: method __init__ (line 89) | def __init__(self, template: str, processor: Processor): method render_messages (line 93) | def render_messages( method parse_message (line 120) | def parse_message(self, generated_text: str) -> Message: method process_samples (line 136) | def process_samples(self, samples: list[Sample]) -> list[ModelInput]: FILE: src/llamafactory/v1/launcher.py function launch (line 34) | def launch(): function main (line 157) | def main(): FILE: src/llamafactory/v1/plugins/data_plugins/converter.py class AlpacaSample (line 27) | class AlpacaSample(TypedDict, total=False): class SharegptSample (line 40) | class SharegptSample(TypedDict, total=False): class OpenaiMessage (line 45) | class OpenaiMessage(TypedDict, total=False): class OpenaiSample (line 50) | class OpenaiSample(TypedDict, total=False): class PairSample (line 54) | class PairSample(TypedDict, total=False): class DataConverterPlugin (line 59) | class DataConverterPlugin(BasePlugin): method __call__ (line 62) | def __call__(self, raw_sample: dict[str, Any]) -> Sample: function alpaca_converter (line 67) | def alpaca_converter(raw_sample: AlpacaSample) -> SFTSample: function sharegpt_converter (line 104) | def sharegpt_converter(raw_sample: SharegptSample) -> SFTSample: function pair_converter (line 168) | def pair_converter(raw_sample: PairSample) -> DPOSample: FILE: src/llamafactory/v1/plugins/data_plugins/loader.py class DataLoaderPlugin (line 26) | class DataLoaderPlugin(BasePlugin): method load (line 29) | def load(self, dataset_info: DatasetInfo) -> HFDataset: function _get_builder_name (line 36) | def _get_builder_name(path: str) -> Literal["arrow", "csv", "json", "par... function load_data_from_file (line 53) | def load_data_from_file(filepath: str, split: str, streaming: bool) -> H... function adjust_data_index (line 69) | def adjust_data_index( function select_data_sample (line 91) | def select_data_sample( FILE: src/llamafactory/v1/plugins/model_plugins/initialization.py class InitPlugin (line 23) | class InitPlugin(BasePlugin): method __call__ (line 24) | def __call__(self) -> torch.device: function init_on_meta (line 29) | def init_on_meta() -> torch.device: function init_on_rank0 (line 34) | def init_on_rank0() -> torch.device: function init_on_default (line 42) | def init_on_default() -> torch.device: FILE: src/llamafactory/v1/plugins/model_plugins/kernels/base.py class BaseKernel (line 30) | class BaseKernel(ABC): method get_kernel_id (line 40) | def get_kernel_id(cls) -> str: method get_device (line 45) | def get_device(cls) -> str: method check_deps (line 50) | def check_deps(cls) -> bool: method apply (line 67) | def apply(cls, **kwargs) -> HFModel: FILE: src/llamafactory/v1/plugins/model_plugins/kernels/interface.py function scan_all_kernels (line 36) | def scan_all_kernels(): function get_default_kernels (line 80) | def get_default_kernels(): function apply_kernel (line 89) | def apply_kernel(kernel_id: str, **kwargs): class KernelPlugin (line 107) | class KernelPlugin(BasePlugin): function apply_default_kernels (line 114) | def apply_default_kernels(model: HFModel, include_kernels: str = None) -... FILE: src/llamafactory/v1/plugins/model_plugins/kernels/ops/mlp/npu_fused_moe.py class GmmFunction (line 42) | class GmmFunction(torch.autograd.Function): method forward (line 46) | def forward(ctx, x, weight, group_list): method backward (line 67) | def backward(ctx, grad_output): class HybridGmmFunction (line 96) | class HybridGmmFunction(torch.autograd.Function): method forward (line 100) | def forward(ctx, num_experts, *args): method backward (line 126) | def backward(ctx, *grad_outputs): class NpuMoeFused (line 178) | class NpuMoeFused: method npu_moe_experts_forward (line 182) | def npu_moe_experts_forward( method npu_moe_sparse_block_forward (line 210) | def npu_moe_sparse_block_forward(self, hidden_states: torch.Tensor) ->... class Qwen3NpuMoeFused (line 232) | class Qwen3NpuMoeFused: method qwen3moe_sparse_moe_block_forward (line 236) | def qwen3moe_sparse_moe_block_forward(self, hidden_states: torch.Tensor): class NpuFusedMoEKernel (line 300) | class NpuFusedMoEKernel(BaseKernel): method apply (line 307) | def apply(cls, **kwargs) -> HFModel: FILE: src/llamafactory/v1/plugins/model_plugins/kernels/ops/mlp/npu_swiglu.py function npu_swiglu_forward (line 40) | def npu_swiglu_forward(self, hidden_state): function _npu_swiglu_glm4_forward (line 55) | def _npu_swiglu_glm4_forward(self, hidden_states): function _npu_swiglu_gemma3ntext_forward (line 70) | def _npu_swiglu_gemma3ntext_forward(self, hidden_states): class NpuSwiGluKernel (line 90) | class NpuSwiGluKernel(BaseKernel): method apply (line 128) | def apply(cls, **kwargs) -> "HFModel": FILE: src/llamafactory/v1/plugins/model_plugins/kernels/ops/rms_norm/npu_rms_norm.py function npu_rms_norm_forward (line 32) | def npu_rms_norm_forward(self, hidden_states): class NpuRMSNormKernel (line 48) | class NpuRMSNormKernel(BaseKernel): method apply (line 55) | def apply(cls, **kwargs) -> "HFModel": FILE: src/llamafactory/v1/plugins/model_plugins/kernels/ops/rope/npu_rope.py function _apply_rotary_pos_emb (line 42) | def _apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_d... function _apply_multimodal_rotary_pos_emb_qwen25_vl (line 63) | def _apply_multimodal_rotary_pos_emb_qwen25_vl(q, k, cos, sin, mrope_sec... class NpuRoPEKernel (line 91) | class NpuRoPEKernel(BaseKernel): method apply (line 98) | def apply(cls, **kwargs) -> "HFModel": FILE: src/llamafactory/v1/plugins/model_plugins/kernels/registry.py class Registry (line 30) | class Registry: method register (line 39) | def register(cls, kernel_cls: type[BaseKernel]) -> type[BaseKernel] | ... method get (line 74) | def get(cls, kernel_id: str) -> type[BaseKernel] | None: method get_registered_kernels (line 86) | def get_registered_kernels(cls) -> dict[str, type[BaseKernel]]: FILE: src/llamafactory/v1/plugins/model_plugins/peft.py class LoraConfigDict (line 31) | class LoraConfigDict(TypedDict, total=False): class FreezeConfigDict (line 62) | class FreezeConfigDict(TypedDict, total=False): class PeftPlugin (line 75) | class PeftPlugin(BasePlugin): method __call__ (line 76) | def __call__(self, model: HFModel, config: dict, is_train: bool) -> HF... function _find_all_linear_modules (line 80) | def _find_all_linear_modules(model: HFModel) -> list[str]: function merge_adapters (line 94) | def merge_adapters(model: HFModel, adapter_name_or_path: Union[list[str]... function load_adapter (line 106) | def load_adapter(model: HFModel, adapter_name_or_path: Union[list[str], ... function get_lora_model (line 152) | def get_lora_model(model: HFModel, config: LoraConfigDict, is_train: boo... function get_freeze_model (line 194) | def get_freeze_model(model: HFModel, config: FreezeConfigDict, is_train:... function merge_and_export_model (line 287) | def merge_and_export_model(args: InputArgument = None): FILE: src/llamafactory/v1/plugins/model_plugins/quantization.py class QuantizationPlugin (line 36) | class QuantizationPlugin(BasePlugin): method __call__ (line 39) | def __call__( function quantization_auto (line 53) | def quantization_auto( function quantization_with_bnb (line 81) | def quantization_with_bnb( FILE: src/llamafactory/v1/plugins/model_plugins/rendering.py class RenderingPlugin (line 25) | class RenderingPlugin(BasePlugin): method _ensure_template_imported (line 28) | def _ensure_template_imported(self) -> None: method __getitem__ (line 39) | def __getitem__(self, method_name: str): method render_messages (line 43) | def render_messages( method parse_messages (line 54) | def parse_messages(self, generated_text: str) -> Message: FILE: src/llamafactory/v1/plugins/model_plugins/templates/qwen3.py function _update_model_input (line 24) | def _update_model_input( function _concat_text_content (line 48) | def _concat_text_content(message: Message) -> str: function _get_last_query_index (line 60) | def _get_last_query_index(messages: list[Message]) -> int: function _split_assistant_content (line 86) | def _split_assistant_content(message: Message) -> tuple[str, str, list[T... function render_qwen3_messages (line 111) | def render_qwen3_messages( function parse_qwen3_message (line 220) | def parse_qwen3_message(generated_text: str) -> Message: FILE: src/llamafactory/v1/plugins/model_plugins/templates/qwen3_nothink.py function _update_model_input (line 24) | def _update_model_input( function _concat_text_content (line 48) | def _concat_text_content(message: Message) -> str: function render_qwen3_nothink_messages (line 61) | def render_qwen3_nothink_messages( function parse_qwen3_nothink_message (line 170) | def parse_qwen3_nothink_message(generated_text: str) -> Message: FILE: src/llamafactory/v1/plugins/trainer_plugins/batching.py class BatchingPlugin (line 20) | class BatchingPlugin(BasePlugin): method compute_length (line 21) | def compute_length(self, data_provider: DataLoader) -> int: method fill_buffer (line 28) | def fill_buffer(self, buffer: StatefulBuffer, batch_info: BatchInfo) -... method generate_batch (line 32) | def generate_batch(self, buffer: StatefulBuffer, batch_info: BatchInfo... FILE: src/llamafactory/v1/plugins/trainer_plugins/distributed/deepspeed.py class DeepSpeedEngine (line 35) | class DeepSpeedEngine: method __init__ (line 47) | def __init__(self, dist_config: dict[str, Any], num_micro_batch: int =... method shard_model (line 67) | def shard_model(self, model: HFModel) -> "DeepSpeedEngine": method prepare (line 74) | def prepare( method backward (line 94) | def backward(self, loss: torch.Tensor) -> None: method get_grad_norm (line 104) | def get_grad_norm(self) -> float: function save_model (line 112) | def save_model(model: HFModel, output_dir: str, processor: Processor) ->... FILE: src/llamafactory/v1/plugins/trainer_plugins/distributed/fsdp2.py function get_transformer_layer_cls (line 38) | def get_transformer_layer_cls(model: HFModel) -> type[nn.Module] | None: function save_model (line 54) | def save_model(model: HFModel, output_dir: str, processor: Processor) ->... class FSDP2Engine (line 68) | class FSDP2Engine: method __init__ (line 69) | def __init__(self, dist_config: dict): method get_mp_policy (line 96) | def get_mp_policy(self) -> MixedPrecisionPolicy: method is_lora_module_wrap (line 113) | def is_lora_module_wrap(self, model) -> bool: method prepare_model (line 116) | def prepare_model(self, model: HFModel) -> HFModel: method materialize_and_load (line 196) | def materialize_and_load(self, model: HFModel, hf_model_path: str, dcp... method _save_non_persistent_buffers (line 216) | def _save_non_persistent_buffers(self, model: HFModel) -> dict: method _restore_non_persistent_buffers (line 229) | def _restore_non_persistent_buffers(self, model: HFModel, saved_buffer... method shard_model (line 246) | def shard_model(self, model: HFModel) -> HFModel: method _load_from_dcp (line 266) | def _load_from_dcp(self, model: HFModel, dcp_path: str): method _load_weights_from_hf_checkpoint (line 285) | def _load_weights_from_hf_checkpoint(self, model: HFModel, hf_model_pa... method _resolve_hf_checkpoint_dir (line 348) | def _resolve_hf_checkpoint_dir(self, hf_model_path: str) -> str: method _copy_weights (line 433) | def _copy_weights(self, param, loaded_tensor): FILE: src/llamafactory/v1/plugins/trainer_plugins/distributed/hub.py class DistributedPlugin (line 27) | class DistributedPlugin(BasePlugin): method __call__ (line 28) | def __call__(self, model: HFModel, dist_config: PluginConfig, **kwargs... function shard_model_fsdp2 (line 33) | def shard_model_fsdp2(model: HFModel, dist_config: PluginConfig, **kwarg... function save_model_fsdp2 (line 40) | def save_model_fsdp2(model: HFModel, output_dir: str, processor: Process... function shard_model_deepspeed (line 47) | def shard_model_deepspeed(model: HFModel, dist_config: PluginConfig, **k... function save_model_deepspeed (line 58) | def save_model_deepspeed(model: HFModel, output_dir: str, processor: Pro... FILE: src/llamafactory/v1/plugins/trainer_plugins/lr_scheduler.py class LRSchedulerPlugin (line 18) | class LRSchedulerPlugin(BasePlugin): FILE: src/llamafactory/v1/plugins/trainer_plugins/optimizer.py class OptimizerPlugin (line 18) | class OptimizerPlugin(BasePlugin): FILE: src/llamafactory/v1/samplers/cli_sampler.py class SyncSampler (line 28) | class SyncSampler(BaseSampler): method __init__ (line 29) | def __init__( method generate (line 45) | def generate(self, messages: list[Message], tools: str | None = None) ... method batch_infer (line 63) | def batch_infer(self, dataset: TorchDataset) -> list[Sample]: function run_chat (line 75) | def run_chat(args: InputArgument = None): FILE: src/llamafactory/v1/trainers/sft_trainer.py class SFTTrainer (line 24) | class SFTTrainer(BaseTrainer): method compute_loss (line 25) | def compute_loss(self, batch: BatchInput) -> Tensor: function run_sft (line 32) | def run_sft(args: InputArgument = None): FILE: src/llamafactory/v1/utils/dtype.py class DtypeRegistry (line 26) | class DtypeRegistry: class DtypeInterface (line 32) | class DtypeInterface: method is_available (line 40) | def is_available(precision: str | torch.dtype) -> bool: method is_fp16 (line 51) | def is_fp16(precision: str | torch.dtype) -> bool: method is_fp32 (line 55) | def is_fp32(precision: str | torch.dtype) -> bool: method is_bf16 (line 59) | def is_bf16(precision: str | torch.dtype) -> bool: method to_dtype (line 63) | def to_dtype(precision: str | torch.dtype) -> torch.dtype: method to_str (line 74) | def to_str(precision: torch.dtype) -> str: method set_dtype (line 85) | def set_dtype(self, precision: str | torch.dtype): FILE: src/llamafactory/v1/utils/env.py function find_available_port (line 19) | def find_available_port() -> int: function is_env_enabled (line 28) | def is_env_enabled(env_var: str, default: str = "0") -> bool: function use_ray (line 33) | def use_ray() -> bool: function use_kt (line 37) | def use_kt() -> bool: FILE: src/llamafactory/v1/utils/helper.py function set_seed (line 25) | def set_seed(seed: int) -> None: function is_tokenizer (line 34) | def is_tokenizer(processor: Processor) -> bool: function get_tokenizer (line 46) | def get_tokenizer(processor: Processor) -> PreTrainedTokenizer: function _pad_and_truncate (line 58) | def _pad_and_truncate(tensor: Tensor, max_seqlen: int, pad_value: int = ... function pad_and_truncate (line 68) | def pad_and_truncate(samples: list[ModelInput], max_seqlen: int) -> list... function compute_valid_tokens (line 89) | def compute_valid_tokens(batches: list[BatchInput]) -> int: FILE: src/llamafactory/v1/utils/logging.py class _Logger (line 31) | class _Logger(logging.Logger): method info_rank0 (line 34) | def info_rank0(self, *args, **kwargs) -> None: method warning_rank0 (line 37) | def warning_rank0(self, *args, **kwargs) -> None: method warning_rank0_once (line 40) | def warning_rank0_once(self, *args, **kwargs) -> None: function _get_default_logging_level (line 44) | def _get_default_logging_level() -> "logging._Level": function _get_library_name (line 56) | def _get_library_name() -> str: function _get_library_root_logger (line 60) | def _get_library_root_logger() -> "_Logger": function _configure_library_root_logger (line 64) | def _configure_library_root_logger() -> None: function get_logger (line 84) | def get_logger(name: str | None = None) -> "_Logger": function add_handler (line 93) | def add_handler(handler: "logging.Handler") -> None: function remove_handler (line 99) | def remove_handler(handler: logging.Handler) -> None: function info_rank0 (line 105) | def info_rank0(self: "logging.Logger", *args, **kwargs) -> None: function warning_rank0 (line 110) | def warning_rank0(self: "logging.Logger", *args, **kwargs) -> None: function warning_rank0_once (line 116) | def warning_rank0_once(self: "logging.Logger", *args, **kwargs) -> None: FILE: src/llamafactory/v1/utils/objects.py class StatefulBuffer (line 21) | class StatefulBuffer: method __init__ (line 24) | def __init__(self, max_buffer_size: int = 1_000_000_000) -> None: method __len__ (line 29) | def __len__(self) -> int: method size (line 33) | def size(self) -> int: method put (line 36) | def put(self, samples: list[ModelInput]) -> None: method get (line 45) | def get(self, value: int) -> list[ModelInput]: method clear (line 52) | def clear(self) -> None: method state_dict (line 57) | def state_dict(self) -> dict: method load_state_dict (line 64) | def load_state_dict(self, state_dict: dict) -> None: FILE: src/llamafactory/v1/utils/packages.py function _is_package_available (line 37) | def _is_package_available(name: str) -> bool: function _get_package_version (line 41) | def _get_package_version(name: str) -> "Version": function is_transformers_version_greater_than (line 49) | def is_transformers_version_greater_than(content: str): function check_version (line 53) | def check_version(requirement: str, mandatory: bool = False) -> None: FILE: src/llamafactory/v1/utils/plugin.py class BasePlugin (line 26) | class BasePlugin: method __init__ (line 55) | def __init__(self, name: str | None = None) -> None: method register (line 59) | def register(self, method_name: str = "__call__") -> Callable: method __call__ (line 73) | def __call__(self, *args, **kwargs) -> Any: method __getattr__ (line 77) | def __getattr__(self, method_name: str) -> Callable: method __getitem__ (line 81) | def __getitem__(self, method_name: str) -> Callable: class PrintPlugin (line 94) | class PrintPlugin(BasePlugin): method again (line 95) | def again(self): # optional function print_hello (line 99) | def print_hello(): function print_hello_again (line 103) | def print_hello_again(): FILE: src/llamafactory/v1/utils/pytest.py function dist_env (line 20) | def dist_env(local_rank: int = 0, world_size: int = 1, master_port: int ... FILE: src/llamafactory/v1/utils/types.py class DatasetInfo (line 57) | class DatasetInfo(TypedDict, total=False): class DistributedConfig (line 74) | class DistributedConfig(TypedDict, total=False): class Content (line 87) | class Content(TypedDict): class Message (line 94) | class Message(TypedDict): class SFTSample (line 103) | class SFTSample(TypedDict): class DPOSample (line 114) | class DPOSample(TypedDict): class ToolCall (line 130) | class ToolCall(TypedDict): class ModelInput (line 137) | class ModelInput(TypedDict, total=False): class BatchInput (line 152) | class BatchInput(TypedDict, total=False): class BatchInfo (line 167) | class BatchInfo(TypedDict): class ModelOutput (line 178) | class ModelOutput(NamedTuple): FILE: src/llamafactory/webui/chatter.py function _escape_html (line 41) | def _escape_html(text: str) -> str: function _format_response (line 46) | def _format_response(text: str, lang: str, escape_html: bool, thought_wo... function update_attr (line 73) | def update_attr(obj: Any, name: str, value: Any): class WebChatModel (line 80) | class WebChatModel(ChatModel): method __init__ (line 81) | def __init__(self, manager: "Manager", demo_mode: bool = False, lazy_i... method loaded (line 98) | def loaded(self) -> bool: method load_model (line 101) | def load_model(self, data) -> Generator[str, None, None]: method unload_model (line 161) | def unload_model(self, data) -> Generator[str, None, None]: method append (line 175) | def append( method stream (line 193) | def stream( FILE: src/llamafactory/webui/common.py function abort_process (line 46) | def abort_process(pid: int) -> None: function get_save_dir (line 59) | def get_save_dir(*paths: str) -> os.PathLike: function _get_config_path (line 69) | def _get_config_path() -> os.PathLike: function load_config (line 74) | def load_config() -> dict[str, str | dict[str, Any]]: function save_config (line 83) | def save_config( function get_model_path (line 103) | def get_model_path(model_name: str) -> str: function get_template (line 125) | def get_template(model_name: str) -> str: function get_time (line 130) | def get_time() -> str: function is_multimodal (line 135) | def is_multimodal(model_name: str) -> bool: function load_dataset_info (line 140) | def load_dataset_info(dataset_dir: str) -> dict[str, dict[str, Any]]: function load_args (line 154) | def load_args(config_path: str) -> dict[str, Any] | None: function save_args (line 163) | def save_args(config_path: str, config_dict: dict[str, Any]) -> None: function _clean_cmd (line 169) | def _clean_cmd(args: dict[str, Any]) -> dict[str, Any]: function gen_cmd (line 182) | def gen_cmd(args: dict[str, Any]) -> str: function save_cmd (line 202) | def save_cmd(args: dict[str, Any]) -> str: function load_eval_results (line 212) | def load_eval_results(path: os.PathLike) -> str: function calculate_pixels (line 220) | def calculate_pixels(pixels: str) -> int: function create_ds_config (line 228) | def create_ds_config() -> None: FILE: src/llamafactory/webui/components/chatbot.py function check_json_schema (line 34) | def check_json_schema(text: str, lang: str) -> None: function create_chat_box (line 49) | def create_chat_box( FILE: src/llamafactory/webui/components/data.py function prev_page (line 34) | def prev_page(page_index: int) -> int: function next_page (line 38) | def next_page(page_index: int, total_num: int) -> int: function can_preview (line 42) | def can_preview(dataset_dir: str, dataset: list) -> "gr.Button": function _load_data_file (line 60) | def _load_data_file(file_path: str) -> list[Any]: function get_preview (line 70) | def get_preview(dataset_dir: str, dataset: list, page_index: int) -> tup... function create_preview_box (line 86) | def create_preview_box(dataset_dir: "gr.Textbox", dataset: "gr.Dropdown"... FILE: src/llamafactory/webui/components/eval.py function create_eval_tab (line 33) | def create_eval_tab(engine: "Engine") -> dict[str, "Component"]: FILE: src/llamafactory/webui/components/export.py function can_quantize (line 40) | def can_quantize(checkpoint_path: str | list[str]) -> "gr.Dropdown": function save_model (line 47) | def save_model( function create_export_tab (line 118) | def create_export_tab(engine: "Engine") -> dict[str, "Component"]: FILE: src/llamafactory/webui/components/footer.py function get_device_memory (line 29) | def get_device_memory() -> "gr.Slider": function create_footer (line 39) | def create_footer() -> dict[str, "Component"]: FILE: src/llamafactory/webui/components/infer.py function create_infer_tab (line 32) | def create_infer_tab(engine: "Engine") -> dict[str, "Component"]: FILE: src/llamafactory/webui/components/top.py function create_top (line 33) | def create_top() -> dict[str, "Component"]: FILE: src/llamafactory/webui/components/train.py function create_train_tab (line 37) | def create_train_tab(engine: "Engine") -> dict[str, "Component"]: FILE: src/llamafactory/webui/control.py function switch_hub (line 41) | def switch_hub(hub_name: str) -> None: function can_quantize (line 50) | def can_quantize(finetuning_type: str) -> "gr.Dropdown": function can_quantize_to (line 62) | def can_quantize_to(quantization_method: str) -> "gr.Dropdown": function change_stage (line 78) | def change_stage(training_stage: str = list(TRAINING_STAGES.keys())[0]) ... function get_model_info (line 87) | def get_model_info(model_name: str) -> tuple[str, str]: function check_template (line 96) | def check_template(lang: str, template: str) -> None: function get_trainer_info (line 107) | def get_trainer_info(lang: str, output_path: os.PathLike, do_train: bool... function list_checkpoints (line 160) | def list_checkpoints(model_name: str, finetuning_type: str) -> "gr.Dropd... function list_config_paths (line 182) | def list_config_paths(current_time: str) -> "gr.Dropdown": function list_datasets (line 197) | def list_datasets(dataset_dir: str = None, training_stage: str = list(TR... function list_output_dirs (line 209) | def list_output_dirs(model_name: str | None, finetuning_type: str, curre... FILE: src/llamafactory/webui/engine.py class Engine (line 28) | class Engine: method __init__ (line 31) | def __init__(self, demo_mode: bool = False, pure_chat: bool = False) -... method _update_component (line 40) | def _update_component(self, input_dict: dict[str, dict[str, Any]]) -> ... method resume (line 49) | def resume(self): method change_lang (line 77) | def change_lang(self, lang: str): FILE: src/llamafactory/webui/interface.py function create_ui (line 38) | def create_ui(demo_mode: bool = False) -> "gr.Blocks": function create_web_demo (line 73) | def create_web_demo() -> "gr.Blocks": function run_web_ui (line 91) | def run_web_ui() -> None: function run_web_demo (line 100) | def run_web_demo() -> None: FILE: src/llamafactory/webui/manager.py class Manager (line 23) | class Manager: method __init__ (line 26) | def __init__(self) -> None: method add_elems (line 30) | def add_elems(self, tab_name: str, elem_dict: dict[str, "Component"]) ... method get_elem_list (line 37) | def get_elem_list(self) -> list["Component"]: method get_elem_iter (line 41) | def get_elem_iter(self) -> Generator[tuple[str, "Component"], None, No... method get_elem_by_id (line 46) | def get_elem_by_id(self, elem_id: str) -> "Component": method get_id_by_elem (line 53) | def get_id_by_elem(self, elem: "Component") -> str: method get_base_elems (line 57) | def get_base_elems(self) -> set["Component"]: FILE: src/llamafactory/webui/runner.py class Runner (line 54) | class Runner: method __init__ (line 57) | def __init__(self, manager: "Manager", demo_mode: bool = False) -> None: method set_abort (line 69) | def set_abort(self) -> None: method _initialize (line 74) | def _initialize(self, data: dict["Component", Any], do_train: bool, fr... method _finalize (line 116) | def _finalize(self, lang: str, finish_info: str) -> None: method _parse_train_args (line 126) | def _parse_train_args(self, data: dict["Component", Any]) -> dict[str,... method _parse_eval_args (line 292) | def _parse_eval_args(self, data: dict["Component", Any]) -> dict[str, ... method _preview (line 346) | def _preview(self, data: dict["Component", Any], do_train: bool) -> Ge... method _launch (line 357) | def _launch(self, data: dict["Component", Any], do_train: bool) -> Gen... method _build_config_dict (line 381) | def _build_config_dict(self, data: dict["Component", Any]) -> dict[str... method preview_train (line 392) | def preview_train(self, data): method preview_eval (line 395) | def preview_eval(self, data): method run_train (line 398) | def run_train(self, data): method run_eval (line 401) | def run_eval(self, data): method monitor (line 404) | def monitor(self): method save_args (line 462) | def save_args(self, data): method load_args (line 478) | def load_args(self, lang: str, config_path: str): method check_output_dir (line 492) | def check_output_dir(self, lang: str, model_name: str, finetuning_type... FILE: src/train.py function main (line 18) | def main(): function _mp_fn (line 22) | def _mp_fn(index): FILE: src/webui.py function main (line 21) | def main(): FILE: tests/check_license.py function main (line 22) | def main(): FILE: tests/conftest.py function pytest_configure (line 35) | def pytest_configure(config: Config): function _handle_runs_on (line 51) | def _handle_runs_on(items: list[Item]): function _handle_slow_tests (line 66) | def _handle_slow_tests(items: list[Item]): function _get_visible_devices_env (line 75) | def _get_visible_devices_env() -> str | None: function _handle_device_visibility (line 85) | def _handle_device_visibility(items: list[Item]): function pytest_collection_modifyitems (line 109) | def pytest_collection_modifyitems(config: Config, items: list[Item]): function _cleanup_distributed_state (line 123) | def _cleanup_distributed_state(): function _manage_distributed_env (line 131) | def _manage_distributed_env(request: FixtureRequest, monkeypatch: Monkey... function fix_valuehead_cpu_loading (line 166) | def fix_valuehead_cpu_loading(): function bypass_mistral_regex_check (line 172) | def bypass_mistral_regex_check(): FILE: tests/data/processor/test_feedback.py function test_feedback_data (line 48) | def test_feedback_data(num_samples: int): FILE: tests/data/processor/test_pairwise.py function _convert_sharegpt_to_openai (line 46) | def _convert_sharegpt_to_openai(messages: list[dict[str, str]]) -> list[... function test_pairwise_data (line 57) | def test_pairwise_data(num_samples: int): FILE: tests/data/processor/test_processor_utils.py function test_infer_seqlen (line 34) | def test_infer_seqlen(test_input: tuple[int, int, int], test_output: tup... FILE: tests/data/processor/test_supervised.py function test_supervised_single_turn (line 48) | def test_supervised_single_turn(num_samples: int): function test_supervised_multi_turn (line 77) | def test_supervised_multi_turn(num_samples: int): function test_supervised_train_on_prompt (line 95) | def test_supervised_train_on_prompt(num_samples: int): function test_supervised_mask_history (line 113) | def test_supervised_mask_history(num_samples: int): FILE: tests/data/processor/test_unsupervised.py function test_unsupervised_data (line 52) | def test_unsupervised_data(num_samples: int): FILE: tests/data/test_collator.py function test_base_collator (line 34) | def test_base_collator(): function test_multimodal_collator (line 78) | def test_multimodal_collator(): function test_4d_attention_mask (line 136) | def test_4d_attention_mask(): FILE: tests/data/test_converter.py function test_alpaca_converter (line 24) | def test_alpaca_converter(): function test_sharegpt_converter (line 45) | def test_sharegpt_converter(): FILE: tests/data/test_formatter.py function test_empty_formatter (line 42) | def test_empty_formatter(): function test_string_formatter (line 48) | def test_string_formatter(): function test_function_formatter (line 54) | def test_function_formatter(): function test_multi_function_formatter (line 64) | def test_multi_function_formatter(): function test_default_tool_formatter (line 75) | def test_default_tool_formatter(): function test_default_tool_extractor (line 94) | def test_default_tool_extractor(): function test_default_multi_tool_extractor (line 101) | def test_default_multi_tool_extractor(): function test_glm4_function_formatter (line 114) | def test_glm4_function_formatter(): function test_glm4_tool_formatter (line 121) | def test_glm4_tool_formatter(): function test_glm4_tool_extractor (line 132) | def test_glm4_tool_extractor(): function test_llama3_function_formatter (line 139) | def test_llama3_function_formatter(): function test_llama3_multi_function_formatter (line 148) | def test_llama3_multi_function_formatter(): function test_llama3_tool_formatter (line 159) | def test_llama3_tool_formatter(): function test_llama3_tool_extractor (line 173) | def test_llama3_tool_extractor(): function test_llama3_multi_tool_extractor (line 180) | def test_llama3_multi_tool_extractor(): function test_mistral_function_formatter (line 193) | def test_mistral_function_formatter(): function test_mistral_multi_function_formatter (line 203) | def test_mistral_multi_function_formatter(): function test_mistral_tool_formatter (line 215) | def test_mistral_tool_formatter(): function test_mistral_tool_extractor (line 224) | def test_mistral_tool_extractor(): function test_mistral_multi_tool_extractor (line 231) | def test_mistral_multi_tool_extractor(): function test_qwen_function_formatter (line 244) | def test_qwen_function_formatter(): function test_qwen_multi_function_formatter (line 253) | def test_qwen_multi_function_formatter(): function test_qwen_tool_formatter (line 264) | def test_qwen_tool_formatter(): function test_qwen_tool_extractor (line 278) | def test_qwen_tool_extractor(): function test_qwen_multi_tool_extractor (line 285) | def test_qwen_multi_tool_extractor(): function test_lfm2_function_formatter (line 298) | def test_lfm2_function_formatter(): function test_lfm2_multi_function_formatter (line 307) | def test_lfm2_multi_function_formatter(): function test_lfm2_tool_formatter (line 317) | def test_lfm2_tool_formatter(): function test_lfm2_tool_extractor (line 325) | def test_lfm2_tool_extractor(): function test_lfm2_multi_tool_extractor (line 332) | def test_lfm2_multi_tool_extractor(): function test_lfm2_tool_extractor_with_nested_dict (line 342) | def test_lfm2_tool_extractor_with_nested_dict(): function test_lfm2_tool_extractor_with_list_arg (line 354) | def test_lfm2_tool_extractor_with_list_arg(): function test_lfm2_tool_extractor_no_match (line 366) | def test_lfm2_tool_extractor_no_match(): function test_lfm2_tool_round_trip (line 374) | def test_lfm2_tool_round_trip(): FILE: tests/data/test_loader.py function test_load_train_only (line 44) | def test_load_train_only(): function test_load_val_size (line 51) | def test_load_val_size(): function test_load_eval_data (line 58) | def test_load_eval_data(): FILE: tests/data/test_mm_plugin.py function _get_mm_inputs (line 93) | def _get_mm_inputs(processor: "ProcessorMixin") -> dict[str, "torch.Tens... function _get_omni_inputs (line 98) | def _get_omni_inputs(processor: "ProcessorMixin") -> dict[str, "torch.Te... function _is_close (line 117) | def _is_close(batch_a: dict[str, Any], batch_b: dict[str, Any]) -> None: function _load_tokenizer_module (line 130) | def _load_tokenizer_module(model_name_or_path: str) -> "TokenizerModule": function _check_plugin (line 135) | def _check_plugin( function test_base_plugin (line 183) | def test_base_plugin(): function test_gemma3_plugin (line 193) | def test_gemma3_plugin(): function test_internvl_plugin (line 215) | def test_internvl_plugin(): function test_llama4_plugin (line 234) | def test_llama4_plugin(): function test_llava_plugin (line 255) | def test_llava_plugin(): function test_llava_next_plugin (line 269) | def test_llava_next_plugin(): function test_llava_next_video_plugin (line 283) | def test_llava_next_video_plugin(): function test_paligemma_plugin (line 298) | def test_paligemma_plugin(): function test_pixtral_plugin (line 318) | def test_pixtral_plugin(): function test_qwen2_omni_plugin (line 341) | def test_qwen2_omni_plugin(): function test_qwen2_vl_plugin (line 371) | def test_qwen2_vl_plugin(): function test_qwen3_vl_plugin (line 389) | def test_qwen3_vl_plugin(): function test_video_llava_plugin (line 411) | def test_video_llava_plugin(): function test_lfm2_vl_plugin (line 425) | def test_lfm2_vl_plugin(): FILE: tests/data/test_template.py function _check_tokenization (line 51) | def _check_tokenization( function _check_template (line 64) | def _check_template( function test_encode_oneturn (line 95) | def test_encode_oneturn(): function test_encode_multiturn (line 110) | def test_encode_multiturn(): function test_reasoning_encode_oneturn (line 133) | def test_reasoning_encode_oneturn(cot_messages: bool, enable_thinking: b... function test_reasoning_encode_multiturn (line 159) | def test_reasoning_encode_multiturn(cot_messages: bool, enable_thinking:... function test_jinja_template (line 186) | def test_jinja_template(): function test_ollama_modelfile (line 196) | def test_ollama_modelfile(): function test_get_stop_token_ids (line 214) | def test_get_stop_token_ids(): function test_gemma_template (line 222) | def test_gemma_template(): function test_gemma2_template (line 235) | def test_gemma2_template(): function test_llama3_template (line 248) | def test_llama3_template(): function test_llama4_template (line 260) | def test_llama4_template(): function test_phi4_template (line 272) | def test_phi4_template(): function test_qwen2_5_template (line 285) | def test_qwen2_5_template(): function test_qwen3_template (line 299) | def test_qwen3_template(cot_messages: bool): function test_parse_llama3_template (line 317) | def test_parse_llama3_template(): function test_parse_qwen_template (line 332) | def test_parse_qwen_template(): function test_parse_qwen3_template (line 345) | def test_parse_qwen3_template(): FILE: tests/e2e/test_chat.py function test_chat (line 41) | def test_chat(): function test_stream_chat (line 47) | def test_stream_chat(): FILE: tests/e2e/test_sglang.py function test_chat (line 44) | def test_chat(): function test_stream_chat (line 54) | def test_stream_chat(): FILE: tests/e2e/test_train.py function test_run_exp (line 63) | def test_run_exp(stage: str, dataset: str): function test_export (line 70) | def test_export(): FILE: tests/eval/test_eval_template.py function test_eval_template_en (line 21) | def test_eval_template_en(): function test_eval_template_zh (line 60) | def test_eval_template_zh(): FILE: tests/model/model_utils/test_add_tokens.py function test_add_tokens (line 29) | def test_add_tokens(special_tokens: bool): FILE: tests/model/model_utils/test_attention.py function is_torch_sdpa_available (line 26) | def is_torch_sdpa_available(): function test_attention (line 43) | def test_attention(): FILE: tests/model/model_utils/test_checkpointing.py function test_vanilla_checkpointing (line 43) | def test_vanilla_checkpointing(disable_gradient_checkpointing: bool): function test_unsloth_gradient_checkpointing (line 49) | def test_unsloth_gradient_checkpointing(): function test_upcast_layernorm (line 55) | def test_upcast_layernorm(): function test_upcast_lmhead_output (line 62) | def test_upcast_lmhead_output(): FILE: tests/model/model_utils/test_misc.py function test_expanded_modules (line 28) | def test_expanded_modules(): FILE: tests/model/model_utils/test_packing.py function test_get_seqlens_in_batch (line 37) | def test_get_seqlens_in_batch(attention_mask, golden_seq_lens): function test_get_unpad_data (line 63) | def test_get_unpad_data(attention_mask, golden_indices, golden_cu_seqlen... FILE: tests/model/model_utils/test_visual.py function test_visual_full (line 30) | def test_visual_full(freeze_vision_tower: bool, freeze_multi_modal_proje... function test_visual_lora (line 53) | def test_visual_lora(freeze_vision_tower: bool, freeze_language_model: b... function test_visual_model_save_load (line 84) | def test_visual_model_save_load(): FILE: tests/model/test_base.py function test_base (line 33) | def test_base(): function test_valuehead (line 40) | def test_valuehead(): FILE: tests/model/test_freeze.py function test_freeze_train_all_modules (line 46) | def test_freeze_train_all_modules(): function test_freeze_train_extra_modules (line 57) | def test_freeze_train_extra_modules(): function test_freeze_inference (line 68) | def test_freeze_inference(): FILE: tests/model/test_full.py function test_full_train (line 46) | def test_full_train(): function test_full_inference (line 53) | def test_full_inference(): FILE: tests/model/test_lora.py function test_lora_train_qv_modules (line 58) | def test_lora_train_qv_modules(): function test_lora_train_all_modules (line 64) | def test_lora_train_all_modules(): function test_lora_train_extra_modules (line 70) | def test_lora_train_extra_modules(): function test_lora_train_old_adapters (line 76) | def test_lora_train_old_adapters(): function test_lora_train_new_adapters (line 82) | def test_lora_train_new_adapters(): function test_lora_train_valuehead (line 91) | def test_lora_train_valuehead(): function test_lora_inference (line 100) | def test_lora_inference(): FILE: tests/model/test_pissa.py function test_pissa_train (line 53) | def test_pissa_train(): function test_pissa_inference (line 60) | def test_pissa_inference(): FILE: tests/train/test_sft_trainer.py class DataCollatorWithVerbose (line 49) | class DataCollatorWithVerbose(DataCollatorWithPadding): method __call__ (line 52) | def __call__(self, features: list[dict[str, Any]]) -> dict[str, Any]: function test_shuffle (line 63) | def test_shuffle(disable_shuffling: bool): FILE: tests_v1/accelerator/test_interface.py function _all_reduce_tests (line 26) | def _all_reduce_tests(local_rank: int, world_size: int, master_port: int): function test_all_device (line 48) | def test_all_device(): function test_multi_device (line 57) | def test_multi_device(): FILE: tests_v1/config/test_args_parser.py function test_get_args_from_yaml (line 22) | def test_get_args_from_yaml(tmp_path: Path): FILE: tests_v1/conftest.py function pytest_configure (line 36) | def pytest_configure(config: Config): function _handle_runs_on (line 52) | def _handle_runs_on(items: list[Item]): function _handle_slow_tests (line 67) | def _handle_slow_tests(items: list[Item]): function _get_visible_devices_env (line 76) | def _get_visible_devices_env() -> str | None: function _handle_device_visibility (line 86) | def _handle_device_visibility(items: list[Item]): function pytest_collection_modifyitems (line 110) | def pytest_collection_modifyitems(config: Config, items: list[Item]): function _set_env (line 124) | def _set_env(): function _cleanup_distributed_state (line 135) | def _cleanup_distributed_state(): function _manage_distributed_env (line 143) | def _manage_distributed_env(request: FixtureRequest, monkeypatch: Monkey... function bypass_mistral_regex_check (line 178) | def bypass_mistral_regex_check(): FILE: tests_v1/core/test_data_engine.py function test_map_dataset (line 25) | def test_map_dataset(num_samples: int): FILE: tests_v1/core/test_model_loader.py function test_tiny_qwen (line 21) | def test_tiny_qwen(): function test_tiny_qwen_with_kernel_plugin (line 30) | def test_tiny_qwen_with_kernel_plugin(): FILE: tests_v1/core/utils/test_batching.py function test_normal_batching (line 21) | def test_normal_batching(): FILE: tests_v1/core/utils/test_rendering.py function _get_input_ids (line 26) | def _get_input_ids(inputs: list | dict) -> list: function test_chatml_rendering (line 87) | def test_chatml_rendering(): function test_chatml_parse (line 109) | def test_chatml_parse(): function test_chatml_rendering_remote (line 118) | def test_chatml_rendering_remote(num_samples: int): function test_qwen3_nothink_rendering (line 130) | def test_qwen3_nothink_rendering(): function test_qwen3_nothink_parse (line 158) | def test_qwen3_nothink_parse(): function test_qwen3_nothink_rendering_remote (line 178) | def test_qwen3_nothink_rendering_remote(num_samples: int): function test_process_sft_samples (line 198) | def test_process_sft_samples(): function test_process_dpo_samples (line 211) | def test_process_dpo_samples(): FILE: tests_v1/plugins/data_plugins/test_converter.py function test_alpaca_converter (line 26) | def test_alpaca_converter(num_samples: int): function test_sharegpt_converter (line 52) | def test_sharegpt_converter(): function test_pair_converter (line 75) | def test_pair_converter(num_samples: int): FILE: tests_v1/plugins/model_plugins/test_init_plugin.py function test_init_on_meta (line 21) | def test_init_on_meta(): function test_init_on_rank0 (line 32) | def test_init_on_rank0(): function test_init_on_default (line 46) | def test_init_on_default(): FILE: tests_v1/plugins/model_plugins/test_kernel_plugin.py function _apply_kernel (line 22) | def _apply_kernel(rank) -> None: function _apply_all_kernels (line 45) | def _apply_all_kernels(rank) -> None: function test_apply_kernel (line 68) | def test_apply_kernel(): function test_apply_all_kernels (line 72) | def test_apply_all_kernels(): FILE: tests_v1/plugins/model_plugins/test_peft.py function model_path (line 27) | def model_path(): function model (line 32) | def model(model_path): function tokenizer (line 37) | def tokenizer(model_path): function adapter_path (line 42) | def adapter_path(tmp_path): function test_find_all_linear_modules (line 60) | def test_find_all_linear_modules(model): function test_get_lora_model (line 67) | def test_get_lora_model(model): function test_get_freeze_model_layers (line 76) | def test_get_freeze_model_layers(model): function test_get_freeze_model_modules (line 94) | def test_get_freeze_model_modules(model): function test_load_adapter_single_for_inference (line 109) | def test_load_adapter_single_for_inference(model, adapter_path): function test_load_adapter_resume_train (line 116) | def test_load_adapter_resume_train(model, adapter_path): function test_load_adapter_train_multiple_disallowed (line 123) | def test_load_adapter_train_multiple_disallowed(model, adapter_path): function test_load_adapter_infer_multiple_merges (line 129) | def test_load_adapter_infer_multiple_merges(model, adapter_path): function test_merge_and_export_model (line 136) | def test_merge_and_export_model(tmp_path, adapter_path): FILE: tests_v1/plugins/model_plugins/test_quantization_plugin.py function check_quantization_status (line 24) | def check_quantization_status(model): function test_quantization_plugin (line 39) | def test_quantization_plugin(name, quantization_bit): FILE: tests_v1/plugins/trainer_plugins/distributed/test_fsdp2.py function collect_non_persistent_buffers (line 33) | def collect_non_persistent_buffers(model): function test_fsdp2_meta_loading_buffers_and_tied_weights (line 45) | def test_fsdp2_meta_loading_buffers_and_tied_weights(): FILE: tests_v1/sampler/test_cli_sampler.py function test_sync_sampler (line 23) | def test_sync_sampler(): FILE: tests_v1/trainers/test_fsdp2_sft_trainer.py function test_fsdp2_sft_trainer (line 24) | def test_fsdp2_sft_trainer(tmp_path: Path):