Skip to content

server: add LFM2 SMT vision support#10

Merged
alex-spacemit merged 1 commit into
spacemit-com:spacemit-mtmdfrom
xiaoguorou:db_0001
Jun 22, 2026
Merged

server: add LFM2 SMT vision support#10
alex-spacemit merged 1 commit into
spacemit-com:spacemit-mtmdfrom
xiaoguorou:db_0001

Conversation

@xiaoguorou

Copy link
Copy Markdown

Overview

Additional information

Requirements

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 lfm2 architectures 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_engine that manages ORT session creation, warmup, input loading, and inference.
  • Add Spacemit EP initialization via dlopen/dlsym in 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;
}
@alex-spacemit alex-spacemit merged commit 514e28c into spacemit-com:spacemit-mtmd Jun 22, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants