Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
base_model:
|
| 6 |
+
- ibm-granite/granite-3.1-2b-instruct
|
| 7 |
+
tags:
|
| 8 |
+
- unsloth
|
| 9 |
+
- text-generation
|
| 10 |
+
- granite
|
| 11 |
+
- two-wheeler
|
| 12 |
+
- bikes
|
| 13 |
+
- motorcycles
|
| 14 |
+
- scooters
|
| 15 |
+
- automotive
|
| 16 |
+
- gguf
|
| 17 |
+
- safetensors
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# 🏍️ Granite-3.1-2b-TwoWheeler
|
| 21 |
+
|
| 22 |
+
This model is a fine-tuned version of **[IBM Granite 3.1 2B Instruct](https://huggingface.co/ibm-granite/granite-3.1-2b-instruct)**, specialized in **Two-Wheeler** knowledge (Motorcycles, Scooters, Superbikes, and Maintenance).
|
| 23 |
+
|
| 24 |
+
It was trained using **[Unsloth](https://github.com/unslothai/unsloth)** on a custom dataset to provide expert advice on bike specifications, comparisons, comparisons, and troubleshooting.
|
| 25 |
+
|
| 26 |
+
## 📂 Included Files
|
| 27 |
+
This repository contains the full merged model and quantized versions:
|
| 28 |
+
|
| 29 |
+
| Filename | Type | Description |
|
| 30 |
+
|:--- |:--- |:--- |
|
| 31 |
+
| `model.safetensors` | **Full Model** | The unquantized, merged weights. Use this for Python/Transformers training or inference. |
|
| 32 |
+
| `granite-3.1-2b-instruct.Q4_K_M.gguf` | **GGUF (Q4)** | **Recommended.** 4-bit quantized. Fast & efficient (runs on 4GB+ RAM). |
|
| 33 |
+
| `granite-3.1-2b-instruct.F16.gguf` | **GGUF (FP16)** | High-precision uncompressed GGUF. Best quality but larger file size. |
|
| 34 |
+
|
| 35 |
+
---
|
| 36 |
+
|
| 37 |
+
## 💻 How to Use (GGUF / Llama.cpp / LM Studio)
|
| 38 |
+
You can use the `.gguf` files directly in **LM Studio**, **Ollama**, or **llama.cpp**.
|
| 39 |
+
|
| 40 |
+
**CLI Command (llama.cpp):**
|
| 41 |
+
```bash
|
| 42 |
+
./llama-cli -m granite-3.1-2b-instruct.Q4_K_M.gguf -p "User: Which bike is best for daily city commute with high mileage in India?\nAssistant:" -cnv
|
| 43 |
+
|
| 44 |
+
System Prompt (Recommended):
|
| 45 |
+
|
| 46 |
+
You are an expert automotive assistant specializing in two-wheelers. Provide detailed specifications, comparisons, and maintenance advice for bikes and scooters.
|
| 47 |
+
|
| 48 |
+
🐍 How to Use (Python / Transformers)
|
| 49 |
+
|
| 50 |
+
Since the model is merged, you can load it directly without needing LoRA adapters.
|
| 51 |
+
Python
|
| 52 |
+
|
| 53 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 54 |
+
import torch
|
| 55 |
+
|
| 56 |
+
model_name = "Prithwiraj731/Granite-3.1-2b-TwoWheeler"
|
| 57 |
+
|
| 58 |
+
# Load Tokenizer & Model
|
| 59 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 60 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 61 |
+
model_name,
|
| 62 |
+
device_map="auto",
|
| 63 |
+
torch_dtype=torch.float16 # Use bfloat16 if your GPU supports it
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
+
# Format the Prompt (Granite Chat Format)
|
| 67 |
+
messages = [
|
| 68 |
+
{"role": "user", "content": "Compare the Royal Enfield Classic 350 vs Honda CB350. Which one has better vibrations?"}
|
| 69 |
+
]
|
| 70 |
+
input_text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 71 |
+
|
| 72 |
+
# Generate
|
| 73 |
+
inputs = tokenizer(input_text, return_tensors="pt").to("cuda")
|
| 74 |
+
outputs = model.generate(**inputs, max_new_tokens=256, temperature=0.7)
|
| 75 |
+
|
| 76 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 77 |
+
|
| 78 |
+
🔧 Training Details
|
| 79 |
+
|
| 80 |
+
Base Architecture: IBM Granite 3.1 (2 Billion Parameters)
|
| 81 |
+
|
| 82 |
+
Framework: Unsloth (PyTorch)
|
| 83 |
+
|
| 84 |
+
Quantization: Q4_K_M & FP16 GGUF
|
| 85 |
+
|
| 86 |
+
Fine-tuning Method: Full LoRA Merge (16-bit)
|
| 87 |
+
|
| 88 |
+
Dataset Focus: Technical specifications, riding comfort, mileage, and maintenance of two-wheelers.
|
| 89 |
+
|
| 90 |
+
Finetuned with ❤️ using Unsloth.
|