File size: 4,990 Bytes
ace58f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
---
base_model:
- Qwen/Qwen3.8-27B
base_model_relation: finetune
license: apache-2.0
library_name: transformers
pipeline_tag: image-text-to-text
tags:
- transformers
- safetensors
- qwen3.8
- conversational
- comfyui
- fine-tuned
- sft
- unsloth
- vision-language
- mtp
---

# Qwen3.8-27B-ComfyUI

Qwen3.8-27B-ComfyUI is a fine-tuned Qwen3.8-27B model specialized for generating, editing, repairing, auditing, and explaining ComfyUI frontend/UI workflow JSON.

## Overview

```text
ComfyUI request
    -> interpret workflow intent and constraints
    -> generate, edit, repair, audit, or explain
    -> return workflow JSON or a conversational answer
```

## Capabilities

- Generate ComfyUI UI workflows from natural-language requests
- Edit existing workflows while preserving requested components
- Repair invalid, incomplete, or disconnected workflows
- Audit workflow structure, nodes, inputs, and links
- Explain workflow behavior and node interactions
- Provide raw workflow JSON or conversational ComfyUI assistance

## Quick Start

Install the required libraries:

```bash
pip install --upgrade transformers accelerate safetensors
```

```python
import torch
from transformers import AutoModelForImageTextToText, AutoProcessor

MODEL_ID = "Rom3rk/Qwen3.8-27B-ComfyUI"
ENABLE_THINKING = False

processor = AutoProcessor.from_pretrained(MODEL_ID)
model = AutoModelForImageTextToText.from_pretrained(
    MODEL_ID,
    dtype=torch.bfloat16,
    device_map="auto",
).eval()

messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "text",
                "text": (
                    "Create a ComfyUI UI workflow for an SDXL image-to-image "
                    "pipeline with a ControlNet depth branch and return the "
                    "complete loadable UI workflow JSON."
                ),
            }
        ],
    }
]

inputs = processor.apply_chat_template(
    messages,
    tokenize=True,
    add_generation_prompt=True,
    enable_thinking=ENABLE_THINKING,
    return_dict=True,
    return_tensors="pt",
).to(model.device)

with torch.inference_mode():
    generated_ids = model.generate(
        **inputs,
        max_new_tokens=4096,
        do_sample=True,
        temperature=0.7,
        top_p=0.8,
        top_k=20,
    )

new_tokens = generated_ids[:, inputs.input_ids.shape[1]:]
response = processor.batch_decode(
    new_tokens,
    skip_special_tokens=True,
    clean_up_tokenization_spaces=False,
)[0]

print(response)
```

The model uses Qwen's native chat template. Set `ENABLE_THINKING` according to the task and inference runtime rather than replacing the template.

## Usage Examples

### Workflow Generation

```text
Create a ComfyUI UI workflow for an SDXL image-to-image pipeline with a ControlNet depth branch, a two-stage sampler, and a final image-save node. Return the complete loadable UI workflow JSON.
```

### Workflow Editing

```text
Modify the following ComfyUI UI workflow to add a second ControlNet branch. Preserve the existing model, sampler settings, node positions, and unrelated links.
```

### Workflow Repair

```text
Repair the invalid links and missing required inputs in this ComfyUI UI workflow. Keep all valid nodes and settings unchanged, and return the corrected workflow JSON.
```

### Workflow Audit

```text
Audit this ComfyUI UI workflow for invalid endpoints, disconnected nodes, incompatible inputs, redundant components, and settings that conflict with the requested generation pipeline.
```

## Recommended Sampling Settings

| Mode | Temperature | Top-p | Top-k | Presence penalty |
|---|---:|---:|---:|---:|
| Thinking | 1.0 | 0.95 | 20 | 0.0 |
| Non-thinking | 0.7 | 0.80 | 20 | 1.5 |

These settings follow the recommendations published for Qwen3.8. Availability and parameter names may vary by inference runtime.

## Questions and Feedback

For questions, bug reports, workflow compatibility issues, or general feedback, please open a Discussion from this repository's **Community** tab.

When reporting a workflow issue, please include:

- Inference runtime and version
- ComfyUI version
- Relevant custom nodes
- The original prompt
- The generated workflow JSON or raw model output

## License and Attribution

This model is a modified derivative of [Qwen/Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B) and is distributed under the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). See the repository's `LICENSE` file for the full license text.

Qwen3.8 was developed by the Qwen Team. Model fine-tuning and merging used [Unsloth](https://unsloth.ai/).

## Citation

```bibtex
@misc{qwen38,
  title  = {{Qwen3.8-Max}: A New Bar for Coding and Cowork},
  author = {{Qwen Team}},
  month  = {August},
  year   = {2026},
  url    = {https://qwen.ai/blog?id=qwen3.8}
}
```

## References

- [Qwen3.8-27B](https://huggingface.co/Qwen/Qwen3.8-27B)
- [Unsloth](https://unsloth.ai/)
- [Transformers](https://huggingface.co/docs/transformers/)