Instructions to use dicta-il/dictalm2.0-instruct-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dicta-il/dictalm2.0-instruct-AWQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="dicta-il/dictalm2.0-instruct-AWQ") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("dicta-il/dictalm2.0-instruct-AWQ") model = AutoModelForCausalLM.from_pretrained("dicta-il/dictalm2.0-instruct-AWQ") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use dicta-il/dictalm2.0-instruct-AWQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "dicta-il/dictalm2.0-instruct-AWQ" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dicta-il/dictalm2.0-instruct-AWQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/dicta-il/dictalm2.0-instruct-AWQ
- SGLang
How to use dicta-il/dictalm2.0-instruct-AWQ with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "dicta-il/dictalm2.0-instruct-AWQ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dicta-il/dictalm2.0-instruct-AWQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "dicta-il/dictalm2.0-instruct-AWQ" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "dicta-il/dictalm2.0-instruct-AWQ", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use dicta-il/dictalm2.0-instruct-AWQ with Docker Model Runner:
docker model run hf.co/dicta-il/dictalm2.0-instruct-AWQ
Adapting LLMs to Hebrew: Unveiling DictaLM 2.0 with Enhanced Vocabulary and Instruction Capabilities
The DictaLM-2.0-Instruct Large Language Model (LLM) is an instruct fine-tuned version of the DictaLM-2.0 generative model using a variety of conversation datasets.
For full details of this model please read our release blog post or the technical report.
This model contains the AWQ 4-bit quantized version of the instruct-tuned model designed for chat DictaLM-2.0-Instruct.
You can view and access the full collection of base/instruct unquantized/quantized versions of DictaLM-2.0 here.
Instruction format
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.
E.g.
text = """<s>[INST] ืืืื ืจืืื ืืืื ืขืืื? [/INST]
ืืื, ืื ื ืื ืืืื ืืื ืืืคืืช ืืืฅ ืืืืื ืกืืื ืืจื. ืื ืืืกืืฃ ืืืืืง ืืช ืืืืืช ืื ืืื ื ืฉื ืืขื ืืืฆืืฅ ืืื ืื ืฉืื ื ืืืฉื ืืืืื!</s>[INST] ืืื ืืฉ ืื ืืชืืื ืื ืืืืื ื? [/INST]"
This format is available as a chat template via the apply_chat_template() method:
Example Code
Running this code requires under 5GB of GPU VRAM.
from transformers import AutoModelForCausalLM, AutoTokenizer
device = "cuda" # the device to load the model onto
model = AutoModelForCausalLM.from_pretrained("dicta-il/dictalm2.0-instruct-AWQ", device_map=device)
tokenizer = AutoTokenizer.from_pretrained("dicta-il/dictalm2.0-instruct-AWQ")
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])
# <s> [INST] ืืืื ืจืืื ืืืื ืขืืื? [/INST]
# ืืื, ืื ื ืื ืืืื ืืื ืืืคืืช ืืืฅ ืืืืื ืกืืื ืืจื. ืื ืืืกืืฃ ืืืืืง ืืช ืืืืืช ืื ืืื ื ืฉื ืืขื ืืืฆืืฅ ืืื ืื ืฉืื ื ืืืฉื ืืืืื!</s> [INST] ืืื ืืฉ ืื ืืชืืื ืื ืืืืื ื? [/INST]
# ืื ื ืืชืืื ืคืฉืื ืืงื ืืืืื ื ืืืชื:
#
# ืืจืืืืื:
# - ืืืฆื ืืืืื ืืืช
# - 2 ืืคืืช ืืืืฅ ืืื ืืื
# - 1 ืืฃ
# (it stopped early because we set max_new_tokens=50)
Model Architecture
DictaLM-2.0-Instruct follows the Zephyr-7B-beta recipe for fine-tuning an instruct model, with an extended instruct dataset for Hebrew.
Limitations
The DictaLM 2.0 Instruct model is a demonstration that the base model can be fine-tuned to achieve compelling performance. It does not have any moderation mechanisms. We're looking forward to engaging with the community on ways to make the model finely respect guardrails, allowing for deployment in environments requiring moderated outputs.
Citation
If you use this model, please cite:
@misc{shmidman2024adaptingllmshebrewunveiling,
title={Adapting LLMs to Hebrew: Unveiling DictaLM 2.0 with Enhanced Vocabulary and Instruction Capabilities},
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},
}
- Downloads last month
- 56
Model tree for dicta-il/dictalm2.0-instruct-AWQ
Base model
dicta-il/dictalm2.0