transcribe-cpp 0.4.0 → 0.4.2
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 +14 -0
- package/dist/_generated.d.ts +1 -1
- package/dist/_generated.js +3 -3
- package/dist/index.js +2 -0
- package/dist/types.d.ts +7 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -12,6 +12,13 @@ A matching prebuilt native package is selected automatically for your
|
|
|
12
12
|
platform (`@transcribe-cpp/<platform>`); there is nothing to compile and no
|
|
13
13
|
environment variables to set.
|
|
14
14
|
|
|
15
|
+
On Windows, the prebuilt libraries are built with the Visual C++ 2022
|
|
16
|
+
toolset and require the
|
|
17
|
+
[Microsoft Visual C++ 2015–2022 Redistributable (x64)](https://aka.ms/vs/17/release/vc_redist.x64.exe)
|
|
18
|
+
version 14.40 or newer. Older runtimes (for example the 2021-era 14.29
|
|
19
|
+
redistributable) crash with a native access violation inside `std::mutex`
|
|
20
|
+
during backend initialization.
|
|
21
|
+
|
|
15
22
|
Upgrading from 0.1? See the
|
|
16
23
|
[0.2 migration guide](https://github.com/handy-computer/transcribe.cpp/blob/main/docs/migrating-to-0.2.md),
|
|
17
24
|
including the replacement of `gpuDevice` with exact device objects.
|
|
@@ -219,6 +226,13 @@ const exact = await TranscribeModel.load("model.gguf", { device: cpu });
|
|
|
219
226
|
loader/driver degrades silently to CPU; an explicit backend that cannot be
|
|
220
227
|
satisfied raises a `BackendError`.
|
|
221
228
|
|
|
229
|
+
Where the device can use host memory (CPU, Metal on Apple silicon), weights are
|
|
230
|
+
memory-mapped from the model file and served from the page cache, which the OS
|
|
231
|
+
can reclaim, instead of being copied into process memory. Don't truncate or
|
|
232
|
+
rewrite a model file in place while it is loaded; write a new file and rename
|
|
233
|
+
it over the old one. `{ noMmap: true }` (or `TRANSCRIBE_NO_MMAP=1`) copies the
|
|
234
|
+
weights instead.
|
|
235
|
+
|
|
222
236
|
## Thread-safety
|
|
223
237
|
|
|
224
238
|
Your JavaScript runs on one thread, but `run`/`feed`/`finalize` dispatch the
|
package/dist/_generated.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const PUBLIC_HEADER_HASH = "
|
|
1
|
+
export declare const PUBLIC_HEADER_HASH = "f99ad4169374b8f3";
|
|
2
2
|
export declare const TRANSCRIBE_OK = 0;
|
|
3
3
|
export declare const TRANSCRIBE_ERR_INVALID_ARG = 1;
|
|
4
4
|
export declare const TRANSCRIBE_ERR_NOT_IMPLEMENTED = 2;
|
package/dist/_generated.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// Stable digest of the ABI surface (structs, enums, macros, layout,
|
|
11
11
|
// prototypes), computed by the Python oracle and pinned here so a header
|
|
12
12
|
// ABI change turns this binding's drift check red for conscious review.
|
|
13
|
-
export const PUBLIC_HEADER_HASH = "
|
|
13
|
+
export const PUBLIC_HEADER_HASH = "f99ad4169374b8f3";
|
|
14
14
|
// === enum constants ===
|
|
15
15
|
export const TRANSCRIBE_OK = 0;
|
|
16
16
|
export const TRANSCRIBE_ERR_INVALID_ARG = 1;
|
|
@@ -149,7 +149,7 @@ export const STRUCT_LAYOUT = {
|
|
|
149
149
|
'transcribe_ext': { size: 16, align: 8, offsets: { 'size': 0, 'kind': 8 } },
|
|
150
150
|
'transcribe_backend_init_params': { size: 24, align: 8, offsets: { 'struct_size': 0, 'artifact_dir': 8, 'allowed_backends': 16 } },
|
|
151
151
|
'transcribe_device_info': { size: 64, align: 8, offsets: { 'struct_size': 0, 'name': 8, 'description': 16, 'kind': 24, 'device_id': 32, 'memory_total': 40, 'memory_free': 48, 'device_type': 56 } },
|
|
152
|
-
'transcribe_model_load_params': { size:
|
|
152
|
+
'transcribe_model_load_params': { size: 32, align: 8, offsets: { 'struct_size': 0, 'backend': 8, 'device': 16, 'no_mmap': 24 } },
|
|
153
153
|
'transcribe_session_params': { size: 24, align: 8, offsets: { 'struct_size': 0, 'n_threads': 8, 'kv_type': 12, 'n_ctx': 16 } },
|
|
154
154
|
'transcribe_run_params': { size: 104, align: 8, offsets: { 'struct_size': 0, 'task': 8, 'timestamps': 12, 'pnc': 16, 'itn': 20, 'diarize': 24, 'language': 32, 'target_language': 40, 'keep_special_tags': 48, 'family': 56, 'spec_k_drafts': 64, 'vocabulary': 72, 'n_vocabulary': 80, 'prompt': 88, 'prefix': 96 } },
|
|
155
155
|
'transcribe_capabilities': { size: 56, align: 8, offsets: { 'struct_size': 0, 'native_sample_rate': 8, 'n_languages': 12, 'languages': 16, 'max_timestamp_kind': 24, 'supports_language_detect': 28, 'supports_translate': 29, 'supports_streaming': 30, 'supports_spec_decode': 31, 'max_audio_ms': 32, 'n_translate_target_languages': 40, 'translate_target_languages': 48 } },
|
|
@@ -220,7 +220,7 @@ export function defineTypes(koffi) {
|
|
|
220
220
|
T['transcribe_ext'] = koffi.struct({ size: 'uint64_t', kind: 'uint32_t' });
|
|
221
221
|
T['transcribe_backend_init_params'] = koffi.struct({ struct_size: 'uint64_t', artifact_dir: 'char *', allowed_backends: 'uint32_t' });
|
|
222
222
|
T['transcribe_device_info'] = koffi.struct({ struct_size: 'uint64_t', name: 'char *', description: 'char *', kind: 'char *', device_id: 'char *', memory_total: 'uint64_t', memory_free: 'uint64_t', device_type: 'int' });
|
|
223
|
-
T['transcribe_model_load_params'] = koffi.struct({ struct_size: 'uint64_t', backend: 'int', device: 'void *' });
|
|
223
|
+
T['transcribe_model_load_params'] = koffi.struct({ struct_size: 'uint64_t', backend: 'int', device: 'void *', no_mmap: 'bool' });
|
|
224
224
|
T['transcribe_session_params'] = koffi.struct({ struct_size: 'uint64_t', n_threads: 'int', kv_type: 'int', n_ctx: 'int32_t' });
|
|
225
225
|
T['transcribe_run_params'] = koffi.struct({ struct_size: 'uint64_t', task: 'int', timestamps: 'int', pnc: 'int', itn: 'int', diarize: 'int', language: 'char *', target_language: 'char *', keep_special_tags: 'bool', family: 'void *', spec_k_drafts: 'int32_t', vocabulary: 'void *', n_vocabulary: 'int32_t', prompt: 'char *', prefix: 'char *' });
|
|
226
226
|
T['transcribe_capabilities'] = koffi.struct({ struct_size: 'uint64_t', native_sample_rate: 'int32_t', n_languages: 'int', languages: 'void *', max_timestamp_kind: 'int', supports_language_detect: 'bool', supports_translate: 'bool', supports_streaming: 'bool', supports_spec_decode: 'bool', max_audio_ms: 'int64_t', n_translate_target_languages: 'int', translate_target_languages: 'void *' });
|
package/dist/index.js
CHANGED
|
@@ -1454,6 +1454,8 @@ export class TranscribeModel {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
p.device = handle;
|
|
1456
1456
|
}
|
|
1457
|
+
if (opts.noMmap)
|
|
1458
|
+
p.no_mmap = true;
|
|
1457
1459
|
const out = [null];
|
|
1458
1460
|
const st = await callAsync(n.F.modelLoadFile, path, p, out);
|
|
1459
1461
|
check(n, st, `loading model ${path}`);
|
package/dist/types.d.ts
CHANGED
|
@@ -119,6 +119,13 @@ export interface ModelOptions {
|
|
|
119
119
|
/** Exact device returned by {@link getAvailableBackends}. Omit for the
|
|
120
120
|
* backend's automatic policy. Exact selection never falls back. */
|
|
121
121
|
device?: BackendInfo;
|
|
122
|
+
/** Copy the weights into memory instead of memory-mapping the model file.
|
|
123
|
+
* Default false: where the device can use host memory (CPU, Metal on Apple
|
|
124
|
+
* silicon) the weights are served from the file's page cache, which the OS
|
|
125
|
+
* can reclaim. Don't truncate or rewrite a mapped model file in place;
|
|
126
|
+
* write a new file and rename it over the old one. The
|
|
127
|
+
* `TRANSCRIBE_NO_MMAP=1` environment variable forces true. */
|
|
128
|
+
noMmap?: boolean;
|
|
122
129
|
}
|
|
123
130
|
export interface SessionOptions {
|
|
124
131
|
/** CPU threads for CPU-side ops; 0 = library default. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "transcribe-cpp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "TypeScript/Node.js bindings for transcribe.cpp — a C/C++ speech-to-text library built on ggml",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -51,11 +51,11 @@
|
|
|
51
51
|
"koffi": "^3.0.2"
|
|
52
52
|
},
|
|
53
53
|
"optionalDependencies": {
|
|
54
|
-
"@transcribe-cpp/darwin-arm64-metal": "0.4.
|
|
55
|
-
"@transcribe-cpp/darwin-x64-cpu": "0.4.
|
|
56
|
-
"@transcribe-cpp/linux-x64-cpu-vulkan": "0.4.
|
|
57
|
-
"@transcribe-cpp/linux-arm64-cpu-vulkan": "0.4.
|
|
58
|
-
"@transcribe-cpp/win32-x64-cpu-vulkan": "0.4.
|
|
54
|
+
"@transcribe-cpp/darwin-arm64-metal": "0.4.2",
|
|
55
|
+
"@transcribe-cpp/darwin-x64-cpu": "0.4.2",
|
|
56
|
+
"@transcribe-cpp/linux-x64-cpu-vulkan": "0.4.2",
|
|
57
|
+
"@transcribe-cpp/linux-arm64-cpu-vulkan": "0.4.2",
|
|
58
|
+
"@transcribe-cpp/win32-x64-cpu-vulkan": "0.4.2"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/node": "^22.0.0",
|