đ Hebrew-Mistral-7B
Hebrew-Mistral-7B is an open - source Large Language Model (LLM). It is pretrained in both Hebrew and English, with 7 billion parameters, and is based on Mistral-7B-v1.0 from Mistral.
This model comes with an extended Hebrew tokenizer that has 64,000 tokens. It is continuously pretrained from Mistral-7B on tokens in both English and Hebrew. The resulting model is a powerful general - purpose language model, well - suited for a wide range of natural language processing tasks, with a particular focus on Hebrew language understanding and generation.
đ Quick Start
Below are some code snippets to help you quickly start running the model. First, make sure to pip install -U transformers
, then copy the relevant snippet according to your use case.
đģ Usage Examples
Basic Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("yam-peleg/Hebrew-Mistral-7B")
model = AutoModelForCausalLM.from_pretrained("yam-peleg/Hebrew-Mistral-7B")
input_text = "׊×××! ×× ×Š×××× ××××?"
input_ids = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**input_ids)
print(tokenizer.decode(outputs[0]))
Advanced Usage
Running on GPU
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("yam-peleg/Hebrew-Mistral-7B")
model = AutoModelForCausalLM.from_pretrained("yam-peleg/Hebrew-Mistral-7B", device_map="auto")
input_text = "׊×××! ×× ×Š×××× ××××?"
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
outputs = model.generate(**input_ids)
print(tokenizer.decode(outputs[0]))
Running with 4 - Bit precision
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
tokenizer = AutoTokenizer.from_pretrained("yam-peleg/Hebrew-Mistral-7B")
model = AutoModelForCausalLM.from_pretrained("yam-peleg/Hebrew-Mistral-7B", quantization_config = BitsAndBytesConfig(load_in_4bit=True))
input_text = "׊×××! ×× ×Š×××× ××××?"
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
outputs = model.generate(**input_ids)
print(tokenizer.decode(outputs[0]))
đ License
The project uses the Apache-2.0 license.
đ§ Technical Details
Hebrew-Mistral-7B is a pretrained base model and therefore does not have any moderation mechanisms.
đ Documentation
Authors
- Trained by Yam Peleg.
- In collaboration with Jonathan Rouach and Arjeo, inc.