نموذج بحجم 350 مليون بارامتر مخصص لتشكيل النصوص العربية. تم تدريب هذا النموذج بضبط نموذج
1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3#تحميل النموذج
4model_id = "Etherll/Tashkeel-350M"
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 [
16 {'role': 'system','content': "أنت نموذج لتشكيل النصوص العربية."},
17 {"role": "user", "content": prompt}
18 ],
19 add_generation_prompt=True,
20 return_tensors="pt",
21 tokenize=True,
22).to(model.device)
23
24output = model.generate(
25 input_ids,
26 do_sample=False,
27)
28
29print(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 LiquidAI/LFM2-350M on the arbml/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.