
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
JavaScript bindings for the GGML library, a fast and lightweight tensor/machine-learning library implemented in C.
https://user-images.githubusercontent.com/3526922/236536800-fca4d729-3479-471a-aea5-2d0ae5df3fdf.mov
You can install ggml-js via npm:
npm install ggml-js
Here's an example of how to use ggml-js in your JavaScript code:
import { Context, F } from 'ggml-js/core'
// Create context, two 1D tensors and multiply them
const ctx = Context.init()
const a = ctx.newTensor1D('f32', 1)
const b = ctx.newTensor1D('f32', 1)
const ab = F.mul(a, b)
// Build the computation graph
const graph = ctx.buildForward(ab)
// Set values & compute the graph
a.set(0, 1.5)
b.set(0, 2)
graph.compute()
// Get result
console.log(ab.get(0))
ggml-js also provides modules for working with pre-trained models and tokenizers. Here's an example of how to use the RWKV model and BPETokenizer:
import { RWKV } from 'ggml-js/llms'
import { BPETokenizer } from 'ggml-js/tokenizers'
// see examples/rwkv.js for full example
const model = RWKV.loadFromFile(...)
const tokenizer = BPETokenizer.loadFromFile(...)
for (const t of model.generate(tokenizer.encode('Hello world!'))) {
process.stdout.write(tokenizer.decodeOne(t))
}
If you want to build ggml-js from source, you can clone the repository and run the following commands:
zig build
This project is licensed under the MIT License.
This project bundles GGML library by Georgi Gerganov, which is also licensed under the MIT License.
FAQs
JS bindings for the ggml library.
The npm package ggml-js receives a total of 2 weekly downloads. As such, ggml-js popularity was classified as not popular.
We found that ggml-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.