Skip to content

Commit

Permalink
Merge pull request #53 from NingW101/bug-fix
Browse files Browse the repository at this point in the history
Fix the bug of mediapipe version not match to the genai file
  • Loading branch information
ibelem authored Sep 4, 2024
2 parents ff523b6 + b9de8b6 commit 9ad522e
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 17 deletions.
12 changes: 6 additions & 6 deletions build_scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,17 @@ async function fetchResources() {
}
}

function build4Github() {
function buildForGithub() {
buildSubProjects("--github");
copyResourcesIntoDist("--use-remote-models");
}

function build4RemoteMode() {
function buildForRemoteMode() {
buildSubProjects("--use-remote-models");
copyResourcesIntoDist("--use-remote-models");
}

function build4LocalMode() {
function buildForLocalMode() {
fetchResources();
buildSubProjects();
copyResourcesIntoDist();
Expand All @@ -225,14 +225,14 @@ switch (MODE) {
case "--github":
// build for deployment on github
// Remote mode + different base url
build4Github();
buildForGithub();
break;
case "--use-remote-models":
// build for Remote mode
build4RemoteMode();
buildForRemoteMode();
break;
default:
// build for Hoisting mode by default
build4LocalMode();
buildForLocalMode();
break;
}
3 changes: 2 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ export const TRANSFORMER_LOCAL_MODEL_PATH = "/models/";
export const TRANSFORMERS_V3_ORT_ENV_WASM_FILE_PATH =
"/models/frameworks/ort-web/ort-web@1_17_1/";

export const MEDIAPIPE_WASM_FILE_PATH = "/models/mediapipe/tasks-genai/wasm";
export const MEDIAPIPE_WASM_FILE_PATH =
"/models/frameworks/mediapipe/tasks-genai";

/**
* Example:
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"vite-plugin-top-level-await": "^1.4.1"
},
"dependencies": {
"@mediapipe/tasks-genai": "0.10.12",
"@mediapipe/tasks-genai": "0.10.14",
"@xenova/transformers": "github:xenova/transformers.js#aadeed936af7cc9049e1d238fd4ec70545dfd508",
"dompurify": "3.1.0",
"highlight.js": "11.9.0",
Expand Down
14 changes: 12 additions & 2 deletions samples/llm_gemma/gemma.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import {
formatBytes
} from "../common/utility.js";
import { setupNavigBar } from "../../js/navbar.js";
import { MEDIAPIPE_WASM_FILE_PATH } from "../../config.js";
import {
MEDIAPIPE_WASM_FILE_PATH,
ALL_NEEDED_MODEL_RESOURCES
} from "../../config.js";

const input = document.getElementById("input");
const output = document.getElementById("output");
Expand All @@ -46,8 +49,15 @@ if (location.href.toLowerCase().indexOf("github.io") > -1) {
}

let llmInference;

const genaiFileset = await FilesetResolver.forGenAiTasks(
baseUrl + MEDIAPIPE_WASM_FILE_PATH
// eslint-disable-next-line no-undef
VITE_ENV_USE_REMOTE_MODELS
? ALL_NEEDED_MODEL_RESOURCES["tasks-genai"].linkPathPrefix.replace(
/\/$/,
""
)
: baseUrl + MEDIAPIPE_WASM_FILE_PATH
);

const STATUS = {
Expand Down

0 comments on commit 9ad522e

Please sign in to comment.