Text Generation
PEFT
TensorBoard
Safetensors
Arabic
English
Generated from Trainer
trl
grpo
math
reasoning
R1
conversational
Run this model with HF Jobs
Run Omartificial-Intelligence-Space/Fanar-Math-R1-GRPO on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Omartificial-Intelligence-Space/Fanar-Math-R1-GRPO. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Omartificial-Intelligence-Space/Fanar-Math-R1-GRPO on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Evaluate on a benchmark
Use HF Jobs to evaluate https://huggingface.co/Omartificial-Intelligence-Space/Fanar-Math-R1-GRPO. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.
Quantize for lower memory use
Use HF Jobs to create a 4-bit version of https://huggingface.co/Omartificial-Intelligence-Space/Fanar-Math-R1-GRPO. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
Instructions to use Omartificial-Intelligence-Space/Fanar-Math-R1-GRPO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Omartificial-Intelligence-Space/Fanar-Math-R1-GRPO with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("QCRI/Fanar-1-9B-Instruct") model = PeftModel.from_pretrained(base_model, "Omartificial-Intelligence-Space/Fanar-Math-R1-GRPO") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files72 unmodified lines737475767677787948 unmodified lines12812913013113113213313433 unmodified lines16816917017117217317417517617717817918018118218318418518618718818917117217317417572 unmodified lines return generated, duration, num_generated_tokens
# Example Arabic math problemprompt = """A conversation between User and Assistant. The user asks a question, and the Assistant solves it. The assistant first thinks about the reasoning process in the mind and then provides the user with the answer either in Arabic or English based on user's language. The reasoning process and answer are enclosed within <think> </think> and <answer> </answer> tags, respectively, i.e., <think> reasoning process here </think><answer> answer here </answer> ูู ู
ุฏููุฉ ูุจูุบ ุนุฏุฏ ุณูุงููุง 1 ู
ูููู ูุณู
ุฉุ ุฅุฐุง ูุงู 60% ู
ู ุงูุณูุงู ุจุงูุบููุ ู40% ู
ู ุงูุจุงูุบูู ูุนู
ูููุ ููู
ุนุฏุฏ ุงูุนุงู
ููู ูู ุงูู
ุฏููุฉุ"""prompt_text = '''ูู ู
ุฏููุฉ ูุจูุบ ุนุฏุฏ ุณูุงููุง 1 ู
ูููู ูุณู
ุฉุ ุฅุฐุง ูุงู 60% ู
ู ุงูุณูุงู ุจุงูุบููุ ู40% ู
ู ุงูุจุงูุบูู ูุนู
ูููุ ููู
ุนุฏุฏ ุงูุนุงู
ููู ูู ุงูู
ุฏููุฉุ'''
result, time_taken, tokens = generate_with_reasoning(prompt)print(result)48 unmodified linesThe model is trained to follow a reasoning-first format:
```<think> First, we calculate 60% of 1 million, which is 600,000. Then, 40% of that is 240,000. </think><think> ุฃููุงูุ ูุญุณุจ 60% ู
ู ู
ูููู ูุณู
ุฉุ ููู 600,000. ุซู
ูุญุณุจ 40% ู
ู ูุฐุง ุงูุนุฏุฏุ ููู 240,000. </think><answer> 240,000 </answer>```
33 unmodified lines
---
## ๐งโ๐ฌ Authors
Developed and trained by **Omar Paniego** with adaptation of the DeepSeek-R1 training recipe using Hugging Face's open tools and datasets.
---
## ๐ข License
Refer to the license file in the repository.
---
## โค๏ธ Acknowledgements
Thanks to:- **Hugging Face Science Team** for `trl` and `math_verify`- **AI-MO** for the NuminaMath-TIR dataset- **DeepSeek Team** for releasing their methodology and insights
Happy reasoning! ๐โจ
## Citations
Cite GRPO as:README.md+3-21