Files
llmgw/internal/control/agentsvc/train.go
T
Ilker ManapandClaude Opus 5.5 79b3e9f887 LoRA adapters trained on the nodes: llmgw ctl train
A job names the catalog model the adapter is for, the safetensors weights to
train on, the node and the MiB of a card it needs, and question/answer pairs.
The control plane sends it when the node's agent is there and nothing else
trains on it; the agent trains with its installed vLLM's torch and a pinned
overlay of peft and accelerate (no second environment), as the engines'
user, on the card with that much free — beside an engine, if it leaves that
much — converts the adapter to GGUF with the installed llama.cpp's own
conversion code when the model is served by llama.cpp, and sends what it
made back in pieces, kept in the store to download. Progress, loss and peak
card memory are reported as it goes; a node that goes fails its job.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-08 20:25:57 +02:00

36 lines
1004 B
Go

package agentsvc
import (
"slices"
llmgwv1 "gitea.mynodes.xyz/ilker/llmgw/api/gen/llmgw/v1"
)
// TrainHandler is told how training jobs on the nodes go (BACKLOG F4).
type TrainHandler interface {
OnTrainStatus(node string, st *llmgwv1.TrainStatus)
OnTrainArtifact(node string, a *llmgwv1.TrainArtifact)
// OnNodeGone is a node's stream ending: a job running there ended with
// it.
OnNodeGone(node string)
}
// SetTrain gives the service what training jobs' messages go to.
func (s *Service) SetTrain(h TrainHandler) {
s.mu.Lock()
s.train = h
s.mu.Unlock()
}
func (s *Service) trainHandler() TrainHandler {
s.mu.RLock()
defer s.mu.RUnlock()
return s.train
}
// Send gives a connected node's agent a command.
func (s *Service) Send(node string, msg *llmgwv1.ControlMessage) error { return s.send(node, msg) }
// Connected is whether a node's agent holds a stream to this control plane.
func (s *Service) Connected(node string) bool { return slices.Contains(s.ConnectedNodes(), node) }