Skip to content

Commit 0b85800

Browse files
authored
fix: remove CUDA binary compression for Windows (#243)
* fix: remove CUDA binary compression for Windows * fix: improve `inspect gpu` command output
1 parent 1e7c5d0 commit 0b85800

File tree

4 files changed

+41
-23
lines changed

4 files changed

+41
-23
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -235,25 +235,25 @@ jobs:
235235
path: "upxInstallations/**"
236236
key: cache-upx-${{ runner.os }}-${{ github.workflow }}
237237

238-
- name: Compress CUDA binary on Windows
239-
if: matrix.config.name == 'Windows for x64'
240-
shell: bash
241-
env:
242-
UPX_VERSION: 4.2.4
243-
run: |
244-
mkdir -p upxInstallations
245-
246-
if [ ! -f "./upxInstallations/upx-${UPX_VERSION}-win64.zip" ]; then
247-
pushd upxInstallations
248-
curl -OL "https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-win64.zip"
249-
popd
250-
fi
251-
252-
mkdir -p upx
253-
unzip -d ./upx "./upxInstallations/upx-${UPX_VERSION}-win64.zip"
254-
mv "./upx/upx-${UPX_VERSION}-win64" ./upx/upx
255-
256-
./upx/upx/upx.exe --best ./bins/win-x64-cuda/llama-addon.node
238+
# - name: Compress CUDA binary on Windows
239+
# if: matrix.config.name == 'Windows for x64'
240+
# shell: bash
241+
# env:
242+
# UPX_VERSION: 4.2.4
243+
# run: |
244+
# mkdir -p upxInstallations
245+
#
246+
# if [ ! -f "./upxInstallations/upx-${UPX_VERSION}-win64.zip" ]; then
247+
# pushd upxInstallations
248+
# curl -OL "https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-win64.zip"
249+
# popd
250+
# fi
251+
#
252+
# mkdir -p upx
253+
# unzip -d ./upx "./upxInstallations/upx-${UPX_VERSION}-win64.zip"
254+
# mv "./upx/upx-${UPX_VERSION}-win64" ./upx/upx
255+
#
256+
# ./upx/upx/upx.exe --best ./bins/win-x64-cuda/llama-addon.node
257257

258258
- name: Compress CUDA binary on Ubuntu
259259
if: matrix.config.name == 'Ubuntu'

src/bindings/utils/getLinuxDistroInfo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ export async function isDistroAlpineLinux(linuxDistroInfo: LinuxDistroInfo) {
2525

2626
async function getOsReleaseInfo() {
2727
for (const osReleasePath of osReleasePaths) {
28-
if (!(await fs.pathExists(osReleasePath)))
29-
continue;
30-
3128
try {
29+
if (!(await fs.pathExists(osReleasePath)))
30+
continue;
31+
3232
const osReleaseFile = await fs.readFile(osReleasePath, "utf-8");
3333

3434
const res = new Map<string, string>();

src/cli/commands/ChatCommand.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,8 @@ async function RunChat({
497497
return res;
498498
}
499499

500+
void session.preloadPrompt("");
501+
500502
// eslint-disable-next-line no-constant-condition
501503
while (true) {
502504
let hadNoWhitespaceTextInThisIteration = false;

src/cli/commands/inspect/commands/InspectGpuCommand.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import {getModuleVersion} from "../../../../utils/getModuleVersion.js";
1111
import {withCliCommandDescriptionDocsUrl} from "../../../utils/withCliCommandDescriptionDocsUrl.js";
1212
import {documentationPageUrls} from "../../../../config.js";
1313
import {Llama} from "../../../../bindings/Llama.js";
14+
import {getPlatformInfo} from "../../../../bindings/utils/getPlatformInfo.js";
15+
import {getLinuxDistroInfo} from "../../../../bindings/utils/getLinuxDistroInfo.js";
1416

1517
type InspectGpuCommand = {
1618
// no options for now
@@ -36,7 +38,21 @@ export const InspectGpuCommand: CommandModule<object, InspectGpuCommand> = {
3638
return gpuToLlama.get(gpu);
3739
}
3840

39-
console.info(`${chalk.yellow("OS:")} ${os.type()} ${os.release()} ${chalk.dim("(" + os.arch() + ")")}`);
41+
if (platform === "linux") {
42+
const linuxDistroInfo = await getLinuxDistroInfo();
43+
44+
if (linuxDistroInfo.prettyName !== "")
45+
console.info(`${chalk.yellow("OS:")} ${linuxDistroInfo.prettyName} ${chalk.dim("(" + os.arch() + ")")}`);
46+
else
47+
console.info(`${chalk.yellow("OS:")} ${linuxDistroInfo.name || os.type()} ${linuxDistroInfo.version || os.release()} ${chalk.dim("(" + os.arch() + ")")}`);
48+
} else {
49+
const platformInfo = await getPlatformInfo();
50+
const osName = platformInfo.name === "Unknown"
51+
? os.type()
52+
: platformInfo.name;
53+
54+
console.info(`${chalk.yellow("OS:")} ${osName} ${platformInfo.version} ${chalk.dim("(" + os.arch() + ")")}`);
55+
}
4056

4157
if (process.versions.node != null)
4258
console.info(`${chalk.yellow("Node:")} ${process.versions.node} ${chalk.dim("(" + arch + ")")}`);

0 commit comments

Comments
 (0)