Skip to content

Support Gemma 4#92

Merged
tattn merged 3 commits intomainfrom
feature/gemma4
Apr 25, 2026
Merged

Support Gemma 4#92
tattn merged 3 commits intomainfrom
feature/gemma4

Conversation

@tattn
Copy link
Copy Markdown
Owner

@tattn tattn commented Apr 20, 2026

Support Gemma 4

  • Added symlinks for new headers: unicode.h, mtmd-debug.h, jinja, nlohmann, and module.modulemap.
  • Updated llama.cpp submodule to a new commit.
  • Enhanced utils.h and utils.cpp with new functions for handling chat parameters and tool inputs.
  • Removed obsolete minja symlink.
  • Introduced new mtmd-image files for improved image handling.
  • Updated Context.swift and Utility.swift for better integration with MLX.
  • Modified glob patterns in Globs.swift to include new jinja files.
  • Removed outdated LlamaToolCallParserTests and refactored LlamaToolTests for improved functionality.
  • Added new tests for message processing and tool call parsing.
  • Updated update_dependencies.sh to verify symlink integrity after submodule updates.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the llama.cpp dependency to version b8851 and introduces support for Gemma 4 models. Key architectural changes include refactoring the Llama tool-calling parser to use a stateful C++ PEG parser context and updating the MLX client to use MLXHuggingFace for tokenizer loading. Feedback focuses on a high-severity thread-safety issue where the shared PEG parser arena in LlamaClient could cause race conditions during concurrent generations, as well as a recommendation to use stricter versioning for the swift-jinja dependency to avoid breaking changes.

Repository owner deleted a comment from gemini-code-assist Bot Apr 20, 2026
Repository owner deleted a comment from gemini-code-assist Bot Apr 20, 2026
@tattn tattn force-pushed the feature/gemma4 branch 7 times, most recently from 8d6a2b4 to 559f51b Compare April 22, 2026 17:22
tattn added 3 commits April 25, 2026 12:33
- Added symlinks for new headers: unicode.h, mtmd-debug.h, jinja, nlohmann, and module.modulemap.
- Updated llama.cpp submodule to a new commit.
- Enhanced utils.h and utils.cpp with new functions for handling chat parameters and tool inputs.
- Removed obsolete minja symlink.
- Introduced new mtmd-image files for improved image handling.
- Updated Context.swift and Utility.swift for better integration with MLX.
- Modified glob patterns in Globs.swift to include new jinja files.
- Removed outdated LlamaToolCallParserTests and refactored LlamaToolTests for improved functionality.
- Added new tests for message processing and tool call parsing.
- Updated update_dependencies.sh to verify symlink integrity after submodule updates.
@tattn
Copy link
Copy Markdown
Owner Author

tattn commented Apr 25, 2026

The tests pass in my local environment, but for some reason they seem to fail on GitHub Actions.
I feel like this might be resolved by adjusting the model used, the context size, or something similar.

I would like to investigate this issue separately. Also, if anyone can fix it, please feel free to send a PR.

@tattn tattn marked this pull request as ready for review April 25, 2026 04:06
@tattn tattn merged commit ee2dbb9 into main Apr 25, 2026
5 of 7 checks passed
@tattn tattn deleted the feature/gemma4 branch April 25, 2026 04:06
@Kyle17888
Copy link
Copy Markdown

Support Gemma 4

  • Added symlinks for new headers: unicode.h, mtmd-debug.h, jinja, nlohmann, and module.modulemap.
  • Updated llama.cpp submodule to a new commit.
  • Enhanced utils.h and utils.cpp with new functions for handling chat parameters and tool inputs.
  • Removed obsolete minja symlink.
  • Introduced new mtmd-image files for improved image handling.
  • Updated Context.swift and Utility.swift for better integration with MLX.
  • Modified glob patterns in Globs.swift to include new jinja files.
  • Removed outdated LlamaToolCallParserTests and refactored LlamaToolTests for improved functionality.
  • Added new tests for message processing and tool call parsing.
  • Updated update_dependencies.sh to verify symlink integrity after submodule updates.

Wow, that was fast! 🚀 Thanks for the quick turnaround on supporting Gemma 4. Amazing work!

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.

2 participants