mirror of
https://github.com/cocktailpeanut/dalai
synced 2024-11-20 23:07:32 +01:00
Threads default to system cpu count.
This commit is contained in:
parent
e8fef81380
commit
488d31f634
@ -1,6 +1,7 @@
|
|||||||
const express = require('express')
|
const express = require('express')
|
||||||
const http = require('http')
|
const http = require('http')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const os = require('os')
|
||||||
const Dalai = require("../../index")
|
const Dalai = require("../../index")
|
||||||
const app = express()
|
const app = express()
|
||||||
const httpServer = http.Server(app);
|
const httpServer = http.Server(app);
|
||||||
@ -13,7 +14,9 @@ const start = (port, home) => {
|
|||||||
app.set('view engine', 'ejs');
|
app.set('view engine', 'ejs');
|
||||||
app.set('views', path.resolve(__dirname, "views"))
|
app.set('views', path.resolve(__dirname, "views"))
|
||||||
app.get("/", (req, res) => {
|
app.get("/", (req, res) => {
|
||||||
res.render("index")
|
res.render("index", {
|
||||||
|
threads: oc.cpus().length;
|
||||||
|
})
|
||||||
})
|
})
|
||||||
httpServer.listen(port, () => {
|
httpServer.listen(port, () => {
|
||||||
console.log(`Server running on http://localhost:${port}/`)
|
console.log(`Server running on http://localhost:${port}/`)
|
||||||
|
@ -111,7 +111,7 @@
|
|||||||
<script>
|
<script>
|
||||||
const config = {
|
const config = {
|
||||||
seed: -1,
|
seed: -1,
|
||||||
threads: 4,
|
threads: <%= threads %>,
|
||||||
n_predict: 200,
|
n_predict: 200,
|
||||||
top_k: 40,
|
top_k: 40,
|
||||||
top_p: 0.9,
|
top_p: 0.9,
|
||||||
@ -126,7 +126,7 @@ const form = document.getElementById('form');
|
|||||||
const input = document.querySelector('#input');
|
const input = document.querySelector('#input');
|
||||||
const model = document.querySelector('#model');
|
const model = document.querySelector('#model');
|
||||||
const renderHeader = (config) => {
|
const renderHeader = (config) => {
|
||||||
const fields = [{ key: "debug", type: "checkbox" }, "n_predict", "repeat_last_n", "repeat_penalty", "top_k", "top_p", "temp", "seed"].map((key) => {
|
const fields = [{ key: "debug", type: "checkbox" }, "n_predict", "repeat_last_n", "repeat_penalty", "top_k", "top_p", "temp", "seed", "threads"].map((key) => {
|
||||||
if (typeof key === "string") {
|
if (typeof key === "string") {
|
||||||
return `<div class='kv'>
|
return `<div class='kv'>
|
||||||
<label>${key}</label>
|
<label>${key}</label>
|
||||||
|
Loading…
Reference in New Issue
Block a user