نموذج بحجم 350 مليون بارامتر مخصص لتشكيل النصوص العربية. تم تدريب هذا النموذج بضبط نموذج
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3#تحميل النموذج
4model_id = "Etherll/Tashkeel-350M-v2"
5model = AutoModelForCausalLM.from_pretrained(
6 model_id,
7 device_map="auto",
8 torch_dtype="bfloat16",
9)
10tokenizer = AutoTokenizer.from_pretrained(model_id)
11
12# إضافة التشكيل
13prompt = "السلام عليكم"
14input_ids = tokenizer.apply_chat_template(
15 [{"role": "user", "content": "قم بتشكيل هذا النص "+ ":\n"+prompt}],
16 add_generation_prompt=True,
17 return_tensors="pt",
18 tokenize=True,
19).to(model.device)
20
21output = model.generate(
22 input_ids,
23 do_sample=False,
24)
25
26print(tokenizer.decode(output[0, input_ids.shape[-1]:], skip_special_tokens=True))
A 350M parameter model for Arabic diacritization (Tashkeel). This model is a fine-tune of ibm-granite/granite-4.0-h-350m on the Misraj/Sadeed_Tashkeela dataset.
The Python code for usage is the same as listed in the Arabic section above.
This lfm2 model was trained 2x faster with
Unsloth and Huggingface's TRL library.