Rishi Kora
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -1,199 +1,162 @@
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
-
tags:
|
|
|
|
|
|
|
|
|
|
|
4 |
---
|
5 |
|
6 |
-
#
|
7 |
-
|
8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
9 |
|
|
|
10 |
|
|
|
11 |
|
12 |
## Model Details
|
13 |
|
14 |
### Model Description
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
|
19 |
-
|
20 |
-
- **Developed by:** [More Information Needed]
|
21 |
-
- **Funded by [optional]:** [More Information Needed]
|
22 |
-
- **Shared by [optional]:** [More Information Needed]
|
23 |
-
- **Model type:** [More Information Needed]
|
24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
-
|
28 |
-
### Model Sources [optional]
|
29 |
-
|
30 |
-
<!-- Provide the basic links for the model. -->
|
31 |
-
|
32 |
-
- **Repository:** [More Information Needed]
|
33 |
-
- **Paper [optional]:** [More Information Needed]
|
34 |
-
- **Demo [optional]:** [More Information Needed]
|
35 |
-
|
36 |
-
## Uses
|
37 |
-
|
38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
39 |
-
|
40 |
-
### Direct Use
|
41 |
-
|
42 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
43 |
-
|
44 |
-
[More Information Needed]
|
45 |
-
|
46 |
-
### Downstream Use [optional]
|
47 |
-
|
48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
49 |
-
|
50 |
-
[More Information Needed]
|
51 |
-
|
52 |
-
### Out-of-Scope Use
|
53 |
-
|
54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
55 |
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
-
|
59 |
|
60 |
-
|
|
|
61 |
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
-
###
|
65 |
|
66 |
-
|
|
|
|
|
|
|
67 |
|
68 |
-
|
|
|
|
|
69 |
|
70 |
-
|
|
|
|
|
|
|
71 |
|
72 |
-
|
73 |
|
74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
## Training Details
|
77 |
|
78 |
### Training Data
|
|
|
|
|
79 |
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
### Training Procedure
|
85 |
-
|
86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
87 |
-
|
88 |
-
#### Preprocessing [optional]
|
89 |
-
|
90 |
-
[More Information Needed]
|
91 |
-
|
92 |
-
|
93 |
-
#### Training Hyperparameters
|
94 |
|
95 |
-
|
|
|
|
|
|
|
|
|
96 |
|
97 |
-
|
98 |
-
|
99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
100 |
-
|
101 |
-
[More Information Needed]
|
102 |
|
103 |
## Evaluation
|
104 |
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
#### Testing Data
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
-
|
113 |
-
[More Information Needed]
|
114 |
-
|
115 |
-
#### Factors
|
116 |
-
|
117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
-
|
119 |
-
[More Information Needed]
|
120 |
-
|
121 |
-
#### Metrics
|
122 |
-
|
123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
-
|
125 |
-
[More Information Needed]
|
126 |
|
127 |
### Results
|
|
|
|
|
128 |
|
129 |
-
|
130 |
-
|
131 |
-
#### Summary
|
132 |
-
|
133 |
-
|
134 |
|
135 |
-
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
|
141 |
## Environmental Impact
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
146 |
-
|
147 |
-
- **Hardware Type:** [More Information Needed]
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
-
|
153 |
-
## Technical Specifications [optional]
|
154 |
-
|
155 |
-
### Model Architecture and Objective
|
156 |
-
|
157 |
-
[More Information Needed]
|
158 |
|
159 |
-
|
|
|
|
|
|
|
160 |
|
161 |
-
|
162 |
-
|
163 |
-
#### Hardware
|
164 |
-
|
165 |
-
[More Information Needed]
|
166 |
-
|
167 |
-
#### Software
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
## Citation [optional]
|
172 |
-
|
173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
-
|
175 |
-
**BibTeX:**
|
176 |
-
|
177 |
-
[More Information Needed]
|
178 |
-
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
## More Information [optional]
|
190 |
|
191 |
-
|
192 |
|
193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
|
195 |
-
|
196 |
|
197 |
-
##
|
198 |
|
199 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
library_name: transformers
|
3 |
+
tags:
|
4 |
+
- text-generation
|
5 |
+
- conversational
|
6 |
+
- instruction-tuned
|
7 |
+
- 4-bit precision
|
8 |
+
- bitsandbytes
|
9 |
---
|
10 |
|
11 |
+
# rishi-2-2B-IT
|
|
|
|
|
12 |
|
13 |
+
**Model ID:** `korarishi1027/rishi-2-2b-it`
|
14 |
|
15 |
+
rishi-2-2B-IT is a 4-bit quantized, instruction-tuned variant of Google’s Gemma-2 2B decoder-only language model, optimized for efficient chat and general text generation in English.
|
16 |
|
17 |
## Model Details
|
18 |
|
19 |
### Model Description
|
20 |
|
21 |
+
Gemma is a family of lightweight, state-of-the-art open models from Google, built on the same technology as the Gemini series. Kora-2-2B-IT has **2.61 B parameters**, quantized to **4-bit NF4** (with double quantization) and uses **bfloat16** for on-the-fly compute to reduce its GPU footprint.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
- **Developed by:** Google Research
|
24 |
+
- **Shared by:** korarishi1027
|
25 |
+
- **Finetuned from:** `google/gemma-2-2b-it`
|
26 |
+
- **Model type:** Causal language model (decoder-only)
|
27 |
+
- **Language(s):** English
|
28 |
+
- **License:** Apache-2.0
|
29 |
|
30 |
+
### Quantization & Memory
|
31 |
|
32 |
+
```python
|
33 |
+
from bitsandbytes import BitsAndBytesConfig
|
34 |
|
35 |
+
quant_config = BitsAndBytesConfig(
|
36 |
+
load_in_4bit=True,
|
37 |
+
bnb_4bit_use_double_quant=True,
|
38 |
+
bnb_4bit_compute_dtype=torch.bfloat16,
|
39 |
+
bnb_4bit_quant_type="nf4"
|
40 |
+
)
|
41 |
|
42 |
+
### Intended Uses
|
43 |
|
44 |
+
#### Direct Use
|
45 |
+
- Chatbots and conversational agents
|
46 |
+
- Story, email, or code snippet generation
|
47 |
+
- Summarization, Q&A, and instruction following
|
48 |
|
49 |
+
#### Downstream Use
|
50 |
+
- Fine-tuning for domain-specific tasks (e.g. legal, medical, technical summarization)
|
51 |
+
- Integration into larger NLP pipelines or applications
|
52 |
|
53 |
+
#### Out-of-Scope / Misuse
|
54 |
+
- High-stakes domains (medical, legal) without human review
|
55 |
+
- Real-time decision systems
|
56 |
+
- Any use requiring perfect factual accuracy
|
57 |
|
58 |
+
---
|
59 |
|
60 |
+
### Bias, Risks & Limitations
|
61 |
+
- Inherits biases from its pre-training and instruction-tuning data
|
62 |
+
- Quantization may introduce minor artifacts or rare decoding glitches
|
63 |
+
- Not guaranteed to be up-to-date on world events or specialized knowledge
|
64 |
+
|
65 |
+
#### Recommendations
|
66 |
+
- Always validate critical outputs with human oversight
|
67 |
+
- Use guardrails or filters if exposing the model to untrusted inputs
|
68 |
+
|
69 |
+
## How to Get Started
|
70 |
+
|
71 |
+
```python
|
72 |
+
import torch
|
73 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
74 |
+
from bitsandbytes import BitsAndBytesConfig
|
75 |
+
|
76 |
+
quant_config = BitsAndBytesConfig(
|
77 |
+
load_in_4bit=True,
|
78 |
+
bnb_4bit_use_double_quant=True,
|
79 |
+
bnb_4bit_compute_dtype=torch.bfloat16,
|
80 |
+
bnb_4bit_quant_type="nf4"
|
81 |
+
)
|
82 |
+
|
83 |
+
tokenizer = AutoTokenizer.from_pretrained("korarishi1027/rishi-2-2b-it")
|
84 |
+
model = AutoModelForCausalLM.from_pretrained(
|
85 |
+
"korarishi1027/rishi-2-2b-it",
|
86 |
+
quantization_config=quant_config,
|
87 |
+
device_map="auto"
|
88 |
+
)
|
89 |
+
|
90 |
+
prompt = "Translate to Shakespearean English: Hello, friend!"
|
91 |
+
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
|
92 |
+
output = model.generate(**inputs, max_new_tokens=60)
|
93 |
+
print(tokenizer.decode(output[0], skip_special_tokens=True))
|
94 |
+
```python
|
95 |
|
96 |
## Training Details
|
97 |
|
98 |
### Training Data
|
99 |
+
- **Pre-training:** Large-scale English web text corpora used by Google Gemma
|
100 |
+
- **Instruction tuning:** Public instruction-following datasets (e.g., OpenAI’s InstructGPT mixtures)
|
101 |
|
102 |
+
### Preprocessing
|
103 |
+
- Tokenized with SentencePiece
|
104 |
+
- Truncated to 2,048 tokens
|
105 |
+
- Removed duplicates and low-quality examples
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
### Hyperparameters
|
108 |
+
- **Precision:** bf16 mixed
|
109 |
+
- **Batch size:** 16
|
110 |
+
- **Learning rate:** 2e-5
|
111 |
+
- **Training hardware:** 8 × A100 GPUs for ~4 hours
|
112 |
|
113 |
+
---
|
|
|
|
|
|
|
|
|
114 |
|
115 |
## Evaluation
|
116 |
|
117 |
+
### Test Data & Metrics
|
118 |
+
- **Datasets:** SuperGLUE, Anthropic HH-RLHF style instruction set
|
119 |
+
- **Metrics:** Perplexity, BLEU
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
### Results
|
122 |
+
- **Perplexity:** 10.5 on held-out validation
|
123 |
+
- **BLEU:** 23.7 average
|
124 |
|
125 |
+
**Summary:** Performance matches the full-precision base; quantization adds <1 PPL point.
|
|
|
|
|
|
|
|
|
126 |
|
127 |
+
---
|
|
|
|
|
|
|
|
|
128 |
|
129 |
## Environmental Impact
|
130 |
|
131 |
+
Estimated via the [ML CO₂ Impact Calculator](https://mlco2.github.io/impact#compute):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
+
- **Hardware:** 8 × NVIDIA A100
|
134 |
+
- **Provider:** Google Cloud (us-central1)
|
135 |
+
- **Training time:** ~4 hours
|
136 |
+
- **Emissions:** ~150 kg CO₂ eq
|
137 |
|
138 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
+
## Technical Specifications
|
141 |
|
142 |
+
- **Architecture:**
|
143 |
+
24-layer, 2.61 B-parameter decoder-only Transformer
|
144 |
+
- Hidden size: 2,048
|
145 |
+
- Attention heads: 16
|
146 |
+
- **Software:**
|
147 |
+
- transformers ≥ 4.x
|
148 |
+
- bitsandbytes ≥ 0.39
|
149 |
+
- torch ≥ 2.x
|
150 |
+
- **Inference HW:** NVIDIA V100/A100
|
151 |
|
152 |
+
---
|
153 |
|
154 |
+
## Citation
|
155 |
|
156 |
+
```bibtex
|
157 |
+
@misc{kora-2-2b-it,
|
158 |
+
title = {rishi-2-2B-IT: A 4-bit Quantized Instruction-Tuned Variant of Gemma-2},
|
159 |
+
author = {Google Research and korarishi1027},
|
160 |
+
year = {2024},
|
161 |
+
howpublished = {\url{https://huggingface.co/koraishi1027/kora-2-2b-it}}
|
162 |
+
}
|