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

image/png

T3Q-ko-solar-dpo-v3.0

该模型是基于davidkim205/nox-solar-10.7b-v4进行DPO微调的版本。

模型开发者 Chihoon Lee(chihoonlee10)、T3Q

在Openmind中使用

from openmind import pipeline, is_torch_npu_available
from openmind_hub import snapshot_download
import torch.nn.functional as F
from torch import Tensor
import openmind
import torch
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-ko-solar-dpo-v3.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"
    
    start_time = time.time()
    
    pipe = pipeline("text-generation", model=model_path, torch_dtype=torch.bfloat16, device_map=device)
    messages = [
        {
            "role": "system",
            "content": "당신은 친절한 채팅 로봇, 항상 해적 스타일로 응답",
        },
        {"role": "user", "content": "당신은 친절한 채팅 로봇, 항상 해적 스타일로 응답?"},
    ]
    prompt = pipe.tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
    outputs = pipe(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
    print(outputs[0]["generated_text"])
    
    end_time = time.time()
    print(f"硬件环境:{device},推理执行时间:{end_time - start_time}秒")
    
if __name__ == "__main__":
    main()