csebuetnlp/xlsum
Updated • 8.17k • 153
How to use Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForMultimodalLM
tokenizer = AutoTokenizer.from_pretrained("Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet")
model = AutoModelForMultimodalLM.from_pretrained("Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet
How to use Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet with Docker Model Runner:
docker model run hf.co/Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet
docker model run hf.co/Khurram123/Qwen2.5-3B-Urdu-Ultimate-PoetDeveloped by Khurram Pervez (Khurram123), this model is a high-performance, specialized version of the Qwen2.5-3B architecture, fine-tuned specifically for the nuances of the Urdu language.
This "Ultimate" version is the result of a multi-stage training process designed to create a versatile Urdu AI. It excels in three distinct areas:
You can load this model using the transformers library on any GPU-enabled machine.
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.float16,
device_map="auto"
)
# Example Prompt for Poetry
prompt = "<|im_start|>user\nعنوان 'شامِ ہجراں' پر ایک شعر لکھیں۔<|im_end|>\n<|im_start|>assistant\n"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=150, do_sample=True, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Install from pip and serve model
# Install vLLM from pip: pip install vllm# Start the vLLM server: vllm serve "Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet"# Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Khurram123/Qwen2.5-3B-Urdu-Ultimate-Poet", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'