|
--- |
|
library_name: transformers |
|
license: apache-2.0 |
|
language: |
|
- aeb |
|
base_model: |
|
- inceptionai/jais-adapted-7b-chat |
|
tags: |
|
- text-generation-inference |
|
- transformers |
|
- unsloth |
|
- trl |
|
--- |
|
|
|
## Model Overview |
|
|
|
Labess-7B-Instruct is an open model instruction-tuned for Tunisian Derja, is a continually pre-trained and aligned version of inceptionai/jais-adapted-7b-chat with Tunisian_Derja_Dataset |
|
# Uploaded model |
|
|
|
- **Developed by:** Linagora |
|
- **License:** apache-2.0 |
|
- **Finetuned from model :** inceptionai/jais-adapted-7b-chat |
|
## 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/Labess-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/Labess-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 ** Labess-7B-Instruct **, please cite: |
|
|
|
```bibtex |
|
@model{linagora2025LLM-tn, |
|
author = {Wajdi Ghezaiel and Jean-Pierre Lorré}, |
|
title = {Labess-7B-Instruct :Tunisian Arabic Derja LLM based on jais-adapted-7b-chat}, |
|
year = {2025}, |
|
month = {July}, |
|
url = {https://huggingface.co/datasets/linagora/Labess-7B-Instruct} |
|
} |
|
|
|
``` |