Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
pipeline_tag: text-generation
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
- he
|
7 |
+
tags:
|
8 |
+
- pretrained
|
9 |
+
inference:
|
10 |
+
parameters:
|
11 |
+
temperature: 0.7
|
12 |
+
---
|
13 |
+
|
14 |
+
[<img src="https://i.ibb.co/5Lbwyr1/dicta-logo.jpg" width="300px"/>](https://dicta.org.il)
|
15 |
+
|
16 |
+
|
17 |
+
# Model Card for DictaLM-2.0-Instruct
|
18 |
+
|
19 |
+
The DictaLM-2.0-Instruct Large Language Model (LLM) is an instruct fine-tuned version of the [DictaLM-2.0](https://huggingface.co/dicta-il/dictalm2.0) generative model using a variety of conversation datasets.
|
20 |
+
|
21 |
+
For full details of this model please read our [release blog post](https://example.com).
|
22 |
+
|
23 |
+
This is the instruct-tuned full-precision model designed for chat.
|
24 |
+
|
25 |
+
You can view and access the full collection of base/instruct unquantized/quantized versions of `DictaLM-2.0` [here](https://huggingface.co/collections/dicta-il/dicta-lm-20-collection-661bbda397df671e4a430c27).
|
26 |
+
|
27 |
+
## Instruction format
|
28 |
+
|
29 |
+
In order to leverage instruction fine-tuning, your prompt should be surrounded by `[INST]` and `[/INST]` tokens. The very first instruction should begin with a begin of sentence id. The next instructions should not. The assistant generation will be ended by the end-of-sentence token id.
|
30 |
+
|
31 |
+
E.g.
|
32 |
+
```
|
33 |
+
text = """<s>[INST] What is your favourite condiment? [/INST]
|
34 |
+
Well, I'm quite partial to a good squeeze of fresh lemon juice. It adds just the right amount of zesty flavour to whatever I'm cooking up in the kitchen!</s>[INST] Do you have mayonnaise recipes? [/INST]"
|
35 |
+
```
|
36 |
+
|
37 |
+
This format is available as a [chat template](https://huggingface.co/docs/transformers/main/chat_templating) via the `apply_chat_template()` method:
|
38 |
+
|
39 |
+
## Example Code
|
40 |
+
|
41 |
+
```python
|
42 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
43 |
+
import torch
|
44 |
+
|
45 |
+
device = "cuda" # the device to load the model onto
|
46 |
+
|
47 |
+
model = AutoModelForCausalLM.from_pretrained("dicta-il/dictalm2.0-instruct", torch_dtype=torch.bfloat16, device_map=device)
|
48 |
+
tokenizer = AutoTokenizer.from_pretrained("dicta-il/dictalm2.0-instruct")
|
49 |
+
|
50 |
+
messages = [
|
51 |
+
{"role": "user", "content": "诪讛 讛专讜讟讘 讗讛讜讘 注诇讬讱?"},
|
52 |
+
{"role": "assistant", "content": "讟讜讘, 讗谞讬 讚讬 诪讞讘讘 讻诪讛 讟讬驻讜转 诪讬抓 诇讬诪讜谉 住讞讜讟 讟专讬. 讝讛 诪讜住讬祝 讘讚讬讜拽 讗转 讛讻诪讜转 讛谞讻讜谞讛 砖诇 讟注诐 讞诪爪诪抓 诇讻诇 诪讛 砖讗谞讬 诪讘砖诇 讘诪讟讘讞!"},
|
53 |
+
{"role": "user", "content": "讛讗诐 讬砖 诇讱 诪转讻讜谞讬诐 诇诪讬讜谞讝?"}
|
54 |
+
]
|
55 |
+
|
56 |
+
encoded = tokenizer.apply_chat_template(messages, return_tensors="pt").to(device)
|
57 |
+
|
58 |
+
generated_ids = model.generate(encoded, max_new_tokens=50, do_sample=True)
|
59 |
+
decoded = tokenizer.batch_decode(generated_ids)
|
60 |
+
print(decoded[0])
|
61 |
+
# 讟讜讘, 讗谞讬 讚讬 诪讞讘讘 讻诪讛 讟讬驻讜转 诪讬抓 诇讬诪讜谉 住讞讜讟 讟专讬. 讝讛 诪讜住讬祝 讘讚讬讜拽 讗转 讛讻诪讜转 讛谞讻讜谞讛 砖诇 讟注诐 讞诪爪诪抓 诇讻诇 诪讛 砖讗谞讬 诪讘砖诇 讘诪讟讘讞!</s> [INST] 讛讗诐 讬砖 诇讱 诪转讻讜谞讬诐 诇诪讬讜谞讝? [/INST]
|
62 |
+
# 讘讟讞, 讛谞讛 诪转讻讜谉 讘住讬住讬 讜拽诇 诇讛讻谞转 诪讬讜谞讝 讘讬转讬!
|
63 |
+
#
|
64 |
+
# 诪专讻讬讘讬诐:
|
65 |
+
# - 2 讞诇诪讜谞讬诐 讙讚讜诇讬诐
|
66 |
+
# - 1 讻祝 讞讜诪抓 讬讬谉 诇讘谉
|
67 |
+
# (it stopped early because we set max_new_tokens=50)
|
68 |
+
```
|
69 |
+
|
70 |
+
## Model Architecture
|
71 |
+
|
72 |
+
DictaLM-2.0-Instruct follows the [Zephyr-7B-beta](https://huggingface.co/HuggingFaceH4/zephyr-7b-beta) recipe for fine-tuning an instruct model, with an extended instruct dataset for Hebrew.
|
73 |
+
|
74 |
+
## Limitations
|
75 |
+
|
76 |
+
The DictaLM 2.0 Instruct model is a demonstration that the base model can be fine-tuned to achieve compelling performance.
|
77 |
+
It does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to
|
78 |
+
make the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.
|
79 |
+
|
80 |
+
## Citation
|
81 |
+
|
82 |
+
If you use this model, please cite:
|
83 |
+
|
84 |
+
```bibtex
|
85 |
+
[Will be added soon]
|
86 |
+
```
|