Skip to content

Commit

Permalink
[Web LLM] Fix for duplicate timestamp issue that could occur when loa…
Browse files Browse the repository at this point in the history
…ding two LoRA models in immediate succession

PiperOrigin-RevId: 707707742
  • Loading branch information
MediaPipe Team authored and copybara-github committed Dec 19, 2024
1 parent c22c48e commit 0f081a1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mediapipe/tasks/web/genai/llm_inference/llm_inference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -759,20 +759,22 @@ export class LlmInference extends TaskRunner {
modelAsset,
);
const loraModel = new LoraModel(this);
const syntheticTimestamp = this.getSynctheticTimestamp();
(
this.graphRunner as unknown as LlmGraphRunner
).addWasmFileReferenceToStream(
wasmFileReference,
LORA_MODEL_REF_INPUT_STREAM,
this.getSynctheticTimestamp(),
syntheticTimestamp,
);
this.graphRunner.addUintToStream(
loraModel.loraModelId,
LORA_MODEL_ID_TO_LOAD_INPUT_STREAM,
this.getSynctheticTimestamp(),
syntheticTimestamp,
);
this.finishProcessing();
wasmFileReference.free();
this.setLatestOutputTimestamp(syntheticTimestamp);
this.isProcessing = false;
return loraModel;
}
Expand Down

0 comments on commit 0f081a1

Please sign in to comment.