Skip to content

Commit

Permalink
Fix README example for large files >2gb
Browse files Browse the repository at this point in the history
  • Loading branch information
platypii committed Mar 27, 2024
1 parent 4e01e17 commit bcb66ca
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ If you're in a node.js environment, you can load a .gguf file with the following
const { ggufMetadata } = await import('hyllama')
const fs = await import('fs')

const buffer = fs.readFileSync('example.gguf')
const arrayBuffer = new Uint8Array(buffer).buffer
const { metadata, tensorInfos } = ggufMetadata(arrayBuffer)
// Read first 1mb of gguf file
const fd = fs.openSync('example.gguf', 'r')
const buffer = new Uint8Array(1000000)
fs.readSync(fd, buffer, 0, 1000000, 0)
fs.closeSync(fd)

// Parse metadata and tensor info
const { metadata, tensorInfos } = ggufMetadata(buffer.buffer)
```

If you're in a browser environment, you'll probably get .gguf file data from either a drag-and-dropped file from the user, or downloaded from the web.
Expand Down

0 comments on commit bcb66ca

Please sign in to comment.