Instructions to use aubmindlab/aragpt2-mega with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use aubmindlab/aragpt2-mega with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="aubmindlab/aragpt2-mega", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("aubmindlab/aragpt2-mega", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use aubmindlab/aragpt2-mega with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "aubmindlab/aragpt2-mega" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "aubmindlab/aragpt2-mega", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/aubmindlab/aragpt2-mega
- SGLang
How to use aubmindlab/aragpt2-mega 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 "aubmindlab/aragpt2-mega" \ --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": "aubmindlab/aragpt2-mega", "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 "aubmindlab/aragpt2-mega" \ --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": "aubmindlab/aragpt2-mega", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use aubmindlab/aragpt2-mega with Docker Model Runner:
docker model run hf.co/aubmindlab/aragpt2-mega
| ========================================== | |
| SOFTWARE LICENSE AGREEMENT - AraGPT2 | |
| ========================================== | |
| * NAME: AraGPT2: Pre-Training Text Discriminatorsfor Arabic Language Understanding | |
| * ACKNOWLEDGMENTS | |
| This [software] was generated by [American | |
| University of Beirut] (“Owners”). The statements | |
| made herein are solely the responsibility of the author[s]. | |
| The following software programs and programs have been used in the | |
| generation of [AraGPT2]: | |
| + gpt-2-simple | |
| - Max Woolf, 2020. | |
| - License and link : https://github.com/minimaxir/gpt-2-simple | |
| + GPT2-ML | |
| - Zhibo Zhang, GPT2-ML: GPT-2 for Multiple Languages, 2019 | |
| - License and link : https://github.com/imcaspar/gpt2-ml | |
| + PyArabic | |
| - T. Zerrouki, Pyarabic, An Arabic language library for Python, | |
| https://pypi.python.org/pypi/pyarabic/, 2010 | |
| - License and link: https://github.com/linuxscout/pyarabic/ | |
| * LICENSE | |
| This software and database is being provided to you, the LICENSEE, | |
| by the Owners under the following license. By obtaining, using and/or | |
| copying this software and database, you agree that you have read, | |
| understood, and will comply with these terms and conditions. You | |
| further agree that you have read and you will abide by the license | |
| agreements provided in the above links under “acknowledgements”: | |
| Permission to use, copy, modify and distribute this software and | |
| database and its documentation for any purpose and without fee or | |
| royalty is hereby granted, provided that you agree to comply with the | |
| following copyright notice and statements, including the disclaimer, | |
| and that the same appear on ALL copies of the software, database and | |
| documentation, including modifications that you make for internal use | |
| or for distribution. [AraGPT2] Copyright 2020 by [American University | |
| of Beirut]. All rights reserved. If you remix, transform, or build | |
| upon the material, you must distribute your contributions under the | |
| same license as this one. You may not apply legal terms or technological | |
| measures that legally restrict others from doing anything this license | |
| permits. THIS SOFTWARE IS PROVIDED "AS IS" AND THE OWNERS MAKE NO | |
| REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, | |
| BUT NOT LIMITATION, THE OWNERS MAKE NO REPRESENTATIONS OR WARRANTIES OF | |
| MERCHANT-ABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF | |
| THE LICENSED SOFTWARE, DATABASE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD | |
| PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. The name of the | |
| Owners may not be used in advertising or publicity pertaining to | |
| distribution of the software and/or database. Title to copyright in | |
| this software, database and any associated documentation shall at all | |
| times remain with the Owners and LICENSEE agrees to preserve same. | |
| The use of AraGPT2 should be cited as follows: | |
| @inproceedings{antoun-etal-2021-aragpt2, | |
| title = "{A}ra{GPT}2: Pre-Trained Transformer for {A}rabic Language Generation", | |
| author = "Antoun, Wissam and | |
| Baly, Fady and | |
| Hajj, Hazem", | |
| booktitle = "Proceedings of the Sixth Arabic Natural Language Processing Workshop", | |
| month = apr, | |
| year = "2021", | |
| address = "Kyiv, Ukraine (Virtual)", | |
| publisher = "Association for Computational Linguistics", | |
| url = "https://www.aclweb.org/anthology/2021.wanlp-1.21", | |
| pages = "196--207", | |
| } | |
| [AraGPT2] Copyright 2020 by [American University of Beirut]. | |
| All rights reserved. | |
| ========================================== |