]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
server : enable multi-modal prompt caching (#19877)
authorGeorgi Gerganov <redacted>
Wed, 25 Feb 2026 13:15:42 +0000 (15:15 +0200)
committerGitHub <redacted>
Wed, 25 Feb 2026 13:15:42 +0000 (15:15 +0200)
tools/server/server-context.cpp
tools/server/server-task.cpp

index 67c3988bd05402117ce0b189ef603e8adb4c94bc..73af812437ea4f3222b230c30936ce90ca4a7f1e 100644 (file)
@@ -995,9 +995,6 @@ private:
             // don't update the cache if the slot's context is empty
             update_cache = update_cache && tokens.size() > 0;
 
-            // TODO: mtmd does not support prompt cache
-            update_cache = update_cache && (ret->mctx == nullptr);
-
             if (update_cache) {
                 SRV_WRN("%s", "updating prompt cache\n");
 
index 739e30a7046ea432764945fcaecf4aa740918b1a..d3aba18489b836b36099689bdfd1f28b07e90cff 100644 (file)
@@ -1900,10 +1900,9 @@ server_prompt * server_prompt_cache::alloc(const server_prompt & prompt, size_t
         return nullptr;
     }
 
-    // TODO: for some reason we can't copy server_tokens, so we have to do this workaround
     auto & cur = states.emplace_back();
     cur = {
-        /*.tokens      =*/ server_tokens(prompt.tokens.get_text_tokens(), false),
+        /*.tokens      =*/ prompt.tokens.clone(),
         /*.data        =*/ std::move(state_data),
         /*.checkpoints =*/ prompt.checkpoints,
     };