[PR #10245] [CLOSED] fs/ggml: support for big-endian model file parsing #23731

Closed
opened 2026-04-19 17:10:35 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/10245
Author: @taronaeo
Created: 4/12/2025
Status: Closed

Base: mainHead: main


📝 Commits (5)

  • 405f373 model: add big-endian model read support
  • d955632 model: clean up comments and debug information
  • 6b64cd4 model: remove additional debug statement
  • 4983d31 chore: remove testing modelfile
  • 7fa2e2f model: remove unnecessary code, change to LE read

📊 Changes

2 files changed (+45 additions, -7 deletions)

View changed files

📝 fs/ggml/ggml.go (+45 -3)
📝 fs/ggml/gguf.go (+0 -4)

📄 Description

At current, Llama.cpp supports loading of Big-Endian GGUF model files without any issues and Ollama has yet to receive a patch that supports the same frictionless behaviour.

This PR changes the GGUF/GGML parsing behaviour to support Big-Endian model file loading in the following ways:

  1. Parsing of model file is now determined by the Model File Endianness via the byteordering of the version byte.
  2. Added Host Endianness detection via the byte-ordering of the magic byte string.
  3. Byteswapping the GGUF/GGML version byte when necessary to correctly read v3/2/1.

This PR has been verified to work on both Little-Endian and Big-Endian machines. The test machines are listed below:

  1. Little-Endian Machine: MacBook Air M3
  2. Big-Endian Machine: IBM z15 Mainframe

Please review this pull request and consider merging into the main repository. Thank you!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/10245 **Author:** [@taronaeo](https://github.com/taronaeo) **Created:** 4/12/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (5) - [`405f373`](https://github.com/ollama/ollama/commit/405f37318d3ffb1a65b8ad4ceed3e277778b5c12) model: add big-endian model read support - [`d955632`](https://github.com/ollama/ollama/commit/d9556323407d4fbad6b295915cfcf921ba4b8c23) model: clean up comments and debug information - [`6b64cd4`](https://github.com/ollama/ollama/commit/6b64cd401eca75f027b81b5b26329d325a08b3fb) model: remove additional debug statement - [`4983d31`](https://github.com/ollama/ollama/commit/4983d3164fef2f0b792254c0f537c2e6efd21e30) chore: remove testing modelfile - [`7fa2e2f`](https://github.com/ollama/ollama/commit/7fa2e2f9db68e22c2ea2e7b8175a0dbcd00d362b) model: remove unnecessary code, change to LE read ### 📊 Changes **2 files changed** (+45 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `fs/ggml/ggml.go` (+45 -3) 📝 `fs/ggml/gguf.go` (+0 -4) </details> ### 📄 Description At current, Llama.cpp supports loading of Big-Endian GGUF model files without any issues and Ollama has yet to receive a patch that supports the same frictionless behaviour. This PR changes the GGUF/GGML parsing behaviour to support Big-Endian model file loading in the following ways: 1. Parsing of model file is now determined by the Model File Endianness via the byteordering of the version byte. 2. Added Host Endianness detection via the byte-ordering of the magic byte string. 3. Byteswapping the GGUF/GGML version byte when necessary to correctly read v3/2/1. This PR has been verified to work on both Little-Endian and Big-Endian machines. The test machines are listed below: 1. Little-Endian Machine: MacBook Air M3 2. Big-Endian Machine: IBM z15 Mainframe Please review this pull request and consider merging into the main repository. Thank you! --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-19 17:10:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#23731