Skip to content

Deluxer/hugginface-mode-in-javascript

Repository files navigation

Description

HuggingFace Models in Javascript: Using different tools, it is possible to use LLM models in Javascript projects, all locally

Stack used

  • Hugginface
  • Nestjs
  • MongoDB
  • Python
  • ONNX
  • Transformerjs

Landingpage

Installation

$ yarn install

Env

copy .env.example and rename to .env
MONGODB_ATLAS_URI='uri'

Download Huggingface Model

cd src/
python -m scripts.convert --quantize --model_id Xenova/all-MiniLM-L6-v2

Use Conda environment

conda create --name vectors python=3.10.12
conda activate vectors

pip install transformers==4.33.2
pip install onnxruntime==1.15.0
pip install optimum==1.13.2
pip install tqdm
pip install onnx==1.13.1

Running the app

# development
$ yarn run start

# watch mode
$ yarn run start:dev

# production mode
$ yarn run start:prod

Endpoint

POST http://localhost:3000/vectors
GET http://localhost:3000/vectors/search?word=red

Documentation

Stay in touch

License

Nest is MIT licensed.

About

Integrate Hugging Face model in Javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published