Spaces:
Running on Zero
Running on Zero
File size: 11,724 Bytes
4d88b3c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | import torch
# βββ Model Registry βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# loader_type:
# "multimodal" β AutoModelForMultimodalLM + AutoProcessor (Gemma 4)
# "vision_causal" β AutoModelForCausalLM + AutoProcessor (Gemma 3 vision)
# "causal" β AutoModelForCausalLM + AutoTokenizer (text-only)
MODELS = {
# ββ Gemma 4 βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
"google/gemma-4-E2B-it": {
"name": "Gemma 4 E2B",
"short": "E2B",
"family": "Gemma 4",
"family_color": "#1a73e8",
"params": "2.3B active / 5.1B total",
"params_short": "2.3B",
"context": "128K",
"context_k": 128,
"gpu_size": "large",
"supports_vision": True,
"loader_type": "multimodal",
"torch_dtype": torch.bfloat16,
"description": "Most compact Gemma 4. PLE architecture with image support. Fast and efficient.",
"release_year": 2026,
"license": "Apache 2.0",
"license_open": True,
"vram": "~10 GB",
"lmarena": None,
"architecture": "Transformer + PLE",
"badge": "NEW",
},
"google/gemma-4-E4B-it": {
"name": "Gemma 4 E4B",
"short": "E4B",
"family": "Gemma 4",
"family_color": "#1a73e8",
"params": "4.5B active / 8B total",
"params_short": "4.5B",
"context": "128K",
"context_k": 128,
"gpu_size": "large",
"supports_vision": True,
"loader_type": "multimodal",
"torch_dtype": torch.bfloat16,
"description": "Greater capacity with PLE and Shared KV Cache. Image + text. Great balance.",
"release_year": 2026,
"license": "Apache 2.0",
"license_open": True,
"vram": "~16 GB",
"lmarena": None,
"architecture": "Transformer + PLE",
"badge": "NEW",
},
"google/gemma-4-26B-A4B-it": {
"name": "Gemma 4 26B MoE",
"short": "26B MoE",
"family": "Gemma 4",
"family_color": "#1a73e8",
"params": "4B active / 26B total",
"params_short": "26B MoE",
"context": "256K",
"context_k": 256,
"gpu_size": "large",
"supports_vision": True,
"loader_type": "multimodal",
"torch_dtype": torch.bfloat16,
"description": "Mixture-of-Experts with only 4B active parameters. LMArena ~1441. Image + text.",
"release_year": 2026,
"license": "Apache 2.0",
"license_open": True,
"vram": "~52 GB",
"lmarena": 1441,
"architecture": "MoE Transformer",
"badge": "NEW",
},
"google/gemma-4-31B-it": {
"name": "Gemma 4 31B",
"short": "31B",
"family": "Gemma 4",
"family_color": "#1a73e8",
"params": "31B parameters",
"params_short": "31B",
"context": "256K",
"context_k": 256,
"gpu_size": "xlarge",
"supports_vision": True,
"loader_type": "multimodal",
"torch_dtype": torch.bfloat16,
"description": "Most powerful Gemma 4. Dense Transformer. LMArena ~1452. On par with models 30Γ larger.",
"release_year": 2026,
"license": "Apache 2.0",
"license_open": True,
"vram": "~62 GB",
"lmarena": 1452,
"architecture": "Dense Transformer",
"badge": "FLAGSHIP",
},
# ββ Gemma 3 βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
"google/gemma-3-1b-it": {
"name": "Gemma 3 1B",
"short": "1B",
"family": "Gemma 3",
"family_color": "#137333",
"params": "1B parameters",
"params_short": "1B",
"context": "32K",
"context_k": 32,
"gpu_size": "large",
"supports_vision": False,
"loader_type": "causal",
"torch_dtype": torch.bfloat16,
"description": "Ultra-lightweight. Ideal for edge devices and low-latency tasks. Text only.",
"release_year": 2025,
"license": "Gemma",
"license_open": False,
"vram": "~2 GB",
"lmarena": None,
"architecture": "Transformer",
"badge": None,
},
"google/gemma-3-4b-it": {
"name": "Gemma 3 4B",
"short": "4B",
"family": "Gemma 3",
"family_color": "#137333",
"params": "4B parameters",
"params_short": "4B",
"context": "128K",
"context_k": 128,
"gpu_size": "large",
"supports_vision": True,
"loader_type": "vision_causal",
"torch_dtype": torch.bfloat16,
"description": "Perfect balance between size and capability. Image + text. 128K context.",
"release_year": 2025,
"license": "Gemma",
"license_open": False,
"vram": "~8 GB",
"lmarena": None,
"architecture": "Transformer",
"badge": None,
},
"google/gemma-3-12b-it": {
"name": "Gemma 3 12B",
"short": "12B",
"family": "Gemma 3",
"family_color": "#137333",
"params": "12B parameters",
"params_short": "12B",
"context": "128K",
"context_k": 128,
"gpu_size": "large",
"supports_vision": True,
"loader_type": "vision_causal",
"torch_dtype": torch.bfloat16,
"description": "High-capacity multimodal. Complex reasoning and image analysis.",
"release_year": 2025,
"license": "Gemma",
"license_open": False,
"vram": "~24 GB",
"lmarena": None,
"architecture": "Transformer",
"badge": None,
},
"google/gemma-3-27b-it": {
"name": "Gemma 3 27B",
"short": "27B",
"family": "Gemma 3",
"family_color": "#137333",
"params": "27B parameters",
"params_short": "27B",
"context": "128K",
"context_k": 128,
"gpu_size": "large",
"supports_vision": True,
"loader_type": "vision_causal",
"torch_dtype": torch.bfloat16,
"description": "Most capable Gemma 3. Advanced vision and high-level reasoning.",
"release_year": 2025,
"license": "Gemma",
"license_open": False,
"vram": "~54 GB",
"lmarena": None,
"architecture": "Transformer",
"badge": None,
},
# ββ Gemma 2 βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
"google/gemma-2-2b-it": {
"name": "Gemma 2 2B",
"short": "2B",
"family": "Gemma 2",
"family_color": "#e37400",
"params": "2B parameters",
"params_short": "2B",
"context": "8K",
"context_k": 8,
"gpu_size": "large",
"supports_vision": False,
"loader_type": "causal",
"torch_dtype": torch.bfloat16,
"description": "Fast and efficient. Sliding Window Attention. Text only.",
"release_year": 2024,
"license": "Gemma",
"license_open": False,
"vram": "~4 GB",
"lmarena": None,
"architecture": "Sliding Window Attn",
"badge": None,
},
"google/gemma-2-9b-it": {
"name": "Gemma 2 9B",
"short": "9B",
"family": "Gemma 2",
"family_color": "#e37400",
"params": "9B parameters",
"params_short": "9B",
"context": "8K",
"context_k": 8,
"gpu_size": "large",
"supports_vision": False,
"loader_type": "causal",
"torch_dtype": torch.bfloat16,
"description": "Solid text performance. Efficient architecture with sliding window.",
"release_year": 2024,
"license": "Gemma",
"license_open": False,
"vram": "~18 GB",
"lmarena": None,
"architecture": "Sliding Window Attn",
"badge": None,
},
"google/gemma-2-27b-it": {
"name": "Gemma 2 27B",
"short": "27B",
"family": "Gemma 2",
"family_color": "#e37400",
"params": "27B parameters",
"params_short": "27B",
"context": "8K",
"context_k": 8,
"gpu_size": "large",
"supports_vision": False,
"loader_type": "causal",
"torch_dtype": torch.bfloat16,
"description": "Largest Gemma 2. High performance on complex text tasks.",
"release_year": 2024,
"license": "Gemma",
"license_open": False,
"vram": "~54 GB",
"lmarena": None,
"architecture": "Sliding Window Attn",
"badge": None,
},
# ββ Gemma 1 βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
"google/gemma-1.1-2b-it": {
"name": "Gemma 1.1 2B",
"short": "2B",
"family": "Gemma 1",
"family_color": "#c5221f",
"params": "2B parameters",
"params_short": "2B",
"context": "8K",
"context_k": 8,
"gpu_size": "large",
"supports_vision": False,
"loader_type": "causal",
"torch_dtype": torch.float16,
"description": "The original foundation model. Where it all began. Text only.",
"release_year": 2024,
"license": "Gemma",
"license_open": False,
"vram": "~4 GB",
"lmarena": None,
"architecture": "Transformer",
"badge": None,
},
"google/gemma-1.1-7b-it": {
"name": "Gemma 1.1 7B",
"short": "7B",
"family": "Gemma 1",
"family_color": "#c5221f",
"params": "7B parameters",
"params_short": "7B",
"context": "8K",
"context_k": 8,
"gpu_size": "large",
"supports_vision": False,
"loader_type": "causal",
"torch_dtype": torch.float16,
"description": "The original 7B. The historical base of the entire Gemma family.",
"release_year": 2024,
"license": "Gemma",
"license_open": False,
"vram": "~14 GB",
"lmarena": None,
"architecture": "Transformer",
"badge": None,
},
}
FAMILIES = {
"Gemma 4": {
"color": "#1a73e8",
"bg": "#e8f0fe",
"year": 2026,
"description": "The newest generation. Full multimodal (image + text). Apache 2.0. Just launched!",
"icon": "β¦",
"new": True,
},
"Gemma 3": {
"color": "#137333",
"bg": "#e6f4ea",
"year": 2025,
"description": "Second generation with vision. Long contexts up to 128K tokens.",
"icon": "β",
"new": False,
},
"Gemma 2": {
"color": "#e37400",
"bg": "#fef7e0",
"year": 2024,
"description": "Optimized for text with Sliding Window Attention. Efficient and fast.",
"icon": "β",
"new": False,
},
"Gemma 1": {
"color": "#c5221f",
"bg": "#fce8e6",
"year": 2024,
"description": "The original foundation models from Google DeepMind.",
"icon": "β",
"new": False,
},
}
def get_models_by_family(family: str):
return {k: v for k, v in MODELS.items() if v["family"] == family}
|