- Notifications
You must be signed in to change notification settings - Fork0
Node.js module for the CLIP model.
License
NotificationsYou must be signed in to change notification settings
frost-beta/clip
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Node.js module for theCLIP model.
Powered bynode-mlx, a machinelearning framework for Node.js.
import{coreasmx}from'@frost-beta/mlx';exporttypeImageInputType=Buffer|ArrayBuffer|string;exportinterfaceProcessedImage{data:Buffer;info:sharp.OutputInfo;}exportinterfaceClipInput{labels?:string[];images?:ProcessedImage[];}exportinterfaceClipOutput{labelEmbeddings?:mx.array;imageEmbeddings?:mx.array;}exportclassClip{constructor(modelDir:string);processImages(images:ImageInputType[]):Promise<ProcessedImage[]>;computeEmbeddings({ labels, images}:ClipInput):ClipOutput;/** * Short hands of computeEmbeddings to convert results to JavaScript numbers * and ensure the intermediate arrays are destroyed. */computeLabelEmbeddingsJs(labels:string[]):number[][];computeImageEmbeddingsJs(images:ProcessedImage[]):number[][];/** * Compute the cosine similarity between 2 embeddings. */staticcomputeCosineSimilaritiy(a1:mx.array,a2:mx.array):mx.array;/** * Compute the cosine similarities between 2 arrays of embeddings. * * A tuple will be returned, with the first element being the cosine * similarity scores, and the second element being the indices sorted by * their scores from larger to smalller. */staticcomputeCosineSimilarities(x1:mx.array|number[][],x2:mx.array|number[][]):[mx.array,mx.array];}
MIT
About
Node.js module for the CLIP model.
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.