Text Generation
Transformers
Safetensors
Arabic
llama
arabic
reasoning
chain-of-thought
math
gsm8k
small-language-model
slm
sft
conversational
text-generation-inference
Instructions to use oddadmix/Nawah-Math-Reasoning with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use oddadmix/Nawah-Math-Reasoning with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="oddadmix/Nawah-Math-Reasoning") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("oddadmix/Nawah-Math-Reasoning") model = AutoModelForCausalLM.from_pretrained("oddadmix/Nawah-Math-Reasoning", device_map="auto") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use oddadmix/Nawah-Math-Reasoning with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "oddadmix/Nawah-Math-Reasoning" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "oddadmix/Nawah-Math-Reasoning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/oddadmix/Nawah-Math-Reasoning
- SGLang
How to use oddadmix/Nawah-Math-Reasoning 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 "oddadmix/Nawah-Math-Reasoning" \ --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": "oddadmix/Nawah-Math-Reasoning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "oddadmix/Nawah-Math-Reasoning" \ --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": "oddadmix/Nawah-Math-Reasoning", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use oddadmix/Nawah-Math-Reasoning with Docker Model Runner:
docker model run hf.co/oddadmix/Nawah-Math-Reasoning
File size: 1,775 Bytes
867d0f3 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #!/usr/bin/env bash
# Merge the primary cache with every node shard, rebuild the corpus, push to the Hub.
#
# Run this after the primary generator exits. Idempotent: it re-merges from the two
# caches every time, so re-running after a resumed generation just produces a larger
# corpus. Neither node's live cache is touched — the merge lands in out_merged/.
#
# ./finish_merge_push.sh # build + card, no push (review, then re-run with push)
# ./finish_merge_push.sh --push # build + card + upload
set -euo pipefail
cd /notebooks/50M/reasonsing
P=/notebooks/50M/.venv-lfm2/bin/python
REPO=oddadmix/arabic-math-reasoning-synth
SHARD_DIR=shards_dl/shards
# 1. merge — primary cache first, then every shard pulled from the Hub
mkdir -p out_merged
cat out_synth/generations.jsonl > out_merged/generations.jsonl
for gz in "$SHARD_DIR"/*.jsonl.gz; do
echo "[*] merging shard $(basename "$gz")"
gunzip -c "$gz" >> out_merged/generations.jsonl
done
echo "[+] merged cache: $(wc -l < out_merged/generations.jsonl) tasks"
# 2. authoritative re-parse / re-validate / dedup over the whole merged cache
OUT_DIR=out_merged SFT_DIR=data_synth_sft $P build_synth_dataset.py > /tmp/build.log 2>&1
$P - <<'PY'
import json
d = json.load(open("out_merged/build_stats.json")); s = d["stats"]
print(f"[+] kept {s['kept']:,} rows | templates {d['unique_templates']:,} | "
f"accept {d['accept_rate']:.1%} | dup drops {s.get('dropped_duplicate_template',0):,}")
for k in sorted(s):
if k.startswith("model_"):
print(f" {k[6:]:36s} {s[k]:,}")
PY
# 3. card + upload
if [[ "${1:-}" == "--push" ]]; then
OUT_DIR=out_merged $P push_synth_dataset.py --repo "$REPO"
else
OUT_DIR=out_merged $P push_synth_dataset.py --repo "$REPO" --dry-run
fi
|