Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,100 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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="dicta-logo.jpg" width="300px"/>](https://dicta.org.il)
|
15 |
+
|
16 |
+
|
17 |
+
# Model Card for DictaLM-2.0
|
18 |
+
|
19 |
+
The DictaLM-2.0 Large Language Model (LLM) is a pretrained generative text model with 7 billion parameters specializing in Hebrew.
|
20 |
+
|
21 |
+
For full details of this model please read our [release blog post](https://example.com).
|
22 |
+
|
23 |
+
## Example Code
|
24 |
+
|
25 |
+
```python
|
26 |
+
from transformers import pipeline
|
27 |
+
import torch
|
28 |
+
|
29 |
+
# This loads the model onto the GPU in bfloat16 precision
|
30 |
+
model = pipeline('text-generation', 'dicta-il/dictalm2.0', torch_dtype=torch.bfloat16, device_map='cuda')
|
31 |
+
|
32 |
+
# Sample few shot examples
|
33 |
+
prompt = """
|
34 |
+
עבר: הלכתי
|
35 |
+
עתיד: אלך
|
36 |
+
|
37 |
+
עבר: שמרתי
|
38 |
+
עתיד: אשמור
|
39 |
+
|
40 |
+
עבר: שמעתי
|
41 |
+
עתיד: אשמע
|
42 |
+
|
43 |
+
עבר: הבנתי
|
44 |
+
עתיד:
|
45 |
+
"""
|
46 |
+
|
47 |
+
print(model(prompt.strip(), do_sample=False, max_new_tokens=8, stop_sequence='\n'))
|
48 |
+
# [{'generated_text': 'עבר: הלכתי\nעתיד: אלך\n\nעבר: שמרתי\nעתיד: אשמור\n\nעבר: שמעתי\nעתיד: אשמע\n\nעבר: הבנתי\nעתיד: אבין\n\n'}]
|
49 |
+
```
|
50 |
+
|
51 |
+
## Example Code - 4-Bit
|
52 |
+
|
53 |
+
There are already pre-quantized 4-bit models using the `GPTQ` and `AWQ` methods available for use: [DictaLM-2.0-AWQ](https://huggingface.co/dicta-il/dictalm2.0-AWQ) and [DictaLM-2.0-GPTQ](https://huggingface.co/dicta-il/dictalm2.0-GPTQ).
|
54 |
+
|
55 |
+
For dynamic quantization on the go, here is sample code which loads the model onto the GPU using the `bitsandbytes` package, requiring :
|
56 |
+
|
57 |
+
```python
|
58 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
59 |
+
import torch
|
60 |
+
|
61 |
+
model = AutoModelForCausalLM.from_pretrained('dicta-il/dictalm2.0', torch_dtype=torch.bfloat16, device_map='cuda', load_in_4bit=True)
|
62 |
+
tokenizer = AutoTokenizer.from_pretrained('dicta-il/dictalm2.0')
|
63 |
+
|
64 |
+
prompt = """
|
65 |
+
עבר: הלכתי
|
66 |
+
עתיד: אלך
|
67 |
+
|
68 |
+
עבר: שמרתי
|
69 |
+
עתיד: אשמור
|
70 |
+
|
71 |
+
עבר: שמעתי
|
72 |
+
עתיד: אשמע
|
73 |
+
|
74 |
+
עבר: הבנתי
|
75 |
+
עתיד:
|
76 |
+
"""
|
77 |
+
|
78 |
+
encoded = tokenizer(prompt.strip(), return_tensors='pt').to(model.device)
|
79 |
+
print(tokenizer.batch_decode(model.generate(**encoded, do_sample=False, max_new_tokens=4)))
|
80 |
+
# ['<s> עבר: הלכתי\nעתיד: אלך\n\nעבר: שמרתי\nעתיד: אשמור\n\nעבר: שמעתי\nעתיד: אשמע\n\nעבר: הבנתי\nעתיד: אבין\n\n']
|
81 |
+
```
|
82 |
+
|
83 |
+
|
84 |
+
## Model Architecture
|
85 |
+
|
86 |
+
DictaLM-2.0 is based on the [Mistral-7B-v0.1](https://huggingface.co/mistralai/Mistral-7B-v0.1) model with the following changes:
|
87 |
+
- An extended tokenizer with tokens for Hebrew, increasing the compression ratio
|
88 |
+
- Continued pretraining on over 190B tokens of naturally occuring text, 50% Hebrew and 50% English.
|
89 |
+
|
90 |
+
## Notice
|
91 |
+
|
92 |
+
DictaLM 2.0 is a pretrained base model and therefore does not have any moderation mechanisms.
|
93 |
+
|
94 |
+
## Citation
|
95 |
+
|
96 |
+
If you use this model, please cite:
|
97 |
+
|
98 |
+
```bibtex
|
99 |
+
[Will be added soon]
|
100 |
+
```
|