mirror of
https://github.com/dogkeeper886/ollama37.git
synced 2025-12-12 00:37:04 +00:00
Revert "Merge pull request #4938 from ollama/mxyng/fix-byte-order"
This reverts commitf5f245cc15, reversing changes made to94d37fdcae. this change broke gguf v2 which is incorrectly detected as big endian
This commit is contained in:
15
llm/gguf.go
15
llm/gguf.go
@@ -36,23 +36,10 @@ func (c *containerGGUF) Name() string {
|
||||
}
|
||||
|
||||
func (c *containerGGUF) Decode(rs io.ReadSeeker) (model, error) {
|
||||
var version [4]byte
|
||||
if err := binary.Read(rs, c.ByteOrder, &version); err != nil {
|
||||
if err := binary.Read(rs, c.ByteOrder, &c.Version); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// if the lower 16 bits are 0, the byte order is probably wrong
|
||||
if c.ByteOrder.Uint32(version[:])&1<<4 == 0 {
|
||||
switch c.ByteOrder {
|
||||
case binary.LittleEndian:
|
||||
c.ByteOrder = binary.BigEndian
|
||||
case binary.BigEndian:
|
||||
c.ByteOrder = binary.LittleEndian
|
||||
}
|
||||
}
|
||||
|
||||
c.Version = c.ByteOrder.Uint32(version[:])
|
||||
|
||||
var err error
|
||||
switch c.Version {
|
||||
case 1:
|
||||
|
||||
Reference in New Issue
Block a user