Skip to content

Commit

Permalink
Support for 64 bit values
Browse files Browse the repository at this point in the history
  • Loading branch information
platypii committed Apr 19, 2024
1 parent 582674d commit c622c92
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
"typecheck": "tsc"
},
"devDependencies": {
"@vitest/coverage-v8": "1.4.0",
"@vitest/coverage-v8": "1.5.0",
"eslint": "8.57.0",
"eslint-plugin-import": "2.29.1",
"eslint-plugin-jsdoc": "48.2.1",
"eslint-plugin-jsdoc": "48.2.3",
"http-server": "14.1.1",
"typescript": "5.4.3",
"vitest": "1.4.0"
"typescript": "5.4.5",
"vitest": "1.5.0"
}
}
9 changes: 7 additions & 2 deletions src/hyllama.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,19 @@ export function ggufMetadata(arrayBuffer) {
}
return { value: arrayValues, byteLength: arrayOffset }
}
case 10: // UINT64
return { value: view.getBigUint64(offset, true), byteLength: 8 }
case 11: // INT64
return { value: view.getBigInt64(offset, true), byteLength: 8 }
case 12: // FLOAT64
return { value: view.getFloat64(offset, true), byteLength: 8 }
default:
throw new Error('Unsupported metadata type: ' + type)
}
}

// read the header
const magic = String.fromCharCode(view.getUint8(0), view.getUint8(1), view.getUint8(2), view.getUint8(3))
if (magic !== 'GGUF') throw new Error('Not a valid GGUF file')
if (view.getUint32(0) !== 1195857222) throw new Error('Not a valid GGUF file') // "GGUF" header
const version = view.getUint32(4, true)
const tensorCount = view.getBigUint64(8, true)
const metadataKVCount = view.getBigUint64(16, true)
Expand Down

0 comments on commit c622c92

Please sign in to comment.