flux-schnell and triposr come with llmgw as presets: their workflow, custom nodes, packages and licence as they were found and tried on the PoC, and a profile that says the card it needs rather than a class, so the entry places on any site's cards. TripoSR's workflow is built in, with the LLMGWPrepareForMesh node that keeps a picture's background out of the mesh, which the copy in the document had left out. `ctl model add PRESET` adds one, and has the nodes install ComfyUI when the cluster's settings name none; `ctl model presets` lists them; the console's add-model dialog offers them beside a definition file. A ComfyUI build is now also checked to keep its order on a Turing card, so a node's installed cu13 is not replaced by the cu126 build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
84 lines
2.5 KiB
Go
84 lines
2.5 KiB
Go
package cli
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"gitea.mynodes.xyz/ilker/llmgw/internal/agent/provision"
|
|
"gitea.mynodes.xyz/ilker/llmgw/internal/control/adminapi"
|
|
"gitea.mynodes.xyz/ilker/llmgw/internal/control/catalog"
|
|
"gitea.mynodes.xyz/ilker/llmgw/internal/settings"
|
|
)
|
|
|
|
func newModelPresetsCmd() *cobra.Command {
|
|
return &cobra.Command{
|
|
Use: "presets",
|
|
Short: "The models that come with llmgw, added by name",
|
|
Long: "Each is a catalog entry whose workflow, custom nodes, packages and licence\n" +
|
|
"were found and tried, and whose profile says the card it needs rather than\n" +
|
|
"a class, so it places on any site's cards. Add one with\n" +
|
|
"`llmgw ctl model add NAME`.",
|
|
Args: cobra.NoArgs,
|
|
RunE: func(cmd *cobra.Command, _ []string) error {
|
|
w := tabTo(cmd.OutOrStdout())
|
|
fmt.Fprintln(w, "NAME\tMAKES\tCARD\tLICENCE\tWHAT IT IS FOR")
|
|
for _, p := range catalog.Presets() {
|
|
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", p.Model.Name, p.Makes, presetCard(p.Model),
|
|
presetLicence(p.Model), p.Model.Description)
|
|
}
|
|
return w.Flush()
|
|
},
|
|
}
|
|
}
|
|
|
|
func presetCard(m catalog.Model) string {
|
|
if len(m.Profiles) == 0 || m.Profiles[0].GPU == nil {
|
|
return "—"
|
|
}
|
|
return m.Profiles[0].GPU.String()
|
|
}
|
|
|
|
func presetLicence(m catalog.Model) string {
|
|
if m.License == nil {
|
|
return "—"
|
|
}
|
|
l := m.License.Name
|
|
if c := m.License.Commercial; c != nil && !*c {
|
|
l += ", not commercial"
|
|
}
|
|
return l
|
|
}
|
|
|
|
// ensureComfyUI has the nodes install ComfyUI for a model that needs it,
|
|
// unless the cluster names a version already, or none on purpose.
|
|
func ensureComfyUI(cmd *cobra.Command, client func() *ctlClient, model string) error {
|
|
out := cmd.OutOrStdout()
|
|
path := []string{"engines", catalog.EngineComfyUI}
|
|
var cur adminapi.SettingsView
|
|
if err := client().get(cmd.Context(), "/api/v1/settings", &cur); err != nil {
|
|
return err
|
|
}
|
|
doc, err := settings.FromBytes("settings", []byte(cur.Body))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
version := provision.ComfyUIVersion()
|
|
if n := doc.Node(path); n != nil {
|
|
if n.Value == "" {
|
|
fmt.Fprintf(out, "engines.comfyui is set to none, so the nodes install no ComfyUI for it: set a version "+
|
|
"(llmgw ctl config set engines.comfyui %s) or name one installed by hand in agent.yaml\n", version)
|
|
}
|
|
return nil
|
|
}
|
|
fmt.Fprintf(out, "Nodes with an NVIDIA GPU install ComfyUI %s for it, about 10 GB each:\n", version)
|
|
if err := doc.SetYAML(path, version); err != nil {
|
|
return err
|
|
}
|
|
b, err := doc.Bytes()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return putSettings(cmd, client, cur, b, "ComfyUI for "+model)
|
|
}
|