feat: `gemma4` model architecture
Issue description
Gemma 4 E4B model loading fails
Expected Behavior
The loading of the model succeeds.
Actual Behavior
I am trying to load this model but it fails.
Here are the logs: error_logs.rtf
Steps to reproduce
Try to load this model using node-llama-cpp version 3.18.1
My Environment
| Dependency | Version |
|---|---|
| Operating System | macOS 24.3.0 (arm64) |
| CPU | Apple M4 Pro |
| Node.js version | 22.21.1 |
| Typescript version | 5.9.3 |
node-llama-cpp version |
3.18.1 |
npx --yes node-llama-cpp inspect gpu output:
Result of running `npx --yes node-llama-cpp inspect gpu`
Additional Context
No response
Relevant Features Used
- [ ] Metal support
- [ ] CUDA support
- [ ] Vulkan support
- [ ] Grammar
- [ ] Function calling
Are you willing to resolve this issue by submitting a Pull Request?
No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
@ittaboba Same issue here. I used the command below as a workaround for now. Just sharing in case it helps!
npx node-llama-cpp source download --release b8808
Any progress on this one?
@sweetpalma I'm actively working on it in #591, currently stabilizing it as it's going to be a significant release
@giladgd thank you very much. Honestly, I'm surprised by the latest Gemma capabilities, and very eager to use within my project.
Just sharing what worked for me, I built from source with version b8678 (npx node-llama-cpp source build).
- The default version didn't support Gemma 4
- And the latest versions gave me compiler errors
→ So b8678 was the only version that compiled perfectly and loaded the models without any issues.
Just sharing what worked for me, I built from source with version b8678 (
npx node-llama-cpp source build).
- The default version didn't support Gemma 4
- And the latest versions gave me compiler errors
→ So b8678 was the only version that compiled perfectly and loaded the models without any issues.
To me it keeps failing with the error:
-- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.9/include (found version "12.9.86") -- CUDA Toolkit found CMake Error at C:/Program Files/CMake/share/cmake-4.2/Modules/CMakeDetermineCompilerId.cmake:676 (message): No CUDA toolset found.
Just sharing what worked for me, I built from source with version b8678 (
npx node-llama-cpp source build).
- The default version didn't support Gemma 4
- And the latest versions gave me compiler errors
→ So b8678 was the only version that compiled perfectly and loaded the models without any issues.
To me it keeps failing with the error:
-- Found CUDAToolkit: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.9/include (found version "12.9.86") -- CUDA Toolkit found CMake Error at C:/Program Files/CMake/share/cmake-4.2/Modules/CMakeDetermineCompilerId.cmake:676 (message): No CUDA toolset found.
@onzag That error is a VS/CUDA toolchain setup issue, unrelated to b8678 itself - CMake can't find the CUDA MSBuild toolset.
Fix: copy the files from CUDA\v12.9\extras\visual_studio_integration\MSBuildExtensions\ into your VS's MSBuild\Microsoft\VC\<vc_version>\BuildCustomizations\ folder, or just reinstall CUDA Toolkit with VS already installed.
That should let CMake pick up the CUDA toolset properly.
:tada: This issue has been resolved in version 3.19.0 :tada:
The release is available on:
v3.19.0- npm package (@latest dist-tag)
- GitHub release
v3.19.0
Your semantic-release bot :package::rocket: