Alpha-VLLM / Lumina-mGPT

Official Implementation of "Lumina-mGPT: Illuminate Flexible Photorealistic Text-to-Image Generation with Multimodal Generative Pretraining"
https://arxiv.org/abs/2408.02657
460 stars 19 forks source link

3 x Black and White output #11

Open Excidos opened 1 month ago

Excidos commented 1 month ago

So I'm creating a ComfyUI wrapper for Lumina-mGPT, I've got it generating similar to the gradio demo, or almost identically. The Gradio demo produces a single RGB (coloured) image but my ComfyUI wrapper seems to be outputting 3 similar black and white images instead. I've tried everything.

here is my ComfyUI log

vq_config is None. initializing the ChameleonVQConfig with default values. Loading checkpoint shards: 100%|█████████████████████████████████████████████████████████| 2/2 [00:10<00:00, 5.43s/it] transform: {'<|image|>': <bound method FlexARItemProcessor.process_image of <data.item_processor.FlexARItemProcessor object at 0x000002229D0E8690>>} media_symbols: ['<|image|>'] load HF transformers tokenizer from Alpha-VLLM/Lumina-mGPT-7B-768

words: 65536 - BOS ID: 0 - EOS ID: 2

List of crop sizes: 1024 x 256 992 x 256 960 x 256 928 x 256 896 x 256 896 x 288 864 x 288 832 x 288 800 x 288 800 x 320 768 x 320 736 x 320 736 x 352 704 x 352 672 x 352 672 x 384 640 x 384 608 x 384 608 x 416 576 x 416 576 x 448 544 x 448 544 x 480 512 x 480 512 x 512 480 x 512 480 x 544 448 x 544 448 x 576 416 x 576 416 x 608 384 x 608 384 x 640 384 x 672 352 x 672 352 x 704 352 x 736 320 x 736 320 x 768 320 x 800 288 x 800 288 x 832 288 x 864 288 x 896 256 x 896 256 x 928 256 x 960 256 x 992 256 x 1024 VQModel loaded from K:\AI-Art\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI-Lumina-mGPT Wrapper\Lumina-mGPT\lumina_mgpt\ckpts\chameleon\tokenizer\vqgan.ckpt Successfully loaded model from K:\AI-Art\ComfyUI_windows_portable\ComfyUI\models\lumina_mgpt\Lumina-mGPT-7B-512 Generating with prompt: Generate an image of 512x512 according to the following prompt: photograph, landscape of a Mythical Grotto from inside of a Harare, at Twilight, Depressing, Cloudpunk, Cold Lighting, dynamic, Nikon d850, Depth of field 270mm, Amaro, Golden ratio, overlooking a futuristic sci-fi city, 4k Starting generation process tensor([87], device='cuda:0') h_latent_dim: 32, w_latent_dim: 32 new line: 33 new line: 66 new line: 99 new line: 132 new line: 165 new line: 198 new line: 231 new line: 264 new line: 297 new line: 330 new line: 363 new line: 396 new line: 429 new line: 462 new line: 495 new line: 528 new line: 561 new line: 594 new line: 627 new line: 660 new line: 693 new line: 726 new line: 759 new line: 792 new line: 825 new line: 858 new line: 891 new line: 924 new line: 957 new line: 990 new line: 1023 new line: 1056 eos image: 1057 Raw generation result: [8197, 8820, 8820, 790, 6526, 7036, 3212, 3072, 1670, 5599, 5130, 2808, 3168, 3278, 2290, 4764, 4949, 5708, 4484, 5946, 3867, 957, 185, 1996, 628, 6119, 974, 5274, 5556, 3543, 6305, 5274, 3033, 376, 6669, 8803, 520, 7078, 7851, 2101, 7174, 237, 7307, 4495, 4239, 1198, 5766, 6534, 6939, 2394, 6971, 3204, 2126, 8015, 4709, 754, 337, 4492, 3605, 959, 4400, 6094, 4714, 3237, 1858, 6045, 5611, 6853, 8803, 4691, 7140, 3119, 2589, 6203, 6495, 5878, 6275, 7001, 8140, 7182, 6111, 6971, 7953, 1006, 3777, 3492, 5307, 4469, 2454, 5291, 3643, 1213, 3644, 3189, 363, 3156, 1647, 4462, 808, 7529, 990, 8803, 2443, 7011, 5729, 7307, 7192, 7162, 4927, 2205, 7182, 4695, 6971, 3175, 5349, 3614, 259, 186, 1883, 6410, 1215, 645, 275, 3596, 3543, 2966, 3048, 6380, 3596, 4038, 6004, 7839, 2330, 506, 8803, 7503, 4234, 2927, 2187, 4754, 4989, 2545, 4327, 5227, 1174, 6377, 269, 5934, 5124, 6607, 5307, 7893, 3005, 2050, 3666, 6468, 4912, 7803, 1541, 3320, 5198, 7368, 5556, 5519, 3967, 6357, 6177, 8803, 2468, 5059, 7183, 2118, 997, 6860, 224, 6308, 7778, 1557, 1901, 5893, 7351, 285, 4038, 7714, 4492, 488, 1712, 3345, 3345, 2182, 3706, 3645, 318, 4659, 6418, 2268, 8147, 5887, 5619, 302, 8803, 2873, 1707, 7878, 3582, 1018, 7553, 728, 7339, 1996, 6709, 6750, 4283, 3412, 5192, 7372, 1643, 863, 4384, 6557, 693, 7154, 2541, 7360, 7120, 6725, 1923, 4128, 4149, 7905, 5120, 1944, 2545, 8803, 213, 3387, 7406, 5891, 903, 6510, 5957, 1996, 6709, 798, 5588, 4476, 5757, 1595, 1430, 5478, 3320, 2380, 4207, 1272, 5556, 6634, 1745, 1635, 4251, 2389, 4300, 4536, 6383, 2852, 2918, 813, 8803, 5198, 4485, 2827, 4649, 5723, 6599, 2691, 2035, 2384, 6286, 2284, 2095, 1415, 560, 5062, 3969, 3313, 6874, 2024, 4117, 7437, 4006, 4731, 7748, 6315, 3904, 8027, 5103, 7524, 7312, 355, 3342, 8803, 6585, 5564, 2545, 4420, 4784, 3358, 5419, 789, 5202, 5911, 6754, 5421, 614, 1820, 2007, 7058, 3427, 5108, 6509, 3991, 2317, 1648, 6800, 6836, 7200, 4468, 2456, 2206, 1886, 3772, 1886, 1293, 8803, 6039, 1084, 6715, 2979, 1980, 5934, 2192, 2184, 3582, 2390, 535, 4953, 2273, 827, 6440, 3189, 5034, 412, 5198, 7375, 6420, 2672, 4585, 4134, 362, 725, 3929, 4863, 7603, 2125, 238, 467, 8803, 947, 4298, 7436, 4244, 3188, 7803, 2674, 1404, 5692, 2064, 7296, 2221, 925, 4419, 2790, 87, 1584, 567, 2881, 816, 4177, 4859, 80, 6114, 6890, 334, 1276, 2010, 7110, 7954, 142, 137, 8803, 7550, 5059, 6308, 5829, 4392, 3487, 5851, 4928, 4300, 5906, 4120, 7880, 1028, 5683, 4565, 4565, 6710, 614, 3230, 2593, 4628, 7176, 4762, 1948, 1876, 2900, 1996, 3527, 7622, 1426, 973, 1018, 8803, 4420, 2585, 1371, 1420, 1208, 2802, 4804, 1703, 6532, 5275, 4051, 266, 270, 466, 8177, 6346, 1660, 529, 4276, 6207, 6091, 7108, 6851, 2897, 4502, 4478, 1371, 4784, 903, 434, 448, 1371, 8803, 3276, 5465, 2691, 3996, 2865, 610, 1202, 3650, 6962, 7668, 7778, 2153, 4207, 3847, 7287, 4159, 942, 587, 5500, 8045, 7592, 7519, 1240, 1558, 6918, 5691, 4676, 1923, 5887, 5525, 921, 5652, 8803, 2961, 1459, 3313, 7667, 7526, 3762, 1088, 5378, 1306, 4117, 765, 7044, 1613, 1154, 1678, 7875, 3707, 2982, 7519, 2047, 3444, 1204, 675, 1306, 7935, 1526, 6709, 4475, 7201, 3020, 2845, 1154, 8803, 6415, 536, 1645, 1238, 3762, 3650, 5034, 1279, 7783, 5779, 1275, 486, 712, 4529, 4811, 7684, 7406, 4602, 6939, 2547, 2047, 4120, 3666, 805, 2454, 2443, 6468, 4488, 6715, 5547, 362, 7536, 8803, 3204, 2965, 7714, 6937, 5274, 1343, 1278, 2482, 4503, 2287, 5483, 5217, 7347, 7368, 2443, 6869, 2852, 5559, 6468, 3743, 2443, 689, 4407, 8140, 7752, 1278, 7783, 3767, 6487, 2993, 5723, 6874, 8803, 4238, 4085, 2228, 4008, 5367, 3666, 4818, 6440, 2036, 3666, 3812, 2765, 588, 40, 2371, 5034, 2268, 6345, 161, 4462, 2380, 1093, 480, 6775, 5483, 1209, 5662, 6309, 548, 1908, 2516, 8027, 8803, 527, 6548, 4029, 5556, 1557, 6004, 2126, 4016, 3033, 1351, 6948, 7206, 7412, 2171, 8165, 3651, 4673, 10, 7101, 536, 1578, 7990, 8113, 1278, 5394, 3208, 4124, 361, 3062, 2537, 1174, 4192, 8803, 903, 2123, 1579, 7339, 1910, 3775, 1641, 1463, 2547, 3690, 3348, 3000, 5496, 4964, 1340, 5766, 689, 318, 963, 2209, 2004, 3172, 4440, 4462, 5932, 3559, 813, 7360, 6906, 7631, 776, 675, 8803, 1018, 2720, 7022, 161, 1112, 6331, 1199, 2743, 2885, 519, 8147, 2823, 743, 905, 4714, 4254, 2691, 1787, 714, 6203, 2643, 3168, 6045, 3812, 8113, 1265, 2317, 3580, 348, 2546, 4163, 4927, 8803, 7332, 4117, 7591, 7032, 346, 3242, 6762, 2784, 2998, 3984, 2225, 2270, 729, 1285, 3083, 5683, 3847, 5605, 4479, 3320, 3348, 1185, 7863, 2460, 943, 3131, 334, 6041, 2307, 7752, 7971, 5737, 8803, 1067, 2604, 3750, 5453, 6094, 4599, 3812, 5365, 4707, 3276, 5271, 8021, 5402, 1337, 2365, 1415, 24, 6440, 6539, 2047, 4251, 3276, 5588, 270, 944, 4407, 714, 2560, 529, 7990, 1743, 5683, 8803, 3464, 2788, 5026, 6407, 467, 2268, 6315, 1426, 3775, 7174, 5196, 5796, 4317, 1022, 4659, 5104, 1517, 4784, 1265, 4599, 6119, 4818, 7569, 3859, 1526, 1062, 7937, 5589, 1440, 4599, 6238, 7595, 8803, 5465, 5724, 1504, 2634, 5058, 4676, 2743, 1112, 2676, 1557, 8102, 1332, 4615, 5745, 1385, 1745, 7992, 750, 6237, 4207, 4676, 5410, 4197, 5834, 7077, 6314, 5683, 2336, 2976, 7956, 6768, 3777, 8803, 3062, 5525, 1018, 1203, 434, 7855, 4123, 7054, 10, 326, 7201, 2546, 729, 7384, 4124, 7991, 7905, 6510, 6238, 4496, 4530, 2523, 7612, 827, 1657, 6801, 566, 804, 4280, 4446, 2016, 3212, 8803, 5725, 219, 3582, 6090, 1110, 6861, 228, 7249, 3214, 6091, 6577, 8092, 712, 3769, 5171, 7303, 4472, 4859, 2900, 2501, 2209, 198, 2215, 4661, 1062, 6315, 5906, 4238, 1791, 7031, 5729, 2365, 8803, 3580, 4244, 1645, 3086, 3891, 2765, 1157, 1923, 6004, 651, 50, 1154, 2827, 3168, 3158, 3637, 6111, 3596, 3033, 6495, 4582, 7412, 2224, 3564, 2835, 611, 4280, 3168, 5375, 3648, 2016, 5846, 8803, 2066, 1304, 7359, 4937, 3025, 1825, 1904, 6068, 7974, 7705, 4401, 2348, 2895, 2036, 3410, 588, 1264, 7154, 2112, 4315, 3622, 6971, 4071, 7991, 2961, 7764, 3843, 3083, 3418, 905, 5062, 3485, 8803, 7645, 6869, 4269, 3770, 4009, 6939, 269, 2560, 7009, 728, 1900, 4277, 1371, 2541, 1712, 2490, 4440, 2540, 7299, 5556, 4008, 1635, 488, 685, 1782, 5775, 3622, 3276, 2895, 6390, 6962, 4484, 8803, 7604, 3175, 1595, 6039, 191, 956, 467, 2941, 4134, 7709, 2205, 5518, 4625, 1343, 3158, 2914, 2277, 2914, 863, 5605, 4192, 536, 4502, 2237, 5759, 237, 4789, 3712, 5390, 159, 5535, 2551, 8803, 8196, 8710] Processed generation result: [8197, 8820, 8820, 790, 6526, 7036, 3212, 3072, 1670, 5599, 5130, 2808, 3168, 3278, 2290, 4764, 4949, 5708, 4484, 5946, 3867, 957, 185, 1996, 628, 6119, 974, 5274, 5556, 3543, 6305, 5274, 3033, 376, 6669, 8803, 520, 7078, 7851, 2101, 7174, 237, 7307, 4495, 4239, 1198, 5766, 6534, 6939, 2394, 6971, 3204, 2126, 8015, 4709, 754, 337, 4492, 3605, 959, 4400, 6094, 4714, 3237, 1858, 6045, 5611, 6853, 8803, 4691, 7140, 3119, 2589, 6203, 6495, 5878, 6275, 7001, 8140, 7182, 6111, 6971, 7953, 1006, 3777, 3492, 5307, 4469, 2454, 5291, 3643, 1213, 3644, 3189, 363, 3156, 1647, 4462, 808, 7529, 990, 8803, 2443, 7011, 5729, 7307, 7192, 7162, 4927, 2205, 7182, 4695, 6971, 3175, 5349, 3614, 259, 186, 1883, 6410, 1215, 645, 275, 3596, 3543, 2966, 3048, 6380, 3596, 4038, 6004, 7839, 2330, 506, 8803, 7503, 4234, 2927, 2187, 4754, 4989, 2545, 4327, 5227, 1174, 6377, 269, 5934, 5124, 6607, 5307, 7893, 3005, 2050, 3666, 6468, 4912, 7803, 1541, 3320, 5198, 7368, 5556, 5519, 3967, 6357, 6177, 8803, 2468, 5059, 7183, 2118, 997, 6860, 224, 6308, 7778, 1557, 1901, 5893, 7351, 285, 4038, 7714, 4492, 488, 1712, 3345, 3345, 2182, 3706, 3645, 318, 4659, 6418, 2268, 8147, 5887, 5619, 302, 8803, 2873, 1707, 7878, 3582, 1018, 7553, 728, 7339, 1996, 6709, 6750, 4283, 3412, 5192, 7372, 1643, 863, 4384, 6557, 693, 7154, 2541, 7360, 7120, 6725, 1923, 4128, 4149, 7905, 5120, 1944, 2545, 8803, 213, 3387, 7406, 5891, 903, 6510, 5957, 1996, 6709, 798, 5588, 4476, 5757, 1595, 1430, 5478, 3320, 2380, 4207, 1272, 5556, 6634, 1745, 1635, 4251, 2389, 4300, 4536, 6383, 2852, 2918, 813, 8803, 5198, 4485, 2827, 4649, 5723, 6599, 2691, 2035, 2384, 6286, 2284, 2095, 1415, 560, 5062, 3969, 3313, 6874, 2024, 4117, 7437, 4006, 4731, 7748, 6315, 3904, 8027, 5103, 7524, 7312, 355, 3342, 8803, 6585, 5564, 2545, 4420, 4784, 3358, 5419, 789, 5202, 5911, 6754, 5421, 614, 1820, 2007, 7058, 3427, 5108, 6509, 3991, 2317, 1648, 6800, 6836, 7200, 4468, 2456, 2206, 1886, 3772, 1886, 1293, 8803, 6039, 1084, 6715, 2979, 1980, 5934, 2192, 2184, 3582, 2390, 535, 4953, 2273, 827, 6440, 3189, 5034, 412, 5198, 7375, 6420, 2672, 4585, 4134, 362, 725, 3929, 4863, 7603, 2125, 238, 467, 8803, 947, 4298, 7436, 4244, 3188, 7803, 2674, 1404, 5692, 2064, 7296, 2221, 925, 4419, 2790, 87, 1584, 567, 2881, 816, 4177, 4859, 80, 6114, 6890, 334, 1276, 2010, 7110, 7954, 142, 137, 8803, 7550, 5059, 6308, 5829, 4392, 3487, 5851, 4928, 4300, 5906, 4120, 7880, 1028, 5683, 4565, 4565, 6710, 614, 3230, 2593, 4628, 7176, 4762, 1948, 1876, 2900, 1996, 3527, 7622, 1426, 973, 1018, 8803, 4420, 2585, 1371, 1420, 1208, 2802, 4804, 1703, 6532, 5275, 4051, 266, 270, 466, 8177, 6346, 1660, 529, 4276, 6207, 6091, 7108, 6851, 2897, 4502, 4478, 1371, 4784, 903, 434, 448, 1371, 8803, 3276, 5465, 2691, 3996, 2865, 610, 1202, 3650, 6962, 7668, 7778, 2153, 4207, 3847, 7287, 4159, 942, 587, 5500, 8045, 7592, 7519, 1240, 1558, 6918, 5691, 4676, 1923, 5887, 5525, 921, 5652, 8803, 2961, 1459, 3313, 7667, 7526, 3762, 1088, 5378, 1306, 4117, 765, 7044, 1613, 1154, 1678, 7875, 3707, 2982, 7519, 2047, 3444, 1204, 675, 1306, 7935, 1526, 6709, 4475, 7201, 3020, 2845, 1154, 8803, 6415, 536, 1645, 1238, 3762, 3650, 5034, 1279, 7783, 5779, 1275, 486, 712, 4529, 4811, 7684, 7406, 4602, 6939, 2547, 2047, 4120, 3666, 805, 2454, 2443, 6468, 4488, 6715, 5547, 362, 7536, 8803, 3204, 2965, 7714, 6937, 5274, 1343, 1278, 2482, 4503, 2287, 5483, 5217, 7347, 7368, 2443, 6869, 2852, 5559, 6468, 3743, 2443, 689, 4407, 8140, 7752, 1278, 7783, 3767, 6487, 2993, 5723, 6874, 8803, 4238, 4085, 2228, 4008, 5367, 3666, 4818, 6440, 2036, 3666, 3812, 2765, 588, 40, 2371, 5034, 2268, 6345, 161, 4462, 2380, 1093, 480, 6775, 5483, 1209, 5662, 6309, 548, 1908, 2516, 8027, 8803, 527, 6548, 4029, 5556, 1557, 6004, 2126, 4016, 3033, 1351, 6948, 7206, 7412, 2171, 8165, 3651, 4673, 10, 7101, 536, 1578, 7990, 8113, 1278, 5394, 3208, 4124, 361, 3062, 2537, 1174, 4192, 8803, 903, 2123, 1579, 7339, 1910, 3775, 1641, 1463, 2547, 3690, 3348, 3000, 5496, 4964, 1340, 5766, 689, 318, 963, 2209, 2004, 3172, 4440, 4462, 5932, 3559, 813, 7360, 6906, 7631, 776, 675, 8803, 1018, 2720, 7022, 161, 1112, 6331, 1199, 2743, 2885, 519, 8147, 2823, 743, 905, 4714, 4254, 2691, 1787, 714, 6203, 2643, 3168, 6045, 3812, 8113, 1265, 2317, 3580, 348, 2546, 4163, 4927, 8803, 7332, 4117, 7591, 7032, 346, 3242, 6762, 2784, 2998, 3984, 2225, 2270, 729, 1285, 3083, 5683, 3847, 5605, 4479, 3320, 3348, 1185, 7863, 2460, 943, 3131, 334, 6041, 2307, 7752, 7971, 5737, 8803, 1067, 2604, 3750, 5453, 6094, 4599, 3812, 5365, 4707, 3276, 5271, 8021, 5402, 1337, 2365, 1415, 24, 6440, 6539, 2047, 4251, 3276, 5588, 270, 944, 4407, 714, 2560, 529, 7990, 1743, 5683, 8803, 3464, 2788, 5026, 6407, 467, 2268, 6315, 1426, 3775, 7174, 5196, 5796, 4317, 1022, 4659, 5104, 1517, 4784, 1265, 4599, 6119, 4818, 7569, 3859, 1526, 1062, 7937, 5589, 1440, 4599, 6238, 7595, 8803, 5465, 5724, 1504, 2634, 5058, 4676, 2743, 1112, 2676, 1557, 8102, 1332, 4615, 5745, 1385, 1745, 7992, 750, 6237, 4207, 4676, 5410, 4197, 5834, 7077, 6314, 5683, 2336, 2976, 7956, 6768, 3777, 8803, 3062, 5525, 1018, 1203, 434, 7855, 4123, 7054, 10, 326, 7201, 2546, 729, 7384, 4124, 7991, 7905, 6510, 6238, 4496, 4530, 2523, 7612, 827, 1657, 6801, 566, 804, 4280, 4446, 2016, 3212, 8803, 5725, 219, 3582, 6090, 1110, 6861, 228, 7249, 3214, 6091, 6577, 8092, 712, 3769, 5171, 7303, 4472, 4859, 2900, 2501, 2209, 198, 2215, 4661, 1062, 6315, 5906, 4238, 1791, 7031, 5729, 2365, 8803, 3580, 4244, 1645, 3086, 3891, 2765, 1157, 1923, 6004, 651, 50, 1154, 2827, 3168, 3158, 3637, 6111, 3596, 3033, 6495, 4582, 7412, 2224, 3564, 2835, 611, 4280, 3168, 5375, 3648, 2016, 5846, 8803, 2066, 1304, 7359, 4937, 3025, 1825, 1904, 6068, 7974, 7705, 4401, 2348, 2895, 2036, 3410, 588, 1264, 7154, 2112, 4315, 3622, 6971, 4071, 7991, 2961, 7764, 3843, 3083, 3418, 905, 5062, 3485, 8803, 7645, 6869, 4269, 3770, 4009, 6939, 269, 2560, 7009, 728, 1900, 4277, 1371, 2541, 1712, 2490, 4440, 2540, 7299, 5556, 4008, 1635, 488, 685, 1782, 5775, 3622, 3276, 2895, 6390, 6962, 4484, 8803, 7604, 3175, 1595, 6039, 191, 956, 467, 2941, 4134, 7709, 2205, 5518, 4625, 1343, 3158, 2914, 2277, 2914, 863, 5605, 4192, 536, 4502, 2237, 5759, 237, 4789, 3712, 5390, 159, 5535, 2551, 8803, 8196] Decoding image from tokens: [8820, 8820, 790, 6526, 7036, 3212, 3072, 1670, 5599, 5130]... Decoding image from tokens: [8820, 8820, 790, 6526, 7036, 3212, 3072, 1670, 5599, 5130]... Decoded image size: (512, 512), mode: RGB Generated image count: 1 First generated image size: (512, 512), mode: RGB Generation result type: <class 'list'>, content: [<PIL.Image.Image image mode=RGB size=512x512 at 0x222AC818850>] Processed image tensor shape: torch.Size([3, 512, 512]), dtype: torch.float32 Prompt executed in 158.32 seconds

