Nodes/Concept Steer/Train Lens (Contrastive)
ComfyUI Node

Train Lens (Contrastive)

Train a concept direction via contrastive paired-margin optimization. Provide positive texts embodying the concept and negative texts describing similar scenes WITHOUT the concept. Fast (~30s).

By Nynxz·Created 5 months ago·Updated 5 months ago· 4
Train Lens (Contrastive)
    • lens_path
    concept_namemy_concept
    positive_texts
    negative_texts
    targetzimage
    contrastive_steps500
    encoder_path
    output_dir
    protect_existingtrue
    CategoryConcept Steer

    Inputs (8)

    NameTypeDefaultDescription
    concept_nameSTRINGmy_conceptName for the concept (used in filename)
    positive_textsSTRINGTexts that EMBODY the concept (one per line). E.g. for 'cinematic': 'A dramatic chiaroscuro portrait with deep shadows and golden rim lighting'
    negative_textsSTRINGNeutral/opposite texts (one per line, same count as positive). E.g. 'A portrait with standard studio lighting and even exposure'
    targetCOMBOzimageTarget model architecture. 'zimage' = Qwen 3.4B (2560d), 'sd15' = SigLIP (768d)
    contrastive_stepsINT500500–20000Contrastive optimization steps (more = more refined)
    encoder_pathSTRINGPath to Qwen 3.4B safetensors file (for zimage target). Leave empty to use QWEN_ENCODER_PATH env var.
    output_dirSTRINGOverride output directory for the lens file
    protect_existingBOOLEANtrueIf the output lens file already exists, save as _v2, _v3, … instead of overwriting. Disable only when intentionally replacing.

    Outputs (1)

    NameTypeDescription
    lens_pathSTRING