🚀 宇宙羊驼指令-直接偏好优化模型(Cosmos LLaMa Instruct-DPO)
宇宙羊驼指令-直接偏好优化模型(Cosmos LLaMa Instruct-DPO)是宇宙羊驼(CosmosLLama)的最新、最先进版本。该模型是通过合并两个经过不同训练的宇宙羊驼指令直接偏好优化(CosmosLLaMa-Instruct DPO)模型而开发的。
此模型专为文本生成任务而设计,能够以连贯且与上下文相关的方式续写给定的文本片段。不过,由于训练数据来源广泛,包括网站、书籍和其他文本资源,该模型可能存在偏差。用户应意识到这些偏差,并负责任地使用该模型。
你可以通过以下链接轻松体验该模型的演示:https://cosmos.yildiz.edu.tr/cosmosllama
✨ 主要特性
- 先进迭代:是宇宙羊驼模型的最新且最先进版本。
- 文本生成:能够完成文本续写任务,输出连贯且符合上下文的内容。
📦 安装指南
文档未提及具体安装步骤,暂不提供。
💻 使用示例
基础用法
import transformers
import torch
model_id = "ytu-ce-cosmos/Turkish-Llama-8b-DPO-v0.1"
pipeline = transformers.pipeline(
"text-generation",
model=model_id,
model_kwargs={"torch_dtype": torch.bfloat16},
device_map="auto",
)
messages = [
{"role": "system", "content": "Sen bir yapay zeka asistanısın. Kullanıcı sana bir görev verecek. Amacın görevi olabildiğince sadık bir şekilde tamamlamak. Görevi yerine getirirken adım adım düşün ve adımlarını gerekçelendir."},
{"role": "user", "content": "Soru: Bir arabanın deposu 60 litre benzin alabiliyor. Araba her 100 kilometrede 8 litre benzin tüketiyor. Depo tamamen doluyken araba kaç kilometre yol alabilir?"},
]
terminators = [
pipeline.tokenizer.eos_token_id,
pipeline.tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = pipeline(
messages,
max_new_tokens=256,
eos_token_id=terminators,
do_sample=True,
temperature=0.6,
top_p=0.9,
)
print(outputs[0]["generated_text"][-1])
高级用法
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
model_id = "ytu-ce-cosmos/Turkish-Llama-8b-DPO-v0.1"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{"role": "system", "content": "Sen bir yapay zeka asistanısın. Kullanıcı sana bir görev verecek. Amacın görevi olabildiğince sadık bir şekilde tamamlamak. Görevi yerine getirirken adım adım düşün ve adımlarını gerekçelendir."},
{"role": "user", "content": "Soru: Bir arabanın deposu 60 litre benzin alabiliyor. Araba her 100 kilometrede 8 litre benzin tüketiyor. Depo tamamen doluyken araba kaç kilometre yol alabilir?"},
]
input_ids = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
return_tensors="pt"
).to(model.device)
terminators = [
tokenizer.eos_token_id,
tokenizer.convert_tokens_to_ids("<|eot_id|>")
]
outputs = model.generate(
input_ids,
max_new_tokens=256,
eos_token_id=terminators,
do_sample=True,
temperature=0.6,
top_p=0.9,
)
response = outputs[0][input_ids.shape[-1]:]
print(tokenizer.decode(response, skip_special_tokens=True))
📚 详细文档
模型信息
属性 |
详情 |
许可证 |
Llama3 |
语言 |
土耳其语 |
任务类型 |
文本生成 |
基础模型 |
ytu - ce - cosmos/Turkish - Llama - 8b - Instruct - v0.1 |
标签 |
土耳其语、Llama、Llama3 |
致谢信息
- 感谢Hugging Face团队的慷慨支持,使得我们能够从其S3存储中下载模型 🤗
- 本研究使用的计算资源由土耳其国家高性能计算中心(UHeM)提供,资助编号为1016912023和1018512024
- 本研究得到了谷歌TPU研究云(TRC)的Cloud TPU支持
联系方式
伊兹密尔技术大学计算机工程系COSMOS人工智能研究小组
https://cosmos.yildiz.edu.tr/
cosmos@yildiz.edu.tr
📄 许可证
本模型使用Llama3许可证。
📖 引用信息
@inproceedings{kesgin2024optimizing,
title={Optimizing Large Language Models for Turkish: New Methodologies in Corpus Selection and Training},
author={Kesgin, H Toprak and Yuce, M Kaan and Dogan, Eren and Uzun, M Egemen and Uz, Atahan and {\.I}nce, Elif and Erdem, Yusuf and Shbib, Osama and Zeer, Ahmed and Amasyali, M Fatih},
booktitle={2024 Innovations in Intelligent Systems and Applications Conference (ASYU)},
pages={1--6},
year={2024},
organization={IEEE}
}
