Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,114 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: gemma
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: gemma
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
base_model:
|
| 6 |
+
- google/gemma-2-2b-it
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
library_name: transformers
|
| 9 |
+
tags:
|
| 10 |
+
- gemma
|
| 11 |
+
---
|
| 12 |
+

|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# **GWQ2b - Gemma with Questions2b**
|
| 16 |
+
|
| 17 |
+
GWQ2b is a family of lightweight, state-of-the-art open models from Google, built using the same research and technology employed to create the Gemini models. These models are text-to-text, decoder-only large language models, available in English, with open weights for both pre-trained and instruction-tuned variants. GWQ2b models are well-suited for a variety of text generation tasks, including question answering, summarization, and reasoning. GWQ2b is fine-tuned on the Chain of Continuous Thought Synthetic Dataset, built upon the Gemma2forCasualLM architecture.
|
| 18 |
+
|
| 19 |
+
# **Running GWQ2b Demo**
|
| 20 |
+
|
| 21 |
+
```python
|
| 22 |
+
# pip install accelerate
|
| 23 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 24 |
+
import torch
|
| 25 |
+
|
| 26 |
+
tokenizer = AutoTokenizer.from_pretrained("prithivMLmods/GWQ2b")
|
| 27 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 28 |
+
"prithivMLmods/GWQ2b",
|
| 29 |
+
device_map="auto",
|
| 30 |
+
torch_dtype=torch.bfloat16,
|
| 31 |
+
)
|
| 32 |
+
|
| 33 |
+
input_text = "Write me a poem about Machine Learning."
|
| 34 |
+
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
|
| 35 |
+
|
| 36 |
+
outputs = model.generate(**input_ids, max_new_tokens=32)
|
| 37 |
+
print(tokenizer.decode(outputs[0]))
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
You can ensure the correct chat template is applied by using `tokenizer.apply_chat_template` as follows:
|
| 41 |
+
```python
|
| 42 |
+
messages = [
|
| 43 |
+
{"role": "user", "content": "Write me a poem about Machine Learning."},
|
| 44 |
+
]
|
| 45 |
+
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True).to("cuda")
|
| 46 |
+
|
| 47 |
+
outputs = model.generate(**input_ids, max_new_tokens=256)
|
| 48 |
+
print(tokenizer.decode(outputs[0]))
|
| 49 |
+
```
|
| 50 |
+
# **Key Architecture**
|
| 51 |
+
|
| 52 |
+
1. **Transformer-Based Design**:
|
| 53 |
+
GWQ2b leverages the transformer architecture, utilizing self-attention mechanisms to process input text and capture contextual relationships effectively.
|
| 54 |
+
|
| 55 |
+
2. **Lightweight and Efficient**:
|
| 56 |
+
It is designed to be computationally efficient, with fewer parameters compared to larger models, making it ideal for deployment on resource-constrained devices or environments.
|
| 57 |
+
|
| 58 |
+
3. **Modular Layers**:
|
| 59 |
+
The architecture consists of modular encoder and decoder layers, allowing flexibility in adapting the model for specific tasks like text generation, summarization, or classification.
|
| 60 |
+
|
| 61 |
+
4. **Attention Mechanisms**:
|
| 62 |
+
GWQ2b employs multi-head self-attention to focus on relevant parts of the input text, improving its ability to handle long-range dependencies and complex language structures.
|
| 63 |
+
|
| 64 |
+
5. **Pre-training and Fine-Tuning**:
|
| 65 |
+
The model is pre-trained on large text corpora and can be fine-tuned for specific tasks, such as markdown processing in ReadM.Md, to enhance its performance on domain-specific data.
|
| 66 |
+
|
| 67 |
+
6. **Scalability**:
|
| 68 |
+
The architecture supports scaling up or down based on the application's requirements, balancing performance and resource usage.
|
| 69 |
+
|
| 70 |
+
7. **Open-Source and Customizable**:
|
| 71 |
+
Being open-source, GWQ2b allows developers to modify and extend its architecture to suit specific use cases, such as integrating it into tools like ReadM.Md for markdown-related tasks.
|
| 72 |
+
|
| 73 |
+
# **Intended Use of GWQ2b (Gemma with Questions2b)**
|
| 74 |
+
|
| 75 |
+
1. **Question Answering:**
|
| 76 |
+
The model excels in generating concise and relevant answers to user-provided queries across various domains.
|
| 77 |
+
|
| 78 |
+
2. **Summarization:**
|
| 79 |
+
It can be used to summarize large bodies of text, making it suitable for news aggregation, academic research, and report generation.
|
| 80 |
+
|
| 81 |
+
3. **Reasoning Tasks:**
|
| 82 |
+
GWQ2b is fine-tuned on the Chain of Continuous Thought Synthetic Dataset, which enhances its ability to perform reasoning, multi-step problem solving, and logical inferences.
|
| 83 |
+
|
| 84 |
+
4. **Text Generation:**
|
| 85 |
+
The model is ideal for creative writing tasks such as generating poems, stories, and essays. It can also be used for generating code comments, documentation, and markdown files.
|
| 86 |
+
|
| 87 |
+
5. **Instruction Following:**
|
| 88 |
+
GWQ2b’s instruction-tuned variant is suitable for generating responses based on user instructions, making it useful for virtual assistants, tutoring systems, and automated customer support.
|
| 89 |
+
|
| 90 |
+
6. **Domain-Specific Applications:**
|
| 91 |
+
Thanks to its modular design and open-source nature, the model can be fine-tuned for specific tasks like legal document summarization, medical record analysis, or financial report generation.
|
| 92 |
+
|
| 93 |
+
# **Limitations of GWQ2b**
|
| 94 |
+
|
| 95 |
+
1. **Resource Requirements:**
|
| 96 |
+
Although lightweight compared to larger models, the 9B parameter size still requires significant computational resources, including GPUs with large memory for inference.
|
| 97 |
+
|
| 98 |
+
2. **Knowledge Cutoff:**
|
| 99 |
+
The model’s pre-training data may not include recent information, making it less effective for answering queries on current events or newly developed topics.
|
| 100 |
+
|
| 101 |
+
3. **Bias in Outputs:**
|
| 102 |
+
Since the model is trained on publicly available datasets, it may inherit biases present in those datasets, leading to potentially biased or harmful outputs in sensitive contexts.
|
| 103 |
+
|
| 104 |
+
4. **Hallucinations:**
|
| 105 |
+
Like other large language models, GWQ2b can occasionally generate incorrect or nonsensical information, especially when asked for facts or reasoning outside its training scope.
|
| 106 |
+
|
| 107 |
+
5. **Lack of Common-Sense Reasoning:**
|
| 108 |
+
While GWQ2b is fine-tuned for reasoning, it may still struggle with tasks requiring deep common-sense knowledge or nuanced understanding of human behavior and emotions.
|
| 109 |
+
|
| 110 |
+
6. **Dependency on Fine-Tuning:**
|
| 111 |
+
For optimal performance on domain-specific tasks, fine-tuning on relevant datasets is required, which demands additional computational resources and expertise.
|
| 112 |
+
|
| 113 |
+
7. **Context Length Limitation:**
|
| 114 |
+
The model’s ability to process long documents is limited by its maximum context window size. If the input exceeds this limit, truncation may lead to loss of important information.
|