Instructions to use akhooli/gpt2-small-arabic-poetry with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use akhooli/gpt2-small-arabic-poetry with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="akhooli/gpt2-small-arabic-poetry", device_map="auto")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("akhooli/gpt2-small-arabic-poetry") model = AutoModelForCausalLM.from_pretrained("akhooli/gpt2-small-arabic-poetry", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use akhooli/gpt2-small-arabic-poetry with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "akhooli/gpt2-small-arabic-poetry" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "akhooli/gpt2-small-arabic-poetry", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/akhooli/gpt2-small-arabic-poetry
- SGLang
How to use akhooli/gpt2-small-arabic-poetry 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 "akhooli/gpt2-small-arabic-poetry" \ --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": "akhooli/gpt2-small-arabic-poetry", "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 "akhooli/gpt2-small-arabic-poetry" \ --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": "akhooli/gpt2-small-arabic-poetry", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use akhooli/gpt2-small-arabic-poetry with Docker Model Runner:
docker model run hf.co/akhooli/gpt2-small-arabic-poetry
YAML Metadata Error:"datasets[0]" with value "Arabic poetry from several eras" is not valid. If possible, use a dataset id from https://hf.co/datasets.
GPT2-Small-Arabic-Poetry
Model description
Fine-tuned model of Arabic poetry dataset based on gpt2-small-arabic.
Intended uses & limitations
How to use
An example is provided in this colab notebook.
Limitations and bias
Both the GPT2-small-arabic (trained on Arabic Wikipedia) and this model have several limitations in terms of coverage and training performance. Use them as demonstrations or proof of concepts but not as production code.
Training data
This pretrained model used the Arabic Poetry dataset from 9 different eras with a total of around 40k poems. The dataset was trained (fine-tuned) based on the gpt2-small-arabic transformer model.
Training procedure
Training was done using Simple Transformers library on Kaggle, using free GPU.
Eval results
Final perplexity reached ws 76.3, loss: 4.33
BibTeX entry and citation info
@inproceedings{Abed Khooli,
year={2020}
}
- Downloads last month
- 94