vllm.model_executor.models.muse_glimmer ¶
Inference-only MuseGlimmer multimodal model for vLLM.
Native port of the MuseGlimmer text decoder (MuseGlimmerForCausalLM). The text stack is a Gemma2 derivative with the following MuseGlimmer-specific deltas, each of which is handled explicitly here:
- SiLU-gated MLP (
hidden_activation="silu"), not Gemma's gelu-tanh. - Scaleless RMSNorm on the token embeddings (no sqrt(hidden) scaling).
- Per-layer sandwich RMSNorms with a baked
+1weight offset (x * (1 + w)), matching Gemma, but with distinct eps for the pre/post norms (rms_norm_epsvspost_norm_eps). - QK-norm (weightless, fp32) applied before RoPE, followed by a query pre-scale of
qk_scale_factor / sqrt(head_dim). - A per-head sigmoid attention output gate.
- iRoPE layout: NoPE layers use full attention, RoPE layers use sliding window attention. RoPE is applied NEOX-style (
is_neox_style=True): the HF converter (convert_muse_glimmer_weights_to_hf.py, 20260806+) permutes q/k into the half-split (NEOX) layout via_permute_for_ropeso they pair withrotate_half— matching the reference's interleaved rotation on the native (unpermuted) weights. Serving the permuted HF weights withis_neox_style=Falsescrambles q/k and causes token-repetition collapse. - Final logits are pre-scaled by
output_multiplierand then tanh soft-capped atfinal_logit_softcapping. - Untied lm_head.
The vision path supports variable-resolution images and temporally patched videos. It mirrors the checkpoint's native vision encoder, including sparse block attention, 2-D RoPE, pixel-shuffle downsampling, and the two-layer adapter/projection stack.
Classes:
-
MuseGlimmerForCausalLM– -
MuseGlimmerImagePixelInputs–Batched variable-resolution image inputs.
-
MuseGlimmerRMSNorm–RMSNorm mirroring HF MuseGlimmer exactly (fp32 compute, cast at the end).
-
MuseGlimmerVideoPixelInputs–Batched variable-length, variable-resolution video inputs.
MuseGlimmerForCausalLM ¶
Bases: Module, SupportsLoRA, SupportsMultiModal, SupportsPP, SupportsEagle3
Methods:
-
get_mm_mapping–Get the module prefix in multimodal models
Source code in vllm/model_executor/models/muse_glimmer.py
1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 | |
get_mm_mapping() ¶
Get the module prefix in multimodal models
Source code in vllm/model_executor/models/muse_glimmer.py
MuseGlimmerImagePixelInputs ¶
Bases: TensorSchema
Batched variable-resolution image inputs.
Source code in vllm/model_executor/models/muse_glimmer.py
MuseGlimmerRMSNorm ¶
Bases: Module
RMSNorm mirroring HF MuseGlimmer exactly (fp32 compute, cast at the end).
normed = _norm(x.float()) * (w.float() + weight_offset) cast back to the input dtype. When with_scale is False the layer is weightless (used for QK-norm and the token-embedding norm).
Source code in vllm/model_executor/models/muse_glimmer.py
MuseGlimmerVideoPixelInputs ¶
Bases: TensorSchema
Batched variable-length, variable-resolution video inputs.
Source code in vllm/model_executor/models/muse_glimmer.py
_muse_glimmer_query_prescale(config) ¶
Post-QK-norm query pre-scale (scale_query_by), normalized across the two config schemas so the net query scaling matches the native reference.
HF native modeling computes scale_query_by = qk_scale_factor / sqrt(head_dim) where the NATIVE qk_scale_factor is the raw params.json value (~43.784). The modular HF text_config PRE-FOLDS the 1/sqrt(head_dim) factor and ships qk_scale_factor = 43.784 / sqrt(128) = 3.87 already, expecting it applied directly. Both must yield the SAME scale_query_by (~3.87), then softmax uses scaling = head_dim**-0.5.
Precedence
- explicit
scale_query_by(already the final factor) -> use as-is. - else derive from
qk_scale_factor: - if it is already the folded value (
~= qk_scale_factor/sqrt(hd)is NOT what we want; detect the native form and divide) — we decide by magnitude: the native raw value isfolded * sqrt(head_dim). Ifqk_scale_factoris close tofolded_expected * sqrt(hd)we treat it as native and divide; otherwise it is already folded, use directly.
Source code in vllm/model_executor/models/muse_glimmer.py
_muse_glimmer_use_attn_output_gate(config) ¶
Whether the per-head sigmoid attention output gate is applied. MuseGlimmer ALWAYS applies it; the modular HF text_config omits use_attn_output_gate (reads as None). Missing/None -> True; only explicit False disables.
Source code in vllm/model_executor/models/muse_glimmer.py
_muse_glimmer_use_qk_norm(config) ¶
Whether QK-norm is applied. MuseGlimmer ALWAYS applies QK-norm; the modular HF text_config schema simply omits use_qk_norm (reads as None). Treat a missing/None flag as True — only an explicit False disables it.
Source code in vllm/model_executor/models/muse_glimmer.py
_text_config(config) ¶
MuseGlimmer checkpoints may nest the text config under text_config (multimodal MuseGlimmerConfig) or expose it directly (MuseGlimmerTextConfig).