Update README.md
Browse files
README.md
CHANGED
|
@@ -6,4 +6,97 @@ pipeline_tag: text-generation
|
|
| 6 |
library_name: transformers
|
| 7 |
tags:
|
| 8 |
- text-generation-inference
|
| 9 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
library_name: transformers
|
| 7 |
tags:
|
| 8 |
- text-generation-inference
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# **Kapteyn-500M**
|
| 12 |
+
|
| 13 |
+
> **Kapteyn-500M** is a lightweight, general-purpose micro language model based on the **LlamaForCausalLM architecture** and trained on the **Llama2 Group of models**. This compact 500M parameter model is designed for **simple chats and responses**, making it ideal for conversational AI applications where efficiency and quick response times are prioritized over complex reasoning tasks.
|
| 14 |
+
>
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
## **Key Features**
|
| 18 |
+
|
| 19 |
+
1. **Compact & Efficient Architecture**
|
| 20 |
+
Built on the proven **LlamaForCausalLM architecture** with only 500M parameters, ensuring fast inference and low memory footprint for resource-constrained environments.
|
| 21 |
+
|
| 22 |
+
2. **General-Purpose Conversational AI**
|
| 23 |
+
Optimized for natural dialogue, casual conversations, and simple Q&A tasks—perfect for chatbots, virtual assistants, and interactive applications.
|
| 24 |
+
|
| 25 |
+
3. **Llama2-Based Training**
|
| 26 |
+
Leverages the robust foundation of the **Llama2 Group of models**, inheriting their conversational capabilities while maintaining ultra-lightweight deployment requirements.
|
| 27 |
+
|
| 28 |
+
4. **Fast Response Generation**
|
| 29 |
+
Designed for quick inference with minimal latency, making it suitable for real-time chat applications and interactive user experiences.
|
| 30 |
+
|
| 31 |
+
5. **Versatile Deployment Options**
|
| 32 |
+
Runs efficiently on **CPUs**, **entry-level GPUs**, **mobile devices**, and **edge computing platforms** with minimal resource requirements.
|
| 33 |
+
|
| 34 |
+
6. **Simple Integration**
|
| 35 |
+
Easy to integrate into existing applications with standard transformer interfaces and minimal setup requirements.
|
| 36 |
+
|
| 37 |
+
---
|
| 38 |
+
|
| 39 |
+
## **Quickstart with Transformers**
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 43 |
+
|
| 44 |
+
model_name = "prithivMLmods/Kapteyn-500M"
|
| 45 |
+
|
| 46 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 47 |
+
model_name,
|
| 48 |
+
torch_dtype="auto",
|
| 49 |
+
device_map="auto"
|
| 50 |
+
)
|
| 51 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 52 |
+
|
| 53 |
+
prompt = "Hello! How are you doing today?"
|
| 54 |
+
|
| 55 |
+
messages = [
|
| 56 |
+
{"role": "system", "content": "You are a helpful and friendly assistant."},
|
| 57 |
+
{"role": "user", "content": prompt}
|
| 58 |
+
]
|
| 59 |
+
|
| 60 |
+
text = tokenizer.apply_chat_template(
|
| 61 |
+
messages,
|
| 62 |
+
tokenize=False,
|
| 63 |
+
add_generation_prompt=True
|
| 64 |
+
)
|
| 65 |
+
|
| 66 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 67 |
+
|
| 68 |
+
generated_ids = model.generate(
|
| 69 |
+
**model_inputs,
|
| 70 |
+
max_new_tokens=256,
|
| 71 |
+
do_sample=True,
|
| 72 |
+
temperature=0.7,
|
| 73 |
+
top_p=0.9
|
| 74 |
+
)
|
| 75 |
+
generated_ids = [
|
| 76 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
| 77 |
+
]
|
| 78 |
+
|
| 79 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 80 |
+
print(response)
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
---
|
| 84 |
+
|
| 85 |
+
## **Intended Use**
|
| 86 |
+
|
| 87 |
+
* Casual conversation and general chat applications
|
| 88 |
+
* Simple Q&A systems and customer service bots
|
| 89 |
+
* Educational tools requiring basic conversational interaction
|
| 90 |
+
* Mobile and edge AI applications with limited computational resources
|
| 91 |
+
* Prototyping conversational AI features before scaling to larger models
|
| 92 |
+
* Personal assistants for everyday tasks and simple information retrieval
|
| 93 |
+
|
| 94 |
+
---
|
| 95 |
+
|
| 96 |
+
## **Limitations**
|
| 97 |
+
|
| 98 |
+
* Limited complex reasoning and analytical capabilities compared to larger models
|
| 99 |
+
* Not suitable for specialized technical, scientific, or mathematical tasks
|
| 100 |
+
* Context window limitations may affect longer conversations
|
| 101 |
+
* May struggle with nuanced or highly specialized domain knowledge
|
| 102 |
+
* Optimized for simple responses rather than detailed explanations or complex problem-solving.
|