Alamaks commited on
Commit
9667f85
Β·
verified Β·
1 Parent(s): 1ab9e95

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +116 -0
README.md ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: unsloth/gemma-3-1b-it-unsloth-bnb-4bit
4
+ tags:
5
+ - unsloth
6
+ - gemma
7
+ - peft
8
+ - lora
9
+ - indonesia
10
+ - fine-tuned
11
+ - indramayu
12
+ language:
13
+ - id
14
+ ---
15
+
16
+ # Model Gemma-3-1B Fine-tuned - Mango City Edition
17
+
18
+ This model is fine-tuned from `unsloth/gemma-3-1b-it-unsloth-bnb-4bit` using the LoRA (Low-Rank Adaptation) method with a specific dataset focused on local knowledge (such as "Kota Mangga" - Indramayu, the Mango City).
19
+
20
+ This model was trained using Unsloth for significant memory and speed efficiency.
21
+
22
+ ## Repository Structure
23
+
24
+ This repository contains the model in two formats for flexibility:
25
+
26
+ ```
27
+ /
28
+ β”œβ”€β”€ config.json
29
+ β”œβ”€β”€ model.safetensors
30
+ β”œβ”€β”€ tokenizer.json
31
+ β”œβ”€β”€ tokenizer_config.json
32
+ β”œβ”€β”€ special_tokens_map.json
33
+ β”œβ”€β”€ generation_config.json
34
+ └── adapter/ # adapter LoRA
35
+ β”œβ”€β”€ adapter_config.json
36
+ β”œβ”€β”€ adapter_model.safetensors
37
+ └── ...
38
+ ```
39
+
40
+ ## How to Use
41
+
42
+ ### 1. Using the Merged Model
43
+
44
+ This is the easiest way to use the model. You will be loading a ready-to-use merged model.
45
+
46
+ ```python
47
+ from transformers import AutoTokenizer, AutoModelForCausalLM
48
+ import torch
49
+
50
+ model_id = "Alamaks/Mangga-2-1b"
51
+
52
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
53
+ model = AutoModelForCausalLM.from_pretrained(
54
+ model_id,
55
+ torch_dtype=torch.float16, # Gunakan float16 untuk efisiensi
56
+ device_map="auto"
57
+ )
58
+
59
+ # Contoh penggunaan
60
+ inputs = tokenizer("Siapakah bupati Indramayu saat ini?", return_tensors="pt").to(model.device)
61
+ outputs = model.generate(**inputs, max_new_tokens=50)
62
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
63
+ ```
64
+
65
+ ### 2. Using the LoRA Adapter
66
+
67
+ If you want to apply the adapter to the base model manually.
68
+
69
+ ```python
70
+ from transformers import AutoTokenizer, AutoModelForCausalLM
71
+ from peft import PeftModel
72
+ import torch
73
+
74
+ base_model_id = "unsloth/gemma-3-1b-it"
75
+ adapter_id = "Alamaks/Mangga-2-1b"
76
+
77
+ # Load the base model
78
+ base_model = AutoModelForCausalLM.from_pretrained(
79
+ base_model_id,
80
+ torch_dtype=torch.float16,
81
+ device_map="auto"
82
+ )
83
+
84
+ # Load the tokenizer from this repo (as there might be new tokens)
85
+ tokenizer = AutoTokenizer.from_pretrained(adapter_id)
86
+
87
+ # Apply the adapter
88
+ model = PeftModel.from_pretrained(
89
+ base_model,
90
+ adapter_id,
91
+ subfolder="adapter" # Don't forget the subfolder
92
+ )
93
+
94
+ # Example usage
95
+ inputs = tokenizer("Jelaskan tentang julukan Indramayu sebagai Kota Mangga.", return_tensors="pt").to(model.device)
96
+ outputs = model.generate(**inputs, max_new_tokens=100)
97
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
98
+ ```
99
+
100
+ ## Model Details
101
+
102
+ **Model Hierarchy:**
103
+ - **Original Model:** `google/gemma-3-1b-it` (Google Gemma-3-1B Instruct)
104
+ - **Unsloth Base Model:** `unsloth/gemma-3-1b-it` (Optimized version of the Google model)
105
+ - **Training Model:** `unsloth/gemma-3-1b-it-unsloth-bnb-4bit` (4-bit quantized version for fine-tuning)
106
+ - **Final Model:** `Alamaks/Mangga-2-1b` (The fine-tuned model)
107
+
108
+ **Specifications:**
109
+ - **Method:** LoRA (Low-Rank Adaptation) via Unsloth
110
+ - **Language:** Indramayu
111
+ - **Upload Precision:** 16-bit
112
+
113
+
114
+ ## Lisensi
115
+
116
+ Apache 2.0