Views
No views yet
unsloth/gemma-2-2b-it-bnb-4bit specifically designed for solving mathematical problems in Bengali language. The model demonstrates strong performance in understanding Bengali mathematical word problems and providing step-by-step solutions.unsloth/gemma-2-2b-it-bnb-4bitProblem: 5 জন ছাত্র 3টি খেলার প্রতিযোগিতায় অংশগ্রহণের জন্য সাইন আপ করছে...
Solution: এই সমস্যা সমাধান করার জন্য, আমরা গুণন নিয়ম ব্যবহার করে গণনা নীতি প্রয়োগ করি...1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4# Load model and tokenizer
5model_name = "ajoysr/bangla-math-solver" # Replace with your actual model name
6tokenizer = AutoTokenizer.from_pretrained(model_name)
7model = AutoModelForCausalLM.from_pretrained(model_name)
8
9# Example usage
10problem = "একটি ত্রিভুজের তিনটি বাহুর দৈর্ঘ্য 3, 4, এবং 5 একক। এর ক্ষেত্রফল কত?"
11
12# Format input
13input_text = f"Problem: {problem}\nSolution:"
14inputs = tokenizer(input_text, return_tensors="pt")
15
16# Generate solution
17with torch.no_grad():
18 outputs = model.generate(
19 **inputs,
20 max_length=512,
21 temperature=0.7,
22 do_sample=True,
23 pad_token_id=tokenizer.eos_token_id
24 )
25
26solution = tokenizer.decode(outputs[0][inputs['input_ids'].shape[1]:], skip_special_tokens=True)
27print(f"Solution: {solution}")Problem: [Bengali mathematical problem]
Solution:1@misc{bangla-math-solver-2025,
2 title={Bangla Math Solver: Fine-tuned Gemma-2B for Bengali Mathematical Problem Solving},
3 author={ajoysr},
4 year={2025},
5 publisher={Hugging Face},
6 url={https://huggingface.co/ajoysr/bangla-math-solver}
7}