--- library_name: transformers license: apache-2.0 language: - aeb base_model: - ALLaM-AI/ALLaM-7B-Instruct-preview tags: - text-generation-inference - transformers - unsloth - trl --- ## Model Overview MoALlam-7B-Instruct is an open model instruction-tuned for Tunisian Derja, is a continually pre-trained and aligned version of ALLaM-7B-Instruct-preview with Tunisian_Derja_Dataset # Uploaded model - **Developed by:** Linagora - **License:** apache-2.0 - **Finetuned from model :** ALLaM-AI/ALLaM-7B-Instruct-preview ## Usage Below we share some code snippets on how to get quickly started with running the model. First, install the Transformers library with: ```sh pip install transformers ``` #### Running with the `pipeline` API ```python import torch from transformers import pipeline model_id= "linagora/MoALlam-7B-Instruct" pipe = pipeline( "text-generation", model=model_id, model_kwargs={"torch_dtype": torch.bfloat16}, device="cuda" # replace with "mps" to run on a Mac device ) messages = [ {"role": "user", "content": 'وين تجي تونس؟'}, ] outputs = pipe(messages, max_new_tokens=128, temperature=0.0) assistant_response = outputs[0]["generated_text"][-1]["content"].strip() print(assistant_response) ``` ``` - Response:تونس تجي في شمال إفريقيا بالضبط في الجزء الجنوبي لغربي متاع البحر الأبيض المتوسط. ``` #### Running the model on a single / multi GPU ```python from transformers import AutoModelForCausalLM, AutoTokenizer device = "cuda" # the device to load the model onto model_id= "linagora/MoALlam-7B-Instruct" model = AutoModelForCausalLM.from_pretrained( model_id, torch_dtype="auto", device_map="cuda" ) tokenizer = AutoTokenizer.from_pretrained(model_id) messages = [ {"role": "user", "content": "وين تجي تونس؟"}, ] input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True , add_generation_prompt=True).to(model.device) outputs = model.generate(**input_ids, max_new_tokens=128) print(tokenizer.decode(outputs[0])) ``` ``` - Response:تونس تجي في شمال إفريقيا بالضبط في الجزء الجنوبي لغربي متاع البحر الأبيض المتوسط. ``` ## Citations When using this model ** MoALlam-7B-Instruct **, please cite: ```bibtex @model{linagora2025LLM-tn, author = {Wajdi Ghezaiel and Jean-Pierre Lorré}, title = {MoALlam-7B-Instruct :Tunisian Arabic Derja LLM based on ALLaM-7B-Instruct}, year = {2025}, month = {July}, url = {https://huggingface.co/datasets/linagora/MoALlam-7B-Instruct} } ```