Views
No views yet
DictaLM-2.0 here.[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.text = """<s>[INST] איזה רוטב אהוב עליך? [/INST]
טוב, אני די מחבב כמה טיפות מיץ לימון סחוט טרי. זה מוסיף בדיוק את הכמות הנכונה של טעם חמצמץ לכל מה שאני מבשל במטבח!</s>[INST] האם יש לך מתכונים למיונז? [/INST]"apply_chat_template() method:1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3device = "cuda" # the device to load the model onto
4
5model = AutoModelForCausalLM.from_pretrained("dicta-il/dictalm2.0-instruct-GPTQ", device_map=device)
6tokenizer = AutoTokenizer.from_pretrained("dicta-il/dictalm2.0-instruct-GPTQ")
7
8messages = [
9 {"role": "user", "content": "איזה רוטב אהוב עליך?"},
10 {"role": "assistant", "content": "טוב, אני די מחבב כמה טיפות מיץ לימון סחוט טרי. זה מוסיף בדיוק את הכמות הנכונה של טעם חמצמץ לכל מה שאני מבשל במטבח!"},
11 {"role": "user", "content": "האם יש לך מתכונים למיונז?"}
12]
13
14encoded = tokenizer.apply_chat_template(messages, return_tensors="pt").to(device)
15
16generated_ids = model.generate(encoded, max_new_tokens=50, do_sample=True)
17decoded = tokenizer.batch_decode(generated_ids)
18print(decoded[0])
19# <s> [INST] איזה רוטב אהוב עליך? [/INST]
20# טוב, אני די מחבב כמה טיפות מיץ לימון סחוט טרי. זה מוסיף בדיוק את הכמות הנכונה של טעם חמצמץ לכל מה שאני מבשל במטבח!</s> [INST] האם יש לך מתכונים למיונז? [/INST]
21# בטח, הנה מתכון קל מאוד למיונז ביתי:
22#
23# מרכיבים:
24# - 2 ביצים גדולות
25# - 1 כף חרדל דיז'ון
26# - 2 כפות
27# (it stopped early because we set max_new_tokens=50)1@misc{shmidman2024adaptingllmshebrewunveiling,
2 title={Adapting LLMs to Hebrew: Unveiling DictaLM 2.0 with Enhanced Vocabulary and Instruction Capabilities},
3 author={Shaltiel Shmidman and Avi Shmidman and Amir DN Cohen and Moshe Koppel},
4 year={2024},
5 eprint={2407.07080},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2407.07080},
9}