ruslanmv commited on
Commit
8cdd9aa
·
verified ·
1 Parent(s): 1199628

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +104 -7
README.md CHANGED
@@ -1,22 +1,119 @@
1
  ---
2
  base_model: ibm-granite/granite-3.1-2b-instruct
3
  tags:
4
- - text-generation-inference
5
  - transformers
 
 
 
6
  - unsloth
7
  - granite
8
  - trl
 
9
  license: apache-2.0
10
  language:
11
  - en
12
  ---
13
 
14
- # Uploaded model
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
- - **Developed by:** ruslanmv
17
- - **License:** apache-2.0
18
- - **Finetuned from model :** ibm-granite/granite-3.1-2b-instruct
19
 
20
- This granite model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
21
 
22
- [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
 
 
 
 
 
 
 
 
1
  ---
2
  base_model: ibm-granite/granite-3.1-2b-instruct
3
  tags:
4
+ - text-generation
5
  - transformers
6
+ - safetensors
7
+ - english
8
+ - text-generation-inference
9
  - unsloth
10
  - granite
11
  - trl
12
+ - inference-endpoints
13
  license: apache-2.0
14
  language:
15
  - en
16
  ---
17
 
18
+ # Granite-3.1-2B-Reasoning-LORA (Efficient Fine-Tuned Model)
19
+
20
+ ## Model Overview
21
+
22
+ This model is a **LoRA fine-tuned version** of **ibm-granite/granite-3.1-2b-instruct**, optimized for **reasoning tasks** while maintaining **efficiency** and **low computational cost**. Using **LoRA (Low-Rank Adaptation)**, this model retains the full power of the base model while applying targeted modifications for **logical and analytical reasoning**.
23
+
24
+ - **Developed by:** [ruslanmv](https://huggingface.co/ruslanmv)
25
+ - **License:** Apache 2.0
26
+ - **Base Model:** [ibm-granite/granite-3.1-2b-instruct](https://huggingface.co/ibm-granite/granite-3.1-2b-instruct)
27
+ - **Fine-tuned for:** Logical reasoning, structured problem-solving, long-context tasks
28
+ - **Training Method:** **LoRA (Low-Rank Adaptation)**
29
+ - **Supported Languages:** English
30
+
31
+ ---
32
+
33
+ ## Why Use the LoRA Version?
34
+
35
+ This **LoRA fine-tuned model** provides **several benefits**:
36
+
37
+ ✅ **Memory-efficient** fine-tuning with LoRA
38
+ ✅ **2x Faster Training** using **Unsloth and Hugging Face TRL**
39
+ ✅ **Retains the base model’s capabilities** while enhancing reasoning skills
40
+ ✅ **Easier to merge with other adapters** or apply to specific tasks
41
+
42
+ ---
43
+
44
+ ## Installation & Usage
45
+
46
+ To use this **LoRA fine-tuned** model, install the necessary dependencies:
47
+
48
+ ```bash
49
+ pip install torch torchvision torchaudio
50
+ pip install accelerate
51
+ pip install transformers
52
+ pip install peft
53
+ pip install bitsandbytes
54
+ ```
55
+
56
+ ### Running the Model
57
+
58
+ Load and merge the LoRA adapter with the base model:
59
+
60
+ ```python
61
+ from transformers import AutoModelForCausalLM, AutoTokenizer
62
+ from peft import PeftModel
63
+ import torch
64
+
65
+ device = "cuda" if torch.cuda.is_available() else "cpu"
66
+ base_model_path = "ibm-granite/granite-3.1-2b-instruct"
67
+ lora_model_path = "ruslanmv/granite-3.1-2b-Reasoning-LORA"
68
+
69
+ tokenizer = AutoTokenizer.from_pretrained(base_model_path)
70
+ model = AutoModelForCausalLM.from_pretrained(base_model_path, device_map="auto")
71
+
72
+ # Load LoRA adapter
73
+ model = PeftModel.from_pretrained(model, lora_model_path)
74
+ model.eval()
75
+
76
+ input_text = "Can you explain the difference between inductive and deductive reasoning?"
77
+ input_tokens = tokenizer(input_text, return_tensors="pt").to(device)
78
+
79
+ output = model.generate(**input_tokens, max_length=4000)
80
+ output_text = tokenizer.batch_decode(output)
81
+
82
+ print(output_text)
83
+ ```
84
+
85
+ ---
86
+
87
+ ## Intended Use
88
+
89
+ Granite-3.1-2B-Reasoning-LORA is optimized for **efficient reasoning** while keeping **computational costs low**, making it ideal for:
90
+
91
+ - **Logical and analytical problem-solving**
92
+ - **Text-based reasoning tasks**
93
+ - **Mathematical and symbolic reasoning**
94
+ - **Advanced instruction-following**
95
+
96
+ This LoRA-based fine-tuning method is particularly useful for **lightweight deployment** and **quick adaptability** to specific tasks.
97
+
98
+ ---
99
+
100
+ ## License & Acknowledgments
101
+
102
+ This model is released under the **Apache 2.0** license. It is fine-tuned from IBM’s **Granite 3.1-2B-Instruct** model using **LoRA fine-tuning**. Special thanks to the **IBM Granite Team** for developing the base model.
103
+
104
+ For more details, visit the [IBM Granite Documentation](https://huggingface.co/ibm-granite).
105
+
106
+ ---
107
 
108
+ ### Citation
 
 
109
 
110
+ If you use this model in your research or applications, please cite:
111
 
112
+ ```
113
+ @misc{ruslanmv2025granite,
114
+ title={LoRA Fine-Tuning of Granite-3.1 for Advanced Reasoning},
115
+ author={Ruslan M.V.},
116
+ year={2025},
117
+ url={https://huggingface.co/ruslanmv/granite-3.1-2b-Reasoning-LORA}
118
+ }
119
+ ```