simple_qwen_test.cpp 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #include "model_detector.h"
  2. #include <iostream>
  3. #include <vector>
  4. #include <filesystem>
  5. namespace fs = std::filesystem;
  6. int main() {
  7. std::cout << "🧪 Simple Qwen Detection Test" << std::endl;
  8. std::cout << "============================" << std::endl;
  9. // Test with available Qwen models
  10. std::vector<std::string> qwenModelPaths = {
  11. "/data/SD_MODELS/diffusion_models/Qwen-Image-Edit-2509-Q3_K_S.gguf",
  12. "/data/SD_MODELS/diffusion_models/Qwen-Image-Pruning-13b-Q4_0.gguf",
  13. "/data/SD_MODELS/diffusion_models/qwen-image-Q2_K.gguf"
  14. };
  15. int successCount = 0;
  16. int totalTests = 0;
  17. for (const auto& modelPath : qwenModelPaths) {
  18. if (fs::exists(modelPath)) {
  19. totalTests++;
  20. std::cout << "\n=== Testing: " << fs::path(modelPath).filename().string() << " ===" << std::endl;
  21. try {
  22. ModelDetectionResult result = ModelDetector::detectModel(modelPath);
  23. std::cout << "📋 Detection Results:" << std::endl;
  24. std::cout << " Architecture: " << result.architectureName << std::endl;
  25. std::cout << " Architecture Enum: " << static_cast<int>(result.architecture) << std::endl;
  26. // Check if it's correctly detected as QWEN2VL
  27. bool isCorrectlyDetected = (result.architecture == ModelArchitecture::QWEN2VL);
  28. std::cout << " ✅ Correctly detected as QWEN2VL: " << (isCorrectlyDetected ? "YES" : "NO") << std::endl;
  29. if (isCorrectlyDetected) {
  30. successCount++;
  31. std::cout << " 🎉 SUCCESS!" << std::endl;
  32. } else {
  33. std::cout << " ❌ FAILED: Expected QWEN2VL but got " << result.architectureName << std::endl;
  34. }
  35. // Show some tensor names for verification
  36. std::cout << " 🔍 Sample tensors (first 5):" << std::endl;
  37. int count = 0;
  38. for (const auto& tensorName : result.tensorNames) {
  39. if (count >= 5) break;
  40. std::cout << " " << (count + 1) << ". " << tensorName << std::endl;
  41. count++;
  42. }
  43. } catch (const std::exception& e) {
  44. std::cout << "❌ Error during detection: " << e.what() << std::endl;
  45. }
  46. } else {
  47. std::cout << "\n⚠️ Skipping non-existent model: " << modelPath << std::endl;
  48. }
  49. }
  50. // Summary
  51. std::cout << "\n🎯 Test Summary:" << std::endl;
  52. std::cout << " Total Qwen models tested: " << totalTests << std::endl;
  53. std::cout << " Successfully detected as QWEN2VL: " << successCount << std::endl;
  54. std::cout << " Success rate: " << (totalTests > 0 ? (successCount * 100 / totalTests) : 0) << "%" << std::endl;
  55. if (successCount == totalTests && totalTests > 0) {
  56. std::cout << " 🎉 ALL TESTS PASSED! Qwen detection fix is working correctly." << std::endl;
  57. std::cout << " ✅ Qwen models are no longer misidentified as Stable Diffusion 1.5" << std::endl;
  58. } else if (totalTests > 0) {
  59. std::cout << " ❌ Some tests failed. The fix may need adjustment." << std::endl;
  60. } else {
  61. std::cout << " ⚠️ No Qwen models found to test." << std::endl;
  62. }
  63. std::cout << "\n🏁 Qwen Detection Test Complete!" << std::endl;
  64. return (successCount == totalTests) ? 0 : 1;
  65. }