@huggingface/transformers 4.0.0-next.6 → 4.0.0-next.8
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 +16 -2
- package/dist/ort-wasm-simd-threaded.jsep.mjs +24 -24
- package/dist/transformers.js +2255 -931
- package/dist/transformers.min.js +19 -19
- package/dist/transformers.node.cjs +2300 -934
- package/dist/transformers.node.min.cjs +20 -20
- package/dist/transformers.node.min.mjs +20 -20
- package/dist/transformers.node.mjs +2336 -1012
- package/dist/transformers.web.js +2327 -1003
- package/dist/transformers.web.min.js +17 -17
- package/package.json +4 -4
- package/src/cache_utils.js +62 -0
- package/src/configs.js +45 -24
- package/src/env.js +8 -1
- package/src/image_processors_utils.js +27 -17
- package/src/models/chatterbox/modeling_chatterbox.js +1 -1
- package/src/models/chmv2/image_processing_chmv2.js +3 -0
- package/src/models/chmv2/modeling_chmv2.js +4 -0
- package/src/models/deepseek_v3/modeling_deepseek_v3.js +5 -0
- package/src/models/detr/image_processing_detr.js +1 -1
- package/src/models/eurobert/modeling_eurobert.js +41 -0
- package/src/models/feature_extractors.js +2 -0
- package/src/models/gemma3n/modeling_gemma3n.js +2 -0
- package/src/models/glm46v/image_processing_glm46v.js +12 -0
- package/src/models/glm46v/processing_glm46v.js +5 -0
- package/src/models/glm_moe_dsa/modeling_glm_moe_dsa.js +5 -0
- package/src/models/glm_ocr/modeling_glm_ocr.js +78 -0
- package/src/models/granite_speech/feature_extraction_granite_speech.js +58 -0
- package/src/models/granite_speech/modeling_granite_speech.js +5 -0
- package/src/models/granite_speech/processing_granite_speech.js +62 -0
- package/src/models/grounding_dino/image_processing_grounding_dino.js +1 -1
- package/src/models/idefics3/modeling_idefics3.js +5 -32
- package/src/models/image_processors.js +3 -0
- package/src/models/lfm2_vl/image_processing_lfm2_vl.js +305 -0
- package/src/models/lfm2_vl/modeling_lfm2_vl.js +13 -0
- package/src/models/lfm2_vl/processing_lfm2_vl.js +77 -0
- package/src/models/lighton_ocr/modeling_lighton_ocr.js +3 -0
- package/src/models/llava/modeling_llava.js +1 -1
- package/src/models/mistral3/modeling_mistral3.js +2 -2
- package/src/models/mistral4/modeling_mistral4.js +5 -0
- package/src/models/modeling_utils.js +224 -308
- package/src/models/models.js +14 -1
- package/src/models/nemotron_h/modeling_nemotron_h.js +5 -0
- package/src/models/paligemma/modeling_paligemma.js +2 -25
- package/src/models/processors.js +4 -0
- package/src/models/qwen2_5_vl/modeling_qwen2_5_vl.js +5 -1
- package/src/models/qwen2_vl/image_processing_qwen2_vl.js +1 -41
- package/src/models/qwen2_vl/modeling_qwen2_vl.js +194 -143
- package/src/models/qwen2_vl/processing_qwen2_vl.js +5 -4
- package/src/models/qwen3_5/modeling_qwen3_5.js +1 -0
- package/src/models/qwen3_5_moe/modeling_qwen3_5_moe.js +2 -1
- package/src/models/qwen3_vl/modeling_qwen3_vl.js +2 -1
- package/src/models/qwen3_vl_moe/modeling_qwen3_vl_moe.js +2 -1
- package/src/models/registry.js +42 -0
- package/src/models/sam/image_processing_sam.js +1 -1
- package/src/models/session.js +17 -6
- package/src/models/smolvlm/modeling_smolvlm.js +7 -0
- package/src/models/solar_open/modeling_solar_open.js +5 -0
- package/src/models/ultravox/modeling_ultravox.js +1 -3
- package/src/models/voxtral/modeling_voxtral.js +3 -0
- package/src/models/voxtral_realtime/feature_extraction_voxtral_realtime.js +71 -0
- package/src/models/voxtral_realtime/modeling_voxtral_realtime.js +239 -0
- package/src/models/voxtral_realtime/processing_voxtral_realtime.js +113 -0
- package/src/models/whisper/feature_extraction_whisper.js +2 -12
- package/src/pipelines.js +1 -0
- package/src/transformers.js +2 -0
- package/src/utils/audio.js +18 -2
- package/src/utils/cache/CrossOriginStorageCache.js +251 -0
- package/src/utils/cache/cross-origin-storage.d.ts +38 -0
- package/src/utils/cache.js +5 -0
- package/src/utils/hub.js +4 -1
- package/src/utils/lru_cache.js +67 -0
- package/src/utils/memoize_promise.js +45 -0
- package/src/utils/model_registry/get_file_metadata.js +15 -2
- package/src/utils/model_registry/get_model_files.js +52 -78
- package/src/utils/tensor.js +18 -2
- package/types/cache_utils.d.ts +29 -0
- package/types/cache_utils.d.ts.map +1 -0
- package/types/configs.d.ts.map +1 -1
- package/types/env.d.ts +8 -0
- package/types/env.d.ts.map +1 -1
- package/types/image_processors_utils.d.ts +18 -1
- package/types/image_processors_utils.d.ts.map +1 -1
- package/types/models/{ast/modeling_ast.d.ts → audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.d.ts} +1 -1
- package/types/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.d.ts.map +1 -0
- package/types/models/chmv2/image_processing_chmv2.d.ts +4 -0
- package/types/models/chmv2/image_processing_chmv2.d.ts.map +1 -0
- package/types/models/chmv2/modeling_chmv2.d.ts +6 -0
- package/types/models/chmv2/modeling_chmv2.d.ts.map +1 -0
- package/types/models/deepseek_v3/modeling_deepseek_v3.d.ts +8 -0
- package/types/models/deepseek_v3/modeling_deepseek_v3.d.ts.map +1 -0
- package/types/models/detr/image_processing_detr.d.ts +1 -1
- package/types/models/eurobert/modeling_eurobert.d.ts +36 -0
- package/types/models/eurobert/modeling_eurobert.d.ts.map +1 -0
- package/types/models/feature_extractors.d.ts +2 -0
- package/types/models/gemma3n/modeling_gemma3n.d.ts +2 -0
- package/types/models/gemma3n/modeling_gemma3n.d.ts.map +1 -1
- package/types/models/glm46v/image_processing_glm46v.d.ts +4 -0
- package/types/models/glm46v/image_processing_glm46v.d.ts.map +1 -0
- package/types/models/glm46v/processing_glm46v.d.ts +4 -0
- package/types/models/glm46v/processing_glm46v.d.ts.map +1 -0
- package/types/models/glm_moe_dsa/modeling_glm_moe_dsa.d.ts +8 -0
- package/types/models/glm_moe_dsa/modeling_glm_moe_dsa.d.ts.map +1 -0
- package/types/models/glm_ocr/modeling_glm_ocr.d.ts +26 -0
- package/types/models/glm_ocr/modeling_glm_ocr.d.ts.map +1 -0
- package/types/models/granite_speech/feature_extraction_granite_speech.d.ts +16 -0
- package/types/models/granite_speech/feature_extraction_granite_speech.d.ts.map +1 -0
- package/types/models/granite_speech/modeling_granite_speech.d.ts +4 -0
- package/types/models/granite_speech/modeling_granite_speech.d.ts.map +1 -0
- package/types/models/granite_speech/processing_granite_speech.d.ts +19 -0
- package/types/models/granite_speech/processing_granite_speech.d.ts.map +1 -0
- package/types/models/grounding_dino/image_processing_grounding_dino.d.ts +1 -1
- package/types/models/idefics3/modeling_idefics3.d.ts +2 -18
- package/types/models/idefics3/modeling_idefics3.d.ts.map +1 -1
- package/types/models/image_processors.d.ts +3 -0
- package/types/models/lfm2_vl/image_processing_lfm2_vl.d.ts +41 -0
- package/types/models/lfm2_vl/image_processing_lfm2_vl.d.ts.map +1 -0
- package/types/models/lfm2_vl/modeling_lfm2_vl.d.ts +4 -0
- package/types/models/lfm2_vl/modeling_lfm2_vl.d.ts.map +1 -0
- package/types/models/lfm2_vl/processing_lfm2_vl.d.ts +18 -0
- package/types/models/lfm2_vl/processing_lfm2_vl.d.ts.map +1 -0
- package/types/models/lighton_ocr/modeling_lighton_ocr.d.ts +4 -0
- package/types/models/lighton_ocr/modeling_lighton_ocr.d.ts.map +1 -0
- package/types/models/mistral3/modeling_mistral3.d.ts +2 -2
- package/types/models/mistral3/modeling_mistral3.d.ts.map +1 -1
- package/types/models/mistral4/modeling_mistral4.d.ts +8 -0
- package/types/models/mistral4/modeling_mistral4.d.ts.map +1 -0
- package/types/models/modeling_utils.d.ts +44 -35
- package/types/models/modeling_utils.d.ts.map +1 -1
- package/types/models/models.d.ts +14 -1
- package/types/models/nemotron_h/modeling_nemotron_h.d.ts +8 -0
- package/types/models/nemotron_h/modeling_nemotron_h.d.ts.map +1 -0
- package/types/models/paligemma/modeling_paligemma.d.ts +2 -8
- package/types/models/paligemma/modeling_paligemma.d.ts.map +1 -1
- package/types/models/processors.d.ts +4 -0
- package/types/models/qwen2_5_vl/modeling_qwen2_5_vl.d.ts +3 -0
- package/types/models/qwen2_5_vl/modeling_qwen2_5_vl.d.ts.map +1 -1
- package/types/models/qwen2_vl/image_processing_qwen2_vl.d.ts.map +1 -1
- package/types/models/qwen2_vl/modeling_qwen2_vl.d.ts +43 -6
- package/types/models/qwen2_vl/modeling_qwen2_vl.d.ts.map +1 -1
- package/types/models/qwen2_vl/processing_qwen2_vl.d.ts +1 -0
- package/types/models/qwen2_vl/processing_qwen2_vl.d.ts.map +1 -1
- package/types/models/qwen3_5/modeling_qwen3_5.d.ts +2 -0
- package/types/models/qwen3_5/modeling_qwen3_5.d.ts.map +1 -1
- package/types/models/qwen3_5_moe/modeling_qwen3_5_moe.d.ts +3 -0
- package/types/models/qwen3_5_moe/modeling_qwen3_5_moe.d.ts.map +1 -1
- package/types/models/qwen3_vl/modeling_qwen3_vl.d.ts +3 -0
- package/types/models/qwen3_vl/modeling_qwen3_vl.d.ts.map +1 -1
- package/types/models/qwen3_vl_moe/modeling_qwen3_vl_moe.d.ts +3 -0
- package/types/models/qwen3_vl_moe/modeling_qwen3_vl_moe.d.ts.map +1 -1
- package/types/models/registry.d.ts.map +1 -1
- package/types/models/sam/image_processing_sam.d.ts +1 -1
- package/types/models/session.d.ts +3 -2
- package/types/models/session.d.ts.map +1 -1
- package/types/models/smolvlm/modeling_smolvlm.d.ts +8 -0
- package/types/models/smolvlm/modeling_smolvlm.d.ts.map +1 -0
- package/types/models/solar_open/modeling_solar_open.d.ts +8 -0
- package/types/models/solar_open/modeling_solar_open.d.ts.map +1 -0
- package/types/models/ultravox/modeling_ultravox.d.ts +0 -2
- package/types/models/ultravox/modeling_ultravox.d.ts.map +1 -1
- package/types/models/voxtral/modeling_voxtral.d.ts +4 -0
- package/types/models/voxtral/modeling_voxtral.d.ts.map +1 -0
- package/types/models/voxtral_realtime/feature_extraction_voxtral_realtime.d.ts +28 -0
- package/types/models/voxtral_realtime/feature_extraction_voxtral_realtime.d.ts.map +1 -0
- package/types/models/voxtral_realtime/modeling_voxtral_realtime.d.ts +17 -0
- package/types/models/voxtral_realtime/modeling_voxtral_realtime.d.ts.map +1 -0
- package/types/models/voxtral_realtime/processing_voxtral_realtime.d.ts +44 -0
- package/types/models/voxtral_realtime/processing_voxtral_realtime.d.ts.map +1 -0
- package/types/models/whisper/feature_extraction_whisper.d.ts.map +1 -1
- package/types/pipelines.d.ts +1 -0
- package/types/pipelines.d.ts.map +1 -1
- package/types/transformers.d.ts +1 -0
- package/types/transformers.d.ts.map +1 -1
- package/types/utils/audio.d.ts +5 -2
- package/types/utils/audio.d.ts.map +1 -1
- package/types/utils/cache/CrossOriginStorageCache.d.ts +120 -0
- package/types/utils/cache/CrossOriginStorageCache.d.ts.map +1 -0
- package/types/utils/cache.d.ts.map +1 -1
- package/types/utils/dtypes.d.ts +1 -1
- package/types/utils/hub.d.ts.map +1 -1
- package/types/utils/image.d.ts +1 -1
- package/types/utils/lru_cache.d.ts +38 -0
- package/types/utils/lru_cache.d.ts.map +1 -0
- package/types/utils/memoize_promise.d.ts +14 -0
- package/types/utils/memoize_promise.d.ts.map +1 -0
- package/types/utils/model_registry/get_file_metadata.d.ts.map +1 -1
- package/types/utils/model_registry/get_model_files.d.ts +1 -0
- package/types/utils/model_registry/get_model_files.d.ts.map +1 -1
- package/types/utils/tensor.d.ts.map +1 -1
- package/src/utils/data-structures.js +0 -572
- package/types/models/ast/modeling_ast.d.ts.map +0 -1
- package/types/utils/data-structures.d.ts +0 -294
- package/types/utils/data-structures.d.ts.map +0 -1
- /package/src/models/{ast/modeling_ast.js → audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.js} +0 -0
|
@@ -1,10 +1,48 @@
|
|
|
1
1
|
import { DEFAULT_DTYPE_SUFFIX_MAPPING, selectDtype } from '../dtypes.js';
|
|
2
2
|
import { selectDevice } from '../devices.js';
|
|
3
3
|
import { resolveExternalDataFormat, getExternalDataChunkNames } from '../model-loader.js';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
MODEL_TYPES,
|
|
6
|
+
MODEL_TYPE_MAPPING,
|
|
7
|
+
MODEL_MAPPING_NAMES,
|
|
8
|
+
getSessionsConfig,
|
|
9
|
+
} from '../../models/modeling_utils.js';
|
|
5
10
|
import { AutoConfig } from '../../configs.js';
|
|
6
11
|
import { GITHUB_ISSUE_URL } from '../constants.js';
|
|
7
12
|
import { logger } from '../logger.js';
|
|
13
|
+
import { memoizePromise } from '../memoize_promise.js';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {import('../../configs.js').PretrainedConfig} PretrainedConfig
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Returns a memoized AutoConfig for the given model ID and options.
|
|
21
|
+
* If the same model ID and options have been requested before — even while
|
|
22
|
+
* the first request is still in-flight — the cached promise is returned
|
|
23
|
+
* so that config.json is only fetched once.
|
|
24
|
+
* When a pre-loaded `config` object is supplied the result is not memoized,
|
|
25
|
+
* since the caller already has the config and no network operation is performed.
|
|
26
|
+
*
|
|
27
|
+
* @param {string} modelId The model id (e.g., "onnx-community/granite-4.0-350m-ONNX-web")
|
|
28
|
+
* @param {Object} [options]
|
|
29
|
+
* @param {PretrainedConfig|null} [options.config=null] Pre-loaded config; skips fetching if provided.
|
|
30
|
+
* @param {string|null} [options.cache_dir=null] Custom local cache directory.
|
|
31
|
+
* @param {boolean} [options.local_files_only=false] Never hit the network if true.
|
|
32
|
+
* @param {string} [options.revision='main'] Git branch, tag, or commit SHA.
|
|
33
|
+
* @returns {Promise<PretrainedConfig>}
|
|
34
|
+
*/
|
|
35
|
+
function get_config(modelId, { config = null, cache_dir = null, local_files_only = false, revision = 'main' } = {}) {
|
|
36
|
+
// When a pre-loaded config is provided, skip memoization — no fetch occurs
|
|
37
|
+
// and there is no meaningful key to deduplicate on.
|
|
38
|
+
if (config !== null) {
|
|
39
|
+
return AutoConfig.from_pretrained(modelId, { config, cache_dir, local_files_only, revision });
|
|
40
|
+
}
|
|
41
|
+
const key = JSON.stringify([modelId, cache_dir, local_files_only, revision]);
|
|
42
|
+
return memoizePromise(key, () =>
|
|
43
|
+
AutoConfig.from_pretrained(modelId, { config, cache_dir, local_files_only, revision }),
|
|
44
|
+
);
|
|
45
|
+
}
|
|
8
46
|
|
|
9
47
|
/**
|
|
10
48
|
* Returns the list of files that will be loaded for a model based on its configuration.
|
|
@@ -25,7 +63,7 @@ export async function get_model_files(
|
|
|
25
63
|
modelId,
|
|
26
64
|
{ config = null, dtype: overrideDtype = null, device: overrideDevice = null, model_file_name = null } = {},
|
|
27
65
|
) {
|
|
28
|
-
config = await
|
|
66
|
+
config = await get_config(modelId, { config });
|
|
29
67
|
|
|
30
68
|
const files = [
|
|
31
69
|
// Add config.json (always loaded)
|
|
@@ -110,83 +148,19 @@ export async function get_model_files(
|
|
|
110
148
|
}
|
|
111
149
|
};
|
|
112
150
|
|
|
113
|
-
//
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
add_model_file('model', 'encoder_model');
|
|
126
|
-
add_model_file('decoder_model_merged');
|
|
127
|
-
// Note: generation_config.json is only loaded for generation models (e.g., T5ForConditionalGeneration)
|
|
128
|
-
// not for base models (e.g., T5Model). Since we can't determine the specific class here,
|
|
129
|
-
// we include it as it's loaded for most use cases.
|
|
130
|
-
files.push('generation_config.json');
|
|
131
|
-
} else if (modelType === MODEL_TYPES.MaskGeneration) {
|
|
132
|
-
add_model_file('model', 'vision_encoder');
|
|
133
|
-
add_model_file('prompt_encoder_mask_decoder');
|
|
134
|
-
} else if (modelType === MODEL_TYPES.EncoderDecoder) {
|
|
135
|
-
add_model_file('model', 'encoder_model');
|
|
136
|
-
add_model_file('decoder_model_merged');
|
|
137
|
-
} else if (modelType === MODEL_TYPES.ImageTextToText) {
|
|
138
|
-
add_model_file('embed_tokens');
|
|
139
|
-
add_model_file('vision_encoder');
|
|
140
|
-
add_model_file('decoder_model_merged');
|
|
141
|
-
if (config.is_encoder_decoder) {
|
|
142
|
-
add_model_file('model', 'encoder_model');
|
|
151
|
+
// Get session configuration from the shared source of truth
|
|
152
|
+
const { sessions, optional_configs } = getSessionsConfig(modelType, config, { model_file_name });
|
|
153
|
+
|
|
154
|
+
// Add model files based on sessions
|
|
155
|
+
for (const [sessionKey, baseName] of Object.entries(sessions)) {
|
|
156
|
+
add_model_file(sessionKey, baseName);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Add optional config files
|
|
160
|
+
if (optional_configs) {
|
|
161
|
+
for (const configFile of Object.values(optional_configs)) {
|
|
162
|
+
files.push(configFile);
|
|
143
163
|
}
|
|
144
|
-
files.push('generation_config.json');
|
|
145
|
-
} else if (modelType === MODEL_TYPES.AudioTextToText) {
|
|
146
|
-
add_model_file('embed_tokens');
|
|
147
|
-
add_model_file('audio_encoder');
|
|
148
|
-
add_model_file('decoder_model_merged');
|
|
149
|
-
files.push('generation_config.json');
|
|
150
|
-
} else if (modelType === MODEL_TYPES.ImageAudioTextToText) {
|
|
151
|
-
add_model_file('embed_tokens');
|
|
152
|
-
add_model_file('audio_encoder');
|
|
153
|
-
add_model_file('vision_encoder');
|
|
154
|
-
add_model_file('decoder_model_merged');
|
|
155
|
-
files.push('generation_config.json');
|
|
156
|
-
} else if (modelType === MODEL_TYPES.Musicgen) {
|
|
157
|
-
add_model_file('model', 'text_encoder');
|
|
158
|
-
add_model_file('decoder_model_merged');
|
|
159
|
-
add_model_file('encodec_decode');
|
|
160
|
-
files.push('generation_config.json');
|
|
161
|
-
} else if (modelType === MODEL_TYPES.MultiModality) {
|
|
162
|
-
add_model_file('prepare_inputs_embeds');
|
|
163
|
-
add_model_file('model', 'language_model');
|
|
164
|
-
add_model_file('lm_head');
|
|
165
|
-
add_model_file('gen_head');
|
|
166
|
-
add_model_file('gen_img_embeds');
|
|
167
|
-
add_model_file('image_decode');
|
|
168
|
-
files.push('generation_config.json');
|
|
169
|
-
} else if (modelType === MODEL_TYPES.Phi3V) {
|
|
170
|
-
add_model_file('prepare_inputs_embeds');
|
|
171
|
-
add_model_file('model');
|
|
172
|
-
add_model_file('vision_encoder');
|
|
173
|
-
files.push('generation_config.json');
|
|
174
|
-
} else if (modelType === MODEL_TYPES.Chatterbox) {
|
|
175
|
-
add_model_file('embed_tokens');
|
|
176
|
-
add_model_file('speech_encoder');
|
|
177
|
-
add_model_file('model', 'language_model');
|
|
178
|
-
add_model_file('conditional_decoder');
|
|
179
|
-
files.push('generation_config.json');
|
|
180
|
-
} else if (modelType === MODEL_TYPES.AutoEncoder) {
|
|
181
|
-
add_model_file('encoder_model');
|
|
182
|
-
add_model_file('decoder_model');
|
|
183
|
-
} else if (modelType === MODEL_TYPES.Supertonic) {
|
|
184
|
-
add_model_file('text_encoder');
|
|
185
|
-
add_model_file('latent_denoiser');
|
|
186
|
-
add_model_file('voice_decoder');
|
|
187
|
-
} else {
|
|
188
|
-
// MODEL_TYPES.EncoderOnly or unknown
|
|
189
|
-
add_model_file('model', singleModelName);
|
|
190
164
|
}
|
|
191
165
|
|
|
192
166
|
return files;
|
package/src/utils/tensor.js
CHANGED
|
@@ -506,11 +506,27 @@ export class Tensor {
|
|
|
506
506
|
}
|
|
507
507
|
|
|
508
508
|
const this_data = this.data;
|
|
509
|
-
const
|
|
509
|
+
const is_bigint = this_data instanceof BigInt64Array || this_data instanceof BigUint64Array;
|
|
510
|
+
|
|
511
|
+
if (is_bigint && p !== 1) {
|
|
512
|
+
throw Error(`Expected a floating point tensor as input. Got ${this.type}`);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
let fn, zero;
|
|
516
|
+
if (is_bigint) {
|
|
517
|
+
fn = (/** @type {bigint} */ a, /** @type {bigint} */ b) => a + b;
|
|
518
|
+
zero = 0n;
|
|
519
|
+
} else {
|
|
520
|
+
fn = (/** @type {number} */ a, /** @type {number} */ b) => a + b ** p;
|
|
521
|
+
zero = 0;
|
|
522
|
+
}
|
|
510
523
|
|
|
511
524
|
if (dim === null) {
|
|
512
525
|
// @ts-ignore
|
|
513
|
-
|
|
526
|
+
let val = this_data.reduce(fn, zero);
|
|
527
|
+
if (p !== 1) {
|
|
528
|
+
val = val ** (1 / p);
|
|
529
|
+
}
|
|
514
530
|
return new Tensor(this.type, [val], []);
|
|
515
531
|
}
|
|
516
532
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type DynamicCache = _DynamicCache & Record<string, Tensor>;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {_DynamicCache & Record<string, Tensor>} DynamicCache
|
|
4
|
+
*/
|
|
5
|
+
export const DynamicCache: new (entries?: Record<string, Tensor>) => DynamicCache;
|
|
6
|
+
/**
|
|
7
|
+
* A cache class that stores past key values as named tensors.
|
|
8
|
+
*/
|
|
9
|
+
declare class _DynamicCache {
|
|
10
|
+
/**
|
|
11
|
+
* Create a DynamicCache, optionally pre-populated with entries.
|
|
12
|
+
* @param {Record<string, Tensor>} [entries] Initial name→Tensor mappings.
|
|
13
|
+
*/
|
|
14
|
+
constructor(entries?: Record<string, Tensor>);
|
|
15
|
+
/**
|
|
16
|
+
* Get the cached sequence length. This requires at least one attention cache entry to be present.
|
|
17
|
+
* @returns {number} The past sequence length.
|
|
18
|
+
*/
|
|
19
|
+
get_seq_length(): number;
|
|
20
|
+
/**
|
|
21
|
+
* Dispose all contained tensors whose data resides on the GPU.
|
|
22
|
+
* Returns a promise that resolves when all disposals are complete.
|
|
23
|
+
* @returns {Promise<void>} Promise that resolves when all GPU tensors are disposed.
|
|
24
|
+
*/
|
|
25
|
+
dispose(): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
import { Tensor } from './utils/tensor.js';
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=cache_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache_utils.d.ts","sourceRoot":"","sources":["../src/cache_utils.js"],"names":[],"mappings":"2BAwDa,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;AADnD;;GAEG;AAEH,2BAAuC,KAAK,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,YAAY,CAE3F;AA3DF;;GAEG;AACH;IACI;;;OAGG;IACH,sBAFW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAchC;IAED;;;OAGG;IACH,kBAFa,MAAM,CAWlB;IAED;;;;OAIG;IACH,WAFa,OAAO,CAAC,IAAI,CAAC,CAUzB;CACJ;uBArDsB,mBAAmB"}
|
package/types/configs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../src/configs.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"configs.d.ts","sourceRoot":"","sources":["../src/configs.js"],"names":[],"mappings":"AA+SA;;;;GAIG;AACH,uCAHW,gBAAgB,iBACd,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CA2HpC;AA8ED;;;GAGG;AACH;IAwBI;;;;;;;;OAQG;IACH,sDANW,MAAM,yEACN,iBAAiB,GAGf,OAAO,CAAC,gBAAgB,CAAC,CAoBrC;IApCD;;;OAGG;IACH,6BAGC;IAnBD,0BAA0B;IAC1B,YADW,MAAM,GAAC,IAAI,CACJ;IAElB,sBAAsB;IACtB,oBADW,OAAO,CACS;IAE3B,qBAAqB;IACrB,yBADW,MAAM,CACO;IAExB,mCAAmC;IACnC,0BADW,oBAAoB,CACN;IAQrB,uBAAkD;CA+BzD;AAED;;;;;GAKG;AACH;IApCI;;;;;;;;OAQG;IACH,sDANW,MAAM,yEACN,iBAAiB,GAGf,OAAO,CAAC,gBAAgB,CAAC,CAoBrC;CAcJ;gCAhiBY,OAAO,gBAAgB,EAAE,iBAAiB;+BAI1C,OAAO,iBAAiB,EAAE,gBAAgB;2BAI1C,OAAO,iBAAiB,EAAE,YAAY;;;;;;;;oBA6hBrC,MAAM,CAAC,OAAO,oBAAoB,EAAE,UAAU,EAAE,YAAY,CAAC;;;;qBAC7D,OAAO,mBAAmB,EAAE,QAAQ,GAAC,MAAM,CAAC,OAAO,mBAAmB,EAAE,QAAQ,EAAE,OAAO,mBAAmB,EAAE,QAAQ,CAAC,GAAC,OAAO;;;;;;+BAC/H,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;;;aAGtB,OAAO,oBAAoB,EAAE,UAAU;;;;YACvC,OAAO,mBAAmB,EAAE,QAAQ,GAAC,MAAM,CAAC,MAAM,EAAE,OAAO,mBAAmB,EAAE,QAAQ,CAAC;;;;+BACzF,OAAO,gBAAgB,EAAE,YAAY,GAAC,MAAM,CAAC,MAAM,EAAE,OAAO,gBAAgB,EAAE,YAAY,CAAC;;;;;2BAK5F,IAAI,CAAC,oBAAoB,EAAE,QAAQ,GAAG,eAAe,CAAC"}
|
package/types/env.d.ts
CHANGED
|
@@ -143,6 +143,14 @@ export type TransformersEnvironment = {
|
|
|
143
143
|
* The cache key to use for storing models and WASM binaries. Defaults to 'transformers-cache'.
|
|
144
144
|
*/
|
|
145
145
|
cacheKey: string;
|
|
146
|
+
/**
|
|
147
|
+
* Whether to use the Cross-Origin Storage API to cache model files
|
|
148
|
+
* across origins, allowing different sites to share the same cached model weights. Defaults to `false`.
|
|
149
|
+
* Requires the Cross-Origin Storage Chrome extension: {@link https://chromewebstore.google.com/detail/cross-origin-storage/denpnpcgjgikjpoglpjefakmdcbmlgih}.
|
|
150
|
+
* The `experimental_` prefix indicates that the underlying browser API is not yet standardised and may change or be
|
|
151
|
+
* removed without a major version bump. For more information, see {@link https://github.com/WICG/cross-origin-storage}.
|
|
152
|
+
*/
|
|
153
|
+
experimental_useCrossOriginStorage: boolean;
|
|
146
154
|
/**
|
|
147
155
|
* The fetch function to use. Defaults to `fetch`.
|
|
148
156
|
*/
|
package/types/env.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.js"],"names":[],"mappings":"AA8FA;;G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;;gBACP,OAAO;;;;cACP,MAAM,GAAC,IAAI;;;;oBACX,OAAO;;;;;iBACP,OAAO,kBAAkB,EAAE,cAAc,GAAC,IAAI;;;;;kBAE9C,OAAO;;;;cAEP,MAAM;;;;;;;;wCACN,OAAO;;;;WAKP,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC"}
|
|
@@ -30,6 +30,23 @@ export function post_process_semantic_segmentation(outputs: any, target_sizes?:
|
|
|
30
30
|
segmentation: Tensor;
|
|
31
31
|
labels: number[];
|
|
32
32
|
}[];
|
|
33
|
+
/**
|
|
34
|
+
* Rescales the image so that the following conditions are met:
|
|
35
|
+
*
|
|
36
|
+
* 1. Both dimensions (height and width) are divisible by 'factor'.
|
|
37
|
+
* 2. The total number of pixels is within the range ['min_pixels', 'max_pixels'].
|
|
38
|
+
* 3. The aspect ratio of the image is maintained as closely as possible.
|
|
39
|
+
*
|
|
40
|
+
* @param {number} height The height of the image.
|
|
41
|
+
* @param {number} width The width of the image.
|
|
42
|
+
* @param {number} [factor=28] The factor to use for resizing.
|
|
43
|
+
* @param {number} [min_pixels=56*56] The minimum number of pixels.
|
|
44
|
+
* @param {number} [max_pixels=14*14*4*1280] The maximum number of pixels.
|
|
45
|
+
* @param {number} [temporal_factor=1] The temporal factor to include in the pixel budget (e.g. temporal_patch_size for video/3D models).
|
|
46
|
+
* @returns {[number, number]} The new width and height of the image.
|
|
47
|
+
* @throws {Error} If the height or width is smaller than the factor.
|
|
48
|
+
*/
|
|
49
|
+
export function smart_resize(height: number, width: number, factor?: number, min_pixels?: number, max_pixels?: number, temporal_factor?: number): [number, number];
|
|
33
50
|
/**
|
|
34
51
|
* Post-process the model output to generate the final panoptic segmentation.
|
|
35
52
|
* @param {*} outputs The model output to post process
|
|
@@ -194,7 +211,7 @@ export class ImageProcessor extends ImageProcessor_base {
|
|
|
194
211
|
*/
|
|
195
212
|
resize(image: RawImage): Promise<RawImage>;
|
|
196
213
|
/**
|
|
197
|
-
* @typedef {
|
|
214
|
+
* @typedef {Object} PreprocessedImage
|
|
198
215
|
* @property {HeightWidth} original_size The original size of the image.
|
|
199
216
|
* @property {HeightWidth} reshaped_input_size The reshaped input size of the image.
|
|
200
217
|
* @property {Tensor} pixel_values The pixel values of the preprocessed image.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image_processors_utils.d.ts","sourceRoot":"","sources":["../src/image_processors_utils.js"],"names":[],"mappings":"AA0DA;;;;;GAKG;AACH,4EAHW,MAAM,EAAE,GACN,MAAM,EAAE,CAIpB;AAED;;;;;;;;;GASG;AACH,uDAPG;IAAwB,MAAM,EAAtB,MAAM;IACU,UAAU,EAA1B,MAAM;CACd,cAAQ,MAAM,iBACN,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,iBAClB,OAAO,GACN,KAAQ,CAsEnB;AAED;;;;;;GAMG;AACH,4DALW,GAAC,iBACD,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAEhB;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,EAAE,CAsDtD;
|
|
1
|
+
{"version":3,"file":"image_processors_utils.d.ts","sourceRoot":"","sources":["../src/image_processors_utils.js"],"names":[],"mappings":"AA0DA;;;;;GAKG;AACH,4EAHW,MAAM,EAAE,GACN,MAAM,EAAE,CAIpB;AAED;;;;;;;;;GASG;AACH,uDAPG;IAAwB,MAAM,EAAtB,MAAM;IACU,UAAU,EAA1B,MAAM;CACd,cAAQ,MAAM,iBACN,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,iBAClB,OAAO,GACN,KAAQ,CAsEnB;AAED;;;;;;GAMG;AACH,4DALW,GAAC,iBACD,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,GAEhB;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,EAAE,CAAA;CAAC,EAAE,CAsDt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E,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;;;;;kBAK9B,MAAM;;;;oBACN,WAAW,EAAE;;;;0BACb,WAAW,EAAE;;;;;;;;;;;;;iBA0gBb,MAAM,EAAE;;;;gBACR,MAAM,EAAE;;;;iBACR,OAAO;;;;qBACP,MAAM;;;;mBACN,OAAO;;;;gBACP,OAAO;;;;eACP,MAAM;;;;WACN,MAAM,MAAO;;;;iBACb,MAAM,MAAO;;;;;4BACb,OAAO;;;;;qBAEP,OAAO;;;;mBAEP,OAAO;;;;;wBACP,OAAO;;;;;yBAEP,MAAM;;;;WAGN,MAAM,EAAE;;;;UACR,MAAM,EAAE;;uBAhjBqB,mBAAmB;yBAErC,kBAAkB"}
|
|
@@ -12,4 +12,4 @@ export class ASTModel extends ASTPreTrainedModel {
|
|
|
12
12
|
export class ASTForAudioClassification extends ASTPreTrainedModel {
|
|
13
13
|
}
|
|
14
14
|
import { PreTrainedModel } from '../modeling_utils.js';
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=modeling_audio_spectrogram_transformer.d.ts.map
|
package/types/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modeling_audio_spectrogram_transformer.d.ts","sourceRoot":"","sources":["../../../src/models/audio_spectrogram_transformer/modeling_audio_spectrogram_transformer.js"],"names":[],"mappings":"AAEA;CAA0D;AAE1D;;GAEG;AACH;CAAmD;AAEnD;;;GAGG;AACH;CAAoE;gCAbpC,sBAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image_processing_chmv2.d.ts","sourceRoot":"","sources":["../../../src/models/chmv2/image_processing_chmv2.js"],"names":[],"mappings":"AAEA;CAA0D;+BAF3B,iCAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modeling_chmv2.d.ts","sourceRoot":"","sources":["../../../src/models/chmv2/modeling_chmv2.js"],"names":[],"mappings":"AAEA;CAA4D;AAC5D;CAAoE;gCAHpC,sBAAsB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export class DeepseekV3PreTrainedModel extends PreTrainedModel {
|
|
2
|
+
}
|
|
3
|
+
export class DeepseekV3Model extends DeepseekV3PreTrainedModel {
|
|
4
|
+
}
|
|
5
|
+
export class DeepseekV3ForCausalLM extends DeepseekV3PreTrainedModel {
|
|
6
|
+
}
|
|
7
|
+
import { PreTrainedModel } from '../modeling_utils.js';
|
|
8
|
+
//# sourceMappingURL=modeling_deepseek_v3.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modeling_deepseek_v3.d.ts","sourceRoot":"","sources":["../../../src/models/deepseek_v3/modeling_deepseek_v3.js"],"names":[],"mappings":"AAEA;CAAiE;AACjE;CAAiE;AACjE;CAAuE;gCAJvC,sBAAsB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {
|
|
2
|
+
* @typedef {Object} DetrFeatureExtractorResultProps
|
|
3
3
|
* @property {import('../../utils/tensor.js').Tensor} pixel_mask
|
|
4
4
|
* @typedef {import('../../image_processors_utils.js').ImageProcessorResult & DetrFeatureExtractorResultProps} DetrFeatureExtractorResult
|
|
5
5
|
*/
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export class EuroBertPreTrainedModel extends PreTrainedModel {
|
|
2
|
+
}
|
|
3
|
+
export class EuroBertModel extends EuroBertPreTrainedModel {
|
|
4
|
+
}
|
|
5
|
+
export class EuroBertForMaskedLM extends EuroBertPreTrainedModel {
|
|
6
|
+
/**
|
|
7
|
+
* Calls the model on new inputs.
|
|
8
|
+
*
|
|
9
|
+
* @param {Object} model_inputs The inputs to the model.
|
|
10
|
+
* @returns {Promise<MaskedLMOutput>} An object containing the model's output logits for masked language modeling.
|
|
11
|
+
*/
|
|
12
|
+
_call(model_inputs: any): Promise<MaskedLMOutput>;
|
|
13
|
+
}
|
|
14
|
+
export class EuroBertForSequenceClassification extends EuroBertPreTrainedModel {
|
|
15
|
+
/**
|
|
16
|
+
* Calls the model on new inputs.
|
|
17
|
+
*
|
|
18
|
+
* @param {Object} model_inputs The inputs to the model.
|
|
19
|
+
* @returns {Promise<SequenceClassifierOutput>} An object containing the model's output logits for sequence classification.
|
|
20
|
+
*/
|
|
21
|
+
_call(model_inputs: any): Promise<SequenceClassifierOutput>;
|
|
22
|
+
}
|
|
23
|
+
export class EuroBertForTokenClassification extends EuroBertPreTrainedModel {
|
|
24
|
+
/**
|
|
25
|
+
* Calls the model on new inputs.
|
|
26
|
+
*
|
|
27
|
+
* @param {Object} model_inputs The inputs to the model.
|
|
28
|
+
* @returns {Promise<TokenClassifierOutput>} An object containing the model's output logits for token classification.
|
|
29
|
+
*/
|
|
30
|
+
_call(model_inputs: any): Promise<TokenClassifierOutput>;
|
|
31
|
+
}
|
|
32
|
+
import { PreTrainedModel } from '../modeling_utils.js';
|
|
33
|
+
import { MaskedLMOutput } from '../modeling_outputs.js';
|
|
34
|
+
import { SequenceClassifierOutput } from '../modeling_outputs.js';
|
|
35
|
+
import { TokenClassifierOutput } from '../modeling_outputs.js';
|
|
36
|
+
//# sourceMappingURL=modeling_eurobert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modeling_eurobert.d.ts","sourceRoot":"","sources":["../../../src/models/eurobert/modeling_eurobert.js"],"names":[],"mappings":"AAGA;CAA+D;AAC/D;CAA6D;AAE7D;IACI;;;;;OAKG;IACH,0BAFa,OAAO,CAAC,cAAc,CAAC,CAInC;CACJ;AAED;IACI;;;;;OAKG;IACH,0BAFa,OAAO,CAAC,wBAAwB,CAAC,CAI7C;CACJ;AAED;IACI;;;;;OAKG;IACH,0BAFa,OAAO,CAAC,qBAAqB,CAAC,CAI1C;CACJ;gCAxC+B,sBAAsB;+BAC0B,wBAAwB;yCAAxB,wBAAwB;sCAAxB,wBAAwB"}
|
|
@@ -4,6 +4,7 @@ export * from "./chatterbox/feature_extraction_chatterbox.js";
|
|
|
4
4
|
export * from "./clap/feature_extraction_clap.js";
|
|
5
5
|
export * from "./dac/feature_extraction_dac.js";
|
|
6
6
|
export * from "./gemma3n/feature_extraction_gemma3n.js";
|
|
7
|
+
export * from "./granite_speech/feature_extraction_granite_speech.js";
|
|
7
8
|
export * from "./moonshine/feature_extraction_moonshine.js";
|
|
8
9
|
export * from "./parakeet/feature_extraction_parakeet.js";
|
|
9
10
|
export * from "./pyannote/feature_extraction_pyannote.js";
|
|
@@ -12,6 +13,7 @@ export * from "./snac/feature_extraction_snac.js";
|
|
|
12
13
|
export * from "./speecht5/feature_extraction_speecht5.js";
|
|
13
14
|
export * from "./wav2vec2/feature_extraction_wav2vec2.js";
|
|
14
15
|
export * from "./wespeaker/feature_extraction_wespeaker.js";
|
|
16
|
+
export * from "./voxtral_realtime/feature_extraction_voxtral_realtime.js";
|
|
15
17
|
export * from "./whisper/feature_extraction_whisper.js";
|
|
16
18
|
export { FeatureExtractor } from "../feature_extraction_utils.js";
|
|
17
19
|
//# sourceMappingURL=feature_extractors.d.ts.map
|
|
@@ -24,5 +24,7 @@ export class Gemma3nForConditionalGeneration extends Gemma3nPreTrainedModel {
|
|
|
24
24
|
attention_mask: any;
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
+
export class Gemma3nForCausalLM extends Gemma3nForConditionalGeneration {
|
|
28
|
+
}
|
|
27
29
|
import { PreTrainedModel } from '../modeling_utils.js';
|
|
28
30
|
//# sourceMappingURL=modeling_gemma3n.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modeling_gemma3n.d.ts","sourceRoot":"","sources":["../../../src/models/gemma3n/modeling_gemma3n.js"],"names":[],"mappings":"AAQA;CAaC;AACD;IACI;;;;;;;;;;;;;qBAsEC;IAED;;;MASC;IACD;;;MAUC;CACJ;
|
|
1
|
+
{"version":3,"file":"modeling_gemma3n.d.ts","sourceRoot":"","sources":["../../../src/models/gemma3n/modeling_gemma3n.js"],"names":[],"mappings":"AAQA;CAaC;AACD;IACI;;;;;;;;;;;;;qBAsEC;IAED;;;MASC;IACD;;;MAUC;CACJ;AAED;CAA0E;gCAjHnE,sBAAsB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image_processing_glm46v.d.ts","sourceRoot":"","sources":["../../../src/models/glm46v/image_processing_glm46v.js"],"names":[],"mappings":"AAGA;CAQC;sCAXqC,0CAA0C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processing_glm46v.d.ts","sourceRoot":"","sources":["../../../src/models/glm46v/processing_glm46v.js"],"names":[],"mappings":"AAEA;CAEC;iCAJgC,oCAAoC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export class GlmMoeDsaPreTrainedModel extends PreTrainedModel {
|
|
2
|
+
}
|
|
3
|
+
export class GlmMoeDsaModel extends GlmMoeDsaPreTrainedModel {
|
|
4
|
+
}
|
|
5
|
+
export class GlmMoeDsaForCausalLM extends GlmMoeDsaPreTrainedModel {
|
|
6
|
+
}
|
|
7
|
+
import { PreTrainedModel } from '../modeling_utils.js';
|
|
8
|
+
//# sourceMappingURL=modeling_glm_moe_dsa.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modeling_glm_moe_dsa.d.ts","sourceRoot":"","sources":["../../../src/models/glm_moe_dsa/modeling_glm_moe_dsa.js"],"names":[],"mappings":"AAEA;CAAgE;AAChE;CAA+D;AAC/D;CAAqE;gCAJrC,sBAAsB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class GlmOcrForConditionalGeneration extends Qwen2_5_VLForConditionalGeneration {
|
|
2
|
+
/**
|
|
3
|
+
* Compute 3D positional indices for vision tokens.
|
|
4
|
+
* Temporal is constant, height is repeat-interleaved, width tiles.
|
|
5
|
+
* @param {number} start_position
|
|
6
|
+
* @param {number[]} grid_thw [T, H, W]
|
|
7
|
+
* @param {number} temp_merge_size
|
|
8
|
+
* @param {number} spatial_merge_size
|
|
9
|
+
* @returns {number[]} Flat array of length 3 * seq_len: [temporal..., height..., width...]
|
|
10
|
+
*/
|
|
11
|
+
get_vision_position_ids(start_position: number, grid_thw: number[], temp_merge_size: number, spatial_merge_size: number): number[];
|
|
12
|
+
/**
|
|
13
|
+
* GlmOcr uses mm_token_type_ids-style grouping (image tokens identified by image_token_id)
|
|
14
|
+
* instead of vision_start_token_id scanning used by Qwen2VL.
|
|
15
|
+
* After a vision segment, position advances by max(h, w) / spatial_merge_size.
|
|
16
|
+
*/
|
|
17
|
+
_get_multimodal_rope_positions({ filtered_ids, image_grid_thw_list, video_grid_thw_list, spatial_merge_size, state, }: {
|
|
18
|
+
filtered_ids: any;
|
|
19
|
+
image_grid_thw_list: any;
|
|
20
|
+
video_grid_thw_list: any;
|
|
21
|
+
spatial_merge_size: any;
|
|
22
|
+
state: any;
|
|
23
|
+
}): number[][];
|
|
24
|
+
}
|
|
25
|
+
import { Qwen2_5_VLForConditionalGeneration } from '../qwen2_5_vl/modeling_qwen2_5_vl.js';
|
|
26
|
+
//# sourceMappingURL=modeling_glm_ocr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modeling_glm_ocr.d.ts","sourceRoot":"","sources":["../../../src/models/glm_ocr/modeling_glm_ocr.js"],"names":[],"mappings":"AAEA;IACI;;;;;;;;OAQG;IACH,wCANW,MAAM,YACN,MAAM,EAAE,mBACR,MAAM,sBACN,MAAM,GACJ,MAAM,EAAE,CAgBpB;IAED;;;;OAIG;IACH;;;;;;mBA2CC;CACJ;mDA7EkD,sCAAsC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export class GraniteSpeechFeatureExtractor extends FeatureExtractor {
|
|
2
|
+
constructor(config: any);
|
|
3
|
+
mel_filters: number[][];
|
|
4
|
+
window: Float64Array<any>;
|
|
5
|
+
/**
|
|
6
|
+
* Extract mel spectrogram features from audio, matching the Python GraniteSpeechFeatureExtractor.
|
|
7
|
+
* @param {Float32Array|Float64Array} audio The audio waveform.
|
|
8
|
+
* @returns {Promise<{input_features: Tensor}>}
|
|
9
|
+
*/
|
|
10
|
+
_call(audio: Float32Array | Float64Array): Promise<{
|
|
11
|
+
input_features: Tensor;
|
|
12
|
+
}>;
|
|
13
|
+
}
|
|
14
|
+
import { FeatureExtractor } from '../../feature_extraction_utils.js';
|
|
15
|
+
import { Tensor } from '../../utils/tensor.js';
|
|
16
|
+
//# sourceMappingURL=feature_extraction_granite_speech.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature_extraction_granite_speech.d.ts","sourceRoot":"","sources":["../../../src/models/granite_speech/feature_extraction_granite_speech.js"],"names":[],"mappings":"AAIA;IACI,yBAsBC;IAhBG,wBAQC;IAKD,0BAAqC;IAKzC;;;;OAIG;IACH,aAHW,YAAY,GAAC,YAAY,GACvB,OAAO,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAC,CAAC,CAwB7C;CACJ;iCAzDuD,mCAAmC;uBAEpE,uBAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modeling_granite_speech.d.ts","sourceRoot":"","sources":["../../../src/models/granite_speech/modeling_granite_speech.js"],"names":[],"mappings":"AAEA;CAEC;8BAJ6B,kCAAkC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export class GraniteSpeechProcessor extends Processor {
|
|
2
|
+
static tokenizer_class: typeof AutoTokenizer;
|
|
3
|
+
static feature_extractor_class: typeof AutoFeatureExtractor;
|
|
4
|
+
/**
|
|
5
|
+
* Compute the number of audio tokens for a given raw audio length.
|
|
6
|
+
* @param {number} audioLength Raw audio sample count.
|
|
7
|
+
* @returns {number} Number of projector output tokens.
|
|
8
|
+
*/
|
|
9
|
+
_get_num_audio_features(audioLength: number): number;
|
|
10
|
+
/**
|
|
11
|
+
* @param {string} text The text input to process.
|
|
12
|
+
* @param {Float32Array} audio The audio input to process.
|
|
13
|
+
*/
|
|
14
|
+
_call(text: string, audio?: Float32Array, kwargs?: {}): Promise<any>;
|
|
15
|
+
}
|
|
16
|
+
import { Processor } from '../../processing_utils.js';
|
|
17
|
+
import { AutoTokenizer } from '../auto/tokenization_auto.js';
|
|
18
|
+
import { AutoFeatureExtractor } from '../auto/feature_extraction_auto.js';
|
|
19
|
+
//# sourceMappingURL=processing_granite_speech.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"processing_granite_speech.d.ts","sourceRoot":"","sources":["../../../src/models/granite_speech/processing_granite_speech.js"],"names":[],"mappings":"AAKA;IACI,6CAAuC;IACvC,4DAAsD;IAGtD;;;;OAIG;IACH,qCAHW,MAAM,GACJ,MAAM,CAUlB;IAED;;;OAGG;IACH,YAHW,MAAM,UACN,YAAY,6BAiCtB;CACJ;0BA3DyB,2BAA2B;8BADvB,8BAA8B;qCADvB,oCAAoC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {
|
|
2
|
+
* @typedef {Object} GroundingDinoFeatureExtractorResultProps
|
|
3
3
|
* @property {import('../../utils/tensor.js').Tensor} pixel_mask
|
|
4
4
|
* @typedef {import('../../image_processors_utils.js').ImageProcessorResult & GroundingDinoFeatureExtractorResultProps} GroundingDinoFeatureExtractorResult
|
|
5
5
|
*/
|
|
@@ -1,23 +1,7 @@
|
|
|
1
|
-
export class Idefics3PreTrainedModel extends PreTrainedModel {
|
|
2
|
-
}
|
|
3
1
|
/**
|
|
4
2
|
* The Idefics3 model which consists of a vision backbone and a language model.
|
|
5
3
|
*/
|
|
6
|
-
export class Idefics3ForConditionalGeneration extends
|
|
7
|
-
encode_image({ pixel_values, pixel_attention_mask }: {
|
|
8
|
-
pixel_values: any;
|
|
9
|
-
pixel_attention_mask: any;
|
|
10
|
-
}): Promise<any>;
|
|
11
|
-
_merge_input_ids_with_image_features(kwargs: any): {
|
|
12
|
-
inputs_embeds: any;
|
|
13
|
-
attention_mask: any;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* The SmolVLM Model with a language modeling head.
|
|
18
|
-
* It is made up a SigLIP vision encoder, with a language modeling head on top.
|
|
19
|
-
*/
|
|
20
|
-
export class SmolVLMForConditionalGeneration extends Idefics3ForConditionalGeneration {
|
|
4
|
+
export class Idefics3ForConditionalGeneration extends LlavaForConditionalGeneration {
|
|
21
5
|
}
|
|
22
|
-
import {
|
|
6
|
+
import { LlavaForConditionalGeneration } from '../llava/modeling_llava.js';
|
|
23
7
|
//# sourceMappingURL=modeling_idefics3.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modeling_idefics3.d.ts","sourceRoot":"","sources":["../../../src/models/idefics3/modeling_idefics3.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modeling_idefics3.d.ts","sourceRoot":"","sources":["../../../src/models/idefics3/modeling_idefics3.js"],"names":[],"mappings":"AAEA;;GAEG;AACH;CASC;8CAd6C,4BAA4B"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./beit/image_processing_beit.js";
|
|
2
2
|
export * from "./bit/image_processing_bit.js";
|
|
3
3
|
export * from "./chinese_clip/image_processing_chinese_clip.js";
|
|
4
|
+
export * from "./chmv2/image_processing_chmv2.js";
|
|
4
5
|
export * from "./clip/image_processing_clip.js";
|
|
5
6
|
export * from "./convnext/image_processing_convnext.js";
|
|
6
7
|
export * from "./deit/image_processing_deit.js";
|
|
@@ -9,11 +10,13 @@ export * from "./dinov3_vit/image_processing_dinov3_vit.js";
|
|
|
9
10
|
export * from "./donut/image_processing_donut.js";
|
|
10
11
|
export * from "./dpt/image_processing_dpt.js";
|
|
11
12
|
export * from "./efficientnet/image_processing_efficientnet.js";
|
|
13
|
+
export * from "./glm46v/image_processing_glm46v.js";
|
|
12
14
|
export * from "./glpn/image_processing_glpn.js";
|
|
13
15
|
export * from "./grounding_dino/image_processing_grounding_dino.js";
|
|
14
16
|
export * from "./idefics3/image_processing_idefics3.js";
|
|
15
17
|
export * from "./janus/image_processing_janus.js";
|
|
16
18
|
export * from "./jina_clip/image_processing_jina_clip.js";
|
|
19
|
+
export * from "./lfm2_vl/image_processing_lfm2_vl.js";
|
|
17
20
|
export * from "./llava_onevision/image_processing_llava_onevision.js";
|
|
18
21
|
export * from "./mask2former/image_processing_mask2former.js";
|
|
19
22
|
export * from "./maskformer/image_processing_maskformer.js";
|