Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions llama/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ endif()

add_definitions(-DNAPI_VERSION=7)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_PLATFORM_NO_VERSIONED_SONAME ON)

set(LLAMA_BUILD_COMMON ON)

Expand Down
10 changes: 5 additions & 5 deletions llama/addon/globals/addonLog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ void addonLlamaCppLogCallback(ggml_log_level level, const char* text, void* user
}

Napi::Value setLogger(const Napi::CallbackInfo& info) {
if (info.Length() < 1 || !info[0].IsFunction()) {
if (addonJsLoggerCallbackSet) {
addonJsLoggerCallbackSet = false;
addonThreadSafeLoggerCallback.Release();
}
if (addonJsLoggerCallbackSet) {
addonJsLoggerCallbackSet = false;
addonThreadSafeLoggerCallback.Release();
}

if (info.Length() < 1 || !info[0].IsFunction()) {
return info.Env().Undefined();
}

Expand Down
2 changes: 1 addition & 1 deletion llama/cmake/addVariantSuffix.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function(addVariantSuffix originalTarget variantSuffix)
if (NOT TARGET ${originalTarget} OR variantSuffix STREQUAL "")
if (NOT TARGET ${originalTarget} OR ${variantSuffix} STREQUAL "")
return()
endif()

Expand Down
2 changes: 1 addition & 1 deletion src/bindings/Llama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export class Llama {
this._supportsMmap = bindings.getSupportsMmap();
this._gpuSupportsMmap = bindings.getGpuSupportsMmap();
this._supportsMlock = bindings.getSupportsMlock();
this._mathCores = bindings.getMathCores();
this._mathCores = Math.floor(bindings.getMathCores());
this._consts = bindings.getConsts();
this._vramOrchestrator = vramOrchestrator;
this._vramPadding = vramPadding;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {createBirpc} from "birpc";

export function createRendererSideBirpc<
const RendererFunction = Record<string, never>,
const ElectronFunctions extends object = Record<string, never>
const ElectronFunction = Record<string, never>,
const RendererFunctions extends object = Record<string, never>
>(
toRendererEventName: string,
fromRendererEventName: string,
electronFunctions: ElectronFunctions
rendererFunctions: RendererFunctions
) {
return createBirpc<RendererFunction, ElectronFunctions>(electronFunctions, {
return createBirpc<ElectronFunction, RendererFunctions>(rendererFunctions, {
post: (data) => window.ipcRenderer.send(fromRendererEventName, data),
on: (onData) => window.ipcRenderer.on(toRendererEventName, (event, data) => {
onData(data);
Expand All @@ -17,4 +17,3 @@ export function createRendererSideBirpc<
deserialize: (value) => JSON.parse(value)
});
}

2 changes: 1 addition & 1 deletion test/modelDependent/llama3.2/sequenceState.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ describe("llama 3.2", () => {
await contextSequence2.loadStateFromFile(stateFile1Path, {acceptRisk: true});

const res2 = await chatSession2.prompt("What did I tell you to remember?", {maxTokens: 12});
expect(res2).to.toMatchInlineSnapshot('"You told me to remember that "locks are not doors"."');
expect(res2).toMatch(/^(You told me to remember that "locks are not doors".|You told me to remember that "locks are not doors.")/);
const contextSequence2TokensState = contextSequence2.tokenMeter.getState();
expect(contextSequence2TokensState.usedInputTokens).to.be.lessThan(contextSequence1TokensState.usedInputTokens);
expect(contextSequence2TokensState).toMatchInlineSnapshot(`
Expand Down
Loading