可用于构建韩语对话场景的文本生成应用,该项目是 davidkim205/nox-solar-10.7b-v4 模型经 DPO 微调后的版本,支持 NPU 和 CPU 硬件环境,提供友好的推理执行示例。【此简介由AI生成】
以下内容由 AI 翻译,如有问题请 点此提交 issue 反馈
library_name: openmind license: apache-2.0 pipeline_tag: text-generation frameworks:
- PyTorch hardwares:
- NPU

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()