Skip to content

QVAC-16464 feat[api]: update SDK nmtcpp plugin for @qvac/translation-nmtcpp 2.0.1#1563

Merged
RamazTs merged 6 commits into
tetherto:mainfrom
RamazTs:QVAC-16464_sdk-nmtcpp-plugin-update-removal-of-fs-loader
Apr 22, 2026
Merged

QVAC-16464 feat[api]: update SDK nmtcpp plugin for @qvac/translation-nmtcpp 2.0.1#1563
RamazTs merged 6 commits into
tetherto:mainfrom
RamazTs:QVAC-16464_sdk-nmtcpp-plugin-update-removal-of-fs-loader

Conversation

@RamazTs

@RamazTs RamazTs commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

The @qvac/translation-nmtcpp addon was migrated to v2.0.1, removing the loader/WeightsProvider abstraction. The addon now takes a files object with resolved file paths instead of loader/diskPath/modelName. The SDK NMT plugin was still using the old 1.x interface and couldn't work with the new addon.

Additionally, the SDK's model-registry.ts imported BaseInference from @qvac/infer-base to define AnyModel, which caused SDK-wide type resolution failures when the new addon's dependency on @qvac/infer-base@^0.4.0 conflicted with other addons' versions.

How does it solve it?

NMT plugin migration (nmtcpp-translation/plugin.ts):

  • Removed FilesystemDL, asLoader, parseModelPath, Loader type
  • Build files object from resolved artifact paths (model, vocabs, pivot)
  • Pivot config moved from bergamotPivotModel (with loader/paths) to config.pivotConfig (generation params only) + files.pivotModel/pivotSrcVocab/pivotDstVocab
  • Single-arg constructor: new TranslationNmtcpp({ files, params, config, logger, opts })
  • Returns loader: null (full PluginModelResult.loader removal deferred to after all addons migrate)

SDK type cleanup (model-registry.ts):

  • Removed BaseInference import from @qvac/infer-base — eliminates the SDK's only direct dependency on that package
  • AnyModel is now a standalone interface with only what the registry/ops layer uses: load(), run(), unload?(), reload?()
  • PluginModel (schemas) stays minimal: load(), unload?() — the plugin contract

Dependency bump (package.json):

  • @qvac/translation-nmtcpp: ^0.6.1^2.0.1

New API

// NMT addon constructor (2.0.1) — called by SDK plugin
new TranslationNmtcpp({
  files: {
    model: '/path/to/model.bin',
    srcVocab: '/path/to/vocab.spm',
    dstVocab: '/path/to/vocab.spm',
    pivotModel: '/path/to/pivot.bin',       // optional
    pivotSrcVocab: '/path/to/pivot-vocab.spm', // optional
    pivotDstVocab: '/path/to/pivot-vocab.spm', // optional
  },
  params: { srcLang: 'en', dstLang: 'fr' },
  config: {
    modelType: TranslationNmtcpp.ModelTypes.Bergamot,
    beamsize: 4,
    pivotConfig: { beamsize: 4, topk: 100 }, // optional
  },
  logger,
  opts: { stats: true },
})

How was it tested?

  • bun run build — clean
  • bun run lint — clean (eslint + tsc)
  • bun run test:unit — all pass
  • bun run bare:example examples/translation/translation-bergamot.ts — EN→FR ✅
  • bun run bare:example examples/translation/translation-bergamot-batch.ts — batch 4 texts ✅
  • bun run bare:example examples/translation/translation-bergamot-pivot.ts — ES→EN→IT pivot ✅
  • bun run bare:example examples/translation/translation-indic.ts — EN→HI IndicTrans ✅

….1, which moves away from base inference inheritance
olyasir
olyasir previously approved these changes Apr 14, 2026
Comment thread packages/sdk/server/bare/ops/cancel.ts Outdated
@github-actions

github-actions Bot commented Apr 14, 2026

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.*

@gianni-cor gianni-cor left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also remove any change not related to translation addon. those will be addressed by other teams

Reverts non-NMT changes (model-registry, cancel, embed, transcribe,
translate, completion-stream, ocr-stream, text-to-speech, diffusion)
back to their original state. Those broader SDK type changes will be
addressed by other teams.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…pp-plugin-update-removal-of-fs-loader

# Conflicts:
#	packages/sdk/bun.lock
#	packages/sdk/package.json
@RamazTs

RamazTs commented Apr 22, 2026

Copy link
Copy Markdown
Contributor Author

/review

@RamazTs RamazTs merged commit 7589a8e into tetherto:main Apr 22, 2026
16 checks passed
Proletter pushed a commit that referenced this pull request May 24, 2026
…nmtcpp 2.0.1 (#1563)

feat: update SDK NMTCPP plugin to support  @qvac/translaton-nmtcpp@2.0.1, which moves away from base inference inheritance
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.

4 participants