You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for multi-chunk external data files (huggingface#1212)
* Cache path vs Local path
* Update src/utils/hub.js
* complete the full parameters of option for pipeline api, see: huggingface#1200
Signed-off-by: Thomas Tang <[email protected]>
* Add support for multi-chunk external data files
* Add MAX_EXTERNAL_DATA_CHUNKS check
* Support loading inference sessions from paths (node.js external data)
* Fix types
* Add support for node.js external data & optimize downloading
* Remove debug logs
* Optimize FileResponse body stream for large models
* Expose `use_external_data_format` in pipeline options. TODO: Improve support and allow per-file specification
* Fix post-merge
* Dedent comments
* Default use_external_data_format to null (unset)
* let -> const where possible
* Support setting external data format in config.json
* Add external data model architecture tests
* Simplify tests
* Formatting
---------
Signed-off-by: Thomas Tang <[email protected]>
Co-authored-by: axrati <[email protected]>
Co-authored-by: Axm <[email protected]>
Co-authored-by: Thomas Tang <[email protected]>
Copy file name to clipboardExpand all lines: src/configs.js
+1-1
Original file line number
Diff line number
Diff line change
@@ -408,5 +408,5 @@ export class AutoConfig {
408
408
* for more information.
409
409
* @property {import('./utils/devices.js').DeviceType} [device] The default device to use for the model.
410
410
* @property {import('./utils/dtypes.js').DataType|Record<string, import('./utils/dtypes.js').DataType>} [dtype] The default data type to use for the model.
411
-
* @property {boolean|Record<string, boolean>} [use_external_data_format=false] Whether to load the model using the external data format (used for models >= 2GB in size).
411
+
* @property {import('./utils/hub.js').ExternalData|Record<string, import('./utils/hub.js').ExternalData>} [use_external_data_format=false] Whether to load the model using the external data format (used for models >= 2GB in size).
Copy file name to clipboardExpand all lines: src/models.js
+39-25
Original file line number
Diff line number
Diff line change
@@ -68,6 +68,7 @@ import {
68
68
import{
69
69
getModelFile,
70
70
getModelJSON,
71
+
MAX_EXTERNAL_DATA_CHUNKS,
71
72
}from'./utils/hub.js';
72
73
73
74
import{
@@ -153,7 +154,7 @@ const MODEL_CLASS_TO_NAME_MAPPING = new Map();
153
154
* @param {string} pretrained_model_name_or_path The path to the directory containing the model file.
154
155
* @param {string} fileName The name of the model file.
155
156
* @param {import('./utils/hub.js').PretrainedModelOptions} options Additional options for loading the model.
156
-
* @returns {Promise<{buffer: Uint8Array, session_options: Object, session_config: Object}>} A Promise that resolves to the data needed to create an InferenceSession object.
157
+
* @returns {Promise<{buffer_or_path: Uint8Array|string, session_options: Object, session_config: Object}>} A Promise that resolves to the data needed to create an InferenceSession object.
0 commit comments