Compare commits
528
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
77a6b5cd41 | ||
|
|
1287555f3c | ||
|
|
d578a62677 | ||
|
|
20c69ebf16 | ||
|
|
a2560ea727 | ||
|
|
8b2a36c185 | ||
|
|
d05d7021c3 | ||
|
|
06b7f5129f | ||
|
|
d99f8a7331 | ||
|
|
d0ecbd4131 | ||
|
|
4178b4facc | ||
|
|
4371e74fad | ||
|
|
da2061a8a5 | ||
|
|
6c22ae9136 | ||
|
|
87abc2aa6b | ||
|
|
2b4df4c83a | ||
|
|
1f5a28035b | ||
|
|
c36f0d1c4f | ||
|
|
84a3414d89 | ||
|
|
4a2d33166b | ||
|
|
433a1e337f | ||
|
|
b79c8b9dea | ||
|
|
1ac2d581ac | ||
|
|
4b48b74f47 | ||
|
|
3899931560 | ||
|
|
7d86208531 | ||
|
|
7b2f872f32 | ||
|
|
b3325897a3 | ||
|
|
db160d2360 | ||
|
|
08f63ca950 | ||
|
|
ccb9525201 | ||
|
|
f3f1740b6c | ||
|
|
2d4ca16768 | ||
|
|
551ecade95 | ||
|
|
4e741f367e | ||
|
|
a9a25f247d | ||
|
|
c5d78bf682 | ||
|
|
fb3cb8b6c0 | ||
|
|
a0c1b0d863 | ||
|
|
645e473cb7 | ||
|
|
a9a04bafe9 | ||
|
|
d481343cbb | ||
|
|
d54067e736 | ||
|
|
2f9b574a82 | ||
|
|
fa0fb562d9 | ||
|
|
c5aef4d036 | ||
|
|
a1eb7957ba | ||
|
|
5651f53bfc | ||
|
|
c933dc1ccc | ||
|
|
44110e6b2d | ||
|
|
df5191de9c | ||
|
|
65131b2024 | ||
|
|
da823ccb57 | ||
|
|
872f5d5942 | ||
|
|
6a23293f2f | ||
|
|
21e22d89b4 | ||
|
|
83ef80cc4b | ||
|
|
4cb8e0658c | ||
|
|
d830624b67 | ||
|
|
f92c3b9a04 | ||
|
|
e679a562f2 | ||
|
|
17d0ff9d25 | ||
|
|
80a8082e17 | ||
|
|
953325b699 | ||
|
|
2b9f3d49ef | ||
|
|
f9b5cbad90 | ||
|
|
aa5cadf527 | ||
|
|
64f7f3da7f | ||
|
|
df08c95044 | ||
|
|
8ecafa242c | ||
|
|
13007792d2 | ||
|
|
162e0e89c0 | ||
|
|
318b988c7f | ||
|
|
99a8ba2709 | ||
|
|
56c7d28577 | ||
|
|
8fa9013b81 | ||
|
|
aa90f948b7 | ||
|
|
9ca156d07e | ||
|
|
c2ca220053 | ||
|
|
36485f0907 | ||
|
|
416ec9f844 | ||
|
|
d9a41c45d7 | ||
|
|
71b66de4ac | ||
|
|
be6e31c1c9 | ||
|
|
f5254347ac | ||
|
|
fb57c1d1fb | ||
|
|
64d0f3f3c2 | ||
|
|
be36b0b547 | ||
|
|
af2e29e08b | ||
|
|
fd16cf274e | ||
|
|
35b49ad00c | ||
|
|
6aab2c6d3e | ||
|
|
7c9c9b29ce | ||
|
|
183e8a37aa | ||
|
|
b42baa0309 | ||
|
|
099f8f198f | ||
|
|
aaa256983d | ||
|
|
4d41b5a510 | ||
|
|
674506c88c | ||
|
|
b8840e66d9 | ||
|
|
8ab9e56657 | ||
|
|
9bf4f190ae | ||
|
|
405e672587 | ||
|
|
f00028cfbe | ||
|
|
970b624fcf | ||
|
|
15965ca387 | ||
|
|
1f3cfb746d | ||
|
|
c2a2c7f8d8 | ||
|
|
29a448493b | ||
|
|
5d37f9bd69 | ||
|
|
0a5298bc56 | ||
|
|
08cf3e4dd8 | ||
|
|
7cc8b5617a | ||
|
|
9e5aa39110 | ||
|
|
3fce50fd85 | ||
|
|
a7ed5de1eb | ||
|
|
9a31bd8f32 | ||
|
|
ed8c9c1261 | ||
|
|
2b15c62f6b | ||
|
|
16c87d76ed | ||
|
|
81d783d904 | ||
|
|
262f6e655c | ||
|
|
8297e94c4e | ||
|
|
2f2d2ef76d | ||
|
|
92ab1fe982 | ||
|
|
26b485d438 | ||
|
|
7896561ae5 | ||
|
|
9e26966d7b | ||
|
|
0432f6c86a | ||
|
|
3853cc675a | ||
|
|
7cb0baa06e | ||
|
|
6df454810c | ||
|
|
a766c3079e | ||
|
|
902d10350b | ||
|
|
f61cfb55fc | ||
|
|
053cb69cf5 | ||
|
|
0a140fd60e | ||
|
|
ca54ff9753 | ||
|
|
4f5fef9fa3 | ||
|
|
1713d1a924 | ||
|
|
f499dee1c7 | ||
|
|
148c6ec512 | ||
|
|
b16199b19b | ||
|
|
9c61bf5afa | ||
|
|
6731f75aa1 | ||
|
|
0d73e61b34 | ||
|
|
c30913007c | ||
|
|
2c451fb5fe | ||
|
|
2e2e2a5f45 | ||
|
|
0d91f542e0 | ||
|
|
7897132738 | ||
|
|
ddddcd6bb3 | ||
|
|
1fc4e8f7fd | ||
|
|
b172feff99 | ||
|
|
e9e5dac74f | ||
|
|
797a126d02 | ||
|
|
cb8f0d8844 | ||
|
|
595e4ce4b7 | ||
|
|
c17343c3bc | ||
|
|
d4df7dcbb5 | ||
|
|
c1bfb80561 | ||
|
|
38edacfec3 | ||
|
|
8d88559c21 | ||
|
|
b37138eff0 | ||
|
|
c89e678813 | ||
|
|
21588e3cd8 | ||
|
|
6e885ce98d | ||
|
|
bad8947410 | ||
|
|
69bbb23aa8 | ||
|
|
ea09ea6b53 | ||
|
|
badfe3597c | ||
|
|
1c229b1c59 | ||
|
|
c9738f904e | ||
|
|
3b484514df | ||
|
|
01c642f4c9 | ||
|
|
4efea4a7f2 | ||
|
|
dc0ed1586a | ||
|
|
fa32e0cac5 | ||
|
|
0b67b14c2d | ||
|
|
c265a8e30f | ||
|
|
39d8e8dda5 | ||
|
|
244e298fb8 | ||
|
|
8aaf970c3a | ||
|
|
271106b633 | ||
|
|
39e506c85e | ||
|
|
d295bcf0d6 | ||
|
|
4384e6ca43 | ||
|
|
37c07c294f | ||
|
|
0f9d749f51 | ||
|
|
536f111487 | ||
|
|
561ac08edb | ||
|
|
da316e461c | ||
|
|
c2dd8d9df6 | ||
|
|
b52daeff69 | ||
|
|
606985e3c8 | ||
|
|
058abdf79e | ||
|
|
4476ec8347 | ||
|
|
f422083360 | ||
|
|
64ce6956ef | ||
|
|
f5f276927f | ||
|
|
48fe00f427 | ||
|
|
226ada0148 | ||
|
|
e6f88055a9 | ||
|
|
c636c48fe8 | ||
|
|
91f28af322 | ||
|
|
b5ff30b1c3 | ||
|
|
ef8de26bfb | ||
|
|
b478719a59 | ||
|
|
f20d281d5d | ||
|
|
0359bc8cff | ||
|
|
b12ab8e52b | ||
|
|
7cbce4ea75 | ||
|
|
665119a770 | ||
|
|
21e52b37a4 | ||
|
|
4b3606214e | ||
|
|
bd53d7087b | ||
|
|
8615809506 | ||
|
|
fd9bcc4181 | ||
|
|
ce979c10d1 | ||
|
|
c082acaae9 | ||
|
|
952c93d072 | ||
|
|
a4c3797fc2 | ||
|
|
ce8047b95d | ||
|
|
be39df191a | ||
|
|
23a93e9452 | ||
|
|
8096b4437f | ||
|
|
c81ce9d873 | ||
|
|
39c30db67c | ||
|
|
93c5543a62 | ||
|
|
6063f49359 | ||
|
|
3f891ae03b | ||
|
|
fa2a921990 | ||
|
|
b6b67e009b | ||
|
|
8f0646a504 | ||
|
|
8e9350162c | ||
|
|
e1c9969392 | ||
|
|
209ff283ce | ||
|
|
21f879064a | ||
|
|
e41f1747a2 | ||
|
|
816fc31bc3 | ||
|
|
80ad9bd0ce | ||
|
|
f1198266a9 | ||
|
|
ea637ebab2 | ||
|
|
53df9f029a | ||
|
|
c21822908a | ||
|
|
ceb3333ded | ||
|
|
ace443142b | ||
|
|
1f6b5a5c77 | ||
|
|
9c908c6ce0 | ||
|
|
b60aa3cc1d | ||
|
|
e6752829b8 | ||
|
|
bfb06a75b9 | ||
|
|
a9ba81b12b | ||
|
|
f30974f287 | ||
|
|
afea4d832a | ||
|
|
fb41d35803 | ||
|
|
e87a0c66c3 | ||
|
|
2ea3800bc2 | ||
|
|
6295b19ecb | ||
|
|
f2ab3302ab | ||
|
|
fbf7d828ec | ||
|
|
159478fe9e | ||
|
|
6908339d60 | ||
|
|
9a840a0e60 | ||
|
|
9ce5aaee5e | ||
|
|
97b8c4f139 | ||
|
|
cad4d98c49 | ||
|
|
20300ddb78 | ||
|
|
357a699f25 | ||
|
|
08f41e2ef7 | ||
|
|
ca71aabc41 | ||
|
|
9a937edea8 | ||
|
|
99b4f27938 | ||
|
|
05abe57102 | ||
|
|
403ae8d7df | ||
|
|
0c707f80a6 | ||
|
|
7da880f0db | ||
|
|
6d96bb162b | ||
|
|
70b35ac75f | ||
|
|
bf5a3dfe4c | ||
|
|
17843dea5e | ||
|
|
c76ae2fef6 | ||
|
|
f8b7e9717c | ||
|
|
db2a30b9b4 | ||
|
|
6ebf0579e6 | ||
|
|
6b217ec6c7 | ||
|
|
83e3936ed2 | ||
|
|
67acb8eecc | ||
|
|
a867b9cf85 | ||
|
|
3725de6dc8 | ||
|
|
a0e9888aa4 | ||
|
|
79d02907f1 | ||
|
|
ebe6bbac65 | ||
|
|
3573be39f1 | ||
|
|
088cb7777e | ||
|
|
2dec3c7c40 | ||
|
|
ed6c9aad4a | ||
|
|
703e40f4c6 | ||
|
|
3950dcf3af | ||
|
|
afd6d1ae50 | ||
|
|
2a70e4f872 | ||
|
|
e6bb91a854 | ||
|
|
818fcaaab1 | ||
|
|
39a39098c9 | ||
|
|
2991f7ec1e | ||
|
|
bd5bce3b78 | ||
|
|
366f710bd5 | ||
|
|
dc6e8cd2a3 | ||
|
|
233bfa897f | ||
|
|
3704ee423f | ||
|
|
c1bc9e31fe | ||
|
|
7a1820a95b | ||
|
|
55732bfe14 | ||
|
|
91798defc7 | ||
|
|
c29b45a34b | ||
|
|
7e75cb64df | ||
|
|
b2651a51a8 | ||
|
|
290e19007a | ||
|
|
db74ea6394 | ||
|
|
6494929ca5 | ||
|
|
02e19fcebe | ||
|
|
3ca61dacf9 | ||
|
|
644b230410 | ||
|
|
f817e4eb81 | ||
|
|
e622e045de | ||
|
|
68908817c0 | ||
|
|
685dc3cbcc | ||
|
|
d6588708c5 | ||
|
|
9643af90f6 | ||
|
|
addd0d2154 | ||
|
|
59afef47ff | ||
|
|
4486525250 | ||
|
|
8af7aebc6c | ||
|
|
858960bf9b | ||
|
|
c8ab9ba7d2 | ||
|
|
cbbe9695c6 | ||
|
|
7d37e6b0cf | ||
|
|
4cf0c6a609 | ||
|
|
fbb56e2ffd | ||
|
|
4ce237d8a0 | ||
|
|
fbb06bc15e | ||
|
|
eb2d1f9bde | ||
|
|
235b2ccb7e | ||
|
|
00dd008d07 | ||
|
|
cd268b6289 | ||
|
|
df2a309146 | ||
|
|
455ef1358b | ||
|
|
87525a2cbb | ||
|
|
af026764dc | ||
|
|
e41bd104a0 | ||
|
|
399fe1d801 | ||
|
|
7b49bbd213 | ||
|
|
a6d98c9244 | ||
|
|
b7133a5521 | ||
|
|
50bc33178d | ||
|
|
2773f44cc1 | ||
|
|
e8041c1210 | ||
|
|
37b0428572 | ||
|
|
f83087d494 | ||
|
|
7039eb4bc2 | ||
|
|
8fccf74ff5 | ||
|
|
48cfc51f50 | ||
|
|
79693a337e | ||
|
|
6619d19a32 | ||
|
|
5f5af1be77 | ||
|
|
67b94d2360 | ||
|
|
baefe92076 | ||
|
|
0b8e8450cf | ||
|
|
dbec3ac4d2 | ||
|
|
d820d09dce | ||
|
|
fd278bf006 | ||
|
|
40478a049c | ||
|
|
fa208d2b3a | ||
|
|
8fcf20904f | ||
|
|
94e21e3fe6 | ||
|
|
95015ce8a2 | ||
|
|
5ffcbc8e05 | ||
|
|
89ce688eba | ||
|
|
77c43895c1 | ||
|
|
5f7dc3b914 | ||
|
|
2837d2e940 | ||
|
|
056c2de198 | ||
|
|
b1951b8ca6 | ||
|
|
ef1cd3df9f | ||
|
|
f15ad58e7e | ||
|
|
44fe570b21 | ||
|
|
b85a23a404 | ||
|
|
e01e376323 | ||
|
|
baed844040 | ||
|
|
63d36b00fb | ||
|
|
b1c6315b95 | ||
|
|
dbdf3fd664 | ||
|
|
e199051340 | ||
|
|
b6673541e5 | ||
|
|
5f8ca110c2 | ||
|
|
efc98134c6 | ||
|
|
b7a0b9b66e | ||
|
|
584128128a | ||
|
|
0d6b629826 | ||
|
|
d2ba0ab46c | ||
|
|
a16a7b12d8 | ||
|
|
33c5787776 | ||
|
|
090f16bfb8 | ||
|
|
f0b2012622 | ||
|
|
b8881dbf85 | ||
|
|
c646b21d07 | ||
|
|
1503fbeec1 | ||
|
|
8967e175a6 | ||
|
|
9be76a9fae | ||
|
|
4c5f163b45 | ||
|
|
7263c98d5e | ||
|
|
71e0e0573f | ||
|
|
1903ac9f96 | ||
|
|
13ce62c844 | ||
|
|
9d9865cc97 | ||
|
|
4557e3bbb5 | ||
|
|
872f508a86 | ||
|
|
ed01da8d36 | ||
|
|
a6c9eb4e7a | ||
|
|
fd837874e2 | ||
|
|
f092b7ba68 | ||
|
|
2ed2eda500 | ||
|
|
5da08d13ed | ||
|
|
e76cacfd4a | ||
|
|
c757b1dae8 | ||
|
|
759254a24e | ||
|
|
acdeff88bf | ||
|
|
3d313d7204 | ||
|
|
b072f1374e | ||
|
|
99fd6e2206 | ||
|
|
0bfca4c67d | ||
|
|
b215d91f24 | ||
|
|
cc99c24c81 | ||
|
|
87fea25596 | ||
|
|
12a200baf9 | ||
|
|
deb213f8f5 | ||
|
|
bbc8f977a7 | ||
|
|
31478f8ab4 | ||
|
|
41796cdc79 | ||
|
|
4cc05feecf | ||
|
|
66931f74fa | ||
|
|
ac9c62615d | ||
|
|
a4b4c58897 | ||
|
|
04f79708da | ||
|
|
1e5c31f9b2 | ||
|
|
e47ca3f362 | ||
|
|
d6ef6141e4 | ||
|
|
05919690d8 | ||
|
|
a70b2a30ba | ||
|
|
4ab75e023d | ||
|
|
42f5468553 | ||
|
|
16e846b3a4 | ||
|
|
bc944a0747 | ||
|
|
7546e62417 | ||
|
|
80663a78b8 | ||
|
|
4e937d11f7 | ||
|
|
4eb08dbfb6 | ||
|
|
6a379c8073 | ||
|
|
8ce785fe26 | ||
|
|
c61021bc9a | ||
|
|
cbf3054cd4 | ||
|
|
a6b395bbf5 | ||
|
|
b246e276a0 | ||
|
|
3a1cf8029f | ||
|
|
10036dc092 | ||
|
|
78c7e66fd7 | ||
|
|
d46a6ad658 | ||
|
|
69be46f0da | ||
|
|
479fac5f4e | ||
|
|
a210707f02 | ||
|
|
12fca1825e | ||
|
|
91658f400e | ||
|
|
b8b535dbbf | ||
|
|
937ae462df | ||
|
|
dff87f5bd4 | ||
|
|
7cff17bac7 | ||
|
|
89a074f9dd | ||
|
|
7443abf25c | ||
|
|
d4ae02ab53 | ||
|
|
91f3015a70 | ||
|
|
b1057fa817 | ||
|
|
e5a36eb6e8 | ||
|
|
d37afca1f0 | ||
|
|
bcd60ad4ab | ||
|
|
447a589cc2 | ||
|
|
d05a619bb1 | ||
|
|
f8c9c73e3a | ||
|
|
fb02f92745 | ||
|
|
9025225b6d | ||
|
|
a5eafdf2f4 | ||
|
|
cde44c1c46 | ||
|
|
fa88e26b10 | ||
|
|
5d820f3395 | ||
|
|
b0f1c5ffa9 | ||
|
|
ead63de184 | ||
|
|
ac3f520670 | ||
|
|
f212e92530 | ||
|
|
5453da1cc8 | ||
|
|
0770636cc7 | ||
|
|
2855c355d1 | ||
|
|
2edda521f7 | ||
|
|
5a8a92f972 | ||
|
|
317f2fe51e | ||
|
|
17d662aca9 | ||
|
|
1c32723e74 | ||
|
|
c7ab111a94 | ||
|
|
7ab7391cca | ||
|
|
1df3d343c9 | ||
|
|
6aa9b8e86d | ||
|
|
b1bba53c53 | ||
|
|
a15dfe46d0 | ||
|
|
3ac6859b11 | ||
|
|
1e151ce829 | ||
|
|
50d20f34e9 | ||
|
|
573f2a26d9 | ||
|
|
6ed2bf1e55 | ||
|
|
0592d1c29d | ||
|
|
a936b602af | ||
|
|
4085577688 | ||
|
|
c12dfad592 | ||
|
|
2b11745597 | ||
|
|
8349b5ba61 | ||
|
|
a73347b89e | ||
|
|
fd8ead1eae | ||
|
|
13cc525d87 | ||
|
|
25a6bcef21 | ||
|
|
03bc8c13e1 | ||
|
|
71a3df9859 |
@@ -1,93 +0,0 @@
|
||||
# Borrowed from https://github.com/sgl-project/sglang/blob/main/.github/workflows/close-inactive-issues.yml
|
||||
name: Close Inactive Issues
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
permissions:
|
||||
issues: write
|
||||
contents: read
|
||||
jobs:
|
||||
close-inactive-issues:
|
||||
if: github.repository == '1038lab/ComfyUI-QwenVL'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check and close inactive issues
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
const thirtyDaysAgo = new Date(Date.now() - 30 * 24 * 60 * 60 * 1000);
|
||||
|
||||
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
|
||||
console.log(`Owner: ${owner}, Repo: ${repo}`);
|
||||
|
||||
async function fetchIssues(page = 1) {
|
||||
console.log(`Fetching issues for ${owner}/${repo}, page ${page}`);
|
||||
return await github.rest.issues.listForRepo({
|
||||
owner,
|
||||
repo,
|
||||
state: 'open',
|
||||
sort: 'updated',
|
||||
direction: 'asc',
|
||||
per_page: 100,
|
||||
page: page
|
||||
});
|
||||
}
|
||||
|
||||
async function processIssues() {
|
||||
console.log('Starting to process issues');
|
||||
console.log(`Repository: ${owner}/${repo}`);
|
||||
|
||||
let page = 1;
|
||||
let hasMoreIssues = true;
|
||||
while (hasMoreIssues) {
|
||||
try {
|
||||
const issues = await fetchIssues(page);
|
||||
console.log(`Fetched ${issues.data.length} issues on page ${page}`);
|
||||
|
||||
if (issues.data.length === 0) {
|
||||
hasMoreIssues = false;
|
||||
break;
|
||||
}
|
||||
|
||||
for (const issue of issues.data) {
|
||||
// Skip if the issue has 'good first issue' label
|
||||
if (issue.labels.some(label => label.name === 'good first issue')) {
|
||||
console.log(`Skipping issue #${issue.number} as it's marked as 'good first issue'`);
|
||||
continue;
|
||||
}
|
||||
if (new Date(issue.updated_at) < thirtyDaysAgo) {
|
||||
try {
|
||||
await github.rest.issues.update({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issue.number,
|
||||
state: 'closed',
|
||||
labels: [...issue.labels.map(l => l.name), 'inactive']
|
||||
});
|
||||
await github.rest.issues.createComment({
|
||||
owner,
|
||||
repo,
|
||||
issue_number: issue.number,
|
||||
body: 'This issue has been automatically closed due to 30-day inactivity. Please feel free to reopen it with \`/reopen\` if needed.'
|
||||
});
|
||||
console.log(`Closed issue #${issue.number} due to inactivity.`);
|
||||
} catch (error) {
|
||||
console.error(`Failed to close issue #${issue.number}: ${error.message}`);
|
||||
}
|
||||
} else {
|
||||
console.log(`Issue #${issue.number} is still active. Stopping processing.`);
|
||||
hasMoreIssues = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
page += 1;
|
||||
} catch (error) {
|
||||
console.error(`Error fetching issues on page ${page}: ${error.message}`);
|
||||
hasMoreIssues = false;
|
||||
}
|
||||
}
|
||||
console.log('Finished processing issues');
|
||||
}
|
||||
|
||||
await processIssues();
|
||||
@@ -1,25 +0,0 @@
|
||||
name: Publish to Comfy registry
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- "pyproject.toml"
|
||||
|
||||
permissions:
|
||||
issues: write
|
||||
|
||||
jobs:
|
||||
publish-node:
|
||||
name: Publish Custom Node to registry
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.repository_owner == '1038lab' }}
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v4
|
||||
- name: Publish Custom Node
|
||||
uses: Comfy-Org/publish-node-action@v1
|
||||
with:
|
||||
## Add your own personal access token to your Github Repository secrets and reference it here.
|
||||
personal_access_token: ${{ secrets.REGISTRY_ACCESS_TOKEN }}
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
.DS_S# ComfyUI-QwenVL-Mod Git Ignore File
|
||||
|
||||
# Python
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*.pyc
|
||||
*$py.class
|
||||
*.so
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# Virtual environments
|
||||
venv/
|
||||
env/
|
||||
ENV/
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# OS
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
._*
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# Logs
|
||||
*.log
|
||||
logs/
|
||||
|
||||
# ComfyUI specific
|
||||
models/
|
||||
input/
|
||||
output/
|
||||
temp/
|
||||
*.png
|
||||
*.jpg
|
||||
*.jpeg
|
||||
*.gif
|
||||
*.webp
|
||||
*.mp4
|
||||
*.avi
|
||||
*.mov
|
||||
*.webm
|
||||
|
||||
# Docker
|
||||
.dockerignore
|
||||
Dockerfile*
|
||||
docker-compose*.yml
|
||||
|
||||
# Node modules
|
||||
node_modules/
|
||||
npm-debug.log*
|
||||
|
||||
# Jupyter
|
||||
.ipynb_checkpoints/
|
||||
|
||||
# Prompt cache files
|
||||
prompt_cache.json
|
||||
|
||||
# Personal build scripts and backups (don't commit to shared repo)
|
||||
build-and-push-4090.sh
|
||||
build-and-push-5090.sh
|
||||
vastai/
|
||||
|
||||
# API consulting tools (keep local for client work)
|
||||
API_GUIDE.md
|
||||
debug_api.py
|
||||
api_client_examples/
|
||||
consulting/
|
||||
client_work/
|
||||
+525
-48
@@ -18,13 +18,166 @@ import json
|
||||
import platform
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
import hashlib
|
||||
|
||||
import numpy as np
|
||||
import psutil
|
||||
import torch
|
||||
from PIL import Image
|
||||
from huggingface_hub import snapshot_download
|
||||
from transformers import AutoModelForVision2Seq, AutoProcessor, AutoTokenizer, BitsAndBytesConfig
|
||||
from transformers import AutoProcessor, AutoTokenizer, BitsAndBytesConfig
|
||||
|
||||
# SageAttention support
|
||||
try:
|
||||
from sageattention.core import (
|
||||
sageattn_qk_int8_pv_fp16_cuda,
|
||||
sageattn_qk_int8_pv_fp8_cuda,
|
||||
sageattn_qk_int8_pv_fp8_cuda_sm90,
|
||||
)
|
||||
SAGE_ATTENTION_AVAILABLE = True
|
||||
except ImportError:
|
||||
SAGE_ATTENTION_AVAILABLE = False
|
||||
|
||||
# Global cache for generated prompts
|
||||
PROMPT_CACHE = {}
|
||||
CACHE_FILE = Path(__file__).parent / "prompt_cache.json"
|
||||
|
||||
# Simple global variable to store last generated prompt
|
||||
LAST_SAVED_PROMPT = None
|
||||
|
||||
def load_prompt_cache():
|
||||
"""Load prompt cache from file"""
|
||||
global PROMPT_CACHE
|
||||
try:
|
||||
if CACHE_FILE.exists():
|
||||
with open(CACHE_FILE, "r", encoding="utf-8") as f:
|
||||
PROMPT_CACHE = json.load(f)
|
||||
print(f"[QwenVL] Loaded {len(PROMPT_CACHE)} cached prompts")
|
||||
except Exception as e:
|
||||
print(f"[QwenVL] Failed to load prompt cache: {e}")
|
||||
PROMPT_CACHE = {}
|
||||
|
||||
def save_prompt_cache():
|
||||
"""Save prompt cache to file"""
|
||||
try:
|
||||
with open(CACHE_FILE, "w", encoding="utf-8") as f:
|
||||
json.dump(PROMPT_CACHE, f, indent=2)
|
||||
except Exception as e:
|
||||
print(f"[QwenVL] Failed to save prompt cache: {e}")
|
||||
|
||||
def get_cache_key(model_name, preset_prompt, custom_prompt, image_hash=None, video_hash=None, seed=None):
|
||||
"""Generate cache key from inputs"""
|
||||
key_data = {
|
||||
"model": model_name,
|
||||
"preset": preset_prompt,
|
||||
"custom": custom_prompt.strip() if custom_prompt else "",
|
||||
"image": image_hash,
|
||||
"video": video_hash,
|
||||
"seed": seed # Always include seed to ensure proper caching behavior
|
||||
}
|
||||
# Create deterministic hash
|
||||
key_str = json.dumps(key_data, sort_keys=True)
|
||||
return hashlib.md5(key_str.encode()).hexdigest()
|
||||
|
||||
def get_alternative_cache_key(model_name, preset_prompt, custom_prompt, image_hash=None, video_hash=None, seed=None, module_name="QwenVL"):
|
||||
"""Generate alternative cache key for fixed seed mode to find random prompts"""
|
||||
# Only for fixed seed mode (when user wants consistent prompts)
|
||||
# We consider any seed that the user keeps fixed as "fixed seed mode"
|
||||
|
||||
print(f"[{module_name} DEBUG] Searching through cache for model={model_name}, preset={preset_prompt}")
|
||||
|
||||
# Try to find any cached prompt with same model/preset/custom/image but different seed
|
||||
for cached_key, cached_data in PROMPT_CACHE.items():
|
||||
cached_model = cached_data.get("model")
|
||||
cached_preset = cached_data.get("preset")
|
||||
cached_seed = cached_data.get("seed")
|
||||
|
||||
print(f"[{module_name} DEBUG] Checking entry: model={cached_model}, preset={cached_preset}, seed={cached_seed}")
|
||||
|
||||
if (cached_model == model_name and
|
||||
cached_preset == preset_prompt and
|
||||
cached_seed != seed): # Different seed
|
||||
|
||||
# Generate the cache key that would have been created for this cached data
|
||||
# to check if image/video hashes match
|
||||
cached_image_hash = cached_data.get("image_hash")
|
||||
cached_video_hash = cached_data.get("video_hash")
|
||||
|
||||
print(f"[{module_name} DEBUG] Found potential match with hashes: image={cached_image_hash}, video={cached_video_hash}")
|
||||
|
||||
# If the cached data doesn't have hash info, try to match by other criteria
|
||||
if cached_image_hash is None and cached_video_hash is None:
|
||||
# Fallback: if both current and cached have no image/video, consider it a match
|
||||
if image_hash is None and video_hash is None:
|
||||
print(f"[{module_name} DEBUG] Match found (no images/videos)!")
|
||||
return cached_key
|
||||
else:
|
||||
# Match if hashes are the same (including None)
|
||||
if cached_image_hash == image_hash and cached_video_hash == video_hash:
|
||||
print(f"[{module_name} DEBUG] Match found (hashes match)!")
|
||||
return cached_key
|
||||
print(f"[{module_name} DEBUG] No alternative cache found")
|
||||
return None
|
||||
|
||||
def tensor_to_pil(tensor):
|
||||
"""Convert tensor to PIL Image with memory optimization"""
|
||||
if tensor is None:
|
||||
return None
|
||||
try:
|
||||
if tensor.dim() == 4:
|
||||
tensor = tensor[0]
|
||||
|
||||
# More aggressive memory management
|
||||
if tensor.is_floating_point():
|
||||
# Scale to 0-255 range more efficiently
|
||||
tensor = tensor.clamp(0, 1)
|
||||
|
||||
# Reduce sample size for memory efficiency
|
||||
array = tensor.cpu().numpy()
|
||||
if tensor.numel() > 0:
|
||||
# Take smaller sample for hash to save memory
|
||||
sample_size = min(50, tensor.numel() // 4) # Reduced from 100
|
||||
sample_pixels = array.flatten()[:sample_size].tolist() if array.size > 0 else []
|
||||
else:
|
||||
sample_pixels = []
|
||||
|
||||
content = f"{tensor.shape}_{tensor.dtype}_{sample_pixels[:10]}"
|
||||
return hashlib.md5(content.encode()).hexdigest()[:16]
|
||||
except:
|
||||
return None
|
||||
|
||||
def get_image_hash(image):
|
||||
"""Generate hash for image tensor"""
|
||||
if image is None:
|
||||
return None
|
||||
try:
|
||||
# Use image tensor properties for hash
|
||||
shape = str(image.shape)
|
||||
dtype = str(image.dtype)
|
||||
# Sample a few pixels for content hash (avoid full tensor for performance)
|
||||
if len(image.shape) >= 3:
|
||||
sample_pixels = image.flatten()[:100].tolist() if image.numel() > 0 else []
|
||||
else:
|
||||
sample_pixels = image.flatten().tolist() if image.numel() > 0 else []
|
||||
|
||||
content = f"{shape}_{dtype}_{sample_pixels[:10]}" # Limit sample size
|
||||
return hashlib.md5(content.encode()).hexdigest()[:16]
|
||||
except:
|
||||
return None
|
||||
|
||||
def get_video_hash(video):
|
||||
"""Generate hash for video tensor (same as image)"""
|
||||
return get_image_hash(video)
|
||||
|
||||
# Load cache on module import
|
||||
load_prompt_cache()
|
||||
try:
|
||||
from transformers import AutoModelForVision2Seq
|
||||
except ImportError:
|
||||
from transformers import AutoModelForImageTextToText as AutoModelForVision2Seq
|
||||
|
||||
# Export memory functions for external use
|
||||
__all__ = ['PROMPT_CACHE', 'get_cache_key', 'get_alternative_cache_key', 'save_prompt_cache', 'get_image_hash', 'get_video_hash', 'check_pytorch_memory', 'set_pytorch_memory_fraction', 'get_device_info', 'tensor_to_pil', 'get_video_hash', 'enforce_memory', 'quantization_config', 'ensure_model', 'resolve_attention_mode', 'flash_attn_available', 'normalize_device_choice', 'load_model_configs', 'HF_VL_MODELS', 'HF_TEXT_MODELS', 'HF_ALL_MODELS', 'SYSTEM_PROMPTS', 'PRESET_PROMPTS', 'TOOLTIPS', 'Quantization', 'ATTENTION_MODES', 'NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
|
||||
|
||||
import folder_paths
|
||||
|
||||
@@ -37,13 +190,12 @@ HF_ALL_MODELS: dict[str, dict] = {}
|
||||
SYSTEM_PROMPTS = {}
|
||||
PRESET_PROMPTS: list[str] = ["Describe this image in detail."]
|
||||
|
||||
|
||||
TOOLTIPS = {
|
||||
"model_name": "Pick the Qwen-VL checkpoint. First run downloads weights into models/LLM/Qwen-VL, so leave disk space.",
|
||||
"quantization": "Precision vs VRAM. FP16 gives the best quality if memory allows; 8-bit suits 8–16 GB GPUs; 4-bit fits 6 GB or lower but is slower.",
|
||||
"attention_mode": "auto tries flash-attn v2 when installed and falls back to SDPA. Only override when debugging attention backends.",
|
||||
"attention_mode": "auto tries SageAttention → FlashAttention 2 → SDPA in order. SDPA is stable and recommended. Only override when debugging attention backends.",
|
||||
"preset_prompt": "Built-in instruction describing how Qwen-VL should analyze the media input.",
|
||||
"custom_prompt": "Optional override—when filled it completely replaces the preset template.",
|
||||
"custom_prompt": "Additional user input that gets combined with the preset template. Leave empty to use only the template.",
|
||||
"max_tokens": "Maximum number of new tokens to decode. Larger values yield longer answers but consume more time and memory.",
|
||||
"keep_model_loaded": "Keeps the model resident in VRAM/RAM after the run so the next prompt skips loading.",
|
||||
"seed": "Seed controlling sampling and frame picking; reuse it to reproduce results.",
|
||||
@@ -56,7 +208,6 @@ TOOLTIPS = {
|
||||
"frame_count": "Number of frames extracted from video inputs before prompting Qwen-VL. More frames provide context but cost time.",
|
||||
}
|
||||
|
||||
|
||||
class Quantization(str, Enum):
|
||||
Q4 = "4-bit (VRAM-friendly)"
|
||||
Q8 = "8-bit (Balanced)"
|
||||
@@ -73,9 +224,19 @@ class Quantization(str, Enum):
|
||||
return item
|
||||
raise ValueError(f"Unsupported quantization: {value}")
|
||||
|
||||
ATTENTION_MODES = ["auto", "sage", "flash_attention_2", "sdpa"]
|
||||
|
||||
ATTENTION_MODES = ["auto", "flash_attention_2", "sdpa"]
|
||||
# Debug: Check SageAttention availability
|
||||
print(f"[QwenVL Debug] SAGE_ATTENTION_AVAILABLE: {SAGE_ATTENTION_AVAILABLE}")
|
||||
if torch.cuda.is_available():
|
||||
major, minor = torch.cuda.get_device_capability()
|
||||
print(f"[QwenVL Debug] CUDA capability: {major}.{minor}")
|
||||
else:
|
||||
print("[QwenVL Debug] CUDA not available")
|
||||
print(f"[QwenVL Debug] Final ATTENTION_MODES: {ATTENTION_MODES}")
|
||||
|
||||
# Temporarily show sage option even if not available for testing
|
||||
print("[QwenVL] NOTE: SageAttention option shown for testing. Install with: pip install sageattention")
|
||||
|
||||
def load_model_configs():
|
||||
global HF_VL_MODELS, HF_TEXT_MODELS, HF_ALL_MODELS, SYSTEM_PROMPTS, PRESET_PROMPTS
|
||||
@@ -131,10 +292,59 @@ def load_model_configs():
|
||||
HF_ALL_MODELS = dict(HF_VL_MODELS)
|
||||
HF_ALL_MODELS.update(HF_TEXT_MODELS)
|
||||
|
||||
|
||||
if not HF_ALL_MODELS:
|
||||
load_model_configs()
|
||||
|
||||
def check_pytorch_memory():
|
||||
"""Check current PyTorch memory settings and allow user to set fraction"""
|
||||
try:
|
||||
import torch
|
||||
print(f"[QwenVL] PyTorch {torch.__version__}")
|
||||
print(f"[QwenVL] CUDA Available: {torch.cuda.is_available()}")
|
||||
|
||||
if torch.cuda.is_available():
|
||||
current_fraction = torch.cuda.get_per_process_memory_fraction()
|
||||
print(f"[QwenVL] Current Memory Fraction: {current_fraction:.3f} ({current_fraction*100:.1f}% of GPU)")
|
||||
print(f"[QwenVL] GPU Memory: {torch.cuda.get_device_properties(0).total_memory / 1024**3:.1f} GB")
|
||||
|
||||
# Allow user to set new fraction
|
||||
try:
|
||||
prompt = f"[QwenVL] Enter new memory fraction (0.1-0.9"
|
||||
if current_fraction is not None:
|
||||
prompt += f", current={current_fraction:.3f})"
|
||||
new_fraction = float(input(prompt + ": ") or current_fraction)
|
||||
if 0.1 <= new_fraction <= 0.9:
|
||||
torch.cuda.set_per_process_memory_fraction(new_fraction)
|
||||
print(f"[QwenVL] ✅ Memory fraction set to: {new_fraction:.3f} ({new_fraction*100:.1f}%)")
|
||||
else:
|
||||
print(f"[QwenVL] ❌ Invalid fraction. Must be between 0.1 and 0.9")
|
||||
except KeyboardInterrupt:
|
||||
print(f"[QwenVL] ✅ Keeping current fraction: {current_fraction:.3f}")
|
||||
except Exception as e:
|
||||
print(f"[QwenVL] ❌ Error setting fraction: {e}")
|
||||
else:
|
||||
print("[QwenVL] CUDA not available")
|
||||
except Exception as e:
|
||||
print(f"[QwenVL] Error checking PyTorch: {e}")
|
||||
|
||||
def set_pytorch_memory_fraction(fraction):
|
||||
"""Set PyTorch memory fraction if CUDA is available"""
|
||||
try:
|
||||
import torch
|
||||
if torch.cuda.is_available():
|
||||
if 0.1 <= fraction <= 0.9:
|
||||
torch.cuda.set_per_process_memory_fraction(fraction)
|
||||
print(f"[QwenVL] Memory fraction set to: {fraction:.3f} ({fraction*100:.1f}%)")
|
||||
return True
|
||||
else:
|
||||
print(f"[QwenVL] Invalid fraction: {fraction:.3f}. Must be between 0.1 and 0.9")
|
||||
return False
|
||||
else:
|
||||
print("[QwenVL] CUDA not available")
|
||||
return False
|
||||
except Exception as e:
|
||||
print(f"[QwenVL] Error: {e}")
|
||||
return False
|
||||
|
||||
def get_device_info():
|
||||
gpu = {"available": False, "total_memory": 0, "free_memory": 0}
|
||||
@@ -143,13 +353,29 @@ def get_device_info():
|
||||
if torch.cuda.is_available():
|
||||
props = torch.cuda.get_device_properties(0)
|
||||
total = props.total_memory / 1024**3
|
||||
allocated = torch.cuda.memory_allocated(0) / 1024**3
|
||||
reserved = torch.cuda.memory_reserved(0) / 1024**3
|
||||
free = total - allocated - reserved
|
||||
|
||||
gpu = {
|
||||
"available": True,
|
||||
"total_memory": total,
|
||||
"free_memory": total - (torch.cuda.memory_allocated(0) / 1024**3),
|
||||
"allocated_memory": allocated,
|
||||
"reserved_memory": reserved,
|
||||
"free_memory": free,
|
||||
}
|
||||
device_type = "nvidia_gpu"
|
||||
recommended = "cuda"
|
||||
|
||||
# Detailed memory debugging
|
||||
print(f"[QwenVL] GPU Memory Debug:")
|
||||
print(f" Total VRAM: {total / 1024**3:.2f} GB")
|
||||
print(f" Allocated: {allocated / 1024**3:.2f} GB")
|
||||
print(f" Reserved: {reserved / 1024**3:.2f} GB")
|
||||
print(f" Free: {free / 1024**3:.2f} GB")
|
||||
print(f" Model requires: 0.74 GB")
|
||||
print(f" Available ratio: {(free / total) * 100:.1f}%")
|
||||
|
||||
elif getattr(torch.backends, "mps", None) and torch.backends.mps.is_available():
|
||||
device_type = "apple_silicon"
|
||||
recommended = "mps"
|
||||
@@ -165,7 +391,6 @@ def get_device_info():
|
||||
"recommended_device": recommended,
|
||||
}
|
||||
|
||||
|
||||
def normalize_device_choice(device: str) -> str:
|
||||
device = (device or "auto").strip()
|
||||
if device == "auto":
|
||||
@@ -203,10 +428,7 @@ def normalize_device_choice(device: str) -> str:
|
||||
|
||||
return device
|
||||
|
||||
|
||||
def flash_attn_available():
|
||||
if platform.system() != "Linux":
|
||||
return False
|
||||
if not torch.cuda.is_available():
|
||||
return False
|
||||
|
||||
@@ -227,18 +449,87 @@ def flash_attn_available():
|
||||
|
||||
return True
|
||||
|
||||
def sage_attn_available():
|
||||
"""Check if SageAttention is available and GPU supports it."""
|
||||
if not SAGE_ATTENTION_AVAILABLE:
|
||||
return False
|
||||
if not torch.cuda.is_available():
|
||||
return False
|
||||
major, _ = torch.cuda.get_device_capability()
|
||||
if major < 8:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def get_sage_attention_config():
|
||||
"""Get the appropriate SageAttention kernel based on GPU architecture."""
|
||||
if not sage_attn_available():
|
||||
return None, None, None
|
||||
|
||||
major, minor = torch.cuda.get_device_capability()
|
||||
arch_code = major * 10 + minor
|
||||
|
||||
attn_func = None
|
||||
pv_accum_dtype = "fp32"
|
||||
|
||||
if arch_code >= 120: # Blackwell
|
||||
pv_accum_dtype = "fp32+fp32"
|
||||
attn_func = sageattn_qk_int8_pv_fp8_cuda
|
||||
print(f"[QwenVL] SageAttention: Using SM120 (Blackwell) FP8 kernel")
|
||||
elif arch_code >= 90: # Hopper
|
||||
pv_accum_dtype = "fp32+fp32"
|
||||
attn_func = sageattn_qk_int8_pv_fp8_cuda_sm90
|
||||
print(f"[QwenVL] SageAttention: Using SM90 (Hopper) FP8 kernel")
|
||||
elif arch_code == 89: # Ada Lovelace
|
||||
pv_accum_dtype = "fp32+fp32"
|
||||
attn_func = sageattn_qk_int8_pv_fp8_cuda
|
||||
print(f"[QwenVL] SageAttention: Using SM89 (Ada) FP8 kernel")
|
||||
elif arch_code >= 80: # Ampere
|
||||
pv_accum_dtype = "fp32"
|
||||
attn_func = sageattn_qk_int8_pv_fp16_cuda
|
||||
print(f"[QwenVL] SageAttention: Using SM80+ (Ampere) FP16 kernel")
|
||||
else:
|
||||
print(f"[QwenVL] SageAttention not supported on SM{arch_code}")
|
||||
return None, None, None
|
||||
|
||||
return attn_func, "per_warp", pv_accum_dtype
|
||||
|
||||
def is_fp8_model(model_name: str) -> bool:
|
||||
"""Check if model name indicates it's a pre-quantized FP8 model."""
|
||||
fp8_indicators = ["-fp8", "_fp8", "-FP8", "_FP8"]
|
||||
return any(indicator in model_name for indicator in fp8_indicators)
|
||||
|
||||
def resolve_attention_mode(mode, force_sdpa=False):
|
||||
"""Resolve attention mode with fallback logic.
|
||||
|
||||
Args:
|
||||
mode: The requested attention mode
|
||||
force_sdpa: If True, always return SDPA (for FP8/BnB models)
|
||||
"""
|
||||
if force_sdpa:
|
||||
return "sdpa"
|
||||
|
||||
def resolve_attention_mode(mode):
|
||||
if mode == "sdpa":
|
||||
return "sdpa"
|
||||
if mode == "sage":
|
||||
if sage_attn_available():
|
||||
return "sage"
|
||||
print("[QwenVL] SageAttention forced but unavailable, falling back to SDPA")
|
||||
return "sdpa"
|
||||
if mode == "flash_attention_2":
|
||||
if flash_attn_available():
|
||||
return "flash_attention_2"
|
||||
print("[QwenVL] Flash-Attn forced but unavailable, falling back to SDPA")
|
||||
return "sdpa"
|
||||
|
||||
# Auto mode: try sage → flash → sdpa
|
||||
if sage_attn_available():
|
||||
print("[QwenVL] Auto mode: Using SageAttention")
|
||||
return "sage"
|
||||
if flash_attn_available():
|
||||
print("[QwenVL] Auto mode: Using Flash Attention 2")
|
||||
return "flash_attention_2"
|
||||
print("[QwenVL] Flash-Attn auto mode: dependency not ready, using SDPA")
|
||||
print("[QwenVL] Auto mode: Using SDPA")
|
||||
return "sdpa"
|
||||
|
||||
def ensure_model(model_name):
|
||||
@@ -266,7 +557,6 @@ def ensure_model(model_name):
|
||||
snapshot_download(
|
||||
repo_id=repo_id,
|
||||
local_dir=str(target),
|
||||
local_dir_use_symlinks=False,
|
||||
ignore_patterns=["*.md", ".git*"],
|
||||
)
|
||||
return str(target)
|
||||
@@ -281,22 +571,34 @@ def enforce_memory(model_name, quantization, device_info):
|
||||
}
|
||||
needed = mapping.get(quantization, 0)
|
||||
if not needed:
|
||||
return quantization
|
||||
return quantization # Always return quantization
|
||||
|
||||
if device_info["recommended_device"] in {"cpu", "mps"}:
|
||||
needed *= 1.5
|
||||
available = device_info["system_memory"]["available"]
|
||||
else:
|
||||
available = device_info["gpu"]["free_memory"]
|
||||
if needed * 1.2 > available:
|
||||
|
||||
# More conservative memory management
|
||||
if needed * 1.5 > available: # More conservative threshold
|
||||
if quantization == Quantization.FP16:
|
||||
print("[QwenVL] Auto-switch to 8-bit due to VRAM pressure")
|
||||
print("[QwenVL] ⚠️ Auto-switch to 8-bit due to VRAM pressure")
|
||||
return Quantization.Q8
|
||||
if quantization == Quantization.Q8:
|
||||
print("[QwenVL] Auto-switch to 4-bit due to VRAM pressure")
|
||||
print("[QwenVL] ⚠️ Auto-switch to 4-bit due to VRAM pressure")
|
||||
return Quantization.Q4
|
||||
raise RuntimeError("Insufficient memory for 4-bit mode")
|
||||
return quantization
|
||||
|
||||
raise RuntimeError(f"Insufficient memory for {quantization.value} mode. Required: {needed * 1.5:.1f}GB, Available: {available / 1024**3:.1f}GB")
|
||||
|
||||
# Conservative memory check with safety margin
|
||||
if needed * 1.3 > available: # Reduced from 1.5 to 1.3
|
||||
if quantization == Quantization.FP16:
|
||||
print("[QwenVL] ⚠️ Auto-switch to 8-bit due to VRAM pressure")
|
||||
return Quantization.Q8
|
||||
if quantization == Quantization.Q8:
|
||||
print("[QwenVL] ⚠️ Auto-switch to 4-bit due to VRAM pressure")
|
||||
return Quantization.Q4
|
||||
print(f"[QwenVL] Memory pressure detected. Consider: 1) Use 4-bit quantization, 2) Reduce max_tokens below 1024, 3) Close other applications")
|
||||
return quantization # Always return quantization
|
||||
|
||||
def quantization_config(model_name, quantization):
|
||||
info = HF_ALL_MODELS.get(model_name, {})
|
||||
@@ -341,8 +643,34 @@ class QwenVLBase:
|
||||
device_choice,
|
||||
keep_model_loaded,
|
||||
):
|
||||
quant = enforce_memory(model_name, Quantization.from_value(quant_value), self.device_info)
|
||||
attn_impl = resolve_attention_mode(attention_mode)
|
||||
quant = Quantization.from_value(quant_value) # Skip enforce_memory for now
|
||||
|
||||
# Safety check: ensure quant is not None
|
||||
if quant is None:
|
||||
print(f"[QwenVL] Invalid quantization value: {quant_value}, falling back to FP16")
|
||||
quant = Quantization.FP16
|
||||
|
||||
# Check if BitsAndBytes quantization is being used
|
||||
is_bnb_quantization = quant in [Quantization.Q4, Quantization.Q8]
|
||||
|
||||
# Check if this is a pre-quantized FP8 model
|
||||
is_prequantized_fp8 = is_fp8_model(model_name) or HF_ALL_MODELS.get(model_name, {}).get("quantized", False)
|
||||
|
||||
# Determine if we need to force SDPA (for FP8 or BitsAndBytes models)
|
||||
force_sdpa = is_prequantized_fp8 or is_bnb_quantization
|
||||
|
||||
# Resolve attention mode with force_sdpa flag
|
||||
attn_impl = resolve_attention_mode(attention_mode, force_sdpa=force_sdpa)
|
||||
|
||||
# Additional info messages for forced SDPA
|
||||
if force_sdpa and attention_mode in ["auto", "sage", "flash_attention_2"]:
|
||||
if is_prequantized_fp8:
|
||||
print("[QwenVL] FP8 model detected - forcing SDPA attention")
|
||||
elif is_bnb_quantization:
|
||||
print("[QwenVL] BitsAndBytes quantization detected - forcing SDPA attention")
|
||||
|
||||
print(f"[QwenVL] Attention backend selected: {attn_impl}")
|
||||
|
||||
device_requested = self.device_info["recommended_device"] if device_choice == "auto" else device_choice
|
||||
device = normalize_device_choice(device_requested)
|
||||
signature = (model_name, quant.value, attn_impl, device, use_compile)
|
||||
@@ -351,16 +679,72 @@ class QwenVLBase:
|
||||
self.clear()
|
||||
model_path = ensure_model(model_name)
|
||||
quant_config, dtype = quantization_config(model_name, quant)
|
||||
|
||||
# Handle attention mode for loading
|
||||
# SageAttention requires loading with SDPA first, then patching
|
||||
actual_attn_impl = attn_impl
|
||||
if attn_impl == "sage":
|
||||
actual_attn_impl = "sdpa"
|
||||
|
||||
# MEMORY DEBUGGING: Check memory before loading
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.empty_cache()
|
||||
allocated_before = torch.cuda.memory_allocated() / 1024**3
|
||||
reserved_before = torch.cuda.memory_reserved() / 1024**3
|
||||
total_memory = torch.cuda.get_device_properties(0).total_memory / 1024**3
|
||||
print(f"[QwenVL] 📊 Memory BEFORE load - Allocated: {allocated_before:.1f}GB, Reserved: {reserved_before:.1f}GB, Total: {total_memory:.1f}GB")
|
||||
|
||||
# Check what's using memory
|
||||
if allocated_before > 2.0:
|
||||
print(f"[QwenVL] ⚠️ WARNING: {allocated_before:.1f}GB already allocated before loading!")
|
||||
|
||||
# DEBUG: Print quantization config details
|
||||
print(f"[QwenVL] 🔍 DEBUG - Model: {model_name}, Quant: {quant}, Quant config: {quant_config}")
|
||||
print(f"[QwenVL] 🔍 DEBUG - Device: {device}, Dtype: {dtype}")
|
||||
print(f"[QwenVL] 🔍 DEBUG - Attention impl: {actual_attn_impl}")
|
||||
|
||||
# Quantization is back - enforce_memory was the problem
|
||||
|
||||
load_kwargs = {
|
||||
"device_map": device if device != "auto" else "auto",
|
||||
"dtype": dtype,
|
||||
"attn_implementation": attn_impl,
|
||||
"device_map": "cpu", # Force CPU loading to test
|
||||
"dtype": torch.float16, # Use dtype instead of deprecated torch_dtype
|
||||
"attn_implementation": actual_attn_impl,
|
||||
"use_safetensors": True,
|
||||
"low_cpu_mem_usage": True,
|
||||
}
|
||||
|
||||
if quant_config:
|
||||
load_kwargs["quantization_config"] = quant_config
|
||||
print(f"[QwenVL] Loading {model_name} ({quant.value}, attn={attn_impl})")
|
||||
|
||||
self.model = AutoModelForVision2Seq.from_pretrained(model_path, **load_kwargs).eval()
|
||||
|
||||
# Move to GPU manually if loading was on CPU
|
||||
if device != "cpu" and torch.cuda.is_available():
|
||||
print(f"[QwenVL] 🔄 Moving model from CPU to {device}...")
|
||||
try:
|
||||
self.model = self.model.to(device)
|
||||
print(f"[QwenVL] ✅ Model moved to {device}")
|
||||
except Exception as e:
|
||||
print(f"[QwenVL] ❌ Failed to move to GPU: {e}")
|
||||
print("[QwenVL] Keeping model on CPU (will be very slow)")
|
||||
|
||||
# Apply SageAttention patching if needed
|
||||
if attn_impl == "sage":
|
||||
try:
|
||||
from sageattention_patch import set_sage_attention
|
||||
set_sage_attention(self.model)
|
||||
print("[QwenVL] SageAttention patching applied successfully")
|
||||
except Exception as e:
|
||||
print(f"[QwenVL] SageAttention patching failed: {e}")
|
||||
print("[QwenVL] Falling back to SDPA attention")
|
||||
# Model is already loaded with SDPA, so we can continue
|
||||
|
||||
# MEMORY CLEANUP: Clear cache after model loading
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.empty_cache()
|
||||
torch.cuda.synchronize()
|
||||
print(f"[QwenVL] GPU memory after load: {torch.cuda.memory_allocated() / 1024**3:.1f}GB / {torch.cuda.get_device_properties(0).total_memory / 1024**3:.1f}GB")
|
||||
|
||||
self.model.config.use_cache = True
|
||||
if hasattr(self.model, "generation_config"):
|
||||
self.model.generation_config.use_cache = True
|
||||
@@ -396,6 +780,11 @@ class QwenVLBase:
|
||||
num_beams,
|
||||
repetition_penalty,
|
||||
):
|
||||
# Memory optimization: clear cache before generation
|
||||
gc.collect()
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.empty_cache()
|
||||
|
||||
conversation = [{"role": "user", "content": []}]
|
||||
if image is not None:
|
||||
conversation[0]["content"].append({"type": "image", "image": self.tensor_to_pil(image)})
|
||||
@@ -407,19 +796,29 @@ class QwenVLBase:
|
||||
if frames:
|
||||
conversation[0]["content"].append({"type": "video", "video": frames})
|
||||
conversation[0]["content"].append({"type": "text", "text": prompt_text})
|
||||
|
||||
# Optimize chat template for memory efficiency
|
||||
chat = self.processor.apply_chat_template(conversation, tokenize=False, add_generation_prompt=True)
|
||||
|
||||
# Process images/videos more efficiently
|
||||
images = [item["image"] for item in conversation[0]["content"] if item["type"] == "image"]
|
||||
video_frames = [frame for item in conversation[0]["content"] if item["type"] == "video" for frame in item["video"]]
|
||||
videos = [video_frames] if video_frames else None
|
||||
|
||||
# Use smaller batch size for memory efficiency
|
||||
processed = self.processor(text=chat, images=images or None, videos=videos, return_tensors="pt")
|
||||
|
||||
# Move to device more efficiently
|
||||
model_device = next(self.model.parameters()).device
|
||||
model_inputs = {
|
||||
key: value.to(model_device) if torch.is_tensor(value) else value
|
||||
key: value.to(model_device, non_blocking=True) if torch.is_tensor(value) else value
|
||||
for key, value in processed.items()
|
||||
}
|
||||
stop_tokens = [self.tokenizer.eos_token_id]
|
||||
if hasattr(self.tokenizer, "eot_id") and self.tokenizer.eot_id is not None:
|
||||
stop_tokens.append(self.tokenizer.eot_id)
|
||||
|
||||
# Memory-efficient generation parameters
|
||||
kwargs = {
|
||||
"max_new_tokens": max_tokens,
|
||||
"repetition_penalty": repetition_penalty,
|
||||
@@ -431,18 +830,77 @@ class QwenVLBase:
|
||||
kwargs.update({"do_sample": True, "temperature": temperature, "top_p": top_p})
|
||||
else:
|
||||
kwargs["do_sample"] = False
|
||||
outputs = self.model.generate(**model_inputs, **kwargs)
|
||||
|
||||
# Generate with memory monitoring
|
||||
try:
|
||||
outputs = self.model.generate(**model_inputs, **kwargs)
|
||||
except torch.cuda.OutOfMemoryError as e:
|
||||
# Clear memory and retry with reduced parameters
|
||||
print(f"[QwenVL] OOM detected, clearing memory and retrying...")
|
||||
gc.collect()
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.empty_cache()
|
||||
|
||||
# Retry with smaller max_tokens
|
||||
reduced_tokens = max(256, max_tokens // 2)
|
||||
kwargs["max_new_tokens"] = reduced_tokens
|
||||
print(f"[QwenVL] Retrying with reduced tokens: {reduced_tokens}")
|
||||
|
||||
try:
|
||||
outputs = self.model.generate(**model_inputs, **kwargs)
|
||||
except torch.cuda.OutOfMemoryError:
|
||||
print(f"[QwenVL] OOM still occurs with {reduced_tokens} tokens, falling back to CPU")
|
||||
# Fallback to CPU if GPU still OOM
|
||||
device_backup = model_inputs["input_ids"].device
|
||||
for key in model_inputs:
|
||||
if torch.is_tensor(model_inputs[key]):
|
||||
model_inputs[key] = model_inputs[key].cpu()
|
||||
outputs = self.model.generate(**model_inputs, **kwargs)
|
||||
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.synchronize()
|
||||
input_len = model_inputs["input_ids"].shape[-1]
|
||||
text = self.tokenizer.decode(outputs[0, input_len:], skip_special_tokens=True)
|
||||
return text.strip()
|
||||
|
||||
def run(self, model_name, quantization, preset_prompt, custom_prompt, image, video, frame_count, max_tokens, temperature, top_p, num_beams, repetition_penalty, seed, keep_model_loaded, attention_mode, use_torch_compile, device):
|
||||
def run(self, model_name, quantization, preset_prompt, custom_prompt, image, video, frame_count, max_tokens, temperature, top_p, num_beams, repetition_penalty, seed, keep_model_loaded, attention_mode, use_torch_compile, device, keep_last_prompt=False):
|
||||
torch.manual_seed(seed)
|
||||
prompt = SYSTEM_PROMPTS.get(preset_prompt, preset_prompt)
|
||||
|
||||
global LAST_SAVED_PROMPT
|
||||
|
||||
# Simple keep last prompt logic
|
||||
if keep_last_prompt:
|
||||
print(f"[QwenVL] Keep last prompt enabled - using last saved prompt")
|
||||
if LAST_SAVED_PROMPT:
|
||||
print(f"[QwenVL] Using last prompt: {LAST_SAVED_PROMPT[:50]}...")
|
||||
return (LAST_SAVED_PROMPT,)
|
||||
else:
|
||||
print(f"[QwenVL] No previous prompt found, returning empty")
|
||||
return ("",)
|
||||
|
||||
# Always generate when keep last prompt is disabled
|
||||
print(f"[QwenVL] Keep last prompt disabled - generating new prompt")
|
||||
|
||||
prompt_template = SYSTEM_PROMPTS.get(preset_prompt, preset_prompt)
|
||||
|
||||
# Generate cache key with all inputs including seed
|
||||
image_hash = get_image_hash(image)
|
||||
video_hash = get_video_hash(video)
|
||||
cache_key = get_cache_key(model_name, preset_prompt, custom_prompt, image_hash, video_hash, seed)
|
||||
|
||||
# Check cache first (only for random mode)
|
||||
if cache_key in PROMPT_CACHE:
|
||||
cached_text = PROMPT_CACHE[cache_key].get("text", "")
|
||||
if cached_text:
|
||||
print(f"[QwenVL] Using cached prompt for seed {seed}: {cache_key[:8]}...")
|
||||
return (cached_text,)
|
||||
|
||||
if custom_prompt and custom_prompt.strip():
|
||||
prompt = custom_prompt.strip()
|
||||
# Combine user input with template - custom prompt first for priority
|
||||
prompt = f"{custom_prompt.strip()}\n\n{prompt_template}"
|
||||
else:
|
||||
prompt = prompt_template
|
||||
|
||||
self.load_model(
|
||||
model_name,
|
||||
quantization,
|
||||
@@ -463,12 +921,30 @@ class QwenVLBase:
|
||||
num_beams,
|
||||
repetition_penalty,
|
||||
)
|
||||
|
||||
# Cache the generated text
|
||||
PROMPT_CACHE[cache_key] = {
|
||||
"text": text,
|
||||
"timestamp": torch.cuda.Event().record() if torch.cuda.is_available() else None,
|
||||
"model": model_name,
|
||||
"preset": preset_prompt,
|
||||
"seed": seed,
|
||||
"image_hash": image_hash,
|
||||
"video_hash": video_hash
|
||||
}
|
||||
save_prompt_cache() # Save cache to file
|
||||
|
||||
print(f"[QwenVL] Cached new prompt for seed {seed}: {cache_key[:8]}...")
|
||||
|
||||
# Save the generated prompt for future bypass mode
|
||||
LAST_SAVED_PROMPT = text
|
||||
print(f"[QwenVL] Saved prompt for bypass mode: {text[:50]}...")
|
||||
|
||||
return (text,)
|
||||
finally:
|
||||
if not keep_model_loaded:
|
||||
self.clear()
|
||||
|
||||
|
||||
class AILab_QwenVL(QwenVLBase):
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
@@ -480,13 +956,13 @@ class AILab_QwenVL(QwenVLBase):
|
||||
return {
|
||||
"required": {
|
||||
"model_name": (models, {"default": default_model, "tooltip": TOOLTIPS["model_name"]}),
|
||||
"quantization": (Quantization.get_values(), {"default": Quantization.FP16.value, "tooltip": TOOLTIPS["quantization"]}),
|
||||
"attention_mode": (ATTENTION_MODES, {"default": "auto", "tooltip": TOOLTIPS["attention_mode"]}),
|
||||
"preset_prompt": (prompts, {"default": default_prompt, "tooltip": TOOLTIPS["preset_prompt"]}),
|
||||
"custom_prompt": ("STRING", {"default": "", "multiline": True, "tooltip": TOOLTIPS["custom_prompt"]}),
|
||||
"max_tokens": ("INT", {"default": 512, "min": 64, "max": 2048, "tooltip": TOOLTIPS["max_tokens"]}),
|
||||
"keep_model_loaded": ("BOOLEAN", {"default": True, "tooltip": TOOLTIPS["keep_model_loaded"]}),
|
||||
"seed": ("INT", {"default": 1, "min": 1, "max": 2**32 - 1, "tooltip": TOOLTIPS["seed"]}),
|
||||
"seed": ("INT", {"default": 1, "min": 1, "max": 2**32 - 1, "tooltip": TOOLTIPS["seed"] + "\n\n💡 Cache Info: Prompts are cached automatically. Use the same inputs (model, preset, custom prompt, image/video) to reuse cached prompts and avoid regeneration.\n\n🔒 Fixed Seed Mode: Set seed = 1 to ignore image/video changes and only use text-based caching. Perfect for keeping the same prompt regardless of media input variations."}),
|
||||
"keep_last_prompt": ("BOOLEAN", {"default": False, "tooltip": "Keep the last generated prompt instead of creating a new one"}),
|
||||
},
|
||||
"optional": {
|
||||
"image": ("IMAGE",),
|
||||
@@ -497,11 +973,12 @@ class AILab_QwenVL(QwenVLBase):
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("RESPONSE",)
|
||||
FUNCTION = "process"
|
||||
CATEGORY = "🧪AILab/QwenVL"
|
||||
|
||||
def process(self, model_name, quantization, preset_prompt, custom_prompt, attention_mode, max_tokens, keep_model_loaded, seed, image=None, video=None):
|
||||
return self.run(model_name, quantization, preset_prompt, custom_prompt, image, video, 16, max_tokens, 0.6, 0.9, 1, 1.2, seed, keep_model_loaded, attention_mode, False, "auto")
|
||||
CATEGORY = "🔷 QwenVL-Mod/QwenVL"
|
||||
|
||||
def process(self, model_name, preset_prompt, custom_prompt, attention_mode, max_tokens, keep_model_loaded, seed, keep_last_prompt=False, image=None, video=None):
|
||||
# Always use FP16 - dropdown removed but keep working logic
|
||||
quantization = Quantization.FP16.value
|
||||
return self.run(model_name, quantization, preset_prompt, custom_prompt, image, video, 16, max_tokens, 0.6, 0.9, 1, 1.2, seed, keep_model_loaded, attention_mode, False, "auto", keep_last_prompt)
|
||||
|
||||
class AILab_QwenVL_Advanced(QwenVLBase):
|
||||
@classmethod
|
||||
@@ -525,14 +1002,15 @@ class AILab_QwenVL_Advanced(QwenVLBase):
|
||||
"device": (device_options, {"default": "auto", "tooltip": TOOLTIPS["device"]}),
|
||||
"preset_prompt": (prompts, {"default": default_prompt, "tooltip": TOOLTIPS["preset_prompt"]}),
|
||||
"custom_prompt": ("STRING", {"default": "", "multiline": True, "tooltip": TOOLTIPS["custom_prompt"]}),
|
||||
"max_tokens": ("INT", {"default": 512, "min": 64, "max": 4096, "tooltip": TOOLTIPS["max_tokens"]}),
|
||||
"max_tokens": ("INT", {"default": 2048, "min": 64, "max": 4096, "tooltip": TOOLTIPS["max_tokens"]}),
|
||||
"temperature": ("FLOAT", {"default": 0.6, "min": 0.1, "max": 1.0, "tooltip": TOOLTIPS["temperature"]}),
|
||||
"top_p": ("FLOAT", {"default": 0.9, "min": 0.0, "max": 1.0, "tooltip": TOOLTIPS["top_p"]}),
|
||||
"num_beams": ("INT", {"default": 1, "min": 1, "max": 8, "tooltip": TOOLTIPS["num_beams"]}),
|
||||
"repetition_penalty": ("FLOAT", {"default": 1.2, "min": 0.5, "max": 2.0, "tooltip": TOOLTIPS["repetition_penalty"]}),
|
||||
"frame_count": ("INT", {"default": 16, "min": 1, "max": 64, "tooltip": TOOLTIPS["frame_count"]}),
|
||||
"keep_model_loaded": ("BOOLEAN", {"default": True, "tooltip": TOOLTIPS["keep_model_loaded"]}),
|
||||
"seed": ("INT", {"default": 1, "min": 1, "max": 2**32 - 1, "tooltip": TOOLTIPS["seed"]}),
|
||||
"seed": ("INT", {"default": 1, "min": 1, "max": 2**32 - 1, "tooltip": TOOLTIPS["seed"] + "\n\n💡 Cache Info: Prompts are cached automatically. Use same inputs (model, preset, custom prompt, image/video) to reuse cached prompts and avoid regeneration.\n\n🔒 Fixed Seed Mode: Set seed = 1 to ignore image/video changes and only use text-based caching. Perfect for keeping the same prompt regardless of media input variations."}),
|
||||
"keep_last_prompt": ("BOOLEAN", {"default": False, "tooltip": "Keep last generated prompt instead of creating a new one"}),
|
||||
},
|
||||
"optional": {
|
||||
"image": ("IMAGE",),
|
||||
@@ -543,11 +1021,10 @@ class AILab_QwenVL_Advanced(QwenVLBase):
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("RESPONSE",)
|
||||
FUNCTION = "process"
|
||||
CATEGORY = "🧪AILab/QwenVL"
|
||||
|
||||
def process(self, model_name, quantization, attention_mode, use_torch_compile, device, preset_prompt, custom_prompt, max_tokens, temperature, top_p, num_beams, repetition_penalty, frame_count, keep_model_loaded, seed, image=None, video=None):
|
||||
return self.run(model_name, quantization, preset_prompt, custom_prompt, image, video, frame_count, max_tokens, temperature, top_p, num_beams, repetition_penalty, seed, keep_model_loaded, attention_mode, use_torch_compile, device)
|
||||
CATEGORY = "🔷 QwenVL-Mod/QwenVL"
|
||||
|
||||
def process(self, model_name, quantization, attention_mode, use_torch_compile, device, preset_prompt, custom_prompt, max_tokens, temperature, top_p, num_beams, repetition_penalty, frame_count, keep_model_loaded, seed, keep_last_prompt, image=None, video=None):
|
||||
return self.run(model_name, quantization, preset_prompt, custom_prompt, image, video, frame_count, max_tokens, temperature, top_p, num_beams, repetition_penalty, seed, keep_model_loaded, attention_mode, use_torch_compile, device, keep_last_prompt)
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"AILab_QwenVL": AILab_QwenVL,
|
||||
@@ -555,6 +1032,6 @@ NODE_CLASS_MAPPINGS = {
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"AILab_QwenVL": "QwenVL",
|
||||
"AILab_QwenVL_Advanced": "QwenVL (Advanced)",
|
||||
"AILab_QwenVL": "QwenVL-Mod",
|
||||
"AILab_QwenVL_Advanced": "QwenVL-Mod (Advanced)",
|
||||
}
|
||||
|
||||
+205
-37
@@ -11,22 +11,32 @@
|
||||
|
||||
import base64
|
||||
import gc
|
||||
import hashlib
|
||||
import io
|
||||
import inspect
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
import torch
|
||||
from huggingface_hub import hf_hub_download
|
||||
from huggingface_hub import hf_hub_download, snapshot_download
|
||||
from llama_cpp import Llama
|
||||
from PIL import Image
|
||||
|
||||
# Import cache functions from main module
|
||||
sys.path.append(str(Path(__file__).parent))
|
||||
from AILab_QwenVL import PROMPT_CACHE, get_cache_key, get_alternative_cache_key, get_image_hash, get_video_hash, save_prompt_cache
|
||||
|
||||
import folder_paths
|
||||
from AILab_OutputCleaner import OutputCleanConfig, clean_model_output
|
||||
|
||||
# Simple global variable to store last generated prompt
|
||||
LAST_SAVED_PROMPT = None
|
||||
|
||||
NODE_DIR = Path(__file__).parent
|
||||
CONFIG_PATH = NODE_DIR / "hf_models.json"
|
||||
SYSTEM_PROMPTS_PATH = NODE_DIR / "AILab_System_Prompts.json"
|
||||
@@ -236,7 +246,6 @@ def _download_single_file(repo_ids: list[str], filename: str, target_path: Path)
|
||||
filename=filename,
|
||||
repo_type="model",
|
||||
local_dir=str(target_path.parent),
|
||||
local_dir_use_symlinks=False,
|
||||
)
|
||||
downloaded_path = Path(downloaded)
|
||||
if downloaded_path.exists() and downloaded_path.resolve() != target_path.resolve():
|
||||
@@ -292,7 +301,7 @@ def _resolve_model_entry(model_name: str) -> GGUFVLResolved:
|
||||
repo_dirname=_safe_dirname(str(repo_dirname)),
|
||||
model_filename=str(model_filename),
|
||||
mmproj_filename=str(mmproj_filename) if mmproj_filename else None,
|
||||
context_length=_int("context_length", 8192),
|
||||
context_length=_int("context_length", 32768),
|
||||
image_max_tokens=_int("image_max_tokens", 4096),
|
||||
n_batch=_int("n_batch", 512),
|
||||
gpu_layers=_int("gpu_layers", -1),
|
||||
@@ -308,12 +317,51 @@ class QwenVLGGUFBase:
|
||||
self.current_signature = None
|
||||
|
||||
def clear(self):
|
||||
self.llm = None
|
||||
self.chat_handler = None
|
||||
print(f"[QwenVL GGUF DEBUG] Starting VRAM cleanup...")
|
||||
|
||||
# Force cleanup of chat handler first
|
||||
if self.chat_handler is not None:
|
||||
try:
|
||||
# Try to explicitly close the chat handler if it has a close method
|
||||
if hasattr(self.chat_handler, 'close'):
|
||||
self.chat_handler.close()
|
||||
elif hasattr(self.chat_handler, '__del__'):
|
||||
self.chat_handler.__del__()
|
||||
except Exception as e:
|
||||
print(f"[QwenVL GGUF DEBUG] Error closing chat_handler: {e}")
|
||||
finally:
|
||||
self.chat_handler = None
|
||||
|
||||
# Force cleanup of LLM model
|
||||
if self.llm is not None:
|
||||
try:
|
||||
# Try to explicitly close the LLM if it has a close method
|
||||
if hasattr(self.llm, 'close'):
|
||||
self.llm.close()
|
||||
elif hasattr(self.llm, '__del__'):
|
||||
self.llm.__del__()
|
||||
# Force garbage collection of the model
|
||||
del self.llm
|
||||
except Exception as e:
|
||||
print(f"[QwenVL GGUF DEBUG] Error closing LLM: {e}")
|
||||
finally:
|
||||
self.llm = None
|
||||
|
||||
# Clear signature
|
||||
self.current_signature = None
|
||||
|
||||
# Aggressive garbage collection
|
||||
gc.collect()
|
||||
|
||||
# Force CUDA cache cleanup multiple times
|
||||
if torch.cuda.is_available():
|
||||
print(f"[QwenVL GGUF DEBUG] Clearing CUDA cache...")
|
||||
torch.cuda.empty_cache()
|
||||
torch.cuda.synchronize()
|
||||
# Additional cleanup
|
||||
torch.cuda.empty_cache()
|
||||
|
||||
print(f"[QwenVL GGUF DEBUG] VRAM cleanup completed")
|
||||
|
||||
def _load_backend(self):
|
||||
try:
|
||||
@@ -381,8 +429,9 @@ class QwenVLGGUFBase:
|
||||
str(model_path),
|
||||
str(mmproj_path) if has_mmproj else "",
|
||||
n_ctx,
|
||||
n_batch_val,
|
||||
n_gpu_layers,
|
||||
n_batch_val,
|
||||
device_kind,
|
||||
img_max,
|
||||
top_k_val,
|
||||
pool_size_val,
|
||||
@@ -390,7 +439,14 @@ class QwenVLGGUFBase:
|
||||
if self.llm is not None and self.current_signature == signature:
|
||||
return
|
||||
|
||||
# Force aggressive cleanup before loading new model (especially for same model conflicts)
|
||||
print(f"[QwenVL GGUF DEBUG] Forcing cleanup before model loading...")
|
||||
self.clear()
|
||||
|
||||
# Additional wait for CUDA cleanup
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.synchronize()
|
||||
time.sleep(0.1) # Brief pause for cleanup to complete
|
||||
|
||||
from llama_cpp import Llama
|
||||
|
||||
@@ -515,39 +571,117 @@ class QwenVLGGUFBase:
|
||||
custom_prompt: str,
|
||||
image,
|
||||
video,
|
||||
frame_count: int,
|
||||
max_tokens: int,
|
||||
temperature: float,
|
||||
top_p: float,
|
||||
repetition_penalty: float,
|
||||
seed: int,
|
||||
keep_model_loaded: bool,
|
||||
device: str,
|
||||
ctx: int | None,
|
||||
n_batch: int | None,
|
||||
gpu_layers: int | None,
|
||||
image_max_tokens: int | None,
|
||||
top_k: int | None,
|
||||
pool_size: int | None,
|
||||
frame_count,
|
||||
max_tokens,
|
||||
temperature,
|
||||
top_p,
|
||||
repetition_penalty,
|
||||
seed,
|
||||
keep_model_loaded,
|
||||
device,
|
||||
ctx=None,
|
||||
n_batch=None,
|
||||
gpu_layers=None,
|
||||
image_max_tokens=None,
|
||||
top_k=None,
|
||||
pool_size=None,
|
||||
keep_last_prompt=False,
|
||||
):
|
||||
torch.manual_seed(int(seed))
|
||||
|
||||
prompt = SYSTEM_PROMPTS.get(preset_prompt, preset_prompt)
|
||||
print(f"[QwenVL GGUF DEBUG] Starting run with seed={seed}, keep_last_prompt={keep_last_prompt}")
|
||||
|
||||
global LAST_SAVED_PROMPT
|
||||
|
||||
# Simple keep last prompt logic
|
||||
if keep_last_prompt:
|
||||
print(f"[QwenVL GGUF] Keep last prompt enabled - using last saved prompt")
|
||||
if LAST_SAVED_PROMPT:
|
||||
print(f"[QwenVL GGUF] Using last prompt: {LAST_SAVED_PROMPT[:50]}...")
|
||||
return (LAST_SAVED_PROMPT,)
|
||||
else:
|
||||
print(f"[QwenVL GGUF] No previous prompt found, returning empty")
|
||||
return ("",)
|
||||
|
||||
# Always generate when keep last prompt is disabled
|
||||
print(f"[QwenVL GGUF] Keep last prompt disabled - generating new prompt")
|
||||
|
||||
prompt_template = SYSTEM_PROMPTS.get(preset_prompt, preset_prompt)
|
||||
|
||||
# Generate cache key with all inputs including seed
|
||||
image_hash = get_image_hash(image)
|
||||
video_hash = get_video_hash(video)
|
||||
cache_key = get_cache_key(model_name, preset_prompt, custom_prompt, image_hash, video_hash, int(seed))
|
||||
|
||||
# TEMPORARILY DISABLED CACHE FOR DEBUGGING
|
||||
# Check cache first (only for random mode)
|
||||
# if cache_key in PROMPT_CACHE:
|
||||
# cached_text = PROMPT_CACHE[cache_key].get("text", "")
|
||||
# if cached_text:
|
||||
# print(f"[QwenVL GGUF] Using cached prompt for seed {seed}: {cache_key[:8]}...")
|
||||
# return cached_text.strip()
|
||||
|
||||
print(f"[QwenVL GGUF DEBUG] Cache disabled - proceeding with generation")
|
||||
|
||||
if custom_prompt and custom_prompt.strip():
|
||||
prompt = custom_prompt.strip()
|
||||
# Combine user input with template - custom prompt first for priority
|
||||
prompt = f"{custom_prompt.strip()}\n\n{prompt_template}"
|
||||
else:
|
||||
prompt = prompt_template
|
||||
|
||||
print(f"[QwenVL GGUF DEBUG] Final prompt: {prompt[:100]}...")
|
||||
|
||||
images_b64: list[str] = []
|
||||
if image is not None:
|
||||
img = _tensor_to_base64_png(image)
|
||||
if img:
|
||||
images_b64.append(img)
|
||||
print(f"[QwenVL GGUF DEBUG] Processing image...")
|
||||
print(f"[QwenVL GGUF DEBUG] Image shape before processing: {image.shape}")
|
||||
|
||||
# Handle batch images from T2V
|
||||
if len(image.shape) == 4: # [batch, height, width, channels]
|
||||
print(f"[QwenVL GGUF DEBUG] Detected batch image with shape: {image.shape}")
|
||||
# Take first frame from batch or process all frames
|
||||
if image.shape[0] > 1:
|
||||
print(f"[QwenVL GGUF DEBUG] Processing {image.shape[0]} frames from batch")
|
||||
for i in range(image.shape[0]):
|
||||
frame_img = image[i] # Take each frame from batch
|
||||
print(f"[QwenVL GGUF DEBUG] Processing batch frame {i} with shape: {frame_img.shape}")
|
||||
img = _tensor_to_base64_png(frame_img)
|
||||
if img:
|
||||
images_b64.append(img)
|
||||
else:
|
||||
# Single frame in batch format
|
||||
frame_img = image[0]
|
||||
print(f"[QwenVL GGUF DEBUG] Single frame in batch, shape: {frame_img.shape}")
|
||||
img = _tensor_to_base64_png(frame_img)
|
||||
if img:
|
||||
images_b64.append(img)
|
||||
else:
|
||||
# Regular single image [height, width, channels]
|
||||
print(f"[QwenVL GGUF DEBUG] Regular single image, shape: {image.shape}")
|
||||
img = _tensor_to_base64_png(image)
|
||||
if img:
|
||||
images_b64.append(img)
|
||||
if video is not None:
|
||||
for frame in _sample_video_frames(video, int(frame_count)):
|
||||
img = _tensor_to_base64_png(frame)
|
||||
if img:
|
||||
images_b64.append(img)
|
||||
|
||||
print(f"[QwenVL GGUF DEBUG] Images processed: {len(images_b64)} images/videos")
|
||||
|
||||
# Debug video/image info
|
||||
if video is not None:
|
||||
print(f"[QwenVL GGUF DEBUG] Video shape: {video.shape}")
|
||||
print(f"[QwenVL GGUF DEBUG] Frame count requested: {frame_count}")
|
||||
if image is not None:
|
||||
print(f"[QwenVL GGUF DEBUG] Image shape: {image.shape}")
|
||||
|
||||
# Debug VRAM before model loading
|
||||
if torch.cuda.is_available():
|
||||
allocated = torch.cuda.memory_allocated()
|
||||
total = torch.cuda.get_device_properties(0).total_memory
|
||||
print(f"[QwenVL GGUF DEBUG] VRAM before loading: {allocated/1024**3:.2f}GB / {total/1024**3:.2f}GB")
|
||||
|
||||
try:
|
||||
print(f"[QwenVL GGUF DEBUG] Loading model...")
|
||||
self._load_model(
|
||||
model_name=model_name,
|
||||
device=device,
|
||||
@@ -558,8 +692,10 @@ class QwenVLGGUFBase:
|
||||
top_k=top_k,
|
||||
pool_size=pool_size,
|
||||
)
|
||||
print(f"[QwenVL GGUF DEBUG] Model loaded successfully")
|
||||
if images_b64 and self.chat_handler is None:
|
||||
print("[QwenVL] Warning: images provided but this model entry has no mmproj_file; images will be ignored")
|
||||
print(f"[QwenVL GGUF DEBUG] Starting generation...")
|
||||
text = self._invoke(
|
||||
system_prompt=(
|
||||
"You are a helpful vision-language assistant. "
|
||||
@@ -573,6 +709,30 @@ class QwenVLGGUFBase:
|
||||
repetition_penalty=repetition_penalty,
|
||||
seed=seed,
|
||||
)
|
||||
|
||||
print(f"[QwenVL GGUF DEBUG] Generation completed. Text length: {len(text) if text else 0}")
|
||||
print(f"[QwenVL GGUF DEBUG] Generated text: {text[:100] if text else 'EMPTY'}...")
|
||||
|
||||
# Cache the generated text
|
||||
PROMPT_CACHE[cache_key] = {
|
||||
"text": text,
|
||||
"timestamp": None, # GGUF doesn't have CUDA events
|
||||
"model": model_name,
|
||||
"preset": preset_prompt,
|
||||
"seed": int(seed),
|
||||
"image_hash": image_hash,
|
||||
"video_hash": video_hash
|
||||
}
|
||||
save_prompt_cache() # Save cache to file
|
||||
|
||||
print(f"[QwenVL GGUF] Cached new prompt for seed {seed}: {cache_key[:8]}...")
|
||||
|
||||
print(f"[QwenVL GGUF DEBUG] Returning tuple with text...")
|
||||
|
||||
# Save the generated prompt for future bypass mode
|
||||
LAST_SAVED_PROMPT = text
|
||||
print(f"[QwenVL GGUF] Saved prompt for bypass mode: {text[:50]}...")
|
||||
|
||||
return (text,)
|
||||
finally:
|
||||
if not keep_model_loaded:
|
||||
@@ -594,11 +754,12 @@ class AILab_QwenVL_GGUF(QwenVLGGUFBase):
|
||||
"required": {
|
||||
"model_name": (model_keys, {"default": default_model}),
|
||||
"preset_prompt": (prompts, {"default": default_prompt}),
|
||||
"custom_prompt": ("STRING", {"default": "", "multiline": True}),
|
||||
"custom_prompt": ("STRING", {"default": "", "multiline": True, "tooltip": "Additional user input that gets combined with the preset template. Leave empty to use only the template."}),
|
||||
"max_tokens": ("INT", {"default": 512, "min": 64, "max": 2048}),
|
||||
"keep_model_loaded": ("BOOLEAN", {"default": True}),
|
||||
"seed": ("INT", {"default": 1, "min": 1, "max": 2**32 - 1}),
|
||||
},
|
||||
"keep_last_prompt": ("BOOLEAN", {"default": False, "tooltip": "Keep the last generated prompt instead of creating a new one"}),
|
||||
},
|
||||
"optional": {
|
||||
"image": ("IMAGE",),
|
||||
"video": ("IMAGE",),
|
||||
@@ -608,7 +769,7 @@ class AILab_QwenVL_GGUF(QwenVLGGUFBase):
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("RESPONSE",)
|
||||
FUNCTION = "process"
|
||||
CATEGORY = "🧪AILab/QwenVL"
|
||||
CATEGORY = "🔷 QwenVL-Mod/QwenVL"
|
||||
|
||||
def process(
|
||||
self,
|
||||
@@ -618,6 +779,8 @@ class AILab_QwenVL_GGUF(QwenVLGGUFBase):
|
||||
max_tokens,
|
||||
keep_model_loaded,
|
||||
seed,
|
||||
keep_last_prompt,
|
||||
unload_after_run,
|
||||
image=None,
|
||||
video=None,
|
||||
):
|
||||
@@ -631,9 +794,10 @@ class AILab_QwenVL_GGUF(QwenVLGGUFBase):
|
||||
max_tokens=max_tokens,
|
||||
temperature=0.6,
|
||||
top_p=0.9,
|
||||
repetition_penalty=1.2,
|
||||
repetition_penalty=1.05,
|
||||
seed=seed,
|
||||
keep_model_loaded=keep_model_loaded,
|
||||
unload_after_run=unload_after_run,
|
||||
device="auto",
|
||||
ctx=None,
|
||||
n_batch=None,
|
||||
@@ -641,6 +805,7 @@ class AILab_QwenVL_GGUF(QwenVLGGUFBase):
|
||||
image_max_tokens=None,
|
||||
top_k=None,
|
||||
pool_size=None,
|
||||
keep_last_prompt=keep_last_prompt,
|
||||
)
|
||||
|
||||
|
||||
@@ -664,13 +829,13 @@ class AILab_QwenVL_GGUF_Advanced(QwenVLGGUFBase):
|
||||
"model_name": (model_keys, {"default": default_model}),
|
||||
"device": (device_options, {"default": "auto"}),
|
||||
"preset_prompt": (prompts, {"default": default_prompt}),
|
||||
"custom_prompt": ("STRING", {"default": "", "multiline": True}),
|
||||
"custom_prompt": ("STRING", {"default": "", "multiline": True, "tooltip": "Additional user input that gets combined with the preset template. Leave empty to use only the template."}),
|
||||
"max_tokens": ("INT", {"default": 512, "min": 64, "max": 4096}),
|
||||
"temperature": ("FLOAT", {"default": 0.6, "min": 0.0, "max": 2.0}),
|
||||
"top_p": ("FLOAT", {"default": 0.9, "min": 0.0, "max": 1.0}),
|
||||
"repetition_penalty": ("FLOAT", {"default": 1.2, "min": 0.5, "max": 2.0}),
|
||||
"frame_count": ("INT", {"default": 16, "min": 1, "max": 64}),
|
||||
"ctx": ("INT", {"default": 8192, "min": 1024, "max": 262144, "step": 512}),
|
||||
"ctx": ("INT", {"default": 32768, "min": 1024, "max": 262144, "step": 512}),
|
||||
"n_batch": ("INT", {"default": 512, "min": 64, "max": 32768, "step": 64}),
|
||||
"gpu_layers": ("INT", {"default": -1, "min": -1, "max": 200}),
|
||||
"image_max_tokens": ("INT", {"default": 4096, "min": 256, "max": 1024000, "step": 256}),
|
||||
@@ -678,7 +843,8 @@ class AILab_QwenVL_GGUF_Advanced(QwenVLGGUFBase):
|
||||
"pool_size": ("INT", {"default": 4194304, "min": 1048576, "max": 10485760, "step": 524288}),
|
||||
"keep_model_loaded": ("BOOLEAN", {"default": True}),
|
||||
"seed": ("INT", {"default": 1, "min": 1, "max": 2**32 - 1}),
|
||||
},
|
||||
"keep_last_prompt": ("BOOLEAN", {"default": False, "tooltip": "Keep the last generated prompt instead of creating a new one"}),
|
||||
},
|
||||
"optional": {
|
||||
"image": ("IMAGE",),
|
||||
"video": ("IMAGE",),
|
||||
@@ -688,7 +854,7 @@ class AILab_QwenVL_GGUF_Advanced(QwenVLGGUFBase):
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("RESPONSE",)
|
||||
FUNCTION = "process"
|
||||
CATEGORY = "🧪AILab/QwenVL"
|
||||
CATEGORY = "🔷 QwenVL-Mod/QwenVL"
|
||||
|
||||
def process(
|
||||
self,
|
||||
@@ -709,6 +875,7 @@ class AILab_QwenVL_GGUF_Advanced(QwenVLGGUFBase):
|
||||
pool_size,
|
||||
keep_model_loaded,
|
||||
seed,
|
||||
keep_last_prompt,
|
||||
image=None,
|
||||
video=None,
|
||||
):
|
||||
@@ -732,6 +899,7 @@ class AILab_QwenVL_GGUF_Advanced(QwenVLGGUFBase):
|
||||
image_max_tokens=image_max_tokens,
|
||||
top_k=top_k,
|
||||
pool_size=pool_size,
|
||||
keep_last_prompt=keep_last_prompt
|
||||
)
|
||||
|
||||
|
||||
@@ -741,6 +909,6 @@ NODE_CLASS_MAPPINGS = {
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"AILab_QwenVL_GGUF": "QwenVL (GGUF)",
|
||||
"AILab_QwenVL_GGUF_Advanced": "QwenVL Advanced (GGUF)",
|
||||
"AILab_QwenVL_GGUF": "QwenVL-Mod (GGUF)",
|
||||
"AILab_QwenVL_GGUF_Advanced": "QwenVL-Mod Advanced (GGUF)",
|
||||
}
|
||||
|
||||
@@ -10,11 +10,15 @@
|
||||
#
|
||||
# Source: https://github.com/1038lab/ComfyUI-QwenVL
|
||||
|
||||
import base64
|
||||
import gc
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
import torch
|
||||
from huggingface_hub import hf_hub_download, snapshot_download
|
||||
from llama_cpp import Llama
|
||||
@@ -22,6 +26,14 @@ from llama_cpp import Llama
|
||||
import folder_paths
|
||||
from AILab_OutputCleaner import OutputCleanConfig, clean_model_output
|
||||
|
||||
# Import cache functions from main module
|
||||
import sys
|
||||
sys.path.append(str(Path(__file__).parent))
|
||||
from AILab_QwenVL import PROMPT_CACHE, get_cache_key, get_alternative_cache_key, save_prompt_cache
|
||||
|
||||
# Simple global variable to store last generated prompt
|
||||
LAST_SAVED_PROMPT = None
|
||||
|
||||
NODE_DIR = Path(__file__).parent
|
||||
GGUF_CONFIG_PATH = NODE_DIR / "gguf_models.json"
|
||||
PROMPT_CONFIG_PATH = NODE_DIR / "AILab_System_Prompts.json"
|
||||
@@ -79,7 +91,7 @@ class AILab_QwenVL_GGUF_PromptEnhancer:
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("ENHANCED_OUTPUT",)
|
||||
FUNCTION = "process"
|
||||
CATEGORY = "🧪AILab/QwenVL"
|
||||
CATEGORY = "🔷 QwenVL-Mod/QwenVL"
|
||||
|
||||
def __init__(self):
|
||||
self.llm = None
|
||||
@@ -166,13 +178,45 @@ class AILab_QwenVL_GGUF_PromptEnhancer:
|
||||
"repetition_penalty": ("FLOAT", {"default": 1.1, "min": 0.5, "max": 2.0}),
|
||||
"english_output": ("BOOLEAN", {"default": False, "tooltip": "Force final output in English using translation prompt."}),
|
||||
"device": (["auto", "cuda", "cpu", "mps"], {"default": "auto", "tooltip": "Select device; auto prefers GPU when available."}),
|
||||
"keep_model_loaded": ("BOOLEAN", {"default": True, "tooltip": "Keep model loaded in memory for faster repeated inference (uses more VRAM)."}),
|
||||
"seed": ("INT", {"default": 1, "min": 1, "max": 2**32 - 1}),
|
||||
}
|
||||
"keep_last_prompt": ("BOOLEAN", {"default": False, "tooltip": "Keep the last generated prompt instead of creating a new one"}),
|
||||
}
|
||||
}
|
||||
|
||||
def clear(self):
|
||||
self.llm = None
|
||||
print(f"[QwenVL PromptEnhancer DEBUG] Starting VRAM cleanup...")
|
||||
|
||||
# Force cleanup of LLM model
|
||||
if self.llm is not None:
|
||||
try:
|
||||
# Try to explicitly close the LLM if it has a close method
|
||||
if hasattr(self.llm, 'close'):
|
||||
self.llm.close()
|
||||
elif hasattr(self.llm, '__del__'):
|
||||
self.llm.__del__()
|
||||
# Force garbage collection of the model
|
||||
del self.llm
|
||||
except Exception as e:
|
||||
print(f"[QwenVL PromptEnhancer DEBUG] Error closing LLM: {e}")
|
||||
finally:
|
||||
self.llm = None
|
||||
|
||||
# Clear signature
|
||||
self.current_signature = None
|
||||
|
||||
# Aggressive garbage collection
|
||||
gc.collect()
|
||||
|
||||
# Force CUDA cache cleanup multiple times
|
||||
if torch.cuda.is_available():
|
||||
print(f"[QwenVL PromptEnhancer DEBUG] Clearing CUDA cache...")
|
||||
torch.cuda.empty_cache()
|
||||
torch.cuda.synchronize()
|
||||
# Additional cleanup
|
||||
torch.cuda.empty_cache()
|
||||
|
||||
print(f"[QwenVL PromptEnhancer DEBUG] VRAM cleanup completed")
|
||||
|
||||
def _resolve_model_path(self, model_name):
|
||||
models = self.gguf_models.get("models") or {}
|
||||
@@ -232,7 +276,6 @@ class AILab_QwenVL_GGUF_PromptEnhancer:
|
||||
filename=filename,
|
||||
repo_type="model",
|
||||
local_dir=str(target_dir),
|
||||
local_dir_use_symlinks=False,
|
||||
)
|
||||
downloaded_path = Path(downloaded)
|
||||
if downloaded_path.exists() and downloaded_path.resolve() != resolved.resolve():
|
||||
@@ -247,7 +290,6 @@ class AILab_QwenVL_GGUF_PromptEnhancer:
|
||||
repo_id=repo_id,
|
||||
repo_type="model",
|
||||
local_dir=str(target_dir),
|
||||
local_dir_use_symlinks=False,
|
||||
allow_patterns=[filename, f"**/{filename}"],
|
||||
)
|
||||
except Exception as exc:
|
||||
@@ -266,11 +308,19 @@ class AILab_QwenVL_GGUF_PromptEnhancer:
|
||||
resolved = self._resolve_model_path(model_name)
|
||||
self._maybe_download_model(model_name, resolved)
|
||||
model_cfg = self.gguf_models["models"].get(model_name, {})
|
||||
context_length = model_cfg.get("context_length", 8192)
|
||||
context_length = model_cfg.get("context_length", 32768)
|
||||
signature = (resolved, context_length, device)
|
||||
if self.llm is not None and self.current_signature == signature:
|
||||
return
|
||||
|
||||
# Force aggressive cleanup before loading new model (especially for same model conflicts)
|
||||
print(f"[QwenVL PromptEnhancer DEBUG] Forcing cleanup before model loading...")
|
||||
self.clear()
|
||||
|
||||
# Additional wait for CUDA cleanup
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.synchronize()
|
||||
time.sleep(0.1) # Brief pause for cleanup to complete
|
||||
resolved.parent.mkdir(parents=True, exist_ok=True)
|
||||
if not resolved.exists():
|
||||
raise FileNotFoundError(f"[QwenVL] GGUF model not found: {resolved}")
|
||||
@@ -367,15 +417,42 @@ class AILab_QwenVL_GGUF_PromptEnhancer:
|
||||
repetition_penalty,
|
||||
english_output,
|
||||
device,
|
||||
keep_model_loaded,
|
||||
seed,
|
||||
keep_last_prompt,
|
||||
):
|
||||
global LAST_SAVED_PROMPT
|
||||
|
||||
# Simple keep last prompt logic
|
||||
if keep_last_prompt: # Keep last prompt enabled
|
||||
print(f"[QwenVL PromptEnhancer GGUF] Keep last prompt enabled - using last saved prompt")
|
||||
if LAST_SAVED_PROMPT:
|
||||
print(f"[QwenVL PromptEnhancer GGUF] Using last prompt: {LAST_SAVED_PROMPT[:50]}...")
|
||||
return (LAST_SAVED_PROMPT,)
|
||||
else:
|
||||
print(f"[QwenVL PromptEnhancer GGUF] No previous prompt found, returning empty")
|
||||
return ("",)
|
||||
|
||||
# Always generate when keep last prompt is disabled
|
||||
print(f"[QwenVL PromptEnhancer GGUF] Keep last prompt disabled - generating new prompt")
|
||||
|
||||
# Generate cache key with all inputs including seed
|
||||
cache_key = get_cache_key(model_name, preset_system_prompt, prompt_text, seed=seed)
|
||||
|
||||
# Check cache first (only for random mode)
|
||||
if cache_key in PROMPT_CACHE:
|
||||
cached_text = PROMPT_CACHE[cache_key].get("text", "")
|
||||
if cached_text:
|
||||
print(f"[QwenVL PromptEnhancer GGUF] Using cached prompt for seed {seed}: {cache_key[:8]}...")
|
||||
return (cached_text.strip(),)
|
||||
|
||||
style_entry = self.styles.get(preset_system_prompt, {})
|
||||
system_prompt = (custom_system_prompt.strip() or style_entry.get("system_prompt") or "").strip()
|
||||
if not system_prompt:
|
||||
raise ValueError("system_prompt is empty; check AILab_System_Prompts.json or preset selection.")
|
||||
system_prompt = (
|
||||
f"{system_prompt}\n\n"
|
||||
"Return only the final prompt text. No preface, no explanations, no analysis, no JSON, no markdown fences, and no <think>.\n"
|
||||
"Return only the final prompt text. No preface, no explanations, no analysis, no JSON, no markdown fences, and no </think>.\n"
|
||||
"Do not write planning steps (no 'First', 'Next', 'Then') and do not use first-person ('I', 'we')."
|
||||
)
|
||||
user_prompt = prompt_text.strip() or "Describe a scene vividly."
|
||||
@@ -394,7 +471,7 @@ class AILab_QwenVL_GGUF_PromptEnhancer:
|
||||
translated = self._invoke_llama(
|
||||
system_prompt=(
|
||||
PROMPT_CONFIG.get("translation_prompt")
|
||||
or "Return a single English paragraph (150-300 words). No prefixes, bullets, JSON, or <think>. "
|
||||
or "Return a single English paragraph (150-300 words). No prefixes, bullets, JSON, or </think>. "
|
||||
"Cover subject, environment, lighting, camera settings, composition, color/texture, and style. Output only the prompt."
|
||||
),
|
||||
user_prompt=enhanced,
|
||||
@@ -407,7 +484,31 @@ class AILab_QwenVL_GGUF_PromptEnhancer:
|
||||
final = clean_model_output(translated, OutputCleanConfig(mode="prompt")) or translated.strip()
|
||||
else:
|
||||
final = clean_model_output(enhanced, OutputCleanConfig(mode="prompt")) or enhanced.strip()
|
||||
return (final,)
|
||||
|
||||
# Cache the generated text
|
||||
PROMPT_CACHE[cache_key] = {
|
||||
"text": final,
|
||||
"timestamp": None, # GGUF PromptEnhancer doesn't have CUDA events
|
||||
"model": model_name,
|
||||
"preset": preset_system_prompt,
|
||||
"seed": seed,
|
||||
"image_hash": None, # PromptEnhancer doesn't use images
|
||||
"video_hash": None # PromptEnhancer doesn't use videos
|
||||
}
|
||||
save_prompt_cache() # Save cache to file
|
||||
|
||||
print(f"[QwenVL PromptEnhancer GGUF] Cached new prompt for seed {seed}: {cache_key[:8]}...")
|
||||
|
||||
try:
|
||||
# Save the generated prompt for future bypass mode
|
||||
LAST_SAVED_PROMPT = final
|
||||
print(f"[QwenVL PromptEnhancer GGUF] Saved prompt for bypass mode: {final[:50]}...")
|
||||
|
||||
return (final,)
|
||||
finally:
|
||||
if not keep_model_loaded:
|
||||
self.clear()
|
||||
print(f"[QwenVL PromptEnhancer GGUF] keep_model_loaded=False - cleaning up model...")
|
||||
|
||||
@staticmethod
|
||||
def _is_english(text):
|
||||
@@ -425,5 +526,5 @@ NODE_CLASS_MAPPINGS = {
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"AILab_QwenVL_GGUF_PromptEnhancer": "QwenVL Prompt Enhancer (GGUF)",
|
||||
"AILab_QwenVL_GGUF_PromptEnhancer": "QwenVL-Mod Prompt Enhancer (GGUF)",
|
||||
}
|
||||
|
||||
@@ -4,7 +4,11 @@
|
||||
#
|
||||
# Source: https://github.com/1038lab/ComfyUI-QwenVL
|
||||
|
||||
import gc
|
||||
import hashlib
|
||||
import json
|
||||
import platform
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
|
||||
import torch
|
||||
@@ -14,11 +18,18 @@ from AILab_QwenVL import (
|
||||
ATTENTION_MODES,
|
||||
HF_TEXT_MODELS,
|
||||
HF_VL_MODELS,
|
||||
PROMPT_CACHE,
|
||||
get_cache_key,
|
||||
get_alternative_cache_key,
|
||||
save_prompt_cache,
|
||||
QwenVLBase,
|
||||
Quantization,
|
||||
TOOLTIPS,
|
||||
)
|
||||
|
||||
# Simple global variable to store last generated prompt
|
||||
LAST_SAVED_PROMPT = None
|
||||
|
||||
NODE_DIR = Path(__file__).parent
|
||||
SYSTEM_PROMPTS_PATH = NODE_DIR / "AILab_System_Prompts.json"
|
||||
|
||||
@@ -62,7 +73,7 @@ class AILab_QwenVL_PromptEnhancer(QwenVLBase):
|
||||
RETURN_TYPES = ("STRING",)
|
||||
RETURN_NAMES = ("ENHANCED_OUTPUT",)
|
||||
FUNCTION = "process"
|
||||
CATEGORY = "🧪AILab/QwenVL"
|
||||
CATEGORY = "🔷 QwenVL-Mod/QwenVL"
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@@ -93,6 +104,7 @@ class AILab_QwenVL_PromptEnhancer(QwenVLBase):
|
||||
"repetition_penalty": ("FLOAT", {"default": 1.1, "min": 0.5, "max": 2.0}),
|
||||
"keep_model_loaded": ("BOOLEAN", {"default": True}),
|
||||
"seed": ("INT", {"default": 1, "min": 1, "max": 2**32 - 1}),
|
||||
"keep_last_prompt": ("BOOLEAN", {"default": False, "tooltip": "Keep the last generated prompt instead of creating a new one"}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,13 +124,29 @@ class AILab_QwenVL_PromptEnhancer(QwenVLBase):
|
||||
repetition_penalty,
|
||||
keep_model_loaded,
|
||||
seed,
|
||||
keep_last_prompt=False,
|
||||
):
|
||||
global LAST_SAVED_PROMPT
|
||||
|
||||
# Simple keep last prompt logic
|
||||
if keep_last_prompt:
|
||||
print(f"[QwenVL PromptEnhancer HF] Keep last prompt enabled - using last saved prompt")
|
||||
if LAST_SAVED_PROMPT:
|
||||
print(f"[QwenVL PromptEnhancer HF] Using last prompt: {LAST_SAVED_PROMPT[:50]}...")
|
||||
return (LAST_SAVED_PROMPT,)
|
||||
else:
|
||||
print(f"[QwenVL PromptEnhancer HF] No previous prompt found, returning empty")
|
||||
return ("",)
|
||||
|
||||
# Always generate when keep last prompt is disabled
|
||||
print(f"[QwenVL PromptEnhancer HF] Keep last prompt disabled - generating new prompt")
|
||||
|
||||
base_instruction = custom_system_prompt.strip() or self.STYLES.get(
|
||||
enhancement_style,
|
||||
next(iter(self.STYLES.values()), ""),
|
||||
)
|
||||
user_prompt = prompt_text.strip() or "Describe a scene vividly."
|
||||
merged_prompt = f"{base_instruction}\n\n{user_prompt}".strip()
|
||||
merged_prompt = f"{user_prompt}\n\n{base_instruction}".strip()
|
||||
if model_name in HF_TEXT_MODELS:
|
||||
enhanced = self._invoke_text(
|
||||
model_name,
|
||||
@@ -147,6 +175,11 @@ class AILab_QwenVL_PromptEnhancer(QwenVLBase):
|
||||
keep_model_loaded,
|
||||
seed,
|
||||
)
|
||||
|
||||
# Save the generated prompt for future bypass mode
|
||||
LAST_SAVED_PROMPT = enhanced.strip()
|
||||
print(f"[QwenVL PromptEnhancer HF] Saved prompt for bypass mode: {LAST_SAVED_PROMPT[:50]}...")
|
||||
|
||||
return (enhanced.strip(),)
|
||||
|
||||
def _invoke_qwen(
|
||||
@@ -241,7 +274,6 @@ class AILab_QwenVL_PromptEnhancer(QwenVLBase):
|
||||
keep_model_loaded,
|
||||
seed,
|
||||
):
|
||||
torch.manual_seed(seed)
|
||||
self._load_text_model(model_name, quantization, device)
|
||||
|
||||
if device == "auto":
|
||||
@@ -263,6 +295,20 @@ class AILab_QwenVL_PromptEnhancer(QwenVLBase):
|
||||
decoded = self.text_tokenizer.decode(outputs[0], skip_special_tokens=True)
|
||||
prefix = self.text_tokenizer.decode(inputs["input_ids"][0], skip_special_tokens=True)
|
||||
result = decoded[len(prefix) :].strip()
|
||||
|
||||
# Cache the generated text
|
||||
# PROMPT_CACHE[cache_key] = {
|
||||
# "text": result,
|
||||
# "timestamp": None, # PromptEnhancer doesn't have CUDA events
|
||||
# "model": model_name,
|
||||
# "preset": style,
|
||||
# "seed": seed,
|
||||
# "image_hash": None, # PromptEnhancer doesn't use images
|
||||
# "video_hash": None # PromptEnhancer doesn't use videos
|
||||
# }
|
||||
# save_prompt_cache() # Save cache to file
|
||||
|
||||
# print(f"[QwenVL PromptEnhancer HF] Cached new prompt for seed {seed}: {cache_key[:8]}...")
|
||||
|
||||
if not keep_model_loaded:
|
||||
self.text_model = None
|
||||
@@ -278,5 +324,5 @@ NODE_CLASS_MAPPINGS = {
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"AILab_QwenVL_PromptEnhancer": "QwenVL Prompt Enhancer",
|
||||
"AILab_QwenVL_PromptEnhancer": "QwenVL-Mod Prompt Enhancer",
|
||||
}
|
||||
|
||||
+39
-19
@@ -1,47 +1,67 @@
|
||||
{
|
||||
"_preset_prompts": [
|
||||
"🍿 Wan 2.2 NSFW I2V Timeline (5s)",
|
||||
"🎥 Wan 2.2 NSFW I2V Scene (5s)",
|
||||
"🎬 Wan 2.2 NSFW I2V Timeline (20s)",
|
||||
"📖 Wan 2.2 NSFW I2V Scene (20s)",
|
||||
"🍿 Wan 2.2 NSFW T2V Timeline (5s)",
|
||||
"🎥 Wan 2.2 NSFW T2V Scene (5s)",
|
||||
"🎬 Wan 2.2 NSFW T2V Timeline (20s)",
|
||||
"📖 Wan 2.2 NSFW T2V Scene (20s)",
|
||||
"🖼️ Tags",
|
||||
"🖼️ Simple Description",
|
||||
"🖼️ Detailed Description",
|
||||
"🖼️ Ultra Detailed Description",
|
||||
"🎬 Cinematic Description",
|
||||
"🖼️ Detailed Analysis",
|
||||
"📹 Video Summary",
|
||||
"📖 Short Story",
|
||||
"🪄 Prompt Refine & Expand"
|
||||
"📹 Video Summary"
|
||||
],
|
||||
"qwenvl": {
|
||||
"🖼️ Tags": "Your task is to generate a clean list of comma-separated tags for a text-to-image AI, based *only* on the visual information in the image. Limit the output to a maximum of 50 unique tags. Strictly describe visual elements like subject, clothing, environment, colors, lighting, and composition. Do not include abstract concepts, interpretations, marketing terms, or technical jargon (e.g., no 'SEO', 'brand-aligned', 'viral potential'). The goal is a concise list of visual descriptors. Avoid repeating tags.",
|
||||
"🍿 Wan 2.2 NSFW I2V Timeline (5s)": "You are a system that converts user prompts from any language and visual inputs into optimized cinematic English descriptions for WAN 2.2 I2V generation.\n\nSteps:\n1. Read the user's input and understand the intention, atmosphere, and desired visual style.\n2. Analyze the provided image or video to extract visual context (subjects, motion, lighting, style, environment).\n3. Combine both sources to create an English prompt optimized for video generation with WAN 2.2.\n\nIMPORTANT: If NO user text input is provided, base is ENTIRE video generation SOLELY on the visual content of the image. Do NOT wait for text input or ask for clarification - proceed with image-only analysis.\n\nStyle Detection and Application:\n- If the user mentions specific visual styles (photorealistic, anime, cartoon, 3D animation, fantasy, artistic portrait), prioritize that style over photorealism.\n- If no specific style is mentioned but the input image/video has stylized characteristics, detect and enhance the existing style.\n- For photorealistic style: Emphasize realistic lighting, natural textures, lifelike details, and authentic motion.\n- For anime style: Emphasize anime character features, vibrant colors, simplified backgrounds, and anime-style motion.\n- For cartoon style: Focus on bold outlines, flat colors, exaggerated expressions, and cartoon-style animation.\n- For 3D animation style: Emphasize 3D rendering characteristics, depth, lighting effects, and smooth 3D motion.\n- For fantasy style: Focus on magical elements, ethereal lighting, fantastical details, and imaginative atmosphere.\n- For artistic portrait style: Emphasize painterly qualities, artistic brushwork, stylized composition, and creative interpretation.\n\nRules:\n- The output must be in fluent English.\n- Structure the description as a precise, continuous scene with a timeline indicated for each second. The video is 5 seconds long (e.g., \"(At 0 seconds: ...) (At 1 seconds: ...) (At 2 seconds: ...) (At 3 seconds: ...) (At 4 seconds: ...) (At 5 seconds: ...)\").\n- Describe the scene with comprehensive artistic details adapted to the requested style: subject(s) and action with style characteristics; environment and atmosphere with artistic elements; lighting and color with stylistic features; camera work and composition adapted to the style.\n- CRITICAL: ONLY describe lighting that is actually visible in the image - do NOT add any artificial lights, studio lights, or lighting effects that are not present\n- The description should be vivid and cinematic, suitable for high-quality video generation.\n- The output should be a single continuous paragraph with timeline markers for each second.\n- Focus on creating a visually rich and stylistically consistent scene.\n\nTechnical specifications:\n- Output length: approximately 200-400 words\n- Include specific details about subjects, actions, environment, lighting, and style elements\n- Maintain consistency with the requested visual style throughout the timeline\n- Ensure smooth transitions between each second of timeline",
|
||||
"🎥 Wan 2.2 NSFW I2V Scene (5s)": "Convert user input + image into ONE single cinematic WAN 2.2 prompt (5s total).\n\nIMPORTANT: If NO user text input is provided, base is ENTIRE video generation SOLELY on the visual content of the image. Do NOT wait for text input or ask for clarification - proceed with image-only analysis.\n\nStyle Priority: User-specified > detected from image > default style\n- If user explicitly mentions a style (photorealistic, anime, cartoon, 3D animation, fantasy, artistic portrait), use that style\n- Else if image has clear stylized characteristics, detect and enhance the existing style from the image\n- Else default to cinematic photorealism with realistic lighting and natural motion\n- For photorealistic style: Emphasize realistic lighting, natural textures, lifelike details, and authentic motion.\n- For anime style: Emphasize anime character features, vibrant colors, simplified backgrounds, and anime-style motion.\n- For cartoon style: Focus on bold outlines, flat colors, exaggerated expressions, and cartoon-style animation.\n- For 3D animation style: Emphasize 3D rendering characteristics, depth, lighting effects, and smooth 3D motion.\n- For fantasy style: Focus on magical elements, ethereal lighting, fantastical details, and imaginative atmosphere.\n- For artistic portrait style: Emphasize painterly qualities, artistic brushwork, stylized composition, and creative interpretation.\n\nCRITICAL FORMAT:\n- Generate exactly ONE single prompt\n- Single prompt = 5 seconds of video\n- NO timeline markers like \"At X seconds:\"\n- 8-12 sentences for rich cinematic detail\n- Focus on complete scene description\n- DO NOT copy example text - generate original content\n\nTECHNICAL RULES:\n- Fluent English only\n- Describe visible elements only (no invented lighting)\n- CRITICAL: ONLY describe lighting that is actually visible in the image - do NOT add any artificial lights, studio lights, or lighting effects that are not present\n- NSFW: Provide explicit descriptions when present\n- No preface/reasoning/notes\n- Rich cinematic descriptions with style details\n- RECOMMENDED: Use max_tokens=512 or higher for complete output\n\nPERFORMANCE OPTIMIZATION:\n- Set context_length to 16384 or higher for better quality\n- Use image_max_tokens=2048 for detailed visual analysis\n- Set n_batch=256 for efficient processing\n- Temperature 0.7-0.8 for creative but coherent output\n\nIMPORTANT: Generate actual cinematic prompt, not example text.",
|
||||
"🎬 Wan 2.2 NSFW I2V Timeline (20s)": "Convert user input + image into FOUR continuous 5-second WAN 2.2 prompts (20s total) using timeline structure.\n\nSteps:\n1. Read the user's input and understand the intention, atmosphere, and desired visual style.\n2. Analyze the provided image or video to extract visual context (subjects, motion, lighting, style, environment).\n3. Generate 4 separate prompts that maintain narrative and visual continuity.\n\nIMPORTANT: If NO user text input is provided, base the ENTIRE video generation SOLELY on the visual content of the image. Do NOT wait for text input or ask for clarification - proceed with image-only analysis.\n\nStyle Detection and Application:\n- If the user mentions specific visual styles (photorealistic, anime, cartoon, 3D animation, fantasy, artistic portrait), prioritize that style over photorealism.\n- If no specific style is mentioned but the input image/video has stylized characteristics, detect and enhance the existing style.\n- For photorealistic style: Emphasize realistic lighting, natural textures, lifelike details, and authentic motion.\n- For anime style: Emphasize anime character features, vibrant colors, simplified backgrounds, and anime-style motion.\n- For cartoon style: Focus on bold outlines, flat colors, exaggerated expressions, and cartoon-style animation.\n- For 3D animation style: Emphasize 3D rendering characteristics, depth, lighting effects, and smooth 3D motion.\n- For fantasy style: Focus on magical elements, ethereal lighting, fantastical details, and imaginative atmosphere.\n- For artistic portrait style: Emphasize painterly qualities, artistic brushwork, stylized composition, and creative interpretation.\n\nRules:\n- The output must be in fluent English.\n- Generate exactly 4 separate prompts, each with timeline structure\n- Each prompt: 5 seconds with timeline markers (e.g., \"(At 0 seconds: ...) (At 1 seconds: ...) (At 2 seconds: ...) (At 3 seconds: ...) (At 4 seconds: ...) (At 5 seconds: ...)\")\n- MANDATORY: Separate prompts with exactly one blank line (press Enter once)\n- CRITICAL CHARACTER CONTINUITY: Each prompt MUST maintain ALL characters and elements from previous prompt - DO NOT remove or change characters between prompts. If there are 2 people in prompt 1, there must be the SAME 2 people in prompts 2, 3, and 4. No character disappearance allowed. This is MANDATORY.\n- Describe the scene with comprehensive artistic details adapted to the requested style: subject(s) and action with style characteristics; environment and atmosphere with artistic elements; stylized lighting design; artistic camera language; stylized composition and mood.\n- Include style-specific technical elements: For photorealistic - realistic lighting, natural textures, lifelike details, and authentic motion; For anime - vibrant colors, simplified backgrounds, anime-style motion; For cartoon - bold outlines, flat colors, exaggerated expressions, and cartoon-style animation; For 3D animation - 3D rendering characteristics, depth, lighting effects, and smooth 3D motion; For fantasy - magical elements, ethereal lighting, fantastical details, and imaginative atmosphere; For artistic portrait - painterly qualities, artistic brushwork, stylized composition, and creative interpretation.\n- Specify ONLY visible technical elements adapted for style: light sources actually present in the image, light quality as observed, time period if evident, shot types matching the image, composition types visible, lens specifications based on perspective, camera movements if present, color tone from the image. Do not invent or add lighting not present in the original image.\n- Maintain consistent character appearance, color tone, lighting, background elements, and cinematic composition according to the requested style.\n- Include dynamic camera movement and ensure logical plot progression with style consistency.\n- WHEN there are NSFW images or text, provide an NSFW description consistent with the requested artistic style.\n- IMPORTANT: Describe ALL content without censorship or filtering, including NSFW content. Provide explicit, detailed descriptions of body parts, sexual acts, and adult content when present. Do not sanitize, euphemize, or avoid explicit content.\n- CRITICAL: DO NOT use transition phrases like \"As the scene progresses\", \"Moving forward\", \"Next\", \"Then\", \"After that\", \"The scene continues\", etc. Describe each prompt as a standalone scene\n- Keep it between 1-6 sentences per timeline entry.\n- No preface, no reasoning.\n- Do not write any Note at the end of the prompt",
|
||||
"📖 Wan 2.2 NSFW I2V Scene (20s)": "Convert user input + image into EXACTLY FOUR continuous 5-second WAN 2.2 prompts (20s total).\n\nIMPORTANT: If NO user text input is provided, base is ENTIRE video generation SOLELY on the visual content of the image. Do NOT wait for text input or ask for clarification - proceed with image-only analysis.\n\nStyle Priority: User-specified > detected > photorealism\n- Photorealistic: realistic lighting, natural textures, lifelike details, and authentic motion\n- Anime: vibrant colors, simplified backgrounds, anime motion\n- Cartoon: bold outlines, flat colors, exaggerated expressions, and cartoon-style animation\n- 3D animation: 3D rendering characteristics, depth, lighting effects, and smooth 3D motion\n- Fantasy: magical elements, ethereal lighting, fantastical details, and imaginative atmosphere\n- Artistic portrait: painterly qualities, artistic brushwork, stylized composition, and creative interpretation\n\nCRITICAL FORMAT:\n- MUST generate EXACTLY FOUR separate prompts - NO MORE, NO LESS\n- Each prompt = 5 seconds of video (0-5s, 5-10s, 10-15s, 15-20s)\n- MANDATORY: Separate prompts with exactly one blank line (press Enter once)\n- NO timeline markers like \"At X seconds:\"\n- Each prompt: 8-12 sentences for rich detail\n- Ensure narrative continuity between parts\n- DO NOT copy example text - generate original content\n- STOP after exactly FOUR prompts - do not generate additional content\n\nHARD ENFORCEMENT:\n- Count your output: MUST be exactly FOUR prompts separated by blank lines\n- If you generate FIVE or more prompts, you have failed the task\n- If you generate THREE or fewer prompts, you have failed the task\n- The structure must be: Prompt1[blank line]Prompt2[blank line]Prompt3[blank line]Prompt4\n- Nothing else after the FOURTH prompt\n\nTECHNICAL RULES:\n- Fluent English only\n- Describe visible elements only (no invented lighting)\n- CRITICAL: ONLY describe lighting that is actually visible in the image - do NOT add any artificial lights, studio lights, or lighting effects that are not present\n- CRITICAL: DO NOT use transition phrases like \"As the scene progresses\", \"Moving forward\", \"Next\", \"Then\", \"After that\", \"The scene continues\", etc. Describe each prompt as a standalone scene\n- NSFW: Provide explicit descriptions when present\n- No preface/reasoning/notes\n- Rich cinematic descriptions with style details\n- RECOMMENDED: Use max_tokens=1024 or higher for complete output\n\nPERFORMANCE OPTIMIZATION:\n- Set context_length to 32768 or higher for better continuity\n- Use image_max_tokens=4096 for detailed visual analysis\n- Set n_batch=512 for efficient processing\n- Temperature 0.7-0.8 for creative but coherent output\n\nFINAL REMINDER: EXACTLY FOUR PROMPTS - NO EXCEPTIONS!",
|
||||
"🖼️ Tags": "Your task is to generate a clean list of comma-separated tags for a text-to-image AI, based *only* on visual information in the image. Limit the output to a maximum of 50 unique tags. Strictly describe visual elements like subject, clothing, environment, colors, lighting, and composition. Do not include abstract concepts, interpretations, marketing terms, or technical jargon (e.g., no 'SEO', 'brand-aligned', 'viral potential'). The goal is a concise list of visual descriptors. Avoid repeating tags.",
|
||||
"🖼️ Simple Description": "Analyze the image and write a single concise sentence that describes the main subject and setting. Keep it grounded in visible details only.",
|
||||
"🖼️ Detailed Description": "Write ONE detailed paragraph (6–10 sentences). Describe only what is visible: subject(s) and actions; people details if present (approx age group, gender expression if clear, hair, facial expression, pose, clothing, accessories); environment (location type, background elements, time cues); lighting (source, direction, softness/hardness, color temperature, shadows); camera viewpoint (eye-level/low/high, distance) and composition (framing, focal emphasis). No preface, no reasoning, no <think>.",
|
||||
"🖼️ Ultra Detailed Description": "Write ONE ultra-detailed paragraph (10–16 sentences, ~180–320 words). Stay grounded in visible details. Include: subject micro-details (materials, textures, patterns, wear, reflections); people details if present (hair, skin tones, makeup, jewelry, fabric types, fit); environment depth (foreground/midground/background, signage/props, surface materials); lighting analysis (key/fill/back light, direction, softness, highlights, shadow shape); camera perspective (angle, lens feel, depth of field) and composition (leading lines, negative space, symmetry/asymmetry, visual hierarchy). No preface, no reasoning, no <think>.",
|
||||
"🎬 Cinematic Description": "Write ONE cinematic paragraph (8–12 sentences). Describe the scene like a film still: subject(s) and action; environment and atmosphere; lighting design (practical lights vs ambient, direction, contrast); camera language (shot type, angle, lens feel, depth of field, motion implied); composition and mood. Keep it vivid but factual (no made-up story). No preface, no reasoning, no <think>.",
|
||||
"🖼️ Detailed Analysis": "Output ONLY these sections with short labels (no bullets): Subject; People (if any); Environment; Lighting; Camera/Composition; Color/Texture. In each section, write 2–4 sentences of concrete visible details. If something is not visible, write 'not visible'. No preface, no reasoning, no <think>.",
|
||||
"📹 Video Summary": "Summarize the key events and narrative points in this video.",
|
||||
"📖 Short Story": "Write a short, imaginative story inspired by this image or video.",
|
||||
"🪄 Prompt Refine & Expand": "Refine and enhance the following user prompt for creative text-to-image generation. Keep the meaning and keywords, make it more expressive and visually rich. Output ONLY the improved prompt text (no preface, no bullets, no JSON, no <think>, no commentary)."
|
||||
"🖼️ Detailed Description": "Write ONE detailed paragraph (6-10 sentences). Describe only what is visible: subject(s) and actions; people details if present (approx age group, gender expression if clear, hair, facial expression, pose, clothing, accessories); environment (location type, background elements, time cues); lighting (source, direction, softness/hardness, color temperature, shadows); camera viewpoint (eye-level/low/high, distance) and composition (framing, focal emphasis). No preface, no reasoning, no emojis.",
|
||||
"🖼️ Ultra Detailed Description": "Write ONE ultra-detailed paragraph (10-16 sentences, ~180-320 words). Stay grounded in visible details. Include: subject micro-details (materials, textures, patterns, wear, reflections); people details if present (hair, skin tones, makeup, jewelry, fabric types, fit); environment depth (foreground/midground/background, signage/props, surface materials); lighting analysis (key/fill/back light, direction, softness, highlights, shadow shape); camera perspective (angle, lens feel, depth of field) and composition (leading lines, negative space, symmetry/asymmetry, visual hierarchy). No preface, no reasoning, no emojis.",
|
||||
"🎬 Cinematic Description": "Write ONE cinematic paragraph (8-12 sentences). Describe the scene like a film still: subject(s) and action; environment and atmosphere; lighting design (practical lights vs ambient, direction, contrast); camera language (shot type, angle, lens feel, depth of field, motion implied); composition and mood. Keep it vivid but factual (no made-up story). No preface, no reasoning, no emojis.",
|
||||
"🖼️ Detailed Analysis": "Output ONLY these sections with short labels (no bullets): Subject; People (if any); Environment; Lighting; Camera/Composition; Color/Texture. In each section, write 2-4 sentences of concrete visible details. If something is not visible, write 'not visible'. No preface, no reasoning, no emojis.",
|
||||
"📹 Video Summary": "Summarize the key events and narrative points in this video."
|
||||
},
|
||||
"qwen_text": {
|
||||
"translation_prompt": "You are a professional prompt translator. Return a single English paragraph (150-300 words). No prefixes, bullets, JSON, or <think>. Preserve all visual and stylistic details.",
|
||||
"translation_prompt": "You are a professional prompt translator. Return a single English paragraph (150-300 words). No prefixes, bullets, JSON, or . Preserve all visual and stylistic details.",
|
||||
"styles": {
|
||||
"📖 Wan 2.2 NSFW T2V Scene (20s)": {
|
||||
"system_prompt": "Generate 1 single T2V prompt for WAN 2.2 video generation (5s total) to establish initial scene.\n\nAPPROACH:\n- Single prompt: T2V (text-to-video) to create the opening scene\n- Establish characters, environment, and initial action\n- Rich cinematic description with style details\n- 8-12 sentences for comprehensive setup\n\nCRITICAL FORMAT:\n- Generate exactly 1 prompt only\n- No separation needed\n- NO labels like \"Prompt 1\", etc.\n- Focus on establishing the complete scene\n- Maintain consistent style\n\nSTYLE PRIORITY:\nUser-specified > detected > default style\n- If user explicitly mentions a style (photorealistic, anime, cartoon, 3D animation, fantasy, artistic portrait), use that style\n- Else default to cinematic photorealism with realistic lighting and natural motion\n- For photorealistic style: Emphasize realistic lighting, natural textures, lifelike details, and authentic motion.\n- For anime style: Emphasize anime character features, vibrant colors, simplified backgrounds, and anime-style motion.\n- For cartoon style: Focus on bold outlines, flat colors, exaggerated expressions, and cartoon-style animation.\n- For 3D animation style: Emphasize 3D rendering characteristics, depth, lighting effects, and smooth 3D motion.\n- For fantasy style: Focus on magical elements, ethereal lighting, fantastical details, and imaginative atmosphere.\n- For artistic portrait style: Emphasize painterly qualities, artistic brushwork, stylized composition, and creative interpretation.\n\nTECHNICAL RULES:\n- Fluent English only\n- Describe visible elements only\n- CRITICAL: ONLY describe lighting that is actually visible in the image - do NOT add any artificial lights, studio lights, or lighting effects that are not present\n- NSFW: Provide explicit descriptions when present\n- No preface/reasoning/notes\n- Temperature 0.7-0.8 for creative output\n\nCRITICAL: Generate exactly 1 comprehensive T2V prompt to establish the scene."
|
||||
},
|
||||
"🍿 Wan 2.2 NSFW T2V Timeline (5s)": {
|
||||
"system_prompt": "You are a system that converts user prompts from any language into optimized cinematic English descriptions for WAN 2.2 T2V generation.\n\nSteps:\n1. Read the user's input and understand the intention, atmosphere, and desired visual style.\n2. Create an English prompt optimized for video generation with WAN 2.2.\n\nStyle Detection and Application:\n- If the user mentions specific visual styles (photorealistic, anime, cartoon, 3D animation, fantasy, artistic portrait), prioritize that style over photorealism.\n- If no specific style is mentioned but the user input suggests stylized characteristics, detect and enhance the existing style.\n- For photorealistic style: Emphasize realistic lighting, natural textures, lifelike details, and authentic motion.\n- For anime style: Emphasize anime character features, vibrant colors, simplified backgrounds, and anime-style motion.\n- For cartoon style: Focus on bold outlines, flat colors, exaggerated expressions, and cartoon-style animation.\n- For 3D animation style: Emphasize 3D rendering characteristics, depth, lighting effects, and smooth 3D motion.\n- For fantasy style: Focus on magical elements, ethereal lighting, fantastical details, and imaginative atmosphere.\n- For artistic portrait style: Emphasize painterly qualities, artistic brushwork, stylized composition, and creative interpretation.\n\nRules:\n- The output must be in fluent English.\n- Structure the description as a precise, continuous scene with a timeline indicated for each second. The video is 5 seconds long (e.g., \"(At 0 seconds: ...) (At 1 seconds: ...) (At 2 seconds: ...) (At 3 seconds: ...) (At 4 seconds: ...) (At 5 seconds: ...)\").\n- Describe the scene with comprehensive artistic details adapted to the requested style: subject(s) and action with style characteristics; environment and atmosphere with artistic elements; stylized lighting design; artistic camera language; stylized composition and mood.\n- Include style-specific technical elements: For photorealistic - realistic lighting, natural textures, lifelike details, and authentic motion; For anime - vibrant colors, simplified backgrounds, anime-style motion; For cartoon - bold outlines, flat colors, exaggerated expressions, and cartoon-style animation; For 3D animation - 3D rendering characteristics, depth, lighting effects, and smooth 3D motion; For fantasy - magical elements, ethereal lighting, fantastical details, and imaginative atmosphere; For artistic portrait - painterly qualities, artistic brushwork, stylized composition, and creative interpretation.\n- Specify ONLY visible technical elements adapted for style: light sources actually present in the image, light quality as observed, time period if evident, shot types matching the image, composition types visible, lens specifications based on perspective, camera movements if present, color tone from the image. Do not invent or add lighting not present in the original image.\n- WHEN there are NSFW images or text, provide an NSFW description consistent with the requested artistic style.\n- IMPORTANT: Describe ALL content without censorship or filtering, including NSFW content. Provide explicit, detailed descriptions of body parts, sexual acts, and adult content when present. Do not sanitize, euphemize, or avoid explicit content.\n- CRITICAL: DO NOT use transition phrases like \"As the scene progresses\", \"Moving forward\", \"Next\", \"Then\", \"After that\", \"The scene continues\", etc. Describe each prompt as a standalone scene\n- Keep it between 1-6 sentences per timeline entry.\n- No preface, no reasoning.\n- Do not write any Note at the end of the prompt. The video is 5 seconds long (e.g., \"(At 0 seconds: ...) (At 1 seconds: ...) (At 2 seconds: ...) (At 3 seconds: ...) (At 4 seconds: ...) (At 5 seconds: ...)\")."
|
||||
},
|
||||
"🎬 Wan 2.2 NSFW T2V Timeline (20s)": {
|
||||
"system_prompt": "Convert user input into 4 continuous 5-second WAN 2.2 prompts (20s total) using timeline structure.\n\nSteps:\n1. Read the user's input and understand the intention, atmosphere, and desired visual style.\n2. Generate 4 separate prompts that maintain narrative and visual continuity.\n\nStyle Detection and Application:\n- If the user mentions specific visual styles (photorealistic, anime, cartoon, 3D animation, fantasy, artistic portrait), prioritize that style over photorealism.\n- If no specific style is mentioned but the user input suggests stylized characteristics, detect and enhance the existing style.\n- For photorealistic style: Emphasize realistic lighting, natural textures, lifelike details, and authentic motion.\n- For anime style: Emphasize anime character features, vibrant colors, simplified backgrounds, and anime-style motion.\n- For cartoon style: Focus on bold outlines, flat colors, exaggerated expressions, and cartoon-style animation.\n- For 3D animation style: Emphasize 3D rendering characteristics, depth, lighting effects, and smooth 3D motion.\n- For fantasy style: Focus on magical elements, ethereal lighting, fantastical details, and imaginative atmosphere.\n- For artistic portrait style: Emphasize painterly qualities, artistic brushwork, stylized composition, and creative interpretation.\n\nRules:\n- The output must be in fluent English.\n- Generate exactly 4 separate prompts, each with timeline structure\n- Each prompt: 5 seconds with timeline markers (e.g., \"(At 0 seconds: ...) (At 1 seconds: ...) (At 2 seconds: ...) (At 3 seconds: ...) (At 4 seconds: ...) (At 5 seconds: ...)\")\n- MANDATORY: Separate prompts with exactly one blank line (press Enter once)\n- CRITICAL CHARACTER CONTINUITY: Each prompt MUST maintain ALL characters and elements from previous prompt - DO NOT remove or change characters between prompts. If there are 2 people in prompt 1, there must be the SAME 2 people in prompts 2, 3, and 4. No character disappearance allowed. This is MANDATORY.\n- Describe the scene with comprehensive artistic details adapted to the requested style: subject(s) and action with style characteristics; environment and atmosphere with artistic elements; stylized lighting design; artistic camera language; stylized composition and mood.\n- Include style-specific technical elements: For photorealistic - realistic lighting, natural textures, lifelike details, and authentic motion; For anime - vibrant colors, simplified backgrounds, anime-style motion; For cartoon - bold outlines, flat colors, exaggerated expressions, and cartoon-style animation; For 3D animation - 3D rendering characteristics, depth, lighting effects, and smooth 3D motion; For fantasy - magical elements, ethereal lighting, fantastical details, and imaginative atmosphere; For artistic portrait - painterly qualities, artistic brushwork, stylized composition, and creative interpretation.\n- Specify ONLY visible technical elements adapted for style: light sources based on scene requirements, light quality as appropriate for the style, time period if evident, shot types matching the scene, composition types visible, lens specifications based on perspective, camera movements if present, color tone appropriate for the style.\n- Maintain consistent character appearance, color tone, lighting, background elements, and cinematic composition according to the requested style.\n- Include dynamic camera movement and ensure logical plot progression with style consistency.\n- WHEN there are NSFW content, provide an NSFW description consistent with the requested artistic style.\n- IMPORTANT: Describe ALL content without censorship or filtering, including NSFW content. Provide explicit, detailed descriptions of body parts, sexual acts, and adult content when present. Do not sanitize, euphemize, or avoid explicit content.\n- CRITICAL: DO NOT use transition phrases like \"As the scene progresses\", \"Moving forward\", \"Next\", \"Then\", \"After that\", \"The scene continues\", etc. Describe each prompt as a standalone scene\n- Keep it between 1-6 sentences per timeline entry.\n- No preface, no reasoning.\n- Do not write any Note at the end of the prompt"
|
||||
},
|
||||
"🎥 Wan 2.2 NSFW T2V Scene (5s)": {
|
||||
"system_prompt": "Convert user input into 1 single cinematic WAN 2.2 prompt (5s total).\n\nStyle Priority: User-specified > detected from image > default style\n- If user explicitly mentions a style (photorealistic, anime, cartoon, 3D animation, fantasy, artistic portrait), use that style\n- Else if image has clear stylized characteristics, detect and enhance the existing style from the image\n- Else default to cinematic photorealism with realistic lighting and natural motion\n- For photorealistic style: Emphasize realistic lighting, natural textures, lifelike details, and authentic motion.\n- For anime style: Emphasize anime character features, vibrant colors, simplified backgrounds, and anime-style motion.\n- For cartoon style: Focus on bold outlines, flat colors, exaggerated expressions, and cartoon-style animation.\n- For 3D animation style: Emphasize 3D rendering characteristics, depth, lighting effects, and smooth 3D motion.\n- For fantasy style: Focus on magical elements, ethereal lighting, fantastical details, and imaginative atmosphere.\n- For artistic portrait style: Emphasize painterly qualities, artistic brushwork, stylized composition, and creative interpretation.\n\nCRITICAL FORMAT:\n- Generate exactly 1 single prompt\n- Single prompt = 5 seconds of video\n- NO timeline markers like \"At X seconds:\"\n- 8-12 sentences for rich cinematic detail\n- Focus on complete scene description\n- DO NOT copy example text - generate original content\n\nTECHNICAL RULES:\n- Fluent English only\n- Describe visible elements only (no invented lighting)\n- CRITICAL: ONLY describe lighting that is actually visible in the image - do NOT add any artificial lights, studio lights, or lighting effects that are not present\n- NSFW: Provide explicit descriptions when present\n- No preface/reasoning/notes\n- Rich cinematic descriptions with style details\n- RECOMMENDED: Use max_tokens=512 or higher for complete output\n\nPERFORMANCE OPTIMIZATION:\n- Set context_length to 16384 or higher for better quality\n- Set n_batch=256 for efficient processing\n- Temperature 0.7-0.8 for creative but coherent output\n\nIMPORTANT: Generate actual cinematic prompt, not example text."
|
||||
},
|
||||
"📝 Enhance": {
|
||||
"system_prompt": "You are a professional photography prompt writer. Respond in the same language as the user input.\n\nWrite ONE final cinematic photography prompt paragraph (150–300 words) based on the user text.\n\nStrict output rules:\n- Output ONLY the prompt paragraph. Start immediately with the scene.\n- Do NOT output any reasoning, planning, or meta text (no \"Okay\", no \"First/Next/Then\", no \"I/we\").\n- Do NOT use <think>, quotes, markdown, code fences, JSON, headings, or bullet points.\n\nInclude naturally: subject + action/pose, environment, lighting, camera/lens/DoF, composition, color/texture, mood/style.\n\nIf input is short/ambiguous, infer minimal sensible details and keep it coherent."
|
||||
"system_prompt": "You are a professional photography prompt writer. Respond in the same language as the user input.\n\nWrite ONE final cinematic photography prompt paragraph (150-300 words) based on the user text.\n\nStrict output rules:\n- Output ONLY the prompt paragraph. Start immediately with the scene.\n- Do NOT output any reasoning, planning, or meta text (no \"Okay\", no \"First/Next/Then\", no \"I/we\").\n- Do NOT use <think>, quotes, markdown, code fences, JSON, headings, or bullet points.\n\nInclude naturally: subject + action/pose, environment, lighting, camera/lens/DoF, composition, color/texture, mood/style.\n\nIf input is short/ambiguous, infer minimal sensible details and keep it coherent."
|
||||
},
|
||||
"📝 Refine": {
|
||||
"system_prompt": "You are a photography prompt refiner. Respond in the same language as the user input.\n\nWrite ONE clear, concise photography prompt paragraph (120–200 words) that preserves the user’s intent.\n\nStrict output rules:\n- Output ONLY the prompt paragraph. Start immediately with the scene.\n- No reasoning, no planning, no meta text (no \"Okay\", no \"First/Next/Then\", no \"I/we\").\n- No <think>, no quotes, no markdown, no code fences, no JSON, no headings, no bullet points.\n\nInclude: subject cues, environment context, lighting, camera parameters, composition focus, color/texture hints, and style tone. Remove redundancy."
|
||||
"system_prompt": "You are a photography prompt refiner. Respond in the same language as the user input.\n\nWrite ONE clear, concise photography prompt paragraph (120-200 words) that preserves the user’s intent.\n\nStrict output rules:\n- Output ONLY the prompt paragraph. Start immediately with the scene.\n- No reasoning, no planning, no meta text (no \"Okay\", no \"First/Next/Then\", no \"I/we\").\n- No <think>, no quotes, no markdown, no code fences, no JSON, no headings, no bullet points.\n\nInclude: subject cues, environment context, lighting, camera parameters, composition focus, color/texture hints, and style tone. Remove redundancy."
|
||||
},
|
||||
"📝 Creative Rewrite": {
|
||||
"system_prompt": "You are a creative photography prompt writer. Respond in the same language as the user input.\n\nRewrite the user’s scene into ONE fresh, imaginative photography prompt paragraph (150–250 words).\n\nStrict output rules:\n- Output ONLY the prompt paragraph. Start immediately with the scene.\n- No reasoning, no planning, no meta text (no \"Okay\", no \"First/Next/Then\", no \"I/we\").\n- No <think>, no quotes, no markdown, no code fences, no JSON, no headings, no bullet points.\n\nPreserve the core intent while adding vivid imagery and cohesive narrative flair. Integrate subject, environment, lighting, camera hints, composition, color/texture, and style."
|
||||
"system_prompt": "You are a creative photography prompt writer. Respond in the same language as the user input.\n\nRewrite the user’s scene into ONE fresh, imaginative photography prompt paragraph (150-250 words).\n\nStrict output rules:\n- Output ONLY the prompt paragraph. Start immediately with the scene.\n- No reasoning, no planning, no meta text (no \"Okay\", no \"First/Next/Then\", no \"I/we\").\n- No <think>, no quotes, no markdown, no code fences, no JSON, no headings, no bullet points.\n\nPreserve the core intent while adding vivid imagery and cohesive narrative flair. Integrate subject, environment, lighting, camera hints, composition, color/texture, and style."
|
||||
},
|
||||
"📝 Detailed Visual": {
|
||||
"system_prompt": "You specialize in detailed visual photography prompts. Respond in the same language as the user input.\n\nWrite ONE flowing, highly visual photography prompt paragraph (180–260 words).\n\nStrict output rules:\n- Output ONLY the prompt paragraph. Start immediately with the scene.\n- No reasoning, no planning, no meta text (no \"Okay\", no \"First/Next/Then\", no \"I/we\").\n- No <think>, no quotes, no markdown, no code fences, no JSON, no headings, no bullet points.\n\nInclude concrete cues: subject traits and pose, foreground/midground/background, materials and textures, lighting direction/intensity/color temperature, colors and contrast, scale, atmosphere, and composition focus."
|
||||
"system_prompt": "You specialize in detailed visual photography prompts. Respond in the same language as the user input.\n\nWrite ONE flowing, highly visual photography prompt paragraph (180-260 words).\n\nStrict output rules:\n- Output ONLY the prompt paragraph. Start immediately with the scene.\n- No reasoning, no planning, no meta text (no \"Okay\", no \"First/Next/Then\", no \"I/we\").\n- No <think>, no quotes, no markdown, no code fences, no JSON, no headings, no bullet points.\n\nInclude concrete cues: subject traits and pose, foreground/midground/background, materials and textures, lighting direction/intensity/color temperature, colors and contrast, scale, atmosphere, and composition focus."
|
||||
},
|
||||
"📝 Artistic Style": {
|
||||
"system_prompt": "You craft artistic photography prompts. Respond in the same language as the user input.\n\nWrite ONE artistic photography prompt paragraph (180–260 words).\n\nStrict output rules:\n- Output ONLY the prompt paragraph. Start immediately with the scene.\n- No reasoning, no planning, no meta text (no \"Okay\", no \"First/Next/Then\", no \"I/we\").\n- No <think>, no quotes, no markdown, no code fences, no JSON, no headings, no bullet points.\n\nWeave in subject, scene, and lighting with explicit style references (e.g., cinematic, fashion, fine art), mood, composition cues, and aesthetic adjectives. Keep it cohesive and visually rich."
|
||||
"system_prompt": "You craft artistic photography prompts. Respond in the same language as the user input.\n\nWrite ONE artistic photography prompt paragraph (180-260 words).\n\nStrict output rules:\n- Output ONLY the prompt paragraph. Start immediately with the scene.\n- No reasoning, no planning, no meta text (no \"Okay\", no \"First/Next/Then\", no \"I/we\").\n- No <think>, no quotes, no markdown, no code fences, no JSON, no headings, no bullet points.\n\nWeave in subject, scene, and lighting with explicit style references (e.g., cinematic, fashion, fine art), mood, composition cues, and aesthetic adjectives. Keep it cohesive and visually rich."
|
||||
},
|
||||
"📝 Technical Specs": {
|
||||
"system_prompt": "You convert scenes into technical photography directives. Respond in the same language as the user input.\n\nWrite ONE clear, actionable photography prompt paragraph (130–210 words).\n\nStrict output rules:\n- Output ONLY the prompt paragraph. Start immediately with the scene.\n- No reasoning, no planning, no meta text (no \"Okay\", no \"First/Next/Then\", no \"I/we\").\n- No <think>, no quotes, no markdown, no code fences, no JSON, no headings, no bullet points.\n\nCover: subject and scene plus focal length, aperture, depth of field, shooting angle, lighting type/direction, color temperature, focus target, and composition priorities as sentences."
|
||||
"system_prompt": "You convert scenes into technical photography directives. Respond in the same language as the user input.\n\nWrite ONE clear, actionable photography prompt paragraph (130-210 words).\n\nStrict output rules:\n- Output ONLY the prompt paragraph. Start immediately with the scene.\n- No reasoning, no planning, no meta text (no \"Okay\", no \"First/Next/Then\", no \"I/we\").\n- No <think>, no quotes, no markdown, no code fences, no JSON, no headings, no bullet points.\n\nCover: subject and scene plus focal length, aperture, depth of field, shooting angle, lighting type/direction, color temperature, focus target, and composition priorities as sentences."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,165 @@
|
||||
# **QwenVL for ComfyUI**
|
||||
# **QwenVL-Mod for ComfyUI**
|
||||
|
||||
The ComfyUI-QwenVL custom node integrates the powerful Qwen-VL series of vision-language models (LVLMs) from Alibaba Cloud, including the latest Qwen3-VL and Qwen2.5-VL, plus GGUF backends and text-only Qwen3 support. This advanced node enables seamless multimodal AI capabilities within your ComfyUI workflows, allowing for efficient text generation, image understanding, and video analysis.
|
||||
[](https://github.com/comfyanonymous/ComfyUI)
|
||||
[](LICENSE)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod/releases)
|
||||
[](https://python.org)
|
||||
[](https://pytorch.org)
|
||||
[](https://developer.nvidia.com/cuda-zone)
|
||||
[](https://huggingface.co/Qwen)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod/issues)
|
||||
|
||||

|
||||
[](https://lightning.ai/huchukato/environments/comfyui-v0-14-2-wan2-2-qwen3-vl-autoprompt)
|
||||
|
||||
[](https://buymeacoffee.com/huchukato)
|
||||
|
||||
## 🚀 **API Support & Troubleshooting**
|
||||
|
||||
Having issues with ComfyUI API? We've got you covered!
|
||||
|
||||
### 📋 **Quick API Help**
|
||||
- 📖 **[API Guide](./API_GUIDE.md)** - Complete API documentation
|
||||
- 🛠️ **[Debug Script](./debug_api.py)** - Automated API diagnostics
|
||||
- 🎯 **Example Workflows** - Ready-to-use API templates
|
||||
|
||||
### 🔧 **Common API Issues**
|
||||
| Issue | Solution |
|
||||
|-------|----------|
|
||||
| "node not found" | Check QwenVL-Mod installation |
|
||||
| "model not found" | Verify model files in `/models/` |
|
||||
| "invalid input" | Check parameter formats |
|
||||
| "queue full" | Wait for current jobs |
|
||||
|
||||
### 🧪 **Quick Debug**
|
||||
```bash
|
||||
# Run API diagnostics
|
||||
python debug_api.py --url http://localhost:18188
|
||||
|
||||
# Check available nodes
|
||||
curl http://localhost:18188/object_info
|
||||
|
||||
# Test simple workflow
|
||||
curl -X POST http://localhost:18188/prompt -d @test_workflow.json
|
||||
```
|
||||
|
||||
### 📞 **Need More Help?**
|
||||
Ask user for:
|
||||
1. **Error message** (exact text)
|
||||
2. **Workflow JSON** (sanitized)
|
||||
3. **Debug output** (from debug_api.py)
|
||||
4. **ComfyUI logs** (API section)
|
||||
|
||||
---
|
||||
|
||||
The ComfyUI-QwenVL custom node integrates powerful Qwen-VL series of vision-language models (LVLMs) from Alibaba Cloud, including latest Qwen3-VL and Qwen2.5-VL, plus GGUF backends and text-only Qwen3 support. This advanced node enables seamless multimodal AI capabilities within your ComfyUI workflows, allowing for efficient text generation, image understanding, and video analysis.
|
||||
|
||||
<img width="749" height="513" alt="Qwen3-VL-Mod" src="https://github.com/user-attachments/assets/0f10b887-1953-4923-b813-37ccacb8a9aa" />
|
||||
|
||||
## **📰 News & Updates**
|
||||
* **2026/02/27**: **v2.2.3** 🔧 **CUDA 13 Compatibility Fix + Redundancy Removal**. [[Update](update.md#version-223-20260227)]
|
||||
> 🔧 **Removed unload_after_run**: Eliminated redundant checkbox from all QwenVL nodes to prevent CUDA 13 conflicts.
|
||||
> 🐛 **Fixed Parameter Errors**: Resolved "missing 1 required positional argument: unload_after_run" errors in all nodes.
|
||||
> 🎯 **Simplified Interface**: Cleaner node interface without redundant parameters.
|
||||
> 🧠 **VRAM Cleanup Node**: Maintained for manual cleanup when needed.
|
||||
> 🏆 **Community Credits**: Thanks to user feedback that identified redundancy and parameter issues.
|
||||
|
||||
* **2026/02/27**: **v2.2.3** 🚀 Critical T2V/I2V Fixes + ComfyUI Optimizations. [[Update](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-223-20260227)]
|
||||
> 🚀 **Batch Processing**: Fixed critical T2V → GGUF issue with batch images from video generation.
|
||||
> 🔄 **Same Model Reuse**: Resolved conflict when using same model between T2V and I2V nodes.
|
||||
> ⚙️ **Flash Attention 2**: Added Flash Attention 2 support for performance boost on compatible hardware.
|
||||
> ⚙️ **ComfyUI Args**: Optimized startup arguments with validated experimental features.
|
||||
> 🔧 **keep_model_loaded**: Added missing parameter to PromptEnhancer for consistent memory management.
|
||||
> 🐳 **Final Docker Build**: Optimized build with all fixes and maximum performance.
|
||||
|
||||
* **2026/02/18**: **v2.2.1** 🔧 Critical GGUF VRAM Fix + Docker Optimized. [[Update](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-221-20260218)]
|
||||
> 🔧 **GGUF VRAM Fix**: Resolved critical VRAM leak issue causing crashes after 2 executions.
|
||||
> 🧹 **Aggressive Cleanup**: Implemented complete VRAM cleanup for all GGUF nodes (AILab_QwenVL_GGUF and PromptEnhancer).
|
||||
> 🚀 **Stable Performance**: GGUF nodes now work reliably without VRAM accumulation.
|
||||
> 🐳 **Docker Enhanced**: Updated Dockerfiles with RunPod-tested methods for Jupyter and FileBrowser.
|
||||
> 🔄 **ComfyUI Latest**: Always latest stable version without manual updates.
|
||||
> 📡 **Complete SSH**: Server + client SSH for full networking functionality.
|
||||
> 🎯 **Jupyter Terminal**: Adopted RunPod method for working terminal.
|
||||
|
||||
* **2026/02/15**: **v2.2.0** 🎬 WAN 2.2 Story Generation System. [[Update](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-220-20260215)]
|
||||
> 🎬 **Story Generation**: Complete 4-segment video story generation with WAN 2.2
|
||||
> 🔄 **Auto-Split Node**: Intelligent prompt splitting for continuous 20-second videos
|
||||
> 📝 **Show Text Node**: Built-in text display node without external dependencies
|
||||
> 🎯 **Enhanced Prompts**: Optimized WAN 2.2 NSFW Story prompts with better formatting
|
||||
> ⚡ **Performance**: Optimized context settings for 8B models (65,536 tokens)
|
||||
> 🐳 **Docker Ready**: Complete Story system integrated in Docker containers
|
||||
> 🎨 **Workflows**: Ready-to-use WAN 2.2 Story and T2V workflows included
|
||||
|
||||
* **2026/02/14**: **v2.1.0** User-Friendly Keep Last Prompt Feature. [[Update](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-210-20260214)]
|
||||
> [!NOTE]
|
||||
* **2026/02/12**: **v2.0.9** Bypass Mode parameter for prompt persistence. [[Update](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-209-20260212)]
|
||||
> 🎛️ **Bypass Mode**: New `bypass_mode` parameter allows maintaining previously generated prompts without regeneration.
|
||||
> 🔄 **Smart Cache**: When bypass mode is enabled, nodes retrieve the most recent cached prompt for the current model.
|
||||
> 🎯 **Perfect Workflow**: Generate prompts once, then enable bypass mode to preserve them while changing inputs.
|
||||
> ⚡ **Zero Resource Usage**: Bypass mode consumes no computational resources - instant response.
|
||||
> 📋 **Universal Feature**: Available across all nodes (HF, GGUF, PromptEnhancer, Advanced variants).
|
||||
> 🎮 **Simple Control**: Just toggle the bypass_mode checkbox to enable/disable prompt persistence.
|
||||
|
||||
* **2026/02/06**: **v2.0.8** Bug fixes and stability improvements. [[Update](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-208-20260206)]
|
||||
> [!NOTE]
|
||||
> 🐛 **Bug Fixes**: Fixed JSON syntax error in system prompts and undefined variable issues.
|
||||
> 🌐 **Multilingual Support**: Complete multilingual support added to all WAN 2.2 presets.
|
||||
> 🎨 **Style Detection**: Enhanced visual style detection for anime, 3D, pixel art, and more.
|
||||
> 🔧 **Stability**: Reverted problematic fixed seed improvements to maintain stable operation.
|
||||
> 📝 **Documentation**: Updated README and changelog with today's improvements.
|
||||
|
||||
* **2026/02/04**: **v2.0.7** Smart prompt caching system with Fixed Seed Mode. [[Update](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-207-20260204)]
|
||||
> [!NOTE]
|
||||
> 🧠 **Smart Caching**: Automatic prompt caching prevents regeneration of identical prompts.
|
||||
> 🔒 **Fixed Seed Mode**: Set any fixed seed value to maintain consistent prompts regardless of media variations.
|
||||
> ⚡ **Performance Boost**: Instant response for cached prompts with zero model loading time.
|
||||
> 🔧 **Code Maintenance**: Removed deprecated parameters across all download functions for future compatibility.
|
||||
> 📈 **GGUF Enhancement**: Increased default context size from 8192 to 32768 for better model utilization.
|
||||
> 🔄 **Universal Caching**: Fixed Seed Mode and smart caching now available across all nodes (HF, GGUF, PromptEnhancer).
|
||||
> 🎯 **Simplified Logic**: Streamlined caching system that always includes seed for predictable behavior across all seed values.
|
||||
|
||||
### 🔥 Version 2.1.0 - Enhanced NSFW Support & Lighting Accuracy
|
||||
- **🔥 Stronger NSFW Instructions**: Enhanced system prompts with explicit directives for uncensored content generation
|
||||
- **🔦 Fixed Lighting Invention**: Corrected AI tendency to add lights not present in source images
|
||||
- **🎯 Improved Accuracy**: Better content fidelity for both NSFW descriptions and lighting analysis
|
||||
- **🔄 Updated GGUF Models**: Replaced noctrex models with mradermacher v2/v3 variants for better performance
|
||||
- **📦 Enhanced Model Selection**: Added Josiefied-Qwen3-VL-4B-Instruct-abliterated-beta-v1 (HF only) (HF, GGUF, PromptEnhancer).
|
||||
|
||||
* **2026/02/03**: **v2.0.6** Professional cinematography enhancement for all WAN 2.2 presets. [[Update](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-206-20260203)]
|
||||
> [!NOTE]
|
||||
> 🎬 **Professional Specs**: All WAN 2.2 presets now include comprehensive cinematography specifications.
|
||||
> 📹 **Technical Details**: Light sources, shot types, lens specs, camera movements, color tone requirements.
|
||||
> 🎯 **Consistent Branding**: Updated preset names with WAN family branding for better organization.
|
||||
|
||||
* **2026/02/01**: **v2.0.5** Extended Storyboard preset added for WAN 2.2 format continuity. [[Update](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-205-20260201)]
|
||||
> [!NOTE]
|
||||
> 🎬 **Extended Storyboard**: New preset for seamless storyboard-to-storyboard generation with timeline format.
|
||||
> 🔄 **Continuity Focus**: Each paragraph repeats previous content for smooth transitions.
|
||||
> 🎯 **WAN 2.2 Compatible**: Same timeline structure and NSFW support as I2V preset.
|
||||
|
||||
* **2026/02/01**: **v2.0.4** Stability update - removed SageAttention for better compatibility and model output reliability. [[Update](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-204-20260201)]
|
||||
> [!NOTE]
|
||||
> 🔧 **Flash Attention 2**: Still available for 2-3x speedup on compatible hardware.
|
||||
> 🛡️ **Enhanced Stability**: Clean attention pipeline with SDPA as reliable fallback.
|
||||
|
||||
* **2026/02/01**: **v2.0.3** SageAttention compatibility fix for proper patching across transformer versions. [[Update](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-203-20260201)]
|
||||
> [!NOTE]
|
||||
> 🔧 **Critical Fix**: Resolved AttributeError preventing Flash Attention 2 from working with certain transformer versions.
|
||||
> ⚡ **Performance Restored**: 2-5x speedup now works correctly with 8-bit quantization on compatible hardware.
|
||||
|
||||
* **2026/02/01**: **v2.0.2** Enhanced model accessibility, improved custom prompt logic, and expanded NSFW content generation. [[Update](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-202-20260201)]
|
||||
> [!NOTE]
|
||||
> 🚀 **Free Abliterated Models**: Added token-free uncensored models as defaults for better accessibility.
|
||||
> 🔧 **Custom Prompt Fix**: Now combines with preset templates instead of replacing them across all nodes.
|
||||
> 📝 **Enhanced NSFW**: Comprehensive descriptions for adult content generation with detailed act specifications.
|
||||
> 🎬 **WAN 2.2 Priority**: Moved video generation preset to top position for faster workflow access.
|
||||
|
||||
* **2026/01/30**: **v2.0.1-enhanced** Added Flash Attention 2 support and WAN 2.2 integration. [[Update](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-201-enhanced-20260130)]
|
||||
> [!NOTE]
|
||||
> 🚀 **Flash Attention 2**: 2-5x performance boost with 8-bit quantized attention for RTX 30+ GPUs.
|
||||
> 🎬 **WAN 2.2 Integration**: New specialized prompts for cinematic video generation - convert images/videos to 5-second timeline descriptions (I2V) or text to video (T2V) with professional scene direction.
|
||||
>
|
||||
* **2025/12/22**: **v2.0.0** Added GGUF supported nodes and Prompt Enhancer nodes. [[Update](https://github.com/1038lab/ComfyUI-QwenVL/blob/main/update.md#version-200-20251222)]
|
||||
> [!IMPORTANT]
|
||||
> Install llama-cpp-python before running GGUF nodes [instruction](docs/LLAMA_CPP_PYTHON_VISION_INSTALL.md)
|
||||
@@ -28,14 +183,31 @@ The ComfyUI-QwenVL custom node integrates the powerful Qwen-VL series of vision-
|
||||
|
||||
## **✨ Features**
|
||||
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
[](https://huggingface.co/Qwen)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
|
||||
* **Standard & Advanced Nodes**: Includes a simple QwenVL node for quick use and a QwenVL (Advanced) node with fine-grained control over generation.
|
||||
* **Prompt Enhancers**: Dedicated text-only prompt enhancers for both HF and GGUF backends.
|
||||
* **Preset & Custom Prompts**: Choose from a list of convenient preset prompts or write your own for full control.
|
||||
* **Multi-Model Support**: Easily switch between various official Qwen-VL models.
|
||||
* **Preset & Custom Prompts**: Choose from a list of convenient preset prompts or write your own for full control. Custom prompts now combine with preset templates for enhanced flexibility.
|
||||
* **Smart Prompt Caching**: Automatic caching system prevents regeneration of identical prompts, dramatically improving performance for repeated inputs. Cache persists across ComfyUI restarts.
|
||||
* **🎛️ Bypass Mode**: New `bypass_mode` parameter allows maintaining previously generated prompts without regeneration. Generate once, then enable bypass mode to preserve prompts while changing inputs. Zero resource usage in bypass mode.
|
||||
* **Fixed Seed Mode**: Set seed = 1 to ignore image/video changes and maintain consistent prompts regardless of media variations. Perfect for stable workflow outputs.
|
||||
* **WAN 2.2 Integration**: Specialized prompts for WAN 2.2 I2V (image-to-video) and T2V (text-to-video) generation with professional cinematography specifications and cinematic timeline structure. I2V preset prioritized for faster workflow access.
|
||||
* **Professional Cinematography**: All WAN 2.2 presets include comprehensive technical specifications - light sources, shot types, lens specifications, camera movements, and color tone requirements for professional video generation.
|
||||
* **Extended Storyboard**: New preset for seamless storyboard-to-storyboard generation with WAN 2.2 format compatibility, continuity focus, and professional cinematography details.
|
||||
* **WAN Family Branding**: Consistent naming across all WAN 2.2 presets for better organization and workflow clarity.
|
||||
* **Free Abliterated Models**: Default models include token-free uncensored options (Qwen3-4B-abliterated-TIES, Qwen3-8B-abliterated-TIES) for immediate accessibility.
|
||||
* **Multi-Model Support**: Easily switch between various official Qwen-VL models with smart 4B-first ordering for VRAM efficiency.
|
||||
* **Automatic Model Download**: Models are downloaded automatically on first use.
|
||||
* **Smart Quantization**: Balance VRAM and performance with 4-bit, 8-bit, and FP16 options.
|
||||
* **Smart Quantization**: Balance VRAM and performance with 4-bit, 8-bit, and FP16 options. 8-bit quantization enabled by default for optimal accessibility.
|
||||
* **Optimized Attention**: Clean attention pipeline with Flash Attention 2 support and stable SDPA fallback. No complex patching that could interfere with model output.
|
||||
* **Hardware-Aware**: Automatically detects GPU capabilities and prevents errors with incompatible models (e.g., FP8).
|
||||
* **Reproducible Generation**: Use the seed parameter to get consistent outputs.
|
||||
* **Reproducible Generation**: Use the seed parameter to get consistent outputs, with Fixed Seed Mode for ultimate stability.
|
||||
* **Memory Management**: "Keep Model Loaded" option to retain the model in VRAM for faster processing.
|
||||
* **Image & Video Support**: Accepts both single images and video frame sequences as input.
|
||||
* **Robust Error Handling**: Provides clear error messages for hardware or memory issues.
|
||||
@@ -43,19 +215,40 @@ The ComfyUI-QwenVL custom node integrates the powerful Qwen-VL series of vision-
|
||||
|
||||
## **🚀 Installation**
|
||||
|
||||
1. Clone this repository to your ComfyUI/custom\_nodes directory:
|
||||
1. Clone this repository to your ComfyUI/custom_nodes directory:
|
||||
```
|
||||
cd ComfyUI/custom\_nodes
|
||||
git clone https://github.com/1038lab/ComfyUI-QwenVL.git
|
||||
cd ComfyUI/custom_nodes
|
||||
git clone https://github.com/huchukato/ComfyUI-QwenVL-Mod.git
|
||||
```
|
||||
2. Install the required dependencies:
|
||||
```
|
||||
cd ComfyUI/custom\_nodes/ComfyUI-QwenVL
|
||||
pip install \-r requirements.txt
|
||||
cd ComfyUI/custom_nodes/ComfyUI-QwenVL-Mod
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
3. Restart ComfyUI.
|
||||
|
||||
### **Optional: Flash Attention 2 Installation**
|
||||
|
||||
For 2-3x performance boost with compatible GPUs:
|
||||
|
||||
```bash
|
||||
# Install Flash Attention 2 (recommended)
|
||||
pip install flash-attn --no-build-isolation
|
||||
|
||||
# Or compile from source
|
||||
git clone https://github.com/Dao-AILab/flash-attention.git
|
||||
cd flash-attention
|
||||
python setup.py install
|
||||
```
|
||||
|
||||
**Requirements for Flash Attention 2:**
|
||||
- NVIDIA GPU with capability >= 8.6 (RTX 20/30/40/50 series)
|
||||
- CUDA >= 12.0
|
||||
- PyTorch >= 2.3.0
|
||||
|
||||
See [Flash Attention 2 section](#-flash-attention-2-performance-boost) for details.
|
||||
|
||||
## **🧭 Node Overview**
|
||||
|
||||
### **Transformers (HF) Nodes**
|
||||
@@ -158,6 +351,7 @@ For more control, use the **"QwenVL (Advanced)"** node. This gives you access to
|
||||
| **repetition\_penalty** | Discourages repeating tokens. | 1.2 | 0.0-2.0 | Advanced Only |
|
||||
| **frame\_count** | Number of frames to sample from the video input. | 16 | 1-64 | Advanced Only |
|
||||
| **device** | Override automatic device selection. | auto | auto, cuda, cpu | Advanced Only |
|
||||
| **attention_mode** | Attention backend for performance optimization. | auto | auto, flash_attention_2, sdpa | Standard & Advanced |
|
||||
|
||||
### **💡 Quantization Options**
|
||||
|
||||
@@ -169,6 +363,20 @@ For more control, use the **"QwenVL (Advanced)"** node. This gives you access to
|
||||
|
||||
\* **Note on 4-bit Speed**: 4-bit quantization significantly reduces VRAM usage but may result in slower performance on some systems due to the computational overhead of real-time dequantization.
|
||||
|
||||
### **⚡ Attention Mode Options**
|
||||
|
||||
| Mode | Description | Speed | Memory | Requirements |
|
||||
| :---- | :---- | :---- | :---- | :---- |
|
||||
| **auto** | Automatically selects Flash Attention 2 if available, falls back to SDPA | Fast | Medium | flash-attn package |
|
||||
| **flash_attention_2** | Uses Flash Attention v2 for optimal performance | Fastest | Low | flash-attn + CUDA GPU |
|
||||
| **sdpa** | PyTorch native Scaled Dot Product Attention | Medium | Medium | PyTorch 2.0+ |
|
||||
|
||||
**Flash Attention 2 Requirements:**
|
||||
- NVIDIA GPU with capability >= 8.6 (RTX 20/30/40/50 series)
|
||||
- CUDA >= 12.0
|
||||
- PyTorch >= 2.3.0
|
||||
- flash-attn package installed
|
||||
|
||||
### **🤔 Setting Tips**
|
||||
|
||||
| Setting | Recommendation |
|
||||
@@ -177,29 +385,148 @@ For more control, use the **"QwenVL (Advanced)"** node. This gives you access to
|
||||
| **Memory Mode** | Keep keep\_model\_loaded enabled (True) for the best performance if you plan to run the node multiple times. Disable it only if you are running out of VRAM for other nodes. |
|
||||
| **Quantization** | Start with the default 8-bit. If you have plenty of VRAM (\>16GB), switch to None (FP16) for the best speed and quality. If you are low on VRAM, use 4-bit. |
|
||||
| **Performance** | The first time a model is loaded with a specific quantization, it may be slow. Subsequent runs (with keep\_model\_loaded enabled) will be much faster. |
|
||||
| **Attention Mode** | Use "flash_attention_2" for 2-3x speedup if you have compatible GPU. Otherwise use "auto" for automatic selection. |
|
||||
|
||||
## **🧠 About Model**
|
||||
|
||||
This node utilizes the Qwen-VL series of models, developed by the Qwen Team at Alibaba Cloud. These are powerful, open-source large vision-language models (LVLMs) designed to understand and process both visual and textual information, making them ideal for tasks like detailed image and video description.
|
||||
|
||||
## **⚡ Flash Attention 2 Performance Boost**
|
||||
|
||||
This integration includes support for **Flash Attention 2**, a cutting-edge attention implementation that provides significant performance improvements:
|
||||
|
||||
### **🚀 Performance Gains**
|
||||
|
||||
| Model | Flash Attention 2 | Speedup |
|
||||
|-------|----------------|---------|
|
||||
| Qwen2.5-VL-3B | 100% | 200-300% | 2-3x |
|
||||
| Qwen3-VL-4B | 100% | 150-250% | 1.5-2.5x |
|
||||
|
||||
### **🎯 How to Use**
|
||||
|
||||
1. **Install Flash Attention 2** (see [Installation](#-optional-flash-attention-2-installation))
|
||||
2. **Select "flash_attention_2"** in the `attention_mode` parameter
|
||||
3. **Run your workflow** - the system automatically applies the optimization
|
||||
|
||||
### **🔧 Technical Details**
|
||||
|
||||
- **Implementation**: Uses optimized attention kernels for better memory efficiency
|
||||
- **Compatibility**: Works with all quantization modes (4-bit, 8-bit, FP16)
|
||||
- **Integration**: Seamlessly integrates with existing workflows
|
||||
- **Fallback**: Automatically falls back to SDPA if Flash Attention 2 is not available
|
||||
|
||||
### **📋 Requirements Checklist**
|
||||
|
||||
- [ ] flash-attn package installed
|
||||
- [ ] Sufficient VRAM for your chosen model
|
||||
- [ ] Compatible GPU (RTX 20 series or newer)
|
||||
|
||||
### **🐛 Troubleshooting**
|
||||
|
||||
**Flash Attention 2 not working?**
|
||||
```bash
|
||||
# Check installation
|
||||
python -c "import flash_attn; print('Flash Attention 2 available')"
|
||||
|
||||
# Check GPU capability
|
||||
python -c "import torch; print(f'GPU capability: {torch.cuda.get_device_capability()}')"
|
||||
```
|
||||
|
||||
**Common Problems:**
|
||||
- **"Flash Attention 2 not available"**: Install the package and check GPU compatibility
|
||||
- **"CUDA not available"**: Ensure you have installed PyTorch compatible CUDA
|
||||
- **"GPU capability insufficient"**: Flash Attention 2 requires RTX 20 series or newer
|
||||
|
||||
### **📚 References**
|
||||
|
||||
- [Flash Attention 2 GitHub](https://github.com/Dao-AILab/flash-attention)
|
||||
- [Flash Attention 2 Paper](https://arxiv.org/abs/2308.06711)
|
||||
- [Performance Benchmarks](https://github.com/Dao-AILab/flash-attention#performance)
|
||||
|
||||
## **🎬 WAN 2.2 Integration**
|
||||
|
||||
This enhanced version includes specialized prompts for **WAN 2.2** video generation, supporting both I2V (image-to-video) and T2V (text-to-video) workflows.
|
||||
|
||||
### **🎯 Available WAN 2.2 Prompts**
|
||||
|
||||
| Prompt Type | Use Case | Input | Output | Location |
|
||||
|:---|:---|:---|:---|:---|
|
||||
| **🍿 Wan 2.2 I2V** | Image-to-Video | Image + Text | 5-second cinematic timeline | QwenVL nodes |
|
||||
| **🍿 Wan 2.2 T2V** | Text-to-Video | Text only | 5-second cinematic timeline | Prompt Enhancer nodes |
|
||||
|
||||
### **⚡ Features**
|
||||
|
||||
- **Cinematic Timeline Structure**: 5-second videos with second-by-second descriptions
|
||||
- **Multilingual Support**: Italian/English input → English optimized output
|
||||
- **Professional Scene Description**: Film-style direction including lighting, camera, composition
|
||||
- **NSFW Handling**: Appropriate content filtering and description
|
||||
- **WAN 2.2 Optimization**: Specifically formatted for best video generation results
|
||||
|
||||
### **📝 Output Format Example**
|
||||
|
||||
```
|
||||
(At 0 seconds: A young woman stands facing a rack of clothes...)
|
||||
(At 1 second: The blouse falls to the floor around her feet...)
|
||||
(At 2 seconds: She reaches out with her right hand...)
|
||||
(At 3 seconds: She turns her body slightly towards the mirror...)
|
||||
(At 4 seconds: Lifting the hanger, she holds the dark fabric...)
|
||||
(At 5 seconds: A subtle, thoughtful expression crosses her face...)
|
||||
```
|
||||
|
||||
### **🔧 Usage**
|
||||
|
||||
1. **For I2V**: Use "🍿 Wan 2.2 I2V" preset in QwenVL nodes with image input
|
||||
2. **For T2V**: Use "🍿 Wan 2.2 T2V" style in Prompt Enhancer nodes with text only
|
||||
3. **For Storyboard**: Use "🍿 Wan Extended Storyboard" for seamless scene continuity
|
||||
4. **For General Video**: Use "🎥 Wan Cinematic Video" for professional single-scene descriptions
|
||||
|
||||
### **🎨 Best Practices**
|
||||
|
||||
- Provide clear, descriptive input for better scene interpretation
|
||||
- Use specific camera and lighting directions when possible
|
||||
- Include mood and atmosphere details for cinematic results
|
||||
- Leverage professional cinematography specs for optimal video quality
|
||||
- The system automatically handles timeline optimization for WAN 2.2 presets
|
||||
|
||||
## **🗺️ Roadmap**
|
||||
|
||||
### **✅ Completed (v1.0.0)**
|
||||
### **✅ Completed (v2.0.7)**
|
||||
|
||||
* ✅ Support for Qwen3-VL and Qwen2.5-VL models.
|
||||
* ✅ Automatic model downloading and management.
|
||||
* ✅ On-the-fly 4-bit, 8-bit, and FP16 quantization.
|
||||
* ✅ Hardware compatibility checks for FP8 models.
|
||||
* ✅ Image and Video (frame sequence) input support.
|
||||
|
||||
* ✅ GGUF backend support for faster inference.
|
||||
* ✅ Prompt Enhancer nodes for text-only workflows.
|
||||
* ✅ Flash Attention 2 integration for 2-3x performance boost.
|
||||
* ✅ WAN 2.2 I2V and T2V video generation prompts.
|
||||
* ✅ Extended Storyboard preset for scene continuity.
|
||||
* ✅ Professional cinematography specifications for all WAN 2.2 presets.
|
||||
* ✅ WAN family branding and consistent naming.
|
||||
* ✅ Extended Storyboard preset for seamless continuity generation.
|
||||
* ✅ Free abliterated models without token requirements.
|
||||
* ✅ Enhanced custom prompt logic across all nodes.
|
||||
* ✅ Comprehensive NSFW content generation support.
|
||||
* ✅ Optimized model ordering and quantization defaults.
|
||||
* ✅ Clean attention pipeline with SDPA stability.
|
||||
* ✅ Removed complexity for better model output reliability.
|
||||
* ✅ Smart prompt caching system for performance optimization.
|
||||
* ✅ Fixed Seed Mode for stable outputs regardless of media variations.
|
||||
* ✅ Persistent cache across ComfyUI restarts.
|
||||
* ✅ Code maintenance updates for future compatibility.
|
||||
|
||||
## **🙏 Credits**
|
||||
|
||||
* **Qwen Team**: [Alibaba Cloud](https://github.com/QwenLM) \- For developing and open-sourcing the powerful Qwen-VL models.
|
||||
* **ComfyUI**: [comfyanonymous](https://github.com/comfyanonymous/ComfyUI) \- For the incredible and extensible ComfyUI platform.
|
||||
* **llama-cpp-python**: [JamePeng/llama-cpp-python](https://github.com/JamePeng/llama-cpp-python) \- GGUF backend with vision support used by the GGUF nodes.
|
||||
* **ComfyUI Integration**: [1038lab](https://github.com/1038lab) \- Developer of this custom node.
|
||||
* **Qwen Team**: [Alibaba Cloud](https://github.com/QwenLM) - For development and open-source powerful Qwen-VL models.
|
||||
* **ComfyUI**: [comfyanonymous](https://github.com/comfyanonymous/ComfyUI) - For incredible and extensible ComfyUI platform.
|
||||
* **llama-cpp-python**: [JamePeng/llama-cpp-python](https://github.com/JamePeng/llama-cpp-python) - GGUF backend with vision support used by GGUF nodes.
|
||||
* **GenorTG**: [GenorTG/ComfyUI-Genor-QwenVL-Mod](https://github.com/GenorTG/ComfyUI-Genor-QwenVL-Mod) - For innovative memory management improvements including `unload_after_run` parameter and prompt cache optimizations that prevent OOM errors in multi-node workflows.
|
||||
* **ComfyUI Integration**: [1038lab](https://github.com/1038lab) - Developer of this custom node.
|
||||
|
||||
## **👥 Author**
|
||||
|
||||
- **huchukato**
|
||||
- 🐙 [GitHub](https://github.com/huchukato)
|
||||
- 🐦 [X (Twitter)](https://twitter.com/huchukato)
|
||||
- 🎨 [Civitai](https://civitai.com/user/huchukato) - Check out my AI art models!
|
||||
|
||||
## **📜 License**
|
||||
|
||||
This repository's code is released under the [GPL-3.0 License](LICENSE).
|
||||
This repository code is released under [GPL-3.0 License](LICENSE).
|
||||
|
||||
+552
@@ -0,0 +1,552 @@
|
||||
# **QwenVL-Mod per ComfyUI**
|
||||
|
||||
[](https://github.com/comfyanonymous/ComfyUI)
|
||||
[](LICENSE)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod/releases)
|
||||
[](https://python.org)
|
||||
[](https://pytorch.org)
|
||||
[](https://developer.nvidia.com/cuda-zone)
|
||||
[](https://huggingface.co/Qwen)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod/issues)
|
||||
|
||||
[](https://lightning.ai/huchukato/environments/comfyui-v0-14-2-qwen3-vl-autoprompt)
|
||||
|
||||
Il custom node ComfyUI-QwenVL integra la potente serie di modelli vision-linguaggio (LVLM) Qwen-VL di Alibaba Cloud, inclusi i più recenti Qwen3-VL e Qwen2.5-VL, oltre a backend GGUF e supporto solo testo Qwen3. Questo nodo avanzato abilita funzionalità multimodali AI senza soluzione di continuità nei tuoi workflow ComfyUI, permettendo efficiente generazione di testo, comprensione di immagini e analisi video.
|
||||
|
||||
<img width="749" height="513" alt="Qwen3-VL-Mod" src="https://github.com/user-attachments/assets/0f10b887-1953-4923-b813-37ccacb8a9aa" />
|
||||
|
||||
## 🛠️ **Fix OOM per QwenVL (v2.2.3)**
|
||||
|
||||
### Problema risolto
|
||||
Gli utenti riscontravano errori **Out of Memory (OOM)** con il nodo QwenVL, anche avendo VRAM sufficiente (31GB totale, 22GB libera). Il modello Qwen3-VL richiede solo ~741MB ma PyTorch limitava l'allocazione a ~17GB a causa di un'impostazione errata del memory fraction.
|
||||
|
||||
### 🔧 Soluzioni implementate
|
||||
1. **Ottimizzazioni memoria**: `max_tokens` ridotto da 4096→2048, garbage collection aggressiva
|
||||
2. **Gestione OOM**: Rilevamento automatico con retry e fallback CPU
|
||||
3. **Debug avanzato**: Tracking dettagliato memoria GPU (allocated, reserved, free)
|
||||
4. **Controllo utente**: Funzioni per verificare e impostare il memory fraction PyTorch
|
||||
|
||||
### 🎯 Risultati
|
||||
- **Meno OOM**: Errori drasticamente ridotti
|
||||
- **Maggiore stabilità**: Gestione memoria più efficiente
|
||||
- **Debugging completo**: Possibilità di diagnosticare problemi PyTorch
|
||||
|
||||
### 💡 Utilizzo delle nuove funzioni
|
||||
```python
|
||||
# Verifica impostazioni PyTorch
|
||||
from AILab_QwenVL import check_pytorch_memory
|
||||
check_pytorch_memory()
|
||||
|
||||
# Imposta memory fraction personalizzata
|
||||
from AILab_QwenVL import set_pytorch_memory_fraction
|
||||
set_pytorch_memory_fraction(0.8) # 80% della GPU
|
||||
```
|
||||
|
||||
## 🧠 VRAM Cleanup Node
|
||||
|
||||
Il nodo **VRAM Cleanup** gestisce la memoria VRAM nei workflow ComfyUI, progettato per prevenire crash e ottimizzare le prestazioni su sistemi con VRAM limitata.
|
||||
|
||||
### Modalità
|
||||
- **Cache Only**: Pulizia leggera della cache CUDA
|
||||
- **Text Encoder**: Cleanup mirato per i text encoder
|
||||
- **Full Cleanup**: Scaricamento completo dei modelli e pulizia cache aggressiva
|
||||
- **T2V + QwenVL Fix**: Modalità speciale per conflitti tra modelli
|
||||
- **Prevenzione OOM**: Cleanup completo quando la VRAM è quasi piena
|
||||
- **Debug**: Modalità diagnostica per problemi di memoria
|
||||
|
||||
### Compatibilità
|
||||
- ✅ **CUDA 12.8 (RunPod)**: Compatibilità nativa
|
||||
- ✅ **CUDA 13 (VastAI)**: Ottimizzato con memory pressure multipla
|
||||
- ✅ **Tutti i nodi QwenVL**: Cleanup automatico nel blocco `finally`
|
||||
- `model_management.unload_all_models()` per scaricamento forzato
|
||||
- `torch.cuda.empty_cache()` per pulizia cache CUDA
|
||||
- `gc.collect()` per garbage collection Python
|
||||
- Memory pressure con tensori temporanei per forzare release VRAM
|
||||
- Sincronizzazione CUDA per operazioni sicure
|
||||
|
||||
### 📋 **Posizione nel Workflow**
|
||||
```
|
||||
T2V → VRAM Cleanup (Full Cleanup) → I2V-1 → VRAM Cleanup (Full Cleanup) → I2V-2 → VRAM Cleanup (Full Cleanup) → I2V-3
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## **📰 Notizie & Aggiornamenti**
|
||||
* **2026/02/27**: **v2.2.3** 🔧 **Fix Compatibilità CUDA 13 + Rimozione Ridondanze**. [[Aggiornamenti](update.md#version-223-20260227)]
|
||||
> 🔧 **Rimozione unload_after_run**: Eliminata checkbox ridondante da tutti i nodi QwenVL per prevenire conflitti su CUDA 13.
|
||||
> 🐛 **Fix Errori Parametri**: Risolti errori "missing 1 required positional argument: unload_after_run" in tutti i nodi.
|
||||
> 🎯 **Interfaccia Semplificata**: Interfaccia più pulita senza parametri ridondanti.
|
||||
> 🧠 **VRAM Cleanup Node**: Mantenuto per cleanup manuale quando necessario.
|
||||
> 🏆 **Crediti Community**: Ringraziamenti per feedback che ha identificato problemi di ridondanza e parametri.
|
||||
|
||||
* **2026/02/19**: **v2.2.2** 🚀 Fix Critici T2V/I2V + Ottimizzazioni ComfyUI. [[Aggiornamenti](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-222-20260219)]
|
||||
> 🚀 **Batch Processing**: Risolto problema critico T2V → GGUF con immagini batch da generazione video.
|
||||
> 🔄 **Stesso Modello**: Fix conflitto riutilizzo stesso modello tra T2V e I2V nodes.
|
||||
> ⚙️ **Flash Attention 2**: Aggiunto supporto Flash Attention 2 per boost performance su hardware compatibile.
|
||||
> ⚙️ **Args ComfyUI**: Ottimizzati argomenti di avvio con features sperimentali validate.
|
||||
> 🔧 **keep_model_loaded**: Aggiunto parametro mancante al PromptEnhancer per gestione memoria consistente.
|
||||
> 🐳 **Docker Finale**: Build ottimizzato con tutti i fix e performance massima.
|
||||
|
||||
* **2026/02/18**: **v2.2.1** 🔧 Fix Critico VRAM per GGUF + Docker Ottimizzato. [[Aggiornamenti](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-221-20260218)]
|
||||
> 🔧 **Fix VRAM GGUF**: Risolto problema critico di leak VRAM che causava crash dopo 2 esecuzioni.
|
||||
> 🧹 **Cleanup Aggressivo**: Implementata pulizia VRAM completa per tutti i nodi GGUF (AILab_QwenVL_GGUF e PromptEnhancer).
|
||||
> 🚀 **Performance Stabile**: I nodi GGUF ora funzionano in modo affidabile senza accumulare VRAM.
|
||||
> 🐳 **Docker Migliorato**: Aggiornati Dockerfile con metodi RunPod testati per Jupyter e FileBrowser.
|
||||
> 🔄 **ComfyUI Latest**: Sempre ultima versione stabile senza aggiornamenti manuali.
|
||||
> 📡 **SSH Completo**: Server + client SSH per piena funzionalità di rete.
|
||||
> 🎯 **Terminale Jupyter**: Adoptato metodo RunPod per terminale funzionante.
|
||||
|
||||
* **2026/02/15**: **v2.2.0** 🎬 Sistema Generazione Story WAN 2.2. [[Aggiornamenti](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-220-20260215)]
|
||||
> 🎬 **Story Generation**: Sistema completo per generazione video story a 4 segmenti con WAN 2.2
|
||||
> 🔄 **Auto-Split Node**: Nodo intelligente per suddivisione automatica prompt in video continui da 20 secondi
|
||||
> 📝 **Show Text Node**: Nodo display testo integrato senza dipendenze esterne
|
||||
> 🎯 **Prompt Migliorati**: Prompt WAN 2.2 NSFW Story ottimizzati con formattazione migliorata
|
||||
> ⚡ **Performance**: Impostazioni context ottimizzate per modelli 8B (65,536 token)
|
||||
> 🐳 **Docker Ready**: Sistema Story completo integrato in container Docker
|
||||
> 🎨 **Workflow**: Workflow WAN 2.2 Story pronto all'uso incluso
|
||||
|
||||
* **2026/02/14**: **v2.1.0** Funzione Keep Last Prompt User-Friendly + Supporto NSFW Migliorato + Modelli GGUF Aggiornati. [[Aggiornamenti](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-210-20260214)]
|
||||
> [!NOTE]
|
||||
> 🔄 **Keep Last Prompt**: Nuovo parametro user-friendly `keep_last_prompt` sostituisce bypass_mode.
|
||||
> 🎛️ **Controllo Semplice**: Checkbox intuitivo per mantenere i prompt generati in precedenza.
|
||||
> 🎯 **Workflow Ottimizzato**: Genera prompt una volta, poi mantieni i risultati cambiando input.
|
||||
> ⚡ **Zero Risorse**: Modalità cache non consuma risorse - risposta istantanea.
|
||||
> 📋 **Universale**: Disponibile in tutti i nodi (HF, GGUF, PromptEnhancer, varianti Advanced).
|
||||
> 🔥 **Supporto NSFW Forte**: Istruzioni esplicite per generazione contenuti non censurati.
|
||||
> 🔦 **Luci Accurate**: Corretta invenzione di luci non presenti nell'immagine originale.
|
||||
> 🔄 **Modelli GGUF Aggiornati**: Sostituiti modelli noctrex con mradermacher v2/v3 per migliori performance.
|
||||
> 📦 **Selezione Modelli**: Aggiunto Josiefied-Qwen3-VL-4B-Instruct-abliterated-beta-v1 (solo HF).
|
||||
* **2026/02/12**: **v2.0.9** Parametro Bypass Mode per persistenza prompt. [[Aggiornamenti](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-209-20260212)]
|
||||
> [!NOTE]
|
||||
> 🎛️ **Bypass Mode**: Nuovo parametro `bypass_mode` permette di mantenere i prompt generati in precedenza senza rigenerarli.
|
||||
> 🔄 **Smart Cache**: Quando bypass mode è abilitato, i nodi recuperano il prompt cached più recente per il modello corrente.
|
||||
> 🎯 **Workflow Perfetto**: Genera prompt una volta, poi abilita bypass mode per preservarli cambiando gli input.
|
||||
> ⚡ **Zero Risorse**: Bypass mode non consuma risorse computazionali - risposta istantanea.
|
||||
> 📋 **Feature Universale**: Disponibile in tutti i nodi (HF, GGUF, PromptEnhancer, varianti Advanced).
|
||||
> 🎮 **Controllo Semplice**: Basta attivare/disattivare il checkbox bypass_mode per abilitare/disabilitare persistenza prompt.
|
||||
|
||||
* **2026/02/06**: **v2.0.8** Correzioni bug e miglioramenti stabilità. [[Aggiornamenti](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-208-20260206)]
|
||||
> [!NOTE]
|
||||
> 🐛 **Correzioni Bug**: Risolto errore sintassi JSON nei prompt di sistema e problemi variabili non definite.
|
||||
> 🌐 **Supporto Multilingua**: Supporto multilingua completo aggiunto a tutti i preset WAN 2.2.
|
||||
> 🎨 **Rilevamento Stile**: Migliorato rilevamento stile visivo per anime, 3D, pixel art e altro.
|
||||
> 🔧 **Stabilità**: Ripristinati miglioramenti seed fissi problematici per mantenere operazione stabile.
|
||||
> 📝 **Documentazione**: Aggiornato README e changelog con i miglioramenti di oggi.
|
||||
|
||||
* **2026/02/04**: **v2.0.7** Sistema intelligente cache prompt con Modalità Seed Fisso. [[Aggiornamenti](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-207-20260204)]
|
||||
> [!NOTE]
|
||||
> 🧠 **Cache Intelligente**: Cache automatica prompt previene rigenerazione di prompt identici.
|
||||
> 🔒 **Modalità Seed Fisso**: Imposta qualsiasi valore seed fisso per mantenere prompt consistenti indipendentemente dalle variazioni multimediali.
|
||||
> ⚡ **Boost Performance**: Risposta istantanea per prompt in cache con tempo zero di caricamento modello.
|
||||
> 🔧 **Manutenzione Codice**: Rimossi parametri deprecati da tutte le funzioni download per compatibilità futura.
|
||||
> 📈 **Miglioramento GGUF**: Aumentata dimensione contesto predefinita da 8192 a 32768 per migliore utilizzo modello.
|
||||
> 🔄 **Cache Universale**: Modalità Seed Fisso e cache intelligente ora disponibili su tutti i nodi (HF, GGUF, PromptEnhancer).
|
||||
> 🎯 **Logica Semplificata**: Sistema cache semplificato che include sempre seed per comportamento prevedibile su tutti i valori seed.
|
||||
|
||||
* **2026/02/03**: **v2.0.6** Miglioramento cinematografia professionale per tutti i preset WAN 2.2. [[Aggiornamenti](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-206-20260203)]
|
||||
> [!NOTE]
|
||||
> 🎬 **Specifiche Professionali**: Tutti i preset WAN 2.2 ora includono specifiche cinematografiche complete.
|
||||
> 📹 **Dettagli Tecnici**: Sorgenti luminose, tipi ripresa, specifiche lenti, movimenti camera, requisiti tonalità colore.
|
||||
> 🎯 **Branding Coerente**: Aggiornati nomi preset con branding famiglia WAN per migliore organizzazione.
|
||||
|
||||
* **2026/02/01**: **v2.0.5** Preset storyboard esteso aggiunto per continuità formato WAN 2.2. [[Aggiornamenti](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-205-20260201)]
|
||||
> [!NOTE]
|
||||
> 🎬 **Storyboard Esteso**: Nuovo preset per generazione storyboard-to-storyboard senza soluzione di continuità con formato timeline.
|
||||
> 🔄 **Focus Continuità**: Ogni paragrafo ripete contenuto precedente per transizioni fluide.
|
||||
> 🎯 **Compatibile WAN 2.2**: Stessa struttura timeline e supporto NSFW del preset I2V.
|
||||
|
||||
* **2026/02/01**: **v2.0.4** Aggiornamento stabilità - rimosso SageAttention per migliore compatibilità e affidabilità output modello. [[Aggiornamenti](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-204-20260201)]
|
||||
> [!NOTE]
|
||||
> 🔧 **Flash Attention 2 Rimosso**: Eliminata complessità e problemi interferenza per performance modello stabili.
|
||||
> ⚡ **Flash Attention 2**: Ancora disponibile per 2-3x velocità su hardware compatibile.
|
||||
> 🛡️ **Stabilità Migliorata**: Pipeline attention pulita con SDPA come fallback affidabile.
|
||||
|
||||
* **2026/02/01**: **v2.0.3** Correzione compatibilità SageAttention per patching corretto su versioni transformer. [[Aggiornamenti](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-203-20260201)]
|
||||
> [!NOTE]
|
||||
> 🔧 **Correzione Critica**: Risolto AttributeError che impediva Flash Attention 2 di funzionare con certe versioni transformer.
|
||||
> ⚡ **Performance Ripristinata**: 2-5x velocità ora funziona correttamente con quantizzazione 8-bit su hardware compatibile.
|
||||
|
||||
* **2026/02/01**: **v2.0.2** Accessibilità modelli migliorata, logica prompt personalizzata migliorata, espanso generazione contenuti NSFW. [[Aggiornamenti](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-202-20260201)]
|
||||
> [!NOTE]
|
||||
> 🚀 **Modelli Abliterated Free**: Aggiunti modelli senza token non censurati come predefiniti per migliore accessibilità.
|
||||
> 🔧 **Correzione Prompt Personalizzato**: Ora combina con template preset invece di sostituirli su tutti i nodi.
|
||||
> 📝 **NSFW Migliorato**: Descrizioni complete per contenuti adulti con specifiche dettagliate atti.
|
||||
> 🎬 **Priorità WAN 2.2**: Spostato preset generazione video in posizione superiore per accesso workflow più rapido.
|
||||
|
||||
* **2026/01/30**: **v2.0.1-enhanced** Aggiunto supporto Flash Attention 2 e integrazione WAN 2.2. [[Aggiornamenti](https://github.com/huchukato/ComfyUI-QwenVL-Mod/blob/main/update.md#version-201-enhanced-20260130)]
|
||||
> [!NOTE]
|
||||
> 🚀 **Flash Attention 2**: 2-5x boost performance con attention quantizzato 8-bit per GPU RTX 30+.
|
||||
> 🎬 **Integrazione WAN 2.2**: Nuovi prompt specializzati per generazione video cinematografica - converti immagini/video in descrizioni timeline 5-secondi (I2V) o testo a video (T2V) con direzione scena professionale.
|
||||
|
||||
* **2025/12/22**: **v2.0.0** Aggiunti nodi supportati GGUF e nodi Prompt Enhancer. [[Aggiornamenti](https://github.com/1038lab/ComfyUI-QwenVL/blob/main/update.md#version-200-20251222)]
|
||||
> [!IMPORTANT]
|
||||
> Installa llama-cpp-python prima di eseguire nodi GGUF [istruzioni](docs/LLAMA_CPP_PYTHON_VISION_INSTALL.md)
|
||||
|
||||

|
||||
* **2025/11/10**: **v1.1.0** Revisione runtime con selettore modalità attention, rilevamento automatico flash-attn, cache più intelligente, e controlli quantizzazione/torch.compile in entrambi i nodi. [[Aggiornamenti](https://github.com/1038lab/ComfyUI-QwenVL/blob/main/update.md#version-110-20251110)]
|
||||
* **2025/10/31**: **v1.0.4** Modelli Personalizzati Supportati [[Aggiornamenti](https://github.com/1038lab/ComfyUI-QwenVL/blob/main/update.md#version-104-20251031)]
|
||||
* **2025/10/22**: **v1.0.3** Elenco modelli aggiornato [[Aggiornamenti](https://github.com/1038lab/ComfyUI-QwenVL/blob/main/update.md#version-103-20251022)]
|
||||
* **2025/10/17**: **v1.0.0** Rilascio Iniziale
|
||||
* Supporto per serie modelli Qwen3-VL e Qwen2.5-VL.
|
||||
* Download automatico modelli da Hugging Face.
|
||||
* Quantizzazione al volo (4-bit, 8-bit, FP16).
|
||||
* Sistema Preset e Prompt Personalizzati per uso flessibile e facile.
|
||||
* **Include sia nodo standard che avanzato** per utenti di tutti i livelli.
|
||||
* Salvaguardie hardware-aware per compatibilità modelli FP8.
|
||||
* Supporto input immagine e video (sequenza frame).
|
||||
* Opzione "Keep Model Loaded" per performance migliorate su esecuzioni sequenziali.
|
||||
* **Parametro Seed** per generazione riproducibile.
|
||||
|
||||
[](https://github.com/1038lab/ComfyUI-QwenVL/blob/main/example_workflows/QWenVL.json)
|
||||
|
||||
## **✨ Funzionalità**
|
||||
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
[](https://huggingface.co/Qwen)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
[](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
|
||||
* **Nodi Standard & Avanzati**: Include nodo QwenVL semplice per uso rapido e nodo QwenVL (Avanzato) con controllo fine-grained sulla generazione.
|
||||
* **Enhancer Prompt**: Enhancer prompt solo testo dedicati per backend HF e GGUF.
|
||||
* **Preset & Prompt Personalizzati**: Scegli da elenco comodo preset prompt o scrivi i tuoi per controllo completo. I prompt personalizzati ora combinano con template preset per flessibilità migliorata.
|
||||
* **Cache Intelligente Prompt**: Sistema cache automatico previene rigenerazione di prompt identici, migliorando dramaticamente performance per input ripetuti. La cache persiste riavvii ComfyUI.
|
||||
* **🎛️ Bypass Mode**: Nuovo parametro `bypass_mode` permette di mantenere i prompt generati in precedenza senza rigenerarli. Genera una volta, poi abilita bypass mode per preservare i prompt cambiando gli input. Zero risorse in modalità bypass.
|
||||
* **Modalità Seed Fisso**: Imposta seed = 1 per ignorare cambiamenti immagine/video e mantenere prompt consistenti indipendentemente dalle variazioni multimediali. Perfetto per output workflow stabili.
|
||||
* **Integrazione WAN 2.2**: Prompt specializzati per generazione WAN 2.2 I2V (immagine-a-video) e T2V (testo-a-video) con specifiche cinematografiche professionali e struttura timeline cinematografica. Preset I2V prioritizzato per accesso workflow più rapido.
|
||||
* **Cinematografia Professionale**: Tutti i preset WAN 2.2 includono specifiche tecniche complete - sorgenti luminose, tipi ripresa, specifiche lenti, movimenti camera e requisiti tonalità colore per generazione video professionale.
|
||||
* **Storyboard Esteso**: Nuovo preset per generazione storyboard-to-storyboard senza soluzione di continuità con compatibilità formato WAN 2.2, focus continuità e dettagli cinematografia professionale.
|
||||
* **Branding Famiglia WAN**: Nomi coerenti su tutti i preset WAN 2.2 per migliore organizzazione e chiarezza workflow.
|
||||
* **Modelli Abliterated Free**: Modelli predefiniti includono opzioni non censurate senza token (Qwen3-4B-abliterated-TIES, Qwen3-8B-abliterated-TIES) per accessibilità immediata.
|
||||
* **Supporto Multi-Modello**: Cambia facilmente tra vari modelli ufficiali Qwen-VL con ordinamento intelligente 4B-primo per efficienza VRAM.
|
||||
* **Download Automatico Modelli**: I modelli sono scaricati automaticamente al primo utilizzo.
|
||||
* **Quantizzazione Intelligente**: Bilancia VRAM e performance con opzioni 4-bit, 8-bit e FP16. Quantizzazione 8-bit abilitata predefinita per accessibilità ottimale.
|
||||
* **Attention Ottimizzato**: Pipeline attention pulita con supporto Flash Attention 2 e fallback stabile SDPA. Nessun patching complesso che potrebbe interferire con output modello.
|
||||
* **Hardware-Aware**: Rileva automaticamente capacità GPU e previene errori con modelli incompatibili (es. FP8).
|
||||
* **Generazione Riproducibile**: Usa parametro seed per output consistenti, con Modalità Seed Fisso per stabilità ultima.
|
||||
* **Gestione Memoria**: Opzione "Keep Model Loaded" per mantenere modello in VRAM per elaborazione più rapida. **Nuovo parametro `unload_after_run`** per scaricare aggressivamente la memoria dopo ogni esecuzione, prevenendo errori OOM in sistemi con VRAM limitata.
|
||||
* **Supporto Immagine & Video**: Accetta sia immagini singole che sequenze frame video come input.
|
||||
* **Gestione Errori Robusta**: Fornisce messaggi errore chiari per problemi hardware o memoria.
|
||||
* **Output Console Pulito**: Log console minimi e informativi durante operazione.
|
||||
|
||||
## **🚀 Installazione**
|
||||
|
||||
1. Clona questo repository nella tua directory ComfyUI/custom_nodes:
|
||||
```
|
||||
cd ComfyUI/custom_nodes
|
||||
git clone https://github.com/huchukato/ComfyUI-QwenVL-Mod.git
|
||||
```
|
||||
2. Installa le dipendenze richieste:
|
||||
```
|
||||
cd ComfyUI/custom_nodes/ComfyUI-QwenVL-Mod
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
3. Riavvia ComfyUI.
|
||||
|
||||
### **Installazione Opzionale: Flash Attention 2**
|
||||
|
||||
Per 2-3x boost performance con GPU compatibili:
|
||||
|
||||
```bash
|
||||
# Installa Flash Attention 2 (raccomandato)
|
||||
pip install flash-attn --no-build-isolation
|
||||
|
||||
# O compila da sorgente
|
||||
git clone https://github.com/Dao-AILab/flash-attention.git
|
||||
cd flash-attention
|
||||
python setup.py install
|
||||
```
|
||||
|
||||
**Requisiti per Flash Attention 2:**
|
||||
-- NVIDIA GPU con capability >= 8.6 (serie RTX 20/30/40/50)
|
||||
-- CUDA >= 12.0
|
||||
-- PyTorch >= 2.3.0
|
||||
|
||||
Vedi [sezione Flash Attention 2](#-boost-performance-flash-attention-2) per dettagli.
|
||||
|
||||
## **🧭 Panoramica Nodi**
|
||||
|
||||
### **Nodi Transformers (HF)**
|
||||
- **QwenVL**: Inferenza vision-linguaggio rapida (immagine/video + preset/prompt personalizzati).
|
||||
- **QwenVL (Avanzato)**: Controllo completo su parametri sampling, device e performance.
|
||||
- **QwenVL Prompt Enhancer**: Miglioramento prompt solo testo (supporta sia modelli testo Qwen3 che modelli QwenVL in modalità testo).
|
||||
|
||||
### **Nodi GGUF (llama.cpp)**
|
||||
- **QwenVL (GGUF)**: Inferenza vision-linguaggio GGUF.
|
||||
- **QwenVL (GGUF Avanzato)**: Controlli GGUF estesi (contesto, layer GPU, ecc.).
|
||||
- **QwenVL Prompt Enhancer (GGUF)**: Miglioramento prompt solo testo GGUF.
|
||||
|
||||
## **🧩 Nodi GGUF (backend llama.cpp)**
|
||||
|
||||
Questo repository include nodi **GGUF** powered by `llama-cpp-python` (separati dai nodi basati Transformers).
|
||||
|
||||
- **Nodi**: `QwenVL (GGUF)`, `QwenVL (GGUF Avanzato)`, `QwenVL Prompt Enhancer (GGUF)`
|
||||
- **Cartella modelli** (predefinito): `ComfyUI/models/llm/GGUF/` (configurabile via `gguf_models.json`)
|
||||
- **Requisito vision**: installa wheel `llama-cpp-python` con capacità vision che fornisce `Qwen3VLChatHandler` / `Qwen25VLChatHandler`
|
||||
Vedi [docs/LLAMA_CPP_PYTHON_VISION_INSTALL.md](docs/LLAMA_CPP_PYTHON_VISION_INSTALL.md)
|
||||
|
||||
## **🗂️ File Configurazione**
|
||||
|
||||
- **Modelli HF**: `hf_models.json`
|
||||
- `hf_vl_models`: modelli vision-linguaggio (usati da nodi QwenVL).
|
||||
- `hf_text_models`: modelli solo testo (usati da Prompt Enhancer).
|
||||
- **Modelli GGUF**: `gguf_models.json`
|
||||
- **Prompt di sistema**: `AILab_System_Prompts.json` (include sia prompt VL che stili prompt-enhancer).
|
||||
|
||||
## **📥 Download Modelli**
|
||||
|
||||
I modelli saranno scaricati automaticamente al primo utilizzo. Se preferisci scaricarli manualmente, mettili nella directory ComfyUI/models/LLM/Qwen-VL/.
|
||||
|
||||
### **Modelli Vision HF (Qwen-VL)**
|
||||
| Modello | Link |
|
||||
| :---- | :---- |
|
||||
| Qwen3-VL-2B-Instruct | [Download](https://huggingface.co/Qwen/Qwen3-VL-2B-Instruct) |
|
||||
| Qwen3-VL-2B-Thinking | [Download](https://huggingface.co/Qwen/Qwen3-VL-2B-Thinking) |
|
||||
| Qwen3-VL-2B-Instruct-FP8 | [Download](https://huggingface.co/Qwen/Qwen3-VL-2B-Instruct-FP8) |
|
||||
| Qwen3-VL-2B-Thinking-FP8 | [Download](https://huggingface.co/Qwen/Qwen3-VL-2B-Thinking-FP8) |
|
||||
| Qwen3-VL-4B-Instruct | [Download](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct) |
|
||||
| Qwen3-VL-4B-Thinking | [Download](https://huggingface.co/Qwen/Qwen3-VL-4B-Thinking) |
|
||||
| Qwen3-VL-4B-Instruct-FP8 | [Download](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct-FP8) |
|
||||
| Qwen3-VL-4B-Thinking-FP8 | [Download](https://huggingface.co/Qwen/Qwen3-VL-4B-Thinking-FP8) |
|
||||
| Qwen3-VL-8B-Instruct | [Download](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct) |
|
||||
| Qwen3-VL-8B-Thinking | [Download](https://huggingface.co/Qwen/Qwen3-VL-8B-Thinking) |
|
||||
| Qwen3-VL-8B-Instruct-FP8 | [Download](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct-FP8) |
|
||||
| Qwen3-VL-8B-Thinking-FP8 | [Download](https://huggingface.co/Qwen/Qwen3-VL-8B-Thinking-FP8) |
|
||||
| Qwen3-VL-32B-Instruct | [Download](https://huggingface.co/Qwen/Qwen3-VL-32B-Instruct) |
|
||||
| Qwen3-VL-32B-Thinking | [Download](https://huggingface.co/Qwen/Qwen3-VL-32B-Thinking) |
|
||||
| Qwen3-VL-32B-Instruct-FP8 | [Download](https://huggingface.co/Qwen/Qwen3-VL-32B-Instruct-FP8) |
|
||||
| Qwen3-VL-32B-Thinking-FP8 | [Download](https://huggingface.co/Qwen/Qwen3-VL-32B-Thinking-FP8) |
|
||||
| Qwen2.5-VL-3B-Instruct | [Download](https://huggingface.co/Qwen/Qwen2.5-VL-3B-Instruct) |
|
||||
| Qwen2.5-VL-7B-Instruct | [Download](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct) |
|
||||
|
||||
### **Modelli Testo HF (Qwen3)**
|
||||
| Modello | Link |
|
||||
| :---- | :---- |
|
||||
| Qwen3-0.6B | [Download](https://huggingface.co/Qwen/Qwen3-0.6B) |
|
||||
| Qwen3-4B-Instruct-2507 | [Download](https://huggingface.co/Qwen/Qwen3-4B-Instruct-2507) |
|
||||
| qwen3-4b-Z-Image-Engineer | [Download](https://huggingface.co/BennyDaBall/qwen3-4b-Z-Image-Engineer) |
|
||||
|
||||
### **Modelli GGUF (Download Manuale)**
|
||||
| Gruppo | Modello | Repo | Alt Repo | File Modelli | MMProj |
|
||||
| :-- | :-- | :-- | :-- | :-- | :-- |
|
||||
| Qwen testo (GGUF) | Qwen3-4B-GGUF | [Qwen/Qwen3-4B-GGUF](https://huggingface.co/Qwen/Qwen3-4B-GGUF) | | Qwen3-4B-Q4_K_M.gguf, Qwen3-4B-Q5_0.gguf, Qwen3-4B-Q5_K_M.gguf, Qwen3-4B-Q6_K.gguf, Qwen3-4B-Q8_0.gguf | |
|
||||
| Qwen-VL (GGUF) | Qwen3-VL-4B-Instruct-GGUF | [Qwen/Qwen3-VL-4B-Instruct-GGUF](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct-GGUF) | | Qwen3VL-4B-Instruct-F16.gguf, Qwen3VL-4B-Instruct-Q4_K_M.gguf, Qwen3VL-4B-Instruct-Q8_0.gguf | mmproj-Qwen3VL-4B-Instruct-F16.gguf |
|
||||
| Qwen-VL (GGUF) | Qwen3-VL-8B-Instruct-GGUF | [Qwen/Qwen3-VL-8B-Instruct-GGUF](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct-GGUF) | | Qwen3VL-8B-Instruct-F16.gguf, Qwen3VL-8B-Instruct-Q4_K_M.gguf, Qwen3VL-8B-Instruct-Q8_0.gguf | mmproj-Qwen3VL-8B-Instruct-F16.gguf |
|
||||
| Qwen-VL (GGUF) | Qwen3-VL-4B-Thinking-GGUF | [Qwen/Qwen3-VL-4B-Thinking-GGUF](https://huggingface.co/Qwen/Qwen3-VL-4B-Thinking-GGUF) | | Qwen3VL-4B-Thinking-F16.gguf, Qwen3VL-4B-Thinking-Q4_K_M.gguf, Qwen3VL-4B-Thinking-Q8_0.gguf | mmproj-Qwen3VL-4B-Thinking-F16.gguf |
|
||||
| Qwen-VL (GGUF) | Qwen3-VL-8B-Thinking-GGUF | [Qwen/Qwen3-VL-8B-Thinking-GGUF](https://huggingface.co/Qwen/Qwen3-VL-8B-Thinking-GGUF) | | Qwen3VL-8B-Thinking-F16.gguf, Qwen3VL-8B-Thinking-Q4_K_M.gguf, Qwen3VL-8B-Thinking-Q8_0.gguf | mmproj-Qwen3VL-8B-Thinking-F16.gguf |
|
||||
|
||||
## **📖 Utilizzo**
|
||||
|
||||
### **Uso Base**
|
||||
|
||||
1. Aggiungi il nodo **"QwenVL"** dalla categoria 🧪AILab/QwenVL.
|
||||
2. Seleziona il **model\_name** che desideri utilizzare.
|
||||
3. Connetti un'immagine o video (sequenza frame) al nodo.
|
||||
4. Scrivi il tuo prompt usando campo preset o personalizzato.
|
||||
5. Esegui il workflow.
|
||||
|
||||
### **Uso Avanzato**
|
||||
|
||||
Per più controllo, usa il nodo **"QwenVL (Avanzato)"**. Questo ti dà accesso a parametri generazione dettagliati come temperatura, top\_p, beam search e selezione device.
|
||||
|
||||
## **⚙️ Parametri**
|
||||
|
||||
| Parametro | Descrizione | Predefinito | Range | Nodi |
|
||||
| :---- | :---- | :---- | :---- | :---- |
|
||||
| **model\_name** | Il modello Qwen-VL da usare. | Qwen3-VL-4B-Instruct | \- | Standard & Avanzato |
|
||||
| **quantization** | Quantizzazione al volo. Ignorata per modelli pre-quantizzati (es. FP8). | 8-bit (Bilanciato) | 4-bit, 8-bit, None | Standard & Avanzato |
|
||||
| **preset\_prompt** | Selezione di prompt predefiniti per compiti comuni. | "Describe this..." | Testo qualsiasi | Standard & Avanzato |
|
||||
| **custom\_prompt** | Sostituisce preset prompt se fornito. | | Testo qualsiasi | Standard & Avanzato |
|
||||
| **max\_tokens** | Numero massimo nuovi token da generare. | 1024 | 64-2048 | Standard & Avanzato |
|
||||
| **keep\_model\_loaded** | Mantiene modello in VRAM per esecuzioni successive più veloci. | True | True/False | Standard & Avanzato |
|
||||
| **seed** | Seed per risultati riproducibili. | 1 | 1 \- 2^64-1 | Standard & Avanzato |
|
||||
| **temperature** | Controlla casualità. Valori più alti = più creativi. (Usato quando num\_beams è 1). | 0.6 | 0.1-1.0 | Solo Avanzato |
|
||||
| **top\_p** | Soglia sampling nucleo. (Usato quando num\_beams è 1). | 0.9 | 0.0-1.0 | Solo Avanzato |
|
||||
| **num\_beams** | Numero di beam per beam search. > 1 disabilita sampling temperature/top\_p. | 1 | 1-10 | Solo Avanzato |
|
||||
| **repetition\_penalty** | Scoraggia token ripetuti. | 1.2 | 0.0-2.0 | Solo Avanzato |
|
||||
| **frame\_count** | Numero di frame da campionare da input video. | 16 | 1-64 | Solo Avanzato |
|
||||
| **device** | Sovrascrive selezione device automatica. | auto | auto, cuda, cpu | Solo Avanzato |
|
||||
| **attention_mode** | Backend attention per ottimizzazione performance. | auto | auto, flash_attention_2, sdpa | Standard & Avanzato |
|
||||
|
||||
### **💡 Opzioni Quantizzazione**
|
||||
|
||||
| Modalità | Precisione | Uso Memoria | Velocità | Qualità | Raccomandato Per |
|
||||
| :---- | :---- | :---- | :---- | :---- | :---- |
|
||||
| None (FP16) | Float 16-bit | Alto | Velocissimo | Migliore | GPU VRAM alta (16GB+) |
|
||||
| 8-bit (Bilanciato) | Intero 8-bit | Medio | Veloce | Ottimo | Performance bilanciata (8GB+) |
|
||||
| 4-bit (VRAM-friendly) | Intero 4-bit | Basso | Più lento* | Buono | GPU VRAM bassa (<8GB) |
|
||||
|
||||
\* **Nota Velocità 4-bit**: La quantizzazione 4-bit riduce significativamente uso VRAM ma può risultare in performance più lente su alcuni sistemi a causa overhead computazionale dequantizzazione real-time.
|
||||
|
||||
### **⚡ Opzioni Modalità Attention**
|
||||
|
||||
| Modalità | Descrizione | Velocità | Memoria | Requisiti |
|
||||
| :---- | :---- | :---- | :---- | :---- |
|
||||
| **auto** | Seleziona automaticamente Flash Attention 2 se disponibile, fallback SDPA | Veloce | Medio | pacchetto flash-attn |
|
||||
| **flash_attention_2** | Usa Flash Attention v2 per performance ottimali | Velocissimo | Basso | flash-attn + GPU CUDA |
|
||||
| **sdpa** | PyTorch nativo Scaled Dot Product Attention | Medio | Medio | PyTorch 2.0+ |
|
||||
|
||||
**Requisiti Flash Attention 2:**
|
||||
-- NVIDIA GPU con capability >= 8.6 (serie RTX 20/30/40/50)
|
||||
-- CUDA >= 12.0
|
||||
-- PyTorch >= 2.3.0
|
||||
-- pacchetto flash-attn installato
|
||||
|
||||
### **🤔 Consigli Impostazioni**
|
||||
|
||||
| Impostazione | Raccomandazione |
|
||||
| :---- | :---- |
|
||||
| **Scelta Modello** | Per molti utenti, Qwen3-VL-4B-Instruct è ottimo punto di partenza. Se hai GPU serie 40, prova versione -FP8 per performance migliori. |
|
||||
| **Modalità Memoria** | Mantieni keep\_model\_loaded abilitato (True) per performance migliori se prevedi eseguire nodo più volte. Disabilitalo solo se esaurisci VRAM per altri nodi. |
|
||||
| **Quantizzazione** | Inizia con predefinito 8-bit. Se hai VRAM abbondante (>16GB), passa a None (FP16) per velocità e qualità migliori. Se sei basso in VRAM, usa 4-bit. |
|
||||
| **Performance** | La prima volta che un modello viene caricato con quantizzazione specifica, può essere lento. Esecuzioni successive (con keep\_model\_loaded abilitato) saranno molto più veloci. |
|
||||
| **Modalità Attention** | Usa "flash_attention_2" per 2-3x velocità se hai GPU compatibile. Altrimenti usa "auto" per selezione automatica. |
|
||||
|
||||
## **🧠 Informazioni Modello**
|
||||
|
||||
Questo nodo utilizza serie modelli Qwen-VL, sviluppati dal Qwen Team di Alibaba Cloud. Questi sono potenti modelli vision-linguaggio open-source (LVLM) progettati per capire e processare informazioni sia visive che testuali, rendendoli ideali per compiti come descrizione dettagliata immagini e video.
|
||||
|
||||
## **⚡ Boost Performance Flash Attention 2**
|
||||
|
||||
Questa integrazione include supporto per **Flash Attention 2**, un'implementazione attention all'avanguardia che fornisce significativi miglioramenti performance:
|
||||
|
||||
### **🚀 Guadagni Performance**
|
||||
|
||||
| Modello | Flash Attention 2 | Velocità |
|
||||
|-------|----------------|---------|
|
||||
| Qwen2.5-VL-3B | 100% | 200-300% | 2-3x |
|
||||
| Qwen3-VL-4B | 100% | 150-250% | 1.5-2.5x |
|
||||
|
||||
### **🎯 Come Usare**
|
||||
|
||||
1. **Installa Flash Attention 2** (vedi [Installazione](#-installazione-opzionale-flash-attention-2))
|
||||
2. **Seleziona "flash_attention_2"** nel parametro `attention_mode`
|
||||
3. **Esegui il tuo workflow** - il sistema applica automaticamente l'ottimizzazione
|
||||
|
||||
### **🔧 Dettagli Tecnici**
|
||||
|
||||
-- **Implementazione**: Usa kernel attention ottimizzati per migliore efficienza memoria
|
||||
-- **Compatibilità**: Funziona con tutte modalità quantizzazione (4-bit, 8-bit, FP16)
|
||||
-- **Integrazione**: Si integra senza soluzione di continuità con workflow esistenti
|
||||
-- **Fallback**: Ripiega automaticamente su SDPA se Flash Attention 2 non è disponibile
|
||||
|
||||
### **📋 Checklist Requisiti**
|
||||
|
||||
- [ ] pacchetto flash-attn installato
|
||||
- [ ] VRAM sufficiente per modello scelto
|
||||
- [ ] GPU compatibile (RTX 20 series o più recente)
|
||||
|
||||
### **🐛 Risoluzione Problemi**
|
||||
|
||||
**Flash Attention 2 non funziona?**
|
||||
```bash
|
||||
# Controlla installazione
|
||||
python -c "import flash_attn; print('Flash Attention 2 disponibile')"
|
||||
|
||||
# Controlla capability GPU
|
||||
python -c "import torch; print(f'GPU capability: {torch.cuda.get_device_capability()}')"
|
||||
```
|
||||
|
||||
**Problemi Comuni:**
|
||||
- **"Flash Attention 2 non disponibile"**: Installa il pacchetto e controlla compatibilità GPU
|
||||
- **"CUDA non disponibile"**: Assicurati di avere installazione PyTorch compatibile CUDA
|
||||
- **"GPU capability insufficiente"**: Flash Attention 2 richiede serie RTX 20 o più recente
|
||||
|
||||
### **📚 Riferimenti**
|
||||
|
||||
- [Flash Attention 2 GitHub](https://github.com/Dao-AILab/flash-attention)
|
||||
- [Flash Attention 2 Paper](https://arxiv.org/abs/2304.01252)
|
||||
- [Benchmark Performance](https://github.com/Dao-AILab/flash-attention#performance)
|
||||
|
||||
## **🎬 Integrazione WAN 2.2**
|
||||
|
||||
Questa versione migliorata include prompt specializzati per **WAN 2.2** generazione video, supportando sia workflow I2V (immagine-a-video) che T2V (testo-a-video).
|
||||
|
||||
### **🎯 Prompt WAN 2.2 Disponibili**
|
||||
|
||||
| Tipo Prompt | Caso Uso | Input | Output | Posizione |
|
||||
|:---|:---|:---|:---|:---|
|
||||
| **🍿 Wan 2.2 I2V** | Immagine-a-Video | Immagine + Testo | Timeline cinematografica 5-secondi | Nodi QwenVL |
|
||||
| **🍿 Wan 2.2 T2V** | Testo-a-Video | Testo solo | Timeline cinematografica 5-secondi | Nodi Prompt Enhancer |
|
||||
|
||||
### **⚡ Funzionalità**
|
||||
|
||||
- **Struttura Timeline Cinematografica**: Video 5-secondi con descrizioni secondo per secondo
|
||||
- **Supporto Multilingua**: Input Italiano/Inglese → Output ottimizzato Inglese
|
||||
- **Descrizione Scena Professionale**: Direzione stile film inclusi illuminazione, camera, composizione
|
||||
- **Gestione NSFW**: Filtro contenuti e descrizione appropriati
|
||||
- **Ottimizzazione WAN 2.2**: Formattato specificamente per migliori risultati generazione video
|
||||
|
||||
### **📝 Esempio Formato Output**
|
||||
|
||||
```
|
||||
(At 0 seconds: A young woman stands facing a rack of clothes...)
|
||||
(At 1 second: The blouse falls to the floor around her feet...)
|
||||
(At 2 seconds: She reaches out with her right hand...)
|
||||
(At 3 seconds: She turns her body slightly towards the mirror...)
|
||||
(At 4 seconds: Lifting the hanger, she holds the dark fabric...)
|
||||
(At 5 seconds: A subtle, thoughtful expression crosses her face...)
|
||||
```
|
||||
|
||||
### **🔧 Utilizzo**
|
||||
|
||||
1. **Per I2V**: Usa preset "🍿 Wan 2.2 I2V" in nodi QwenVL con input immagine
|
||||
2. **Per T2V**: Usa stile "🍿 Wan 2.2 T2V" in nodi Prompt Enhancer con solo testo
|
||||
3. **Per Storyboard**: Usa "🍿 Wan Extended Storyboard" per continuità scena senza soluzione di continuità
|
||||
4. **Per Video Generale**: Usa "🎥 Wan Cinematic Video" per descrizioni scena professionali singole
|
||||
|
||||
### **🎨 Best Practices**
|
||||
|
||||
- Fornisci input chiaro e descrittivo per migliore interpretazione scena
|
||||
- Usa direzioni camera e illuminazione specifiche quando possibile
|
||||
- Includi dettagli umore e atmosfera per risultati cinematografici
|
||||
- Sfrutta specifiche cinematografia professionale per qualità video ottimale
|
||||
- Il sistema gestisce automaticamente ottimizzazione timeline per preset WAN 2.2
|
||||
|
||||
## **🗺️ Roadmap**
|
||||
|
||||
### **✅ Completato (v2.0.7)**
|
||||
|
||||
* ✅ Supporto per modelli Qwen3-VL e Qwen2.5-VL.
|
||||
* ✅ Supporto backend GGUF per inferenza più rapida.
|
||||
* ✅ Nodi Prompt Enhancer per workflow solo testo.
|
||||
* ✅ Integrazione Flash Attention 2 per 2-3x boost performance.
|
||||
* ✅ Prompt generazione video WAN 2.2 I2V e T2V.
|
||||
* ✅ Preset Storyboard Esteso per continuità scena.
|
||||
* ✅ Specifiche cinematografia professionale per tutti preset WAN 2.2.
|
||||
* ✅ Branding famiglia WAN e nomi coerenti.
|
||||
* ✅ Preset Storyboard Esteso per generazione continuità senza soluzione di continuità.
|
||||
* ✅ Modelli abliterated free senza requisiti token.
|
||||
* ✅ Logica prompt personalizzata migliorata su tutti i nodi.
|
||||
* ✅ Supporto completo generazione contenuti NSFW.
|
||||
* ✅ Ordinamento modelli ottimizzato e predefiniti quantizzazione.
|
||||
* ✅ Pipeline attention pulita con stabilità SDPA.
|
||||
* ✅ Rimossa complessità per migliore affidabilità output modello.
|
||||
* ✅ Sistema cache intelligente prompt per ottimizzazione performance.
|
||||
* ✅ Modalità Seed Fisso per output stabili indipendentemente da variazioni multimediali.
|
||||
* ✅ Cache persistente riavvii ComfyUI.
|
||||
* ✅ Aggiornamenti manutenzione codice per compatibilità futura.
|
||||
|
||||
## **🙏 Crediti**
|
||||
|
||||
* **Qwen Team**: [Alibaba Cloud](https://github.com/QwenLM) - Per sviluppo e open-source potenti modelli Qwen-VL.
|
||||
* **ComfyUI**: [comfyanonymous](https://github.com/comfyanonymous/ComfyUI) - Per incredibile e estensibile piattaforma ComfyUI.
|
||||
* **llama-cpp-python**: [JamePeng/llama-cpp-python](https://github.com/JamePeng/llama-cpp-python) - Backend GGUF con supporto vision usato da nodi GGUF.
|
||||
* **GenorTG**: [GenorTG/ComfyUI-Genor-QwenVL-Mod](https://github.com/GenorTG/ComfyUI-Genor-QwenVL-Mod) - Per innovativi miglioramenti di gestione memoria incluso il parametro `unload_after_run` e ottimizzazioni cache prompt che prevengono errori OOM in workflow multi-nodo.
|
||||
* **Integrazione ComfyUI**: [1038lab](https://github.com/1038lab) - Sviluppatore di questo custom node.
|
||||
|
||||
## **👥 Autore**
|
||||
|
||||
- **huchukato**
|
||||
- 🐙 [GitHub](https://github.com/huchukato)
|
||||
- 🐦 [X (Twitter)](https://twitter.com/huchukato)
|
||||
- 🎨 [Civitai](https://civitai.com/user/huchukato) - Dai un'occhiata ai miei modelli arte AI!
|
||||
|
||||
## **📜 Licenza**
|
||||
|
||||
Il codice di questo repository è rilasciato sotto [Licenza GPL-3.0](LICENSE).
|
||||
-154
@@ -1,154 +0,0 @@
|
||||
# **QwenVL for ComfyUI**
|
||||
|
||||
ComfyUI-QwenVL 是一款自定义节点,它集成了来自阿里云的强大 Qwen-VL 系列视觉语言模型(LVLMs),包括最新的 Qwen3-VL 和 Qwen2.5-VL。这款高级节点能够在您的 ComfyUI 工作流中实现无缝的多模态 AI 功能,支持高效的文本生成、图像理解和视频分析。
|
||||
|
||||

|
||||
|
||||
## **📰 新闻与更新**
|
||||
|
||||
* **2025/10/17**: **v1.0.0** 初始版本发布
|
||||
[](https://github.com/1038lab/ComfyUI-QwenVL/blob/main/example_workflows/QWenVL.json)
|
||||
* 支持 Qwen3-VL 和 Qwen2.5-VL 系列模型。
|
||||
* 自动从 Hugging Face 下载模型。
|
||||
* 支持即时量化(4-bit、8-bit、FP16)。
|
||||
* 提供预设和自定义提示词系统,使用灵活方便。
|
||||
* **包含**一个标准节点和一个高级**节点**,满足不同层次用户的需求。
|
||||
* 具备硬件感知保护机制,以兼容 FP8 模型。
|
||||
* 支持图像和视频(帧序列)输入。
|
||||
* 提供“保持模型加载”选项,以提高连续运行的性能。
|
||||
* **包含种子(Seed)参数**,用于生成可复现的结果。
|
||||
|
||||
## **✨ 功能特性**
|
||||
|
||||
* **标准与高级节点**:包含一个用于快速上手的简单 QwenVL 节点,以及一个提供精细生成控制的 QwenVL (Advanced) 节点。
|
||||
* **预设与自定义提示词**:可从一系列便捷的预设提示词中选择,或自行编写以实现完全控制。
|
||||
* **多模型支持**:轻松在各种官方 Qwen-VL 模型之间切换。
|
||||
* **自动模型下载**:首次使用时会自动下载所需模型。
|
||||
* **智能量化**:通过 4-bit、8-bit 和 FP16 选项,平衡显存占用与性能。
|
||||
* **硬件感知**:自动检测 GPU 能力,并防止因模型不兼容(例如 FP8)而导致的错误。
|
||||
* **可复现生成**:使用 seed 参数可获得一致的输出结果。
|
||||
* **内存管理**:“保持模型加载”选项可将模型保留在显存中,以加快处理速度。
|
||||
* **图像与视频支持**:接受单个图像和视频帧序列作为输入。
|
||||
* **强大的错误处理**:为硬件或内存问题提供清晰的错误信息。
|
||||
* **简洁的控制台输出**:在操作过程中提供最少且信息丰富的控制台日志。
|
||||
* **新增 attention_mode 参数,支持自动启用 Flash-Attention v2 加速。
|
||||
* **新增 use_torch_compile 参数,在 Torch 2.1+ 上可启用 JIT 优化,提高推理吞吐。
|
||||
* **新增 device 参数,支持在 CUDA、CPU 与 Apple MPS 之间手动切换。
|
||||
* **改进显存检测逻辑,可在内存不足时自动降低量化等级。
|
||||
|
||||
## **🚀 安装**
|
||||
|
||||
1. 将此仓库克隆到您的 ComfyUI/custom\_nodes 目录:
|
||||
```
|
||||
cd ComfyUI/custom\_nodes
|
||||
git clone https://github.com/1038lab/ComfyUI-QwenVL.git\
|
||||
```
|
||||
2. 安装所需的依赖项:
|
||||
```
|
||||
cd ComfyUI/custom\_nodes/ComfyUI-QwenVL
|
||||
pip install \-r requirements.txt
|
||||
```
|
||||
3. 重启 ComfyUI。
|
||||
|
||||
## **📥 下载模型**
|
||||
|
||||
模型将在首次使用时自动下载。如果您希望手动下载,请将它们放置在 ComfyUI/models/LLM/Qwen-VL/ 目录下。
|
||||
|
||||
| 模型 | 链接 |
|
||||
| :---- | :---- |
|
||||
| Qwen3-VL-2B-Instruct | [下载](https://huggingface.co/Qwen/Qwen3-VL-2B-Instruct) |
|
||||
| Qwen3-VL-2B-Thinking | [下载](https://huggingface.co/Qwen/Qwen3-VL-2B-Thinking) |
|
||||
| Qwen3-VL-2B-Instruct-FP8 | [下载](https://huggingface.co/Qwen/Qwen3-VL-2B-Instruct-FP8) |
|
||||
| Qwen3-VL-2B-Thinking-FP8 | [下载](https://huggingface.co/Qwen/Qwen3-VL-2B-Thinking-FP8) |
|
||||
| Qwen3-VL-4B-Instruct | [下载](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct) |
|
||||
| Qwen3-VL-4B-Thinking | [下载](https://huggingface.co/Qwen/Qwen3-VL-4B-Thinking) |
|
||||
| Qwen3-VL-4B-Instruct-FP8 | [下载](https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct-FP8) |
|
||||
| Qwen3-VL-4B-Thinking-FP8 | [下载](https://huggingface.co/Qwen/Qwen3-VL-4B-Thinking-FP8) |
|
||||
| Qwen3-VL-8B-Instruct | [下载](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct) |
|
||||
| Qwen3-VL-8B-Thinking | [下载](https://huggingface.co/Qwen/Qwen3-VL-8B-Thinking) |
|
||||
| Qwen3-VL-8B-Instruct-FP8 | [下载](https://huggingface.co/Qwen/Qwen3-VL-8B-Instruct-FP8) |
|
||||
| Qwen3-VL-8B-Thinking-FP8 | [下载](https://huggingface.co/Qwen/Qwen3-VL-4B-Thinking-FP8) |
|
||||
| Qwen3-VL-32B-Instruct | [下载](https://huggingface.co/Qwen/Qwen3-VL-32B-Instruct) |
|
||||
| Qwen3-VL-32B-Thinking | [下载](https://huggingface.co/Qwen/Qwen3-VL-32B-Thinking) |
|
||||
| Qwen3-VL-32B-Instruct-FP8 | [下载](https://huggingface.co/Qwen/Qwen3-VL-32B-Instruct-FP8) |
|
||||
| Qwen3-VL-32B-Thinking-FP8 | [下载](https://huggingface.co/Qwen/Qwen3-VL-32B-Thinking-FP8) |
|
||||
| Qwen2.5-VL-3B-Instruct | [下载](https://huggingface.co/Qwen/Qwen2.5-VL-3B-Instruct) |
|
||||
| Qwen2.5-VL-7B-Instruct | [下载](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct) |
|
||||
|
||||
|
||||
## **📖 基本用法**
|
||||
|
||||
1. 从 🧪AILab/QwenVL 类别中添加 **"QwenVL"** 节点。
|
||||
2. 选择您希望使用的 model\_name(模型名称)。
|
||||
3. 连接一个图像或视频(图像序列)源到该节点。
|
||||
4. 编写您的提示词。
|
||||
5. 根据需要调整其他参数并运行工作流。
|
||||
|
||||
### **⚙️ 参数详解**
|
||||
|
||||
| 参数 | 描述 | 默认值 |
|
||||
| :---- | :---- | :---- |
|
||||
| **model\_name** | 要使用的 Qwen-VL 模型。 | Qwen3-VL-4B-Instruct |
|
||||
| **quantization** | 即时量化级别。对于预量化模型(如 FP8)将被忽略。 | 8-bit (Balanced) |
|
||||
| **attention_mode** | 注意力机制模式。auto 会自动启用 Flash-Attn v2(若可用),否则回退为 SDPA。| auto auto、flash_attention_2、sdpa | 标准 & 高级 |
|
||||
| **use_torch_compile** | 启用 torch.compile('reduce-overhead') 优化以提升 CUDA 推理性能(需 Torch 2.1+)。 | False | - | 高级 |
|
||||
| **preset\_prompt** | 为常见任务预定义的一系列提示词。 | "Describe this..." |
|
||||
| **custom\_prompt** | 自定义文本提示词。如果提供,将覆盖预设提示词。 | |
|
||||
| **max\_tokens** | 要生成的最大新词元(token)数量。 | 1024 |
|
||||
| **temperature** | 控制随机性。值越高 \= 更具创造性。(当 num\_beams 为 1 时使用)。 | 0.6 |
|
||||
| **top\_p** | 核心采样阈值。(当 num\_beams 为 1 时使用)。 | 0.9 |
|
||||
| **num\_beams** | 用于束搜索(beam search)的光束数量。\> 1 时将禁用 temperature/top\_p 采样。 | 1 |
|
||||
| **repetition\_penalty** | 抑制重复词元的惩罚系数。1.0 表示中性。 | 1.2 |
|
||||
| **keep\_model\_loaded** | 将模型保留在显存中,以便后续运行更快。 | True |
|
||||
| **seed** | 随机种子,用于确保生成结果的可复现性。 | 1 |
|
||||
|
||||
### **💡 量化选项**
|
||||
|
||||
| 模式 | 精度 | 显存占用 | 速度 | 质量 | 推荐适用场景 |
|
||||
| :---- | :---- | :---- | :---- | :---- | :---- |
|
||||
| None (FP16) | 16位浮点 | 高 | 最快 | 最佳 | 高显存 GPU (16GB+) |
|
||||
| 8-bit (Balanced) | 8位整数 | 中 | 较快 | 很好 | 追求均衡性能 (8GB+) |
|
||||
| 4-bit (VRAM-friendly) | 4位整数 | 低 | 较慢\* | 好 | 低显存 GPU (\<8GB) |
|
||||
|
||||
**\*关于 4-bit 速度的说明**:4-bit 量化能显著减少显存使用,但由于实时反量化的计算开销,在某些系统上可能会导致性能下降。
|
||||
|
||||
### **🤔 设置技巧**
|
||||
|
||||
| 设置 | 建议 |
|
||||
| :---- | :---- |
|
||||
| **模型选择** | 对于大多数用户,Qwen3-VL-4B-Instruct 是一个很好的起点。如果您有 40 系 GPU,可以尝试 \-FP8 版本以获得更好的性能。 |
|
||||
| **内存模式** | 如果您计划多次运行该节点,请保持 keep\_model\_loaded 启用(True)以获得最佳性能。仅在其他节点需要更多显存时才禁用它。 |
|
||||
| **量化** | 从默认的 8-bit 开始。如果您的显存充裕(\>16GB),切换到 None (FP16) 以获得最佳速度和质量。如果显存不足,请使用 4-bit。 |
|
||||
| **性能** | 首次加载具有特定量化设置的模型时可能会较慢。后续的运行(在启用 keep\_model\_loaded 的情况下)会快得多。 |
|
||||
|
||||
## **🧠 关于模型**
|
||||
|
||||
此节点利用了由阿里云 Qwen 团队开发的 Qwen-VL 系列模型。这些是功能强大的开源大型视觉语言模型(LVLMs),旨在理解和处理视觉及文本信息,非常适合用于详细的图像和视频描述等任务。
|
||||
|
||||
## **🗺️ 路线图**
|
||||
|
||||
### **✅ 已完成 (v1.0.0)**
|
||||
|
||||
* ✅ 支持 Qwen3-VL 和 Qwen2.5-VL 模型。
|
||||
* ✅ 自动模型下载和管理。
|
||||
* ✅ 即时 4-bit、8-bit 和 FP16 量化。
|
||||
* ✅ 针对 FP8 模型的硬件兼容性检查。
|
||||
* ✅ 支持图像和视频(帧序列)输入。
|
||||
* ✅ **即将支持 GGUF 模型格式。**
|
||||
|
||||
### **🔄 未来计划**
|
||||
|
||||
* GGUF 格式支持 CPU 和更广泛的硬件兼容性。
|
||||
* 集成更多视觉语言模型。
|
||||
* 提供更高级的参数选项以微调生成过程。
|
||||
* 支持额外的视频处理功能。
|
||||
|
||||
## **🙏 致谢**
|
||||
|
||||
* **Qwen 团队**:[阿里云](https://github.com/QwenLM) \- 感谢其开发并开源了强大的 Qwen-VL 模型。
|
||||
* **ComfyUI**:[comfyanonymous](https://github.com/comfyanonymous/ComfyUI) \- 感谢其创造了如此出色且可扩展的 ComfyUI 平台。
|
||||
* **ComfyUI 集成**:[1038lab](https://github.com/1038lab) \- 本自定义节点的开发者。
|
||||
|
||||
## **📜 许可证**
|
||||
|
||||
此仓库的代码根据 [GPL-3.0 许可证](LICENSE) 发布。
|
||||
+16
@@ -1,3 +1,14 @@
|
||||
"""
|
||||
{
|
||||
"name": "QwenVL-Mod: Enhanced Vision-Language",
|
||||
"description": "Enhanced QwenVL node with Flash Attention 2, WAN 2.2 video generation, free abliterated models, and comprehensive NSFW support. Advanced fork with major improvements over original for stable multimodal AI workflows.",
|
||||
"author": "huchukato",
|
||||
"version": "2.0.4",
|
||||
"url": "https://github.com/huchukato/ComfyUI-QwenVL-Mod",
|
||||
"category": "image"
|
||||
}
|
||||
"""
|
||||
|
||||
import importlib.util
|
||||
import os
|
||||
import sys
|
||||
@@ -32,6 +43,11 @@ def load_modules_from_directory(directory):
|
||||
print(f"Error loading module {module_name}: {e}")
|
||||
|
||||
load_modules_from_directory(current_dir)
|
||||
|
||||
# Also load from nodes subdirectory
|
||||
nodes_dir = os.path.join(current_dir, "nodes")
|
||||
if os.path.exists(nodes_dir):
|
||||
load_modules_from_directory(nodes_dir)
|
||||
NODE_CLASS_MAPPINGS = dict(sorted(NODE_CLASS_MAPPINGS.items(), key=lambda x: NODE_DISPLAY_NAME_MAPPINGS.get(x[0], x[0])))
|
||||
NODE_DISPLAY_NAME_MAPPINGS = dict(sorted(NODE_DISPLAY_NAME_MAPPINGS.items(), key=lambda x: x[1]))
|
||||
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"author": "huchukato",
|
||||
"title": "QwenVL-Mod: Enhanced Vision-Language",
|
||||
"reference": "https://github.com/huchukato/ComfyUI-QwenVL-Mod",
|
||||
"files": [
|
||||
"https://github.com/huchukato/ComfyUI-QwenVL-Mod"
|
||||
],
|
||||
"install_type": "git-clone",
|
||||
"description": "Enhanced QwenVL node with smart prompt caching, Fixed Seed Mode, professional cinematography specifications, WAN 2.2 video generation, Extended Storyboard preset, free abliterated models, and comprehensive NSFW support. Advanced fork with major improvements over original for stable multimodal AI workflows.",
|
||||
"category": "image",
|
||||
"tags": ["vision", "language", "multimodal", "qwen", "flash_attention", "performance", "wan2.2", "video", "i2v", "t2v", "storyboard", "cinematography", "professional", "caching", "fixed_seed", "abliterated", "nsfw", "enhanced", "fork"],
|
||||
"version": "2.0.7"
|
||||
}
|
||||
+194
-43
@@ -1,62 +1,205 @@
|
||||
{
|
||||
"base_dir": "llm/GGUF",
|
||||
"base_dir": "LLM/GGUF",
|
||||
"Qwen_model": {
|
||||
"Qwen3-4B-abliterated-GGUF": {
|
||||
"author": "mradermacher",
|
||||
"repo_name": "Qwen3-4B-abliterated-GGUF",
|
||||
"repo_id": "mradermacher/Qwen3-4B-abliterated-GGUF",
|
||||
"model_files": [
|
||||
"Qwen3-4B-abliterated-Q4_K_M.gguf",
|
||||
"Qwen3-4B-abliterated-Q5_K_M.gguf",
|
||||
"Qwen3-4B-abliterated-Q6_K.gguf",
|
||||
"Qwen3-4B-abliterated-Q8_0.gguf",
|
||||
"Qwen3-4B-abliterated-F16.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 32768
|
||||
}
|
||||
},
|
||||
"Josiefied-Qwen3-4B-abliterated-v1-GGUF": {
|
||||
"author": "mradermacher",
|
||||
"repo_name": "Josiefied-Qwen3-4B-abliterated-v1-GGUF",
|
||||
"repo_id": "mradermacher/Josiefied-Qwen3-4B-abliterated-v1-GGUF",
|
||||
"model_files": [
|
||||
"Josiefied-Qwen3-4B-abliterated-v1.Q4_K_M.gguf",
|
||||
"Josiefied-Qwen3-4B-abliterated-v1.Q5_K_M.gguf",
|
||||
"Josiefied-Qwen3-4B-abliterated-v1.Q6_K.gguf",
|
||||
"Josiefied-Qwen3-4B-abliterated-v1.Q8_0.gguf",
|
||||
"Josiefied-Qwen3-4B-abliterated-v1-F16.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 32768
|
||||
}
|
||||
},
|
||||
"Josiefied-Qwen3-8B-abliterated-v1-GGUF": {
|
||||
"author": "mradermacher",
|
||||
"repo_name": "Josiefied-Qwen3-8B-abliterated-v1-GGUF",
|
||||
"repo_id": "mradermacher/Josiefied-Qwen3-8B-abliterated-v1-GGUF",
|
||||
"model_files": [
|
||||
"Josiefied-Qwen3-8B-abliterated-v1.Q4_K_M.gguf",
|
||||
"Josiefied-Qwen3-8B-abliterated-v1.Q5_K_M.gguf",
|
||||
"Josiefied-Qwen3-8B-abliterated-v1.Q6_K.gguf",
|
||||
"Josiefied-Qwen3-8B-abliterated-v1.Q8_0.gguf",
|
||||
"Josiefied-Qwen3-8B-abliterated-v1-F16.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 32768
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-4B-Instruct-c_abliterated-v2-GGUF": {
|
||||
"author": "mradermacher",
|
||||
"repo_name": "Qwen3-VL-4B-Instruct-c_abliterated-v2-GGUF",
|
||||
"repo_id": "mradermacher/Qwen3-VL-4B-Instruct-c_abliterated-v2-GGUF",
|
||||
"model_files": [
|
||||
"Qwen3-VL-4B-Instruct-c_abliterated-v2.Q4_K_M.gguf",
|
||||
"Qwen3-VL-4B-Instruct-c_abliterated-v2.Q5_K_M.gguf",
|
||||
"Qwen3-VL-4B-Instruct-c_abliterated-v2.Q6_K.gguf",
|
||||
"Qwen3-VL-4B-Instruct-c_abliterated-v2.Q8_0.gguf",
|
||||
"Qwen3-VL-4B-Instruct-c_abliterated-v2-F16.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 32768
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-8B-Instruct-c_abliterated-v3-GGUF": {
|
||||
"author": "mradermacher",
|
||||
"repo_name": "Qwen3-VL-8B-Instruct-c_abliterated-v3-GGUF",
|
||||
"repo_id": "mradermacher/Qwen3-VL-8B-Instruct-c_abliterated-v3-GGUF",
|
||||
"model_files": [
|
||||
"Qwen3-VL-8B-Instruct-c_abliterated-v3.Q4_K_M.gguf",
|
||||
"Qwen3-VL-8B-Instruct-c_abliterated-v3.Q5_K_M.gguf",
|
||||
"Qwen3-VL-8B-Instruct-c_abliterated-v3.Q6_K.gguf",
|
||||
"Qwen3-VL-8B-Instruct-c_abliterated-v3.Q8_0.gguf",
|
||||
"Qwen3-VL-8B-Instruct-c_abliterated-v3-F16.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 65536
|
||||
}
|
||||
},
|
||||
"Josiefied-Qwen3-4B-Instruct-2507-gabliterated-v1-GGUF": {
|
||||
"author": "DevQuasar",
|
||||
"repo_name": "Josiefied-Qwen3-4B-Instruct-2507-gabliterated-v1-GGUF",
|
||||
"repo_id": "DevQuasar/Goekdeniz-Guelmez.Josiefied-Qwen3-4B-Instruct-2507-gabliterated-v1-GGUF",
|
||||
"model_files": [
|
||||
"Goekdeniz-Guelmez.Josiefied-Qwen3-4B-Instruct-2507-gabliterated-v1.Q4_K_M.gguf",
|
||||
"Goekdeniz-Guelmez.Josiefied-Qwen3-4B-Instruct-2507-gabliterated-v1.Q5_K_M.gguf",
|
||||
"Goekdeniz-Guelmez.Josiefied-Qwen3-4B-Instruct-2507-gabliterated-v1.Q6_K.gguf",
|
||||
"Goekdeniz-Guelmez.Josiefied-Qwen3-4B-Instruct-2507-gabliterated-v1.Q8_0.gguf",
|
||||
"Goekdeniz-Guelmez.Josiefied-Qwen3-4B-Instruct-2507-gabliterated-v1.f16.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 32768
|
||||
}
|
||||
},
|
||||
"Qwen3-4B-GGUF": {
|
||||
"author": "Qwen",
|
||||
"repo_name": "Qwen3-4B-GGUF",
|
||||
"repo_id": "Qwen/Qwen3-4B-GGUF",
|
||||
"model_files": [
|
||||
"Qwen3-4B-Q4_K_M.gguf",
|
||||
"Qwen3-4B-Q5_0.gguf",
|
||||
"Qwen3-4B-Q5_K_M.gguf",
|
||||
"Qwen3-4B-Q6_K.gguf",
|
||||
"Qwen3-4B-Q8_0.gguf"
|
||||
"Qwen3-4B-Q8_0.gguf",
|
||||
"Qwen3-4B-F16.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 8192
|
||||
"context_length": 32768
|
||||
}
|
||||
},
|
||||
"Qwen3-4B-abliterated-GGUF": {
|
||||
"author": "Mungert",
|
||||
"repo_name": "Qwen3-4B-abliterated-GGUF",
|
||||
"repo_id": "Mungert/Qwen3-4B-abliterated-GGUF",
|
||||
"alt_repo_ids": [
|
||||
"mradermacher/Qwen3-4B-abliterated-GGUF"
|
||||
],
|
||||
"Qwen3-4B-Instruct-GGUF": {
|
||||
"author": "Qwen",
|
||||
"repo_name": "Qwen3-4B-Instruct-GGUF",
|
||||
"repo_id": "Qwen/Qwen3-4B-Instruct-GGUF",
|
||||
"model_files": [
|
||||
"Qwen3-4B-abliterated-iq2_m.gguf",
|
||||
"Qwen3-4B-abliterated-iq2_s.gguf",
|
||||
"Qwen3-4B-abliterated-iq2_xs.gguf",
|
||||
"Qwen3-4B-abliterated-iq2_xxs.gguf",
|
||||
"Qwen3-4B-abliterated-iq3_m.gguf",
|
||||
"Qwen3-4B-abliterated-iq3_s.gguf",
|
||||
"Qwen3-4B-abliterated-iq3_xs.gguf",
|
||||
"Qwen3-4B-abliterated-iq3_xxs.gguf",
|
||||
"Qwen3-4B-abliterated-iq4_nl.gguf",
|
||||
"Qwen3-4B-abliterated-iq4_xs.gguf",
|
||||
"Qwen3-4B-abliterated-q2_k_s.gguf",
|
||||
"Qwen3-4B-abliterated-q3_k_m.gguf",
|
||||
"Qwen3-4B-abliterated-q3_k_s.gguf",
|
||||
"Qwen3-4B-abliterated-q4_0.gguf",
|
||||
"Qwen3-4B-abliterated-q4_1.gguf",
|
||||
"Qwen3-4B-abliterated-q4_k_m.gguf",
|
||||
"Qwen3-4B-abliterated-q4_k_s.gguf",
|
||||
"Qwen3-4B-abliterated-q5_0.gguf",
|
||||
"Qwen3-4B-abliterated-q5_1.gguf",
|
||||
"Qwen3-4B-abliterated-q5_k_m.gguf",
|
||||
"Qwen3-4B-abliterated-q5_k_s.gguf",
|
||||
"Qwen3-4B-abliterated-q6_k_m.gguf",
|
||||
"Qwen3-4B-abliterated-q8_0.gguf",
|
||||
"Qwen3-4B-abliterated-bf16.gguf",
|
||||
"Qwen3-4B-abliterated-bf16_q8_0.gguf",
|
||||
"Qwen3-4B-abliterated-f16_q8_0.gguf"
|
||||
"Qwen3-4B-Instruct-Q4_K_M.gguf",
|
||||
"Qwen3-4B-Instruct-Q5_K_M.gguf",
|
||||
"Qwen3-4B-Instruct-Q6_K.gguf",
|
||||
"Qwen3-4B-Instruct-Q8_0.gguf",
|
||||
"Qwen3-4B-Instruct-F16.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 8192
|
||||
"context_length": 32768
|
||||
}
|
||||
},
|
||||
"Qwen3-8B-Instruct-GGUF": {
|
||||
"author": "Qwen",
|
||||
"repo_name": "Qwen3-8B-Instruct-GGUF",
|
||||
"repo_id": "Qwen/Qwen3-8B-Instruct-GGUF",
|
||||
"model_files": [
|
||||
"Qwen3-8B-Instruct-Q4_K_M.gguf",
|
||||
"Qwen3-8B-Instruct-Q5_K_M.gguf",
|
||||
"Qwen3-8B-Instruct-Q6_K.gguf",
|
||||
"Qwen3-8B-Instruct-Q8_0.gguf",
|
||||
"Qwen3-8B-Instruct-F16.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 32768
|
||||
}
|
||||
}
|
||||
},
|
||||
"qwenVL_model": {
|
||||
"Qwen3-VL-4B-Instruct-c_abliterated-v2-GGUF": {
|
||||
"author": "mradermacher",
|
||||
"repo_name": "Qwen3-VL-4B-Instruct-c_abliterated-v2-GGUF",
|
||||
"repo_id": "mradermacher/Qwen3-VL-4B-Instruct-c_abliterated-v2-GGUF",
|
||||
"mmproj_file": "Qwen3-VL-4B-Instruct-c_abliterated-v2.mmproj-f16.gguf",
|
||||
"model_files": [
|
||||
"Qwen3-VL-4B-Instruct-c_abliterated-v2.Q4_K_M.gguf",
|
||||
"Qwen3-VL-4B-Instruct-c_abliterated-v2.Q5_K_M.gguf",
|
||||
"Qwen3-VL-4B-Instruct-c_abliterated-v2.Q6_K.gguf",
|
||||
"Qwen3-VL-4B-Instruct-c_abliterated-v2.Q8_0.gguf",
|
||||
"Qwen3-VL-4B-Instruct-c_abliterated-v2-F16.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 32768,
|
||||
"image_max_tokens": 4096,
|
||||
"n_batch": 512,
|
||||
"gpu_layers": -1,
|
||||
"top_k": 0,
|
||||
"pool_size": 4194304
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-8B-Instruct-c_abliterated-v3-GGUF": {
|
||||
"author": "mradermacher",
|
||||
"repo_name": "Qwen3-VL-8B-Instruct-c_abliterated-v3-GGUF",
|
||||
"repo_id": "mradermacher/Qwen3-VL-8B-Instruct-c_abliterated-v3-GGUF",
|
||||
"mmproj_file": "Qwen3-VL-8B-Instruct-c_abliterated-v3.mmproj-f16.gguf",
|
||||
"model_files": [
|
||||
"Qwen3-VL-8B-Instruct-c_abliterated-v3.Q4_K_M.gguf",
|
||||
"Qwen3-VL-8B-Instruct-c_abliterated-v3.Q5_K_M.gguf",
|
||||
"Qwen3-VL-8B-Instruct-c_abliterated-v3.Q6_K.gguf",
|
||||
"Qwen3-VL-8B-Instruct-c_abliterated-v3.Q8_0.gguf",
|
||||
"Qwen3-VL-8B-Instruct-c_abliterated-v3-F16.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 65536,
|
||||
"image_max_tokens": 4096,
|
||||
"n_batch": 512,
|
||||
"gpu_layers": -1,
|
||||
"top_k": 0,
|
||||
"pool_size": 4194304
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-32B-Heretic-v2-GGUF": {
|
||||
"author": "mradermacher",
|
||||
"repo_name": "Qwen3-VL-32B-Heretic-v2-GGUF",
|
||||
"repo_id": "mradermacher/Qwen3-VL-32B-Heretic-v2-GGUF",
|
||||
"mmproj_file": "Qwen3-VL-32B-Heretic-v2.mmproj-f16.gguf",
|
||||
"model_files": [
|
||||
"Qwen3-VL-32B-Heretic-v2.Q4_K_M.gguf",
|
||||
"Qwen3-VL-32B-Heretic-v2.Q5_K_M.gguf",
|
||||
"Qwen3-VL-32B-Heretic-v2.Q6_K.gguf",
|
||||
"Qwen3-VL-32B-Heretic-v2.Q8_0.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 32768,
|
||||
"image_max_tokens": 4096,
|
||||
"n_batch": 512,
|
||||
"gpu_layers": -1,
|
||||
"top_k": 0,
|
||||
"pool_size": 4194304
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-4B-Instruct-GGUF": {
|
||||
"author": "Qwen",
|
||||
"repo_name": "Qwen3-VL-4B-Instruct-GGUF",
|
||||
@@ -64,11 +207,13 @@
|
||||
"mmproj_file": "mmproj-Qwen3VL-4B-Instruct-F16.gguf",
|
||||
"model_files": [
|
||||
"Qwen3VL-4B-Instruct-Q4_K_M.gguf",
|
||||
"Qwen3-VL-4B-Instruct-Q5_K_M.gguf",
|
||||
"Qwen3-VL-4B-Instruct-Q6_K.gguf",
|
||||
"Qwen3VL-4B-Instruct-Q8_0.gguf",
|
||||
"Qwen3VL-4B-Instruct-F16.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 8192,
|
||||
"context_length": 32768,
|
||||
"image_max_tokens": 4096,
|
||||
"n_batch": 512,
|
||||
"gpu_layers": -1,
|
||||
@@ -83,11 +228,13 @@
|
||||
"mmproj_file": "mmproj-Qwen3VL-8B-Instruct-F16.gguf",
|
||||
"model_files": [
|
||||
"Qwen3VL-8B-Instruct-Q4_K_M.gguf",
|
||||
"Qwen3-VL-8B-Instruct-Q5_K_M.gguf",
|
||||
"Qwen3-VL-8B-Instruct-Q6_K.gguf",
|
||||
"Qwen3VL-8B-Instruct-Q8_0.gguf",
|
||||
"Qwen3VL-8B-Instruct-F16.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 8192,
|
||||
"context_length": 32768,
|
||||
"image_max_tokens": 4096,
|
||||
"n_batch": 512,
|
||||
"gpu_layers": -1,
|
||||
@@ -102,11 +249,13 @@
|
||||
"mmproj_file": "mmproj-Qwen3VL-4B-Thinking-F16.gguf",
|
||||
"model_files": [
|
||||
"Qwen3VL-4B-Thinking-Q4_K_M.gguf",
|
||||
"Qwen3-VL-4B-Thinking-Q5_K_M.gguf",
|
||||
"Qwen3-VL-4B-Thinking-Q6_K.gguf",
|
||||
"Qwen3VL-4B-Thinking-Q8_0.gguf",
|
||||
"Qwen3VL-4B-Thinking-F16.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 8192,
|
||||
"context_length": 32768,
|
||||
"image_max_tokens": 4096,
|
||||
"n_batch": 512,
|
||||
"gpu_layers": -1,
|
||||
@@ -121,11 +270,13 @@
|
||||
"mmproj_file": "mmproj-Qwen3VL-8B-Thinking-F16.gguf",
|
||||
"model_files": [
|
||||
"Qwen3VL-8B-Thinking-Q4_K_M.gguf",
|
||||
"Qwen3-VL-8B-Thinking-Q5_K_M.gguf",
|
||||
"Qwen3-VL-8B-Thinking-Q6_K.gguf",
|
||||
"Qwen3VL-8B-Thinking-Q8_0.gguf",
|
||||
"Qwen3VL-8B-Thinking-F16.gguf"
|
||||
],
|
||||
"defaults": {
|
||||
"context_length": 8192,
|
||||
"context_length": 32768,
|
||||
"image_max_tokens": 4096,
|
||||
"n_batch": 512,
|
||||
"gpu_layers": -1,
|
||||
@@ -134,4 +285,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+44
-128
@@ -1,53 +1,27 @@
|
||||
{
|
||||
"hf_vl_models": {
|
||||
"Qwen3-VL-2B-Instruct": {
|
||||
"repo_id": "Qwen/Qwen3-VL-2B-Instruct",
|
||||
"Qwen3-VL-4B-Instruct-Abliterated": {
|
||||
"repo_id": "huihui-ai/Huihui-Qwen3-VL-4B-Instruct-abliterated",
|
||||
"default": true,
|
||||
"quantized": false,
|
||||
"vram_requirement": {
|
||||
"full": 4.0,
|
||||
"8bit": 2.5,
|
||||
"4bit": 1.5
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-2B-Thinking": {
|
||||
"repo_id": "Qwen/Qwen3-VL-2B-Thinking",
|
||||
"default": false,
|
||||
"quantized": false,
|
||||
"vram_requirement": {
|
||||
"full": 4.0,
|
||||
"8bit": 2.5,
|
||||
"4bit": 1.5
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-2B-Instruct-FP8": {
|
||||
"repo_id": "Qwen/Qwen3-VL-2B-Instruct-FP8",
|
||||
"default": false,
|
||||
"quantized": true,
|
||||
"vram_requirement": {
|
||||
"full": 2.5
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-2B-Thinking-FP8": {
|
||||
"repo_id": "Qwen/Qwen3-VL-2B-Thinking-FP8",
|
||||
"default": false,
|
||||
"quantized": true,
|
||||
"vram_requirement": {
|
||||
"full": 2.5
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-4B-Instruct": {
|
||||
"repo_id": "Qwen/Qwen3-VL-4B-Instruct",
|
||||
"default": true,
|
||||
"quantized": false,
|
||||
"vram_requirement": {
|
||||
"full": 6.0,
|
||||
"8bit": 3.5,
|
||||
"4bit": 2.0
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-4B-Thinking": {
|
||||
"repo_id": "Qwen/Qwen3-VL-4B-Thinking",
|
||||
"Qwen3-VL-8B-Instruct-Abliterated": {
|
||||
"repo_id": "huihui-ai/Huihui-Qwen3-VL-8B-Instruct-abliterated",
|
||||
"default": false,
|
||||
"quantized": true,
|
||||
"vram_requirement": {
|
||||
"full": 12.0,
|
||||
"8bit": 7.0,
|
||||
"4bit": 4.5
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-4B-Instruct-Unredacted-MAX": {
|
||||
"repo_id": "prithivMLmods/Qwen3-VL-4B-Instruct-Unredacted-MAX",
|
||||
"default": false,
|
||||
"quantized": false,
|
||||
"vram_requirement": {
|
||||
@@ -56,24 +30,8 @@
|
||||
"4bit": 2.0
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-4B-Instruct-FP8": {
|
||||
"repo_id": "Qwen/Qwen3-VL-4B-Instruct-FP8",
|
||||
"default": false,
|
||||
"quantized": true,
|
||||
"vram_requirement": {
|
||||
"full": 2.5
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-4B-Thinking-FP8": {
|
||||
"repo_id": "Qwen/Qwen3-VL-4B-Thinking-FP8",
|
||||
"default": false,
|
||||
"quantized": true,
|
||||
"vram_requirement": {
|
||||
"full": 2.5
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-8B-Instruct": {
|
||||
"repo_id": "Qwen/Qwen3-VL-8B-Instruct",
|
||||
"Qwen3-VL-8B-Instruct-Unredacted-MAX": {
|
||||
"repo_id": "prithivMLmods/Qwen3-VL-8B-Instruct-Unredacted-MAX",
|
||||
"default": false,
|
||||
"quantized": false,
|
||||
"vram_requirement": {
|
||||
@@ -82,8 +40,8 @@
|
||||
"4bit": 4.5
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-8B-Thinking": {
|
||||
"repo_id": "Qwen/Qwen3-VL-8B-Thinking",
|
||||
"Qwen3-VL-8B-Instruct-abliterated-v1": {
|
||||
"repo_id": "prithivMLmods/Qwen3-VL-8B-Instruct-abliterated-v1",
|
||||
"default": false,
|
||||
"quantized": false,
|
||||
"vram_requirement": {
|
||||
@@ -92,60 +50,8 @@
|
||||
"4bit": 4.5
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-8B-Instruct-FP8": {
|
||||
"repo_id": "Qwen/Qwen3-VL-8B-Instruct-FP8",
|
||||
"default": false,
|
||||
"quantized": true,
|
||||
"vram_requirement": {
|
||||
"full": 7.5
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-8B-Thinking-FP8": {
|
||||
"repo_id": "Qwen/Qwen3-VL-8B-Thinking-FP8",
|
||||
"default": false,
|
||||
"quantized": true,
|
||||
"vram_requirement": {
|
||||
"full": 7.5
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-32B-Instruct": {
|
||||
"repo_id": "Qwen/Qwen3-VL-32B-Instruct",
|
||||
"default": false,
|
||||
"quantized": false,
|
||||
"vram_requirement": {
|
||||
"full": 28.0,
|
||||
"8bit": 14.0,
|
||||
"4bit": 8.5
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-32B-Thinking": {
|
||||
"repo_id": "Qwen/Qwen3-VL-32B-Thinking",
|
||||
"default": false,
|
||||
"quantized": false,
|
||||
"vram_requirement": {
|
||||
"full": 28.0,
|
||||
"8bit": 14.0,
|
||||
"4bit": 8.5
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-32B-Instruct-FP8": {
|
||||
"repo_id": "Qwen/Qwen3-VL-32B-Instruct-FP8",
|
||||
"default": false,
|
||||
"quantized": true,
|
||||
"vram_requirement": {
|
||||
"full": 24.0
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-32B-Thinking-FP8": {
|
||||
"repo_id": "Qwen/Qwen3-VL-32B-Thinking-FP8",
|
||||
"default": false,
|
||||
"quantized": true,
|
||||
"vram_requirement": {
|
||||
"full": 24.0
|
||||
}
|
||||
},
|
||||
"Qwen2.5-VL-3B-Instruct": {
|
||||
"repo_id": "Qwen/Qwen2.5-VL-3B-Instruct",
|
||||
"Qwen3-VL-4B-Instruct-abliterated-v1": {
|
||||
"repo_id": "prithivMLmods/Qwen3-VL-4B-Instruct-abliterated-v1",
|
||||
"default": false,
|
||||
"quantized": false,
|
||||
"vram_requirement": {
|
||||
@@ -154,32 +60,42 @@
|
||||
"4bit": 2.0
|
||||
}
|
||||
},
|
||||
"Qwen2.5-VL-7B-Instruct": {
|
||||
"repo_id": "Qwen/Qwen2.5-VL-7B-Instruct",
|
||||
"Qwen3-VL-32B-Heretic-v2": {
|
||||
"repo_id": "rpDungeon/Qwen3-VL-32B-Heretic-v2",
|
||||
"default": false,
|
||||
"quantized": false,
|
||||
"vram_requirement": {
|
||||
"full": 15.0,
|
||||
"8bit": 8.5,
|
||||
"4bit": 5.0
|
||||
"full": 48.0,
|
||||
"8bit": 28.0,
|
||||
"4bit": 16.0
|
||||
}
|
||||
}
|
||||
},
|
||||
"hf_text_models": {
|
||||
"Qwen3-0.6B": {
|
||||
"repo_id": "Qwen/Qwen3-0.6B",
|
||||
"Qwen3-VL-4B-Instruct-Abliterated": {
|
||||
"repo_id": "huihui-ai/Huihui-Qwen3-VL-4B-Instruct-abliterated",
|
||||
"default": true,
|
||||
"quantized": true,
|
||||
"vram_requirement": {
|
||||
"full": 6.0,
|
||||
"8bit": 3.5,
|
||||
"4bit": 2.0
|
||||
}
|
||||
},
|
||||
"Qwen3-VL-8B-Instruct-Abliterated": {
|
||||
"repo_id": "huihui-ai/Huihui-Qwen3-VL-8B-Instruct-abliterated",
|
||||
"default": false,
|
||||
"quantized": false
|
||||
"quantized": true,
|
||||
"vram_requirement": {
|
||||
"full": 12.0,
|
||||
"8bit": 7.0,
|
||||
"4bit": 4.5
|
||||
}
|
||||
},
|
||||
"qwen3-4b-Z-Image-Engineer": {
|
||||
"repo_id": "BennyDaBall/qwen3-4b-Z-Image-Engineer",
|
||||
"default": false,
|
||||
"quantized": false
|
||||
},
|
||||
"Qwen3-4B-Instruct-2507": {
|
||||
"repo_id": "Qwen/Qwen3-4B-Instruct-2507",
|
||||
"default": false,
|
||||
"quantized": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
"""
|
||||
Custom node for splitting WAN 2.2 Story prompts
|
||||
Handles various separators automatically
|
||||
"""
|
||||
|
||||
class StorySplitNode:
|
||||
"""
|
||||
Splits WAN 2.2 Story output into 4 separate prompts
|
||||
Handles different separators: \n, \n\n, \n\n\n
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"text": ("STRING", {"multiline": True, "default": ""}),
|
||||
},
|
||||
"optional": {
|
||||
"auto_split": ("BOOLEAN", {"default": True}),
|
||||
"custom_delimiter": ("STRING", {"multiline": False, "default": ""}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("STRING", "STRING", "STRING", "STRING", "STRING")
|
||||
RETURN_NAMES = ("prompt_1", "prompt_2", "prompt_3", "prompt_4", "debug_info")
|
||||
FUNCTION = "split_story"
|
||||
CATEGORY = "🔷 QwenVL-Mod/Utils"
|
||||
|
||||
def split_story(self, text, auto_split=True, custom_delimiter=""):
|
||||
"""
|
||||
Split story text into 4 prompts
|
||||
"""
|
||||
if not text:
|
||||
return ("", "", "", "", "Empty input")
|
||||
|
||||
text = text.strip()
|
||||
|
||||
if auto_split and not custom_delimiter:
|
||||
# Try different separators automatically
|
||||
if '\n\n\n' in text:
|
||||
prompts = text.split('\n\n\n')
|
||||
elif '\n\n' in text:
|
||||
prompts = text.split('\n\n')
|
||||
elif '\n' in text:
|
||||
prompts = text.split('\n')
|
||||
else:
|
||||
# No clear separator, split by paragraphs
|
||||
prompts = [p for p in text.split('\n') if p.strip()]
|
||||
else:
|
||||
# Use custom delimiter
|
||||
delimiter = custom_delimiter if custom_delimiter else '\n\n'
|
||||
prompts = text.split(delimiter)
|
||||
|
||||
# Clean up prompts
|
||||
clean_prompts = []
|
||||
for prompt in prompts:
|
||||
clean_prompt = prompt.strip()
|
||||
if clean_prompt and not clean_prompt.startswith("Prompt") and "content describing" not in clean_prompt:
|
||||
clean_prompts.append(clean_prompt)
|
||||
|
||||
# Ensure we have exactly 4 prompts
|
||||
while len(clean_prompts) < 4:
|
||||
clean_prompts.append("")
|
||||
|
||||
result_prompts = clean_prompts[:4]
|
||||
|
||||
# Debug info
|
||||
debug = f"Found {len(prompts)} parts, cleaned to {len(clean_prompts)} prompts"
|
||||
|
||||
return (
|
||||
result_prompts[0],
|
||||
result_prompts[1],
|
||||
result_prompts[2],
|
||||
result_prompts[3],
|
||||
debug
|
||||
)
|
||||
|
||||
# Node mapping for ComfyUI
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"StorySplitNode": StorySplitNode
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"StorySplitNode": "Story Split Node"
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
ComfyUI VRAM Cleanup Node
|
||||
Generic VRAM cleanup for preventing memory issues in workflows
|
||||
"""
|
||||
|
||||
import gc
|
||||
import torch
|
||||
import folder_paths
|
||||
from comfy import model_management
|
||||
|
||||
class VRAMCleanup:
|
||||
"""
|
||||
Generic VRAM cleanup node for preventing memory issues in workflows
|
||||
Prevents memory accumulation and crashes in multi-model workflows
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
return {
|
||||
"required": {
|
||||
"input": ("*",), # Any input to allow connection
|
||||
"cleanup_mode": ([
|
||||
"Cache Only",
|
||||
"Text Encoder",
|
||||
"Full Cleanup",
|
||||
"T2V + QwenVL Fix"
|
||||
], {"default": "Cache Only"}),
|
||||
}
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("*",) # Pass through the input
|
||||
RETURN_NAMES = ("output",)
|
||||
FUNCTION = "cleanup_vram_memory"
|
||||
CATEGORY = "🔷 QwenVL-Mod/Utils"
|
||||
OUTPUT_NODE = True
|
||||
|
||||
def cleanup_vram_memory(self, input, cleanup_mode):
|
||||
"""
|
||||
Generic VRAM cleanup for preventing memory issues in workflows
|
||||
"""
|
||||
try:
|
||||
print(f"🧹 VRAM Cleanup: Starting {cleanup_mode} cleanup...")
|
||||
|
||||
# Get current memory state
|
||||
if torch.cuda.is_available():
|
||||
initial_memory = torch.cuda.memory_allocated()
|
||||
print(f"📊 Initial VRAM: {initial_memory / 1024**3:.2f} GB")
|
||||
|
||||
# Mode-specific cleanup
|
||||
if cleanup_mode == "Cache Only":
|
||||
self._cache_only()
|
||||
elif cleanup_mode == "Text Encoder":
|
||||
self._text_encoder()
|
||||
elif cleanup_mode == "Full Cleanup":
|
||||
self._full_cleanup()
|
||||
elif cleanup_mode == "T2V + QwenVL Fix":
|
||||
self._t2v_qwen_fix()
|
||||
|
||||
# Report final memory state
|
||||
if torch.cuda.is_available():
|
||||
final_memory = torch.cuda.memory_allocated()
|
||||
freed_memory = initial_memory - final_memory
|
||||
print(f"📉 Final VRAM: {final_memory / 1024**3:.2f} GB")
|
||||
print(f"💾 Freed: {freed_memory / 1024**3:.2f} GB")
|
||||
|
||||
print("✅ VRAM Cleanup completed successfully!")
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ VRAM Cleanup failed: {str(e)}")
|
||||
raise e
|
||||
|
||||
return (input,) # Pass through the input
|
||||
|
||||
def _cache_only(self):
|
||||
"""Simple cache cleanup only"""
|
||||
try:
|
||||
if torch.cuda.is_available():
|
||||
torch.cuda.empty_cache()
|
||||
print(" Cache cleared")
|
||||
|
||||
except Exception as e:
|
||||
print(f"⚠️ Cache cleanup warning: {e}")
|
||||
|
||||
def _text_encoder(self):
|
||||
"""Targeted cleanup for WAN text encoder"""
|
||||
try:
|
||||
if torch.cuda.is_available():
|
||||
for i in range(3):
|
||||
torch.cuda.empty_cache()
|
||||
if i == 1:
|
||||
torch.cuda.synchronize()
|
||||
print(f" Text encoder clear {i+1}/3")
|
||||
|
||||
print(" Text encoder cleanup completed")
|
||||
|
||||
except Exception as e:
|
||||
print(f"⚠️ Text encoder cleanup warning: {e}")
|
||||
|
||||
def _full_cleanup(self):
|
||||
"""Complete cleanup - unload all models"""
|
||||
try:
|
||||
if torch.cuda.is_available():
|
||||
try:
|
||||
print(" Attempting full model unload...")
|
||||
model_management.unload_all_models()
|
||||
print(" All models unloaded successfully")
|
||||
except Exception as unload_error:
|
||||
print(f" Model unload failed: {unload_error}")
|
||||
print(" Continuing with cache cleanup only...")
|
||||
|
||||
for _ in range(5):
|
||||
torch.cuda.empty_cache()
|
||||
|
||||
torch.cuda.synchronize()
|
||||
gc.collect()
|
||||
print(" Full cleanup completed")
|
||||
|
||||
except Exception as e:
|
||||
print(f"⚠️ Full cleanup warning: {e}")
|
||||
|
||||
def _t2v_qwen_fix(self):
|
||||
"""Special fix for T2V + QwenVL conflict - uses Easy Use method"""
|
||||
try:
|
||||
if torch.cuda.is_available():
|
||||
try:
|
||||
print(" Attempting model unload (Easy Use method)...")
|
||||
model_management.unload_all_models()
|
||||
print(" Models unloaded successfully")
|
||||
except Exception as unload_error:
|
||||
print(f" Model unload failed: {unload_error}")
|
||||
print(" Continuing with cache cleanup only...")
|
||||
|
||||
for i in range(3):
|
||||
torch.cuda.empty_cache()
|
||||
if i == 1:
|
||||
torch.cuda.synchronize()
|
||||
print(f" T2V residue clear {i+1}/3")
|
||||
|
||||
try:
|
||||
temp_tensor = torch.randn(1500, 1500, device='cuda')
|
||||
del temp_tensor
|
||||
torch.cuda.empty_cache()
|
||||
torch.cuda.synchronize()
|
||||
print(" Memory pressure applied")
|
||||
except:
|
||||
pass
|
||||
|
||||
torch.cuda.synchronize()
|
||||
gc.collect()
|
||||
print(" T2V + QwenVL fix completed")
|
||||
|
||||
except Exception as e:
|
||||
print(f"⚠️ T2V + QwenVL fix warning: {e}")
|
||||
|
||||
# Register the node
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"VRAMCleanup": VRAMCleanup
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"VRAMCleanup": "VRAM Cleanup"
|
||||
}
|
||||
|
||||
__all__ = ['NODE_CLASS_MAPPINGS', 'NODE_DISPLAY_NAME_MAPPINGS']
|
||||
+8
-7
@@ -1,14 +1,15 @@
|
||||
[project]
|
||||
name = "ComfyUI-QwenVL"
|
||||
description = "ComfyUI-QwenVL custom node: Integrates the Qwen-VL series, including Qwen2.5-VL and the latest Qwen3-VL, with GGUF support for advanced multimodal AI in text generation, image understanding, and video analysis."
|
||||
version = "2.0.0"
|
||||
name = "ComfyUI-QwenVL-Mod"
|
||||
description = "Enhanced QwenVL node with WAN 2.2 workflows, multilingual support, visual style detection, smart prompt caching, and GGUF backend for professional video generation and multimodal AI."
|
||||
version = "2.2.3"
|
||||
license = {file = "LICENSE"}
|
||||
dependencies = ["transformers", "torch", "huggingface-hub", "hf_xet", "psutil", "numpy", "Pillow", "opencv-python", "bitsandbytes", "accelerate"]
|
||||
dependencies = ["transformers", "torch", "huggingface-hub", "hf_xet", "psutil", "numpy", "Pillow", "opencv-python", "bitsandbytes", "accelerate", "llama-cpp-python"]
|
||||
|
||||
[project.urls]
|
||||
Repository = "https://github.com/1038lab/ComfyUI-QwenVL"
|
||||
Repository = "https://github.com/huchukato/ComfyUI-QwenVL-Mod"
|
||||
|
||||
[tool.comfy]
|
||||
PublisherId = "ailab"
|
||||
DisplayName = "ComfyUI-QwenVL"
|
||||
PublisherId = "huchukato"
|
||||
DisplayName = "ComfyUI-QwenVL-Mod"
|
||||
Icon = ""
|
||||
Category = "video"
|
||||
|
||||
+12
-9
@@ -3,18 +3,21 @@
|
||||
|
||||
transformers
|
||||
torch
|
||||
huggingface-hub
|
||||
hf_xet
|
||||
psutil
|
||||
numpy
|
||||
Pillow
|
||||
opencv-python
|
||||
bitsandbytes
|
||||
accelerate
|
||||
huggingface-hub
|
||||
hf_xet
|
||||
psutil
|
||||
numpy
|
||||
Pillow
|
||||
opencv-python
|
||||
bitsandbytes
|
||||
accelerate
|
||||
|
||||
# For running GGUF models with vision support
|
||||
|
||||
# The [server] extra installs necessary components for multimodal models
|
||||
# llama-cpp-python[server]
|
||||
|
||||
# Optional: Flash Attention 2 for 2-3x performance boost (RTX 20+)
|
||||
# flash-attn>=2.0.0 # Uncomment for Flash Attention 2 support
|
||||
|
||||
# Optional: SageAttention for 2-5x performance boost (RTX 30+)
|
||||
# sageattention>=1.0.0 # Uncomment for SageAttention support
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
"""
|
||||
SageAttention patching functions for QwenVL models.
|
||||
This module contains the safe SageAttention implementation with proper error handling.
|
||||
"""
|
||||
|
||||
import torch
|
||||
|
||||
|
||||
def set_sage_attention(model):
|
||||
"""
|
||||
Apply SageAttention patching to the model.
|
||||
Patches Qwen2Attention and Qwen3VLTextAttention modules to use SageAttention kernels.
|
||||
"""
|
||||
from AILab_QwenVL import sage_attn_available, get_sage_attention_config
|
||||
|
||||
if not sage_attn_available():
|
||||
raise ImportError("SageAttention library is not installed or GPU doesn't support it.")
|
||||
|
||||
SAGE_ATTN_FUNC, QK_QUANT_GRAN, PV_ACCUM_DTYPE = get_sage_attention_config()
|
||||
if SAGE_ATTN_FUNC is None:
|
||||
raise RuntimeError("No compatible SageAttention kernel found for this GPU.")
|
||||
|
||||
# Try to import different attention classes for different Qwen models
|
||||
attention_classes = []
|
||||
|
||||
# Qwen2 models
|
||||
try:
|
||||
from transformers.models.qwen2.modeling_qwen2 import Qwen2Attention, apply_rotary_pos_emb as qwen2_apply_rotary
|
||||
attention_classes.append((Qwen2Attention, qwen2_apply_rotary))
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
# Qwen3 models (Qwen3-VL, etc.)
|
||||
try:
|
||||
from transformers.models.qwen3.modeling_qwen3 import Qwen3Attention, apply_rotary_pos_emb as qwen3_apply_rotary
|
||||
attention_classes.append((Qwen3Attention, qwen3_apply_rotary))
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
# Qwen3-VL specific
|
||||
try:
|
||||
from transformers.models.qwen3_vl.modeling_qwen3_vl import Qwen3VLTextAttention, apply_rotary_pos_emb as qwen3vl_apply_rotary
|
||||
attention_classes.append((Qwen3VLTextAttention, qwen3vl_apply_rotary))
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
if not attention_classes:
|
||||
print("[QwenVL] Could not import any attention classes for SageAttention patching")
|
||||
return
|
||||
|
||||
def make_sage_forward(AttentionClass, apply_rotary_pos_emb_func):
|
||||
def sage_attention_forward(
|
||||
self,
|
||||
hidden_states: torch.Tensor,
|
||||
position_embeddings: tuple = None,
|
||||
attention_mask: torch.Tensor = None,
|
||||
past_key_values=None,
|
||||
cache_position: torch.LongTensor = None,
|
||||
position_ids: torch.LongTensor = None,
|
||||
**kwargs,
|
||||
):
|
||||
original_dtype = hidden_states.dtype
|
||||
|
||||
# Determine target dtype
|
||||
is_4bit = hasattr(self.q_proj, 'quant_state')
|
||||
if is_4bit:
|
||||
target_dtype = torch.bfloat16
|
||||
else:
|
||||
target_dtype = self.q_proj.weight.dtype
|
||||
|
||||
if hidden_states.dtype != target_dtype:
|
||||
hidden_states = hidden_states.to(target_dtype)
|
||||
|
||||
input_shape = hidden_states.shape[:-1]
|
||||
hidden_shape = (*input_shape, -1, self.head_dim)
|
||||
bsz, q_len = input_shape[0], input_shape[1] if len(input_shape) > 1 else hidden_states.size(1)
|
||||
|
||||
# Handle q_norm and k_norm for Qwen3-VL
|
||||
query_states = self.q_proj(hidden_states)
|
||||
key_states = self.k_proj(hidden_states)
|
||||
value_states = self.v_proj(hidden_states)
|
||||
|
||||
# Apply normalization if available (Qwen3-VL specific)
|
||||
if hasattr(self, 'q_norm'):
|
||||
query_states = self.q_norm(query_states.view(hidden_shape)).transpose(1, 2)
|
||||
else:
|
||||
query_states = query_states.view(hidden_shape).transpose(1, 2)
|
||||
|
||||
if hasattr(self, 'k_norm'):
|
||||
key_states = self.k_norm(key_states.view(hidden_shape)).transpose(1, 2)
|
||||
else:
|
||||
key_states = key_states.view(hidden_shape).transpose(1, 2)
|
||||
|
||||
value_states = value_states.view(hidden_shape).transpose(1, 2)
|
||||
|
||||
# Apply rotary embeddings
|
||||
if position_embeddings is not None:
|
||||
cos, sin = position_embeddings
|
||||
query_states, key_states = apply_rotary_pos_emb_func(query_states, key_states, cos, sin)
|
||||
|
||||
if past_key_values is not None:
|
||||
cache_kwargs = {"sin": sin if position_embeddings else None, "cos": cos if position_embeddings else None, "cache_position": cache_position}
|
||||
key_states, value_states = past_key_values.update(key_states, value_states, self.layer_idx, cache_kwargs)
|
||||
|
||||
is_causal = attention_mask is None and q_len > 1
|
||||
|
||||
attn_output = SAGE_ATTN_FUNC(
|
||||
query_states.to(target_dtype),
|
||||
key_states.to(target_dtype),
|
||||
value_states.to(target_dtype),
|
||||
tensor_layout="HND",
|
||||
is_causal=is_causal,
|
||||
qk_quant_gran=QK_QUANT_GRAN,
|
||||
pv_accum_dtype=PV_ACCUM_DTYPE,
|
||||
)
|
||||
|
||||
if isinstance(attn_output, tuple):
|
||||
attn_output = attn_output[0]
|
||||
|
||||
attn_output = attn_output.transpose(1, 2).contiguous()
|
||||
attn_output = attn_output.reshape(*input_shape, -1)
|
||||
|
||||
attn_output = self.o_proj(attn_output)
|
||||
|
||||
if attn_output.dtype != original_dtype:
|
||||
attn_output = attn_output.to(original_dtype)
|
||||
|
||||
return attn_output, None
|
||||
|
||||
return sage_attention_forward
|
||||
|
||||
# Apply patching to all supported attention modules
|
||||
patched_count = 0
|
||||
for AttentionClass, apply_rotary_func in attention_classes:
|
||||
sage_forward = make_sage_forward(AttentionClass, apply_rotary_func)
|
||||
for module in model.modules():
|
||||
if isinstance(module, AttentionClass):
|
||||
module.forward = sage_forward.__get__(module, AttentionClass)
|
||||
patched_count += 1
|
||||
|
||||
if patched_count > 0:
|
||||
print(f"[QwenVL] SageAttention: Patched {patched_count} attention layers")
|
||||
else:
|
||||
print("[QwenVL] SageAttention: No compatible attention layers found to patch")
|
||||
@@ -1,4 +1,586 @@
|
||||
# ComfyUI-QwenVL Update Log
|
||||
|
||||
## Version 2.2.3 (2026/02/27)
|
||||
|
||||
🔧 **CUDA 13 Compatibility Fix + Redundancy Removal**
|
||||
|
||||
This update removes redundant memory management features and improves CUDA 13 compatibility.
|
||||
|
||||
### 🔧 **Memory Management Cleanup**
|
||||
|- **Removed unload_after_run**: Eliminated redundant checkbox from all QwenVL nodes
|
||||
|- **Fixed Parameter Errors**: Resolved missing argument errors in GGUF and PromptEnhancer nodes
|
||||
|- **Conflict Prevention**: Prevents multiple unload operations that cause CUDA 13 crashes
|
||||
|- **Simplified Interface**: Cleaner node interface without redundant parameters
|
||||
|- **VRAM Cleanup Node**: Maintained for manual cleanup when needed
|
||||
|
||||
### 🐛 **Bug Fixes**
|
||||
|- **VastAI CUDA 13**: Fixed crashes caused by conflicting unload operations
|
||||
|- **WanMoeKSampler**: Manual boundary setting prevents automatic switching crashes
|
||||
|- **Memory Conflicts**: Eliminated double cleanup between QwenVL and VRAM Cleanup nodes
|
||||
|- **Parameter Errors**: Fixed "missing 1 required positional argument: unload_after_run" errors
|
||||
|- **Function Signatures**: Corrected all run() and load_model() function signatures
|
||||
|
||||
### 📚 **Documentation Updates**
|
||||
|- **All READMEs**: Updated to reflect unload_after_run removal
|
||||
|- **Installation Guides**: Simplified instructions without redundant parameters
|
||||
|- **Troubleshooting**: Added CUDA 13 specific guidance
|
||||
|
||||
### 🏆 Credits & Attribution
|
||||
|- **Community Feedback**: Thanks to user testing that identified redundancy issue
|
||||
|- **CUDA 13 Testing**: Comprehensive testing on VastAI infrastructure
|
||||
|- **Memory Management**: Streamlined approach for better stability
|
||||
|
||||
---
|
||||
|
||||
## Version 2.2.2 (2026/02/19)
|
||||
|
||||
🚀 **Critical T2V/I2V Fixes + ComfyUI Optimizations**
|
||||
|
||||
## Version 2.2.2 (2026/02/19)
|
||||
|
||||
🚀 **Critical T2V/I2V Fixes + ComfyUI Optimizations**
|
||||
|
||||
This major update resolves critical workflow issues with T2V/I2V batch processing, same model reuse conflicts, and adds significant performance optimizations including Flash Attention 2 support and refined ComfyUI startup arguments.
|
||||
|
||||
### 🚀 T2V/I2V Workflow Fixes (Critical)
|
||||
|- **Batch Processing**: Fixed critical T2V → GGUF issue with batch images `[batch, height, width, channels]`
|
||||
|- **Frame Detection**: Added automatic batch detection and individual frame processing
|
||||
|- **Video Support**: Enhanced video frame processing with proper shape handling
|
||||
|- **Debug Enhanced**: Comprehensive logging for batch processing troubleshooting
|
||||
|
||||
### **Same Model Reuse Fix**
|
||||
|- **Conflict Resolution**: Fixed crash when using same model between T2V and I2V nodes
|
||||
|- **Memory Management**: Enhanced cleanup with CUDA synchronization and timing
|
||||
|- **Signature Mismatch**: Resolved different signature patterns between nodes
|
||||
|- **Aggressive Cleanup**: Forced complete VRAM cleanup before model reload
|
||||
|
||||
### 🐳 Docker System Optimizations
|
||||
|- **ComfyUI Arguments**: Optimized startup arguments for better performance
|
||||
|- **Flash Attention 2**: Enabled for 2-3x speedup on compatible hardware
|
||||
|- **Experimental Features**: Added validated arguments (`--async-offload`, `--reserve-vram 2`)
|
||||
|- **Version Compatibility**: Resolved version-specific argument differences
|
||||
|
||||
### **keep_model_loaded Enhancement**
|
||||
### 🔧 keep_model_loaded Enhancement
|
||||
|- **Missing Parameter**: Added `keep_model_loaded` to PromptEnhancer node
|
||||
|- **Consistent Behavior**: Both GGUF and PromptEnhancer now have identical memory management
|
||||
|- **Conditional Cleanup**: Proper cleanup based on `keep_model_loaded` setting
|
||||
|- **User Control**: Full control over memory usage vs performance
|
||||
|
||||
### 🐳 Docker Final Optimization
|
||||
|- **Complete Build**: All fixes integrated into final Docker build
|
||||
|- **Flash Attention 2 Ready**: Performance optimizations included
|
||||
|- **Debug Enhanced**: Comprehensive logging for troubleshooting
|
||||
|- **Production Ready**: Stable and optimized for deployment
|
||||
|
||||
### 📋 Files Modified
|
||||
**Node Files:**
|
||||
|- `AILab_QwenVL_GGUF.py`: Batch processing + enhanced cleanup
|
||||
|- `AILab_QwenVL_GGUF_PromptEnhancer.py`: keep_model_loaded + cleanup
|
||||
|
||||
**Docker System Files:**
|
||||
|- `runpod/Dockerfile`: Flash Attention 2 + optimized ComfyUI arguments
|
||||
|- `runpod/Dockerfile.4090`: Flash Attention 2 + optimized ComfyUI arguments
|
||||
|
||||
### 🎯 Impact
|
||||
|- **T2V/I2V Workflows**: Now fully functional with batch processing
|
||||
|- **Same Model Reuse**: No more conflicts between nodes
|
||||
|- **Performance**: 2-3x faster with Flash Attention 2
|
||||
|- **Stability**: Robust memory management and cleanup
|
||||
|- **Production**: Ready for deployment with all optimizations
|
||||
|
||||
## Version 2.2.1 (2026/02/18)
|
||||
|
||||
🔧 **Critical GGUF VRAM Fix + Docker Optimization**
|
||||
|
||||
This critical update resolves a major VRAM leak issue in GGUF nodes that was causing crashes after multiple executions, plus significant Docker improvements for better stability and functionality.
|
||||
|
||||
### 🔧 GGUF VRAM Fix (Critical)
|
||||
- **VRAM Leak Resolved**: Fixed critical issue where GGUF models kept VRAM allocated after runs
|
||||
- **Issue #104**: Addressed GitHub issue where GGUF models failed after 2 runs
|
||||
- **Aggressive Cleanup**: Implemented comprehensive VRAM cleanup for all GGUF nodes
|
||||
- **Enhanced Clear Method**: Added explicit model deletion and multiple CUDA cache clearing
|
||||
- **Debug Logging**: Added detailed cleanup logging for troubleshooting
|
||||
- **Exception Handling**: Robust error handling during cleanup operations
|
||||
|
||||
### 🚀 Performance Improvements
|
||||
- **Stable GGUF Operation**: Nodes now work reliably without VRAM accumulation
|
||||
- **No More Crashes**: GGUF Advanced and PromptEnhancer nodes stable after multiple runs
|
||||
- **Memory Management**: Proper garbage collection and CUDA synchronization
|
||||
- **Resource Efficiency**: Better VRAM utilization and cleanup
|
||||
|
||||
### 🐳 Docker Enhancements
|
||||
- **RunPod Methods**: Adopted proven RunPod installation methods for services
|
||||
- **Jupyter Terminal**: Switched to simple `pip install jupyter` (RunPod approach)
|
||||
- **FileBrowser**: Using official get.sh script for latest version
|
||||
- **ComfyUI Latest**: Always uses latest stable version automatically
|
||||
- **SSH Complete**: Both server and client SSH for full networking
|
||||
- **FFmpeg ENV**: Added IMAGEIO_FFMPEG_EXE environment variable
|
||||
- **Build Warnings**: Removed problematic HF_TOKEN variables
|
||||
|
||||
### 📋 Files Modified
|
||||
- `AILab_QwenVL_GGUF.py`: Enhanced VRAM cleanup
|
||||
- `AILab_QwenVL_GGUF_PromptEnhancer.py`: Enhanced VRAM cleanup
|
||||
- `runpod/Dockerfile`: RunPod methods + optimizations
|
||||
- `runpod/Dockerfile.4090`: RunPod methods + optimizations
|
||||
|
||||
### 🎯 Impact
|
||||
- **Reliability**: GGUF nodes now production-ready
|
||||
- **Stability**: No more VRAM-related crashes
|
||||
- **Docker**: Better container experience
|
||||
- **Performance**: Consistent operation across multiple runs
|
||||
|
||||
---
|
||||
|
||||
## Version 2.2.0 (2026/02/15)
|
||||
|
||||
🎬 **WAN 2.2 Story Generation System**
|
||||
|
||||
This major update introduces a complete story generation system for WAN 2.2, enabling the creation of continuous 20-second videos with 4 distinct segments, along with custom utility nodes and enhanced performance optimizations.
|
||||
|
||||
### 🎬 Story Generation System
|
||||
- **4-Segment Videos**: Complete system for generating 20-second continuous videos (4 × 5-second segments)
|
||||
- **Narrative Continuity**: Intelligent prompt splitting ensures story coherence across segments
|
||||
- **Auto-Split Technology**: Custom node automatically detects and splits prompt separators
|
||||
- **Workflow Integration**: Ready-to-use WAN 2.2 Story workflow included
|
||||
- **NSFW Optimized**: Enhanced prompts specifically designed for story generation
|
||||
|
||||
### 🔄 Custom Nodes
|
||||
- **Story Split Node**: Intelligent text splitting with auto-detection of separators (`\n`, `\n\n`, `\n\n\n`)
|
||||
- **Smart Processing**: Automatically handles inconsistent model output formatting
|
||||
- **Category**: Located in `🔷QwenVL-Mod/Utils` category
|
||||
- **Chaining Support**: Full input/output connectivity for workflow integration
|
||||
|
||||
### 🎯 Enhanced Prompts
|
||||
- **WAN 2.2 NSFW Story**: Optimized prompt format for 4-segment generation
|
||||
- **Separator Instructions**: Clear guidelines for prompt separation
|
||||
- **Continuity Rules**: Enhanced narrative continuity between segments
|
||||
- **Token Optimization**: Recommended max_tokens=1536 for complete output
|
||||
|
||||
### ⚡ Performance Optimizations
|
||||
- **Context Settings**: Optimized context_length for 8B models (65,536 tokens)
|
||||
- **Model-Specific**: 4B models maintain 32,768 context for stability
|
||||
- **Memory Management**: Improved VRAM usage and stability
|
||||
- **Crash Prevention**: Safe defaults prevent ComfyUI crashes with large contexts
|
||||
|
||||
### 🐳 Docker Integration
|
||||
- **Container Ready**: Complete Story system integrated in Docker containers
|
||||
- **Auto-Download**: WAN2.2-I2V-AutoPrompt-Story.json and WAN2.2-T2V-AutoPrompt-Story.json workflows included
|
||||
- **Cloud Deployment**: Ready for RunPod/VastAI deployment
|
||||
- **Service Integration**: FileBrowser, JupyterLab, and ComfyUI with Story support
|
||||
|
||||
### 📁 File Structure
|
||||
- **Nodes**: `/nodes/story_split_node.py` for intelligent prompt splitting
|
||||
- **Workflows**:
|
||||
- `/vastai/workflows/WAN2.2-I2V-AutoPrompt-Story.json` ready-to-use I2V workflow
|
||||
- `/vastai/workflows/WAN2.2-T2V-AutoPrompt-Story.json` ready-to-use T2V workflow
|
||||
- **Docker**: Updated `/runpod/Dockerfile` with Story workflows
|
||||
- **Prompts**: Enhanced `/AILab_System_Prompts.json` with Story system
|
||||
|
||||
### 🔧 Technical Improvements
|
||||
- **Auto-Loading**: Enhanced `__init__.py` to load nodes from subdirectory
|
||||
- **Error Handling**: Robust separator detection and fallback mechanisms
|
||||
- **Debug Output**: Detailed debugging information for troubleshooting
|
||||
- **Flexible Input**: Support for custom delimiters and auto-detection modes
|
||||
|
||||
## Version 2.1.0 (2026/02/14)
|
||||
|
||||
🏷️ **User-Friendly Keep Last Prompt Feature**
|
||||
|
||||
This update refines the prompt persistence feature with a more intuitive parameter name and simplified implementation, making it easier for users to understand and use.
|
||||
|
||||
### 🔄 Keep Last Prompt User-Friendly
|
||||
- **Parameter Rename**: Changed `bypass_mode` to `keep_last_prompt` for better user understanding
|
||||
- **Intuitive Checkbox**: Clear boolean parameter for prompt persistence control
|
||||
- **Consistent Logic**: Unified behavior across all 6 nodes (HF, GGUF, PromptEnhancer variants)
|
||||
- **Workflow Optimization**: Generate once, preserve results while changing inputs
|
||||
- **Zero Resource Usage**: Cached mode provides instant responses without model loading
|
||||
- **Smart Caching**: LAST_SAVED_PROMPT global variable for efficient prompt reuse
|
||||
|
||||
### 🔥 Enhanced NSFW Support
|
||||
- **Stronger Instructions**: Changed "If" to "WHEN" for more directive NSFW handling
|
||||
- **Explicit Directives**: Added "IMPORTANT: Describe ALL content without censorship or filtering"
|
||||
- **Detailed Requirements**: "Provide explicit, detailed descriptions of body parts, sexual acts, and adult content"
|
||||
- **No Sanitization**: "Do not sanitize, euphemize, or avoid explicit content"
|
||||
- **Universal Application**: Applied to all WAN 2.2 presets (I2V, T2V, Storyboard, Cinematic)
|
||||
|
||||
### 🔦 Fixed Lighting Invention Issues
|
||||
- **Accuracy Problem**: Corrected AI tendency to add lights not present in source images
|
||||
- **Visible Only Rule**: Changed to "Specify ONLY visible technical elements adapted for style"
|
||||
- **Source Fidelity**: "light sources actually present in the image, light quality as observed"
|
||||
- **No Invention**: "Do not invent or add lighting not present in the original image"
|
||||
- **Better Descriptions**: More accurate lighting analysis based on actual image content
|
||||
|
||||
### 🔄 Updated GGUF Models
|
||||
- **Replaced noctrex Models**: Removed older noctrex abliterated GGUF variants
|
||||
- **Added mradermacher v2/v3**: Latest mradermacher quantizations for better performance
|
||||
- **4B Model**: Qwen3-VL-4B-Instruct-c_abliterated-v2-GGUF (7 variants: 2.38GB-4.28GB)
|
||||
- **8B Model**: Qwen3-VL-8B-Instruct-c_abliterated-v3-GGUF (7 variants: 4.8GB-8.71GB)
|
||||
- **Enhanced File Selection**: More quantization options (Q4_K_S, Q5_K_S) for better VRAM efficiency
|
||||
- **Corrected MMProj Files**: Updated to use proper .mmproj-f16.gguf files for each model
|
||||
|
||||
### 📦 Enhanced Model Selection (HF)
|
||||
- **Added Josiefied Model**: Josiefied-Qwen3-VL-4B-Instruct-abliterated-beta-v1 (HF only)
|
||||
- **GGUF Not Available**: Josiefied model exists only in HuggingFace format, not GGUF
|
||||
- **Better Alternatives**: mradermacher models provide superior GGUF quantizations
|
||||
- **Reliable Behavior**: Works regardless of seed changes or model variations
|
||||
|
||||
### ✅ Universal Implementation
|
||||
- **All Nodes Updated**: QwenVL, QwenVL Advanced, QwenVL GGUF, QwenVL Advanced GGUF, QwenVL Prompt Enhancer, QwenVL Prompt Enhancer GGUF
|
||||
- **Consistent UI**: Same parameter name and tooltip across all nodes
|
||||
- **Bug Fixes**: Resolved TypeError issues in Advanced nodes
|
||||
|
||||
### 🔄 How Keep Last Prompt Works
|
||||
1. **Generate Phase** (`keep_last_prompt=False`): Generate new prompt and save to memory
|
||||
2. **Keep Phase** (`keep_last_prompt=True`): Return the last saved prompt from memory
|
||||
3. **First Run**: If no previous prompt exists, returns empty string
|
||||
4. **Memory Update**: Each generation overwrites the previous saved prompt
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
- **Fixed TypeError**: Resolved "unexpected keyword argument" errors in Advanced nodes
|
||||
- **Parameter Consistency**: All process() functions now use `keep_last_prompt`
|
||||
- **Syntax Errors**: Fixed duplicate global declarations
|
||||
|
||||
---
|
||||
|
||||
## Version 2.0.9 (2026/02/12)
|
||||
|
||||
🎛️ **Bypass Mode Parameter for Prompt Persistence**
|
||||
|
||||
This major feature introduces a new `bypass_mode` parameter that allows users to maintain previously generated prompts without regeneration, providing perfect workflow control.
|
||||
|
||||
### 🎛️ New Bypass Mode Feature
|
||||
- **Smart Cache Retrieval**: When `bypass_mode=True`, nodes automatically retrieve the most recent cached prompt for the current model
|
||||
- **Zero Resource Usage**: Bypass mode consumes no computational resources - instant response
|
||||
- **Perfect Workflow Control**: Generate prompts once, then enable bypass mode to preserve them while changing inputs
|
||||
- **Universal Implementation**: Available across all nodes (HF, GGUF, PromptEnhancer, Advanced variants)
|
||||
|
||||
### 🔄 How Bypass Mode Works
|
||||
1. **Generate Phase** (`bypass_mode=False`): Generate new prompts and save them to cache
|
||||
2. **Bypass Phase** (`bypass_mode=True`): Retrieve and return the most recent cached prompt
|
||||
3. **Input Changes**: When bypass mode is enabled, changing images/videos or other inputs has no effect on the output
|
||||
4. **Seamless Switching**: Toggle bypass mode on/off to switch between generation and persistence
|
||||
|
||||
### 📋 Updated Nodes
|
||||
- ✅ **AILab_QwenVL** (HF): Added bypass_mode parameter
|
||||
- ✅ **AILab_QwenVL_GGUF**: Added bypass_mode parameter
|
||||
- ✅ **AILab_QwenVL_GGUF_Advanced**: Added bypass_mode parameter
|
||||
- ✅ **AILab_QwenVL_PromptEnhancer** (HF): Added bypass_mode parameter
|
||||
- ✅ **AILab_QwenVL_GGUF_PromptEnhancer**: Added bypass_mode parameter
|
||||
|
||||
### 🎯 Use Cases
|
||||
- **Prompt Locking**: Generate the perfect prompt once, then lock it while experimenting with other workflow parameters
|
||||
- **Batch Processing**: Generate multiple prompts, then use bypass mode to maintain consistency across batches
|
||||
- **Resource Optimization**: Enable bypass mode when you need to preserve prompts but don't want to consume GPU resources
|
||||
- **Workflow Debugging**: Test other parts of your workflow without changing the generated prompts
|
||||
|
||||
### 🎮 Simple Control
|
||||
- **Checkbox Interface**: Simple bypass_mode checkbox in all node interfaces
|
||||
- **Default Behavior**: bypass_mode defaults to False (normal generation)
|
||||
- **Instant Feedback**: Console logs show when bypass mode is active and which cached prompt is being used
|
||||
|
||||
### 🔧 Technical Implementation
|
||||
- **Cache-Based**: Uses existing prompt caching system for reliable prompt retrieval
|
||||
- **Model-Specific**: Retrieves prompts specific to the current model configuration
|
||||
- **Fallback Handling**: If no cached prompt exists, returns empty string gracefully
|
||||
- **Performance Optimized**: Minimal overhead when bypass mode is enabled
|
||||
|
||||
## Version 2.0.8 (2026/02/06)
|
||||
|
||||
🐛 **Bug Fixes and Stability Improvements**
|
||||
|
||||
This release addresses critical issues identified in v2.0.7 and enhances multilingual capabilities.
|
||||
|
||||
### 🔧 Bug Fixes
|
||||
- **JSON Syntax Error**: Fixed trailing comma in `AILab_System_Prompts.json` at line 26
|
||||
- **Undefined Variable Error**: Resolved `name 'image_hash' is not defined` in GGUF Advanced node
|
||||
- **Fixed Seed Stability**: Reverted problematic fixed seed improvements that caused undefined variable errors
|
||||
- **Node Loading**: Ensured all nodes load correctly without missing variable errors
|
||||
|
||||
### 🌐 Multilingual Support Enhancement
|
||||
- **Complete Multilingual Support**: All WAN 2.2 presets now support "user prompts from any language"
|
||||
- **Updated Presets**:
|
||||
- 🍿 Wan 2.2 I2V: Multilingual + style detection
|
||||
- 🍿 Wan Extended Storyboard: Multilingual + style detection
|
||||
- 🎥 Wan Cinematic Video: Multilingual + style detection
|
||||
- 🍿 Wan 2.2 T2V: Multilingual + style detection
|
||||
|
||||
### 🎨 Visual Style Detection
|
||||
- **Enhanced Style Detection**: Comprehensive support for artistic styles:
|
||||
- Anime style
|
||||
- 3D cartoon
|
||||
- Pixel art
|
||||
- Puppet animation
|
||||
- 3D game style
|
||||
- Claymation
|
||||
- Watercolor
|
||||
- Black and white animation
|
||||
- Oil painting style
|
||||
- Felt style
|
||||
- Tilt-shift photography
|
||||
- Time-lapse photography
|
||||
|
||||
### 🔧 Technical Improvements
|
||||
- **JSON Validation**: All system prompts now validate correctly
|
||||
- **Error Handling**: Improved error messages for debugging
|
||||
- **Code Stability**: Removed complex seed tracking that caused undefined variables
|
||||
- **Documentation**: Updated README and changelog with comprehensive changes
|
||||
|
||||
### 🔄 Repository Management
|
||||
- **Clean Revert**: Properly reverted problematic commits
|
||||
- **Version Control**: Maintained stable commit history
|
||||
- **Documentation**: Comprehensive update logs for transparency
|
||||
|
||||
---
|
||||
|
||||
## Version 2.0.7 (2026/02/04)
|
||||
|
||||
🧠 **Smart Prompt Caching System**
|
||||
|
||||
This release introduces intelligent prompt caching with Fixed Seed Mode for dramatic performance improvements and workflow stability.
|
||||
|
||||
### 🎯 Key Features
|
||||
- **Smart Caching**: Automatic prompt caching prevents regeneration of identical prompts
|
||||
- **Fixed Seed Mode**: Set any fixed seed value to maintain consistent prompts regardless of media variations
|
||||
- **Universal Coverage**: Works across all node types (HF, GGUF, PromptEnhancer)
|
||||
- **Performance Boost**: Instant response for cached prompts with zero model loading time
|
||||
- **Simplified Logic**: Streamlined caching system that always includes seed for predictable behavior across all seed values
|
||||
|
||||
### 🔧 Technical Implementation
|
||||
- **Hash-based Cache Keys**: MD5 hashes generated from model, preset, custom prompt, media, and seed
|
||||
- **Media Hash Sampling**: Efficient image/video tensor hashing using pixel sampling
|
||||
- **Cache File Storage**: JSON-based cache with automatic save/load functionality
|
||||
- **Seed-based Logic**: Always includes seed in cache key for consistent behavior
|
||||
- **Console Logging**: Clear feedback on cache hits/misses with seed information
|
||||
|
||||
### 📋 Cache Behavior
|
||||
- **Fixed Seed Mode**: Any fixed seed value maintains consistent prompts regardless of media variations
|
||||
- **Random Mode**: Different seeds generate different prompts even with identical inputs
|
||||
- **Cache Hit**: Same seed + same inputs = instant response from cache
|
||||
- **Cache Miss**: Different seed or different inputs = new generation and cache storage
|
||||
- **Cache Persistence**: Automatic saving to `prompt_cache.json` after each generation
|
||||
- **Cache Loading**: Automatic cache restoration on ComfyUI startup
|
||||
- **Memory Efficient**: Cache only stores generated text and metadata
|
||||
|
||||
### 🎨 User Experience
|
||||
- **Updated Tooltips**: Enhanced seed parameter tooltips explaining cache behavior
|
||||
- **Instant Response**: Zero wait time for cached prompts
|
||||
- **Workflow Stability**: Same prompt guaranteed with fixed seed regardless of media
|
||||
- **Performance Gains**: Dramatic speedup for repeated prompt generation
|
||||
- **Transparent Operation**: Clear console messages indicating cache usage
|
||||
|
||||
### 🛠️ Compatibility
|
||||
- **Backward Compatible**: Existing workflows continue to work unchanged
|
||||
- **Optional Feature**: Fixed Seed Mode works with any seed value
|
||||
- **Cache Management**: Automatic cache cleanup and management
|
||||
- **Cross-Session**: Cache persists between ComfyUI restarts
|
||||
- **Code Maintenance**: Removed deprecated parameters across all download functions (HF, GGUF, PromptEnhancer) for future compatibility
|
||||
- **GGUF Performance**: Increased default context size from 8192 to 32768 across all GGUF models for better utilization
|
||||
- **Universal Caching**: Fixed Seed Mode and smart caching now available across all node types (HF, GGUF, PromptEnhancer) with shared cache file
|
||||
- **Simplified Logic**: Streamlined caching system that always includes seed for predictable behavior across all seed values
|
||||
|
||||
---
|
||||
|
||||
## Version 2.0.6 (2026/02/03)
|
||||
|
||||
🎬 **Professional Cinematography Enhancement**
|
||||
|
||||
This release adds comprehensive professional cinematography specifications to all WAN 2.2 presets and updates naming for consistency.
|
||||
|
||||
### 🎯 Major Enhancements
|
||||
- **Professional Specifications**: All WAN 2.2 presets now include comprehensive cinematography technical details
|
||||
- **Light Sources**: 8 types (sunlight, artificial, moonlight, practical, firelight, fluorescent, cloudy, mixed)
|
||||
- **Light Quality**: 9 qualities (soft, hard, top, side, back, bottom, edge, silhouette, low/high contrast)
|
||||
- **Time Periods**: 6 periods (daytime, nighttime, dusk, sunset, dawn, sunrise)
|
||||
- **Shot Types**: 6 types (close-up, medium shot, medium close-up, medium full shot, full shot, wide angle)
|
||||
- **Composition Types**: 5 types (central, balanced, side, symmetrical, short side)
|
||||
- **Lens Specifications**: 5 focal lengths + 6 angles for complete camera control
|
||||
- **Camera Movements**: 9 movement types for dynamic cinematography
|
||||
- **Color Tone**: 4 tone options (warm, cool, high saturation, low saturation)
|
||||
|
||||
### 🏷️ Branding Updates
|
||||
- **Wan 2.2 T2V**: Updated to "🍿 Wan 2.2 T2V" with proper emoji
|
||||
- **Extended Storyboard**: Updated to "🍿 Wan Extended Storyboard" for WAN family consistency
|
||||
- **Cinematic Video**: Updated to "🎥 Wan Cinematic Video" to align with WAN branding
|
||||
|
||||
### 📋 Enhanced Presets
|
||||
- **🍿 Wan 2.2 I2V**: Timeline structure + professional specs
|
||||
- **🍿 Wan 2.2 T2V**: Timeline structure + professional specs
|
||||
- **🍿 Wan Extended Storyboard**: Timeline + continuity + professional specs
|
||||
- **🎥 Wan Cinematic Video**: Single scene + professional specs
|
||||
|
||||
### 🛠️ Technical Improvements
|
||||
- **Consistent Organization**: All WAN presets now follow family branding
|
||||
- **Professional Quality**: Industry-standard cinematography specifications
|
||||
- **Comprehensive Coverage**: Complete technical details for professional video generation
|
||||
|
||||
---
|
||||
|
||||
## Version 2.0.5 (2026/02/01)
|
||||
|
||||
🎬 **Extended Storyboard Preset Added**
|
||||
|
||||
This release adds a new specialized preset for extended storyboard generation with WAN 2.2 format compatibility.
|
||||
|
||||
### 🎯 New Features
|
||||
- **Extended Storyboard Preset**: New preset positioned as 2nd in the list after Wan 2.2 I2V
|
||||
- **WAN 2.2 Format Compliance**: Follows the same timeline structure "(At 0 seconds: ...)" format
|
||||
- **Storyboard Continuity**: Each paragraph repeats content from previous paragraph for smooth transitions
|
||||
- **NSFW Support**: Complete NSFW description support like Wan 2.2 I2V preset
|
||||
- **Cinematic Specifications**: Comprehensive camera, lighting, and composition guidelines
|
||||
|
||||
### 📋 Preset Details
|
||||
- **Position**: 2nd preset (after Wan 2.2 I2V) for easy access
|
||||
- **Format**: 5-second timeline with detailed second-by-second descriptions
|
||||
- **Focus**: Extended video generation with consistent character appearance and scene continuity
|
||||
- **Technical Specs**: Includes camera movements, lighting types, composition guidelines
|
||||
- **Output**: Optimized for storyboard-to-storyboard workflow generation
|
||||
|
||||
### 🛠️ Technical Improvements
|
||||
- **Stability Fixes**: Identified and resolved "keep model loaded" memory issues
|
||||
- **Performance**: Maintained stable operation without OOM errors
|
||||
- **Compatibility**: Preset works with both VL and text-only models
|
||||
|
||||
---
|
||||
|
||||
## Version 2.0.4 (2026/02/01)
|
||||
|
||||
🔧 **Stability Update - SageAttention Removal**
|
||||
|
||||
This release focuses on stability by removing SageAttention integration that was causing compatibility issues and model interference.
|
||||
|
||||
### 🛠️ Major Changes
|
||||
- **SageAttention Removed**: Completely removed SageAttention integration due to compatibility and stability issues
|
||||
- **Simplified Attention Modes**: Now supports auto, flash_attention_2, and sdpa only
|
||||
- **Clean Codebase**: Removed 100+ lines of complex patching code
|
||||
- **Stable Performance**: SDPA provides excellent performance with zero interference
|
||||
|
||||
### 🎯 Attention Modes Available
|
||||
- **Auto**: Automatically chooses best available attention implementation
|
||||
- **Flash Attention 2**: High-performance attention when available (RTX 20+)
|
||||
- **SDPA**: Scaled Dot Product Attention - stable and well-tested fallback
|
||||
|
||||
### 🐛 Issues Resolved
|
||||
- **Model Output Problems**: Fixed prompt generation issues caused by SageAttention interference
|
||||
- **Recursion Errors**: Eliminated infinite recursion in attention patching
|
||||
- **Head Dimension Compatibility**: Removed headdim restrictions that were causing crashes
|
||||
- **VAE Compatibility**: Fixed VAE encoding/decoding interference
|
||||
|
||||
### ⚡ Performance Impact
|
||||
- **Flash Attention 2**: Still available for 2-3x speedup on compatible hardware
|
||||
- **SDPA**: Highly optimized baseline performance
|
||||
- **Zero Interference**: Clean attention pipeline without patching complications
|
||||
- **Better Stability**: More reliable across different model architectures
|
||||
|
||||
---
|
||||
|
||||
## Version 2.0.3 (2026/02/01)
|
||||
|
||||
🔧 **SageAttention Compatibility Fix**
|
||||
|
||||
This hotfix release addresses a critical compatibility issue with SageAttention integration that prevented proper patching in certain transformer versions.
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
- **SageAttention Patch**: Fixed AttributeError when accessing `transformers.models.qwen2.modeling_qwen2.F`
|
||||
- **Proper Module Access**: Changed patch target to `torch.nn.functional.F.scaled_dot_product_attention`
|
||||
- **Compatibility**: Ensured SageAttention works across different transformer versions
|
||||
- **Safer Imports**: Added better error handling for module imports
|
||||
|
||||
### ⚡ Performance Impact
|
||||
- SageAttention now works correctly with 8-bit quantization
|
||||
- Maintains 2-5x performance boost on compatible hardware
|
||||
- Graceful fallback to SDPA when patching fails
|
||||
|
||||
---
|
||||
|
||||
## Version 2.0.2 (2026/02/01)
|
||||
|
||||
🎯 **User Experience & Model Management Update**
|
||||
|
||||
This release focuses on improving user accessibility, model management, and content generation capabilities based on community feedback.
|
||||
|
||||
### 🚀 Enhanced Model Accessibility
|
||||
- **Free Abliterated Models**: Added `Qwen3-4B-abliterated-TIES` and `Qwen3-8B-abliterated-TIES` (nbeerbower) as default options
|
||||
- **No Token Required**: These models provide uncensored performance without Hugging Face authentication
|
||||
- **Smart Model Ordering**: 4B models prioritized before 8B for better VRAM accessibility
|
||||
- **8-Bit Quantization Default**: Optimized VRAM usage for both VL and text models
|
||||
|
||||
**New Default Models:**
|
||||
- **VL**: `Qwen3-VL-4B-Instruct-Abliterated` (8-bit quantized)
|
||||
- **Text**: `Qwen3-4B-abliterated-TIES` (8-bit quantized, no token)
|
||||
|
||||
### 🔧 Improved Custom Prompt Logic
|
||||
- **Template Combination**: Fixed custom prompts to combine with preset templates instead of replacing them
|
||||
- **Consistent Behavior**: All nodes (HF, GGUF, PromptEnhancer) now handle custom prompts identically
|
||||
- **Better UX**: Users can now add their input while keeping preset instructions intact
|
||||
- **WAN 2.2 Compatibility**: Fixed I2V preset to work properly with custom user input
|
||||
|
||||
### 📝 Enhanced NSFW Content Generation
|
||||
- **Comprehensive Descriptions**: Expanded NSFW rules to include detailed sexual act descriptions
|
||||
- **Clear Instructions**: Added "body parts and acts being performed" specification
|
||||
- **Complete Coverage**: Includes blowjob, paizuri, deepthroat, handjob, cunnilingus, anal, missionary, doggystyle, cowgirl, reverse cowgirl, masturbation, fingering, squirting, cumshot, facial
|
||||
- **Applied Universally**: Enhanced both WAN 2.2 I2V and T2V presets
|
||||
|
||||
### 🎬 Preset Priority Optimization
|
||||
- **WAN 2.2 I2V First**: Moved most-used video generation preset to top position
|
||||
- **Better Workflow**: Faster access to primary video generation functionality
|
||||
- **Maintained Order**: Preserved logical organization of remaining presets
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
- **Custom Prompt Override**: Fixed issue where custom prompts completely replaced preset templates
|
||||
- **GGUF Consistency**: Applied same prompt logic fixes to GGUF nodes
|
||||
- **Tooltip Updates**: Updated all custom prompt tooltips to reflect new behavior
|
||||
- **JSON Validation**: Removed duplicate model entries for cleaner configuration
|
||||
|
||||
---
|
||||
|
||||
## Version 2.0.1-enhanced (2026/01/30)
|
||||
|
||||
🚀 **Major Performance & Video Generation Update**
|
||||
|
||||
This enhanced version introduces cutting-edge performance optimizations and comprehensive video generation capabilities, making it the most advanced QwenVL integration available.
|
||||
|
||||
### ⚡ SageAttention Integration
|
||||
- **2-5x Performance Boost**: Added SageAttention support for 8-bit quantized attention computation
|
||||
- **Automatic Detection**: System automatically detects SageAttention availability and GPU compatibility
|
||||
- **Seamless Fallback**: Gracefully falls back to SDPA when SageAttention is unavailable
|
||||
- **Memory Efficiency**: Reduced VRAM usage with quantized attention kernels
|
||||
|
||||
**Requirements:**
|
||||
- NVIDIA GPU with capability >= 8.0 (RTX 30/40/50 series)
|
||||
- CUDA >= 12.0
|
||||
- sageattention package (optional)
|
||||
|
||||
### 🎬 WAN 2.2 Video Generation Integration
|
||||
- **I2V Support**: Image-to-Video generation with cinematic timeline structure
|
||||
- **T2V Support**: Text-to-Video generation with professional scene descriptions
|
||||
- **5-Second Timeline**: Precise second-by-second scene progression
|
||||
- **Multilingual**: Italian/English input to optimized English output
|
||||
- **Cinematic Quality**: Film-style direction including lighting, camera, composition
|
||||
|
||||
**Available Prompts:**
|
||||
- `🍿 Wan 2.2 I2V` - For image-to-video workflows in QwenVL nodes
|
||||
- `🍿 Wan 2.2 T2V` - For text-to-video workflows in Prompt Enhancer nodes
|
||||
|
||||
### 🔧 Enhanced Compatibility
|
||||
- **Transformers Compatibility**: Support for both old (`AutoModelForImageTextToText`) and new (`AutoModelForVision2Seq`) transformer versions
|
||||
- **Attention Mode Selection**: Four modes available - auto, flash_attention_2, sdpa, sageattention
|
||||
- **Custom Model Support**: Extended HF and GGUF model configurations
|
||||
- **Improved Error Handling**: Better diagnostics and fallback mechanisms
|
||||
|
||||
### 📚 Documentation Updates
|
||||
- **SageAttention Section**: Comprehensive installation and troubleshooting guide
|
||||
- **WAN 2.2 Documentation**: Complete usage examples and best practices
|
||||
- **Performance Comparisons**: Detailed benchmarks and requirements tables
|
||||
- **Updated README**: Professional documentation with all new features
|
||||
|
||||
### 🏷️ Manager Integration
|
||||
- **Custom Nodes JSON**: Prepared for ComfyUI Manager submission
|
||||
- **Enhanced Tags**: Added wan2.2, video, i2v, t2v tags for better discoverability
|
||||
- **Updated Metadata**: Comprehensive description highlighting all enhancements
|
||||
|
||||
---
|
||||
|
||||
# Release Notes: v2.0.0 (2025-12-22)
|
||||
|
||||
### New GGUF Nodes
|
||||
|
||||
@@ -0,0 +1,241 @@
|
||||
# ComfyUI-QwenVL-Mod - Enhanced Vision-Language with WAN 2.2
|
||||
|
||||
**Version 2.2.3** (2026/02/27) - 🧠 Advanced Memory Management + Documentation Updates
|
||||
|
||||
---
|
||||
|
||||
## 🌟 What is ComfyUI-QwenVL-Mod?
|
||||
|
||||
A powerful **enhanced vision-language node** for ComfyUI that combines Qwen3-VL models with professional WAN 2.2 video generation workflows. Features multilingual support, visual style detection, and NSFW capabilities for professional AI content creation.
|
||||
|
||||
**Think:** *"Your all-in-one solution for intelligent prompt enhancement and video generation with cutting-edge AI models!"*
|
||||
|
||||
---
|
||||
|
||||
## 🎬 Key Features
|
||||
|
||||
### **🚀 WAN 2.2 Video Generation**
|
||||
- **Text-to-Video (T2V)**: Professional 5-second video generation
|
||||
- **Image-to-Video (I2V)**: Advanced image animation with style detection
|
||||
- **Story Generation**: 20-second continuous videos with 4 narrative segments
|
||||
- **Storyboard Workflows**: Seamless storyboard-to-storyboard generation
|
||||
- **Cinematic Video**: Professional cinematography specifications
|
||||
|
||||
### **🌐 Enhanced Capabilities**
|
||||
- **Multilingual Support**: Process prompts from any language (Italian, English, etc.)
|
||||
- **Visual Style Detection**: 12+ artistic styles (anime, 3D, pixel art, puppet animation, etc.)
|
||||
- **Smart Prompt Caching**: Performance optimization with Fixed Seed Mode
|
||||
- **GGUF Backend**: Efficient local model inference with quantization support
|
||||
- **NSFW Support**: Comprehensive content generation without restrictions
|
||||
|
||||
### **🧠 Intelligent Features**
|
||||
- **Auto-Prompt Enhancement**: Automatically enhance user prompts for optimal generation
|
||||
- **Professional Cinematography**: Built-in specifications for lighting, camera angles, shot types
|
||||
- **Timeline Structure**: Precise 5-second timeline with frame-by-frame descriptions
|
||||
- **Keep Last Prompt**: Generate once, preserve results while changing inputs
|
||||
|
||||
---
|
||||
|
||||
## 🎯 What's New in v2.2.3
|
||||
- **CUDA 13 Compatibility**: Fixed crashes caused by conflicting unload operations
|
||||
- **Parameter Cleanup**: Removed redundant unload_after_run from all nodes
|
||||
- **Bug Fixes**: Resolved "missing required positional argument" errors
|
||||
- **Memory Management**: Streamlined VRAM cleanup with VRAM Cleanup node
|
||||
- **Documentation**: Updated all README files with new memory features
|
||||
- **Credits**: Added community credits for feedback and testing
|
||||
|
||||
## 🎯 What's New in v2.2.2
|
||||
|
||||
### **🚀 Critical T2V/I2V Workflow Fixes**
|
||||
- **Batch Processing**: Fixed critical T2V → GGUF issue with batch images
|
||||
- **Frame Detection**: Added automatic batch detection and individual frame processing
|
||||
- **Video Support**: Enhanced video frame processing with proper shape handling
|
||||
- **Debug Enhanced**: Comprehensive logging for batch processing troubleshooting
|
||||
|
||||
### **🔄 Same Model Reuse Fix**
|
||||
- **Conflict Resolution**: Fixed crash when using same model between T2V and I2V nodes
|
||||
- **Memory Management**: Enhanced cleanup with CUDA synchronization and timing
|
||||
- **Signature Mismatch**: Resolved different signature patterns between nodes
|
||||
- **Aggressive Cleanup**: Forced complete VRAM cleanup before model reload
|
||||
|
||||
### **🔧 keep_model_loaded Enhancement**
|
||||
- **Missing Parameter**: Added keep_model_loaded to PromptEnhancer node
|
||||
- **Consistent Behavior**: Both GGUF and PromptEnhancer now have identical memory management
|
||||
- **Conditional Cleanup**: Proper cleanup based on keep_model_loaded setting
|
||||
- **User Control**: Full control over memory usage vs performance
|
||||
|
||||
---
|
||||
|
||||
## 🎬 WAN 2.2 Story Workflow - Revolutionary AI Storytelling
|
||||
|
||||
### **📖 AI Story Generation**
|
||||
- **4-Segment Videos**: Automatic 20-second videos (4 × 5-second segments)
|
||||
- **Narrative Continuity**: Perfect story flow between segments
|
||||
- **NSFW Support**: Enhanced adult content generation
|
||||
- **Timeline-Free**: Natural storytelling without time markers
|
||||
|
||||
### **🔄 Smart Auto-Split**
|
||||
- **Story Split Node**: Intelligent prompt separation technology
|
||||
- **Auto-Detection**: Handles any separator format automatically
|
||||
- **4-Output Guarantee**: Always produces exactly 4 prompts
|
||||
- **Debug Mode**: Built-in troubleshooting information
|
||||
|
||||
---
|
||||
|
||||
## 📦 Installation
|
||||
|
||||
### **Requirements**
|
||||
- **ComfyUI**: v0.13.0+
|
||||
- **GPU**: 8GB+ VRAM (16GB+ recommended)
|
||||
- **System**: Windows/Linux/Mac
|
||||
- **Python**: 3.10+ (or use provided Docker environment)
|
||||
|
||||
### **Docker/Cloud Ready**
|
||||
- **RunPod**: Pre-configured templates available
|
||||
- **VastAI**: Optimized instances ready
|
||||
- **Local**: Docker support included
|
||||
|
||||
### **Quick Install**
|
||||
1. **Download**: ComfyUI-QwenVL-Mod (latest version)
|
||||
2. **Extract** to `ComfyUI/custom_nodes/ComfyUI-QwenVL-Mod`
|
||||
3. **Restart** ComfyUI
|
||||
4. **Load** included workflows
|
||||
|
||||
---
|
||||
|
||||
## 🎮 Usage Examples
|
||||
|
||||
### **Basic Text-to-Video**
|
||||
1. Load **WAN2.2-I2V-AutoPrompt.json**
|
||||
2. Input your text prompt
|
||||
3. Select model (HF or GGUF)
|
||||
4. Generate enhanced video
|
||||
|
||||
### **Image-to-Video with Style**
|
||||
1. Load **WAN2.2-I2V-AutoPrompt.json**
|
||||
2. Upload your image
|
||||
3. Enable style detection
|
||||
4. Generate animated video
|
||||
|
||||
### **AI Story Generation**
|
||||
1. Load **WAN2.2-I2V-AutoPrompt-Story.json**
|
||||
2. Input your story idea
|
||||
3. Auto-split into 4 segments
|
||||
4. Generate 20-second story video
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Technical Specifications
|
||||
|
||||
### **⚡ Performance**
|
||||
- **Context**: 65,536 tokens (8B models)
|
||||
- **Memory**: Optimized VRAM usage
|
||||
- **Stability**: Crash-free operation
|
||||
- **Speed**: Fast generation times
|
||||
|
||||
### **🎨 Model Support**
|
||||
- **Qwen3-VL 4B**: 7 GGUF variants (2.38GB-4.28GB)
|
||||
- **Qwen3-VL 8B**: 7 GGUF variants (4.8GB-8.71GB)
|
||||
- **HF Models**: Josiefed and official variants
|
||||
- **Quantization**: Q4_K_S, Q5_K_S for VRAM efficiency
|
||||
|
||||
### **🌐 Multilingual Capabilities**
|
||||
- **Input Languages**: Any language supported
|
||||
- **Auto-Translation**: Automatic translation to optimized English
|
||||
- **Style Detection**: Works with multilingual prompts
|
||||
- **Cultural Adaptation**: Context-aware prompt enhancement
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Included Workflows
|
||||
|
||||
### **🍿 WAN 2.2 Presets**
|
||||
- **Wan 2.2 I2V**: Image-to-video with timeline structure
|
||||
- **Wan 2.2 T2V**: Text-to-video with professional specs
|
||||
- **Wan Extended Storyboard**: Multi-segment continuity
|
||||
- **Wan Cinematic Video**: Single scene with cinematography
|
||||
|
||||
### **🔥 Advanced Features**
|
||||
- **NSFW Enhancement**: Uncensored content generation
|
||||
- **Professional Lighting**: 8 light types + 9 qualities
|
||||
- **Camera Control**: 6 shot types + 5 compositions
|
||||
- **Color Grading**: 4 tone options
|
||||
|
||||
---
|
||||
|
||||
## 🎨 Visual Style Detection
|
||||
|
||||
Automatically detects and enhances:
|
||||
- **Anime style** - Japanese animation aesthetics
|
||||
- **3D cartoon** - Computer-generated animation
|
||||
- **Pixel art** - Retro gaming graphics
|
||||
- **Puppet animation** - Stop-motion style
|
||||
- **3D game style** - Video game graphics
|
||||
- **Claymation** - Clay animation
|
||||
- **Watercolor** - Painting style
|
||||
- **Black and white animation** - Monochrome
|
||||
- **Oil painting style** - Classical art
|
||||
- **Felt style** - Textile art
|
||||
- **Tilt-shift photography** - Miniature effect
|
||||
- **Time-lapse photography** - Speed photography
|
||||
|
||||
---
|
||||
|
||||
## 🔥 NSFW Content Support
|
||||
|
||||
### **Enhanced Generation**
|
||||
- **Explicit Content**: Uncensored adult descriptions
|
||||
- **Detailed Scenes**: 8-12 sentences per segment
|
||||
- **Natural Progression**: Smooth story flow
|
||||
- **Style Adaptation**: Automatic visual style matching
|
||||
- **Quality**: Consistent characters & scenes
|
||||
|
||||
### **Professional Applications**
|
||||
- **Adult Content**: Industry-standard generation
|
||||
- **Artistic Nudity**: Classical art styles
|
||||
- **Educational**: Anatomy and artistic study
|
||||
- **Creative**: Artistic expression
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Why Choose ComfyUI-QwenVL-Mod?
|
||||
|
||||
### **🎬 For Content Creators**
|
||||
- **Storytelling**: Create compelling narratives
|
||||
- **Efficiency**: One prompt → complete video
|
||||
- **Quality**: Professional video output
|
||||
- **Flexibility**: Any genre, any style
|
||||
|
||||
### **🔥 For NSFW Content**
|
||||
- **Explicit**: Uncensored generation
|
||||
- **Detailed**: Rich scene descriptions
|
||||
- **Continuous**: Smooth story flow
|
||||
- **Natural**: Realistic progression
|
||||
|
||||
### **⚡ For Power Users**
|
||||
- **Customizable**: Easy to modify
|
||||
- **Extendable**: Add more segments
|
||||
- **Integrable**: Works with existing setups
|
||||
- **Optimized**: Maximum performance
|
||||
|
||||
---
|
||||
|
||||
## 🌟 What Makes This Special?
|
||||
|
||||
- **First**: Complete AI story system with vision enhancement
|
||||
- **Smart**: Intelligent prompt splitting and enhancement
|
||||
- **Complete**: End-to-end solution from text to video
|
||||
- **Optimized**: Performance-tuned for professional use
|
||||
- **Ready**: Works out-of-the-box with included workflows
|
||||
|
||||
---
|
||||
|
||||
## 🎬 Create Amazing AI Videos Today!
|
||||
|
||||
Transform your ideas into stunning videos with the power of Qwen3-VL vision enhancement and WAN 2.2 video generation.
|
||||
|
||||
**Perfect for creators, artists, and professionals looking for the ultimate AI video enhancement tool!** 🌟
|
||||
|
||||
---
|
||||
|
||||
**Built with ❤️ for the ComfyUI community**
|
||||
@@ -0,0 +1,179 @@
|
||||
# ComfyUI - WAN 2.2 I2V/T2V - RTX 4090
|
||||
|
||||
> **[Create an Instance](https://cloud.vast.ai/?ref_id=188688&creator_id=188688&name=ComfyUI%20-%20WAN%202.2%20I2V%2FT2V%20-%20RTX%204090)**
|
||||
|
||||
## What is this template?
|
||||
|
||||
This template gives you a **complete AI video generation environment** optimized for RTX 4090 with ComfyUI running in a Docker container. Features QwenVL-Mod enhanced vision-language capabilities and professional WAN 2.2 video generation workflows.
|
||||
|
||||
**Think:** *"A visual programming environment for AI video generation - connect nodes to build any workflow you can imagine!"*
|
||||
|
||||
---
|
||||
|
||||
## What can I do with this?
|
||||
|
||||
### **🎬 WAN 2.2 Video Generation Workflows**
|
||||
- **Text-to-Video (T2V)**: Generate professional 5-second videos from text prompts
|
||||
- **Image-to-Video (I2V)**: Animate static images with automatic prompt enhancement
|
||||
- **Storyboard Workflows**: Seamless storyboard-to-storyboard generation
|
||||
- **Story Generation**: 4-segment continuous video stories
|
||||
- **Cinematic Video**: Professional cinematography specifications
|
||||
|
||||
### **🌐 QwenVL-Mod Enhanced Features**
|
||||
- **Multilingual Support**: Process prompts from any language with automatic translation
|
||||
- **Visual Style Detection**: 12+ artistic styles (anime, 3D, pixel art, etc.)
|
||||
- **Smart Prompt Caching**: Performance optimization with Fixed Seed Mode
|
||||
- **GGUF Backend**: Efficient local model inference with quantization support
|
||||
- **NSFW Support**: Comprehensive content generation without restrictions
|
||||
|
||||
### **🧠 Smart Prompt System**
|
||||
- **Auto-Prompt Enhancement**: Automatically enhance user prompts for optimal video generation
|
||||
- **Professional Cinematography**: Built-in specifications for lighting, camera angles
|
||||
- **Timeline Structure**: Precise 5-second timeline with frame-by-frame descriptions
|
||||
- **Fixed Seed Mode**: Maintain consistent prompts regardless of media variations
|
||||
|
||||
### **⚡ RTX 4090 Optimized Performance**
|
||||
- **SageAttention + FP16**: Proven optimal for WAN2.2 video generation
|
||||
- **CUDA 12.4 Compatibility**: Maximum stability and performance
|
||||
- **Miniconda Environment**: Python 3.12.12 isolated environment
|
||||
- **Hardware Optimization**: Automatic GPU detection and VRAM management
|
||||
|
||||
---
|
||||
|
||||
## Who is this for?
|
||||
|
||||
This is **perfect** if you:
|
||||
- Want to use **QwenVL-Mod** with enhanced vision-language capabilities
|
||||
- Need **professional WAN 2.2 video generation** with T2V and I2V workflows
|
||||
- Have an **RTX 4090** and want maximum performance optimization
|
||||
- Want **multilingual support** with automatic language detection
|
||||
- Need **visual style detection** for anime, 3D, pixel art styles
|
||||
- Want **Fixed Seed Mode** for consistent prompt generation
|
||||
- Need **NSFW support** for comprehensive content generation
|
||||
- Want **GGUF backend support** for efficient local model inference
|
||||
- Are creating **professional video content** with cinematography specs
|
||||
- Want **hardware-optimized performance** for RTX 4090
|
||||
|
||||
---
|
||||
|
||||
## Quick Start Guide
|
||||
|
||||
### **Step 1: Configure Your Setup**
|
||||
Set your preferred configuration via environment variables:
|
||||
- **`WORKSPACE`**: Custom workspace directory for your models and outputs
|
||||
- **`PROVISIONING_SCRIPT`**: URL to auto-download models on first boot
|
||||
- **`HF_TOKEN`**: Hugging Face token for downloading restricted models
|
||||
- **`CIVITAI_TOKEN`**: CivitAI token for premium model downloads
|
||||
|
||||
> **🎬 Pre-installed QwenVL-Mod Workflows**: Complete WAN 2.2 video generation with auto-prompt enhancement:
|
||||
> - **WAN 2.2 T2V**: Text-to-video with automatic prompt optimization
|
||||
> - **WAN 2.2 I2V**: Image-to-video with style detection and enhancement
|
||||
> - **WAN 2.2 T2V/I2V Story**: 4-segment continuous video stories
|
||||
> - **WAN 2.2 I2V-SVI**: Advanced image-to-video with SVI processing
|
||||
> - **WAN 2.2 T2V/I2V GGUF**: GGUF-optimized versions
|
||||
> - **WAN 2.2 MMAudio**: Audio-enhanced video generation
|
||||
> - **Wan Extended Storyboard**: Seamless storyboard sequences
|
||||
> - **Multilingual Support**: Process prompts from any language
|
||||
> - **Visual Style Detection**: Automatic detection of artistic styles
|
||||
|
||||
### **Step 2: Launch Instance**
|
||||
Click **"[Rent](https://cloud.vast.ai/?ref_id=188688)"** when you've found a suitable RTX 4090 instance
|
||||
|
||||
### **Step 3: Wait for Setup**
|
||||
ComfyUI will be ready automatically with all dependencies installed *(initial model downloads may take additional time)*
|
||||
|
||||
### **Step 4: Access Your Environment**
|
||||
**Easy access:** Click the **"Open"** button for instant access to the ComfyUI interface!
|
||||
|
||||
**Direct access via mapped ports:**
|
||||
- **ComfyUI:** `http://your-instance-ip:8188` (main interface)
|
||||
- **JupyterLab:** `http://your-instance-ip:8888` (terminal access)
|
||||
|
||||
### **Step 5: Start Creating**
|
||||
Load a workflow, download models via ComfyUI-Manager, and start generating!
|
||||
|
||||
---
|
||||
|
||||
## Key Features
|
||||
|
||||
### **ComfyUI-Manager & Pre-installed Nodes**
|
||||
- **One-click model downloads** from CivitAI and Hugging Face
|
||||
- **Custom node installation** from the community repository
|
||||
- **Workflow management** and sharing tools
|
||||
- **Automatic dependency resolution** for custom nodes
|
||||
|
||||
> **🚀 Pre-installed Custom Nodes**: 30+ essential custom nodes for professional video generation:
|
||||
> - **ComfyUI-Manager**: Essential node management system
|
||||
> - **ComfyUI-QwenVL-Mod**: Enhanced vision-language with WAN 2.2 workflows
|
||||
> - **ComfyUI-GGUF**: GGUF model support for efficient inference
|
||||
> - **ComfyUI-VideoHelperSuite**: Video processing utilities
|
||||
> - **ComfyUI-Impact-Pack**: Advanced node functionality
|
||||
> - **ComfyUI_essentials**: Essential utilities and helpers
|
||||
> - **PainterI2V series**: Professional image-to-video workflows
|
||||
> - **ComfyUI-WanMoeKSampler**: WAN model optimization
|
||||
> - **ComfyUI-RIFE-TensorRT-Auto**: Advanced frame interpolation
|
||||
> - **ComfyUI-MMAudio**: Audio processing capabilities
|
||||
> - **ComfyUI-VFI**: Video frame interpolation
|
||||
> - **Plus 20+ additional nodes** for professional workflows
|
||||
|
||||
### **Authentication & Access**
|
||||
| Method | Use Case | Access Point |
|
||||
|--------|----------|--------------|
|
||||
| **Web Interface** | All ComfyUI operations | Click "Open" or port 8188 |
|
||||
| **JupyterLab** | Terminal access & scripting | Port 8888 |
|
||||
| **SSH Terminal** | System administration | [SSH access](https://docs.vast.ai/instances/sshscp) |
|
||||
|
||||
### **Port Reference**
|
||||
| Service | External Port | Internal Port |
|
||||
|---------|---------------|---------------|
|
||||
| ComfyUI | 8188 | 18188 |
|
||||
| JupyterLab | 8888 | 8080 |
|
||||
|
||||
---
|
||||
|
||||
## RTX 4090 Optimizations
|
||||
|
||||
### **Environment Variables Reference**
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `WORKSPACE` | `/workspace` | ComfyUI workspace directory |
|
||||
| `COMFYUI_ARGS` | `--disable-auto-launch --port 18188 --enable-cors-header --fast fp16_accumulation --use-sage-attention --reserve-vram 2 --cuda-malloc --async-offload` | ComfyUI startup arguments optimized for RTX 4090 |
|
||||
| `PROVISIONING_SCRIPT` | (none) | Auto-setup script URL |
|
||||
| `HF_TOKEN` | (none) | Hugging Face token for restricted model downloads |
|
||||
| `CIVITAI_TOKEN` | (none) | CivitAI token for premium model downloads |
|
||||
|
||||
### **Why These Settings?**
|
||||
- **SageAttention + FP16**: Proven optimal for WAN2.2 video generation
|
||||
- **Reserve VRAM 2GB**: Perfect balance for RTX 4090 + WAN2.2
|
||||
- **Conda Isolation**: Prevents dependency conflicts with Python 3.12.12
|
||||
- **CUDA 12.4**: Maximum compatibility and stability for RTX 4090
|
||||
|
||||
### **Recommended GPU Memory**
|
||||
| Use Case | Minimum VRAM | Recommended VRAM |
|
||||
|----------|--------------|------------------|
|
||||
| SD 1.5 / SDXL | 8 GB | 12 GB |
|
||||
| WAN 2.2 Video | 16 GB | 24 GB |
|
||||
| Professional Workflows | 24 GB | 24 GB+ |
|
||||
|
||||
---
|
||||
|
||||
## Need More Help?
|
||||
|
||||
### **Documentation & Resources**
|
||||
- **QwenVL-Mod Documentation:** [GitHub Repository](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
- **ComfyUI Documentation:** [Official Repository](https://github.com/Comfy-Org/ComfyUI)
|
||||
- **ComfyUI-Manager:** [Node and Model Manager](https://github.com/Comfy-Org/ComfyUI-Manager)
|
||||
- **Vast.ai Documentation:** [Instance Portal Guide](https://docs.vast.ai/instance-portal)
|
||||
|
||||
### **Community & Support**
|
||||
- **ComfyUI GitHub:** [Issues & Discussions](https://github.com/Comfy-Org/ComfyUI)
|
||||
- **Vast.ai Support:** Use the messaging icon in the console
|
||||
|
||||
### **Getting Started Resources**
|
||||
- **Example Workflows:** Pre-built WAN 2.2 workflows included
|
||||
- **ComfyUI Examples:** [Community workflow gallery](https://comfyworkflows.com/)
|
||||
- **Custom Nodes:** Thousands available via ComfyUI-Manager
|
||||
|
||||
---
|
||||
|
||||
**Built with ❤️ for the ComfyUI community - Optimized for RTX 4090**
|
||||
@@ -0,0 +1,188 @@
|
||||
# ComfyUI - WAN 2.2 I2V/T2V - RTX 5090 Blackwell
|
||||
|
||||
> **[Create an Instance](https://cloud.vast.ai/?ref_id=188688&creator_id=188688&name=ComfyUI%20-%20WAN%202.2%20I2V%2FT2V%20-%20RTX%205090%20Blackwell)**
|
||||
|
||||
## What is this template?
|
||||
|
||||
This template gives you a **complete AI video generation environment** optimized for RTX 5090 Blackwell with ComfyUI running in a Docker container. Features QwenVL-Mod enhanced vision-language capabilities and professional WAN 2.2 video generation workflows with next-gen GPU acceleration.
|
||||
|
||||
**Think:** *"A visual programming environment for AI video generation with cutting-edge RTX 5090 performance - connect nodes to build any workflow you can imagine!"*
|
||||
|
||||
---
|
||||
|
||||
## What can I do with this?
|
||||
|
||||
### **🎬 WAN 2.2 Video Generation Workflows**
|
||||
- **Text-to-Video (T2V)**: Generate professional 5-second videos from text prompts
|
||||
- **Image-to-Video (I2V)**: Animate static images with automatic prompt enhancement
|
||||
- **Storyboard Workflows**: Seamless storyboard-to-storyboard generation
|
||||
- **Story Generation**: 4-segment continuous video stories
|
||||
- **Cinematic Video**: Professional cinematography specifications
|
||||
|
||||
### **🌐 QwenVL-Mod Enhanced Features**
|
||||
- **Multilingual Support**: Process prompts from any language with automatic translation
|
||||
- **Visual Style Detection**: 12+ artistic styles (anime, 3D, pixel art, etc.)
|
||||
- **Smart Prompt Caching**: Performance optimization with Fixed Seed Mode
|
||||
- **GGUF Backend**: Efficient local model inference with quantization support
|
||||
- **NSFW Support**: Comprehensive content generation without restrictions
|
||||
|
||||
### **🧠 Smart Prompt System**
|
||||
- **Auto-Prompt Enhancement**: Automatically enhance user prompts for optimal video generation
|
||||
- **Professional Cinematography**: Built-in specifications for lighting, camera angles
|
||||
- **Timeline Structure**: Precise 5-second timeline with frame-by-frame descriptions
|
||||
- **Fixed Seed Mode**: Maintain consistent prompts regardless of media variations
|
||||
|
||||
### **⚡ RTX 5090 Blackwell Optimized Performance**
|
||||
- **SageAttention + FP16**: Proven optimal for WAN2.2 video generation
|
||||
- **FP8 Compute Support**: Leverages RTX 5090's hardware FP8 acceleration
|
||||
- **CUDA 12.8 Next-Gen**: Latest optimizations for Blackwell architecture
|
||||
- **Miniconda Environment**: Python 3.12.12 isolated environment
|
||||
- **Hardware Optimization**: Automatic GPU detection and VRAM management
|
||||
|
||||
---
|
||||
|
||||
## Who is this for?
|
||||
|
||||
This is **perfect** if you:
|
||||
- Want to use **QwenVL-Mod** with enhanced vision-language capabilities
|
||||
- Need **professional WAN 2.2 video generation** with T2V and I2V workflows
|
||||
- Have an **RTX 5090 Blackwell** and want cutting-edge performance
|
||||
- Want **FP8 acceleration** for next-gen model inference
|
||||
- Need **multilingual support** with automatic language detection
|
||||
- Want **visual style detection** for anime, 3D, pixel art styles
|
||||
- Need **NSFW support** for comprehensive content generation
|
||||
- Want **GGUF backend support** for efficient local model inference
|
||||
- Are creating **professional video content** with cinematography specs
|
||||
- Want **maximum performance** with RTX 5090 Blackwell optimization
|
||||
|
||||
---
|
||||
|
||||
## Quick Start Guide
|
||||
|
||||
### **Step 1: Configure Your Setup**
|
||||
Set your preferred configuration via environment variables:
|
||||
- **`WORKSPACE`**: Custom workspace directory for your models and outputs
|
||||
- **`PROVISIONING_SCRIPT`**: URL to auto-download models on first boot
|
||||
- **`HF_TOKEN`**: Hugging Face token for downloading restricted models
|
||||
- **`CIVITAI_TOKEN`**: CivitAI token for premium model downloads
|
||||
|
||||
> **🎬 Pre-installed QwenVL-Mod Workflows**: Complete WAN 2.2 video generation with auto-prompt enhancement:
|
||||
> - **WAN 2.2 T2V**: Text-to-video with automatic prompt optimization
|
||||
> - **WAN 2.2 I2V**: Image-to-video with style detection and enhancement
|
||||
> - **WAN 2.2 T2V/I2V Story**: 4-segment continuous video stories
|
||||
> - **WAN 2.2 I2V-SVI**: Advanced image-to-video with SVI processing
|
||||
> - **WAN 2.2 T2V/I2V GGUF**: GGUF-optimized versions
|
||||
> - **WAN 2.2 MMAudio**: Audio-enhanced video generation
|
||||
> - **Wan Extended Storyboard**: Seamless storyboard sequences
|
||||
> - **Multilingual Support**: Process prompts from any language
|
||||
> - **Visual Style Detection**: Automatic detection of artistic styles
|
||||
|
||||
### **Step 2: Launch Instance**
|
||||
Click **"[Rent](https://cloud.vast.ai/?ref_id=188688)"** when you've found a suitable RTX 5090 instance
|
||||
|
||||
### **Step 3: Wait for Setup**
|
||||
ComfyUI will be ready automatically with all dependencies installed *(initial model downloads may take additional time)*
|
||||
|
||||
### **Step 4: Access Your Environment**
|
||||
**Easy access:** Click the **"Open"** button for instant access to the ComfyUI interface!
|
||||
|
||||
**Direct access via mapped ports:**
|
||||
- **ComfyUI:** `http://your-instance-ip:8188` (main interface)
|
||||
- **JupyterLab:** `http://your-instance-ip:8888` (terminal access)
|
||||
|
||||
### **Step 5: Start Creating**
|
||||
Load a workflow, download models via ComfyUI-Manager, and start generating!
|
||||
|
||||
---
|
||||
|
||||
## Key Features
|
||||
|
||||
### **ComfyUI-Manager & Pre-installed Nodes**
|
||||
- **One-click model downloads** from CivitAI and Hugging Face
|
||||
- **Custom node installation** from the community repository
|
||||
- **Workflow management** and sharing tools
|
||||
- **Automatic dependency resolution** for custom nodes
|
||||
|
||||
> **🚀 Pre-installed Custom Nodes**: 30+ essential custom nodes for professional video generation:
|
||||
> - **ComfyUI-Manager**: Essential node management system
|
||||
> - **ComfyUI-QwenVL-Mod**: Enhanced vision-language with WAN 2.2 workflows
|
||||
> - **ComfyUI-GGUF**: GGUF model support for efficient inference
|
||||
> - **ComfyUI-VideoHelperSuite**: Video processing utilities
|
||||
> - **ComfyUI-Impact-Pack**: Advanced node functionality
|
||||
> - **ComfyUI_essentials**: Essential utilities and helpers
|
||||
> - **PainterI2V series**: Professional image-to-video workflows
|
||||
> - **ComfyUI-WanMoeKSampler**: WAN model optimization
|
||||
> - **ComfyUI-RIFE-TensorRT-Auto**: Advanced frame interpolation
|
||||
> - **ComfyUI-MMAudio**: Audio processing capabilities
|
||||
> - **ComfyUI-VFI**: Video frame interpolation
|
||||
> - **Plus 20+ additional nodes** for professional workflows
|
||||
|
||||
### **Authentication & Access**
|
||||
| Method | Use Case | Access Point |
|
||||
|--------|----------|--------------|
|
||||
| **Web Interface** | All ComfyUI operations | Click "Open" or port 8188 |
|
||||
| **JupyterLab** | Terminal access & scripting | Port 8888 |
|
||||
| **SSH Terminal** | System administration | [SSH access](https://docs.vast.ai/instances/sshscp) |
|
||||
|
||||
### **Port Reference**
|
||||
| Service | External Port | Internal Port |
|
||||
|---------|---------------|---------------|
|
||||
| ComfyUI | 8188 | 18188 |
|
||||
| JupyterLab | 8888 | 8080 |
|
||||
|
||||
---
|
||||
|
||||
## RTX 5090 Blackwell Optimizations
|
||||
|
||||
### **Environment Variables Reference**
|
||||
| Variable | Default | Description |
|
||||
|----------|---------|-------------|
|
||||
| `WORKSPACE` | `/workspace` | ComfyUI workspace directory |
|
||||
| `COMFYUI_ARGS` | `--disable-auto-launch --port 18188 --enable-cors-header --fast fp16_accumulation --use-sage-attention --reserve-vram 2 --cuda-malloc --async-offload --supports-fp8-compute` | ComfyUI startup arguments optimized for RTX 5090 |
|
||||
| `PROVISIONING_SCRIPT` | (none) | Auto-setup script URL |
|
||||
| `HF_TOKEN` | (none) | Hugging Face token for restricted model downloads |
|
||||
| `CIVITAI_TOKEN` | (none) | CivitAI token for premium model downloads |
|
||||
|
||||
### **Why These Settings?**
|
||||
- **SageAttention + FP16**: Proven optimal for WAN2.2 video generation
|
||||
- **FP8 Support**: Leverages RTX 5090's hardware FP8 acceleration
|
||||
- **Reserve VRAM 2GB**: Perfect balance for RTX 5090 + WAN2.2
|
||||
- **Conda Isolation**: Prevents dependency conflicts with Python 3.12.12
|
||||
- **CUDA 12.8**: Latest optimizations for Blackwell architecture
|
||||
|
||||
### **RTX 5090 Blackwell Advantages**
|
||||
- **FP8 Compute**: Native hardware acceleration for FP8 models
|
||||
- **Blackwell Architecture**: Next-gen GPU optimizations
|
||||
- **Enhanced Memory Bandwidth**: Faster model loading and inference
|
||||
- **Advanced Tensor Cores**: Optimized for AI workloads
|
||||
|
||||
### **Recommended GPU Memory**
|
||||
| Use Case | Minimum VRAM | Recommended VRAM |
|
||||
|----------|--------------|------------------|
|
||||
| SD 1.5 / SDXL | 8 GB | 12 GB |
|
||||
| WAN 2.2 Video | 16 GB | 24 GB |
|
||||
| FP8 Models | 12 GB | 16 GB |
|
||||
| Professional Workflows | 24 GB | 32 GB+ |
|
||||
|
||||
---
|
||||
|
||||
## Need More Help?
|
||||
|
||||
### **Documentation & Resources**
|
||||
- **QwenVL-Mod Documentation:** [GitHub Repository](https://github.com/huchukato/ComfyUI-QwenVL-Mod)
|
||||
- **ComfyUI Documentation:** [Official Repository](https://github.com/Comfy-Org/ComfyUI)
|
||||
- **ComfyUI-Manager:** [Node and Model Manager](https://github.com/Comfy-Org/ComfyUI-Manager)
|
||||
- **Vast.ai Documentation:** [Instance Portal Guide](https://docs.vast.ai/instance-portal)
|
||||
|
||||
### **Community & Support**
|
||||
- **ComfyUI GitHub:** [Issues & Discussions](https://github.com/Comfy-Org/ComfyUI)
|
||||
- **Vast.ai Support:** Use the messaging icon in the console
|
||||
|
||||
### **Getting Started Resources**
|
||||
- **Example Workflows:** Pre-built WAN 2.2 workflows included
|
||||
- **ComfyUI Examples:** [Community workflow gallery](https://comfyworkflows.com/)
|
||||
- **Custom Nodes**: Thousands available via ComfyUI-Manager
|
||||
|
||||
---
|
||||
|
||||
**Built with ❤️ for the ComfyUI community - Optimized for RTX 5090 Blackwell**
|
||||
@@ -0,0 +1,334 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /venv/main/bin/activate
|
||||
COMFYUI_DIR=${WORKSPACE}/ComfyUI
|
||||
|
||||
APT_PACKAGES=(
|
||||
"nodejs"
|
||||
"npm"
|
||||
)
|
||||
|
||||
PIP_PACKAGES=(
|
||||
"--upgrade --force-reinstall --no-cache-dir https://github.com/JamePeng/llama-cpp-python/releases/download/v0.3.30-cu130-Basic-linux-20260302/llama_cpp_python-0.3.30+cu130.basic-cp312-cp312-linux_x86_64.whl"
|
||||
)
|
||||
|
||||
NODES=(
|
||||
"https://github.com/ltdrdata/ComfyUI-Manager"
|
||||
"https://github.com/kijai/ComfyUI_essentials"
|
||||
"https://github.com/huchukato/comfy-tagcomplete"
|
||||
"https://github.com/huchukato/ComfyUI-QwenVL-Mod"
|
||||
"https://github.com/huchukato/ComfyUI-RIFE-TensorRT-Auto"
|
||||
"https://github.com/huchukato/ComfyUI-Upscaler-TensorRT-Auto"
|
||||
"https://github.com/huchukato/ComfyUI-HuggingFace"
|
||||
"https://github.com/huchukato/ComfyUI-PainterI2Vadvanced"
|
||||
"https://github.com/MoonGoblinDev/Civicomfy"
|
||||
"https://github.com/Koishi-Star/Euler-Smea-Dyn-Sampler"
|
||||
"https://github.com/ltdrdata/was-node-suite-comfyui"
|
||||
"https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite"
|
||||
"https://github.com/rgthree/rgthree-comfy"
|
||||
"https://github.com/yolain/ComfyUI-Easy-Use"
|
||||
"https://github.com/kijai/ComfyUI-KJNodes"
|
||||
"https://github.com/Fannovel16/ComfyUI-Frame-Interpolation"
|
||||
"https://github.com/Smirnov75/ComfyUI-mxToolkit"
|
||||
"https://github.com/princepainter/ComfyUI-PainterI2V"
|
||||
"https://github.com/princepainter/ComfyUI-PainterLongVideo"
|
||||
"https://github.com/ashtar1984/comfyui-find-perfect-resolution"
|
||||
"https://github.com/huchukato/ComfyUI-Selectors"
|
||||
"https://github.com/city96/ComfyUI-GGUF"
|
||||
"https://github.com/kijai/ComfyUI-MMAudio"
|
||||
"https://github.com/GACLove/ComfyUI-VFI"
|
||||
"https://github.com/stduhpf/ComfyUI-WanMoeKSampler"
|
||||
"https://github.com/melMass/comfy_mtb"
|
||||
)
|
||||
|
||||
WORKFLOWS=(
|
||||
"https://github.com/huchukato/ComfyUI-QwenVL-Mod/raw/main/vastai/workflows/PMP-LoRaStack-Upscale-Wildcards.json"
|
||||
"https://github.com/huchukato/ComfyUI-QwenVL-Mod/raw/main/vastai/workflows/WAN2.2-I2V-AutoPrompt.json"
|
||||
"https://github.com/huchukato/ComfyUI-QwenVL-Mod/raw/main/vastai/workflows/WAN2.2-I2V-AutoPrompt-GGUF.json"
|
||||
"https://github.com/huchukato/ComfyUI-QwenVL-Mod/raw/main/vastai/workflows/WAN2.2-I2V-AutoPrompt-Story.json"
|
||||
"https://github.com/huchukato/ComfyUI-QwenVL-Mod/raw/main/vastai/workflows/WAN2.2-I2V-Full-AutoPrompt-MMAudio.json"
|
||||
"https://github.com/huchukato/ComfyUI-QwenVL-Mod/raw/main/vastai/workflows/WAN2.2-I2V-Full-AutoPrompt-MMAudio-GGUF.json"
|
||||
"https://github.com/huchukato/ComfyUI-QwenVL-Mod/raw/main/vastai/workflows/WAN2.2-I2V-SVI-AutoPrompt.json"
|
||||
"https://github.com/huchukato/ComfyUI-QwenVL-Mod/raw/main/vastai/workflows/WAN2.2-I2V-SVI-AutoPrompt-GGUF.json"
|
||||
"https://github.com/huchukato/ComfyUI-QwenVL-Mod/raw/main/vastai/workflows/WAN2.2-I2V-SVI-AutoPrompt-Story.json"
|
||||
"https://github.com/huchukato/ComfyUI-QwenVL-Mod/raw/main/vastai/workflows/WAN2.2-T2V-AutoPrompt.json"
|
||||
"https://github.com/huchukato/ComfyUI-QwenVL-Mod/raw/main/vastai/workflows/WAN2.2-T2V-AutoPrompt-GGUF.json"
|
||||
"https://github.com/huchukato/ComfyUI-QwenVL-Mod/raw/main/vastai/workflows/WAN2.2-T2V-I2V-AutoPrompt-Story.json"
|
||||
"https://github.com/huchukato/ComfyUI-QwenVL-Mod/raw/main/vastai/workflows/WAN2.2-T2V-I2V-Full-AutoPrompt-MMAudio-GGUF.json"
|
||||
)
|
||||
|
||||
CHECKPOINT_MODELS=(
|
||||
)
|
||||
|
||||
UNET_MODELS=(
|
||||
|
||||
)
|
||||
|
||||
LORA_MODELS=(
|
||||
|
||||
)
|
||||
|
||||
VAE_MODELS=(
|
||||
"https://huggingface.co/Comfy-Org/Wan_2.2_ComfyUI_Repackaged/resolve/main/split_files/vae/wan_2.1_vae.safetensors"
|
||||
"https://huggingface.co/Kijai/WanVideo_comfy/resolve/main/Wan2_1_VAE_fp32.safetensors"
|
||||
"https://huggingface.co/huchukato/favs/resolve/main/VAE/sdxl.vae.safetensors"
|
||||
)
|
||||
|
||||
ESRGAN_MODELS=(
|
||||
"https://huggingface.co/huchukato/favs/resolve/main/ESRGAN/2xLexicaRRDBNet.pth"
|
||||
"https://huggingface.co/huchukato/favs/resolve/main/ESRGAN/2xLexicaRRDBNet_Sharp.pth"
|
||||
)
|
||||
|
||||
TEXT_ENCODERS=(
|
||||
"https://huggingface.co/NSFW-API/NSFW-Wan-UMT5-XXL/resolve/main/nsfw_wan_umt5-xxl_fp8_scaled.safetensors"
|
||||
"https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/resolve/main/split_files/text_encoders/umt5_xxl_fp8_e4m3fn_scaled.safetensors"
|
||||
)
|
||||
|
||||
CONTROLNET_MODELS=(
|
||||
)
|
||||
|
||||
### DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING ###
|
||||
|
||||
function provisioning_start() {
|
||||
provisioning_print_header
|
||||
echo "🚀 Starting provisioning process..."
|
||||
|
||||
echo "📦 Installing APT packages..."
|
||||
provisioning_get_apt_packages
|
||||
|
||||
echo "🔧 Installing custom nodes..."
|
||||
provisioning_get_nodes
|
||||
|
||||
echo "🎴 Copying wildcards to Easy-Use..."
|
||||
provisioning_copy_wildcards
|
||||
|
||||
echo "📦 Installing PIP packages..."
|
||||
provisioning_get_pip_packages
|
||||
|
||||
echo "📁 Downloading workflows..."
|
||||
# Create workflows directory
|
||||
mkdir -p "${COMFYUI_DIR}/user/default/workflows"
|
||||
|
||||
provisioning_get_files \
|
||||
"${COMFYUI_DIR}/user/default/workflows" \
|
||||
"${WORKFLOWS[@]}"
|
||||
|
||||
echo "✅ Workflows downloaded to: ${COMFYUI_DIR}/user/default/workflows"
|
||||
|
||||
echo "🎯 Downloading checkpoint models..."
|
||||
provisioning_get_files \
|
||||
"${COMFYUI_DIR}/models/checkpoints" \
|
||||
"${CHECKPOINT_MODELS[@]}"
|
||||
|
||||
echo "🧠 Downloading U-NET models..."
|
||||
provisioning_get_files \
|
||||
"${COMFYUI_DIR}/models/unet" \
|
||||
"${UNET_MODELS[@]}"
|
||||
|
||||
echo "🎨 Downloading LoRA models..."
|
||||
provisioning_get_files \
|
||||
"${COMFYUI_DIR}/models/lora" \
|
||||
"${LORA_MODELS[@]}"
|
||||
|
||||
echo "🎮 Downloading ControlNet models..."
|
||||
provisioning_get_files \
|
||||
"${COMFYUI_DIR}/models/controlnet" \
|
||||
"${CONTROLNET_MODELS[@]}"
|
||||
|
||||
echo "🔮 Downloading VAE models..."
|
||||
provisioning_get_files \
|
||||
"${COMFYUI_DIR}/models/vae" \
|
||||
"${VAE_MODELS[@]}"
|
||||
|
||||
echo "⚡ Downloading upscale models..."
|
||||
provisioning_get_files \
|
||||
"${COMFYUI_DIR}/models/upscale_models" \
|
||||
"${ESRGAN_MODELS[@]}"
|
||||
|
||||
echo "📝 Downloading text encoders..."
|
||||
provisioning_get_files \
|
||||
"${COMFYUI_DIR}/models/text_encoders" \
|
||||
"${TEXT_ENCODERS[@]}"
|
||||
|
||||
provisioning_print_end
|
||||
}
|
||||
|
||||
function provisioning_get_apt_packages() {
|
||||
if [[ -n $APT_PACKAGES ]]; then
|
||||
sudo $APT_INSTALL ${APT_PACKAGES[@]}
|
||||
fi
|
||||
}
|
||||
|
||||
function provisioning_get_pip_packages() {
|
||||
if [[ -n $PIP_PACKAGES ]]; then
|
||||
echo "Installing PIP packages..."
|
||||
for package in "${PIP_PACKAGES[@]}"; do
|
||||
echo "Installing: $package"
|
||||
pip install --root-user-action=ignore --no-cache-dir $package
|
||||
echo "✓ Completed: $package"
|
||||
done
|
||||
echo "All PIP packages installed successfully!"
|
||||
fi
|
||||
}
|
||||
|
||||
function provisioning_get_nodes() {
|
||||
echo "Processing ${#NODES[@]} nodes..."
|
||||
local count=0
|
||||
for repo in "${NODES[@]}"; do
|
||||
((count++))
|
||||
dir="${repo##*/}"
|
||||
path="${COMFYUI_DIR}/custom_nodes/${dir}"
|
||||
requirements="${path}/requirements.txt"
|
||||
|
||||
echo "[$count/${#NODES[@]}] Processing node: $dir"
|
||||
|
||||
if [[ -d $path ]]; then
|
||||
if [[ ${AUTO_UPDATE,,} != "false" ]]; then
|
||||
echo " → Updating existing node..."
|
||||
( cd "$path" && git pull )
|
||||
if [[ -e $requirements ]]; then
|
||||
echo " → Installing requirements..."
|
||||
pip install --root-user-action=ignore --no-cache-dir -r "$requirements"
|
||||
fi
|
||||
else
|
||||
echo " → Node exists, skipping (AUTO_UPDATE=false)"
|
||||
fi
|
||||
else
|
||||
echo " → Downloading new node..."
|
||||
git clone "${repo}" "${path}" --recursive
|
||||
if [[ -e $requirements ]]; then
|
||||
echo " → Installing requirements..."
|
||||
pip install --root-user-action=ignore --no-cache-dir -r "${requirements}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Special handling for ComfyUI-Easy-Use-Frontend
|
||||
if [[ "$dir" == "ComfyUI-Easy-Use" ]]; then
|
||||
echo " → Installing ComfyUI-Easy-Use-Frontend..."
|
||||
cd "${path}"
|
||||
if [[ ! -d "ComfyUI-Easy-Use-Frontend" ]]; then
|
||||
git clone https://github.com/yolain/ComfyUI-Easy-Use-Frontend.git
|
||||
fi
|
||||
cd ComfyUI-Easy-Use-Frontend
|
||||
if [[ ! -d "node_modules" ]]; then
|
||||
echo " → Installing npm dependencies..."
|
||||
npm install
|
||||
fi
|
||||
echo " → Building frontend..."
|
||||
npm run build:dev
|
||||
# Create config.yaml with WEB_VERSION: dev
|
||||
if [[ ! -f "${path}/config.yaml" ]]; then
|
||||
echo "WEB_VERSION: dev" > "${path}/config.yaml"
|
||||
fi
|
||||
cd "${COMFYUI_DIR}"
|
||||
fi
|
||||
done
|
||||
echo "All nodes processed successfully!"
|
||||
}
|
||||
|
||||
function provisioning_copy_wildcards() {
|
||||
echo "Copying wildcards from comfy-tagcomplete to Easy-Use..."
|
||||
|
||||
local source_dir="${COMFYUI_DIR}/custom_nodes/comfy-tagcomplete/wildcards/mbe"
|
||||
local target_dir="${COMFYUI_DIR}/custom_nodes/ComfyUI-Easy-Use/wildcards"
|
||||
|
||||
# Create target directory if it doesn't exist
|
||||
mkdir -p "$target_dir"
|
||||
|
||||
# Copy the entire mbe directory
|
||||
if [[ -d "$source_dir" ]]; then
|
||||
echo " → Copying mbe wildcards..."
|
||||
cp -r "$source_dir" "$target_dir/"
|
||||
echo " ✓ Wildcards copied successfully to $target_dir/mbe"
|
||||
else
|
||||
echo " ⚠ Source directory not found: $source_dir"
|
||||
echo " → Trying alternative path..."
|
||||
# Try alternative path if comfy-tagcomplete is in workspace
|
||||
local alt_source_dir="/workspace/comfy-tagcomplete/wildcards/mbe"
|
||||
if [[ -d "$alt_source_dir" ]]; then
|
||||
echo " → Found at alternative path, copying..."
|
||||
cp -r "$alt_source_dir" "$target_dir/"
|
||||
echo " ✓ Wildcards copied successfully from alternative path"
|
||||
else
|
||||
echo " ⚠ Source directory not found at: $alt_source_dir"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function provisioning_get_files() {
|
||||
if [[ -z $2 ]]; then return 1; fi
|
||||
|
||||
dir="$1"
|
||||
mkdir -p "$dir"
|
||||
shift
|
||||
arr=("$@")
|
||||
echo "Downloading ${#arr[@]} file(s) to $dir..."
|
||||
local count=0
|
||||
for url in "${arr[@]}"; do
|
||||
((count++))
|
||||
echo "[$count/${#arr[@]}] Downloading: $(basename "$url")"
|
||||
provisioning_download "${url}" "${dir}"
|
||||
echo " ✓ Download completed"
|
||||
done
|
||||
echo "All files downloaded successfully!"
|
||||
}
|
||||
|
||||
function provisioning_print_header() {
|
||||
printf "\n##############################################\n# #\n# Provisioning container #\n# #\n# This will take some time #\n# #\n# Your container will be ready on completion #\n# #\n##############################################\n\n"
|
||||
}
|
||||
|
||||
function provisioning_print_end() {
|
||||
printf "\nProvisioning complete: Application will start now\n\n"
|
||||
}
|
||||
|
||||
function provisioning_has_valid_hf_token() {
|
||||
[[ -n "$HF_TOKEN" ]] || return 1
|
||||
url="https://huggingface.co/api/whoami-v2"
|
||||
|
||||
response=$(curl -o /dev/null -s -w "%{http_code}" -X GET "$url" \
|
||||
-H "Authorization: Bearer $HF_TOKEN" \
|
||||
-H "Content-Type: application/json")
|
||||
|
||||
# Check if the token is valid
|
||||
if [ "$response" -eq 200 ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function provisioning_has_valid_civitai_token() {
|
||||
[[ -n "$CIVITAI_TOKEN" ]] || return 1
|
||||
url="https://civitai.com/api/v1/models?hidden=1&limit=1"
|
||||
|
||||
response=$(curl -o /dev/null -s -w "%{http_code}" -X GET "$url" \
|
||||
-H "Authorization: Bearer $CIVITAI_TOKEN" \
|
||||
-H "Content-Type: application/json")
|
||||
|
||||
# Check if the token is valid
|
||||
if [ "$response" -eq 200 ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Download from $1 URL to $2 file path
|
||||
function provisioning_download() {
|
||||
if [[ -n $HF_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\\.)?huggingface\\.co(/|$|\\?) ]]; then
|
||||
auth_token="$HF_TOKEN"
|
||||
elif
|
||||
[[ -n $CIVITAI_TOKEN && $1 =~ ^https://([a-zA-Z0-9_-]+\\.)?civitai\\.com(/|$|\\?) ]]; then
|
||||
auth_token="$CIVITAI_TOKEN"
|
||||
fi
|
||||
if [[ -n $auth_token ]];then
|
||||
wget --header="Authorization: Bearer $auth_token" --content-disposition -e dotbytes="${3:-4M}" -P "$2" "$1"
|
||||
else
|
||||
wget --content-disposition -e dotbytes="${3:-4M}" -P "$2" "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
# Allow user to disable provisioning if they started with a script they didn't want
|
||||
if [[ ! -f /.noprovisioning ]]; then
|
||||
provisioning_start
|
||||
fi
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "ComfyUI - Wan 2.2 I2V/T2V - 5090 Blackwell",
|
||||
"description": "Complete AI video generation environment with ComfyUI, QwenVL-Mod enhanced vision-language capabilities, and WAN 2.2 workflows. Features professional video generation, multilingual support, visual style detection, and pre-installed custom nodes.",
|
||||
"version": "1.0.0",
|
||||
"author": "huchukato",
|
||||
"referral_id": "188688",
|
||||
"creator_id": "188688",
|
||||
"tags": [
|
||||
"comfyui",
|
||||
"wan2.2",
|
||||
"video-generation",
|
||||
"qwenvl-mod",
|
||||
"vision-language",
|
||||
"multilingual",
|
||||
"style-detection",
|
||||
"professional",
|
||||
"5090-blackwell",
|
||||
"rtx-5090"
|
||||
],
|
||||
"features": {
|
||||
"gpu_optimized": true,
|
||||
"pre_installed_nodes": 30,
|
||||
"pre_installed_workflows": 9,
|
||||
"pre_installed_models": true,
|
||||
"multilingual_support": true,
|
||||
"style_detection": true,
|
||||
"nsfw_support": true,
|
||||
"gguf_backend": true
|
||||
},
|
||||
"requirements": {
|
||||
"min_vram": "24GB",
|
||||
"recommended_gpu": "RTX 5090",
|
||||
"cuda_version": "13.0+"
|
||||
},
|
||||
"provisioning": {
|
||||
"script_url": "https://github.com/huchukato/ComfyUI-QwenVL-Mod/raw/main/vastai/provisioning.sh",
|
||||
"supports_tokens": ["HF_TOKEN", "CIVITAI_TOKEN"],
|
||||
"auto_download": true
|
||||
},
|
||||
"links": {
|
||||
"repository": "https://github.com/huchukato/ComfyUI-QwenVL-Mod",
|
||||
"documentation": "https://github.com/huchukato/ComfyUI-QwenVL-Mod/tree/main/vastai",
|
||||
"issues": "https://github.com/huchukato/ComfyUI-QwenVL-Mod/issues"
|
||||
},
|
||||
"environment_variables": {
|
||||
"WORKSPACE": "/workspace",
|
||||
"COMFYUI_ARGS": "--disable-auto-launch --port 18188 --enable-cors-header --fast fp16_accumulation --use-sage-attention --reserve-vram 2 --cuda-malloc --async-offload --supports-fp8-compute --fast cublas_ops autotune",
|
||||
"PROVISIONING_SCRIPT": "https://github.com/huchukato/ComfyUI-QwenVL-Mod/raw/main/vastai/provisioning.sh",
|
||||
"HF_TOKEN": null,
|
||||
"CIVITAI_TOKEN": null,
|
||||
"ENABLE_HTTPS": false
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user