🚀 Mistral-7B-Instruct-Ukrainian 模型卡片
Mistral-7B-UK 是一個針對烏克蘭語進行微調的大語言模型。該模型通過以下方式進行訓練:
- 使用結構化和非結構化數據集對 Mistral-7B-v0.2 進行初始微調。
- 將微調後的模型與在
OpenLLM
基準測試中表現優於 Mistral-7B-v0.2
的模型 NeuralTrix-7B 進行 SLERP 合併。
- 對最終模型進行直接偏好優化(DPO)。
🚀 快速開始
指令格式
為了利用指令微調的優勢,您的提示應使用 [INST]
和 [/INST]
標記進行包圍。
例如:
text = "[INST]Відповідайте лише буквою правильної відповіді: Елементи експресіонізму наявні у творі: A. «Камінний хрест», B. «Інститутка», C. «Маруся», D. «Людина»[/INST]"
這種格式可以通過 apply_chat_template()
方法作為 聊天模板 使用:
模型架構
此指令模型基於 Mistral-7B-v0.2,這是一個具有以下架構選擇的 Transformer 模型:
- 分組查詢注意力(Grouped-Query Attention)
- 滑動窗口注意力(Sliding-Window Attention)
- 字節回退 BPE 分詞器(Byte-fallback BPE tokenizer)
數據集
結構化數據集
非結構化數據集
DPO 數據集
💻 使用示例
基礎用法
!pip install -qU transformers accelerate
from transformers import AutoTokenizer
import transformers
import torch
model = "SherlockAssistant/Mistral-7B-Instruct-Ukrainian"
messages = [{"role": "user", "content": "What is a large language model?"}]
tokenizer = AutoTokenizer.from_pretrained(model)
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
pipeline = transformers.pipeline(
"text-generation",
model=model,
torch_dtype=torch.bfloat16,
device_map="auto",
)
outputs = pipeline(prompt, max_new_tokens=256, do_sample=True, temperature=0.7, top_k=50, top_p=0.95)
print(outputs[0]["generated_text"])
📚 詳細文檔
引用
如果您在研究中使用此模型並發表論文,請引用我們的論文:
BibTeX 格式
@inproceedings{boros-chivereanu-dumitrescu-purcaru-2024-llm-uk,
title = "Fine-tuning and Retrieval Augmented Generation for Question Answering using affordable Large Language Models",
author = "Boros, Tiberiu and Chivereanu, Radu and Dumitrescu, Stefan Daniel and Purcaru, Octavian",
booktitle = "Proceedings of the Third Ukrainian Natural Language Processing Workshop, LREC-COLING",
month = may,
year = "2024",
address = "Torino, Italy",
publisher = "European Language Resources Association",
}
APA 格式
Boros, T., Chivereanu, R., Dumitrescu, S., & Purcaru, O. (2024). Fine-tuning and Retrieval Augmented Generation for Question Answering using affordable Large Language Models. In Proceedings of the Third Ukrainian Natural Language Processing Workshop, LREC-COLING. European Language Resources Association.
MLA 格式
Boros, Tiberiu, Radu, Chivereanu, Stefan Daniel, Dumitrescu, Octavian, Purcaru. "Fine-tuning and Retrieval Augmented Generation for Question Answering using affordable Large Language Models." Proceedings of the Third Ukrainian Natural Language Processing Workshop, LREC-COLING. European Language Resources Association, 2024.
芝加哥格式
Boros, Tiberiu, Radu, Chivereanu, Stefan Daniel, Dumitrescu, and Octavian, Purcaru. "Fine-tuning and Retrieval Augmented Generation for Question Answering using affordable Large Language Models." . In Proceedings of the Third Ukrainian Natural Language Processing Workshop, LREC-COLING. European Language Resources Association, 2024.
📄 許可證
本項目採用 Apache-2.0 許可證。