Skip to content

fixed broken documentation links - #5

Closed
GO-4Code wants to merge 1 commit into
ml-explore:mainfrom
GO-4Code:GO-4Code-patch-1
Closed

GO-4Code wants to merge 1 commit into
ml-explore:mainfrom
GO-4Code:GO-4Code-patch-1

Conversation

@GO-4Code

Copy link
Copy Markdown

fixed all documentation links to point to the correct mlx-swift-examples.

  • fixed broken links referencing mlx-swift-lm (404)
  • verified all new links resolve correctly on swift package index

@GO-4Code GO-4Code closed this Nov 13, 2025
antmanler added a commit to platx-ai/mlx-swift-lm that referenced this pull request Apr 14, 2026
Adds Gemma 4 audio input support on top of the text + vision + MoE
implementation from ml-explore#180.

New components:

- Gemma4AudioConfiguration — decodes config.json's audio_config block,
  optional so models without audio still load unchanged.
- Audio encoder (~700 lines) — USM-style Conformer with:
  * SubSampleConvProjection (2x Conv2d, 4x temporal reduction)
  * 12 ConformerBlock layers (FFW -> attention -> light conv1d -> FFW)
  * Relative positional embedding with sinusoidal projection
  * Chunked local self-attention with logit softcap
  * Cumulative group norm for streaming compatibility
- Gemma4 model integration:
  * audio_tower and embed_audio modules, conditional on audio config
  * getInputEmbeddings extended with audioFeatures/audioMask, scatters
    encoder output into <|audio|> placeholder positions
  * prepare() routes LMInput.audio through the new path
  * sanitize() preserves audio weights only when audio is configured
- Processor integration:
  * Gemma4Processor.prepare extracts mel features, computes the audio
    token count from actual subsampling math (not a duration estimate),
    injects <|audio|> placeholders into the prompt, and inverts the mel
    mask to True=padding convention expected by the encoder
  * Gemma4ProcessorConfiguration gains audioTokenId with default 258881
    for models whose processor_config.json omits it

Correctness fixes preserved from 668347f:

1. FFT 0.5 scaling (in Gemma4AudioFeatureExtractor, separate commit)
2. Audio mask polarity inversion (Processor.prepare)
3. Depthwise conv1d groups=hiddenSize in Gemma4ConformerLightConv1d
4. relPosInvTimescales stored as [Float] not MLXArray to avoid MLX
   Module weight lookup
5. Audio token count from actual mel subsampling, not duration
6. audioTokenId default 258881 when absent
7. Audio placeholder injection into chat template prompt

Fix ml-explore#5 (EOS [1, 106, 50]) lives in the caller's generation loop, not
in the library.

File size: Gemma4.swift 1910 -> 2740 lines.
Build: `swift build` passes on upstream/main base.
antmanler added a commit to platx-ai/mlx-swift-lm that referenced this pull request Apr 15, 2026
Adds Gemma 4 audio input support on top of the text + vision + MoE
implementation from ml-explore#180.

New components:

- Gemma4AudioConfiguration — decodes config.json's audio_config block,
  optional so models without audio still load unchanged.
- Audio encoder (~700 lines) — USM-style Conformer with:
  * SubSampleConvProjection (2x Conv2d, 4x temporal reduction)
  * 12 ConformerBlock layers (FFW -> attention -> light conv1d -> FFW)
  * Relative positional embedding with sinusoidal projection
  * Chunked local self-attention with logit softcap
  * Cumulative group norm for streaming compatibility
- Gemma4 model integration:
  * audio_tower and embed_audio modules, conditional on audio config
  * getInputEmbeddings extended with audioFeatures/audioMask, scatters
    encoder output into <|audio|> placeholder positions
  * prepare() routes LMInput.audio through the new path
  * sanitize() preserves audio weights only when audio is configured
- Processor integration:
  * Gemma4Processor.prepare extracts mel features, computes the audio
    token count from actual subsampling math (not a duration estimate),
    injects <|audio|> placeholders into the prompt, and inverts the mel
    mask to True=padding convention expected by the encoder
  * Gemma4ProcessorConfiguration gains audioTokenId with default 258881
    for models whose processor_config.json omits it

Correctness fixes preserved from 668347f:

1. FFT 0.5 scaling (in Gemma4AudioFeatureExtractor, separate commit)
2. Audio mask polarity inversion (Processor.prepare)
3. Depthwise conv1d groups=hiddenSize in Gemma4ConformerLightConv1d
4. relPosInvTimescales stored as [Float] not MLXArray to avoid MLX
   Module weight lookup
5. Audio token count from actual mel subsampling, not duration
6. audioTokenId default 258881 when absent
7. Audio placeholder injection into chat template prompt

Fix ml-explore#5 (EOS [1, 106, 50]) lives in the caller's generation loop, not
in the library.

File size: Gemma4.swift 1910 -> 2740 lines.
Build: `swift build` passes on upstream/main base.
antmanler added a commit to platx-ai/mlx-swift-lm that referenced this pull request Apr 16, 2026
Adds Gemma 4 audio input support on top of the text + vision + MoE
implementation from ml-explore#180.

New components:

- Gemma4AudioConfiguration — decodes config.json's audio_config block,
  optional so models without audio still load unchanged.
- Audio encoder (~700 lines) — USM-style Conformer with:
  * SubSampleConvProjection (2x Conv2d, 4x temporal reduction)
  * 12 ConformerBlock layers (FFW -> attention -> light conv1d -> FFW)
  * Relative positional embedding with sinusoidal projection
  * Chunked local self-attention with logit softcap
  * Cumulative group norm for streaming compatibility
- Gemma4 model integration:
  * audio_tower and embed_audio modules, conditional on audio config
  * getInputEmbeddings extended with audioFeatures/audioMask, scatters
    encoder output into <|audio|> placeholder positions
  * prepare() routes LMInput.audio through the new path
  * sanitize() preserves audio weights only when audio is configured
- Processor integration:
  * Gemma4Processor.prepare extracts mel features, computes the audio
    token count from actual subsampling math (not a duration estimate),
    injects <|audio|> placeholders into the prompt, and inverts the mel
    mask to True=padding convention expected by the encoder
  * Gemma4ProcessorConfiguration gains audioTokenId with default 258881
    for models whose processor_config.json omits it

Correctness fixes preserved from 668347f:

1. FFT 0.5 scaling (in Gemma4AudioFeatureExtractor, separate commit)
2. Audio mask polarity inversion (Processor.prepare)
3. Depthwise conv1d groups=hiddenSize in Gemma4ConformerLightConv1d
4. relPosInvTimescales stored as [Float] not MLXArray to avoid MLX
   Module weight lookup
5. Audio token count from actual mel subsampling, not duration
6. audioTokenId default 258881 when absent
7. Audio placeholder injection into chat template prompt

Fix ml-explore#5 (EOS [1, 106, 50]) lives in the caller's generation loop, not
in the library.

File size: Gemma4.swift 1910 -> 2740 lines.
Build: `swift build` passes on upstream/main base.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant