Instructions to use RichardErkhov/akhooli_-_gpt2-small-arabic-4bits with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RichardErkhov/akhooli_-_gpt2-small-arabic-4bits with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="RichardErkhov/akhooli_-_gpt2-small-arabic-4bits")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("RichardErkhov/akhooli_-_gpt2-small-arabic-4bits") model = AutoModelForCausalLM.from_pretrained("RichardErkhov/akhooli_-_gpt2-small-arabic-4bits") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use RichardErkhov/akhooli_-_gpt2-small-arabic-4bits with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "RichardErkhov/akhooli_-_gpt2-small-arabic-4bits" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "RichardErkhov/akhooli_-_gpt2-small-arabic-4bits", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/RichardErkhov/akhooli_-_gpt2-small-arabic-4bits
- SGLang
How to use RichardErkhov/akhooli_-_gpt2-small-arabic-4bits 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 "RichardErkhov/akhooli_-_gpt2-small-arabic-4bits" \ --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": "RichardErkhov/akhooli_-_gpt2-small-arabic-4bits", "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 "RichardErkhov/akhooli_-_gpt2-small-arabic-4bits" \ --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": "RichardErkhov/akhooli_-_gpt2-small-arabic-4bits", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use RichardErkhov/akhooli_-_gpt2-small-arabic-4bits with Docker Model Runner:
docker model run hf.co/RichardErkhov/akhooli_-_gpt2-small-arabic-4bits
YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Quantization made by Richard Erkhov.
gpt2-small-arabic - bnb 4bits
- Model creator: https://huggingface.co/akhooli/
- Original model: https://huggingface.co/akhooli/gpt2-small-arabic/
Original model description:
language: "ar" datasets: - Arabic Wikipedia metrics: - none
GPT2-Small-Arabic
Model description
GPT2 model from Arabic Wikipedia dataset based on gpt2-small (using Fastai2).
Intended uses & limitations
How to use
An example is provided in this colab notebook. Both text and poetry (fine-tuned model) generation are included.
Limitations and bias
GPT2-small-arabic (trained on Arabic Wikipedia) has several limitations in terms of coverage (Arabic Wikipeedia quality, no diacritics) and training performance. Use as demonstration or proof of concepts but not as production code.
Training data
This pretrained model used the Arabic Wikipedia dump (around 900 MB).
Training procedure
Training was done using Fastai2 library on Kaggle, using free GPU.
Eval results
Final perplexity reached was 72.19, loss: 4.28, accuracy: 0.307
BibTeX entry and citation info
@inproceedings{Abed Khooli,
year={2020}
}
- Downloads last month
- 3