Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GGUF parser: support big-endian files #545

Merged
merged 3 commits into from Mar 13, 2024
Merged

GGUF parser: support big-endian files #545

merged 3 commits into from Mar 13, 2024

Conversation

julien-c
Copy link
Member

The important snippet is:

const [littleEndian, version] = (() => {
	/// https://github.com/ggerganov/llama.cpp/issues/3957
	/// Assume this code is always running on little-endian
	/// but wants to be able to parse both endianness
	const version = r.view.getUint32(4, true);
	if (version & 65535) {
		return [true, version];
	} else {
		return [false, r.view.getUint32(4, false)];
	}
})();

from ggerganov/llama.cpp#3957 and thanks to @ggerganov comment

Comment on lines +234 to +244
const [littleEndian, version] = (() => {
/// https://github.com/ggerganov/llama.cpp/issues/3957
/// Assume this code is always running on little-endian
/// but wants to be able to parse both endianness
const version = r.view.getUint32(4, true);
if (version & 65535) {
return [true, version];
} else {
return [false, r.view.getUint32(4, false)];
}
})();
Copy link
Member Author

Choose a reason for hiding this comment

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

this is the important part

mishig25

This comment was marked as outdated.

Copy link
Collaborator

@mishig25 mishig25 left a comment

Choose a reason for hiding this comment

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

lgtm!

@julien-c julien-c merged commit 12d28d9 into gguf Mar 13, 2024
2 checks passed
@julien-c julien-c deleted the gguf-big-endian branch March 13, 2024 08:34
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.

None yet

3 participants