and my node generation def

def generate(self, lumina_mgpt_model, prompt, resolution, cfg, seed, image_top_k, temperature):
    try:
        # Parse resolution string
        width, height = map(int, resolution.split('x'))

        if seed == 0:
            seed = torch.randint(0, 2**32 - 1, (1,)).item()
        torch.manual_seed(seed)

        logits_processor = lumina_mgpt_model.create_logits_processor(cfg=cfg, text_top_k=5, image_top_k=image_top_k)

        full_prompt = f"Generate an image of {resolution} according to the following prompt:\n{prompt}"
        logger.info(f"Generating with prompt: {full_prompt}")

        generated_text, generated_images = lumina_mgpt_model.generate(
            images=[],
            qas=[[full_prompt, None]],
            max_gen_len=5000,
            temperature=temperature,
            logits_processor=logits_processor,
        )
        logger.info(f"Generation result type: {type(generated_images)}, content: {generated_images}")

        if not generated_images:
            logger.warning("No image was generated. Returning a blank image.")
            blank_image = Image.new('RGB', (width, height), color='white')
            img_np = np.array(blank_image).astype(np.float32) / 255.0
            return (torch.from_numpy(img_np).permute(2, 0, 1),)

        # Take the first generated image
        generated_image = generated_images[0]

        # Ensure the image is in RGB mode
        if generated_image.mode != 'RGB':
            logger.warning(f"Image mode is {generated_image.mode}, converting to RGB.")
            generated_image = generated_image.convert('RGB')

        # Resize the image if necessary
        generated_image = generated_image.resize((width, height), Image.LANCZOS)

        # Convert to numpy array and normalize
        img_np = np.array(generated_image).astype(np.float32) / 255.0

        # Convert to PyTorch tensor
        new_image_tensor = torch.from_numpy(img_np).permute(2, 0, 1)

        logger.info(f"Processed image tensor shape: {new_image_tensor.shape}, dtype: {new_image_tensor.dtype}")

        return (new_image_tensor,)

    except Exception as e:
        logger.error(f"Error in generate method: {str(e)}")
        logger.error(traceback.format_exc())
        raise  # Re-raise the exception to stop the process and show the error
