-
Notifications
You must be signed in to change notification settings - Fork 191
feat : Add Support of Qwen2.5Omni model (without talker) #610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
47833b1
[Codex] After prompt #0
KKkai0315 bcf23b9
feat:add Qwen2.5omni text modal processing
KKkai0315 c573c0a
add qwen2.5omni vision, audio modal
KKkai0315 b6ca34c
fix: Enhance quantization modules. Introduced FixedActivationQDQ for …
chenghuaWang 3f5733f
fix: Suppress deprecated comma-subscript warnings in CMake and remove…
chenghuaWang 86e30f5
feat(qualcomm): Add installation targets for flatbuffers and MllmQNNB…
chenghuaWang 67c71df
feat(qualcomm): Refactor Qwen3 model to integrate ConcatObserver for …
chenghuaWang 0f2005b
feat(cpu): Implement fill operations for various data types including…
chenghuaWang 3cd68aa
feat(qnn): Enhance QNNBackend initialization with improved logging an…
chenghuaWang 5cd3f8d
feat(qnn): Update quantization handling and embedding output data typ…
chenghuaWang 7bad302
feat(qwen3): Integrate QEmbedding for quantized embeddings and refine…
chenghuaWang 3ce2654
remove src code
KKkai0315 9b1c12a
fix
KKkai0315 1ad47e6
fix
KKkai0315 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ tasks/mllmteam* | |
| build*/ | ||
| install*/ | ||
| mllm-sdk-*/ | ||
| mllm-install-*/ | ||
|
|
||
| # Pymllm related | ||
| stubs/ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| add_executable(mllm-qwen2_5-omni-text-runner text_infer.cpp) | ||
| target_link_libraries(mllm-qwen2_5-omni-text-runner PRIVATE MllmRT MllmCPUBackend) | ||
| target_include_directories(mllm-qwen2_5-omni-text-runner PRIVATE ${MLLM_INCLUDE_DIR}) | ||
|
|
||
| add_executable(mllm-qwen2_5-omni-image-runner image_infer.cpp) | ||
| target_link_libraries(mllm-qwen2_5-omni-image-runner PRIVATE MllmRT MllmCPUBackend) | ||
| target_include_directories(mllm-qwen2_5-omni-image-runner PRIVATE ${MLLM_INCLUDE_DIR}) | ||
|
|
||
| add_executable(mllm-qwen2_5-omni-audio-runner audio_infer.cpp) | ||
| target_link_libraries(mllm-qwen2_5-omni-audio-runner PRIVATE MllmRT MllmCPUBackend) | ||
| target_include_directories(mllm-qwen2_5-omni-audio-runner PRIVATE ${MLLM_INCLUDE_DIR}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| // Copyright (c) MLLM Team. | ||
| // Licensed under the MIT License. | ||
|
|
||
| #include <iostream> | ||
| #include <fmt/core.h> | ||
| #include <mllm/mllm.hpp> | ||
| #include <mllm/models/qwen2_5omni/configuration_qwen2_5omni.hpp> | ||
| #include <mllm/models/qwen2_5omni/modeling_qwen2_5omni.hpp> | ||
| #include <mllm/models/qwen2_5omni/tokenization_qwen2_5omni.hpp> | ||
|
|
||
| using mllm::Argparse; | ||
|
|
||
| MLLM_MAIN({ | ||
| mllm::Logger::level() = mllm::LogLevel::kError; | ||
|
|
||
| auto& help = Argparse::add<bool>("-h|--help").help("Show help message"); | ||
| auto& model_path = Argparse::add<std::string>("-m|--model_path").help("Model path").required(true); | ||
| auto& model_version = Argparse::add<std::string>("-mv|--model_version").help("Model version").required(true); | ||
| auto& tokenizer_path = Argparse::add<std::string>("-t|--tokenizer_path").help("Tokenizer directory").required(true); | ||
| auto& config_path = Argparse::add<std::string>("-c|--config_path").help("Config path").required(true); | ||
|
|
||
| Argparse::parse(argc, argv); | ||
|
|
||
| mllm::ModelFileVersion file_version = mllm::ModelFileVersion::kV1; | ||
| if (model_version.get() == "v1") { | ||
| file_version = mllm::ModelFileVersion::kV1; | ||
| } else if (model_version.get() == "v2") { | ||
| file_version = mllm::ModelFileVersion::kV2; | ||
| } | ||
|
|
||
| if (help.isSet()) { | ||
| Argparse::printHelp(); | ||
| mllm::shutdownContext(); | ||
| return 0; | ||
| } | ||
|
Comment on lines
+16
to
+35
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
💡 One way to bypass required-arg validation+#include <string_view>
...
auto& config_path = Argparse::add<std::string>("-c|--config_path").help("Config path").required(true);
+ for (int i = 1; i < argc; ++i) {
+ const std::string_view arg{argv[i]};
+ if (arg == "-h" || arg == "--help") {
+ Argparse::printHelp();
+ mllm::shutdownContext();
+ return 0;
+ }
+ }
Argparse::parse(argc, argv);🤖 Prompt for AI Agents |
||
|
|
||
| { | ||
| auto qwen2_5omni_cfg = mllm::models::qwen2_5omni::Qwen2_5OmniConfig(config_path.get()); | ||
| auto qwen2_5omni_tokenizer = mllm::models::qwen2_5omni::Qwen2_5OmniTokenizer(tokenizer_path.get()); | ||
| auto qwen2_5omni = mllm::models::qwen2_5omni::Qwen2_5OmniForCausalLM(qwen2_5omni_cfg); | ||
|
|
||
| auto param = mllm::load(model_path.get(), file_version); | ||
| qwen2_5omni.thinker_.load(param); | ||
|
|
||
| fmt::print("\n{:*^60}\n", " Qwen2.5-Omni Audio CLI "); | ||
| fmt::print("Enter 'exit' or 'quit' to end the session\n\n"); | ||
|
|
||
| std::string audio_path; | ||
| std::string prompt_text; | ||
|
|
||
| fmt::print("Audio path (or 'exit/quit'): "); | ||
| //std::getline(std::cin, audio_path); | ||
| //if (audio_path == "exit" || audio_path == "quit") { return 0; } | ||
| audio_path = ""; | ||
|
|
||
| fmt::print("Prompt text: "); | ||
| //std::getline(std::cin, prompt_text); | ||
| //if (prompt_text.empty()) { prompt_text = "Please describe the audio."; } | ||
| prompt_text = ""; | ||
|
|
||
| try { | ||
| fmt::print("Processing...\n"); | ||
| auto inputs = qwen2_5omni_tokenizer.convertAudioMessage({.prompt = prompt_text, .audio_file_path = audio_path}); | ||
|
|
||
| fmt::print("\nResponse: "); | ||
| qwen2_5omni.streamGenerate(inputs, | ||
| { | ||
| {"do_sample", mllm::AnyValue(false)}, | ||
| {"max_length", mllm::AnyValue(qwen2_5omni_cfg.max_cache_length)}, | ||
| }, | ||
| [&](int64_t token_id) { | ||
| auto str = qwen2_5omni_tokenizer.detokenize(token_id); | ||
| std::wcout << str << std::flush; | ||
| }); | ||
|
|
||
| fmt::print("\n{}\n", std::string(60, '-')); | ||
| } catch (const std::exception& e) { fmt::print("\nError: {}\n{}\n", e.what(), std::string(60, '-')); } | ||
|
|
||
| qwen2_5omni.perfSummary(); | ||
| } | ||
|
|
||
| mllm::print("\n"); | ||
| mllm::memoryReport(); | ||
| }) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reject unsupported model_version values.
Any value other than
"v2"silently falls back tokV1, which can load incorrect weights. Validate and exit with a clear error.🛡️ Suggested validation
mllm::ModelFileVersion file_version = mllm::ModelFileVersion::kV1; if (model_version.get() == "v1") { file_version = mllm::ModelFileVersion::kV1; } else if (model_version.get() == "v2") { file_version = mllm::ModelFileVersion::kV2; + } else { + fmt::print("Unsupported model_version: {}\n", model_version.get()); + mllm::shutdownContext(); + return 1; }🤖 Prompt for AI Agents