Skip to content

QVAC-17265 feat: auto-download models in pivot and indictrans examples#1614

Merged
olyasir merged 2 commits into
tetherto:mainfrom
RamazTs:feat/QVAC-17265-nmtcpp-examples-auto-download
Apr 16, 2026
Merged

QVAC-17265 feat: auto-download models in pivot and indictrans examples#1614
olyasir merged 2 commits into
tetherto:mainfrom
RamazTs:feat/QVAC-17265-nmtcpp-examples-auto-download

Conversation

@RamazTs

@RamazTs RamazTs commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

  • pivot.example.js and indictrans.js required model files to be manually pre-downloaded before running, unlike quickstart.js and batch.example.js which auto-download Bergamot models from Firefox CDN
  • New users running the examples for the first time would get a "model not found" error with no automatic resolution

How does it solve it?

  • pivot.example.js: Replace manual fs.existsSync checks with ensureBergamotModelFiles() and getBergamotFileNames() from bergamot-model-fetcher, auto-downloading es→en and en→it models from Firefox CDN when not found locally
  • indictrans.js: Create new lib/indictrans-model-fetcher.js that uses @qvac/registry-client to download the ggml-indictrans2-en-indic-dist-200M-q4_0.bin model from the QVAC registry when not found locally
  • Add @qvac/registry-client as a devDependency and export the new fetcher module
  • Both examples still support env var overrides (BERGAMOT_ESEN_PATH, BERGAMOT_ENIT_PATH, INDICTRANS_MODEL_PATH) for custom local paths
  • Bump package version to 2.0.3

How was it tested?

  • npx standard lint passes on all changed files
  • bare examples/pivot.example.js — models auto-downloaded from Firefox CDN, pivot translation (Spanish → English → Italian) completed successfully
  • Verified cached models are reused on subsequent runs (skips download)

API Changes

// New module export
const {
  ensureIndicTransModelFile,
  getIndicTransFileName,
  downloadIndicTransFromRegistry,
  INDICTRANS_MODELS
} = require('@qvac/translation-nmtcpp/lib/indictrans-model-fetcher')
                                                                                                                                                                                                                                                    
// Ensures model is present, downloads from QVAC registry if not
await ensureIndicTransModelFile('./model/indictrans/model.bin')    

@RamazTs RamazTs requested review from a team as code owners April 15, 2026 19:12
@RamazTs RamazTs changed the title feat: auto-download models in pivot and indictrans examples QVAC-17265 feat: auto-download models in pivot and indictrans examples Apr 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Tier-based Approval Status

**PR Tier:** TIER1

**Current Status:** ✅ APPROVED

**Requirements:**
- 1 Team Member approval ✅ (1/1)
- 1 Team Lead OR Management approval ✅ (1/1)



---
*This comment is automatically updated when reviews change.*

@github-actions

Copy link
Copy Markdown
Contributor

🧪 C++ Test Coverage Report

Coverage:

📊 Detailed Coverage
Filename                      Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TranslationModel.cpp              146                35    76.03%          23                 3    86.96%         305                49    83.93%          58                26    55.17%
TranslationModel.hpp                1                 0   100.00%           1                 0   100.00%           1                 0   100.00%           0                 0         -
nmt.cpp                            72                22    69.44%           9                 1    88.89%         135                28    79.26%          38                12    68.42%
nmt.hpp                            51                 4    92.16%          11                 2    81.82%          53                 4    92.45%          28                 0   100.00%
nmt_beam_search.cpp               116                25    78.45%          10                 3    70.00%         254                32    87.40%          74                17    77.03%
nmt_graph_decoder.cpp             164                78    52.44%          15                 7    53.33%         541               161    70.24%         112                69    38.39%
nmt_graph_encoder.cpp              54                13    75.93%           3                 0   100.00%         268                33    87.69%          36                15    58.33%
nmt_loader.cpp                    283                80    71.73%          14                 0   100.00%         786               109    86.13%         148                71    52.03%
nmt_state_backend.cpp             199                53    73.37%          20                 0   100.00%         431                86    80.05%         122                53    56.56%
nmt_tokenization.cpp               88                21    76.14%           8                 0   100.00%         135                36    73.33%          58                25    56.90%
nmt_utils.cpp                      24                 4    83.33%           3                 0   100.00%          36                 5    86.11%          16                 7    56.25%
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                            1198               335    72.04%         117                16    86.32%        2945               543    81.56%         690               295    57.25%

@olyasir olyasir merged commit 25f025c into tetherto:main Apr 16, 2026
37 of 62 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - Android

Overall Status: FAILED
Device Farm Result: FAILED
Platform: Android
Addon: @qvac/translation-nmtcpp
PR: #1614
Commit: 436e29c

Test Summary

Metric Count
Total Tests 6
✅ Passed 4
❌ Failed 2
⏭️ Skipped 0

Links

  • 🔗 Device Farm Run: View on AWS Device Farm
  • 🔗 Workflow: View Details
  • 📋 Run ARN: arn:aws:devicefarm:us-west-2:833707431398:run:cef7531e-44ed-4ddf-a349-a4b0f72f680d/1834352d-ad55-4efa-9854-aa2677fb3075

Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

✅ E2E Mobile Test Results - iOS

Overall Status: PASSED
Device Farm Result: PASSED
Platform: iOS
Addon: @qvac/translation-nmtcpp
PR: #1614
Commit: 436e29c

Test Summary

Metric Count
Total Tests 3
✅ Passed 3
❌ Failed 0
⏭️ Skipped 0

Links

  • 🔗 Device Farm Run: View on AWS Device Farm
  • 🔗 Workflow: View Details
  • 📋 Run ARN: arn:aws:devicefarm:us-west-2:833707431398:run:cef7531e-44ed-4ddf-a349-a4b0f72f680d/022bdd42-c7e8-4fe7-9b3a-7c3a2cef2642

Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - iOS

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: iOS
Addon: @qvac/translation-nmtcpp
PR: #1614
Commit: 436e29c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - Android

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: Android
Addon: @qvac/translation-nmtcpp
PR: #1614
Commit: 436e29c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - iOS

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: iOS
Addon: @qvac/translation-nmtcpp
PR: #1614
Commit: 436e29c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - iOS

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: iOS
Addon: @qvac/translation-nmtcpp
PR: #1614
Commit: 436e29c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - Android

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: Android
Addon: @qvac/translation-nmtcpp
PR: #1614
Commit: 436e29c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

@github-actions

Copy link
Copy Markdown
Contributor

❌ E2E Mobile Test Results - Android

Overall Status: FAILED
Device Farm Result: UNKNOWN
Platform: Android
Addon: @qvac/translation-nmtcpp
PR: #1614
Commit: 436e29c

Test Summary

Metric Count
Total Tests 0
✅ Passed 0
❌ Failed 0
⏭️ Skipped 0

Links


Automated E2E mobile testing powered by AWS Device Farm
Tests located in: test/mobile/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants