@qvac/translation-nmtcpp 0.19.2 → 0.20.0

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.
package/README.md CHANGED
@@ -288,7 +288,7 @@ const backendSettings = {
288
288
  use_gpu: true, // Enable GPU inference (default: false → CPU-only)
289
289
  gpu_backend: 'vulkan', // Optional: pick a specific backend by name substring
290
290
  gpu_device: 0, // Optional: ordinal within matching devices (default: 0)
291
- backendsDir: './prebuilds', // Optional override of the fabric backends root
291
+ backendsDir: '/abs/path/to/backends', // Optional. Scanned as given; omit to use the backends @qvac/fabric ships
292
292
  openclCacheDir: '/path/ok' // Optional (Android only): OpenCL kernel-cache dir
293
293
  }
294
294
  ```
@@ -300,7 +300,7 @@ The three GPU control keys each accept a camelCase alias alongside the snake_cas
300
300
  | `use_gpu` | `useGPU` | boolean | Enable GPU inference. When `false` (default), only the CPU backend is used. Bergamot is CPU-only by design — this flag is effectively a no-op for Bergamot. |
301
301
  | `gpu_backend` | `gpuBackend` | string | Case-insensitive **substring** match against eligible Vulkan, Metal, OpenCL, or CUDA device names (e.g. `"vulkan"`, `"vulkan0"`, `"opencl"`, `"metal"`). When unset, the default gated selection runs (see [Backends](#backends)). Any explicit selector that resolves to OpenCL bypasses the build-time `USE_OPENCL` guard — an informed opt-in. |
302
302
  | `gpu_device` | `gpuDevice` | int | Ordinal within the matching devices. Defaults to `0` (first match). Example: `{gpu_backend: "vulkan", gpu_device: 1}` picks the second Vulkan adapter. |
303
- | `backendsDir` | — | string | Path to the directory containing the runtime backend shared libraries (`libqvac-ggml-vulkan.so`, etc.). Defaults to the root `@qvac/fabric/backends` resolves on desktop, falling back to this package's `prebuilds/` on mobile, where the package tree isn't resolvable from the packed worklet. Must be an absolute path when set; paths with `..` segments or unresolvable symlinks are rejected with a warning and fall back to that default. |
303
+ | `backendsDir` | — | string | Path to the directory containing the runtime backend shared libraries (`libqvac-ggml-vulkan.so`, etc.). When omitted, the backends `@qvac/fabric` ships are loaded; fabric locates them next to its runtime on every platform. Must be an absolute path when set; paths with `..` segments or unresolvable symlinks are rejected with a warning and fall back to fabric's backends. |
304
304
  | `openclCacheDir` | — | string | **Android only.** Writable directory the OpenCL backend uses for its JIT kernel cache (forwarded via `GGML_OPENCL_CACHE_DIR`). Must be an absolute path; paths with `..` segments are rejected. The OpenCL backend falls back to a non-writable relative path if this is unset, which `ggml_abort()`s during init inside the app sandbox — always provide an app-writable path when exercising OpenCL on Android. |
305
305
 
306
306
  GPU execution is limited to Vulkan, Metal/MTL, OpenCL, and CUDA devices reported as GPU or integrated GPU. RPC, ROCm/HIP, SYCL, MUSA, and unknown backend families fall back to CPU — RPC because translation has no split-mode support and cannot execute over it. CUDA is admitted ahead of its planned Fabric build so that build does not require another selector change. An explicit selector only narrows this eligible set; it cannot enable an unsupported family.
package/binding.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // Pre-load @qvac/fabric so its shared .bare module (the ggml runtime) is
2
2
  // registered with the bare runtime before our addon resolves its DT_NEEDED
3
- // dependency qvac__fabric@0.bare.
3
+ // dependency qvac__fabric-<host>@0.bare (shipped by @qvac/fabric-<host>).
4
4
  require('@qvac/fabric')
5
5
 
6
6
  module.exports = require.addon()
package/index.d.ts CHANGED
@@ -165,9 +165,8 @@ declare namespace TranslationNmtcpp {
165
165
  gpuDevice?: number;
166
166
  /**
167
167
  * Path to the directory containing backend shared libraries
168
- * (libqvac-ggml-vulkan.so, etc.). Defaults to the root `@qvac/fabric/backends`
169
- * resolves on desktop, falling back to this package's `prebuilds/` on mobile where
170
- * the package tree isn't resolvable from the packed worklet.
168
+ * (libqvac-ggml-vulkan.so, etc.). Defaults to the ones @qvac/fabric ships,
169
+ * which it locates itself next to its runtime.
171
170
  */
172
171
  backendsDir?: string;
173
172
  /**
package/index.js CHANGED
@@ -1,9 +1,6 @@
1
1
  "use strict";
2
2
  /* eslint-disable @typescript-eslint/no-require-imports -- Bare modules and @qvac/logging expose CommonJS export shapes. */
3
- const fs = require("bare-fs");
4
- const path = require("bare-path");
5
3
  const QvacLogger = require("@qvac/logging");
6
- const fabricBackends = require("@qvac/fabric/backends");
7
4
  /* eslint-enable @typescript-eslint/no-require-imports */
8
5
  const infer_base_1 = require("@qvac/infer-base");
9
6
  const marian_1 = require("./marian");
@@ -19,22 +16,6 @@ const indic_processor_1 = require("./third-party/indic-processor");
19
16
  const BERGAMOT_TARGET_TOKEN_BY_PAIR = {
20
17
  "en:pt": ">>por<<",
21
18
  };
22
- // The ggml compute backends (GGML_BACKEND_DL modules) ship exactly once, next to
23
- // the @qvac/fabric runtime (<root>/<host>/qvac__fabric). We deliberately do not
24
- // copy them into this addon to avoid duplicating tens of MB per fabric
25
- // consumer. On desktop, @qvac/fabric/backends resolves that root in whichever
26
- // package holds the runtime. On mobile the package tree isn't resolvable at
27
- // runtime (the worklet runs from a packed bundle), so fall back to this addon's
28
- // own prebuilds, where the mobile packaging stages the backends. The native side
29
- // appends BACKENDS_SUBDIR ("<host>/qvac__fabric") to whichever root we return.
30
- function resolveBackendsDir() {
31
- // fabric's resolver only checks that the platform package resolves, not that
32
- // its prebuilds are on disk.
33
- const fabricRoot = fabricBackends.resolveBackendsDir();
34
- if (fabricRoot !== null && fs.existsSync(fabricRoot))
35
- return fabricRoot;
36
- return path.join(__dirname, "prebuilds");
37
- }
38
19
  function isAbsoluteModelPath(modelPath) {
39
20
  return (modelPath.startsWith("/") ||
40
21
  /^[A-Za-z]:[\\/]/.test(modelPath) ||
@@ -133,10 +114,7 @@ const TranslationNmtcpp = class TranslationNmtcpp {
133
114
  normalizeGpuAliases(config);
134
115
  return binding.assessFit({
135
116
  ...request,
136
- config: {
137
- ...config,
138
- backendsDir: request.config.backendsDir ?? resolveBackendsDir(),
139
- },
117
+ config,
140
118
  });
141
119
  }
142
120
  opts;
@@ -338,9 +316,6 @@ const TranslationNmtcpp = class TranslationNmtcpp {
338
316
  // translate camelCase → snake_case here. snake_case takes precedence
339
317
  // when both are present (explicit user choice wins over alias).
340
318
  normalizeGpuAliases(otherConfig);
341
- if (otherConfig.backendsDir === undefined) {
342
- otherConfig.backendsDir = resolveBackendsDir();
343
- }
344
319
  const configurationParams = {
345
320
  path: this._files.model,
346
321
  config: otherConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qvac/translation-nmtcpp",
3
- "version": "0.19.2",
3
+ "version": "0.20.0",
4
4
  "description": "translation addon for qvac",
5
5
  "addon": true,
6
6
  "engines": {
@@ -78,14 +78,14 @@
78
78
  "bugs": "https://github.com/tetherto/qvac/issues",
79
79
  "homepage": "https://qvac.tether.io",
80
80
  "devDependencies": {
81
- "@qvac/fabric-android-arm64": "^0.20.0",
82
- "@qvac/fabric-ios": "^0.20.0",
81
+ "@qvac/fabric-android-arm64": "0.21.1",
82
+ "@qvac/fabric-ios": "0.21.1",
83
83
  "@qvac/registry-client": "^0.6.1",
84
84
  "@types/node": "^24.2.1",
85
85
  "bare-fetch": "^3.0.1",
86
86
  "bare-stream": "^2.7.0",
87
87
  "brittle": "^3.4.0",
88
- "cmake-bare": "^1.7.5",
88
+ "cmake-bare": "^1.9.0",
89
89
  "cmake-vcpkg": "^1.1.0",
90
90
  "eslint": "^9.39.4",
91
91
  "eslint-import-resolver-typescript": "^4.4.5",
@@ -98,7 +98,7 @@
98
98
  },
99
99
  "dependencies": {
100
100
  "@qvac/error": "^0.1.0",
101
- "@qvac/fabric": "^0.20.0",
101
+ "@qvac/fabric": "^0.21.1",
102
102
  "@qvac/infer-base": "^0.6.2",
103
103
  "@qvac/logging": "^0.1.0",
104
104
  "bare-fs": "^4.5.1",
@@ -107,12 +107,27 @@
107
107
  "bare-process": "^4.2.2",
108
108
  "bare-url": "^2.1.6"
109
109
  },
110
+ "optionalDependencies": {
111
+ "@qvac/fabric-linux-x64": "^0.21.1",
112
+ "@qvac/fabric-linux-arm64": "^0.21.1",
113
+ "@qvac/fabric-darwin-arm64": "^0.21.1",
114
+ "@qvac/fabric-darwin-x64": "^0.21.1",
115
+ "@qvac/fabric-win32-x64": "^0.21.1"
116
+ },
110
117
  "peerDependencies": {
111
- "bare-fetch": "^3.0.1"
118
+ "bare-fetch": "^3.0.1",
119
+ "@qvac/fabric-android-arm64": "^0.21.1",
120
+ "@qvac/fabric-ios": "^0.21.1"
112
121
  },
113
122
  "peerDependenciesMeta": {
114
123
  "bare-fetch": {
115
124
  "optional": true
125
+ },
126
+ "@qvac/fabric-android-arm64": {
127
+ "optional": true
128
+ },
129
+ "@qvac/fabric-ios": {
130
+ "optional": true
116
131
  }
117
132
  },
118
133
  "exports": {
@@ -7,7 +7,7 @@
7
7
  ],
8
8
  "current_versions": [
9
9
  {
10
- "version": "0.19.2"
10
+ "version": "0.20"
11
11
  }
12
12
  ],
13
13
  "exported_symbols": [
@@ -7,7 +7,7 @@
7
7
  ],
8
8
  "current_versions": [
9
9
  {
10
- "version": "0.19.2"
10
+ "version": "0.20"
11
11
  }
12
12
  ],
13
13
  "exported_symbols": [
@@ -7,7 +7,7 @@
7
7
  ],
8
8
  "current_versions": [
9
9
  {
10
- "version": "0.19.2"
10
+ "version": "0.20"
11
11
  }
12
12
  ],
13
13
  "exported_symbols": [
@@ -7,7 +7,7 @@
7
7
  ],
8
8
  "current_versions": [
9
9
  {
10
- "version": "0.19.2"
10
+ "version": "0.20"
11
11
  }
12
12
  ],
13
13
  "exported_symbols": [
@@ -7,7 +7,7 @@
7
7
  ],
8
8
  "current_versions": [
9
9
  {
10
- "version": "0.19.2"
10
+ "version": "0.20"
11
11
  }
12
12
  ],
13
13
  "exported_symbols": [