Skip to content

Commit

Permalink
Merge branch 'main' into add/model-list
Browse files Browse the repository at this point in the history
  • Loading branch information
hahuyhoang411 authored Dec 26, 2023
2 parents 1ec0836 + acbd356 commit a5ddb94
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Jan is an open-source ChatGPT alternative that runs 100% offline on your compute
<tr style="text-align: center">
<td style="text-align:center"><b>Experimental (Nighlty Build)</b></td>
<td style="text-align:center" colspan="4">
<a href='https://github.com/janhq/jan/actions/runs/7328809734'>
<a href='https://github.com/janhq/jan/actions/runs/7329755769'>
<b>Github action artifactory</b>
</a>
</td>
Expand Down
3 changes: 3 additions & 0 deletions docs/docs/guides/04-using-models/02-import-manually.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -130,6 +132,7 @@ Copy the following configurations into the `model.json`.
"tags": ["7B", "Merged", "Featured"],
"size": 4370000000
},
"state": "ready",
"engine": "nitro"
}
```
Expand Down
14 changes: 14 additions & 0 deletions extensions/inference-nitro-extension/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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}";
Expand Down

0 comments on commit a5ddb94

Please sign in to comment.