Enable WebGPU execution provider for semantic embeddings (WASM fallback)
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- javascript, typescript
- Lĩnh vực
- frontend, machine-learning, search
Hướng nghiên cứu
Start by reading src/lib/search/embeddings.ts, especially the device selection around lines 48 and 58-68, then inspect the device-guard tests. Extend the existing worker pipeline to probe WebGPU, retry with WASM on failure, and include the selected device in the fingerprints handled by src/lib/search/semantic-cache.ts and src/lib/search/semantic-digest.ts. Done means the fallback tests pass and the Settings view reports the active embedding device.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
The semantic search engine currently pins the transformers.js embedding pipeline to CPU/WASM execution (device: embeddingDevice with a WASM-only default). Transformers.js v4 — already the project dependency (@huggingface/transformers ^4.3.1) — makes WebGPU the default backend where the browser supports it, with a one-line device flag and mature WASM fallback.
Evidence
src/lib/search/embeddings.ts:48— "CPU execution via WASM — no WebGPU required" comment documents the current deliberate choice.src/lib/search/embeddings.ts:66-68—setEmbeddingDeviceForTestsshows the device selection is already parameterized; addingwebgpuis a small, contained change.- Dependency is already at v4.x, so no upgrade is required to try it.
Impact
- Performance: 2026 benchmarks report 40–75× embedding speedups on WebGPU vs WASM across integrated and discrete GPUs; semantic indexing of a large corpus drops from tens of seconds to near-instant for incremental updates.
- Battery/UX: GPU inference frees the main thread and reduces CPU spin during indexing (the search worker already exists, so worker placement is solved).
- No regression risk for unsupported browsers:
navigator.gpu.requestAdapter()probe → fall back to the existingwasmpath.
Proposed approach
- Probe
navigator.gpu?.requestAdapter()in the worker before pipeline creation. - Select
device: 'webgpu'when available; on pipeline-creation failure, retry once withdevice: 'wasm'. - Record the chosen device in the semantic cache fingerprint so vectors are not reused across devices (
src/lib/search/semantic-cache.ts/semantic-digest.tsalready fingerprint model + preprocessing + corpus). - Extend the device-guard test (
deviceerror handling aroundembeddings.ts:58) and a new fallback unit test. - Surface the active device in the Settings view (it already reports semantic index cost/budget).
References
- Transformers.js docs (WebGPU + browser cache): https://huggingface.co/docs/transformers.js
- 2026 WebGPU browser-inference architecture guide (worker placement, device loss recovery, fallback): https://diegobetto.com/en/webgpu-client-side-ai-browser/
- WebGPU vs WASM embedding speedup benchmarks (2026): https://wowdata.science/browser-native-agents-llms-in-browser-ai-guide-2026/
- Quantization guidance (q8 sweet spot for embeddings): https://vadimall.com/posts/transformers-js-v4-webgpu-browser-ai-typescript
- Ngôn ngữ chính
- TypeScript
- Star
- 3
- Fork
- 2
- Merge trung bình
- 11 giờ 49 phút
- Pull request đã merge (30 ngày)
- 102
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của d-oit/do-knowledge-studio
-
Migrate do-harness.toml to the current [[sensors]] schema (do-harness CLI 0.6.0 cannot parse it)Đang mởchore config priority: low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
d-oit/do-knowledge-studio#1219 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Dependabot only scans the root manifest — add workspace packages/* directories, cooldown, and grouped updatesCó thể đã có người làm @d-oit đã nhận hôm nay. Đang mởci config deps priority: medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
d-oit/do-knowledge-studio#1212 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation priority: low
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
d-oit/do-knowledge-studio#1218 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chore priority: low skills
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
d-oit/do-knowledge-studio#1217 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
discussion enhancement performance priority: low search
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
d-oit/do-knowledge-studio#1216 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của d-oit/do-knowledge-studio
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
danielmiessler/LifeOS#3028 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
-
iOS: last line of a long UITextView text is sometimes not drawn (frame a fraction of a point short)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
Koenkk/zigbee2mqtt#33855 ·
Maintainer thường phản hồi trong vòng 1 ngày