A picture or 3D model is added by its name: llmgw ctl model add triposr
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>
This commit is contained in:
1 parent
52898fbb80
commit
40b8948d7d
12 files changed
+537
-36
No files matched your search
@@ -0,0 +1,99 @@
|
||||
package catalog
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Preset is a catalog entry that comes with llmgw: a model whose workflow,
|
||||
// custom nodes, packages and licence somebody has already found and tried,
|
||||
// so that adding it is naming it.
|
||||
//
|
||||
// A ComfyUI model cannot be worked out from its repository the way a GGUF
|
||||
// can: which workflow runs it, which node at which commit, which packages at
|
||||
// which ranges, and under which licence what it makes is shipped are learned
|
||||
// by running it. Written in a document, they were copied by hand on every
|
||||
// site, and a line left out — the node that cuts the picture out — gave
|
||||
// meshes with their background as geometry.
|
||||
type Preset struct {
|
||||
// Makes is what it makes: pictures or meshes.
|
||||
Makes string
|
||||
Model Model
|
||||
}
|
||||
|
||||
// Presets are the entries that come with llmgw, by name. Each profile says
|
||||
// the card it needs rather than naming a class, so the entry places on any
|
||||
// site's cards.
|
||||
func Presets() []Preset {
|
||||
yes := true
|
||||
return []Preset{
|
||||
{
|
||||
Makes: OutputPictures,
|
||||
Model: Model{
|
||||
Name: "flux-schnell",
|
||||
Description: "FLUX.1 [schnell]: pictures from a prompt, in four steps",
|
||||
Source: "hf:Comfy-Org/flux1-schnell/flux1-schnell-fp8.safetensors",
|
||||
ComfyUI: &ComfyUI{Workflow: "flux-schnell"},
|
||||
License: &License{
|
||||
ID: "Apache-2.0", Name: "Apache-2.0", Commercial: &yes,
|
||||
URL: "https://huggingface.co/black-forest-labs/FLUX.1-schnell",
|
||||
Notice: "Made with FLUX.1 [schnell] (Black Forest Labs, Apache 2.0).",
|
||||
},
|
||||
Scaling: Scaling{Min: 0, Max: 1, IdleTimeout: 15 * time.Minute},
|
||||
// The checkpoint is 17 GB with its text encoders; a card with
|
||||
// no fp8 has its weights upcast as they load.
|
||||
Profiles: []Profile{{Name: "gpu", Engine: EngineComfyUI, TP: 1,
|
||||
GPU: &GPUNeed{MinComputeCapability: 7.0, MinMemoryGB: 24}}},
|
||||
},
|
||||
},
|
||||
{
|
||||
Makes: OutputMeshes,
|
||||
Model: Model{
|
||||
Name: "triposr",
|
||||
Description: "TripoSR: a 3D model (GLB) from a picture of one object on a plain background, as a job",
|
||||
Source: "hf:stabilityai/TripoSR/model.ckpt",
|
||||
ComfyUI: &ComfyUI{
|
||||
Workflow: "triposr",
|
||||
Output: OutputMeshes,
|
||||
Nodes: []CustomNode{{
|
||||
Repo: "https://github.com/flowtyone/ComfyUI-Flowty-TripoSR",
|
||||
Commit: "a0c94ac60a7cc062604f61aeeea6d0d493521de3",
|
||||
// transformers 5 renames the checkpoint's keys; rembg
|
||||
// and onnxruntime cut out a picture with no alpha.
|
||||
Requirements: []string{"omegaconf", "trimesh", "scikit-image", "imageio",
|
||||
"transformers>=4.50.3,<5", "huggingface-hub<1", "tokenizers", "rembg", "onnxruntime"},
|
||||
}},
|
||||
},
|
||||
License: &License{
|
||||
ID: "MIT", Name: "MIT", Commercial: &yes,
|
||||
URL: "https://huggingface.co/stabilityai/TripoSR/blob/main/LICENSE",
|
||||
Notice: "Made with TripoSR (Stability AI and Tripo AI, MIT). Its image encoder is " +
|
||||
"facebook/dino-vitb16 (Apache 2.0). TripoSR was trained on a filtered subset of " +
|
||||
"Objaverse, some of whose objects carry their own licences.",
|
||||
},
|
||||
Scaling: Scaling{Min: 0, Max: 1, IdleTimeout: 10 * time.Minute},
|
||||
Profiles: []Profile{{Name: "gpu", Engine: EngineComfyUI, TP: 1,
|
||||
GPU: &GPUNeed{MinComputeCapability: 7.0, MinMemoryGB: 8}}},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// PresetNamed is the preset of that name.
|
||||
func PresetNamed(name string) (Preset, bool) {
|
||||
ps := Presets()
|
||||
i := slices.IndexFunc(ps, func(p Preset) bool { return p.Model.Name == name })
|
||||
if i < 0 {
|
||||
return Preset{}, false
|
||||
}
|
||||
return ps[i], true
|
||||
}
|
||||
|
||||
// PresetNames are the presets' names, in order.
|
||||
func PresetNames() []string {
|
||||
var out []string
|
||||
for _, p := range Presets() {
|
||||
out = append(out, p.Model.Name)
|
||||
}
|
||||
return out
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package catalog
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/comfy"
|
||||
)
|
||||
|
||||
func TestEveryPresetIsACatalogEntryThatLoads(t *testing.T) {
|
||||
var models []Model
|
||||
for _, p := range Presets() {
|
||||
models = append(models, p.Model)
|
||||
}
|
||||
cat, err := New(models)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, p := range Presets() {
|
||||
m, ok := cat.Resolve(p.Model.Name)
|
||||
if !ok {
|
||||
t.Fatalf("%s is not in the catalog", p.Model.Name)
|
||||
}
|
||||
if p.Makes == OutputMeshes && !m.MakesMeshes() || p.Makes == OutputPictures && !m.MakesImages() {
|
||||
t.Errorf("%s does not make %s", m.Name, p.Makes)
|
||||
}
|
||||
// A shipped entry has its workflow inside llmgw, not in a file a
|
||||
// site would have to write.
|
||||
w, ckpt := m.ComfyWorkflow()
|
||||
if _, err := comfy.Load(w); err != nil {
|
||||
t.Errorf("%s: %v", m.Name, err)
|
||||
}
|
||||
if ckpt == "" {
|
||||
t.Errorf("%s has no checkpoint", m.Name)
|
||||
}
|
||||
if m.License == nil || m.License.ID == "" || m.License.Commercial == nil {
|
||||
t.Errorf("%s does not say its licence for a machine to match", m.Name)
|
||||
}
|
||||
for _, pr := range m.Profiles {
|
||||
if pr.GPUClass != "" || pr.GPU == nil {
|
||||
t.Errorf("%s/%s names a class: a preset fits any site's cards", m.Name, pr.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAPresetIsFoundByName(t *testing.T) {
|
||||
if p, ok := PresetNamed("triposr"); !ok || p.Model.ComfyUI.Workflow != "triposr" {
|
||||
t.Errorf("triposr: %+v %v", p, ok)
|
||||
}
|
||||
if _, ok := PresetNamed("sdxl"); ok {
|
||||
t.Error("a preset that is not there was found")
|
||||
}
|
||||
// Each call is a fresh copy: a caller changing one changes nobody's.
|
||||
a, _ := PresetNamed("triposr")
|
||||
a.Model.ComfyUI.Nodes[0].Requirements[0] = "x"
|
||||
if b, _ := PresetNamed("triposr"); b.Model.ComfyUI.Nodes[0].Requirements[0] == "x" {
|
||||
t.Error("a preset was changed by a caller")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user