server: add LFM2 SMT vision support#10
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds SMT vision support for the LFM2 architecture in the server path, and refactors the mtmd SMT vision wrapper to run the ONNX model directly via the ONNX Runtime C++ API and dynamically initialize the Spacemit execution provider.
Changes:
- Recognize
lfm2architectures when selecting image boundary special tokens in the server SMT vision flow. - Replace the previous SpineVisionModelEngine usage in the mtmd wrapper with a local
smt_ort_vision_enginethat manages ORT session creation, warmup, input loading, and inference. - Add Spacemit EP initialization via
dlopen/dlsymin the mtmd vision wrapper (needs platform guards for Windows).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tools/server/server-smt-vision.cpp | Adds lfm2 to native image boundary token detection so LFM2 uses `< |
| tools/mtmd/smt-vision-wrapper.cpp | Refactors SMT vision ONNX execution to a new ORT-based engine and adds dynamic Spacemit EP initialization (currently not Windows-safe). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
10
to
12
| #include <cstdlib> | ||
| #include <dlfcn.h> | ||
| #include <fstream> |
Comment on lines
+71
to
+75
| void * handle = dlopen("libspacemit_ep.so", RTLD_NOW); | ||
| if (!handle) { | ||
| error_message = std::string("failed to load libspacemit_ep.so: ") + dlerror(); | ||
| return false; | ||
| } |
514e28c
into
spacemit-com:spacemit-mtmd
10 of 11 checks passed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
Additional information
Requirements