Skip to content

Commit

Permalink
new naming convention and location for the model
Browse files Browse the repository at this point in the history
  • Loading branch information
guschmue committed May 16, 2024
1 parent 712a887 commit 4670897
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions js/chat/llm.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,15 @@ export class LLM {

const model_path = (local) ? "models/" + model.path : "https://huggingface.co/" + model.path + "/resolve/main";
let model_file = model.file || "model";
model_file = (hasFP16 && model_file != "decoder_model_merged") ? model_file + "_fp16.onnx" : model_file + ".onnx";
model_file = (hasFP16) ? model_file + "_q4f16.onnx" : model_file + "_q4.onnx";

log(`loading... ${model.name}, ${provider}`);
const json_bytes = await fetchAndCache(model_path + "/config.json");
let textDecoder = new TextDecoder();
const model_config = JSON.parse(textDecoder.decode(json_bytes));

const model_bytes = await fetchAndCache(model_path + "/onnx/" + model_file);
const externaldata = (model.externaldata) ? await fetchAndCache(model_path + "/onnx/" + model_file + '.data') : false;
const externaldata = (model.externaldata) ? await fetchAndCache(model_path + "/onnx/" + model_file + '_data') : false;
let modelSize = model_bytes.byteLength;
if (externaldata) {
modelSize += externaldata.byteLength;
Expand All @@ -93,7 +93,7 @@ export class LLM {
opt.externalData = [
{
data: externaldata,
path: model_file + ".data",
path: model_file + "_data",
},
]
}
Expand Down Expand Up @@ -184,7 +184,7 @@ export class LLM {
}

//
// prefill prompt and generate tokens
// prefill prompt and generate tokens, greedy search only
//
async generate(tokens, callback, options) {
const max_tokens = options.max_tokens || 256;
Expand Down
3 changes: 2 additions & 1 deletion js/chat/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { marked } from 'marked';


const MODELS = {
"phi3": { name: "phi3", path: "schmuell/phi3-int4", externaldata: true },
"phi3": { name: "phi3", path: "microsoft/Phi-3-mini-4k-instruct-onnx-web", externaldata: true },
"phi3dev": { name: "phi3dev", path: "schmuell/Phi-3-mini-4k-instruct-onnx-web", externaldata: true },
}

const preCannedQueries = {
Expand Down

0 comments on commit 4670897

Please sign in to comment.