diff --git a/README.md b/README.md index 496950eb9..e5b9c4a4f 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ Jan is an open-source ChatGPT alternative that runs 100% offline on your compute Experimental (Nighlty Build) - + Github action artifactory diff --git a/docs/docs/guides/04-using-models/02-import-manually.mdx b/docs/docs/guides/04-using-models/02-import-manually.mdx index fecb3fa4d..cae294b40 100644 --- a/docs/docs/guides/04-using-models/02-import-manually.mdx +++ b/docs/docs/guides/04-using-models/02-import-manually.mdx @@ -109,6 +109,8 @@ Copy the following configurations into the `model.json`. 2. Make sure the `source_url` property is the direct binary download link ending in `.gguf`. In HuggingFace, you can find the directl links in `Files and versions` tab. 3. Ensure you are using the correct `prompt_template`. This is usually provided in the HuggingFace model's description page. +> Note: Currently, the filename must be `model.json` and the ID has to be equal to the foldername. In the `model.json`, you have to include the `state` property and set it to `ready` for Jan to recognize the model. + ```js { "source_url": "https://huggingface.co/janhq/trinity-v1-GGUF/resolve/main/trinity-v1.Q4_K_M.gguf", @@ -130,6 +132,7 @@ Copy the following configurations into the `model.json`. "tags": ["7B", "Merged", "Featured"], "size": 4370000000 }, + "state": "ready", "engine": "nitro" } ``` diff --git a/extensions/inference-nitro-extension/src/module.ts b/extensions/inference-nitro-extension/src/module.ts index a990ef81b..25836a875 100644 --- a/extensions/inference-nitro-extension/src/module.ts +++ b/extensions/inference-nitro-extension/src/module.ts @@ -68,6 +68,15 @@ async function loadModel(nitroResourceProbe: any | undefined) { if (!nitroResourceProbe) nitroResourceProbe = await getResourcesInfo(); return killSubprocess() .then(() => tcpPortUsed.waitUntilFree(PORT, 300, 5000)) + // wait for 500ms to make sure the port is free for windows platform + .then(() => { + if (process.platform === "win32") { + return sleep(500); + } + else { + return sleep(0); + } + }) .then(() => spawnNitroProcess(nitroResourceProbe)) .then(() => loadLLMModel(currentSettings)) .then(validateModelStatus) @@ -78,6 +87,11 @@ async function loadModel(nitroResourceProbe: any | undefined) { }); } +// Add function sleep +function sleep(ms) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + function promptTemplateConverter(promptTemplate) { // Split the string using the markers const systemMarker = "{system_message}";