Skip to content

Commit

Permalink
Inference Plugin pull nitro binary from release (#524)
Browse files Browse the repository at this point in the history
* refactor nitro folder structure inside inference plugin

* Change to flat folder structure for nitro binary

* Remove all exiting nitro binary file

* add download command for nitron linux cuda

* Add yarn script to download nitro

* Add build deps to data-plugins yarn script

* add chmod for nitro binary file

---------

Co-authored-by: Hien To <[email protected]>
Co-authored-by: Service Account <[email protected]>
  • Loading branch information
3 people authored Nov 1, 2023
1 parent f02f769 commit 200f19f
Show file tree
Hide file tree
Showing 25 changed files with 35 additions and 2,539 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@ package-lock.json
*.log
plugin-core/lib
core/lib/**

# Nitro binary files
plugins/inference-plugin/nitro/*/nitro
plugins/inference-plugin/nitro/*/*.exe
plugins/inference-plugin/nitro/*/*.dll
plugins/inference-plugin/nitro/*/*.metal
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"build:electron": "yarn workspace jan build",
"build:electron:test": "yarn workspace jan build:test",
"build:pull-plugins": "rimraf ./electron/core/pre-install/*.tgz && cd ./electron/core/pre-install && npm pack @janhq/inference-plugin @janhq/data-plugin @janhq/model-management-plugin @janhq/monitoring-plugin",
"build:plugins": "rimraf ./electron/core/pre-install/*.tgz && concurrently --kill-others-on-fail \"cd ./plugins/data-plugin && npm install && npm run postinstall\" \"cd ./plugins/inference-plugin && npm install && npm run postinstall\" \"cd ./plugins/model-management-plugin && npm install && npm run postinstall\" \"cd ./plugins/monitoring-plugin && npm install && npm run postinstall\" && concurrently --kill-others-on-fail \"cd ./plugins/data-plugin && npm run build:publish\" \"cd ./plugins/inference-plugin && npm run build:publish\" \"cd ./plugins/model-management-plugin && npm run build:publish\" \"cd ./plugins/monitoring-plugin && npm run build:publish\"",
"build:plugins": "rimraf ./electron/core/pre-install/*.tgz && concurrently --kill-others-on-fail \"cd ./plugins/data-plugin && npm install && npm run build:deps && npm run postinstall\" \"cd ./plugins/inference-plugin && npm install && npm run postinstall\" \"cd ./plugins/model-management-plugin && npm install && npm run postinstall\" \"cd ./plugins/monitoring-plugin && npm install && npm run postinstall\" && concurrently --kill-others-on-fail \"cd ./plugins/data-plugin && npm run build:publish\" \"cd ./plugins/inference-plugin && npm run build:publish\" \"cd ./plugins/model-management-plugin && npm run build:publish\" \"cd ./plugins/monitoring-plugin && npm run build:publish\"",
"build": "yarn build:web && yarn build:electron",
"build:test": "yarn build:web && yarn build:electron:test",
"build:test-darwin": "yarn build:web && yarn workspace jan build:test-darwin",
Expand Down
11 changes: 8 additions & 3 deletions plugins/inference-plugin/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ const initModel = (fileName) => {

if (process.platform === "win32") {
// Todo: Need to check for CUDA support to switch between CUDA and non-CUDA binaries
binaryName = "nitro_start_windows.bat";
binaryName = "win-start.bat";
} else if (process.platform === "darwin") {
// Mac OS platform
binaryName = process.arch === "arm64" ? "nitro_mac_arm64" : "nitro_mac_intel";
if (process.arch === "arm64") {
binaryFolder = path.join(binaryFolder, "mac-arm64")
} else {
binaryFolder = path.join(binaryFolder, "mac-x64")
}
binaryName = "nitro"
} else {
// Linux
// Todo: Need to check for CUDA support to switch between CUDA and non-CUDA binaries
binaryName = "nitro_start_linux.sh"; // For other platforms
binaryName = "linux-start.sh"; // For other platforms
}

const binaryPath = path.join(binaryFolder, binaryName);
Expand Down
Loading

0 comments on commit 200f19f

Please sign in to comment.