bridge.models.muse_spark_open.modeling_muse_spark_open.muse_spark_open_transformers_patch#

HF export-only causal LM for standalone Muse Spark Open text checkpoints.

Transformers ships the Muse Spark Open language model (MuseSparkTextModel) but no text-only causal LM. This class pairs it with the VL checkpoint’s output head, including its output multiplier and tanh soft-cap, under the same parameter names (model.*, lm_head.*). This file is copied into text exports and depends only on Torch and Transformers, not on Megatron-Bridge.

Module Contents#

Classes#

MuseSparkForCausalLM

HF language-only entrypoint with the complete Muse Spark Open output head.

API#

class bridge.models.muse_spark_open.modeling_muse_spark_open.muse_spark_open_transformers_patch.MuseSparkForCausalLM(
config: transformers.models.muse_spark.configuration_muse_spark.MuseSparkTextConfig,
)#

Bases: transformers.models.muse_spark.modeling_muse_spark.MuseSparkPreTrainedModel, transformers.generation.GenerationMixin

HF language-only entrypoint with the complete Muse Spark Open output head.

Initialization

config_class#

None

config: transformers.models.muse_spark.configuration_muse_spark.MuseSparkTextConfig#

None

_no_split_modules#

[‘MuseSparkTextDecoderLayer’]

classmethod _can_set_experts_implementation() → bool#
forward(
input_ids: torch.LongTensor | None = None,
attention_mask: torch.Tensor | None = None,
position_ids: torch.LongTensor | None = None,
past_key_values=None,
inputs_embeds: torch.FloatTensor | None = None,
labels: torch.LongTensor | None = None,
use_cache: bool | None = None,
logits_to_keep: int | torch.Tensor = 0,
**kwargs,
) → transformers.modeling_outputs.MoeCausalLMOutputWithPast#

Match the VL model’s head: T * tanh(lm_head(h) * output_multiplier / T).