Instructions to use AhmadMustafa/MobiLLama-Urdu-Article-Generation with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AhmadMustafa/MobiLLama-Urdu-Article-Generation with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AhmadMustafa/MobiLLama-Urdu-Article-Generation", trust_remote_code=True)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("AhmadMustafa/MobiLLama-Urdu-Article-Generation", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("AhmadMustafa/MobiLLama-Urdu-Article-Generation", trust_remote_code=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use AhmadMustafa/MobiLLama-Urdu-Article-Generation with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AhmadMustafa/MobiLLama-Urdu-Article-Generation" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AhmadMustafa/MobiLLama-Urdu-Article-Generation", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/AhmadMustafa/MobiLLama-Urdu-Article-Generation
- SGLang
How to use AhmadMustafa/MobiLLama-Urdu-Article-Generation 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 "AhmadMustafa/MobiLLama-Urdu-Article-Generation" \ --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": "AhmadMustafa/MobiLLama-Urdu-Article-Generation", "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 "AhmadMustafa/MobiLLama-Urdu-Article-Generation" \ --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": "AhmadMustafa/MobiLLama-Urdu-Article-Generation", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use AhmadMustafa/MobiLLama-Urdu-Article-Generation with Docker Model Runner:
docker model run hf.co/AhmadMustafa/MobiLLama-Urdu-Article-Generation
Model Card for Model ID
This is Instruct Fine-tuned Version of MobiLlama Fine-tuned on Instruct Urdu Article Generation Dataset. Instruct Urdu Article Generation Dataset was released under AYA Collections by Cohere for AI
This model is finetuned for 8500 steps for generating articles in Urdu Language.
Model Description
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
- Developed by: [Ahmad Mustafa Anis]
- Language(s) (NLP): [Urdu]
- License: [CC by 4.0]
- Finetuned from model [optional]: [MBZUAI/MobiLlama-05B]
Model Sources [optional]
- Repository: [https://github.com/mbzuai-oryx/MobiLlama?tab=readme-ov-file]
- Paper [optional]: [https://arxiv.org/abs/2402.16840]
Uses
This model is intended to use on mobile devices for generating articles in Urdu Language.
Bias, Risks, and Limitations
This model may contain biases and limitations that are present in LLMs and I have not accounted for them.
How to Get Started with the Model
Use the code below to get started with the model.
model = AutoModelForCausalLM.from_pretrained("AhmadMustafa/MobiLLama-Urdu-Article-Generation", trust_remote_code=True).to(device)
tokenizer = AutoTokenizer.from_pretrained("MBZUAI/MobiLlama-05B")
example = {'inputs': """ اس دی گی ایک خبر سے متعلق ایک مضمون لکھیں۔
خبر: سشانت سنگھ کیس بھارتی سپریم کورٹ نے فریقین سے مفصل جواب طلب کرلیا""",
}
example = f"### Instruction: {example['inputs']}\n ### Completion: "
inputs = tokenizer.encode(f"{example}", return_tensors="pt").to(device)
outputs = model.generate(inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0]))
# Output
>>>جی ضرور، یہ رہا آپ کی خبر سے متعلق ایک مضمون:
ممبئی بھارتی سپریم کورٹ نے بالی وڈ اداکار سشانت سنگھ راجپوت کیس کی سماعت کے دوران فریقین سے مفصل جواب طلب کرلیا بھارتی سپریم کورٹ کے جسٹس شوکت عزیز نے سشانت سنگھ راجپوت کیس کی سماعت کی سماعت کے دوران فریقین سے مفصل جواب طلب کیا سشانت سنگھ راجپوت کیس کی سماعت کے دوران فریقین سے مفصل جواب طلب کیا گیا جسٹس شوکت عزیز نے سشانت سنگھ راجپوت کیس کی سماعت کی سماعت کے دوران فریقین سے مفصل جواب طلب کیا سشانت سنگھ راجپوت کیس کی سماعت کے دوران فریقین سے مفصل جواب طلب کی
Please note that I have used <|EOS|> in the end of each example so you can use that as ending token to control generation.
Citation [optional]
BibTeX:
@misc{thawakar2024mobillama, title={MobiLlama: Towards Accurate and Lightweight Fully Transparent GPT}, author={Omkar Thawakar and Ashmal Vayani and Salman Khan and Hisham Cholakkal and Rao Muhammad Anwer and Michael Felsberg and Timothy Baldwin and Eric P. Xing and Fahad Shahbaz Khan}, year={2024}, eprint={2402.16840}, archivePrefix={arXiv}, primaryClass={cs.CL} }
Model Card Authors [optional]
- Name: Ahmad Mustafa Anis
- Email: ahmadanis5050@gmail.com
- Downloads last month
- 15
Model tree for AhmadMustafa/MobiLLama-Urdu-Article-Generation
Base model
MBZUAI/MobiLlama-05B