Shaltiel commited on
Commit
8f78f63
โ€ข
1 Parent(s): 3a84b23

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +86 -0
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
+ ```