MCPcopy Create free account
hub / github.com/alibaba/MNN / GetModelType

Method GetModelType

apps/mnncli/src/model_repository.cpp:138–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

136}
137
138std::string ModelRepository::GetModelType(const std::string& modelId) {
139 try {
140 auto data = GetModelMarketData();
141 if (!data) {
142 return "LLM"; // Default to LLM if no data available
143 }
144
145 // Check ASR models
146 for (const auto& model : data->asrModels) {
147 for (const auto& [source, repoPath] : model.sources) {
148 std::string testModelId = CreateModelId(source, repoPath);
149 if (testModelId == modelId) {
150 LOG_DEBUG_TAG("Found ASR model: " + modelId, kTag);
151 return "ASR";
152 }
153 }
154 }
155
156 // Check TTS models
157 for (const auto& model : data->ttsModels) {
158 for (const auto& [source, repoPath] : model.sources) {
159 std::string testModelId = CreateModelId(source, repoPath);
160 if (testModelId == modelId) {
161 LOG_DEBUG_TAG("Found TTS model: " + modelId, kTag);
162 return "TTS";
163 }
164 }
165 }
166
167 } catch (const std::exception& e) {
168 LOG_DEBUG_TAG("Failed to determine model type for " + modelId + ": " + std::string(e.what()), kTag);
169 }
170
171 // Default to LLM
172 return "LLM";
173}
174
175std::optional<ModelMarketData> ModelRepository::LoadFromAssets() {
176 try {

Callers 1

DownloadModelMethod · 0.80

Calls 2

stringFunction · 0.50
whatMethod · 0.45

Tested by

no test coverage detected