-
Notifications
You must be signed in to change notification settings - Fork 190
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JS] Add GenAI Node.js bindings #1193
base: master
Are you sure you want to change the base?
[JS] Add GenAI Node.js bindings #1193
Conversation
7784bba
to
222940d
Compare
153a7ea
to
a365ef8
Compare
src/js/README.md
Outdated
``` | ||
1. Configure CMake with OpenVINO extra modules: | ||
```sh | ||
cmake -DOPENVINO_EXTRA_MODULES=*relative (from openvino folder) path to genai repository* -DCPACK_ARCHIVE_COMPONENT_INSTALL=OFF \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
relative (from openvino folder) path to genai repository*
Any path representation will do. Absolute path should also wrok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to *absolute path*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point is that you shouldn't care if it's absolute or relative. Just ask for a path
1. Configure CMake with OpenVINO extra modules: | ||
```sh | ||
cmake -DOPENVINO_EXTRA_MODULES=*absolute path to genai repository directory* -DCPACK_ARCHIVE_COMPONENT_INSTALL=OFF \ | ||
-DCPACK_GENERATOR=NPM -DENABLE_JS=ON -UTBB* -DENABLE_SYSTEM_TBB=OFF \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Why do you care about tbb?
- What does
-UTBB*
do?
src/js/README.md
Outdated
1. In `build` folder you will find `genai_nodejs_bindings.tar.gz`. | ||
Create `bin` directory by path `src/js/` and unpack archive content to it. | ||
```sh | ||
tar -xzf genai_nodejs_bindings.tar.gz |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. In `build` folder you will find `genai_nodejs_bindings.tar.gz`. | |
Create `bin` directory by path `src/js/` and unpack archive content to it. | |
```sh | |
tar -xzf genai_nodejs_bindings.tar.gz | |
1. Install Node.js bindings | |
```sh | |
mkdir ./src/js/bin/ | |
tar -xvf ./build/genai_nodejs_bindings.tar.gz --directory ./src/js/bin/ | |
cd ./src/js/ | |
npm install |
src/js/README.md
Outdated
### Perform Test Run | ||
|
||
- To run sample you should have prepared model. | ||
Use this instruction [to download model](https://github.com/openvinotoolkit/openvino.genai/blob/master/samples/js/chat_sample/README.md#download-and-convert-the-model-and-tokenizers) | ||
- Go to [samples/js/chat_sample/](../../samples/js/chat_sample/) | ||
- Read [README.md](../../samples/js/chat_sample/README.md) and follow steps there | ||
to run **chat sample**. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should drop this section because this is about the sample. You have a dedicated readme for that.
src/js/README.md
Outdated
|
||
### Using as npm Dependency | ||
|
||
To use this package locally use `npm link` in this directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To use this package locally use `npm link` in this directory | |
To use this package locally use `npm link` in `src/js/` directory |
src/js/README.md
Outdated
### Using as npm Dependency | ||
|
||
To use this package locally use `npm link` in this directory | ||
and `npm link genai-node` in the folder where you want add this package as dependency |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and `npm link genai-node` in the folder where you want add this package as dependency | |
and `npm link genai-node` in the folder where you want to add this package as a dependency. |
src/js/tests/bindings.test.js
Outdated
before((_, done) => { | ||
pipeline = new addon.LLMPipeline(); | ||
|
||
pipeline.init(MODEL_PATH, 'AUTO', (err) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pipeline.init(MODEL_PATH, 'AUTO', (err) => { | |
pipeline.init(MODEL_PATH, 'CPU', (err) => { |
Setting that to CPU allows to avoid compiling all other plugins saving some CI time.
samples/js/chat_sample/README.md
Outdated
## Run: | ||
|
||
Create `bin` folder in [../../../src/js](../../../src/js). | ||
Compile GenAI JavaScript bindings archive first. Put its content into `bin` directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The sample should assume that bingings are already prepared. You should reference the corresponding readme instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
samples/js/chat_sample/README.md
Outdated
Create `bin` folder in [../../../src/js](../../../src/js). | ||
Compile GenAI JavaScript bindings archive first. Put its content into `bin` directory. | ||
|
||
Run `npm install` in current folder and then run a sample: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Run `npm install` in current folder and then run a sample: | |
Run `npm install` in current folder and then run the sample: |
samples/js/chat_sample/README.md
Outdated
Create `bin` folder in [../../../src/js](../../../src/js). | ||
Compile GenAI JavaScript bindings archive first. Put its content into `bin` directory. | ||
|
||
Run `npm install` in current folder and then run a sample: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not what CI does. It runs npm link genai-node
. Why are they different?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aligned, good remark
Adding Node.js bindings for GenAI pipelines.
Limitations
Current version it's primary backbone of future development. Supports bindings of
LLMPipeline
only.TODO