license: apache-2.0
pipeline_tag: text-generation
language:
- en
- he
tags:
- instruction-tuned
base_model: dicta-il/dictalm2.0
inference:
parameters:
temperature: 0.7

适配希伯来语的大语言模型:揭秘具备增强词汇与指令能力的DictaLM 2.0
DictaLM-2.0-Instruct大语言模型(LLM)是基于DictaLM-2.0生成模型,通过多种对话数据集进行指令微调的版本。
关于该模型的完整详情,请阅读我们的发布博客或技术报告。
这是专为聊天场景设计的全精度指令微调模型。您可以通过在线演示实时体验。
您可以在此处查看并访问DictaLM-2.0
所有基础/指令、未量化/量化版本的完整集合。
指令格式
为充分发挥指令微调效果,您的提示词需用[INST]
和[/INST]
标记包裹。首条指令应以句子起始符开头,后续指令则无需添加。助手生成内容将以句子结束符终止。
示例:
text = """<s>[INST] 你最喜欢的酱料是什么? [/INST]
嗯,我特别喜欢加几滴新鲜柠檬汁。它能恰到好处地为我烹饪的每道菜增添酸爽风味!</s>[INST] 你有自制蛋黄酱的食谱吗? [/INST]"
该格式可通过apply_chat_template()
方法作为聊天模板使用:
示例代码
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
device = "cuda"
model = AutoModelForCausalLM.from_pretrained("dicta-il/dictalm2.0-instruct", torch_dtype=torch.bfloat16, device_map=device)
tokenizer = AutoTokenizer.from_pretrained("dicta-il/dictalm2.0-instruct")
messages = [
{"role": "user", "content": "你最喜欢的酱料是什么?"},
{"role": "assistant", "content": "嗯,我特别喜欢加几滴新鲜柠檬汁。它能恰到好处地为我烹饪的每道菜增添酸爽风味!"},
{"role": "user", "content": "你有自制蛋黄酱的食谱吗?"}
]
encoded = tokenizer.apply_chat_template(messages, return_tensors="pt").to(device)
generated_ids = model.generate(encoded, max_new_tokens=50, do_sample=True)
decoded = tokenizer.batch_decode(generated_ids)
print(decoded[0])
模型架构
DictaLM-2.0-Instruct遵循Zephyr-7B-beta的指令微调方案,并针对希伯来语扩展了指令数据集。
局限性
DictaLM 2.0 Instruct模型旨在证明基础模型可通过微调实现出色性能,但当前未内置内容审核机制。我们期待与社区共同探索如何建立精细的防护机制,使其能应用于需要受控输出的环境。
引用
若使用本模型,请引用:
@misc{shmidman2024adaptingllmshebrewunveiling,
title={适配希伯来语的大语言模型:揭秘具备增强词汇与指令能力的DictaLM 2.0},
author={Shaltiel Shmidman and Avi Shmidman and Amir DN Cohen and Moshe Koppel},
year={2024},
eprint={2407.07080},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2407.07080},
}