-
-
Notifications
You must be signed in to change notification settings - Fork 168
Description
Issue description
commonJS headerReadResultPromisable instanceof Promise is false
Expected Behavior
Support commonjs
Actual Behavior
In commonJS with the instantiation like await (new Function('return import("node-llama-cpp")')() as Promise<typeof import("node-llama-cpp")>); when calling the const model = await llama.loadModel() it will result in the metadata being undefined and give an error with general.alignment headerReadResult.metadata["general.alignment"]; this is due to the the fact that headerReadResultPromisable instanceof Promise resolves as false instead of true, therefore the promise is not yet resolved
Steps to reproduce
Try to use this in commonjs.
My Environment
| Dependency | Version |
|---|---|
| Operating System | |
| CPU | Intel i9 / Apple M1 |
| Node.js version | x.y.zzz |
| Typescript version | x.y.zzz |
node-llama-cpp version |
x.y.zzz |
npx --yes node-llama-cpp inspect gpu output:
Result of running `npx --yes node-llama-cpp inspect gpu`
Additional Context
No response
Relevant Features Used
- Metal support
- CUDA support
- Vulkan support
- Grammar
- Function calling
Are you willing to resolve this issue by submitting a Pull Request?
No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.