HuggingFace镜像/T3Q_SOLAR_SLERP_v1.0-openmind
模型介绍文件和版本分析
下载使用量0

未命名模型 (1)

这是一个使用 mergekit 创建的预训练语言模型合并体。

在 Openmind 中使用

import torch
from openmind import AutoTokenizer, AutoModelForCausalLM, is_torch_npu_available
from openmind_hub import snapshot_download
import argparse
import time

def parse_args():
    parser = argparse.ArgumentParser()
    parser.add_argument(
        "--model_name_or_path",
        type=str,
        help="Path to model",
        default="jeffding/T3Q_SOLAR_SLERP_v1.0-openmind",
    )
    args = parser.parse_args()
    return args

def main():
    args = parse_args()
    model_path = args.model_name_or_path

    if is_torch_npu_available():
        device = "npu:0"
    else:
        device = "cpu"
        
    tokenizer = AutoTokenizer.from_pretrained(model_path, trust_remote_code=True)
    # Set `torch_dtype=torch.float16` to load model in float16, otherwise it will be loaded as float32 and might cause OOM Error.
    model = AutoModelForCausalLM.from_pretrained(model_path, torch_dtype=torch.float16, trust_remote_code=True).to(device)
    
    start_time = time.time()
    
    model = model.eval()
    inputs = tokenizer(["상해라는 도시를 간단히 소개하겠습니다."], return_tensors="pt")
    for k,v in inputs.items():
        inputs[k] = v.to(device)
    gen_kwargs = {"max_length": 500, "top_p": 0.8, "temperature": 0.8, "do_sample": True, "repetition_penalty": 1.0}
    output = model.generate(**inputs, **gen_kwargs)
    output = tokenizer.decode(output[0].tolist(), skip_special_tokens=True)
    print(output)
    
    end_time = time.time()
    print(f"硬件环境:{device},推理执行时间:{end_time - start_time}秒")

if __name__ == "__main__":
    main()

合并详情

合并方法

本模型采用SLERP合并方法进行合并。

合并的模型

合并中包含以下模型:

  • chihoonlee10/T3Q-ko-solar-dpo-v7.0
  • hwkwon/S-SOLAR-10.7B-v1.5

配置

生成此模型时使用了以下YAML配置:

slices:
  - sources:
      - model: chihoonlee10/T3Q-ko-solar-dpo-v7.0
        layer_range: [0, 48]
      - model: hwkwon/S-SOLAR-10.7B-v1.5
        layer_range: [0, 48]
# or, the equivalent models: syntax:
# models:
#   - model: psmathur/orca_mini_v3_13b
#   - model: garage-bAInd/Platypus2-13B
merge_method: slerp
base_model: chihoonlee10/T3Q-ko-solar-dpo-v7.0
parameters:
  t:
    - filter: self_attn
      value: [0, 0.5, 0.3, 0.7, 1]
    - filter: mlp
      value: [1, 0.5, 0.7, 0.3, 0]
    - value: 0.5 # fallback for rest of tensors
dtype: float16