Instructions to use FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator") model = AutoModelForCausalLM.from_pretrained("FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator
- SGLang
How to use FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator 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 "FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator" \ --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": "FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator", "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 "FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator" \ --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": "FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator with Docker Model Runner:
docker model run hf.co/FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator
AraGPT2 Arabic Humor Generator
This model is a fine-tuned version of aubmindlab/aragpt2-medium specifically optimized for generating Arabic jokes and sarcastic humor based on keyword pairs.
Model Description
The model was trained to solve the "Keyword-to-Joke" task. It uses a specific prompt format:
word1 word2 | [Generated Joke]
Training Results
During the final training phase, the model achieved:
- Training Loss: 3.28
- Validation Loss: 4.49
- Epochs: 5
How to Use
You can use this model with the Hugging Face transformers library:
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("{HF_REPO_ID}")
model = AutoModelForCausalLM.from_pretrained("{HF_REPO_ID}")
prompt = "ู
ุญุดุด ู
ุฏุฑุณุฉ | "
inputs = tokenizer(prompt, return_tensors="pt")
outputs = model.generate(**inputs, max_new_tokens=50, repetition_penalty=1.3)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Intended Use & Limitations
This model is designed for creative writing and humor generation.
- Repetition: Use a
repetition_penaltyof 1.2 or higher to avoid loops. - Safety: While training data was filtered, AI humor can occasionally produce unexpected results.
- Downloads last month
- 7
Model tree for FatimahEmadEldin/AraGPT2-Arabic-Humor-Generator
Base model
aubmindlab/aragpt2-medium