Instructions to use monsoon-nlp/dialect-ar-gpt-2021 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use monsoon-nlp/dialect-ar-gpt-2021 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="monsoon-nlp/dialect-ar-gpt-2021")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("monsoon-nlp/dialect-ar-gpt-2021") model = AutoModelForCausalLM.from_pretrained("monsoon-nlp/dialect-ar-gpt-2021") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use monsoon-nlp/dialect-ar-gpt-2021 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "monsoon-nlp/dialect-ar-gpt-2021" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "monsoon-nlp/dialect-ar-gpt-2021", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/monsoon-nlp/dialect-ar-gpt-2021
- SGLang
How to use monsoon-nlp/dialect-ar-gpt-2021 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "monsoon-nlp/dialect-ar-gpt-2021" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "monsoon-nlp/dialect-ar-gpt-2021", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "monsoon-nlp/dialect-ar-gpt-2021" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "monsoon-nlp/dialect-ar-gpt-2021", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use monsoon-nlp/dialect-ar-gpt-2021 with Docker Model Runner:
docker model run hf.co/monsoon-nlp/dialect-ar-gpt-2021
Commit ·
5d73e61
1
Parent(s): 2dfd242
Update README.md
Browse files
README.md
CHANGED
|
@@ -11,11 +11,6 @@ from AUB MIND Lab.
|
|
| 11 |
This model was then finetuned on dialect datasets from Qatar University, University of British Columbia / NLP,
|
| 12 |
and Johns Hopkins University / LREC for 10 epochs.
|
| 13 |
|
| 14 |
-
Sources
|
| 15 |
-
- https://qspace.qu.edu.qa/handle/10576/15265
|
| 16 |
-
- https://github.com/UBC-NLP/aoc_id
|
| 17 |
-
- https://github.com/ryancotterell/arabic_dialect_annotation
|
| 18 |
-
|
| 19 |
You can use special tokens to prompt five dialects: `[EGYPTIAN]`, `[GULF]`, `[LEVANTINE]`, `[MAGHREBI]`, or `[MSA]`, followed by a space.
|
| 20 |
|
| 21 |
```
|
|
@@ -34,3 +29,23 @@ Original model: https://huggingface.co/aubmindlab/aragpt2-medium
|
|
| 34 |
I inserted new tokens into the tokenizer, finetuned the model on the dialect samples, and exported the new model.
|
| 35 |
|
| 36 |
Notebook: https://colab.research.google.com/drive/19C0zbkSCt5ncVCa4kY-ik9hSEiJcjI-F
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
This model was then finetuned on dialect datasets from Qatar University, University of British Columbia / NLP,
|
| 12 |
and Johns Hopkins University / LREC for 10 epochs.
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
You can use special tokens to prompt five dialects: `[EGYPTIAN]`, `[GULF]`, `[LEVANTINE]`, `[MAGHREBI]`, or `[MSA]`, followed by a space.
|
| 15 |
|
| 16 |
```
|
|
|
|
| 29 |
I inserted new tokens into the tokenizer, finetuned the model on the dialect samples, and exported the new model.
|
| 30 |
|
| 31 |
Notebook: https://colab.research.google.com/drive/19C0zbkSCt5ncVCa4kY-ik9hSEiJcjI-F
|
| 32 |
+
|
| 33 |
+
## Citations
|
| 34 |
+
|
| 35 |
+
AraGPT2 model:
|
| 36 |
+
|
| 37 |
+
```
|
| 38 |
+
@misc{antoun2020aragpt2,
|
| 39 |
+
title={AraGPT2: Pre-Trained Transformer for Arabic Language Generation},
|
| 40 |
+
author={Wissam Antoun and Fady Baly and Hazem Hajj},
|
| 41 |
+
year={2020},
|
| 42 |
+
eprint={2012.15520},
|
| 43 |
+
archivePrefix={arXiv},
|
| 44 |
+
primaryClass={cs.CL}
|
| 45 |
+
}
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
Dialect data sources:
|
| 49 |
+
- https://qspace.qu.edu.qa/handle/10576/15265
|
| 50 |
+
- https://github.com/UBC-NLP/aoc_id
|
| 51 |
+
- https://github.com/ryancotterell/arabic_dialect_annotation
|