🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

gemma-node

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gemma-node

This is a module that will interface with [Gemma](https://blog.google/technology/developers/gemma-open-models/)'s [gemma.cpp](https://github.com/google/gemma.cpp). Its still a work in progress.

latest
npmnpm
Version
0.0.4
Version published
Maintainers
1
Created
Source

Gemma Node

This is a module that will interface with Gemma's gemma.cpp. Its still a work in progress.

Installation

First with the current version you will need to clone the gemma.cpp repo, and build the library. You will also need to download the model files from Kaggle.

To install this package, run:

yarn add gemma-node

Usage

Configuring Gemma

import { Gemma } from 'gemma-node'

const gemma = new Gemma({
  directory: 'path/to/gemma.cpp/build/', // or process.env.GEMMA_DIR
  tokenizer: 'tokenizer.spm ', // will resolve path based on directory
  model: '2b-it',
  compressedWeights: '2b-it-sfp.sbs', // will resolve path based on directory
})

Using Gemma

await gemma.start()

This will start up the Gemma process and load the model. This is required and once the promise is resolves you are ready to send input to the model.

Async methods

const input = 'This is a test'
const output = await gemma.sendMessageAsync(input)
console.log(output.join(' '))

There right now is only one way to send input, and receive output. This is the async method that uses async await. THe awaited output will be an array of strings.

Stream methods

Coming soon

FAQs

Package last updated on 10 Mar 2024

Did you know?

Socket

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.

Install

Related posts