Add MOSS-Image on the Image v2 path and stop the queue calling it Klein.
The bench queue labeled every engine except Krea, Qwen, MiniMax, and LTX as Klein, and the v2 starter treated any engine other than Krea as Flux. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+65
-2
@@ -8,7 +8,7 @@ import {
|
||||
|
||||
export const IMAGE_V2_MODES = ['edit', 'compose', 'refine', 'generate', 'iterate'] as const
|
||||
export const IMAGE_V2_TASKS = ['scene', 'identity', 'outfit', 'face_lock', 'refine', 't2i'] as const
|
||||
export const IMAGE_V2_ENGINES = ['flux', 'krea'] as const
|
||||
export const IMAGE_V2_ENGINES = ['flux', 'krea', 'moss'] as const
|
||||
|
||||
export type ImageV2Mode = (typeof IMAGE_V2_MODES)[number]
|
||||
export type ImageV2Task = (typeof IMAGE_V2_TASKS)[number]
|
||||
@@ -89,6 +89,63 @@ export const IMAGE_V2_KREA_UNET_CANDIDATES = [
|
||||
] as const
|
||||
export const IMAGE_V2_KREA_CONCEPT_LORA = 'xaigen-snofs_krea_v1_3D.safetensors'
|
||||
|
||||
/** Official template speed point. 50 / CFG 3 is the slower published look. */
|
||||
export const IMAGE_V2_MOSS_STEPS = 25
|
||||
export const IMAGE_V2_MOSS_CFG = 2.5
|
||||
export const IMAGE_V2_MOSS_SHIFT = 5
|
||||
export const IMAGE_V2_MOSS_SLG_LAYER = '22'
|
||||
export const IMAGE_V2_MOSS_CLIP_TYPE = 'moss_image'
|
||||
export const IMAGE_V2_MOSS_UNET = 'moss_image_sft_int8_convrot.safetensors'
|
||||
export const IMAGE_V2_MOSS_CLIP_CANDIDATES = [
|
||||
'qwen3.5_9b_w4a8_gptq.safetensors',
|
||||
'qwen3.5_9b_int8_convrot.safetensors'
|
||||
] as const
|
||||
export const IMAGE_V2_MOSS_VAE_CANDIDATES = [
|
||||
'flux2-vae_small.safetensors',
|
||||
'flux2-vae.safetensors'
|
||||
] as const
|
||||
export const IMAGE_V2_LOOK_STORAGE_KEY = 'aigen-image-v2-look'
|
||||
|
||||
export type ImageV2EngineLook = { steps: number; cfg: number; turbo: boolean }
|
||||
|
||||
export function imageV2SamplingDefaults(engine: ImageV2Engine) {
|
||||
if (engine === 'krea') return { steps: IMAGE_V2_KREA_STEPS, cfg: IMAGE_V2_KREA_CFG }
|
||||
if (engine === 'moss') return { steps: IMAGE_V2_MOSS_STEPS, cfg: IMAGE_V2_MOSS_CFG }
|
||||
return { steps: IMAGE_V2_STEPS_DEFAULT, cfg: IMAGE_V2_CFG_DEFAULT }
|
||||
}
|
||||
|
||||
export function defaultImageV2EngineLook(engine: ImageV2Engine): ImageV2EngineLook {
|
||||
const sampling = imageV2SamplingDefaults(engine)
|
||||
return { steps: sampling.steps, cfg: sampling.cfg, turbo: false }
|
||||
}
|
||||
|
||||
function lookNumber(raw: unknown, fallback: number, min: number, max: number, step: number) {
|
||||
const value = Number(raw)
|
||||
if (!Number.isFinite(value)) return fallback
|
||||
const snapped = Math.round(value / step) * step
|
||||
const digits = step < 1 ? 1 : 0
|
||||
const rounded = Number(snapped.toFixed(digits))
|
||||
return Math.min(max, Math.max(min, rounded))
|
||||
}
|
||||
|
||||
export function readImageV2LookState(raw: unknown): {
|
||||
engine: ImageV2Engine
|
||||
looks: Record<ImageV2Engine, ImageV2EngineLook>
|
||||
} {
|
||||
const src = raw && typeof raw === 'object' ? raw as Record<string, unknown> : {}
|
||||
const looks = {} as Record<ImageV2Engine, ImageV2EngineLook>
|
||||
for (const engine of IMAGE_V2_ENGINES) {
|
||||
const row = src[engine] && typeof src[engine] === 'object' ? src[engine] as Record<string, unknown> : {}
|
||||
const fallback = defaultImageV2EngineLook(engine)
|
||||
looks[engine] = {
|
||||
steps: lookNumber(row.steps, fallback.steps, 1, 50, 1),
|
||||
cfg: lookNumber(row.cfg, fallback.cfg, 0, 20, 0.1),
|
||||
turbo: engine === 'flux' && row.turbo === true
|
||||
}
|
||||
}
|
||||
return { engine: parseImageV2Engine(src.engine, 'flux'), looks }
|
||||
}
|
||||
|
||||
export const IMAGE_V2_ROLE_HEADERS: Record<Exclude<ImageV2Task, 'scene' | 'refine' | 't2i'>, string> = {
|
||||
outfit: 'Person, face, body, pose, and background from image 1. Clothing only from image 2. Fit the outfit from image 2 to the body in image 1. Do not copy image 2’s face, body shape, or pose.',
|
||||
face_lock: 'Body, pose, and scene from image 1. Exact face from image 2.',
|
||||
@@ -106,12 +163,14 @@ export function parseImageV2Task(raw: unknown, fallback: ImageV2Task = 'scene'):
|
||||
}
|
||||
|
||||
export function parseImageV2Engine(raw: unknown, fallback: ImageV2Engine = 'flux'): ImageV2Engine {
|
||||
const value = String(raw || '').trim().toLowerCase()
|
||||
const value = String(raw || '').trim().toLowerCase().replace(/[\s_]+/g, '-')
|
||||
if (value === 'moss-image' || value === 'mossimage' || value === 'openmoss') return 'moss'
|
||||
return IMAGE_V2_ENGINES.includes(value as ImageV2Engine) ? value as ImageV2Engine : fallback
|
||||
}
|
||||
|
||||
export function imageV2WorkflowFile(mode: ImageV2Mode, engine: ImageV2Engine = 'flux', opts: { hasImage?: boolean; hasReference?: boolean } = {}) {
|
||||
const graph = imageV2GraphMode(mode, opts)
|
||||
if (engine === 'moss') return 'moss_v2_generate.json'
|
||||
if (engine === 'krea') {
|
||||
if (graph === 'generate') return 'krea_v2_generate.json'
|
||||
if (graph === 'refine') return 'krea_v2_refine.json'
|
||||
@@ -194,6 +253,7 @@ export type ImageV2PresetSettings = {
|
||||
}
|
||||
|
||||
export function imageV2ConceptLoraName(engine: ImageV2Engine, kreaConcept?: string) {
|
||||
if (engine === 'moss') return ''
|
||||
if (engine === 'krea') return String(kreaConcept || IMAGE_V2_KREA_CONCEPT_LORA || '').trim()
|
||||
return IMAGE_V2_SNOFS_LORA
|
||||
}
|
||||
@@ -202,6 +262,7 @@ export function isImageV2ConceptLora(name: string, engine?: ImageV2Engine) {
|
||||
const id = loraIdentityKey(name)
|
||||
const flux = id === loraIdentityKey(IMAGE_V2_SNOFS_LORA) || /klein_snofs/i.test(id)
|
||||
const krea = id === loraIdentityKey(IMAGE_V2_KREA_CONCEPT_LORA) || /snofs_krea/i.test(id)
|
||||
if (engine === 'moss') return false
|
||||
if (engine === 'krea') return krea
|
||||
if (engine === 'flux') return flux
|
||||
return flux || krea
|
||||
@@ -248,6 +309,7 @@ export function defaultImageV2LoraStack(opts: {
|
||||
xaigen: boolean
|
||||
kreaConcept?: string
|
||||
}): LoraStackItem[] {
|
||||
if (opts.engine === 'moss') return []
|
||||
if (opts.engine === 'krea') {
|
||||
const name = String(opts.kreaConcept || '').trim()
|
||||
if (!opts.xaigen || !name) return []
|
||||
@@ -276,6 +338,7 @@ export function mergeLegacyImageV2Loras(stack: unknown, opts: {
|
||||
consistencyClip?: number
|
||||
kreaConcept?: string
|
||||
}): LoraStackItem[] {
|
||||
if (opts.engine === 'moss') return []
|
||||
let items = filterLoraStackForImageEngine(stack, opts.engine)
|
||||
if (opts.engine === 'krea') {
|
||||
const name = String(opts.kreaConcept || '').trim()
|
||||
|
||||
@@ -115,7 +115,7 @@ export function normalizeStillSettings(raw: unknown): StillGenerationSettings |
|
||||
const mode = value.mode === 'compose' || value.mode === 'refine' || value.mode === 'generate' || value.mode === 'edit' || value.mode === 'iterate'
|
||||
? value.mode
|
||||
: undefined
|
||||
const engine = value.engine === 'krea' || value.engine === 'flux' ? value.engine : undefined
|
||||
const engine = value.engine === 'krea' || value.engine === 'flux' || value.engine === 'moss' ? value.engine : undefined
|
||||
const kind: StillGenerationKind | undefined = value.kind === 'imagev2' || mode
|
||||
? 'imagev2'
|
||||
: value.kind === 'image'
|
||||
@@ -183,7 +183,7 @@ export function stillModeLabel(still: { filename?: string; settings?: StillGener
|
||||
? 'Refine'
|
||||
: 'Edit'
|
||||
const task = settings.mode === 'compose' ? composeTaskLabel(settings.task) : ''
|
||||
const engine = settings.engine === 'krea' ? 'Krea' : settings.engine === 'flux' ? 'Flux' : ''
|
||||
const engine = settings.engine === 'krea' ? 'Krea' : settings.engine === 'moss' ? 'MOSS' : settings.engine === 'flux' ? 'Flux' : ''
|
||||
return [engine ? `Image v2 · ${mode} · ${engine}` : `Image v2 · ${mode}`, task].filter(Boolean).join(' · ')
|
||||
}
|
||||
if (settings?.kind === 'image') return 'Image edit'
|
||||
@@ -217,7 +217,7 @@ export function stillSettingsRows(still: {
|
||||
rows.push({ label: 'Output', value: `${still.width}×${still.height}` })
|
||||
}
|
||||
if (settings.engine) {
|
||||
rows.push({ label: 'Engine', value: settings.engine === 'krea' ? 'Krea' : 'Flux' })
|
||||
rows.push({ label: 'Engine', value: settings.engine === 'krea' ? 'Krea' : settings.engine === 'moss' ? 'MOSS' : 'Flux' })
|
||||
}
|
||||
const displayStack = stillDisplayLoraStack(settings)
|
||||
const { consistency } = imageV2StackSpecials(displayStack, settings.engine)
|
||||
|
||||
+11
-5
@@ -261,19 +261,23 @@ export function imageLoraEngineOf(name: string): 'flux' | 'krea' | null {
|
||||
return null
|
||||
}
|
||||
|
||||
export function loraMatchesImageEngine(name: string, engine: 'flux' | 'krea') {
|
||||
export function loraMatchesImageEngine(name: string, engine: 'flux' | 'krea' | 'moss') {
|
||||
if (engine === 'moss') return false
|
||||
return imageLoraEngineOf(name) === engine
|
||||
}
|
||||
|
||||
export function filterLorasForImageEngine(names: string[], engine: 'flux' | 'krea') {
|
||||
export function filterLorasForImageEngine(names: string[], engine: 'flux' | 'krea' | 'moss') {
|
||||
if (engine === 'moss') return []
|
||||
return names.filter(name => loraMatchesImageEngine(name, engine))
|
||||
}
|
||||
|
||||
export function filterLoraStackForImageEngine(stack: unknown, engine: 'flux' | 'krea') {
|
||||
export function filterLoraStackForImageEngine(stack: unknown, engine: 'flux' | 'krea' | 'moss') {
|
||||
if (engine === 'moss') return []
|
||||
return normalizeLoraStack(stack).filter(item => loraMatchesImageEngine(item.name, engine))
|
||||
}
|
||||
|
||||
export function imageLoraEngineMismatchMessage(name: string, engine: 'flux' | 'krea') {
|
||||
export function imageLoraEngineMismatchMessage(name: string, engine: 'flux' | 'krea' | 'moss') {
|
||||
if (engine === 'moss') return `${loraDisplayName(name)} cannot be used with MOSS-Image.`
|
||||
const other = engine === 'krea' ? 'Flux' : 'Krea'
|
||||
const current = engine === 'krea' ? 'Krea' : 'Flux'
|
||||
return `${loraDisplayName(name)} is a ${other} LoRA and cannot be used with ${current}.`
|
||||
@@ -283,7 +287,7 @@ export function kleinLoraOnKreaMessage(name: string) {
|
||||
return imageLoraEngineMismatchMessage(name, 'krea')
|
||||
}
|
||||
|
||||
export type LoraUse = 'minimax' | 'ltx' | 'flux' | 'krea' | 'qwen21'
|
||||
export type LoraUse = 'minimax' | 'ltx' | 'flux' | 'krea' | 'qwen21' | 'moss'
|
||||
|
||||
export function isSystemGraphLora(name: string) {
|
||||
const id = loraIdentityKey(name)
|
||||
@@ -313,12 +317,14 @@ export function isQwenImageLora(name: string) {
|
||||
|
||||
export function loraMatchesUse(name: string, use: LoraUse) {
|
||||
if (isSystemGraphLora(name)) return false
|
||||
if (use === 'moss') return false
|
||||
if (use === 'qwen21') return isQwenImageLora(name)
|
||||
return !!inferLoraUse(name)?.includes(use)
|
||||
}
|
||||
|
||||
/** Saved stacks may contain unlabelled adapters; never carry a known wrong engine. */
|
||||
export function filterLoraStackForUse(stack: unknown, use: LoraUse, xaigen: boolean) {
|
||||
if (use === 'moss') return []
|
||||
if (use === 'ltx' && !xaigen) return []
|
||||
return filterLoraStackForStudio(stack, xaigen).filter(item => {
|
||||
if (isSystemGraphLora(item.name)) return false
|
||||
|
||||
Reference in New Issue
Block a user