Skip to content

Using Node LLama CPP in a Child Process #481

Answered by giladgd
SpicyMelonYT asked this question in Q&A
Discussion options

You must be logged in to vote

Please share the output of running this command, so I can get a sense of your environment:

npx --yes node-llama-cpp inspect gpu

You can await model.dispose() to unload a model on demand, or just let it be garbage collected to get it unloaded automatically.
The loading of the model is also asynchronous, but it may take about ~100ms of the main thread to read the model’s metadata from the JS side if the metadata is extremely big, but this only happens once.

Why did you land on using another process/thread for that?
On node-llama-cpp v2 the loading and unloading of models used to be sync, so having another process for that back then made sense, but this is not the case anymore since v3.
Perh…

Replies: 1 comment 12 replies

Comment options

You must be logged in to vote
12 replies
@giladgd
Comment options

@SpicyMelonYT
Comment options

@SpicyMelonYT
Comment options

@giladgd
Comment options

@SpicyMelonYT
Comment options

Answer selected by giladgd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants