Text Generation
Transformers
Safetensors
PyTorch
Indonesian
English
caca
causal-lm
transformer
untrained
gqa
rope
swiglu
rmsnorm
flash-attention
indonesian
bilingual
custom_code
Instructions to use Lyon28/caca-150M-untrained with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Lyon28/caca-150M-untrained with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Lyon28/caca-150M-untrained", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Lyon28/caca-150M-untrained", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Lyon28/caca-150M-untrained with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Lyon28/caca-150M-untrained" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lyon28/caca-150M-untrained", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Lyon28/caca-150M-untrained
- SGLang
How to use Lyon28/caca-150M-untrained with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Lyon28/caca-150M-untrained" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lyon28/caca-150M-untrained", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Lyon28/caca-150M-untrained" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lyon28/caca-150M-untrained", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Lyon28/caca-150M-untrained with Docker Model Runner:
docker model run hf.co/Lyon28/caca-150M-untrained
Initial commit: caca-150M untrained model
Browse files- README.md +1343 -0
- caca_transformers.py +0 -0
- config.json +107 -0
- generation_config.json +9 -0
- model.safetensors +3 -0
- training_stats.json +179 -0
README.md
ADDED
|
@@ -0,0 +1,1343 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- id
|
| 5 |
+
- en
|
| 6 |
+
tags:
|
| 7 |
+
- text-generation
|
| 8 |
+
- pytorch
|
| 9 |
+
- causal-lm
|
| 10 |
+
- transformer
|
| 11 |
+
- untrained
|
| 12 |
+
- gqa
|
| 13 |
+
- rope
|
| 14 |
+
- swiglu
|
| 15 |
+
- rmsnorm
|
| 16 |
+
- flash-attention
|
| 17 |
+
- indonesian
|
| 18 |
+
- bilingual
|
| 19 |
+
library_name: transformers
|
| 20 |
+
pipeline_tag: text-generation
|
| 21 |
+
widget:
|
| 22 |
+
- text: "Jakarta adalah ibu kota"
|
| 23 |
+
example_title: "๐ฎ๐ฉ Pelengkapan Teks (ID)"
|
| 24 |
+
- text: |
|
| 25 |
+
Pertanyaan: Apa itu kecerdasan buatan?
|
| 26 |
+
Jawaban:
|
| 27 |
+
example_title: "๐ฎ๐ฉ Tanya Jawab (ID)"
|
| 28 |
+
- text: |
|
| 29 |
+
Tulis cerita pendek tentang robot yang belajar mencintai.
|
| 30 |
+
example_title: "๐ฎ๐ฉ Penulisan Kreatif (ID)"
|
| 31 |
+
- text: "The capital of Indonesia is"
|
| 32 |
+
example_title: "๐ฌ๐ง Text Completion (EN)"
|
| 33 |
+
- text: |
|
| 34 |
+
Question: What is artificial intelligence?
|
| 35 |
+
Answer:
|
| 36 |
+
example_title: "๐ฌ๐ง Question Answering (EN)"
|
| 37 |
+
- text: |
|
| 38 |
+
def fibonacci(n):
|
| 39 |
+
"""Hitung bilangan fibonacci ke-n"""
|
| 40 |
+
example_title: "๐ป Pelengkapan Kode"
|
| 41 |
+
- text: |
|
| 42 |
+
# Fungsi untuk mengurutkan array
|
| 43 |
+
def sort_array(arr):
|
| 44 |
+
example_title: "๐ป Generasi Kode"
|
| 45 |
+
- text: |
|
| 46 |
+
User: Halo! Siapa kamu?
|
| 47 |
+
Assistant:
|
| 48 |
+
example_title: "๐ฌ Format Chat (ID)"
|
| 49 |
+
- text: |
|
| 50 |
+
User: Jelaskan tentang machine learning dalam 2 kalimat.
|
| 51 |
+
Assistant:
|
| 52 |
+
example_title: "๐ฌ Conversational (ID)"
|
| 53 |
+
inference:
|
| 54 |
+
parameters:
|
| 55 |
+
max_new_tokens: 100
|
| 56 |
+
temperature: 0.7
|
| 57 |
+
top_p: 0.9
|
| 58 |
+
top_k: 50
|
| 59 |
+
do_sample: true
|
| 60 |
+
repetition_penalty: 1.1
|
| 61 |
+
num_beams: 1
|
| 62 |
+
datasets: []
|
| 63 |
+
metrics:
|
| 64 |
+
- perplexity
|
| 65 |
+
- accuracy
|
| 66 |
+
model-index:
|
| 67 |
+
- name: caca-150M
|
| 68 |
+
results: []
|
| 69 |
+
---
|
| 70 |
+
|
| 71 |
+
<div align="center">
|
| 72 |
+
|
| 73 |
+
<img src="https://i.postimg.cc/MTSj073X/logo.png" width="400" alt="caca-150M"/>
|
| 74 |
+
|
| 75 |
+
# ๐ค caca-150M
|
| 76 |
+
|
| 77 |
+
### Arsitektur Transformer Modern dengan Fitur Canggih
|
| 78 |
+
|
| 79 |
+
[](https://opensource.org/licenses/Apache-2.0)
|
| 80 |
+
[](https://www.python.org/downloads/)
|
| 81 |
+
[](https://pytorch.org/)
|
| 82 |
+
[](https://github.com/huggingface/transformers)
|
| 83 |
+
[]()
|
| 84 |
+
[]()
|
| 85 |
+
[]()
|
| 86 |
+
|
| 87 |
+
**145,244,672** parameters โข **145.24M** โข **29 layers** โข **2,048 tokens**
|
| 88 |
+
|
| 89 |
+
[๐ Documentation](#-dokumentasi) โข [๐ป Usage](#-cara-penggunaan) โข [โ๏ธ Configuration](#๏ธ-konfigurasi-detail) โข [๐ฌ Architecture](#-arsitektur)
|
| 90 |
+
|
| 91 |
+
</div>
|
| 92 |
+
|
| 93 |
+
---
|
| 94 |
+
|
| 95 |
+
## โ ๏ธ PENTING: Model Belum Dilatih (Untrained)
|
| 96 |
+
|
| 97 |
+
<div style="background: #fff3cd; border-left: 4px solid #ffc107; padding: 12px; margin: 16px 0;">
|
| 98 |
+
<strong>โ ๏ธ PERHATIAN</strong>: Ini adalah model yang <strong>belum melalui proses training</strong>. Bobot model masih dalam kondisi <strong>random initialization</strong>. Output yang dihasilkan akan <strong>tidak bermakna dan acak</strong>.
|
| 99 |
+
</div>
|
| 100 |
+
|
| 101 |
+
**Status Model:**
|
| 102 |
+
- ๐ด **Belum dilatih** - Bobot masih random (Kaiming/Xavier init)
|
| 103 |
+
- ๐ก **Untuk riset & eksperimen** - Arsitektur sudah siap, tinggal train
|
| 104 |
+
- ๐ข **Production-ready architecture** - Teruji dan optimal
|
| 105 |
+
|
| 106 |
+
Widget di atas hanya menunjukkan **format input yang diharapkan**. Setelah model dilatih dengan dataset yang tepat, format yang sama akan menghasilkan output berkualitas tinggi.
|
| 107 |
+
|
| 108 |
+
### ๐ฏ Apa yang Bisa Dilakukan?
|
| 109 |
+
|
| 110 |
+
| โ
Bisa | โ Belum Bisa |
|
| 111 |
+
|---------|----------------|
|
| 112 |
+
| Load model architecture | Generate teks bermakna |
|
| 113 |
+
| Test forward pass | Menjawab pertanyaan |
|
| 114 |
+
| Measure memory & speed | Reasoning & understanding |
|
| 115 |
+
| Start training | Production deployment |
|
| 116 |
+
| Fine-tuning experiments | Real-world applications |
|
| 117 |
+
|
| 118 |
+
---
|
| 119 |
+
|
| 120 |
+
## ๐ Deskripsi
|
| 121 |
+
|
| 122 |
+
**Caca** adalah arsitektur Large Language Model (LLM) generasi terbaru yang menggabungkan berbagai teknik state-of-the-art dalam deep learning. Model ini dirancang dengan fokus pada **efisiensi komputasi**, **skalabilitas**, dan **performa tinggi**.
|
| 123 |
+
|
| 124 |
+
<blockquote style="border-left: 4px solid #4A90E2; padding-left: 16px; margin: 16px 0; background: #f8f9fa; padding: 12px;">
|
| 125 |
+
<p><strong>๐ Tentang Project Caca</strong></p>
|
| 126 |
+
<p><em>Caca</em> adalah eksperimen open-source Indonesian LLM yang dibuat dari nol secara individual dan bertahap. Bukan kompetitor siapa-siapa, cuma pengen eksplorasi apa yang bisa dilakukan dengan budget terbatas, passion unlimited, dan mindset collaborative.</p>
|
| 127 |
+
<p>Kalau berguna buat orang lain, alhamdulillah. Kalau enggak, ya tetap fun kok. Ini proyek eksplorasi, jadi kalau gagal ya bagian dari proses belajar. Kalau berhasil, itu bonus.</p>
|
| 128 |
+
<p>โ <strong>Lyon</strong>, Creator</p>
|
| 129 |
+
</blockquote>
|
| 130 |
+
|
| 131 |
+
### ๐ Mengapa Caca?
|
| 132 |
+
|
| 133 |
+
1. **๐ฎ๐ฉ Fokus pada Bahasa Indonesia** - Dirancang dengan mempertimbangkan karakteristik bahasa Indonesia
|
| 134 |
+
2. **โก Efisiensi Tinggi** - GQA & Flash Attention untuk inferensi 3-5x lebih cepat
|
| 135 |
+
3. **๐พ Memory Efficient** - Hemat 80% memory untuk KV cache
|
| 136 |
+
4. **๐ง Modular & Extensible** - Mudah dikustomisasi untuk berbagai use case
|
| 137 |
+
5. **๐ Bilingual** - Support optimal untuk Indonesia & English
|
| 138 |
+
|
| 139 |
+
### ๐ฏ Keunggulan vs Model Lain
|
| 140 |
+
|
| 141 |
+
| Fitur | Caca caca-150M | LLaMA-2 145.24M | GPT-3 145.24M |
|
| 142 |
+
|-------|------------|-----------|----------|
|
| 143 |
+
| **Attention Type** | GQA | GQA | MHA |
|
| 144 |
+
| **Position Encoding** | RoPE + ALiBI | RoPE | Learned |
|
| 145 |
+
| **Activation** | SwiGLU | SwiGLU | GELU |
|
| 146 |
+
| **Flash Attention** | โ
v2 | โ
v1/v2 | โ |
|
| 147 |
+
| **Long Context** | Sliding Window + Sink | โ
| Limited |
|
| 148 |
+
| **MoE Support** | โ
Optional | โ | โ |
|
| 149 |
+
| **Multimodal** | โ
Optional | โ | โ |
|
| 150 |
+
| **Quantization** | 4/8-bit | 4/8-bit | Limited |
|
| 151 |
+
|
| 152 |
+
---
|
| 153 |
+
|
| 154 |
+
## ๐ฏ Use Cases & Applications
|
| 155 |
+
|
| 156 |
+
### โ
Cocok Untuk
|
| 157 |
+
|
| 158 |
+
<table>
|
| 159 |
+
<tr>
|
| 160 |
+
<td width="50%">
|
| 161 |
+
|
| 162 |
+
**๐ฌ Research & Development**
|
| 163 |
+
- Eksperimen arsitektur transformer
|
| 164 |
+
- Ablation studies
|
| 165 |
+
- Novel training techniques
|
| 166 |
+
- Architecture search
|
| 167 |
+
|
| 168 |
+
**๐ Academic & Education**
|
| 169 |
+
- Thesis & research papers
|
| 170 |
+
- Teaching materials
|
| 171 |
+
- Student projects
|
| 172 |
+
- LLM internals understanding
|
| 173 |
+
|
| 174 |
+
</td>
|
| 175 |
+
<td width="50%">
|
| 176 |
+
|
| 177 |
+
**๐ Base Model for Fine-tuning**
|
| 178 |
+
- Task-specific models
|
| 179 |
+
- Domain adaptation
|
| 180 |
+
- Instruction tuning
|
| 181 |
+
- RLHF experiments
|
| 182 |
+
|
| 183 |
+
**๐ก Prototyping**
|
| 184 |
+
- Proof of concept
|
| 185 |
+
- Feature testing
|
| 186 |
+
- A/B testing architectures
|
| 187 |
+
- Benchmark comparisons
|
| 188 |
+
|
| 189 |
+
</td>
|
| 190 |
+
</tr>
|
| 191 |
+
</table>
|
| 192 |
+
|
| 193 |
+
### โ Tidak Cocok Untuk
|
| 194 |
+
|
| 195 |
+
<div style="background: #ffe6e6; border-left: 4px solid #ff4444; padding: 12px; margin: 16px 0;">
|
| 196 |
+
|
| 197 |
+
- ๐ซ **Production Applications** - Model belum dilatih, output random
|
| 198 |
+
- ๐ซ **Real-world Deployment** - Perlu training & safety alignment dulu
|
| 199 |
+
- ๐ซ **Safety-critical Systems** - Tidak ada safety guardrails
|
| 200 |
+
- ๐ซ **Direct User-facing Apps** - Output tidak dapat diprediksi
|
| 201 |
+
- ๐ซ **Commercial Use (as-is)** - Harus dilatih terlebih dahulu
|
| 202 |
+
|
| 203 |
+
</div>
|
| 204 |
+
|
| 205 |
+
---
|
| 206 |
+
|
| 207 |
+
## ๐ Spesifikasi Model
|
| 208 |
+
|
| 209 |
+
<table>
|
| 210 |
+
<tr>
|
| 211 |
+
<td><strong>Parameter</strong></td>
|
| 212 |
+
<td><strong>Value</strong></td>
|
| 213 |
+
<td><strong>Parameter</strong></td>
|
| 214 |
+
<td><strong>Value</strong></td>
|
| 215 |
+
</tr>
|
| 216 |
+
<tr>
|
| 217 |
+
<td>Total Parameters</td>
|
| 218 |
+
<td><code>145,244,672</code></td>
|
| 219 |
+
<td>Vocab Size</td>
|
| 220 |
+
<td><code>16,000</code></td>
|
| 221 |
+
</tr>
|
| 222 |
+
<tr>
|
| 223 |
+
<td>Hidden Size</td>
|
| 224 |
+
<td><code>640</code></td>
|
| 225 |
+
<td>Intermediate Size</td>
|
| 226 |
+
<td><code>1728</code></td>
|
| 227 |
+
</tr>
|
| 228 |
+
<tr>
|
| 229 |
+
<td>Num Layers</td>
|
| 230 |
+
<td><code>29</code></td>
|
| 231 |
+
<td>Attention Heads</td>
|
| 232 |
+
<td><code>10</code></td>
|
| 233 |
+
</tr>
|
| 234 |
+
<tr>
|
| 235 |
+
<td>KV Heads (GQA)</td>
|
| 236 |
+
<td><code>2</code></td>
|
| 237 |
+
<td>Head Dimension</td>
|
| 238 |
+
<td><code>64</code></td>
|
| 239 |
+
</tr>
|
| 240 |
+
<tr>
|
| 241 |
+
<td>Max Context Length</td>
|
| 242 |
+
<td><code>2,048</code></td>
|
| 243 |
+
<td>RoPE Base (ฮธ)</td>
|
| 244 |
+
<td><code>10,000</code></td>
|
| 245 |
+
</tr>
|
| 246 |
+
<tr>
|
| 247 |
+
<td>Model Size (FP16)</td>
|
| 248 |
+
<td><code>0.29 GB</code></td>
|
| 249 |
+
<td>Formatted Size</td>
|
| 250 |
+
<td><code>145.24M</code></td>
|
| 251 |
+
</tr>
|
| 252 |
+
</table>
|
| 253 |
+
|
| 254 |
+
---
|
| 255 |
+
|
| 256 |
+
### ๐ฏ Core Features
|
| 257 |
+
|
| 258 |
+
<details open>
|
| 259 |
+
<summary><b>๐ Klik untuk expand/collapse</b></summary>
|
| 260 |
+
|
| 261 |
+
- โ
**Grouped Query Attention (GQA)** - Efisiensi memori dan komputasi superior
|
| 262 |
+
- Query heads: **10**
|
| 263 |
+
- KV heads: **2**
|
| 264 |
+
- Ratio: **5:1** (hemat ~80% memory KV cache)
|
| 265 |
+
- **Benefit**: Inferensi lebih cepat dengan memory footprint lebih kecil
|
| 266 |
+
|
| 267 |
+
- โ
**Rotary Position Embeddings (RoPE)** - Generalisasi konteks panjang lebih baik
|
| 268 |
+
- Theta (ฮธ): **10,000**
|
| 269 |
+
- Support extrapolation untuk konteks > training length
|
| 270 |
+
- **Benefit**: Performa stabil pada sequence length yang belum pernah dilihat saat training
|
| 271 |
+
|
| 272 |
+
- โ
**RMSNorm** - Normalisasi lebih stabil dan ~50% lebih cepat dari LayerNorm
|
| 273 |
+
- Epsilon: **1e-06**
|
| 274 |
+
- **Benefit**: Training lebih stabil, inference lebih cepat, gradient flow lebih baik
|
| 275 |
+
|
| 276 |
+
- โ
**SwiGLU Activation** - Performa 10-15% lebih baik dari ReLU/GELU
|
| 277 |
+
- Intermediate size: **1,728** (2.7x hidden)
|
| 278 |
+
- **Benefit**: Kapasitas model lebih besar tanpa menambah parameter signifikan
|
| 279 |
+
|
| 280 |
+
- โ
**Flash Attention 2** - Akselerasi hingga 3x dengan memory efficiency
|
| 281 |
+
- Otomatis aktif jika tersedia CUDA device
|
| 282 |
+
- IO-aware algorithm untuk minimal HBM access
|
| 283 |
+
- **Benefit**: Training & inference jauh lebih cepat, support batch size lebih besar
|
| 284 |
+
|
| 285 |
+
</details>
|
| 286 |
+
|
| 287 |
+
### ๐ฅ Advanced Features
|
| 288 |
+
|
| 289 |
+
### ๐ฏ Mekanisme Attention
|
| 290 |
+
|
| 291 |
+
- โก **Flash Attention v2** - Algoritma IO-aware yang 3x lebih cepat dari attention standar
|
| 292 |
+
- ๐ **Grouped Query Attention (GQA)** - 10 Query heads : 2 KV heads
|
| 293 |
+
- Rasio kompresi: **5:1** (hemat ~80% memory KV cache)
|
| 294 |
+
- ๐ **xFormers Support** - Fallback memory-efficient attention
|
| 295 |
+
- ๐ฏ **PyTorch SDPA** - Native scaled dot product attention
|
| 296 |
+
|
| 297 |
+
### ๐ Position Encodings
|
| 298 |
+
|
| 299 |
+
- ๐ **RoPE (Rotary Position Embeddings)** - Base frequency ฮธ=10,000
|
| 300 |
+
- Generalisasi lebih baik untuk sequence panjang dibanding absolute PE
|
| 301 |
+
|
| 302 |
+
### ๐ Optimisasi Training
|
| 303 |
+
|
| 304 |
+
- ๐พ **Gradient Checkpointing** - Trade compute for memory (support model hingga 100B+ params)
|
| 305 |
+
- ๐ฏ **Mixed Precision Training** - Support FP16, BF16, dan TF32
|
| 306 |
+
- ๐ **Dropout Regularization**
|
| 307 |
+
- Hidden dropout: 0.1
|
| 308 |
+
- Attention dropout: 0.0
|
| 309 |
+
- Residual dropout: 0.1
|
| 310 |
+
|
| 311 |
+
### ๐ฆ Dukungan Quantization
|
| 312 |
+
|
| 313 |
+
- 4๏ธโฃ **4-bit Quantization** - NF4 & FP4 via bitsandbytes
|
| 314 |
+
- Memory reduction: ~**75%** (4GB โ 1GB)
|
| 315 |
+
- Accuracy loss: <2% pada kebanyakan tasks
|
| 316 |
+
- Support double quantization untuk kompresi maksimal
|
| 317 |
+
- 8๏ธโฃ **8-bit Quantization** - LLM.int8() dengan outlier handling
|
| 318 |
+
- Memory reduction: ~**50%** (4GB โ 2GB)
|
| 319 |
+
- Accuracy loss: <1%
|
| 320 |
+
- ๐ **Dynamic Quantization** - Runtime quantization tanpa calibration
|
| 321 |
+
|
| 322 |
+
### ๐ฌ Advanced Features
|
| 323 |
+
|
| 324 |
+
- ๐ **Automatic Mixed Precision (AMP)** - Dynamic loss scaling
|
| 325 |
+
- ๐ฏ **Gradient Clipping** - Stabilitas training dengan max norm clipping
|
| 326 |
+
- ๐ **Learning Rate Scheduling** - Support cosine, linear, warmup
|
| 327 |
+
- ๐ก **Smart Memory Management** - Auto cache clearing & monitoring
|
| 328 |
+
- ๐ **Metrics Tracking** - Real-time perplexity, loss, gradient norms
|
| 329 |
+
- ๐ก๏ธ **NaN/Inf Detection** - Automatic recovery dari numerical instability
|
| 330 |
+
|
| 331 |
+
---
|
| 332 |
+
|
| 333 |
+
## ๐พ Kebutuhan Memory
|
| 334 |
+
|
| 335 |
+
### Training Requirements
|
| 336 |
+
|
| 337 |
+
<table>
|
| 338 |
+
<tr>
|
| 339 |
+
<th>Configuration</th>
|
| 340 |
+
<th>Model Weights</th>
|
| 341 |
+
<th>+ Optimizer States</th>
|
| 342 |
+
<th>Total Training</th>
|
| 343 |
+
</tr>
|
| 344 |
+
<tr>
|
| 345 |
+
<td><strong>FP32 (AdamW)</strong></td>
|
| 346 |
+
<td>0.58 GB</td>
|
| 347 |
+
<td>+1.74 GB</td>
|
| 348 |
+
<td><strong>2.32 GB</strong></td>
|
| 349 |
+
</tr>
|
| 350 |
+
<tr>
|
| 351 |
+
<td><strong>Mixed Precision</strong></td>
|
| 352 |
+
<td>0.29 GB</td>
|
| 353 |
+
<td>+2.03 GB</td>
|
| 354 |
+
<td><strong>2.32 GB</strong></td>
|
| 355 |
+
</tr>
|
| 356 |
+
<tr>
|
| 357 |
+
<td><strong>+ Gradient Checkpointing</strong></td>
|
| 358 |
+
<td colspan="2">Menghemat ~30-50% activation memory</td>
|
| 359 |
+
<td><strong>~1.39 GB</strong></td>
|
| 360 |
+
</tr>
|
| 361 |
+
</table>
|
| 362 |
+
|
| 363 |
+
### Inference Requirements
|
| 364 |
+
|
| 365 |
+
<table>
|
| 366 |
+
<tr>
|
| 367 |
+
<th>Precision</th>
|
| 368 |
+
<th>Model Size</th>
|
| 369 |
+
<th>KV Cache (2K ctx)</th>
|
| 370 |
+
<th>Total Memory</th>
|
| 371 |
+
<th>Memory Saving</th>
|
| 372 |
+
</tr>
|
| 373 |
+
<tr>
|
| 374 |
+
<td><strong>FP16 / BF16</strong></td>
|
| 375 |
+
<td>0.29 GB</td>
|
| 376 |
+
<td>0.03 GB</td>
|
| 377 |
+
<td><strong>0.32 GB</strong></td>
|
| 378 |
+
<td>Baseline</td>
|
| 379 |
+
</tr>
|
| 380 |
+
<tr>
|
| 381 |
+
<td><strong>INT8</strong></td>
|
| 382 |
+
<td>0.15 GB</td>
|
| 383 |
+
<td>0.03 GB</td>
|
| 384 |
+
<td><strong>0.18 GB</strong></td>
|
| 385 |
+
<td>~50% โ</td>
|
| 386 |
+
</tr>
|
| 387 |
+
<tr>
|
| 388 |
+
<td><strong>INT4 (NF4)</strong></td>
|
| 389 |
+
<td>0.07 GB</td>
|
| 390 |
+
<td>0.03 GB</td>
|
| 391 |
+
<td><strong>0.10 GB</strong></td>
|
| 392 |
+
<td>~75% โ</td>
|
| 393 |
+
</tr>
|
| 394 |
+
</table>
|
| 395 |
+
|
| 396 |
+
> ๐ก **Note**: KV cache bertambah secara linear dengan panjang sequence. Untuk context 8K, kalikan nilai KV cache dengan 4.
|
| 397 |
+
|
| 398 |
+
### Performance Estimates
|
| 399 |
+
|
| 400 |
+
<table>
|
| 401 |
+
<tr>
|
| 402 |
+
<th>Metric</th>
|
| 403 |
+
<th>Value</th>
|
| 404 |
+
<th>Notes</th>
|
| 405 |
+
</tr>
|
| 406 |
+
<tr>
|
| 407 |
+
<td><strong>FLOPs per Token</strong></td>
|
| 408 |
+
<td>290,489,344</td>
|
| 409 |
+
<td>Forward pass only</td>
|
| 410 |
+
</tr>
|
| 411 |
+
<tr>
|
| 412 |
+
<td><strong>TFLOPs per Token</strong></td>
|
| 413 |
+
<td>0.0003</td>
|
| 414 |
+
<td>โ 6ร untuk backward</td>
|
| 415 |
+
</tr>
|
| 416 |
+
<tr>
|
| 417 |
+
<td><strong>Bandwidth (FP16)</strong></td>
|
| 418 |
+
<td>0.29 GB/token</td>
|
| 419 |
+
<td>Memory bandwidth requirement</td>
|
| 420 |
+
</tr>
|
| 421 |
+
</table>
|
| 422 |
+
|
| 423 |
+
---
|
| 424 |
+
|
| 425 |
+
### ๐ Struktur Arsitektur Lengkap
|
| 426 |
+
|
| 427 |
+
<details>
|
| 428 |
+
<summary><b>๐ Klik untuk lihat detail arsitektur</b></summary>
|
| 429 |
+
|
| 430 |
+
```
|
| 431 |
+
CacaForCausalLM (145.24M)
|
| 432 |
+
โ
|
| 433 |
+
โโ Embedding: 16,000 ร 640
|
| 434 |
+
โ
|
| 435 |
+
โโ Transformer Layers (29x)
|
| 436 |
+
โ โโ RMSNorm
|
| 437 |
+
โ โโ Attention (GQA)
|
| 438 |
+
โ โ โโ Q: 10 heads ร 64 dim
|
| 439 |
+
โ โ โโ KV: 2 heads ร 64 dim
|
| 440 |
+
โ โ โโ RoPE (ฮธ=10,000)
|
| 441 |
+
โ โ โโ Flash Attention v2
|
| 442 |
+
โ โโ Residual
|
| 443 |
+
โ โโ RMSNorm
|
| 444 |
+
โ โโ FFN (SwiGLU)
|
| 445 |
+
โ โ โโ Gate: 640 โ 1728
|
| 446 |
+
โ โ โโ Up: 640 โ 1728
|
| 447 |
+
โ โ โโ Down: 1728 โ 640
|
| 448 |
+
โ โโ Residual
|
| 449 |
+
โ
|
| 450 |
+
โโ Final RMSNorm
|
| 451 |
+
โโ LM Head: 640 โ 16,000
|
| 452 |
+
|
| 453 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 454 |
+
๐ PARAMETER BREAKDOWN:
|
| 455 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 456 |
+
Embeddings: 10,240,000 ( 7.1%)
|
| 457 |
+
Transformer Layers: 124,723,200 ( 85.9%)
|
| 458 |
+
โโ Attention: 28,508,160
|
| 459 |
+
โโ FFN: 96,215,040
|
| 460 |
+
Final Norm: 640 ( 0.0%)
|
| 461 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 462 |
+
TOTAL: 145,244,672 (100.0%)
|
| 463 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 464 |
+
```
|
| 465 |
+
|
| 466 |
+
**Key Design Decisions:**
|
| 467 |
+
|
| 468 |
+
1. **GQA over MHA**: Hemat 80% KV cache memory dengan minimal accuracy loss
|
| 469 |
+
2. **SwiGLU over GELU**: ~10% better performance pada language modeling
|
| 470 |
+
3. **RMSNorm over LayerNorm**: Lebih cepat & stabil, tanpa bias term
|
| 471 |
+
4. **RoPE over Learned**: Better extrapolation untuk sequence length > training
|
| 472 |
+
5. **No Bias in Linear**: Mengikuti modern LLM best practices (LLaMA-style)
|
| 473 |
+
|
| 474 |
+
</details>
|
| 475 |
+
|
| 476 |
+
---
|
| 477 |
+
|
| 478 |
+
## ๐ Dokumentasi
|
| 479 |
+
|
| 480 |
+
### ๐ฆ Instalasi Dependencies
|
| 481 |
+
|
| 482 |
+
```bash
|
| 483 |
+
# Core dependencies (REQUIRED)
|
| 484 |
+
pip install torch>=2.0.0 transformers>=4.35.0 accelerate safetensors
|
| 485 |
+
|
| 486 |
+
# Optional: Untuk performa maksimal
|
| 487 |
+
pip install flash-attn --no-build-isolation # Flash Attention 2 (3x speedup)
|
| 488 |
+
pip install xformers # Memory efficient attention
|
| 489 |
+
pip install bitsandbytes # 4/8-bit quantization
|
| 490 |
+
|
| 491 |
+
# Optional: Untuk monitoring & profiling
|
| 492 |
+
pip install tensorboard wandb # Training monitoring
|
| 493 |
+
pip install gputil psutil # Resource monitoring
|
| 494 |
+
```
|
| 495 |
+
|
| 496 |
+
**Compatibility Matrix:**
|
| 497 |
+
|
| 498 |
+
| Component | Version | Note |
|
| 499 |
+
|-----------|---------|------|
|
| 500 |
+
| Python | 3.8 - 3.11 | 3.11 recommended |
|
| 501 |
+
| PyTorch | โฅ 2.0.0 | 2.1+ untuk SDPA optimal |
|
| 502 |
+
| CUDA | 11.8 / 12.1 | Untuk Flash Attention |
|
| 503 |
+
| Transformers | โฅ 4.35.0 | Untuk AutoModel support |
|
| 504 |
+
|
| 505 |
+
### Cara Penggunaan
|
| 506 |
+
|
| 507 |
+
#### 1๏ธโฃ Basic Loading
|
| 508 |
+
|
| 509 |
+
```python
|
| 510 |
+
from transformers import AutoConfig, AutoModelForCausalLM, AutoTokenizer
|
| 511 |
+
import torch
|
| 512 |
+
|
| 513 |
+
# Load configuration
|
| 514 |
+
config = AutoConfig.from_pretrained(
|
| 515 |
+
"Lyon28/caca-150M-untrained",
|
| 516 |
+
trust_remote_code=True
|
| 517 |
+
)
|
| 518 |
+
|
| 519 |
+
# Load model (FP16 untuk efisiensi)
|
| 520 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 521 |
+
"Lyon28/caca-150M-untrained",
|
| 522 |
+
config=config,
|
| 523 |
+
trust_remote_code=True,
|
| 524 |
+
torch_dtype=torch.float16,
|
| 525 |
+
device_map="auto" # Automatic device placement
|
| 526 |
+
)
|
| 527 |
+
|
| 528 |
+
# Model ini UNTRAINED - butuh training dulu!
|
| 529 |
+
print(f"Model loaded: {model.num_parameters():,} parameters")
|
| 530 |
+
print("โ ๏ธ Model ini belum dilatih dan belum bisa digunakan untuk inference")
|
| 531 |
+
```
|
| 532 |
+
|
| 533 |
+
#### 2๏ธโฃ Quantized Loading (4-bit/8-bit)
|
| 534 |
+
|
| 535 |
+
```python
|
| 536 |
+
from transformers import AutoModelForCausalLM, BitsAndBytesConfig
|
| 537 |
+
import torch
|
| 538 |
+
|
| 539 |
+
# 4-bit quantization config
|
| 540 |
+
bnb_config = BitsAndBytesConfig(
|
| 541 |
+
load_in_4bit=True,
|
| 542 |
+
bnb_4bit_quant_type="nf4",
|
| 543 |
+
bnb_4bit_compute_dtype=torch.bfloat16,
|
| 544 |
+
bnb_4bit_use_double_quant=True
|
| 545 |
+
)
|
| 546 |
+
|
| 547 |
+
# Load model dengan quantization
|
| 548 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 549 |
+
"Lyon28/caca-150M-untrained",
|
| 550 |
+
trust_remote_code=True,
|
| 551 |
+
quantization_config=bnb_config,
|
| 552 |
+
device_map="auto"
|
| 553 |
+
)
|
| 554 |
+
|
| 555 |
+
print(f"Memory footprint: ~0.07GB (4-bit)")
|
| 556 |
+
```
|
| 557 |
+
|
| 558 |
+
#### 3๏ธโฃ Training Setup
|
| 559 |
+
|
| 560 |
+
```python
|
| 561 |
+
from transformers import TrainingArguments, Trainer
|
| 562 |
+
|
| 563 |
+
# Training configuration
|
| 564 |
+
training_args = TrainingArguments(
|
| 565 |
+
output_dir="./output",
|
| 566 |
+
per_device_train_batch_size=1,
|
| 567 |
+
gradient_accumulation_steps=16,
|
| 568 |
+
learning_rate=2e-4,
|
| 569 |
+
max_steps=10000,
|
| 570 |
+
lr_scheduler_type="cosine",
|
| 571 |
+
warmup_steps=500,
|
| 572 |
+
logging_steps=10,
|
| 573 |
+
save_steps=500,
|
| 574 |
+
fp16=True, # Mixed precision
|
| 575 |
+
gradient_checkpointing=True, # Memory efficient
|
| 576 |
+
)
|
| 577 |
+
|
| 578 |
+
# Initialize trainer
|
| 579 |
+
trainer = Trainer(
|
| 580 |
+
model=model,
|
| 581 |
+
args=training_args,
|
| 582 |
+
train_dataset=train_dataset,
|
| 583 |
+
)
|
| 584 |
+
|
| 585 |
+
# Start training
|
| 586 |
+
trainer.train()
|
| 587 |
+
```
|
| 588 |
+
|
| 589 |
+
### Advanced Usage
|
| 590 |
+
|
| 591 |
+
#### Gradient Checkpointing (Memory Efficient)
|
| 592 |
+
|
| 593 |
+
```python
|
| 594 |
+
model.gradient_checkpointing_enable()
|
| 595 |
+
print("โ
Gradient checkpointing enabled - saves ~40% memory")
|
| 596 |
+
```
|
| 597 |
+
|
| 598 |
+
#### Custom Training Loop
|
| 599 |
+
|
| 600 |
+
```python
|
| 601 |
+
from torch.optim import AdamW
|
| 602 |
+
from torch.cuda.amp import autocast, GradScaler
|
| 603 |
+
|
| 604 |
+
optimizer = AdamW(model.parameters(), lr=2e-4)
|
| 605 |
+
scaler = GradScaler()
|
| 606 |
+
|
| 607 |
+
for batch in dataloader:
|
| 608 |
+
# Mixed precision forward
|
| 609 |
+
with autocast(dtype=torch.bfloat16):
|
| 610 |
+
outputs = model(**batch)
|
| 611 |
+
loss = outputs.loss
|
| 612 |
+
|
| 613 |
+
# Backward with gradient scaling
|
| 614 |
+
scaler.scale(loss).backward()
|
| 615 |
+
scaler.step(optimizer)
|
| 616 |
+
scaler.update()
|
| 617 |
+
optimizer.zero_grad()
|
| 618 |
+
```
|
| 619 |
+
|
| 620 |
+
#### Multi-GPU Training (DDP)
|
| 621 |
+
|
| 622 |
+
```python
|
| 623 |
+
import torch.distributed as dist
|
| 624 |
+
from torch.nn.parallel import DistributedDataParallel
|
| 625 |
+
|
| 626 |
+
# Initialize process group
|
| 627 |
+
dist.init_process_group(backend="nccl")
|
| 628 |
+
|
| 629 |
+
# Wrap model
|
| 630 |
+
model = DistributedDataParallel(
|
| 631 |
+
model,
|
| 632 |
+
device_ids=[local_rank],
|
| 633 |
+
find_unused_parameters=False
|
| 634 |
+
)
|
| 635 |
+
```
|
| 636 |
+
|
| 637 |
+
---
|
| 638 |
+
|
| 639 |
+
## โ๏ธ Konfigurasi Detail
|
| 640 |
+
|
| 641 |
+
### Full Configuration JSON
|
| 642 |
+
|
| 643 |
+
```json
|
| 644 |
+
{
|
| 645 |
+
"architectures": ["CacaForCausalLM"],
|
| 646 |
+
"model_type": "caca",
|
| 647 |
+
"vocab_size": 16000,
|
| 648 |
+
"hidden_size": 640,
|
| 649 |
+
"intermediate_size": 1728,
|
| 650 |
+
"num_hidden_layers": 29,
|
| 651 |
+
"num_attention_heads": 10,
|
| 652 |
+
"num_key_value_heads": 2,
|
| 653 |
+
"head_dim": 64,
|
| 654 |
+
"max_position_embeddings": 2048,
|
| 655 |
+
"rope_theta": 10000,
|
| 656 |
+
"rms_norm_eps": 1e-06,
|
| 657 |
+
"use_cache": true,
|
| 658 |
+
"use_qk_norm": true,
|
| 659 |
+
"use_flash_attn": true,
|
| 660 |
+
"attention_dropout": 0.0,
|
| 661 |
+
"hidden_dropout": 0.1,
|
| 662 |
+
"torch_dtype": "float16"
|
| 663 |
+
}
|
| 664 |
+
```
|
| 665 |
+
|
| 666 |
+
### Custom Configuration
|
| 667 |
+
|
| 668 |
+
```python
|
| 669 |
+
from transformers import AutoConfig
|
| 670 |
+
|
| 671 |
+
# Load dan modifikasi config
|
| 672 |
+
config = AutoConfig.from_pretrained("Lyon28/caca-150M-untrained")
|
| 673 |
+
|
| 674 |
+
# Custom modifications
|
| 675 |
+
config.max_position_embeddings = 16384 # Extend context
|
| 676 |
+
config.rope_scaling = {"type": "linear", "factor": 2.0}
|
| 677 |
+
config.use_flash_attn = True
|
| 678 |
+
config.hidden_dropout = 0.05
|
| 679 |
+
|
| 680 |
+
# Save custom config
|
| 681 |
+
config.save_pretrained("./custom_config")
|
| 682 |
+
```
|
| 683 |
+
|
| 684 |
+
---
|
| 685 |
+
|
| 686 |
+
## ๐ฌ Arsitektur
|
| 687 |
+
|
| 688 |
+
### Layer Structure
|
| 689 |
+
|
| 690 |
+
```
|
| 691 |
+
Input Tokens
|
| 692 |
+
โ
|
| 693 |
+
Embedding Layer (16,000 โ 640)
|
| 694 |
+
โ
|
| 695 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 696 |
+
โ Decoder Block ร 29 โ
|
| 697 |
+
โ โ
|
| 698 |
+
โ โโ RMSNorm โ
|
| 699 |
+
โ โโ Multi-Head Attention (GQA) โ
|
| 700 |
+
โ โ - Flash Attention v2 โ
|
| 701 |
+
โ โ - 10 Query heads, 2 KV heads โ
|
| 702 |
+
โ โ - RoPE position encoding โ
|
| 703 |
+
โ โโ Residual Connection โ
|
| 704 |
+
โ โ โ
|
| 705 |
+
โ โโ RMSNorm โ
|
| 706 |
+
โ โโ Feed-Forward Network (SwiGLU) โ
|
| 707 |
+
โ โ - Gate: 640 โ 1728 โ
|
| 708 |
+
โ โ - Up: 640 โ 1728 โ
|
| 709 |
+
โ โ - Down: 1728 โ 640 โ
|
| 710 |
+
โ โโ Residual Connection โ
|
| 711 |
+
โ โ
|
| 712 |
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 713 |
+
โ
|
| 714 |
+
RMSNorm (Final)
|
| 715 |
+
โ
|
| 716 |
+
LM Head (640 โ 16,000)
|
| 717 |
+
โ
|
| 718 |
+
Output Logits
|
| 719 |
+
```
|
| 720 |
+
|
| 721 |
+
### Attention Mechanism (GQA)
|
| 722 |
+
|
| 723 |
+
```
|
| 724 |
+
Query: [10 heads ร 64 dim] = 640
|
| 725 |
+
Key: [2 heads ร 64 dim] = 128
|
| 726 |
+
Value: [2 heads ร 64 dim] = 128
|
| 727 |
+
|
| 728 |
+
Grouped Query Attention:
|
| 729 |
+
- Setiap 5 query heads berbagi 1 KV head
|
| 730 |
+
- Memory KV cache: 80% lebih kecil dari Multi-Head Attention
|
| 731 |
+
- Kualitas mendekati MHA, speed mendekati MQA
|
| 732 |
+
```
|
| 733 |
+
|
| 734 |
+
### Feed-Forward Network (SwiGLU)
|
| 735 |
+
|
| 736 |
+
```
|
| 737 |
+
FFN(x) = (SiLU(xW_gate) โ xW_up) W_down
|
| 738 |
+
|
| 739 |
+
Where:
|
| 740 |
+
- W_gate: 640 ร 1728
|
| 741 |
+
- W_up: 640 ร 1728
|
| 742 |
+
- W_down: 1728 ร 640
|
| 743 |
+
- SiLU(x) = x ยท sigmoid(x)
|
| 744 |
+
- โ = element-wise multiplication
|
| 745 |
+
```
|
| 746 |
+
|
| 747 |
+
## ๐ฌ Format Chat & Prompt Engineering
|
| 748 |
+
|
| 749 |
+
### ๐ Chat Template
|
| 750 |
+
|
| 751 |
+
Model mendukung format chat standar untuk conversational AI:
|
| 752 |
+
|
| 753 |
+
```python
|
| 754 |
+
# Format chat template bawaan
|
| 755 |
+
chat_template = """
|
| 756 |
+
{% for message in messages %}
|
| 757 |
+
{% if message['role'] == 'system' %}
|
| 758 |
+
System: {{ message['content'] }}
|
| 759 |
+
|
| 760 |
+
{% elif message['role'] == 'user' %}
|
| 761 |
+
User: {{ message['content'] }}
|
| 762 |
+
|
| 763 |
+
{% elif message['role'] == 'assistant' %}
|
| 764 |
+
Assistant: {{ message['content'] }}
|
| 765 |
+
|
| 766 |
+
{% endif %}
|
| 767 |
+
{% endfor %}
|
| 768 |
+
{% if add_generation_prompt %}Assistant:{% endif %}
|
| 769 |
+
"""
|
| 770 |
+
|
| 771 |
+
# Contoh penggunaan
|
| 772 |
+
messages = [
|
| 773 |
+
{"role": "system", "content": "Kamu adalah asisten AI yang membantu dan ramah."},
|
| 774 |
+
{"role": "user", "content": "Jelaskan tentang fotosintesis"},
|
| 775 |
+
{"role": "assistant", "content": "Fotosintesis adalah proses di mana tumbuhan mengubah cahaya matahari menjadi energi kimia..."},
|
| 776 |
+
{"role": "user", "content": "Apa manfaatnya bagi manusia?"},
|
| 777 |
+
]
|
| 778 |
+
|
| 779 |
+
# Apply template
|
| 780 |
+
formatted = tokenizer.apply_chat_template(
|
| 781 |
+
messages,
|
| 782 |
+
tokenize=False,
|
| 783 |
+
add_generation_prompt=True
|
| 784 |
+
)
|
| 785 |
+
|
| 786 |
+
print(formatted)
|
| 787 |
+
# Output:
|
| 788 |
+
# System: Kamu adalah asisten AI yang membantu dan ramah.
|
| 789 |
+
#
|
| 790 |
+
# User: Jelaskan tentang fotosintesis
|
| 791 |
+
# Assistant: Fotosintesis adalah proses di mana tumbuhan...
|
| 792 |
+
# User: Apa manfaatnya bagi manusia?
|
| 793 |
+
# Assistant:
|
| 794 |
+
```
|
| 795 |
+
|
| 796 |
+
---
|
| 797 |
+
|
| 798 |
+
## ๐ฏ Use Cases
|
| 799 |
+
|
| 800 |
+
Model ini dirancang untuk berbagai aplikasi NLP setelah melalui proses training:
|
| 801 |
+
|
| 802 |
+
### Text Generation
|
| 803 |
+
- โ๏ธ Creative writing & storytelling
|
| 804 |
+
- ๐ฐ Article generation
|
| 805 |
+
- ๐ฌ Conversational AI
|
| 806 |
+
- ๐ Text completion
|
| 807 |
+
|
| 808 |
+
### Language Understanding
|
| 809 |
+
- ๐ Text classification
|
| 810 |
+
- ๐ท๏ธ Named Entity Recognition (NER)
|
| 811 |
+
- โ Question Answering
|
| 812 |
+
- ๐ Summarization
|
| 813 |
+
|
| 814 |
+
### Code Generation
|
| 815 |
+
- ๐ป Code completion
|
| 816 |
+
- ๐ Bug fixing suggestions
|
| 817 |
+
- ๐ Documentation generation
|
| 818 |
+
- ๐ Code translation
|
| 819 |
+
|
| 820 |
+
### Multilingual Tasks
|
| 821 |
+
- ๐ Translation (ID โ EN)
|
| 822 |
+
- ๐ฃ๏ธ Cross-lingual understanding
|
| 823 |
+
- ๐ Multilingual classification
|
| 824 |
+
|
| 825 |
+
---
|
| 826 |
+
|
| 827 |
+
## ๐ Benchmark & Evaluation
|
| 828 |
+
|
| 829 |
+
> โ ๏ธ Model belum melalui evaluasi karena status untrained
|
| 830 |
+
|
| 831 |
+
Setelah training, model akan dievaluasi pada:
|
| 832 |
+
|
| 833 |
+
### Indonesian Benchmarks
|
| 834 |
+
- **IndoNLU**: Comprehensive Indonesian NLU tasks
|
| 835 |
+
- **IndoQA**: Indonesian Question Answering
|
| 836 |
+
- **IndoSum**: Summarization
|
| 837 |
+
- **IndoNER**: Named Entity Recognition
|
| 838 |
+
|
| 839 |
+
### Multilingual Benchmarks
|
| 840 |
+
- **MMLU**: Massive Multitask Language Understanding
|
| 841 |
+
- **HellaSwag**: Common sense reasoning
|
| 842 |
+
- **ARC**: Science QA
|
| 843 |
+
- **TruthfulQA**: Truthfulness evaluation
|
| 844 |
+
|
| 845 |
+
### Generation Quality
|
| 846 |
+
- **Perplexity**: Language modeling quality
|
| 847 |
+
- **BLEU/ROUGE**: Translation & summarization
|
| 848 |
+
- **Human Evaluation**: Fluency, coherence, factuality
|
| 849 |
+
|
| 850 |
+
---
|
| 851 |
+
|
| 852 |
+
## ๐ ๏ธ Development & Training Tips
|
| 853 |
+
|
| 854 |
+
### Optimal Batch Size
|
| 855 |
+
|
| 856 |
+
```python
|
| 857 |
+
# Rule of thumb untuk 145.24M model
|
| 858 |
+
# GPU Memory โ Batch size per device
|
| 859 |
+
|
| 860 |
+
if gpu_memory >= 80: # A100 80GB
|
| 861 |
+
batch_size = 110
|
| 862 |
+
gradient_accumulation = 1
|
| 863 |
+
elif gpu_memory >= 40: # A100 40GB
|
| 864 |
+
batch_size = 55
|
| 865 |
+
gradient_accumulation = 1
|
| 866 |
+
elif gpu_memory >= 24: # RTX 3090/4090
|
| 867 |
+
batch_size = 1
|
| 868 |
+
gradient_accumulation = 1
|
| 869 |
+
|
| 870 |
+
# Effective batch size = batch_size ร gradient_accumulation ร num_gpus
|
| 871 |
+
```
|
| 872 |
+
|
| 873 |
+
### Learning Rate Scheduling
|
| 874 |
+
|
| 875 |
+
```python
|
| 876 |
+
# Recommended untuk 145.24M model
|
| 877 |
+
learning_rate = 0.0005 # Base LR
|
| 878 |
+
warmup_ratio = 0.05 # 5% of total steps
|
| 879 |
+
lr_scheduler = "cosine" # atau "linear"
|
| 880 |
+
|
| 881 |
+
# Learning rate scaling rule:
|
| 882 |
+
# LR โ sqrt(batch_size)
|
| 883 |
+
# Untuk batch size 256: LR = 0.0005
|
| 884 |
+
# Untuk batch size 512: LR = 7.07e-04
|
| 885 |
+
```
|
| 886 |
+
|
| 887 |
+
### Gradient Clipping
|
| 888 |
+
|
| 889 |
+
```python
|
| 890 |
+
# Prevent gradient explosion
|
| 891 |
+
max_grad_norm = 1.0 # Clip at 1.0
|
| 892 |
+
|
| 893 |
+
# Monitor gradients
|
| 894 |
+
from torch.nn.utils import clip_grad_norm_
|
| 895 |
+
|
| 896 |
+
grad_norm = clip_grad_norm_(model.parameters(), max_grad_norm)
|
| 897 |
+
if grad_norm > 10.0:
|
| 898 |
+
print(f"โ ๏ธ High gradient norm: {grad_norm:.2f}")
|
| 899 |
+
```
|
| 900 |
+
|
| 901 |
+
### Training Stability
|
| 902 |
+
|
| 903 |
+
```python
|
| 904 |
+
# Tips untuk stable training:
|
| 905 |
+
|
| 906 |
+
1. **Warmup**: Mulai dengan LR rendah
|
| 907 |
+
2. **Gradient Checkpointing**: Kurangi memory footprint
|
| 908 |
+
3. **Mixed Precision**: Gunakan BF16 jika tersedia (lebih stable dari FP16)
|
| 909 |
+
4. **Batch Size**: Start small, increase gradually
|
| 910 |
+
5. **Monitor**: Track loss, perplexity, gradient norms
|
| 911 |
+
```
|
| 912 |
+
|
| 913 |
+
---
|
| 914 |
+
|
| 915 |
+
## ๐ง Troubleshooting
|
| 916 |
+
|
| 917 |
+
### Out of Memory (OOM)
|
| 918 |
+
|
| 919 |
+
```python
|
| 920 |
+
# Solusi OOM saat training:
|
| 921 |
+
|
| 922 |
+
โ
1. Enable gradient checkpointing
|
| 923 |
+
model.gradient_checkpointing_enable()
|
| 924 |
+
|
| 925 |
+
โ
2. Reduce batch size
|
| 926 |
+
per_device_train_batch_size = 1
|
| 927 |
+
|
| 928 |
+
โ
3. Increase gradient accumulation
|
| 929 |
+
gradient_accumulation_steps = 32
|
| 930 |
+
|
| 931 |
+
โ
4. Use quantization
|
| 932 |
+
load_in_8bit = True # atau load_in_4bit
|
| 933 |
+
|
| 934 |
+
โ
5. Reduce sequence length
|
| 935 |
+
max_length = 2048 # Start dengan ini
|
| 936 |
+
|
| 937 |
+
โ
6. CPU offloading (jika perlu)
|
| 938 |
+
device_map = "auto"
|
| 939 |
+
offload_folder = "offload"
|
| 940 |
+
```
|
| 941 |
+
|
| 942 |
+
### Slow Training
|
| 943 |
+
|
| 944 |
+
```python
|
| 945 |
+
# Optimasi kecepatan training:
|
| 946 |
+
|
| 947 |
+
โ
1. Flash Attention
|
| 948 |
+
config.use_flash_attn = True # 2-3x speedup
|
| 949 |
+
|
| 950 |
+
โ
2. Compile model (PyTorch 2.0+)
|
| 951 |
+
model = torch.compile(model, mode="reduce-overhead")
|
| 952 |
+
|
| 953 |
+
โ
3. DataLoader optimization
|
| 954 |
+
dataloader = DataLoader(
|
| 955 |
+
dataset,
|
| 956 |
+
batch_size=batch_size,
|
| 957 |
+
num_workers=4, # Parallel data loading
|
| 958 |
+
pin_memory=True, # Faster GPU transfer
|
| 959 |
+
prefetch_factor=2
|
| 960 |
+
)
|
| 961 |
+
|
| 962 |
+
โ
4. Mixed precision
|
| 963 |
+
use_fp16 = True # atau bf16
|
| 964 |
+
|
| 965 |
+
โ
5. Optimize communication (multi-GPU)
|
| 966 |
+
find_unused_parameters = False
|
| 967 |
+
gradient_as_bucket_view = True
|
| 968 |
+
```
|
| 969 |
+
|
| 970 |
+
### NaN Loss
|
| 971 |
+
|
| 972 |
+
```python
|
| 973 |
+
# Jika loss menjadi NaN:
|
| 974 |
+
|
| 975 |
+
โ
1. Reduce learning rate
|
| 976 |
+
learning_rate = learning_rate * 0.1
|
| 977 |
+
|
| 978 |
+
โ
2. Check gradient norms
|
| 979 |
+
clip_grad_norm_(model.parameters(), 1.0)
|
| 980 |
+
|
| 981 |
+
โ
3. Use BF16 instead of FP16
|
| 982 |
+
torch_dtype = torch.bfloat16 # Lebih stable
|
| 983 |
+
|
| 984 |
+
โ
4. Add epsilon to RMSNorm
|
| 985 |
+
rms_norm_eps = 1e-5 # Increase jika perlu
|
| 986 |
+
|
| 987 |
+
โ
5. Check data
|
| 988 |
+
# Pastikan tidak ada inf/nan di dataset
|
| 989 |
+
assert not torch.isnan(input_ids).any()
|
| 990 |
+
assert not torch.isinf(attention_mask).any()
|
| 991 |
+
```
|
| 992 |
+
|
| 993 |
+
---
|
| 994 |
+
|
| 995 |
+
### ๐ซ Prohibited Uses
|
| 996 |
+
|
| 997 |
+
<div style="background: #ffebee; border-left: 4px solid #f44336; padding: 12px; margin: 16px 0;">
|
| 998 |
+
|
| 999 |
+
Model ini **TIDAK BOLEH** digunakan untuk:
|
| 1000 |
+
|
| 1001 |
+
- ๐ซ **Harmful content generation** (violence, self-harm, illegal acts)
|
| 1002 |
+
- ๐ซ **Misinformation/disinformation campaigns**
|
| 1003 |
+
- ๐ซ **Harassment or hate speech**
|
| 1004 |
+
- ๐ซ **Impersonation or identity theft**
|
| 1005 |
+
- ๐ซ **Child safety violations** (CSAM, grooming, exploitation)
|
| 1006 |
+
- ๐ซ **Privacy violations** (doxxing, stalking, surveillance abuse)
|
| 1007 |
+
- ๐ซ **Malicious code generation** (malware, exploits, etc)
|
| 1008 |
+
- ๐ซ **Spam or manipulation** (fake reviews, astroturfing)
|
| 1009 |
+
- ๐ซ **Medical/legal advice** (tanpa disclaimer & expert review)
|
| 1010 |
+
- ๐ซ **Financial fraud** (scams, market manipulation)
|
| 1011 |
+
|
| 1012 |
+
**Violation consequences:** Model access revocation + legal action jika applicable
|
| 1013 |
+
|
| 1014 |
+
</div>
|
| 1015 |
+
|
| 1016 |
+
---
|
| 1017 |
+
|
| 1018 |
+
## ๐ License & Citation
|
| 1019 |
+
|
| 1020 |
+
### ๐ License
|
| 1021 |
+
|
| 1022 |
+
<div style="background: #e8f5e9; border-left: 4px solid #4caf50; padding: 12px; margin: 16px 0;">
|
| 1023 |
+
|
| 1024 |
+
Model ini dirilis di bawah **Apache License 2.0**
|
| 1025 |
+
|
| 1026 |
+
โ
**Anda BEBAS untuk:**
|
| 1027 |
+
- โ๏ธ Gunakan secara komersial
|
| 1028 |
+
- โ๏ธ Modifikasi sesuka hati
|
| 1029 |
+
- โ๏ธ Distribusi ulang
|
| 1030 |
+
- โ๏ธ Patent use
|
| 1031 |
+
- โ๏ธ Private use
|
| 1032 |
+
|
| 1033 |
+
โ ๏ธ **Dengan syarat:**
|
| 1034 |
+
- ๐ Include license & copyright notice
|
| 1035 |
+
- ๐ State changes yang dibuat
|
| 1036 |
+
- ๐ Disclaimer of warranty
|
| 1037 |
+
|
| 1038 |
+
โ **Tanpa jaminan apapun** (use at your own risk)
|
| 1039 |
+
|
| 1040 |
+
</div>
|
| 1041 |
+
|
| 1042 |
+
**Full license text**: [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
| 1043 |
+
|
| 1044 |
+
## ๐ Citation
|
| 1045 |
+
|
| 1046 |
+
Jika Anda menggunakan model ini dalam penelitian, mohon sitasi:
|
| 1047 |
+
|
| 1048 |
+
```bibtex
|
| 1049 |
+
@misc{cacacaca150m,
|
| 1050 |
+
author = {Lyon},
|
| 1051 |
+
title = {Caca-caca-150M: Modern Transformer Architecture with Grouped Query Attention},
|
| 1052 |
+
year = {2026},
|
| 1053 |
+
publisher = {Hugging Face},
|
| 1054 |
+
journal = {Hugging Face Model Hub},
|
| 1055 |
+
howpublished = {\url{https://huggingface.co/Lyon28/caca-150M-untrained}},
|
| 1056 |
+
note = {Untrained model with 145,244,672 parameters}
|
| 1057 |
+
}
|
| 1058 |
+
```
|
| 1059 |
+
|
| 1060 |
+
**APA Style:**
|
| 1061 |
+
```
|
| 1062 |
+
Lyon. (2026). Caca-caca-150M: Modern Transformer Architecture with Grouped
|
| 1063 |
+
Query Attention [Untrained model]. Hugging Face.
|
| 1064 |
+
https://huggingface.co/Lyon28/caca-150M-untrained
|
| 1065 |
+
```
|
| 1066 |
+
|
| 1067 |
+
**MLA Style:**
|
| 1068 |
+
```
|
| 1069 |
+
Lyon. "Caca-caca-150M: Modern Transformer Architecture with Grouped Query Attention."
|
| 1070 |
+
Hugging Face, 2026, huggingface.co/Lyon28/caca-150M-untrained.
|
| 1071 |
+
```
|
| 1072 |
+
|
| 1073 |
+
---
|
| 1074 |
+
|
| 1075 |
+
### ๐ Acknowledgments
|
| 1076 |
+
|
| 1077 |
+
Model ini berdiri di pundak para raksasa! Terima kasih kepada:
|
| 1078 |
+
|
| 1079 |
+
<details>
|
| 1080 |
+
<summary><b>๐๏ธ Klik untuk daftar lengkap acknowledgments</b></summary>
|
| 1081 |
+
|
| 1082 |
+
#### ๐๏ธ **Core Architecture**
|
| 1083 |
+
- **LLaMA/LLaMA 2** (Meta AI, 2023) - Decoder-only architecture, RMSNorm, SwiGLU
|
| 1084 |
+
- Paper: [LLaMA: Open and Efficient Foundation Language Models](https://arxiv.org/abs/2302.13971)
|
| 1085 |
+
- Authors: Hugo Touvron et al.
|
| 1086 |
+
- **GPT-3** (OpenAI, 2020) - Transformer language modeling paradigm
|
| 1087 |
+
- **PaLM** (Google, 2022) - SwiGLU activation insights
|
| 1088 |
+
|
| 1089 |
+
#### ๐ฏ **Attention Mechanisms**
|
| 1090 |
+
- **Flash Attention v2** (Tri Dao et al., Stanford, 2023)
|
| 1091 |
+
- Paper: [FlashAttention-2: Faster Attention with Better Parallelism](https://arxiv.org/abs/2307.08691)
|
| 1092 |
+
- 3x speedup dengan IO-aware algorithm
|
| 1093 |
+
- **Grouped Query Attention** (Joshua Ainslie et al., Google, 2023)
|
| 1094 |
+
- Paper: [GQA: Training Generalized Multi-Query Transformer](https://arxiv.org/abs/2305.13245)
|
| 1095 |
+
- Memory-efficient KV cache
|
| 1096 |
+
- **Multi-Query Attention** (Noam Shazeer, Google, 2019)
|
| 1097 |
+
- Fast inference dengan shared K/V
|
| 1098 |
+
- **xFormers** (Meta AI, 2022) - Memory efficient attention
|
| 1099 |
+
- **PyTorch SDPA** (PyTorch Team, 2023) - Native attention optimization
|
| 1100 |
+
|
| 1101 |
+
#### ๐ **Position Encodings**
|
| 1102 |
+
- **RoPE** (Jianlin Su et al., EleutherAI, 2021)
|
| 1103 |
+
- Paper: [RoFormer: Enhanced Transformer with Rotary Position Embedding](https://arxiv.org/abs/2104.09864)
|
| 1104 |
+
- Superior length extrapolation
|
| 1105 |
+
- **ALiBI** (Ofir Press et al., 2022)
|
| 1106 |
+
- Paper: [Train Short, Test Long: Attention with Linear Biases](https://arxiv.org/abs/2108.12409)
|
| 1107 |
+
- Length generalization without retraining
|
| 1108 |
+
- **YaRN** (Bowen Peng et al., 2023)
|
| 1109 |
+
- Paper: [YaRN: Efficient Context Window Extension](https://arxiv.org/abs/2309.00071)
|
| 1110 |
+
|
| 1111 |
+
#### ๐ช **Long Context & Efficiency**
|
| 1112 |
+
- **Sliding Window Attention** (Albert Gu et al., Mistral AI, 2023)
|
| 1113 |
+
- Paper: [Mistral 7B](https://arxiv.org/abs/2310.06825)
|
| 1114 |
+
- **StreamingLLM** (Guangxuan Xiao et al., MIT, 2023)
|
| 1115 |
+
- Paper: [Efficient Streaming Language Models with Attention Sinks](https://arxiv.org/abs/2309.17453)
|
| 1116 |
+
- Infinite sequence length!
|
| 1117 |
+
- **Logit Softcapping** (Google Gemma Team, 2024)
|
| 1118 |
+
- Paper: [Gemma: Open Models Based on Gemini](https://arxiv.org/abs/2403.08295)
|
| 1119 |
+
|
| 1120 |
+
#### ๐ง **Mixture of Experts**
|
| 1121 |
+
- **Mixtral 8x7B** (Albert Jiang et al., Mistral AI, 2024)
|
| 1122 |
+
- Paper: [Mixtral of Experts](https://arxiv.org/abs/2401.04088)
|
| 1123 |
+
- State-of-the-art sparse MoE
|
| 1124 |
+
- **Switch Transformers** (William Fedus et al., Google, 2021)
|
| 1125 |
+
- Paper: [Switch Transformers: Scaling to Trillion Parameter Models](https://arxiv.org/abs/2101.03961)
|
| 1126 |
+
- Expert scaling insights
|
| 1127 |
+
- **GLaM** (Nan Du et al., Google, 2021) - Generalist Language Model
|
| 1128 |
+
- **Expert Choice Routing** (Yanqi Zhou et al., Google, 2022)
|
| 1129 |
+
- Better load balancing
|
| 1130 |
+
|
| 1131 |
+
#### ๐ **Training Optimizations**
|
| 1132 |
+
- **Layer Scale** (Hugo Touvron et al., Meta, 2021)
|
| 1133 |
+
- Paper: [Going Deeper with Image Transformers](https://arxiv.org/abs/2103.17239)
|
| 1134 |
+
- Training stability untuk deep networks
|
| 1135 |
+
- **Stochastic Depth** (Gao Huang et al., 2016)
|
| 1136 |
+
- Paper: [Deep Networks with Stochastic Depth](https://arxiv.org/abs/1603.09382)
|
| 1137 |
+
- **Mixture of Depths** (David Raposo et al., DeepMind, 2024)
|
| 1138 |
+
- Paper: [Mixture-of-Depths: Dynamically allocating compute](https://arxiv.org/abs/2404.02258)
|
| 1139 |
+
- Dynamic compute allocation
|
| 1140 |
+
- **Gradient Checkpointing** (Tianqi Chen et al., 2016)
|
| 1141 |
+
|
| 1142 |
+
#### ๐ฆ **Quantization**
|
| 1143 |
+
- **LLM.int8()** (Tim Dettmers et al., 2022)
|
| 1144 |
+
- Paper: [LLM.int8(): 8-bit Matrix Multiplication for Transformers](https://arxiv.org/abs/2208.07339)
|
| 1145 |
+
- **QLoRA** (Tim Dettmers et al., 2023)
|
| 1146 |
+
- Paper: [QLoRA: Efficient Finetuning of Quantized LLMs](https://arxiv.org/abs/2305.14314)
|
| 1147 |
+
- 4-bit efficient fine-tuning
|
| 1148 |
+
- **bitsandbytes** (Tim Dettmers) - Quantization library
|
| 1149 |
+
|
| 1150 |
+
#### ๐จ **Multimodal**
|
| 1151 |
+
- **Vision Transformer** (Alexey Dosovitskiy et al., Google, 2020)
|
| 1152 |
+
- Paper: [An Image is Worth 16x16 Words](https://arxiv.org/abs/2010.11929)
|
| 1153 |
+
- **Flamingo** (Jean-Baptiste Alayrac et al., DeepMind, 2022)
|
| 1154 |
+
- Paper: [Flamingo: a Visual Language Model](https://arxiv.org/abs/2204.14198)
|
| 1155 |
+
- Perceiver Resampler
|
| 1156 |
+
- **BLIP-2** (Junnan Li et al., Salesforce, 2023)
|
| 1157 |
+
- Paper: [BLIP-2: Bootstrapping Language-Image Pre-training](https://arxiv.org/abs/2301.12597)
|
| 1158 |
+
- Q-Former architecture
|
| 1159 |
+
- **Whisper** (Alec Radford et al., OpenAI, 2022) - Audio encoding
|
| 1160 |
+
|
| 1161 |
+
#### ๐ ๏ธ **Normalization & Activations**
|
| 1162 |
+
- **RMSNorm** (Biao Zhang, Rico Sennrich, 2019)
|
| 1163 |
+
- Paper: [Root Mean Square Layer Normalization](https://arxiv.org/abs/1910.07467)
|
| 1164 |
+
- **SwiGLU** (Noam Shazeer, Google, 2020)
|
| 1165 |
+
- Paper: [GLU Variants Improve Transformer](https://arxiv.org/abs/2002.05202)
|
| 1166 |
+
|
| 1167 |
+
#### ๐ง **Tools & Frameworks**
|
| 1168 |
+
- **๐ค Hugging Face** - Transformers, Accelerate, PEFT
|
| 1169 |
+
- Making NLP accessible to everyone
|
| 1170 |
+
- **PyTorch** - Deep learning framework
|
| 1171 |
+
- Facebook AI Research team
|
| 1172 |
+
- **Safetensors** - Secure serialization
|
| 1173 |
+
- Hugging Face team
|
| 1174 |
+
- **DeepSpeed** - Distributed training
|
| 1175 |
+
- Microsoft Research
|
| 1176 |
+
- **Flash Attention Implementation** - Tri Dao & team
|
| 1177 |
+
|
| 1178 |
+
#### ๐ฎ๐ฉ **Indonesian NLP Community**
|
| 1179 |
+
Special thanks to Indonesian NLP researchers & practitioners yang telah membangun foundation untuk Indonesian language AI.
|
| 1180 |
+
|
| 1181 |
+
</details>
|
| 1182 |
+
|
| 1183 |
+
---
|
| 1184 |
+
|
| 1185 |
+
## ๐ License
|
| 1186 |
+
|
| 1187 |
+
Model ini dirilis di bawah **Apache License 2.0**.
|
| 1188 |
+
|
| 1189 |
+
### Ketentuan Penggunaan:
|
| 1190 |
+
- โ
**Bebas digunakan** untuk keperluan komersial dan non-komersial
|
| 1191 |
+
- โ
**Modifikasi** diperbolehkan
|
| 1192 |
+
- โ
**Distribusi** diperbolehkan dengan attribution
|
| 1193 |
+
- โ ๏ธ **No Warranty** - model disediakan "as is"
|
| 1194 |
+
- ๐ **Attribution Required** - sertakan copyright notice
|
| 1195 |
+
|
| 1196 |
+
Lihat [LICENSE](LICENSE) untuk detail lengkap.
|
| 1197 |
+
|
| 1198 |
+
---
|
| 1199 |
+
|
| 1200 |
+
## ๐ค Contributing
|
| 1201 |
+
|
| 1202 |
+
Kami sangat terbuka untuk kontribusi! Berikut cara Anda bisa berkontribusi:
|
| 1203 |
+
|
| 1204 |
+
### Training & Fine-tuning
|
| 1205 |
+
- ๐ Train model ini dengan dataset Anda
|
| 1206 |
+
- ๐ Share benchmark results
|
| 1207 |
+
- ๐ฌ Experiment dengan hyperparameters
|
| 1208 |
+
|
| 1209 |
+
### Code & Architecture
|
| 1210 |
+
- ๐ Report bugs atau issues
|
| 1211 |
+
- ๐ก Suggest improvements
|
| 1212 |
+
- ๐ง Submit pull requests
|
| 1213 |
+
|
| 1214 |
+
### Documentation
|
| 1215 |
+
- ๐ Improve documentation
|
| 1216 |
+
- ๐ Add translations
|
| 1217 |
+
- โ๏ธ Write tutorials & guides
|
| 1218 |
+
|
| 1219 |
+
### Dataset & Evaluation
|
| 1220 |
+
- ๐ Contribute training data
|
| 1221 |
+
- ๐งช Create evaluation benchmarks
|
| 1222 |
+
- ๐ฏ Share fine-tuned versions
|
| 1223 |
+
|
| 1224 |
+
---
|
| 1225 |
+
|
| 1226 |
+
## ๐ฅ Team & Acknowledgments
|
| 1227 |
+
|
| 1228 |
+
### Core Team
|
| 1229 |
+
- **LyonPoy** - Architecture design & implementation
|
| 1230 |
+
|
| 1231 |
+
### Special Thanks
|
| 1232 |
+
- ๐ค **Hugging Face** - Infrastructure & community
|
| 1233 |
+
- โก **FlashAttention Team** - Efficient attention implementation
|
| 1234 |
+
- ๐ง **Anthropic, Google, Meta** - Research inspirations
|
| 1235 |
+
|
| 1236 |
+
### Community
|
| 1237 |
+
Terima kasih kepada komunitas open-source yang telah berkontribusi pada:
|
| 1238 |
+
- Transformers library
|
| 1239 |
+
- PyTorch framework
|
| 1240 |
+
- Datasets & evaluation tools
|
| 1241 |
+
|
| 1242 |
+
---
|
| 1243 |
+
|
| 1244 |
+
## ๐ Contact & Support
|
| 1245 |
+
|
| 1246 |
+
### Community
|
| 1247 |
+
- ๐ฌ [Discussions](https://huggingface.co/Lyon28/caca-150M-untrained/discussions) - Ask questions
|
| 1248 |
+
- ๐ [Issues](https://github.com/lyon28/caca-transformers/issues) - Report bugs
|
| 1249 |
+
- ๐ง Email : cacatransformers@gmail.com
|
| 1250 |
+
|
| 1251 |
+
---
|
| 1252 |
+
|
| 1253 |
+
## ๐ Star History
|
| 1254 |
+
|
| 1255 |
+
<div align="center">
|
| 1256 |
+
|
| 1257 |
+
[](https://star-history.com/#Lyon-28/caca-transformers&Date)
|
| 1258 |
+
|
| 1259 |
+
</div>
|
| 1260 |
+
|
| 1261 |
+
## ๐ Dibuat dengan โค๏ธ untuk Komunitas AI Indonesia
|
| 1262 |
+
|
| 1263 |
+
<img src="https://i.postimg.cc/MTSj073X/logo.png" width="200" alt="Caca Logo"/>
|
| 1264 |
+
|
| 1265 |
+
### **Terima kasih telah menggunakan Caca!**
|
| 1266 |
+
|
| 1267 |
+
Jika model ini berguna, jangan lupa โญ repository kami!
|
| 1268 |
+
|
| 1269 |
+
<div align="center">
|
| 1270 |
+
|
| 1271 |
+
<table>
|
| 1272 |
+
<tr>
|
| 1273 |
+
<td align="center">โญ<br/><b>Star Repo</b><br/><sub>Show your support</sub></td>
|
| 1274 |
+
<td align="center">๐<br/><b>Share</b><br/><sub>Tell your friends</sub></td>
|
| 1275 |
+
<td align="center">๐ฌ<br/><b>Join Discussion</b><br/><sub>Ask questions</sub></td>
|
| 1276 |
+
<td align="center">๐ค<br/><b>Contribute</b><br/><sub>Make it better</sub></td>
|
| 1277 |
+
</tr>
|
| 1278 |
+
</table>
|
| 1279 |
+
|
| 1280 |
+
### ๐ Happy Training! ๐
|
| 1281 |
+
|
| 1282 |
+
**Model ini menunggu untuk dilatih dan menjadi foundation untuk aplikasi AI Anda.**
|
| 1283 |
+
|
| 1284 |
+
[๐ฅ Download Model](#) โข [๐ Read Docs](https://caca-transformers.ai) โข [๐ฌ Join Community](https://discord.gg/cacatransformers)
|
| 1285 |
+
|
| 1286 |
+
</div>
|
| 1287 |
+
|
| 1288 |
+
---
|
| 1289 |
+
|
| 1290 |
+
### ๐ Model Statistics
|
| 1291 |
+
|
| 1292 |
+
<img src="https://img.shields.io/badge/Parameters-145.24M-blue?style=for-the-badge" alt="Parameters"/>
|
| 1293 |
+
<img src="https://img.shields.io/badge/Status-Untrained-orange?style=for-the-badge" alt="Status"/>
|
| 1294 |
+
<img src="https://img.shields.io/badge/License-Apache%202.0-green?style=for-the-badge" alt="License"/>
|
| 1295 |
+
|
| 1296 |
+
<img src="https://img.shields.io/badge/Architecture-Transformer-purple?style=for-the-badge" alt="Architecture"/>
|
| 1297 |
+
<img src="https://img.shields.io/badge/Type-Causal%20LM-red?style=for-the-badge" alt="Type"/>
|
| 1298 |
+
<img src="https://img.shields.io/badge/Context-2,048%20tokens-cyan?style=for-the-badge" alt="Context"/>
|
| 1299 |
+
|
| 1300 |
+
---
|
| 1301 |
+
|
| 1302 |
+
### ๐จ Daily Inspiration
|
| 1303 |
+
|
| 1304 |
+
<div align="center">
|
| 1305 |
+
<img src="https://quotes-caca.vercel.app/api/SsQuote" alt="Daily Quote" width="600" />
|
| 1306 |
+
</div>
|
| 1307 |
+
|
| 1308 |
+
---
|
| 1309 |
+
|
| 1310 |
+
### ๐ Quick Stats
|
| 1311 |
+
|
| 1312 |
+
| Metric | Value |
|
| 1313 |
+
|--------|-------|
|
| 1314 |
+
| ๐ Total Parameters | 145,244,672 |
|
| 1315 |
+
| ๐๏ธ Layers | 29 |
|
| 1316 |
+
| ๐ฏ Attention Heads | 10 |
|
| 1317 |
+
| ๐ Max Context | 2,048 tokens |
|
| 1318 |
+
| ๐พ Size (FP16) | 0.29 GB |
|
| 1319 |
+
| ๐พ Size (INT4) | 0.07 GB |
|
| 1320 |
+
|
| 1321 |
+
---
|
| 1322 |
+
|
| 1323 |
+
<sub>
|
| 1324 |
+
Model ini adalah bagian dari <b>Caca Project</b> - Open source initiative untuk membangun Indonesian LLM ecosystem.<br/>
|
| 1325 |
+
Created with ๐ป by <a href="https://huggingface.co/Lyon28">@Lyon28</a> |
|
| 1326 |
+
Licensed under <a href="https://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a> |
|
| 1327 |
+
Built with <a href="https://huggingface.co">๐ค HuggingFace</a>
|
| 1328 |
+
</sub>
|
| 1329 |
+
|
| 1330 |
+
<br/><br/>
|
| 1331 |
+
|
| 1332 |
+
**๐ "Dari nol, untuk semua" ๐**
|
| 1333 |
+
|
| 1334 |
+
<sub>Last updated: january 2026</sub>
|
| 1335 |
+
|
| 1336 |
+
</div>
|
| 1337 |
+
|
| 1338 |
+
---
|
| 1339 |
+
|
| 1340 |
+
<div align="center">
|
| 1341 |
+
<sub>Built with โค๏ธ by Caca Transformers Team</sub><br>
|
| 1342 |
+
<sub>Powered by ๐ค Transformers โข โก PyTorch โข ๐ฅ Flash Attention</sub>
|
| 1343 |
+
</div>
|
caca_transformers.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
config.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"CacaForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"attention_pattern": "all_global",
|
| 8 |
+
"attention_sink_size": 4,
|
| 9 |
+
"attention_sink_window": 1024,
|
| 10 |
+
"attention_temperature": 1.0,
|
| 11 |
+
"attn_logit_softcapping": null,
|
| 12 |
+
"audio_config": {},
|
| 13 |
+
"auto_map": {
|
| 14 |
+
"AutoConfig": "caca_transformers.CacaConfig",
|
| 15 |
+
"AutoModel": "caca_transformers.CacaModel",
|
| 16 |
+
"AutoModelForCausalLM": "caca_transformers.CacaForCausalLM"
|
| 17 |
+
},
|
| 18 |
+
"bos_token_id": 1,
|
| 19 |
+
"chat_template": "{% for message in messages %}{% if message['role'] == 'system' %}System: {{ message['content'] }}\n{% elif message['role'] == 'user' %}User: {{ message['content'] }}\n{% elif message['role'] == 'assistant' %}Assistant: {{ message['content'] }}\n{% endif %}{% endfor %}{% if add_generation_prompt %}Assistant:{% endif %}",
|
| 20 |
+
"cross_attention_frequency": 4,
|
| 21 |
+
"dtype": "float32",
|
| 22 |
+
"eos_token_id": 2,
|
| 23 |
+
"expert_capacity_factor": 1.0,
|
| 24 |
+
"expert_choice_k": 0.125,
|
| 25 |
+
"expert_load_monitoring": true,
|
| 26 |
+
"expert_load_warn_threshold": 0.3,
|
| 27 |
+
"final_logit_softcapping": null,
|
| 28 |
+
"global_attention_every_n_layers": 2,
|
| 29 |
+
"gradient_checkpointing_granularity": "full",
|
| 30 |
+
"head_dim": 64,
|
| 31 |
+
"hidden_dropout": 0.1,
|
| 32 |
+
"hidden_size": 640,
|
| 33 |
+
"initializer_range": 0.02,
|
| 34 |
+
"intermediate_size": 1728,
|
| 35 |
+
"label_smoothing": 0.0,
|
| 36 |
+
"layer_scale_init": 1e-05,
|
| 37 |
+
"lm_logit_softcapping": 30.0,
|
| 38 |
+
"longformer_attention_window": 512,
|
| 39 |
+
"lora_alpha": 32.0,
|
| 40 |
+
"lora_bias": "none",
|
| 41 |
+
"lora_dropout": 0.05,
|
| 42 |
+
"lora_rank": 16,
|
| 43 |
+
"lora_target_modules": [
|
| 44 |
+
"q_proj",
|
| 45 |
+
"v_proj"
|
| 46 |
+
],
|
| 47 |
+
"max_position_embeddings": 2048,
|
| 48 |
+
"merge_threshold": 0.5,
|
| 49 |
+
"mlp_bias": false,
|
| 50 |
+
"mod_capacity_factor": 0.5,
|
| 51 |
+
"mod_route_method": "learned",
|
| 52 |
+
"model_type": "caca",
|
| 53 |
+
"moe_layer_frequency": 2,
|
| 54 |
+
"mup_base_width": 256,
|
| 55 |
+
"nan_recovery_level": 1,
|
| 56 |
+
"num_attention_heads": 10,
|
| 57 |
+
"num_expert_groups": 1,
|
| 58 |
+
"num_experts": 8,
|
| 59 |
+
"num_experts_per_tok": 2,
|
| 60 |
+
"num_hidden_layers": 29,
|
| 61 |
+
"num_key_value_heads": 2,
|
| 62 |
+
"pad_token_id": null,
|
| 63 |
+
"pipeline_parallel_size": 1,
|
| 64 |
+
"pretraining_tp": 1,
|
| 65 |
+
"projector_hidden_size": 640,
|
| 66 |
+
"qk_norm_eps": 1e-06,
|
| 67 |
+
"residual_dropout": 0.1,
|
| 68 |
+
"rms_norm_eps": 1e-06,
|
| 69 |
+
"rope_ntk_alpha": 1.0,
|
| 70 |
+
"rope_parameters": {
|
| 71 |
+
"rope_theta": 10000.0,
|
| 72 |
+
"rope_type": "default"
|
| 73 |
+
},
|
| 74 |
+
"rope_theta": 10000.0,
|
| 75 |
+
"rope_type": "default",
|
| 76 |
+
"router_aux_loss_coef": 0.01,
|
| 77 |
+
"router_z_loss_coef": 0.001,
|
| 78 |
+
"sliding_window": null,
|
| 79 |
+
"stochastic_depth_prob": 0.1,
|
| 80 |
+
"tensor_parallel_size": 1,
|
| 81 |
+
"tie_word_embeddings": false,
|
| 82 |
+
"token_dropout": 0.0,
|
| 83 |
+
"transformers_version": "5.14.1",
|
| 84 |
+
"use_alibi": false,
|
| 85 |
+
"use_attention_sink": false,
|
| 86 |
+
"use_cache": true,
|
| 87 |
+
"use_cross_attention": false,
|
| 88 |
+
"use_expert_choice": false,
|
| 89 |
+
"use_flash_attn": true,
|
| 90 |
+
"use_grouped_moe": false,
|
| 91 |
+
"use_grouped_query_attention": false,
|
| 92 |
+
"use_layer_scale": false,
|
| 93 |
+
"use_longformer_attention": false,
|
| 94 |
+
"use_lora": false,
|
| 95 |
+
"use_mixture_of_depths": false,
|
| 96 |
+
"use_moe": false,
|
| 97 |
+
"use_multi_query_attention": false,
|
| 98 |
+
"use_multimodal": false,
|
| 99 |
+
"use_mup": false,
|
| 100 |
+
"use_qk_norm": true,
|
| 101 |
+
"use_rotary_embeddings": true,
|
| 102 |
+
"use_soft_merging": false,
|
| 103 |
+
"use_spectral_norm": false,
|
| 104 |
+
"use_stochastic_depth": false,
|
| 105 |
+
"vision_config": {},
|
| 106 |
+
"vocab_size": 16000
|
| 107 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"eos_token_id": 2,
|
| 5 |
+
"output_attentions": false,
|
| 6 |
+
"output_hidden_states": false,
|
| 7 |
+
"transformers_version": "5.14.1",
|
| 8 |
+
"use_cache": true
|
| 9 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c916e68026851198b7991d66cd4a2d9079cb11dd5b0c15e4e7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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metrics": {},
|
| 3 |
+
"cache_stats": {
|
| 4 |
+
"layer_0": {
|
| 5 |
+
"hits": 0,
|
| 6 |
+
"misses": 0,
|
| 7 |
+
"hit_rate": 0,
|
| 8 |
+
"cache_size": 0
|
| 9 |
+
},
|
| 10 |
+
"layer_1": {
|
| 11 |
+
"hits": 0,
|
| 12 |
+
"misses": 0,
|
| 13 |
+
"hit_rate": 0,
|
| 14 |
+
"cache_size": 0
|
| 15 |
+
},
|
| 16 |
+
"layer_2": {
|
| 17 |
+
"hits": 0,
|
| 18 |
+
"misses": 0,
|
| 19 |
+
"hit_rate": 0,
|
| 20 |
+
"cache_size": 0
|
| 21 |
+
},
|
| 22 |
+
"layer_3": {
|
| 23 |
+
"hits": 0,
|
| 24 |
+
"misses": 0,
|
| 25 |
+
"hit_rate": 0,
|
| 26 |
+
"cache_size": 0
|
| 27 |
+
},
|
| 28 |
+
"layer_4": {
|
| 29 |
+
"hits": 0,
|
| 30 |
+
"misses": 0,
|
| 31 |
+
"hit_rate": 0,
|
| 32 |
+
"cache_size": 0
|
| 33 |
+
},
|
| 34 |
+
"layer_5": {
|
| 35 |
+
"hits": 0,
|
| 36 |
+
"misses": 0,
|
| 37 |
+
"hit_rate": 0,
|
| 38 |
+
"cache_size": 0
|
| 39 |
+
},
|
| 40 |
+
"layer_6": {
|
| 41 |
+
"hits": 0,
|
| 42 |
+
"misses": 0,
|
| 43 |
+
"hit_rate": 0,
|
| 44 |
+
"cache_size": 0
|
| 45 |
+
},
|
| 46 |
+
"layer_7": {
|
| 47 |
+
"hits": 0,
|
| 48 |
+
"misses": 0,
|
| 49 |
+
"hit_rate": 0,
|
| 50 |
+
"cache_size": 0
|
| 51 |
+
},
|
| 52 |
+
"layer_8": {
|
| 53 |
+
"hits": 0,
|
| 54 |
+
"misses": 0,
|
| 55 |
+
"hit_rate": 0,
|
| 56 |
+
"cache_size": 0
|
| 57 |
+
},
|
| 58 |
+
"layer_9": {
|
| 59 |
+
"hits": 0,
|
| 60 |
+
"misses": 0,
|
| 61 |
+
"hit_rate": 0,
|
| 62 |
+
"cache_size": 0
|
| 63 |
+
},
|
| 64 |
+
"layer_10": {
|
| 65 |
+
"hits": 0,
|
| 66 |
+
"misses": 0,
|
| 67 |
+
"hit_rate": 0,
|
| 68 |
+
"cache_size": 0
|
| 69 |
+
},
|
| 70 |
+
"layer_11": {
|
| 71 |
+
"hits": 0,
|
| 72 |
+
"misses": 0,
|
| 73 |
+
"hit_rate": 0,
|
| 74 |
+
"cache_size": 0
|
| 75 |
+
},
|
| 76 |
+
"layer_12": {
|
| 77 |
+
"hits": 0,
|
| 78 |
+
"misses": 0,
|
| 79 |
+
"hit_rate": 0,
|
| 80 |
+
"cache_size": 0
|
| 81 |
+
},
|
| 82 |
+
"layer_13": {
|
| 83 |
+
"hits": 0,
|
| 84 |
+
"misses": 0,
|
| 85 |
+
"hit_rate": 0,
|
| 86 |
+
"cache_size": 0
|
| 87 |
+
},
|
| 88 |
+
"layer_14": {
|
| 89 |
+
"hits": 0,
|
| 90 |
+
"misses": 0,
|
| 91 |
+
"hit_rate": 0,
|
| 92 |
+
"cache_size": 0
|
| 93 |
+
},
|
| 94 |
+
"layer_15": {
|
| 95 |
+
"hits": 0,
|
| 96 |
+
"misses": 0,
|
| 97 |
+
"hit_rate": 0,
|
| 98 |
+
"cache_size": 0
|
| 99 |
+
},
|
| 100 |
+
"layer_16": {
|
| 101 |
+
"hits": 0,
|
| 102 |
+
"misses": 0,
|
| 103 |
+
"hit_rate": 0,
|
| 104 |
+
"cache_size": 0
|
| 105 |
+
},
|
| 106 |
+
"layer_17": {
|
| 107 |
+
"hits": 0,
|
| 108 |
+
"misses": 0,
|
| 109 |
+
"hit_rate": 0,
|
| 110 |
+
"cache_size": 0
|
| 111 |
+
},
|
| 112 |
+
"layer_18": {
|
| 113 |
+
"hits": 0,
|
| 114 |
+
"misses": 0,
|
| 115 |
+
"hit_rate": 0,
|
| 116 |
+
"cache_size": 0
|
| 117 |
+
},
|
| 118 |
+
"layer_19": {
|
| 119 |
+
"hits": 0,
|
| 120 |
+
"misses": 0,
|
| 121 |
+
"hit_rate": 0,
|
| 122 |
+
"cache_size": 0
|
| 123 |
+
},
|
| 124 |
+
"layer_20": {
|
| 125 |
+
"hits": 0,
|
| 126 |
+
"misses": 0,
|
| 127 |
+
"hit_rate": 0,
|
| 128 |
+
"cache_size": 0
|
| 129 |
+
},
|
| 130 |
+
"layer_21": {
|
| 131 |
+
"hits": 0,
|
| 132 |
+
"misses": 0,
|
| 133 |
+
"hit_rate": 0,
|
| 134 |
+
"cache_size": 0
|
| 135 |
+
},
|
| 136 |
+
"layer_22": {
|
| 137 |
+
"hits": 0,
|
| 138 |
+
"misses": 0,
|
| 139 |
+
"hit_rate": 0,
|
| 140 |
+
"cache_size": 0
|
| 141 |
+
},
|
| 142 |
+
"layer_23": {
|
| 143 |
+
"hits": 0,
|
| 144 |
+
"misses": 0,
|
| 145 |
+
"hit_rate": 0,
|
| 146 |
+
"cache_size": 0
|
| 147 |
+
},
|
| 148 |
+
"layer_24": {
|
| 149 |
+
"hits": 0,
|
| 150 |
+
"misses": 0,
|
| 151 |
+
"hit_rate": 0,
|
| 152 |
+
"cache_size": 0
|
| 153 |
+
},
|
| 154 |
+
"layer_25": {
|
| 155 |
+
"hits": 0,
|
| 156 |
+
"misses": 0,
|
| 157 |
+
"hit_rate": 0,
|
| 158 |
+
"cache_size": 0
|
| 159 |
+
},
|
| 160 |
+
"layer_26": {
|
| 161 |
+
"hits": 0,
|
| 162 |
+
"misses": 0,
|
| 163 |
+
"hit_rate": 0,
|
| 164 |
+
"cache_size": 0
|
| 165 |
+
},
|
| 166 |
+
"layer_27": {
|
| 167 |
+
"hits": 0,
|
| 168 |
+
"misses": 0,
|
| 169 |
+
"hit_rate": 0,
|
| 170 |
+
"cache_size": 0
|
| 171 |
+
},
|
| 172 |
+
"layer_28": {
|
| 173 |
+
"hits": 0,
|
| 174 |
+
"misses": 0,
|
| 175 |
+
"hit_rate": 0,
|
| 176 |
+
"cache_size": 0
|
| 177 |
+
}
|
| 178 |
+
}
|
| 179 |
+
}
|