Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a GGUF parser that works on remotely hosted files (over HTTP range re…
…quests) (#540) GGUF is the new single-file weights format that's been taking the Hub by storm... <img width="476" alt="image" src="https://github.com/huggingface/huggingface.js/assets/326577/946b3a6c-6392-46fd-967f-3ea74412ac7d"> ## Spec https://github.com/ggerganov/ggml/blob/master/docs/gguf.md Reference implementation (Python): https://github.com/ggerganov/llama.cpp/blob/master/gguf-py/gguf/gguf_reader.py ## Acknowledgements & Inspirations - https://github.com/hyparam/hyllama by @platypii (MIT license) - https://github.com/ahoylabs/gguf.js by @biw @dkogut1996 @spencekim (MIT license) - might also be of interest to: @yagil --------- Co-authored-by: Mishig <[email protected]> Co-authored-by: Mishig Davaadorj <[email protected]>
- Loading branch information
1 parent
ce98503
commit 7359058
Showing
20 changed files
with
703 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: GGUF - Version and Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
newversion: | ||
type: choice | ||
description: "Semantic Version Bump Type" | ||
default: patch | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
|
||
concurrency: | ||
group: "push-to-main" | ||
|
||
defaults: | ||
run: | ||
working-directory: packages/gguf | ||
|
||
jobs: | ||
version_and_release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
# Needed to push the tag and the commit on the main branch, otherwise we get: | ||
# > Run git push --follow-tags | ||
# remote: error: GH006: Protected branch update failed for refs/heads/main. | ||
# remote: error: Changes must be made through a pull request. Required status check "lint" is expected. | ||
token: ${{ secrets.BOT_ACCESS_TOKEN }} | ||
- run: corepack enable | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20" | ||
cache: "pnpm" | ||
cache-dependency-path: | | ||
packages/gguf/pnpm-lock.yaml | ||
# setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED | ||
registry-url: "https://registry.npmjs.org" | ||
- run: pnpm install | ||
- run: git config --global user.name machineuser | ||
- run: git config --global user.email [email protected] | ||
- run: | | ||
PACKAGE_VERSION=$(node -p "require('./package.json').version") | ||
BUMPED_VERSION=$(node -p "require('semver').inc('$PACKAGE_VERSION', '${{ github.event.inputs.newversion }}')") | ||
# Update package.json with the new version | ||
node -e "const fs = require('fs'); const package = JSON.parse(fs.readFileSync('./package.json')); package.version = '$BUMPED_VERSION'; fs.writeFileSync('./package.json', JSON.stringify(package, null, '\t') + '\n');" | ||
git commit . -m "🔖 @hugginface/gguf $BUMPED_VERSION" | ||
git tag "gguf-v$BUMPED_VERSION" | ||
- run: pnpm publish --no-git-checks . | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- run: git pull --rebase && git push --follow-tags | ||
# hack - reuse actions/setup-node@v3 just to set a new registry | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: "20" | ||
registry-url: "https://npm.pkg.github.com" | ||
- run: pnpm publish --no-git-checks . | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pnpm-lock.yaml | ||
# In order to avoid code samples to have tabs, they don't display well on npm | ||
README.md | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# `@huggingface/gguf` | ||
|
||
A GGUF parser that works on remotely hosted files. | ||
|
||
## Spec | ||
|
||
https://github.com/ggerganov/ggml/blob/master/docs/gguf.md | ||
|
||
Reference implementation (Python): https://github.com/ggerganov/llama.cpp/blob/master/gguf-py/gguf/gguf_reader.py | ||
|
||
## Acknowledgements & Inspirations | ||
|
||
- https://github.com/hyparam/hyllama by @platypii (MIT license) | ||
- https://github.com/ahoylabs/gguf.js by @biw @dkogut1996 @spencekim (MIT license) | ||
|
||
🔥❤️ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{ | ||
"name": "@huggingface/gguf", | ||
"packageManager": "[email protected]", | ||
"version": "0.0.1", | ||
"description": "a GGUF parser that works on remotely hosted files", | ||
"repository": "https://github.com/huggingface/huggingface.js.git", | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"main": "./dist/index.js", | ||
"module": "./dist/index.mjs", | ||
"types": "./dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"require": "./dist/index.js", | ||
"import": "./dist/index.mjs" | ||
} | ||
}, | ||
"browser": { | ||
"./dist/index.js": "./dist/browser/index.js", | ||
"./dist/index.mjs": "./dist/browser/index.mjs" | ||
}, | ||
"engines": { | ||
"node": ">=20" | ||
}, | ||
"source": "index.ts", | ||
"scripts": { | ||
"lint": "eslint --quiet --fix --ext .cjs,.ts .", | ||
"lint:check": "eslint --ext .cjs,.ts .", | ||
"format": "prettier --write .", | ||
"format:check": "prettier --check .", | ||
"prepublishOnly": "pnpm run build", | ||
"build": "tsup src/index.ts --format cjs,esm --clean --dts", | ||
"test": "vitest run", | ||
"check": "tsc" | ||
}, | ||
"files": [ | ||
"dist", | ||
"src", | ||
"tsconfig.json" | ||
], | ||
"keywords": [ | ||
"huggingface", | ||
"hub", | ||
"gguf" | ||
], | ||
"author": "Hugging Face", | ||
"license": "MIT", | ||
"devDependencies": {} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.