Skip to content

Commit b6acbcf

Browse files
committed
feat: move prebuilt fallback CUDA backend to an additional npm package
1 parent 51fcce5 commit b6acbcf

22 files changed

+430
-19
lines changed

llama/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,8 @@ endif()
8686

8787
if (GGML_CUDA AND NOT DEFINED CMAKE_CUDA_ARCHITECTURES AND NOT NLC_GGML_NATIVE)
8888
find_package(CUDAToolkit)
89-
9089
if (CUDAToolkit_FOUND AND CUDAToolkit_VERSION VERSION_GREATER_EQUAL "13.0")
9190
set(CMAKE_CUDA_ARCHITECTURES "75-virtual;80-virtual;86-real;89-real;90-real")
92-
elseif (CUDAToolkit_FOUND AND CUDAToolkit_VERSION VERSION_GREATER_EQUAL "12.2")
93-
set(CMAKE_CUDA_ARCHITECTURES "50-virtual;61-virtual;70-virtual;75-virtual;80-virtual;86-virtual;89-virtual")
9491
endif()
9592
endif()
9693

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,14 @@
228228
"@node-llama-cpp/linux-armv7l": "0.1.0",
229229
"@node-llama-cpp/linux-x64": "0.1.0",
230230
"@node-llama-cpp/linux-x64-cuda": "0.1.0",
231+
"@node-llama-cpp/linux-x64-cuda-ext": "0.1.0",
231232
"@node-llama-cpp/linux-x64-vulkan": "0.1.0",
232233
"@node-llama-cpp/mac-arm64-metal": "0.1.0",
233234
"@node-llama-cpp/mac-x64": "0.1.0",
234235
"@node-llama-cpp/win-arm64": "0.1.0",
235236
"@node-llama-cpp/win-x64": "0.1.0",
236237
"@node-llama-cpp/win-x64-cuda": "0.1.0",
238+
"@node-llama-cpp/win-x64-cuda-ext": "0.1.0",
237239
"@node-llama-cpp/win-x64-vulkan": "0.1.0"
238240
}
239241
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/dist
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Gilad S.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# [`node-llama-cpp`](https://github.com/withcatai/node-llama-cpp)
2+
This is an extension of the [`@node-llama-cpp/linux-x64-cuda`](https://www.npmjs.com/package/@node-llama-cpp/linux-x64-cuda) package
3+
that provides a prebuilt binary for [`node-llama-cpp`](https://github.com/withcatai/node-llama-cpp) for Linux x64 with CUDA support.
4+
5+
Do not install this package directly.

packages/@node-llama-cpp/linux-x64-cuda-ext/package-lock.json

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"name": "@node-llama-cpp/linux-x64-cuda-ext",
3+
"version": "0.1.0",
4+
"description": "Extension of @node-llama-cpp/linux-x64-cuda - prebuilt binary for node-llama-cpp for Linux x64 with CUDA support",
5+
"main": "dist/index.js",
6+
"type": "module",
7+
"files": [
8+
"dist/",
9+
"bins/",
10+
"package.json",
11+
"README.md",
12+
"LICENSE"
13+
],
14+
"exports": {
15+
".": {
16+
"import": "./dist/index.js",
17+
"node": "./dist/index.js",
18+
"default": "./dist/index.js"
19+
}
20+
},
21+
"engines": {
22+
"node": ">=20.0.0"
23+
},
24+
"os": ["linux"],
25+
"cpu": ["x64"],
26+
"libc": ["glibc"],
27+
"scripts": {
28+
"prebuild": "rimraf ./dist ./tsconfig.tsbuildinfo",
29+
"build": "tsc --build tsconfig.json --force",
30+
"prewatch": "rimraf ./dist ./tsconfig.tsbuildinfo",
31+
"watch": "tsc --build tsconfig.json --watch --force",
32+
"clean": "rm -rf ./node_modules ./dist ./tsconfig.tsbuildinfo"
33+
},
34+
"repository": {
35+
"type": "git",
36+
"url": "git+https://github.com/withcatai/node-llama-cpp.git"
37+
},
38+
"author": "Gilad S.",
39+
"license": "MIT",
40+
"preferUnplugged": true,
41+
"bugs": {
42+
"url": "https://github.com/withcatai/node-llama-cpp/issues"
43+
},
44+
"homepage": "https://node-llama-cpp.withcat.ai",
45+
"devDependencies": {
46+
"typescript": "^5.2.2"
47+
}
48+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import path from "path";
2+
import {fileURLToPath} from "url";
3+
import fs from "node:fs/promises";
4+
5+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
6+
const binsDir = path.join(__dirname, "..", "bins");
7+
const packageVersion: string = (JSON.parse(await fs.readFile(path.join(__dirname, "..", "package.json"), "utf8"))).version;
8+
9+
export function getBinsDir() {
10+
return {
11+
binsDir,
12+
packageVersion
13+
};
14+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"compilerOptions": {
3+
"lib": ["es2022"],
4+
"module": "es2022",
5+
"target": "es2022",
6+
"esModuleInterop": true,
7+
"noImplicitAny": true,
8+
"noImplicitReturns": true,
9+
"noImplicitThis": true,
10+
"noImplicitOverride": true,
11+
"removeComments": false,
12+
"allowSyntheticDefaultImports": true,
13+
"forceConsistentCasingInFileNames": true,
14+
"noFallthroughCasesInSwitch": true,
15+
"skipLibCheck": true,
16+
"moduleResolution": "node",
17+
"resolveJsonModule": false,
18+
"strictNullChecks": true,
19+
"isolatedModules": true,
20+
"noEmit": false,
21+
"outDir": "./dist",
22+
"strict": true,
23+
"sourceMap": false,
24+
"composite": false,
25+
"declaration": false,
26+
"stripInternal": true
27+
},
28+
"files": [
29+
"./src/index.ts"
30+
],
31+
"include": [
32+
"./src"
33+
]
34+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/dist

0 commit comments

Comments
 (0)