🚀 宇宙羊駝指令-直接偏好優化模型(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}
}
