mirror of
				https://github.com/hiyouga/LLaMA-Factory.git
				synced 2025-11-04 09:52:14 +08:00 
			
		
		
		
	[misc] update license year & fix llama pro (#6814)
* fix llamapro script * change year Former-commit-id: d9ae594178796994d400a5f207d6499712816f89
This commit is contained in:
		
							parent
							
								
									0817c24c04
								
							
						
					
					
						commit
						c2022431aa
					
				@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
@ -19,15 +19,10 @@ from typing import Any, Dict
 | 
			
		||||
 | 
			
		||||
import fire
 | 
			
		||||
import torch
 | 
			
		||||
from huggingface_hub import split_torch_state_dict_into_shards
 | 
			
		||||
from safetensors.torch import save_file
 | 
			
		||||
from tqdm import tqdm
 | 
			
		||||
from transformers.modeling_utils import (
 | 
			
		||||
    SAFE_WEIGHTS_INDEX_NAME,
 | 
			
		||||
    SAFE_WEIGHTS_NAME,
 | 
			
		||||
    WEIGHTS_INDEX_NAME,
 | 
			
		||||
    WEIGHTS_NAME,
 | 
			
		||||
    shard_checkpoint,
 | 
			
		||||
)
 | 
			
		||||
from transformers.modeling_utils import SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, WEIGHTS_INDEX_NAME, WEIGHTS_NAME
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
CONFIG_NAME = "config.json"
 | 
			
		||||
@ -40,34 +35,42 @@ def save_weight(input_dir: str, output_dir: str, shard_size: str, save_safetenso
 | 
			
		||||
            shard_weight = torch.load(os.path.join(input_dir, filepath), map_location="cpu")
 | 
			
		||||
            baichuan2_state_dict.update(shard_weight)
 | 
			
		||||
 | 
			
		||||
    llama2_state_dict: Dict[str, torch.Tensor] = OrderedDict()
 | 
			
		||||
    llama_state_dict: Dict[str, torch.Tensor] = OrderedDict()
 | 
			
		||||
    for key, value in tqdm(baichuan2_state_dict.items(), desc="Convert format"):
 | 
			
		||||
        if "W_pack" in key:
 | 
			
		||||
            proj_size = value.size(0) // 3
 | 
			
		||||
            llama2_state_dict[key.replace("W_pack", "q_proj")] = value[:proj_size, :]
 | 
			
		||||
            llama2_state_dict[key.replace("W_pack", "k_proj")] = value[proj_size : 2 * proj_size, :]
 | 
			
		||||
            llama2_state_dict[key.replace("W_pack", "v_proj")] = value[2 * proj_size :, :]
 | 
			
		||||
            llama_state_dict[key.replace("W_pack", "q_proj")] = value[:proj_size, :]
 | 
			
		||||
            llama_state_dict[key.replace("W_pack", "k_proj")] = value[proj_size : 2 * proj_size, :]
 | 
			
		||||
            llama_state_dict[key.replace("W_pack", "v_proj")] = value[2 * proj_size :, :]
 | 
			
		||||
        elif "lm_head" in key:
 | 
			
		||||
            llama2_state_dict[key] = torch.nn.functional.normalize(value)
 | 
			
		||||
            llama_state_dict[key] = torch.nn.functional.normalize(value)
 | 
			
		||||
        else:
 | 
			
		||||
            llama2_state_dict[key] = value
 | 
			
		||||
            llama_state_dict[key] = value
 | 
			
		||||
 | 
			
		||||
    weights_name = SAFE_WEIGHTS_NAME if save_safetensors else WEIGHTS_NAME
 | 
			
		||||
    shards, index = shard_checkpoint(llama2_state_dict, max_shard_size=shard_size, weights_name=weights_name)
 | 
			
		||||
 | 
			
		||||
    for shard_file, shard in tqdm(shards.items(), desc="Save weights"):
 | 
			
		||||
    filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
 | 
			
		||||
    state_dict_split = split_torch_state_dict_into_shards(
 | 
			
		||||
        llama_state_dict, filename_pattern=filename_pattern, max_shard_size=shard_size
 | 
			
		||||
    )
 | 
			
		||||
    for shard_file, tensors in tqdm(state_dict_split.filename_to_tensors.items(), desc="Save weights"):
 | 
			
		||||
        shard = {tensor: llama_state_dict[tensor].contiguous() for tensor in tensors}
 | 
			
		||||
        if save_safetensors:
 | 
			
		||||
            save_file(shard, os.path.join(output_dir, shard_file), metadata={"format": "pt"})
 | 
			
		||||
        else:
 | 
			
		||||
            torch.save(shard, os.path.join(output_dir, shard_file))
 | 
			
		||||
 | 
			
		||||
    if index is None:
 | 
			
		||||
        print(f"Model weights saved in {os.path.join(output_dir, WEIGHTS_NAME)}")
 | 
			
		||||
    if not state_dict_split.is_sharded:
 | 
			
		||||
        print(f"Model weights saved in {os.path.join(output_dir, weights_name)}.")
 | 
			
		||||
    else:
 | 
			
		||||
        index = {
 | 
			
		||||
            "metadata": state_dict_split.metadata,
 | 
			
		||||
            "weight_map": state_dict_split.tensor_to_filename,
 | 
			
		||||
        }
 | 
			
		||||
        index_name = SAFE_WEIGHTS_INDEX_NAME if save_safetensors else WEIGHTS_INDEX_NAME
 | 
			
		||||
        with open(os.path.join(output_dir, index_name), "w", encoding="utf-8") as f:
 | 
			
		||||
            json.dump(index, f, indent=2, sort_keys=True)
 | 
			
		||||
        print(f"Model weights saved in {output_dir}")
 | 
			
		||||
 | 
			
		||||
        print(f"Model weights saved in {output_dir}.")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def save_config(input_dir: str, output_dir: str):
 | 
			
		||||
@ -81,6 +84,7 @@ def save_config(input_dir: str, output_dir: str):
 | 
			
		||||
 | 
			
		||||
    with open(os.path.join(output_dir, CONFIG_NAME), "w", encoding="utf-8") as f:
 | 
			
		||||
        json.dump(llama2_config_dict, f, indent=2)
 | 
			
		||||
 | 
			
		||||
    print(f"Model config saved in {os.path.join(output_dir, CONFIG_NAME)}")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
@ -19,16 +19,11 @@ from typing import Any, Dict
 | 
			
		||||
 | 
			
		||||
import fire
 | 
			
		||||
import torch
 | 
			
		||||
from huggingface_hub import split_torch_state_dict_into_shards
 | 
			
		||||
from safetensors import safe_open
 | 
			
		||||
from safetensors.torch import save_file
 | 
			
		||||
from tqdm import tqdm
 | 
			
		||||
from transformers.modeling_utils import (
 | 
			
		||||
    SAFE_WEIGHTS_INDEX_NAME,
 | 
			
		||||
    SAFE_WEIGHTS_NAME,
 | 
			
		||||
    WEIGHTS_INDEX_NAME,
 | 
			
		||||
    WEIGHTS_NAME,
 | 
			
		||||
    shard_checkpoint,
 | 
			
		||||
)
 | 
			
		||||
from transformers.modeling_utils import SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, WEIGHTS_INDEX_NAME, WEIGHTS_NAME
 | 
			
		||||
from transformers.utils import check_min_version
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -49,60 +44,68 @@ def save_weight(input_dir: str, output_dir: str, shard_size: str, save_safetenso
 | 
			
		||||
                for key in f.keys():
 | 
			
		||||
                    qwen_state_dict[key] = f.get_tensor(key)
 | 
			
		||||
 | 
			
		||||
    llama2_state_dict: Dict[str, torch.Tensor] = OrderedDict()
 | 
			
		||||
    llama_state_dict: Dict[str, torch.Tensor] = OrderedDict()
 | 
			
		||||
    torch_dtype = None
 | 
			
		||||
    for key, value in tqdm(qwen_state_dict.items(), desc="Convert format"):
 | 
			
		||||
        if torch_dtype is None:
 | 
			
		||||
            torch_dtype = value.dtype
 | 
			
		||||
        if "wte" in key:
 | 
			
		||||
            llama2_state_dict["model.embed_tokens.weight"] = value
 | 
			
		||||
            llama_state_dict["model.embed_tokens.weight"] = value
 | 
			
		||||
        elif "ln_f" in key:
 | 
			
		||||
            llama2_state_dict["model.norm.weight"] = value
 | 
			
		||||
            llama_state_dict["model.norm.weight"] = value
 | 
			
		||||
        else:
 | 
			
		||||
            key = key.replace("transformer.h", "model.layers")
 | 
			
		||||
            if "attn.c_attn" in key:
 | 
			
		||||
                proj_size = value.size(0) // 3
 | 
			
		||||
                llama2_state_dict[key.replace("attn.c_attn", "self_attn.q_proj")] = value[:proj_size, ...]
 | 
			
		||||
                llama2_state_dict[key.replace("attn.c_attn", "self_attn.k_proj")] = value[
 | 
			
		||||
                llama_state_dict[key.replace("attn.c_attn", "self_attn.q_proj")] = value[:proj_size, ...]
 | 
			
		||||
                llama_state_dict[key.replace("attn.c_attn", "self_attn.k_proj")] = value[
 | 
			
		||||
                    proj_size : 2 * proj_size, ...
 | 
			
		||||
                ]
 | 
			
		||||
                llama2_state_dict[key.replace("attn.c_attn", "self_attn.v_proj")] = value[2 * proj_size :, ...]
 | 
			
		||||
                llama_state_dict[key.replace("attn.c_attn", "self_attn.v_proj")] = value[2 * proj_size :, ...]
 | 
			
		||||
            elif "attn.c_proj" in key:
 | 
			
		||||
                llama2_state_dict[key.replace("attn.c_proj", "self_attn.o_proj")] = value
 | 
			
		||||
                llama2_state_dict[key.replace("attn.c_proj.weight", "self_attn.o_proj.bias")] = torch.zeros_like(
 | 
			
		||||
                llama_state_dict[key.replace("attn.c_proj", "self_attn.o_proj")] = value
 | 
			
		||||
                llama_state_dict[key.replace("attn.c_proj.weight", "self_attn.o_proj.bias")] = torch.zeros_like(
 | 
			
		||||
                    value[:, 0]
 | 
			
		||||
                ).squeeze()
 | 
			
		||||
            elif "ln_1" in key:
 | 
			
		||||
                llama2_state_dict[key.replace("ln_1", "input_layernorm")] = value
 | 
			
		||||
                llama_state_dict[key.replace("ln_1", "input_layernorm")] = value
 | 
			
		||||
            elif "ln_2" in key:
 | 
			
		||||
                llama2_state_dict[key.replace("ln_2", "post_attention_layernorm")] = value
 | 
			
		||||
                llama_state_dict[key.replace("ln_2", "post_attention_layernorm")] = value
 | 
			
		||||
            elif "mlp.w1" in key:
 | 
			
		||||
                llama2_state_dict[key.replace("mlp.w1", "mlp.up_proj")] = value
 | 
			
		||||
                llama_state_dict[key.replace("mlp.w1", "mlp.up_proj")] = value
 | 
			
		||||
            elif "mlp.w2" in key:
 | 
			
		||||
                llama2_state_dict[key.replace("mlp.w2", "mlp.gate_proj")] = value
 | 
			
		||||
                llama_state_dict[key.replace("mlp.w2", "mlp.gate_proj")] = value
 | 
			
		||||
            elif "mlp.c_proj" in key:
 | 
			
		||||
                llama2_state_dict[key.replace("mlp.c_proj", "mlp.down_proj")] = value
 | 
			
		||||
                llama_state_dict[key.replace("mlp.c_proj", "mlp.down_proj")] = value
 | 
			
		||||
            elif "lm_head" in key:
 | 
			
		||||
                llama2_state_dict[key] = value
 | 
			
		||||
                llama_state_dict[key] = value
 | 
			
		||||
            else:
 | 
			
		||||
                raise KeyError(f"Unable to process key {key}")
 | 
			
		||||
 | 
			
		||||
    weights_name = SAFE_WEIGHTS_NAME if save_safetensors else WEIGHTS_NAME
 | 
			
		||||
    shards, index = shard_checkpoint(llama2_state_dict, max_shard_size=shard_size, weights_name=weights_name)
 | 
			
		||||
 | 
			
		||||
    for shard_file, shard in tqdm(shards.items(), desc="Save weights"):
 | 
			
		||||
    filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
 | 
			
		||||
    state_dict_split = split_torch_state_dict_into_shards(
 | 
			
		||||
        llama_state_dict, filename_pattern=filename_pattern, max_shard_size=shard_size
 | 
			
		||||
    )
 | 
			
		||||
    for shard_file, tensors in tqdm(state_dict_split.filename_to_tensors.items(), desc="Save weights"):
 | 
			
		||||
        shard = {tensor: llama_state_dict[tensor].contiguous() for tensor in tensors}
 | 
			
		||||
        if save_safetensors:
 | 
			
		||||
            save_file(shard, os.path.join(output_dir, shard_file), metadata={"format": "pt"})
 | 
			
		||||
        else:
 | 
			
		||||
            torch.save(shard, os.path.join(output_dir, shard_file))
 | 
			
		||||
 | 
			
		||||
    if index is None:
 | 
			
		||||
        print(f"Model weights saved in {os.path.join(output_dir, weights_name)}")
 | 
			
		||||
    if not state_dict_split.is_sharded:
 | 
			
		||||
        print(f"Model weights saved in {os.path.join(output_dir, weights_name)}.")
 | 
			
		||||
    else:
 | 
			
		||||
        index = {
 | 
			
		||||
            "metadata": state_dict_split.metadata,
 | 
			
		||||
            "weight_map": state_dict_split.tensor_to_filename,
 | 
			
		||||
        }
 | 
			
		||||
        index_name = SAFE_WEIGHTS_INDEX_NAME if save_safetensors else WEIGHTS_INDEX_NAME
 | 
			
		||||
        with open(os.path.join(output_dir, index_name), "w", encoding="utf-8") as f:
 | 
			
		||||
            json.dump(index, f, indent=2, sort_keys=True)
 | 
			
		||||
        print(f"Model weights saved in {output_dir}")
 | 
			
		||||
 | 
			
		||||
        print(f"Model weights saved in {output_dir}.")
 | 
			
		||||
 | 
			
		||||
    return str(torch_dtype).replace("torch.", "")
 | 
			
		||||
 | 
			
		||||
@ -134,6 +137,7 @@ def save_config(input_dir: str, output_dir: str, torch_dtype: str):
 | 
			
		||||
 | 
			
		||||
    with open(os.path.join(output_dir, CONFIG_NAME), "w", encoding="utf-8") as f:
 | 
			
		||||
        json.dump(llama2_config_dict, f, indent=2)
 | 
			
		||||
 | 
			
		||||
    print(f"Model config saved in {os.path.join(output_dir, CONFIG_NAME)}")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 Tencent Inc. and the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 Tencent Inc. and the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# This code is inspired by the Tencent's LLaMA-Pro library.
 | 
			
		||||
# https://github.com/TencentARC/LLaMA-Pro/blob/main/scripts/block_expansion.py
 | 
			
		||||
@ -18,20 +18,15 @@
 | 
			
		||||
import json
 | 
			
		||||
import os
 | 
			
		||||
from collections import OrderedDict
 | 
			
		||||
from typing import TYPE_CHECKING
 | 
			
		||||
from typing import TYPE_CHECKING, Dict
 | 
			
		||||
 | 
			
		||||
import fire
 | 
			
		||||
import torch
 | 
			
		||||
from huggingface_hub import split_torch_state_dict_into_shards
 | 
			
		||||
from safetensors.torch import save_file
 | 
			
		||||
from tqdm import tqdm
 | 
			
		||||
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer, PreTrainedModel
 | 
			
		||||
from transformers.modeling_utils import (
 | 
			
		||||
    SAFE_WEIGHTS_INDEX_NAME,
 | 
			
		||||
    SAFE_WEIGHTS_NAME,
 | 
			
		||||
    WEIGHTS_INDEX_NAME,
 | 
			
		||||
    WEIGHTS_NAME,
 | 
			
		||||
    shard_checkpoint,
 | 
			
		||||
)
 | 
			
		||||
from transformers.modeling_utils import SAFE_WEIGHTS_INDEX_NAME, SAFE_WEIGHTS_NAME, WEIGHTS_INDEX_NAME, WEIGHTS_NAME
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if TYPE_CHECKING:
 | 
			
		||||
@ -46,41 +41,36 @@ def block_expansion(
 | 
			
		||||
    model_name_or_path: str,
 | 
			
		||||
    output_dir: str,
 | 
			
		||||
    num_expand: int,
 | 
			
		||||
    shard_size: str = "2GB",
 | 
			
		||||
    shard_size: str = "5GB",
 | 
			
		||||
    save_safetensors: bool = True,
 | 
			
		||||
):
 | 
			
		||||
    r"""
 | 
			
		||||
    Performs block expansion for LLaMA, Mistral, Qwen1.5 or Yi models.
 | 
			
		||||
    Performs block expansion for LLaMA, Mistral, Qwen2 or Yi models.
 | 
			
		||||
    Usage: python llama_pro.py --model_name_or_path meta-llama/Llama-2-7b-hf --output_dir llama2_pro --num_expand 8
 | 
			
		||||
    """
 | 
			
		||||
    config: "PretrainedConfig" = AutoConfig.from_pretrained(model_name_or_path)
 | 
			
		||||
    config: "PretrainedConfig" = AutoConfig.from_pretrained(model_name_or_path, trust_remote_code=True)
 | 
			
		||||
    num_layers = getattr(config, "num_hidden_layers")
 | 
			
		||||
    setattr(config, "num_hidden_layers", num_layers + num_expand)
 | 
			
		||||
    config.save_pretrained(output_dir)
 | 
			
		||||
 | 
			
		||||
    tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
 | 
			
		||||
    tokenizer.save_pretrained(output_dir)
 | 
			
		||||
 | 
			
		||||
    config = AutoConfig.from_pretrained(model_name_or_path)  # load the original one
 | 
			
		||||
    if save_safetensors:
 | 
			
		||||
        setattr(config, "tie_word_embeddings", False)  # safetensors does not allow shared weights
 | 
			
		||||
 | 
			
		||||
    model = AutoModelForCausalLM.from_pretrained(
 | 
			
		||||
        model_name_or_path,
 | 
			
		||||
        config=config,
 | 
			
		||||
        torch_dtype="auto",
 | 
			
		||||
        trust_remote_code=True,
 | 
			
		||||
        low_cpu_mem_usage=True,
 | 
			
		||||
    )
 | 
			
		||||
    assert isinstance(model, PreTrainedModel)  # type hint
 | 
			
		||||
    state_dict = model.state_dict()
 | 
			
		||||
 | 
			
		||||
    if num_layers % num_expand != 0:
 | 
			
		||||
        raise ValueError(f"`num_layers` {num_layers} should be divisible by `num_expand` {num_expand}.")
 | 
			
		||||
 | 
			
		||||
    setattr(config, "num_hidden_layers", num_layers + num_expand)
 | 
			
		||||
    config.save_pretrained(output_dir)
 | 
			
		||||
 | 
			
		||||
    tokenizer = AutoTokenizer.from_pretrained(model_name_or_path, trust_remote_code=True)
 | 
			
		||||
    tokenizer.save_pretrained(output_dir)
 | 
			
		||||
 | 
			
		||||
    print(f"Expanding model of {num_layers} layers to {num_layers + num_expand} layers.")
 | 
			
		||||
    model = AutoModelForCausalLM.from_pretrained(
 | 
			
		||||
        model_name_or_path, torch_dtype="auto", device_map="cpu", trust_remote_code=True, low_cpu_mem_usage=True
 | 
			
		||||
    )
 | 
			
		||||
    assert isinstance(model, PreTrainedModel)  # type hint
 | 
			
		||||
    if save_safetensors and getattr(model.config, "tie_word_embeddings", False):
 | 
			
		||||
        del model.lm_head  # safetensors does not allow shared weights
 | 
			
		||||
 | 
			
		||||
    split = num_layers // num_expand
 | 
			
		||||
    layer_cnt = 0
 | 
			
		||||
    output_state_dict = OrderedDict()
 | 
			
		||||
    state_dict = model.state_dict()
 | 
			
		||||
    output_state_dict: Dict[str, "torch.Tensor"] = OrderedDict()
 | 
			
		||||
    for i in range(num_layers):
 | 
			
		||||
        for key, value in state_dict.items():
 | 
			
		||||
            if f".{i:d}." in key:
 | 
			
		||||
@ -104,17 +94,24 @@ def block_expansion(
 | 
			
		||||
            output_state_dict[key] = value
 | 
			
		||||
 | 
			
		||||
    weights_name = SAFE_WEIGHTS_NAME if save_safetensors else WEIGHTS_NAME
 | 
			
		||||
    shards, index = shard_checkpoint(output_state_dict, max_shard_size=shard_size, weights_name=weights_name)
 | 
			
		||||
 | 
			
		||||
    for shard_file, shard in tqdm(shards.items(), desc="Save weights"):
 | 
			
		||||
    filename_pattern = weights_name.replace(".bin", "{suffix}.bin").replace(".safetensors", "{suffix}.safetensors")
 | 
			
		||||
    state_dict_split = split_torch_state_dict_into_shards(
 | 
			
		||||
        output_state_dict, filename_pattern=filename_pattern, max_shard_size=shard_size
 | 
			
		||||
    )
 | 
			
		||||
    for shard_file, tensors in tqdm(state_dict_split.filename_to_tensors.items(), desc="Save weights"):
 | 
			
		||||
        shard = {tensor: output_state_dict[tensor].contiguous() for tensor in tensors}
 | 
			
		||||
        if save_safetensors:
 | 
			
		||||
            save_file(shard, os.path.join(output_dir, shard_file), metadata={"format": "pt"})
 | 
			
		||||
        else:
 | 
			
		||||
            torch.save(shard, os.path.join(output_dir, shard_file))
 | 
			
		||||
 | 
			
		||||
    if index is None:
 | 
			
		||||
    if not state_dict_split.is_sharded:
 | 
			
		||||
        print(f"Model weights saved in {os.path.join(output_dir, weights_name)}.")
 | 
			
		||||
    else:
 | 
			
		||||
        index = {
 | 
			
		||||
            "metadata": state_dict_split.metadata,
 | 
			
		||||
            "weight_map": state_dict_split.tensor_to_filename,
 | 
			
		||||
        }
 | 
			
		||||
        index_name = SAFE_WEIGHTS_INDEX_NAME if save_safetensors else WEIGHTS_INDEX_NAME
 | 
			
		||||
        with open(os.path.join(output_dir, index_name), "w", encoding="utf-8") as f:
 | 
			
		||||
            json.dump(index, f, indent=2, sort_keys=True)
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 HuggingFace Inc. and the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 HuggingFace Inc. and the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# This code is based on the HuggingFace's PEFT library.
 | 
			
		||||
# https://github.com/huggingface/peft/blob/v0.10.0/examples/loftq_finetuning/quantize_save_load.py
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 HuggingFace Inc. and the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 HuggingFace Inc. and the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# This code is based on the HuggingFace's PEFT library.
 | 
			
		||||
# https://github.com/huggingface/peft/blob/v0.11.0/examples/pissa_finetuning/preprocess.py
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 Microsoft Corporation and the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 Microsoft Corporation and the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# This code is inspired by the Microsoft's DeepSpeed library.
 | 
			
		||||
# https://www.deepspeed.ai/tutorials/flops-profiler/
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 imoneoi and the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 imoneoi and the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# This code is inspired by the imoneoi's OpenChat library.
 | 
			
		||||
# https://github.com/imoneoi/openchat/blob/3.6.0/ochat/training_deepspeed/train.py
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								setup.py
									
									
									
									
									
								
							@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
@ -642,7 +642,7 @@ _register_template(
 | 
			
		||||
 | 
			
		||||
_register_template(
 | 
			
		||||
    name="empty",
 | 
			
		||||
    efficient_eos=True,
 | 
			
		||||
    format_assistant=StringFormatter(slots=["{{content}}"]),
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# This code is inspired by the Dan's test library.
 | 
			
		||||
# https://github.com/hendrycks/test/blob/master/evaluate_flan.py
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
# Copyright 2024 the LlamaFactory team.
 | 
			
		||||
# Copyright 2025 the LlamaFactory team.
 | 
			
		||||
#
 | 
			
		||||
# Licensed under the Apache License, Version 2.0 (the "License");
 | 
			
		||||
# you may not use this file except in compliance with the License.
 | 
			
		||||
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user