[PR #288] [CLOSED] strata-vision: --flash-attn switch, CPU runs without a CUDA context or warm-up; relative vision paths #2554

Closed
opened 2026-11-04 02:01:17 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/288
Author: @sergqwer
Created: 9/30/2026
Status: ❌ Closed

Base: main ← Head: pr/vision-cpu


📝 Commits (1)

  • 8f8bbc7 strata-vision: --flash-attn on|off|auto; on the CPU no CUDA context, no warm-up, a thread per core

📊 Changes

2 files changed (+31 additions, -5 deletions)

View changed files

📝 serve/server.py (+5 -2)
📝 tools/vision/strata_vision.cpp (+26 -3)

📄 Description

Summary

Four small changes to the image encoder and its config:

  • --flash-attn on|off|auto (mtmd's flash_attn_type). Flash attention keeps K and V in FP16. On the NVFP4 fork
    the vision tower's output was 11.2% off with it on the GPU, and 0.1% with FP32 attention on the CPU. The
    default stays auto; the switch makes the choice possible.
  • CPU runs without a CUDA context. A CUDA build of the encoder running on the CPU still opened a context on the
    GPU: 0.4-0.7 GB of VRAM, 150-260 expert slots less for the engine beside it. It now hides the GPU
    (CUDA_VISIBLE_DEVICES=-1 before the runtime starts).
  • CPU threads and warm-up. Without --threads, the CPU encoder uses one thread per core (mtmd's default is 4), and
    it skips the warm-up encode (~6 s of start at 1,024 image tokens).
  • Relative paths. In serve/server.py, relative exe, mmproj and model paths in the vision config now
    resolve against the config's cwd, as the engine's paths already do.

Measured

On the NVFP4 fork with an FP32 mmproj on the CPU: 2-6 s per picture, and no VRAM taken from the expert cache.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/288 **Author:** [@sergqwer](https://github.com/sergqwer) **Created:** 9/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `pr/vision-cpu` --- ### 📝 Commits (1) - [`8f8bbc7`](https://github.com/Niko1221/Strata/commit/8f8bbc778d0291eb4d8320d629f2ea7d6552f3b3) strata-vision: --flash-attn on|off|auto; on the CPU no CUDA context, no warm-up, a thread per core ### 📊 Changes **2 files changed** (+31 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `serve/server.py` (+5 -2) 📝 `tools/vision/strata_vision.cpp` (+26 -3) </details> ### 📄 Description ## Summary Four small changes to the image encoder and its config: - **`--flash-attn on|off|auto`** (mtmd's `flash_attn_type`). Flash attention keeps K and V in FP16. On the NVFP4 fork the vision tower's output was **11.2% off** with it on the GPU, and 0.1% with FP32 attention on the CPU. The default stays `auto`; the switch makes the choice possible. - **CPU runs without a CUDA context.** A CUDA build of the encoder running on the CPU still opened a context on the GPU: 0.4-0.7 GB of VRAM, 150-260 expert slots less for the engine beside it. It now hides the GPU (`CUDA_VISIBLE_DEVICES=-1` before the runtime starts). - **CPU threads and warm-up.** Without `--threads`, the CPU encoder uses one thread per core (mtmd's default is 4), and it skips the warm-up encode (~6 s of start at 1,024 image tokens). - **Relative paths.** In `serve/server.py`, relative `exe`, `mmproj` and `model` paths in the vision config now resolve against the config's `cwd`, as the engine's paths already do. ## Measured On the NVFP4 fork with an FP32 mmproj on the CPU: 2-6 s per picture, and no VRAM taken from the expert cache. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 02:01:17 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2554
No description provided.