Instructions to use Bedirhn77/Mithra-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Bedirhn77/Mithra-2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Bedirhn77/Mithra-2B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Bedirhn77/Mithra-2B") model = AutoModelForCausalLM.from_pretrained("Bedirhn77/Mithra-2B", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - PEFT
How to use Bedirhn77/Mithra-2B with PEFT:
Task type is invalid.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Bedirhn77/Mithra-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Bedirhn77/Mithra-2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Bedirhn77/Mithra-2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Bedirhn77/Mithra-2B
- SGLang
How to use Bedirhn77/Mithra-2B 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 "Bedirhn77/Mithra-2B" \ --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": "Bedirhn77/Mithra-2B", "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 "Bedirhn77/Mithra-2B" \ --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": "Bedirhn77/Mithra-2B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Bedirhn77/Mithra-2B with Docker Model Runner:
docker model run hf.co/Bedirhn77/Mithra-2B
🤖 Mithra-2B — FTC & FRC Robot Coding Assistant
A small, fast, open-source LLM that writes FTC/FRC robot code (Java, C++), OpenSCAD/CAD scripts and fixes software bugs — in Turkish and English.
TL;DR — Mithra-2B is a LoRA-fine-tuned and merged version of Qwen2.5-Coder-1.5B-Instruct (~1.5B parameters, ~3 GB in fp16). It is built for FIRST Tech Challenge (FTC) and FIRST Robotics Competition (FRC) teams who want a lightweight local coding helper for OpModes, autonomous routines, encoder/motor control, and OpenSCAD CAD scripts. Developed by FTC Team 24501 "ERROR" from Diyarbakır, Türkiye.
Türkçe özet — Mithra-2B, FTC ve FRC robotları için Java/C++ kodu, OpMode ve otonom taslakları, OpenSCAD/CAD betikleri yazan ve yazılım hatalarını çözmeye yardım eden küçük, açık kaynaklı bir kodlama modelidir. FTC Team 24501 "ERROR" (Diyarbakır) tarafından geliştirilmiştir.
✨ At a Glance
| Model name | Mithra-2B (the "2B" is a series name; actual size ≈ 1.5B parameters) |
| Type | Causal (decoder-only) language model, instruction-tuned |
| Base model | Qwen/Qwen2.5-Coder-1.5B-Instruct |
| Fine-tuning | LoRA (r=16, α=32) with TRL SFTTrainer, merged into base weights |
| Languages | Turkish 🇹🇷, English 🇬🇧 |
| Code languages | Java, C++, Python, JavaScript, HTML, CSS, OpenSCAD |
| Focus | FTC SDK, FRC / WPILib style robot code, autonomous, CAD scripting |
| Size | ~3 GB (fp16) — runs on a free Colab T4 or a modest local GPU |
| License | MIT |
| Made by | FTC Team 24501 "ERROR", Diyarbakır, Türkiye |
| Funded by | TED Diyarbakır |
🎯 What can Mithra-2B do?
| 🔧 Task | 💬 Example prompt |
|---|---|
| FTC OpMode (Java) | "FTC için encoder ile motoru hedef konuma götüren bir OpMode yaz." |
| Drive system | "Write a mecanum TeleOp drive OpMode for FTC in Java." |
| Autonomous draft | "Write an autonomous routine that drives forward 24 inches and stops." |
| Sensor logic | "Read a color sensor and stop the robot when it sees yellow." |
| CAD / 3D printing | "Write an OpenSCAD script for a motor mount with 4 screw holes." |
| Debugging | "Bu Java hatasını açıkla ve düzelt: NullPointerException hardwareMap…" |
🚀 Quick Start
pip install torch transformers accelerate
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
REPO = "Bedirhn77/Mithra-2B"
SYSTEM_PROMPT = (
"Senin adın mithra. Türkiye, Diyarbakır merkezli FTC Team 24501 'ERROR' (ftcerror.com) "
"tarafından geliştirilmiş bir yapay zeka kodlama ve robotik asistanısın. Görevin FTC ve FRC "
"robotları için Java ve C++ kodları yazmak, CAD tasarımları için Python/OpenSCAD betikleri "
"üretmek ve yazılım sorunlarını çözmektir. Kendinden bahsederken sadece mithra olduğunu ve "
"ERROR takımı tarafından Diyarbakır'da oluşturulduğunu söylemelisin."
)
tok = AutoTokenizer.from_pretrained(REPO)
model = AutoModelForCausalLM.from_pretrained(REPO, torch_dtype=torch.float16, device_map="auto")
prompt = (
f"<|im_start|>system\n{SYSTEM_PROMPT}<|im_end|>\n"
"<|im_start|>user\nFTC için encoder ile motoru hedef konuma götüren bir OpMode yaz.<|im_end|>\n"
"<|im_start|>assistant\n"
)
inputs = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(
**inputs,
max_new_tokens=400,
do_sample=True,
temperature=0.4,
top_p=0.9,
eos_token_id=tok.convert_tokens_to_ids("<|im_end|>"),
)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
💡 Tip: Use the system prompt above so the model keeps its mithra identity. Low temperature (0.2–0.4) gives more reliable code.
🧪 Training Details
| Dataset | First 1,200 rows of iamtarun/code_instructions_120k_alpaca |
| Format | ChatML with the mithra identity system prompt |
| Method | LoRA (PEFT): r=16, lora_alpha=32, lora_dropout=0.05, targets q_proj, v_proj |
| Trainer | TRL SFTTrainer |
| Precision | fp16 mixed precision |
| Epochs | 2 |
| Effective batch size | 16 (2 × 8 gradient accumulation) |
| Learning rate | 2e-4, cosine schedule |
| Max sequence length | 768 |
| Hardware | Free Google Colab, NVIDIA T4 — about 20–40 minutes |
| After training | LoRA merged into the base model with merge_and_unload |
⚠️ Limitations & Responsible Use
- Small model, small dataset. Only 1,200 training examples; it does not deeply cover the FTC SDK or WPILib and may invent functions that do not exist. Always check against the official docs.
- Always test. Review generated code and run it in a simulator or a safe setup before using it on a real robot. Do not run unverified code in safety-critical situations.
- Turkish quality can be weaker than English.
- Identity (mithra / ERROR / Diyarbakır) comes from the system prompt; without it the model may answer as the base model.
- Long, complex projects: consistency is limited compared to large models.
- No formal benchmark has been run. The model was only checked manually with FTC/FRC sample prompts and identity questions.
- Not designed for medical, legal or financial advice.
❓ FAQ
What is Mithra-2B? A small open-source coding and robotics language model for FTC and FRC teams, fine-tuned from Qwen2.5-Coder-1.5B-Instruct by FTC Team 24501 "ERROR".
Who made Mithra-2B? FTC Team 24501 "ERROR" from Diyarbakır, Türkiye (ftcerror.com), led by Bedirhan, with support from TED Diyarbakır.
Is it really 2 billion parameters? Yes. "2B" is a Parametre. The train size is about 0.5B parameters and the base model is Qwen2.5-Coder-1.5B-Instruct.
Can it write FTC OpMode code? Yes, it can draft Java OpModes (TeleOp, autonomous, encoder control). Review and test everything before running on a robot.
Can it make CAD models? It can write OpenSCAD and Python scripts for simple parts like mounts, brackets and plates.
Does it speak Turkish? Yes — Turkish and English, with English usually stronger.
Can I run it for free? Yes. It runs on a free Colab T4 GPU and many consumer GPUs (~3 GB in fp16).
Can I fine-tune it further on my team's code? Yes. It is MIT-licensed and intended as a starting point for team-specific fine-tuning with your own robot libraries.
Which license? MIT.
🔎 Keywords
FTC coding AI · FRC coding assistant · FIRST Tech Challenge LLM · FIRST Robotics Competition AI · FTC OpMode generator · FTC autonomous code · FTC SDK Java · WPILib helper · OpenSCAD AI · robot code generator · small coding LLM · Qwen2.5-Coder fine-tune · LoRA coding model · Turkish coding model · Türkçe kodlama modeli · FTC yapay zeka · robotik kod asistanı · FTC Team 24501 ERROR
📚 Citation
@misc{mithra2b,
title = {Mithra-2B: FTC/FRC Coding and Robotics Assistant},
author = {Bedirhan and FTC Team 24501 ERROR},
year = {2026},
url = {https://huggingface.co/Bedirhn77/Mithra-2B}
}
🙏 Acknowledgements
- Base model: Alibaba Qwen team (Qwen2.5-Coder)
- Dataset: iamtarun/code_instructions_120k_alpaca
- Support: TED Diyarbakır
📬 Contact
FTC Team 24501 "ERROR" — Diyarbakır, Türkiye · 🌐 ftcerror.com
⭐ If Mithra-2B helps your team, give the repo a like on Hugging Face! ⭐
- Downloads last month
- 454
Model tree for Bedirhn77/Mithra-2B
Base model
Qwen/Qwen2.5-1.5B