ChrisLiu6 commented 1 month ago

Sorry I'm not familiar with ComfyUI.

Could you please check the following position in your code:

        ...

        # Take the first generated image
        generated_image = generated_images[0]

        ...

to see if the 'generated_image` variable is the colored PIL image that you want? If yes, then the problem should be with the following post-processing operations (which I don't know why they should exist, guess maybe required by ComfyUI?)

Excidos commented 1 month ago

All good got the wrapper for ComfyUI working and will upload now, thank you though :)

Excidos commented 1 month ago

I managed to get my wrapper fully functioning, the 512 model works great but the 768 is struggling on my 4090. Do you know if it would be possible to quantise the model somehow?

https://github.com/Excidos/ComfyUI-Lumina-mGPT-Wrapper.git

ChrisLiu6 commented 1 month ago

I managed to get my wrapper fully functioning, the 512 model works great but the 768 is struggling on my 4090. Do you know if it would be possible to quantise the model somehow?

https://github.com/Excidos/ComfyUI-Lumina-mGPT-Wrapper.git

Thank you for your suggestion. We have made internal arrangements, and quantization support should come very soon.

Excidos commented 1 month ago

I managed to get my wrapper fully functioning, the 512 model works great but the 768 is struggling on my 4090. Do you know if it would be possible to quantise the model somehow? https://github.com/Excidos/ComfyUI-Lumina-mGPT-Wrapper.git

Thank you for your suggestion. We have made internal arrangements, and quantization support should come very soon.

Awesome that is great to hear, want to get the 1024 working on a more consumer friendly basis :). Will keep a keen eye out.

and sorry one last question, does Lumina-mGPT support FP8 precision, I would like to try get this working similar in the way flux has recently been able to be used more widely due to these inference capabilities. If you could point me in the right direction to how this might be possible, that would be amazing :)