Instructions to use DesaiJayM/Bharat-24B-Math-Code with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use DesaiJayM/Bharat-24B-Math-Code with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("mistralai/Mistral-Small-3.2-24B-Instruct-2506") model = PeftModel.from_pretrained(base_model, "DesaiJayM/Bharat-24B-Math-Code") - Notebooks
- Google Colab
- Kaggle
Download bharat_serving.py from DesaiJayM/Bharat-24B-Math-Code: direct link, hf CLI and curl.
- Browser
- Download file 810 Bytes
-
https://huggingface.co/DesaiJayM/Bharat-24B-Math-Code/resolve/main/bharat_serving.py
- Command line
-
hf download hf://DesaiJayM/Bharat-24B-Math-Code/bharat_serving.py
-
curl -L -o bharat_serving.py https://huggingface.co/DesaiJayM/Bharat-24B-Math-Code/resolve/main/bharat_serving.py
810 Bytes
| """Bharat's explicit default identity policy with the unchanged native tokenizer.""" | |
| import json | |
| from pathlib import Path | |
| def encode_messages(tokenizer,messages,identity_path=None): | |
| path=Path(identity_path) if identity_path else Path(__file__).parent/'bharat-model-identity.json' | |
| policy=json.loads(path.read_text()) | |
| messages=[dict(m) for m in messages] | |
| if not any(m['role']=='system' for m in messages): | |
| messages.insert(0,{'role':'system','content':policy['default_system_message']}) | |
| return tokenizer.apply_chat_template(messages,tokenize=True,return_dict=False,add_generation_prompt=True) | |
| def visible_answer(text): | |
| """Separate the exposed reasoning envelope without modifying its raw record.""" | |
| return text.split('</think>',1)[-1].strip() if '</think>' in text else text | |