A page for anyone in a project, built for the one who knows least: an Excel, CSV or JSONL file of questions and answers, previewed; a model; a name; who may use it; and a button. The weights to train on are found from where the model's came (a GGUF repository's base model), the card's memory from their size, the node as the one with the most free. When it is done the adapter is published by itself (a llama.cpp model's replicas replaced to load it) and is a model of its own in the chat and the API. The project's by default; its members share it wider (confirmed, and never wider than the knowledge bases its pairs came from) or delete it. One trains at a time per project. ctl train start needs only --model and --data now, and --publish publishes when done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
975 B
Go
35 lines
975 B
Go
package web
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"gitea.mynodes.xyz/ilker/llmgw/internal/store"
|
|
)
|
|
|
|
type trainData struct {
|
|
Nav Nav
|
|
User store.User
|
|
Models []string
|
|
Projects []ChatContext
|
|
CSRF string
|
|
Version string
|
|
Now string
|
|
}
|
|
|
|
// Train renders the page that customises a model: a file of questions and
|
|
// answers, a model, a button, and the trainings of the person's projects.
|
|
func Train(user store.User, models []string, projects []ChatContext, version string) http.HandlerFunc {
|
|
return func(w http.ResponseWriter, r *http.Request) {
|
|
noStore(w)
|
|
render(w, r, "train", trainData{
|
|
Nav: navFrom(r, "train"), User: user, Models: models, Projects: projects,
|
|
CSRF: csrfFor(r), Version: version, Now: time.Now().UTC().Format(time.RFC3339),
|
|
})
|
|
}
|
|
}
|
|
|
|
// SetTrain has the menu offer the page while a model can be customised.
|
|
// Asked on every page, so it must be cheap.
|
|
func (p *AccountPages) SetTrain(available func() bool) { p.train = available }
|