trio-core 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- trio_core-0.3.0/.github/ISSUE_TEMPLATE/bug_report.md +46 -0
- trio_core-0.3.0/.github/ISSUE_TEMPLATE/feature_request.md +25 -0
- trio_core-0.3.0/.github/ISSUE_TEMPLATE/model_support.md +30 -0
- trio_core-0.3.0/.github/PULL_REQUEST_TEMPLATE.md +28 -0
- trio_core-0.3.0/.github/workflows/publish.yml +28 -0
- trio_core-0.3.0/.github/workflows/test.yml +28 -0
- trio_core-0.3.0/.gitignore +16 -0
- trio_core-0.3.0/CHANGELOG.md +61 -0
- trio_core-0.3.0/CONTRIBUTING.md +102 -0
- trio_core-0.3.0/LICENSE +190 -0
- trio_core-0.3.0/PKG-INFO +257 -0
- trio_core-0.3.0/README.md +205 -0
- trio_core-0.3.0/SECURITY.md +26 -0
- trio_core-0.3.0/examples/bench_generate_loop.py +231 -0
- trio_core-0.3.0/examples/bench_non_qwen.py +465 -0
- trio_core-0.3.0/examples/bench_prefix_cache.py +114 -0
- trio_core-0.3.0/examples/bench_sink.py +235 -0
- trio_core-0.3.0/examples/bench_sink_real.py +202 -0
- trio_core-0.3.0/examples/bench_streaming_qa.py +376 -0
- trio_core-0.3.0/examples/bench_visual_similarity.py +177 -0
- trio_core-0.3.0/examples/run_baseline_mlxvlm.py +175 -0
- trio_core-0.3.0/examples/run_benchmark.py +191 -0
- trio_core-0.3.0/examples/run_eval.py +110 -0
- trio_core-0.3.0/examples/run_regression.py +299 -0
- trio_core-0.3.0/examples/run_tier1_benchmark.py +313 -0
- trio_core-0.3.0/examples/screen_narrator.py +320 -0
- trio_core-0.3.0/examples/stream_monitor.py +120 -0
- trio_core-0.3.0/examples/video_analyze.py +84 -0
- trio_core-0.3.0/examples/webcam_gui.py +207 -0
- trio_core-0.3.0/examples/webcam_to_text.py +75 -0
- trio_core-0.3.0/pyproject.toml +54 -0
- trio_core-0.3.0/research/README.md +365 -0
- trio_core-0.3.0/research/eval-baseline-plan.md +206 -0
- trio_core-0.3.0/research/eval-results/bench_mvbench_8tasks_20_baseline.json +1619 -0
- trio_core-0.3.0/research/eval-results/bench_mvbench_8tasks_20_tome_r4.json +1619 -0
- trio_core-0.3.0/research/eval-results/bench_mvbench_clevrer_5_baseline.json +269 -0
- trio_core-0.3.0/research/eval-results/bench_pope_100_baseline.json +919 -0
- trio_core-0.3.0/research/eval-results/bench_pope_100_baseline_v2.json +919 -0
- trio_core-0.3.0/research/eval-results/bench_pope_100_qwen3vl_baseline.json +919 -0
- trio_core-0.3.0/research/eval-results/bench_pope_100_qwen3vl_tome_r4.json +919 -0
- trio_core-0.3.0/research/eval-results/bench_pope_100_tome_r4.json +919 -0
- trio_core-0.3.0/research/eval-results/bench_pope_100_tome_r4_hidden_mk02.json +919 -0
- trio_core-0.3.0/research/eval-results/bench_pope_100_tome_r4_hidden_mk025.json +919 -0
- trio_core-0.3.0/research/eval-results/bench_pope_100_tome_r4_hidden_v2.json +919 -0
- trio_core-0.3.0/research/eval-results/bench_pope_100_tome_r4_keys.json +919 -0
- trio_core-0.3.0/research/eval-results/bench_pope_100_tome_r4_keys_v2.json +919 -0
- trio_core-0.3.0/research/eval-results/bench_pope_100_tome_r8.json +919 -0
- trio_core-0.3.0/research/eval-results/bench_pope_random_30_baseline.json +289 -0
- trio_core-0.3.0/research/eval-results/bench_streaming_qa_w10_b100.json +110 -0
- trio_core-0.3.0/research/eval-results/bench_streaming_qa_w30_b100.json +35 -0
- trio_core-0.3.0/research/eval-results/compound-tome-fastv-benchmark.md +113 -0
- trio_core-0.3.0/research/eval-results/eval_1080p_baseline.json +322 -0
- trio_core-0.3.0/research/eval-results/eval_1080p_tome_r4.json +322 -0
- trio_core-0.3.0/research/eval-results/eval_1080p_tome_r4_hidden.json +322 -0
- trio_core-0.3.0/research/eval-results/eval_baseline.json +322 -0
- trio_core-0.3.0/research/eval-results/eval_compressed_50.json +322 -0
- trio_core-0.3.0/research/eval-results/eval_compressed_75.json +322 -0
- trio_core-0.3.0/research/eval-results/eval_qwen35_0.8b_baseline.json +322 -0
- trio_core-0.3.0/research/eval-results/eval_qwen35_0.8b_tome_r4.json +322 -0
- trio_core-0.3.0/research/eval-results/eval_qwen3vl_baseline.json +322 -0
- trio_core-0.3.0/research/eval-results/eval_qwen3vl_tome_r4.json +322 -0
- trio_core-0.3.0/research/eval-results/eval_tome_r8.json +322 -0
- trio_core-0.3.0/research/eval-results/mlxvlm-native-baselines.md +87 -0
- trio_core-0.3.0/research/eval-results/regression/SUMMARY.md +149 -0
- trio_core-0.3.0/research/eval-results/regression/default_baseline.json +26 -0
- trio_core-0.3.0/research/eval-results/regression/default_baseline_latest.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/default_vs_0.95_latest.json +29 -0
- trio_core-0.3.0/research/eval-results/regression/gemma-3-4b-it_baseline.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/gemma-3-4b-it_mlxvlm_native.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/qwen2.5-vl-3b_baseline.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/qwen2.5-vl-3b_baseline_latest.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/qwen2.5-vl-3b_fastv_0.5.json +38 -0
- trio_core-0.3.0/research/eval-results/regression/qwen2.5-vl-3b_fastv_0.5_L16.json +38 -0
- trio_core-0.3.0/research/eval-results/regression/qwen2.5-vl-3b_fastv_0.5_L2.json +38 -0
- trio_core-0.3.0/research/eval-results/regression/qwen2.5-vl-3b_fastv_0.5_L8.json +38 -0
- trio_core-0.3.0/research/eval-results/regression/qwen2.5-vl-3b_mlxvlm_native.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/qwen2.5-vl-3b_tome_r1.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/qwen2.5-vl-3b_tome_r2.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/qwen2.5-vl-3b_tome_r4.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/qwen2.5-vl-3b_tome_r4_adaptive.json +38 -0
- trio_core-0.3.0/research/eval-results/regression/qwen2.5-vl-3b_tome_r4_fastv_0.5.json +38 -0
- trio_core-0.3.0/research/eval-results/regression/qwen3-vl-4b_baseline.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/qwen3-vl-4b_baseline_latest.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/qwen3-vl-4b_mlxvlm_native.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/qwen3-vl-4b_tome_r4.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/qwen3-vl-4b_tome_r4_fastv_0.5.json +33 -0
- trio_core-0.3.0/research/eval-results/regression/qwen3.5-0.8b-mlx_baseline.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/qwen3.5-0.8b-mlx_baseline_latest.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/qwen3.5-0.8b-mlx_mlxvlm_native.json +36 -0
- trio_core-0.3.0/research/eval-results/regression/qwen3.5-0.8b-mlx_tome_r4.json +36 -0
- trio_core-0.3.0/research/eval-results/speculative-decode-benchmark.md +119 -0
- trio_core-0.3.0/research/eval-results/tier1/eval_qwen2.5-vl-3b_480p_baseline.json +322 -0
- trio_core-0.3.0/research/eval-results/tier1/eval_qwen2.5-vl-7b_480p_baseline.json +322 -0
- trio_core-0.3.0/research/eval-results/tier1/eval_qwen3-vl-2b_480p_baseline.json +322 -0
- trio_core-0.3.0/research/eval-results/tier1/eval_qwen3-vl-4b_480p_baseline.json +322 -0
- trio_core-0.3.0/research/eval-results/tier1/eval_qwen3-vl-8b_480p_baseline.json +322 -0
- trio_core-0.3.0/research/eval-results/tier1/eval_qwen3.5-0.8b_480p_baseline.json +322 -0
- trio_core-0.3.0/research/eval-results/tier1/eval_qwen3.5-2b_480p_baseline.json +322 -0
- trio_core-0.3.0/research/eval-results/tier1/eval_qwen3.5-4b_480p_baseline.json +322 -0
- trio_core-0.3.0/research/eval-results/tier1/eval_qwen3.5-9b_480p_baseline.json +322 -0
- trio_core-0.3.0/research/eval-results/tier1/kv_reuse_internvl3-1b.json +11 -0
- trio_core-0.3.0/research/eval-results/tier1/kv_reuse_internvl3-2b.json +11 -0
- trio_core-0.3.0/research/eval-results/tier1/kv_reuse_nanollava.json +11 -0
- trio_core-0.3.0/research/eval-results/tier1/non_qwen_benchmark_summary.json +150 -0
- trio_core-0.3.0/research/eval-results/tier1/perf_internvl3-1b_baseline.json +53 -0
- trio_core-0.3.0/research/eval-results/tier1/perf_internvl3-1b_compressed_50.json +53 -0
- trio_core-0.3.0/research/eval-results/tier1/perf_internvl3-2b_baseline.json +53 -0
- trio_core-0.3.0/research/eval-results/tier1/perf_internvl3-2b_compressed_50.json +53 -0
- trio_core-0.3.0/research/eval-results/tier1/perf_nanollava_baseline.json +53 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_internvl3-1b_baseline.json +519 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_internvl3-1b_compressed_50.json +519 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_internvl3-1b_fastv_0.5.json +519 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_internvl3-2b_baseline.json +519 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_internvl3-2b_compressed_50.json +519 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_internvl3-2b_fastv_0.5.json +519 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_nanollava_baseline.json +519 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_qwen2.5-vl-3b_baseline.json +469 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_qwen2.5-vl-7b_baseline.json +469 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_qwen3-vl-2b_baseline.json +469 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_qwen3-vl-4b_baseline.json +469 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_qwen3-vl-8b_baseline.json +469 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_qwen3.5-0.8b_baseline.json +469 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_qwen3.5-2b_baseline.json +469 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_qwen3.5-4b_baseline.json +469 -0
- trio_core-0.3.0/research/eval-results/tier1/pope_qwen3.5-9b_baseline.json +469 -0
- trio_core-0.3.0/research/eval-results/tier1/streammem_nanollava.json +80 -0
- trio_core-0.3.0/research/eval-results/tier1/tier1_combined_baseline.json +8 -0
- trio_core-0.3.0/research/eval-strategy.md +168 -0
- trio_core-0.3.0/research/native-engine-plan.md +201 -0
- trio_core-0.3.0/research/phase1-custom-generate.md +215 -0
- trio_core-0.3.0/research/poc_attention_analysis.py +291 -0
- trio_core-0.3.0/research/tome-implementation-plan.md +278 -0
- trio_core-0.3.0/research/visual-token-compression.md +324 -0
- trio_core-0.3.0/src/trio_core/__init__.py +32 -0
- trio_core-0.3.0/src/trio_core/api/__init__.py +0 -0
- trio_core-0.3.0/src/trio_core/api/models.py +170 -0
- trio_core-0.3.0/src/trio_core/api/server.py +451 -0
- trio_core-0.3.0/src/trio_core/backends.py +746 -0
- trio_core-0.3.0/src/trio_core/callbacks.py +80 -0
- trio_core-0.3.0/src/trio_core/cli.py +172 -0
- trio_core-0.3.0/src/trio_core/compressed_backend.py +264 -0
- trio_core-0.3.0/src/trio_core/config.py +103 -0
- trio_core-0.3.0/src/trio_core/device.py +188 -0
- trio_core-0.3.0/src/trio_core/engine.py +400 -0
- trio_core-0.3.0/src/trio_core/eval.py +406 -0
- trio_core-0.3.0/src/trio_core/eval_benchmarks.py +1083 -0
- trio_core-0.3.0/src/trio_core/fastv_backend.py +593 -0
- trio_core-0.3.0/src/trio_core/generate.py +896 -0
- trio_core-0.3.0/src/trio_core/model_adapter.py +511 -0
- trio_core-0.3.0/src/trio_core/models/__init__.py +1 -0
- trio_core-0.3.0/src/trio_core/models/base.py +231 -0
- trio_core-0.3.0/src/trio_core/models/loader.py +170 -0
- trio_core-0.3.0/src/trio_core/models/qwen2_5_vl/__init__.py +4 -0
- trio_core-0.3.0/src/trio_core/models/qwen2_5_vl/config.py +90 -0
- trio_core-0.3.0/src/trio_core/models/qwen2_5_vl/language.py +461 -0
- trio_core-0.3.0/src/trio_core/models/qwen2_5_vl/qwen2_5_vl.py +132 -0
- trio_core-0.3.0/src/trio_core/models/qwen2_5_vl/vision.py +342 -0
- trio_core-0.3.0/src/trio_core/models/qwen3_5/__init__.py +2 -0
- trio_core-0.3.0/src/trio_core/models/qwen3_5/config.py +96 -0
- trio_core-0.3.0/src/trio_core/models/qwen3_5/language.py +667 -0
- trio_core-0.3.0/src/trio_core/models/qwen3_5/qwen3_5.py +150 -0
- trio_core-0.3.0/src/trio_core/models/qwen3_5/vision.py +5 -0
- trio_core-0.3.0/src/trio_core/models/qwen3_vl/__init__.py +4 -0
- trio_core-0.3.0/src/trio_core/models/qwen3_vl/config.py +104 -0
- trio_core-0.3.0/src/trio_core/models/qwen3_vl/language.py +554 -0
- trio_core-0.3.0/src/trio_core/models/qwen3_vl/qwen3_vl.py +161 -0
- trio_core-0.3.0/src/trio_core/models/qwen3_vl/vision.py +419 -0
- trio_core-0.3.0/src/trio_core/native_vision.py +485 -0
- trio_core-0.3.0/src/trio_core/native_vision_standard.py +194 -0
- trio_core-0.3.0/src/trio_core/profiles.py +649 -0
- trio_core-0.3.0/src/trio_core/streaming_memory.py +319 -0
- trio_core-0.3.0/src/trio_core/token_compression.py +206 -0
- trio_core-0.3.0/src/trio_core/tome.py +223 -0
- trio_core-0.3.0/src/trio_core/tome_backend.py +386 -0
- trio_core-0.3.0/src/trio_core/tome_vision.py +393 -0
- trio_core-0.3.0/src/trio_core/utils.py +94 -0
- trio_core-0.3.0/src/trio_core/video.py +553 -0
- trio_core-0.3.0/tests/__init__.py +0 -0
- trio_core-0.3.0/tests/test_api.py +297 -0
- trio_core-0.3.0/tests/test_backends.py +89 -0
- trio_core-0.3.0/tests/test_callbacks.py +59 -0
- trio_core-0.3.0/tests/test_device.py +50 -0
- trio_core-0.3.0/tests/test_engine.py +139 -0
- trio_core-0.3.0/tests/test_fastv.py +279 -0
- trio_core-0.3.0/tests/test_model_adapter.py +284 -0
- trio_core-0.3.0/tests/test_native_vision.py +286 -0
- trio_core-0.3.0/tests/test_prefix_cache.py +350 -0
- trio_core-0.3.0/tests/test_profiles.py +133 -0
- trio_core-0.3.0/tests/test_stream_capture.py +99 -0
- trio_core-0.3.0/tests/test_streaming_memory.py +339 -0
- trio_core-0.3.0/tests/test_tome.py +275 -0
- trio_core-0.3.0/tests/test_tome_integration.py +366 -0
- trio_core-0.3.0/tests/test_video.py +93 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Report a bug in TrioCore
|
|
4
|
+
title: "[Bug] "
|
|
5
|
+
labels: bug
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Description
|
|
10
|
+
|
|
11
|
+
A clear description of the bug.
|
|
12
|
+
|
|
13
|
+
## Environment
|
|
14
|
+
|
|
15
|
+
- **OS**: macOS / Linux / Windows
|
|
16
|
+
- **Hardware**: Apple M3 Pro 18GB / RTX 4090 / CPU only
|
|
17
|
+
- **Python**: 3.12
|
|
18
|
+
- **trio-core version**: 0.2.1
|
|
19
|
+
- **Backend**: mlx / transformers
|
|
20
|
+
|
|
21
|
+
## Model
|
|
22
|
+
|
|
23
|
+
- **Model ID**: `mlx-community/Qwen2.5-VL-3B-Instruct-4bit`
|
|
24
|
+
|
|
25
|
+
## Steps to Reproduce
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from trio_core import TrioCore
|
|
29
|
+
engine = TrioCore()
|
|
30
|
+
engine.load()
|
|
31
|
+
# ...
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Expected Behavior
|
|
35
|
+
|
|
36
|
+
What you expected to happen.
|
|
37
|
+
|
|
38
|
+
## Actual Behavior
|
|
39
|
+
|
|
40
|
+
What actually happened. Include error messages and tracebacks.
|
|
41
|
+
|
|
42
|
+
## Additional Context
|
|
43
|
+
|
|
44
|
+
- [ ] ToMe enabled? If so, what `r` value?
|
|
45
|
+
- [ ] Streaming or batch inference?
|
|
46
|
+
- [ ] Happens with all models or specific ones?
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Suggest a new feature or improvement
|
|
4
|
+
title: "[Feature] "
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Problem
|
|
10
|
+
|
|
11
|
+
What problem does this feature solve? What's the use case?
|
|
12
|
+
|
|
13
|
+
## Proposed Solution
|
|
14
|
+
|
|
15
|
+
Describe how you'd like it to work.
|
|
16
|
+
|
|
17
|
+
## Alternatives Considered
|
|
18
|
+
|
|
19
|
+
Other approaches you've thought about.
|
|
20
|
+
|
|
21
|
+
## Additional Context
|
|
22
|
+
|
|
23
|
+
- Related papers or prior art
|
|
24
|
+
- Benchmark data if applicable
|
|
25
|
+
- Impact on existing functionality
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Model Support Request
|
|
3
|
+
about: Request support for a new VLM model
|
|
4
|
+
title: "[Model] "
|
|
5
|
+
labels: model-support
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Model
|
|
10
|
+
|
|
11
|
+
- **Name**: e.g., Qwen2.5-VL-72B
|
|
12
|
+
- **HuggingFace ID**: e.g., `Qwen/Qwen2.5-VL-72B-Instruct`
|
|
13
|
+
- **MLX variant** (if available): e.g., `mlx-community/Qwen2.5-VL-72B-Instruct-4bit`
|
|
14
|
+
|
|
15
|
+
## Architecture Details
|
|
16
|
+
|
|
17
|
+
- **Family**: Qwen2.5-VL / Qwen3-VL / Gemma 3 / SmolVLM / Other
|
|
18
|
+
- **Parameter size**: 72B
|
|
19
|
+
- **Vision encoder**: ViT patch size, merge factor
|
|
20
|
+
- **Context window**: 128K
|
|
21
|
+
- **Quantized size**: ~40GB (4-bit)
|
|
22
|
+
|
|
23
|
+
## Why This Model?
|
|
24
|
+
|
|
25
|
+
What makes this model a good fit for TrioCore?
|
|
26
|
+
|
|
27
|
+
## Testing
|
|
28
|
+
|
|
29
|
+
- [ ] I have tested basic inference with this model
|
|
30
|
+
- [ ] I can provide benchmark results
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
## Summary
|
|
2
|
+
|
|
3
|
+
Brief description of what this PR does.
|
|
4
|
+
|
|
5
|
+
## Changes
|
|
6
|
+
|
|
7
|
+
- Change 1
|
|
8
|
+
- Change 2
|
|
9
|
+
|
|
10
|
+
## Test Plan
|
|
11
|
+
|
|
12
|
+
- [ ] All existing tests pass (`python -m pytest tests/`)
|
|
13
|
+
- [ ] Regression test passes (`python examples/run_regression.py`) — required for inference changes
|
|
14
|
+
- [ ] New tests added for new functionality
|
|
15
|
+
|
|
16
|
+
## Benchmarks
|
|
17
|
+
|
|
18
|
+
If this PR affects inference performance or accuracy, include before/after numbers:
|
|
19
|
+
|
|
20
|
+
| Metric | Before | After |
|
|
21
|
+
|--------|--------|-------|
|
|
22
|
+
| POPE accuracy | | |
|
|
23
|
+
| Prefill latency | | |
|
|
24
|
+
| Visual tokens | | |
|
|
25
|
+
|
|
26
|
+
## Related Issues
|
|
27
|
+
|
|
28
|
+
Closes #
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
permissions:
|
|
11
|
+
id-token: write # trusted publishing
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Set up Python
|
|
17
|
+
uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
|
|
21
|
+
- name: Install build tools
|
|
22
|
+
run: pip install hatchling
|
|
23
|
+
|
|
24
|
+
- name: Build wheel
|
|
25
|
+
run: python -m hatchling build -t wheel
|
|
26
|
+
|
|
27
|
+
- name: Publish to PyPI
|
|
28
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
20
|
+
uses: actions/setup-python@v5
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python-version }}
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: pip install -e '.[dev]'
|
|
26
|
+
|
|
27
|
+
- name: Run tests
|
|
28
|
+
run: python -m pytest tests/ -v
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Webcam GUI example with live video preview and VLM text overlay
|
|
12
|
+
- Accuracy regression test suite (POPE + TextVQA gate)
|
|
13
|
+
- Native engine plan and inference pipeline documentation
|
|
14
|
+
|
|
15
|
+
## [0.2.1] - 2026-03-06
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
- Qwen3.5 support (0.8B / 4B / 9B profiles, verified ToMe compatibility)
|
|
19
|
+
- Gemma 3 model profiles (4B, 12B) with SigLIP vision encoder parameters
|
|
20
|
+
- SmolVLM model profiles (256M, 500M, 2.2B) for ultra-lightweight inference
|
|
21
|
+
- Pattern matching for HuggingFace model IDs of all supported families
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- Generalized Transformers backend: replaced `Qwen2_5_VLForConditionalGeneration` with `AutoModelForVision2Seq` for universal VLM support
|
|
25
|
+
- Added generic PIL-based input path for non-Qwen models (Gemma 3, SmolVLM, etc.)
|
|
26
|
+
|
|
27
|
+
## [0.2.0] - 2026-03-04
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- ToMe (Token Merging) visual token compression inside ViT blocks
|
|
31
|
+
- Windowed-attention-aware merging for Qwen2.5-VL
|
|
32
|
+
- Qwen3-VL support with deepstack feature handling
|
|
33
|
+
- Compressed position encoding after token merging
|
|
34
|
+
- POPE and TextVQA benchmark framework
|
|
35
|
+
- Synthetic eval framework (prefill, decode, memory profiling)
|
|
36
|
+
- Benchmark CLI with A/B comparison (`run_benchmark.py`, `run_eval.py`)
|
|
37
|
+
|
|
38
|
+
### Results
|
|
39
|
+
- Qwen2.5-VL-3B at 1080p: **73% prefill speedup**, 68% token reduction with ToMe r=4
|
|
40
|
+
- Qwen3-VL-4B POPE: **zero quality loss** (91% accuracy) with 31% prefill speedup
|
|
41
|
+
|
|
42
|
+
## [0.1.0] - 2026-03-01
|
|
43
|
+
|
|
44
|
+
### Added
|
|
45
|
+
- Core inference engine with three-phase pipeline (preprocess, inference, postprocess)
|
|
46
|
+
- MLX backend for Apple Silicon (M1-M4) via mlx-vlm
|
|
47
|
+
- Transformers backend for NVIDIA GPU and CPU
|
|
48
|
+
- Hardware auto-detection and model recommendation
|
|
49
|
+
- StreamCapture for live video streams (RTSP, YouTube, webcam)
|
|
50
|
+
- Temporal deduplication (normalized L2 on 64x64 downscale)
|
|
51
|
+
- Motion gating (frame differencing + EMA background)
|
|
52
|
+
- Model profiles with architecture-aware parameters
|
|
53
|
+
- FastAPI server with OpenAI-compatible chat endpoint
|
|
54
|
+
- CLI: `trio-core serve`, `trio-core analyze`, `trio-core device`
|
|
55
|
+
- Callback system with 10 lifecycle events
|
|
56
|
+
- 120 unit tests
|
|
57
|
+
|
|
58
|
+
[Unreleased]: https://github.com/machinefi/trio-core/compare/v0.2.1...HEAD
|
|
59
|
+
[0.2.1]: https://github.com/machinefi/trio-core/compare/v0.2.0...v0.2.1
|
|
60
|
+
[0.2.0]: https://github.com/machinefi/trio-core/compare/v0.1.0...v0.2.0
|
|
61
|
+
[0.1.0]: https://github.com/machinefi/trio-core/releases/tag/v0.1.0
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# Contributing to TrioCore
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to TrioCore! This guide will help you get started.
|
|
4
|
+
|
|
5
|
+
## Development Setup
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Clone
|
|
9
|
+
git clone https://github.com/machinefi/trio-core.git
|
|
10
|
+
cd trio-core
|
|
11
|
+
|
|
12
|
+
# Create virtual environment
|
|
13
|
+
python -m venv .venv
|
|
14
|
+
source .venv/bin/activate
|
|
15
|
+
|
|
16
|
+
# Install in development mode
|
|
17
|
+
pip install -e '.[dev]'
|
|
18
|
+
|
|
19
|
+
# Apple Silicon: also install MLX backend
|
|
20
|
+
pip install -e '.[mlx,dev]'
|
|
21
|
+
|
|
22
|
+
# NVIDIA GPU: also install Transformers backend
|
|
23
|
+
pip install -e '.[transformers,dev]'
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Running Tests
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Run all tests
|
|
30
|
+
python -m pytest tests/ -v
|
|
31
|
+
|
|
32
|
+
# Run specific test file
|
|
33
|
+
python -m pytest tests/test_tome.py -v
|
|
34
|
+
|
|
35
|
+
# Run with coverage
|
|
36
|
+
python -m pytest tests/ --cov=trio_core
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Running Benchmarks
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Quick accuracy check (50 samples, ~2 min)
|
|
43
|
+
python examples/run_regression.py --save-baseline
|
|
44
|
+
|
|
45
|
+
# Full POPE benchmark
|
|
46
|
+
python examples/run_benchmark.py --bench pope --samples 100
|
|
47
|
+
|
|
48
|
+
# Performance eval
|
|
49
|
+
python examples/run_eval.py --resolution 1080p --runs 3
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Code Style
|
|
53
|
+
|
|
54
|
+
- Python 3.10+ with type hints
|
|
55
|
+
- Use `from __future__ import annotations` for forward references
|
|
56
|
+
- Keep functions focused and short
|
|
57
|
+
- No unnecessary abstractions — three similar lines > premature helper
|
|
58
|
+
- Comments only where logic isn't self-evident
|
|
59
|
+
|
|
60
|
+
## Pull Request Process
|
|
61
|
+
|
|
62
|
+
1. **Fork** the repository and create a feature branch from `main`
|
|
63
|
+
2. **Write tests** for any new functionality
|
|
64
|
+
3. **Run the test suite** — all 120+ tests must pass
|
|
65
|
+
4. **Run regression tests** if changing inference code:
|
|
66
|
+
```bash
|
|
67
|
+
python examples/run_regression.py
|
|
68
|
+
```
|
|
69
|
+
5. **Keep PRs focused** — one feature or fix per PR
|
|
70
|
+
6. **Write a clear description** of what and why
|
|
71
|
+
|
|
72
|
+
## What to Contribute
|
|
73
|
+
|
|
74
|
+
### High Impact
|
|
75
|
+
- Bug fixes in inference pipeline
|
|
76
|
+
- New model support (profiles + backend testing)
|
|
77
|
+
- Performance optimizations with benchmarks
|
|
78
|
+
- Accuracy improvements on POPE/TextVQA
|
|
79
|
+
|
|
80
|
+
### Welcome
|
|
81
|
+
- Documentation improvements
|
|
82
|
+
- New examples and usage patterns
|
|
83
|
+
- CI/CD improvements
|
|
84
|
+
- Test coverage for edge cases
|
|
85
|
+
|
|
86
|
+
### Please Discuss First
|
|
87
|
+
- Architecture changes (open an issue)
|
|
88
|
+
- New dependencies
|
|
89
|
+
- API breaking changes
|
|
90
|
+
|
|
91
|
+
## Reporting Issues
|
|
92
|
+
|
|
93
|
+
Use the [issue templates](.github/ISSUE_TEMPLATE/) to report bugs or request features. Include:
|
|
94
|
+
|
|
95
|
+
- Python version, OS, hardware (M1/M2/M3/M4, GPU model)
|
|
96
|
+
- Model being used
|
|
97
|
+
- Minimal reproduction steps
|
|
98
|
+
- Expected vs actual behavior
|
|
99
|
+
|
|
100
|
+
## License
|
|
101
|
+
|
|
102
|
+
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.
|
trio_core-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2025 Trio Team
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|