🚀 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 许可证。