Instructions to use obaidtambo/urdu_ghazals_gpt2_v2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use obaidtambo/urdu_ghazals_gpt2_v2 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="obaidtambo/urdu_ghazals_gpt2_v2")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("obaidtambo/urdu_ghazals_gpt2_v2") model = AutoModelForCausalLM.from_pretrained("obaidtambo/urdu_ghazals_gpt2_v2") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use obaidtambo/urdu_ghazals_gpt2_v2 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "obaidtambo/urdu_ghazals_gpt2_v2" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "obaidtambo/urdu_ghazals_gpt2_v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/obaidtambo/urdu_ghazals_gpt2_v2
- SGLang
How to use obaidtambo/urdu_ghazals_gpt2_v2 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 "obaidtambo/urdu_ghazals_gpt2_v2" \ --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": "obaidtambo/urdu_ghazals_gpt2_v2", "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 "obaidtambo/urdu_ghazals_gpt2_v2" \ --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": "obaidtambo/urdu_ghazals_gpt2_v2", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use obaidtambo/urdu_ghazals_gpt2_v2 with Docker Model Runner:
docker model run hf.co/obaidtambo/urdu_ghazals_gpt2_v2
Urdu Ghazals Model
This model generates Urdu ghazals in response to English translated prompts.
A good prompt for this model would be an English translated line from an Urdu ghazal, such as
“kuch kehna tha aap se”.
The model will generate an Urdu ghazal in response to the prompt.
We hope you enjoy using this model to generate beautiful Urdu ghazals! The model was trained and fine-tuned on a dataset of 9000 samples of Urdu ghazals, including the famous ghazal by Mirza Ghalib:
hazāroñ ḳhvāhisheñ aisī ki har ḳhvāhish pe dam nikle
bahut nikle mire armān lekin phir bhī kam nikle
Dare kyuuñ merā qātil kyā rahegā us kī gardan par
vo ḳhuuñ jo chashm-e-tar se umr bhar yuuñ dam-ba-dam nikle
nikalnā ḳhuld se aadam kā sunte aa.e haiñ lekin
bahut be-ābrū ho kar tire kūche se ham nikle
bharam khul jaa.e zālim tere qāmat kī darāzī kā
agar is turra-e-pur-pech-o-ḳham kā pech-o-ḳham nikle
magar likhvā.e koī us ko ḳhat to ham se likhvā.e
huī sub.h aur ghar se kaan par rakh kar qalam nikle
huī is daur meñ mansūb mujh se bāda-ashāmī
phir aayā vo zamāna jo jahāñ meñ jām-e-jam nikle
huī jin se tavaqqo ḳhastagī kī daad paane kī
vo ham se bhī ziyāda ḳhasta-e-teġh-e-sitam nikle
mohabbat meñ nahīñ hai farq jiine aur marne kā
usī ko dekh kar jiite haiñ jis kāfir pe dam nikle
kahāñ mai-ḳhāne kā darvāza 'ġhālib' aur kahāñ vaa.iz
par itnā jānte haiñ kal vo jaatā thā ki ham nikle
😊
- Downloads last month
- 1