Skip to content

Commit a3992a0

Browse files
authored
Merge branch 'main' into add-janus
2 parents 3019e55 + 1768b8b commit a3992a0

File tree

12 files changed

+328
-29
lines changed

12 files changed

+328
-29
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ __pycache__
22
.vscode
33
node_modules
44
.cache
5+
.DS_STORE
56

67
# Do not track build artifacts/generated files
78
/dist

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,8 @@ You can refine your search by selecting the task you're interested in (e.g., [te
374374
1. **[OPT](https://huggingface.co/docs/transformers/master/model_doc/opt)** (from Meta AI) released with the paper [OPT: Open Pre-trained Transformer Language Models](https://arxiv.org/abs/2205.01068) by Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen et al.
375375
1. **[OWL-ViT](https://huggingface.co/docs/transformers/model_doc/owlvit)** (from Google AI) released with the paper [Simple Open-Vocabulary Object Detection with Vision Transformers](https://arxiv.org/abs/2205.06230) by Matthias Minderer, Alexey Gritsenko, Austin Stone, Maxim Neumann, Dirk Weissenborn, Alexey Dosovitskiy, Aravindh Mahendran, Anurag Arnab, Mostafa Dehghani, Zhuoran Shen, Xiao Wang, Xiaohua Zhai, Thomas Kipf, and Neil Houlsby.
376376
1. **[OWLv2](https://huggingface.co/docs/transformers/model_doc/owlv2)** (from Google AI) released with the paper [Scaling Open-Vocabulary Object Detection](https://arxiv.org/abs/2306.09683) by Matthias Minderer, Alexey Gritsenko, Neil Houlsby.
377+
1. **[PatchTSMixer](https://huggingface.co/docs/transformers/main/model_doc/patchtsmixer)** (from IBM) released with the paper [TSMixer: Lightweight MLP-Mixer Model for Multivariate Time Series Forecasting](https://arxiv.org/abs/2306.09364) by Vijay Ekambaram, Arindam Jati, Nam Nguyen, Phanwadee Sinthong, Jayant Kalagnanam.
378+
1. **[PatchTST](https://huggingface.co/docs/transformers/main/model_doc/patchtst)** (from Princeton University, IBM) released with the paper [A Time Series is Worth 64 Words: Long-term Forecasting with Transformers](https://arxiv.org/abs/2211.14730) by Yuqi Nie, Nam H. Nguyen, Phanwadee Sinthong, Jayant Kalagnanam.
377379
1. **[Phi](https://huggingface.co/docs/transformers/main/model_doc/phi)** (from Microsoft) released with the papers - [Textbooks Are All You Need](https://arxiv.org/abs/2306.11644) by Suriya Gunasekar, Yi Zhang, Jyoti Aneja, Caio César Teodoro Mendes, Allie Del Giorno, Sivakanth Gopi, Mojan Javaheripi, Piero Kauffmann, Gustavo de Rosa, Olli Saarikivi, Adil Salim, Shital Shah, Harkirat Singh Behl, Xin Wang, Sébastien Bubeck, Ronen Eldan, Adam Tauman Kalai, Yin Tat Lee and Yuanzhi Li, [Textbooks Are All You Need II: phi-1.5 technical report](https://arxiv.org/abs/2309.05463) by Yuanzhi Li, Sébastien Bubeck, Ronen Eldan, Allie Del Giorno, Suriya Gunasekar and Yin Tat Lee.
378380
1. **[Phi3](https://huggingface.co/docs/transformers/main/model_doc/phi3)** (from Microsoft) released with the paper [Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone](https://arxiv.org/abs/2404.14219) by Marah Abdin, Sam Ade Jacobs, Ammar Ahmad Awan, Jyoti Aneja, Ahmed Awadallah, Hany Awadalla, Nguyen Bach, Amit Bahree, Arash Bakhtiari, Harkirat Behl, Alon Benhaim, Misha Bilenko, Johan Bjorck, Sébastien Bubeck, Martin Cai, Caio César Teodoro Mendes, Weizhu Chen, Vishrav Chaudhary, Parul Chopra, Allie Del Giorno, Gustavo de Rosa, Matthew Dixon, Ronen Eldan, Dan Iter, Amit Garg, Abhishek Goswami, Suriya Gunasekar, Emman Haider, Junheng Hao, Russell J. Hewett, Jamie Huynh, Mojan Javaheripi, Xin Jin, Piero Kauffmann, Nikos Karampatziakis, Dongwoo Kim, Mahoud Khademi, Lev Kurilenko, James R. Lee, Yin Tat Lee, Yuanzhi Li, Chen Liang, Weishung Liu, Eric Lin, Zeqi Lin, Piyush Madan, Arindam Mitra, Hardik Modi, Anh Nguyen, Brandon Norick, Barun Patra, Daniel Perez-Becker, Thomas Portet, Reid Pryzant, Heyang Qin, Marko Radmilac, Corby Rosset, Sambudha Roy, Olatunji Ruwase, Olli Saarikivi, Amin Saied, Adil Salim, Michael Santacroce, Shital Shah, Ning Shang, Hiteshi Sharma, Xia Song, Masahiro Tanaka, Xin Wang, Rachel Ward, Guanhua Wang, Philipp Witte, Michael Wyatt, Can Xu, Jiahang Xu, Sonali Yadav, Fan Yang, Ziyi Yang, Donghan Yu, Chengruidong Zhang, Cyril Zhang, Jianwen Zhang, Li Lyna Zhang, Yi Zhang, Yue Zhang, Yunan Zhang, Xiren Zhou.
379381
1. **[PVT](https://huggingface.co/docs/transformers/main/model_doc/pvt)** (from Nanjing University, The University of Hong Kong etc.) released with the paper [Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions](https://arxiv.org/pdf/2102.12122.pdf) by Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, Ling Shao.

docs/snippets/6_supported-models.snippet

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@
8989
1. **[OPT](https://huggingface.co/docs/transformers/master/model_doc/opt)** (from Meta AI) released with the paper [OPT: Open Pre-trained Transformer Language Models](https://arxiv.org/abs/2205.01068) by Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen et al.
9090
1. **[OWL-ViT](https://huggingface.co/docs/transformers/model_doc/owlvit)** (from Google AI) released with the paper [Simple Open-Vocabulary Object Detection with Vision Transformers](https://arxiv.org/abs/2205.06230) by Matthias Minderer, Alexey Gritsenko, Austin Stone, Maxim Neumann, Dirk Weissenborn, Alexey Dosovitskiy, Aravindh Mahendran, Anurag Arnab, Mostafa Dehghani, Zhuoran Shen, Xiao Wang, Xiaohua Zhai, Thomas Kipf, and Neil Houlsby.
9191
1. **[OWLv2](https://huggingface.co/docs/transformers/model_doc/owlv2)** (from Google AI) released with the paper [Scaling Open-Vocabulary Object Detection](https://arxiv.org/abs/2306.09683) by Matthias Minderer, Alexey Gritsenko, Neil Houlsby.
92+
1. **[PatchTSMixer](https://huggingface.co/docs/transformers/main/model_doc/patchtsmixer)** (from IBM) released with the paper [TSMixer: Lightweight MLP-Mixer Model for Multivariate Time Series Forecasting](https://arxiv.org/abs/2306.09364) by Vijay Ekambaram, Arindam Jati, Nam Nguyen, Phanwadee Sinthong, Jayant Kalagnanam.
93+
1. **[PatchTST](https://huggingface.co/docs/transformers/main/model_doc/patchtst)** (from Princeton University, IBM) released with the paper [A Time Series is Worth 64 Words: Long-term Forecasting with Transformers](https://arxiv.org/abs/2211.14730) by Yuqi Nie, Nam H. Nguyen, Phanwadee Sinthong, Jayant Kalagnanam.
9294
1. **[Phi](https://huggingface.co/docs/transformers/main/model_doc/phi)** (from Microsoft) released with the papers - [Textbooks Are All You Need](https://arxiv.org/abs/2306.11644) by Suriya Gunasekar, Yi Zhang, Jyoti Aneja, Caio César Teodoro Mendes, Allie Del Giorno, Sivakanth Gopi, Mojan Javaheripi, Piero Kauffmann, Gustavo de Rosa, Olli Saarikivi, Adil Salim, Shital Shah, Harkirat Singh Behl, Xin Wang, Sébastien Bubeck, Ronen Eldan, Adam Tauman Kalai, Yin Tat Lee and Yuanzhi Li, [Textbooks Are All You Need II: phi-1.5 technical report](https://arxiv.org/abs/2309.05463) by Yuanzhi Li, Sébastien Bubeck, Ronen Eldan, Allie Del Giorno, Suriya Gunasekar and Yin Tat Lee.
9395
1. **[Phi3](https://huggingface.co/docs/transformers/main/model_doc/phi3)** (from Microsoft) released with the paper [Phi-3 Technical Report: A Highly Capable Language Model Locally on Your Phone](https://arxiv.org/abs/2404.14219) by Marah Abdin, Sam Ade Jacobs, Ammar Ahmad Awan, Jyoti Aneja, Ahmed Awadallah, Hany Awadalla, Nguyen Bach, Amit Bahree, Arash Bakhtiari, Harkirat Behl, Alon Benhaim, Misha Bilenko, Johan Bjorck, Sébastien Bubeck, Martin Cai, Caio César Teodoro Mendes, Weizhu Chen, Vishrav Chaudhary, Parul Chopra, Allie Del Giorno, Gustavo de Rosa, Matthew Dixon, Ronen Eldan, Dan Iter, Amit Garg, Abhishek Goswami, Suriya Gunasekar, Emman Haider, Junheng Hao, Russell J. Hewett, Jamie Huynh, Mojan Javaheripi, Xin Jin, Piero Kauffmann, Nikos Karampatziakis, Dongwoo Kim, Mahoud Khademi, Lev Kurilenko, James R. Lee, Yin Tat Lee, Yuanzhi Li, Chen Liang, Weishung Liu, Eric Lin, Zeqi Lin, Piyush Madan, Arindam Mitra, Hardik Modi, Anh Nguyen, Brandon Norick, Barun Patra, Daniel Perez-Becker, Thomas Portet, Reid Pryzant, Heyang Qin, Marko Radmilac, Corby Rosset, Sambudha Roy, Olatunji Ruwase, Olli Saarikivi, Amin Saied, Adil Salim, Michael Santacroce, Shital Shah, Ning Shang, Hiteshi Sharma, Xia Song, Masahiro Tanaka, Xin Wang, Rachel Ward, Guanhua Wang, Philipp Witte, Michael Wyatt, Can Xu, Jiahang Xu, Sonali Yadav, Fan Yang, Ziyi Yang, Donghan Yu, Chengruidong Zhang, Cyril Zhang, Jianwen Zhang, Li Lyna Zhang, Yi Zhang, Yue Zhang, Yunan Zhang, Xiren Zhou.
9496
1. **[PVT](https://huggingface.co/docs/transformers/main/model_doc/pvt)** (from Nanjing University, The University of Hong Kong etc.) released with the paper [Pyramid Vision Transformer: A Versatile Backbone for Dense Prediction without Convolutions](https://arxiv.org/pdf/2102.12122.pdf) by Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, Ling Shao.

examples/video-object-detection/index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,16 @@ <h4>
3434
<br>
3535
<input id="threshold" type="range" min="0.01" max="1" step="0.01" value="0.25" disabled>
3636
</div>
37+
<div>
38+
<label>Image scale</label>
39+
(<label id="scale-value">0.5</label>)
40+
<br>
41+
<input id="scale" type="range" min="0" max="1" step="0.01" value="0.5" disabled>
42+
</div>
3743
</div>
3844
<label id="status"></label>
3945

4046
<script type="module" src="/main.js"></script>
4147
</body>
4248

43-
</html>
49+
</html>

scripts/quantize.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from enum import Enum
22

33
from tqdm import tqdm
4-
from typing import Set
4+
from typing import Set, List, Optional
55
import onnx
66
import os
77

@@ -110,6 +110,16 @@ class QuantizationArguments:
110110
},
111111
)
112112

113+
op_block_list: List[str] = field(
114+
default=None,
115+
metadata={
116+
"help": "List of operators to exclude from quantization."
117+
"Can be any standard ONNX operator (see https://onnx.ai/onnx/operators/)"
118+
"or your custom implemented operators.",
119+
"nargs": "+",
120+
},
121+
)
122+
113123

114124
def get_operators(model: onnx.ModelProto) -> Set[str]:
115125
operators = set()
@@ -131,6 +141,7 @@ def quantize_q8(
131141
per_channel: bool,
132142
reduce_range: bool,
133143
weight_type: QuantType,
144+
op_block_list: Optional[List[str]]
134145
):
135146
"""
136147
Quantize the weights of the model from float32 to int8/uint8
@@ -140,6 +151,10 @@ def quantize_q8(
140151
it is faster on most CPU architectures
141152
"""
142153

154+
op_types_to_quantize = set(IntegerOpsRegistry.keys())
155+
if op_block_list is not None:
156+
op_types_to_quantize.difference_update(op_block_list)
157+
143158
quantizer = ONNXQuantizer(
144159
model,
145160
per_channel,
@@ -151,7 +166,7 @@ def quantize_q8(
151166
tensors_range=None,
152167
nodes_to_quantize=[],
153168
nodes_to_exclude=[],
154-
op_types_to_quantize=list(IntegerOpsRegistry.keys()),
169+
op_types_to_quantize=op_types_to_quantize,
155170
extra_options=dict(
156171
EnableSubgraph=True,
157172
MatMulConstBOnly=True,
@@ -165,6 +180,7 @@ def quantize_q8(
165180
def quantize_fp16(
166181
model: onnx.ModelProto,
167182
save_path: str,
183+
op_block_list: Optional[List[str]]
168184
):
169185
"""
170186
Quantize the weights of the model from float32 to float16
@@ -174,10 +190,15 @@ def quantize_fp16(
174190
# ValueError: Message onnx.ModelProto exceeds maximum protobuf size of 2GB: 2338583841
175191
disable_shape_infer = model.ByteSize() >= onnx.checker.MAXIMUM_PROTOBUF
176192

193+
blocked_ops = set(float16.DEFAULT_OP_BLOCK_LIST)
194+
if op_block_list is not None:
195+
blocked_ops.update(op_block_list)
196+
177197
model_fp16 = float16.convert_float_to_float16(
178198
model,
179199
keep_io_types=True,
180200
disable_shape_infer=disable_shape_infer,
201+
op_block_list=blocked_ops,
181202
)
182203
graph = gs.import_onnx(model_fp16)
183204
graph.toposort()
@@ -271,6 +292,7 @@ def quantize(input_folder, output_folder, quantization_args: QuantizationArgumen
271292
quantize_fp16(
272293
model,
273294
save_path,
295+
quantization_args.op_block_list
274296
)
275297

276298
elif mode in (QuantMode.Q4, QuantMode.Q4F16):
@@ -287,6 +309,7 @@ def quantize(input_folder, output_folder, quantization_args: QuantizationArgumen
287309
quantize_fp16(
288310
q4_model,
289311
save_path,
312+
quantization_args.op_block_list,
290313
)
291314

292315
elif mode == QuantMode.BNB4:
@@ -331,6 +354,7 @@ def quantize(input_folder, output_folder, quantization_args: QuantizationArgumen
331354
per_channel=quantization_args.per_channel,
332355
reduce_range=quantization_args.reduce_range,
333356
weight_type=weight_type,
357+
op_block_list=quantization_args.op_block_list,
334358
)
335359

336360

src/configs.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ import {
3636
* @typedef {import('./utils/hub.js').PretrainedOptions} PretrainedOptions
3737
*/
3838

39+
/**
40+
* @typedef {import('./utils/core.js').ProgressCallback} ProgressCallback
41+
*/
42+
43+
/**
44+
* @typedef {import('./utils/core.js').ProgressInfo} ProgressInfo
45+
*/
3946

4047
/**
4148
* Loads a config from the specified path.

src/models.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6519,6 +6519,37 @@ export class MgpstrForSceneTextRecognition extends MgpstrPreTrainedModel {
65196519
}
65206520
}
65216521

6522+
//////////////////////////////////////////////////
6523+
// PatchTST Transformer models
6524+
export class PatchTSTPreTrainedModel extends PreTrainedModel { }
6525+
6526+
/**
6527+
* The bare PatchTST Model outputting raw hidden-states without any specific head.
6528+
*/
6529+
export class PatchTSTModel extends PatchTSTPreTrainedModel { }
6530+
6531+
/**
6532+
* The PatchTST for prediction model.
6533+
*/
6534+
export class PatchTSTForPrediction extends PatchTSTPreTrainedModel { }
6535+
//////////////////////////////////////////////////
6536+
6537+
//////////////////////////////////////////////////
6538+
// PatchTSMixer Transformer models
6539+
export class PatchTSMixerPreTrainedModel extends PreTrainedModel { }
6540+
6541+
/**
6542+
* The bare PatchTSMixer Model outputting raw hidden-states without any specific head.
6543+
*/
6544+
export class PatchTSMixerModel extends PatchTSMixerPreTrainedModel { }
6545+
6546+
/**
6547+
* The PatchTSMixer for prediction model.
6548+
*/
6549+
export class PatchTSMixerForPrediction extends PatchTSMixerPreTrainedModel { }
6550+
//////////////////////////////////////////////////
6551+
6552+
65226553
//////////////////////////////////////////////////
65236554
// AutoModels, used to simplify construction of PreTrainedModels
65246555
// (uses config to instantiate correct class)
@@ -6658,6 +6689,8 @@ const MODEL_MAPPING_NAMES_ENCODER_ONLY = new Map([
66586689
['efficientnet', ['EfficientNetModel', EfficientNetModel]],
66596690

66606691
['decision_transformer', ['DecisionTransformerModel', DecisionTransformerModel]],
6692+
['patchtst', ['PatchTSTForPrediction', PatchTSTModel]],
6693+
['patchtsmixer', ['PatchTSMixerForPrediction', PatchTSMixerModel]],
66616694

66626695
['mobilenet_v1', ['MobileNetV1Model', MobileNetV1Model]],
66636696
['mobilenet_v2', ['MobileNetV2Model', MobileNetV2Model]],
@@ -6950,6 +6983,11 @@ const MODEL_FOR_IMAGE_MATTING_MAPPING_NAMES = new Map([
69506983
['vitmatte', ['VitMatteForImageMatting', VitMatteForImageMatting]],
69516984
]);
69526985

6986+
const MODEL_FOR_TIME_SERIES_PREDICTION_MAPPING_NAMES = new Map([
6987+
['patchtst', ['PatchTSTForPrediction', PatchTSTForPrediction]],
6988+
['patchtsmixer', ['PatchTSMixerForPrediction', PatchTSMixerForPrediction]],
6989+
])
6990+
69536991
const MODEL_FOR_IMAGE_TO_IMAGE_MAPPING_NAMES = new Map([
69546992
['swin2sr', ['Swin2SRForImageSuperResolution', Swin2SRForImageSuperResolution]],
69556993
])
@@ -6997,6 +7035,7 @@ const MODEL_CLASS_TYPE_MAPPING = [
69977035
[MODEL_FOR_UNIVERSAL_SEGMENTATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
69987036
[MODEL_FOR_SEMANTIC_SEGMENTATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
69997037
[MODEL_FOR_IMAGE_MATTING_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
7038+
[MODEL_FOR_TIME_SERIES_PREDICTION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
70007039
[MODEL_FOR_IMAGE_TO_IMAGE_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
70017040
[MODEL_FOR_DEPTH_ESTIMATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],
70027041
[MODEL_FOR_NORMAL_ESTIMATION_MAPPING_NAMES, MODEL_TYPES.EncoderOnly],

src/utils/core.js

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
11

22
/**
33
* @file Core utility functions/classes for Transformers.js.
4-
*
4+
*
55
* These are only used internally, meaning an end-user shouldn't
66
* need to access anything here.
7-
*
7+
*
88
* @module utils/core
99
*/
1010

11+
/**
12+
* @typedef {Object} ProgressInfo
13+
* @property {'initiate' | 'download' | 'progress' | 'done'} status The status of the progress item.
14+
* @property {string} name This can be either:
15+
* - a string, the *model id* of a model repo on huggingface.co.
16+
* - a path to a *directory* potentially containing the file.
17+
* @property {string} file The name of the file
18+
* @property {number} [progress] A number between 0 and 100. Only available for the 'progress' status.
19+
* @property {number} [loaded] The number of bytes loaded. Only available for the 'progress' status.
20+
* @property {number} [total] The total number of bytes to be loaded. Only available for the 'progress' status.
21+
*/
22+
23+
/**
24+
* A callback function that is called with progress information.
25+
* @callback ProgressCallback
26+
* @param {ProgressInfo} progressInfo
27+
* @returns {void}
28+
*/
29+
1130
/**
1231
* Helper function to dispatch progress callbacks.
1332
*
14-
* @param {Function} progress_callback The progress callback function to dispatch.
15-
* @param {any} data The data to pass to the progress callback function.
33+
* @param {ProgressCallback | null | undefined} progress_callback The progress callback function to dispatch.
34+
* @param {ProgressInfo} data The data to pass to the progress callback function.
1635
* @returns {void}
1736
* @private
1837
*/
@@ -46,7 +65,7 @@ export function escapeRegExp(string) {
4665
* Check if a value is a typed array.
4766
* @param {*} val The value to check.
4867
* @returns {boolean} True if the value is a `TypedArray`, false otherwise.
49-
*
68+
*
5069
* Adapted from https://stackoverflow.com/a/71091338/13989043
5170
*/
5271
export function isTypedArray(val) {
@@ -63,6 +82,15 @@ export function isIntegralNumber(x) {
6382
return Number.isInteger(x) || typeof x === 'bigint'
6483
}
6584

85+
/**
86+
* Determine if a provided width or height is nullish.
87+
* @param {*} x The value to check.
88+
* @returns {boolean} True if the value is `null`, `undefined` or `-1`, false otherwise.
89+
*/
90+
export function isNullishDimension(x) {
91+
return x === null || x === undefined || x === -1;
92+
}
93+
6694
/**
6795
* Calculates the dimensions of a nested array.
6896
*
@@ -132,9 +160,9 @@ export function calculateReflectOffset(i, w) {
132160
}
133161

134162
/**
135-
*
136-
* @param {Object} o
137-
* @param {string[]} props
163+
*
164+
* @param {Object} o
165+
* @param {string[]} props
138166
* @returns {Object}
139167
*/
140168
export function pick(o, props) {
@@ -151,7 +179,7 @@ export function pick(o, props) {
151179
/**
152180
* Calculate the length of a string, taking multi-byte characters into account.
153181
* This mimics the behavior of Python's `len` function.
154-
* @param {string} s The string to calculate the length of.
182+
* @param {string} s The string to calculate the length of.
155183
* @returns {number} The length of the string.
156184
*/
157185
export function len(s) {

src/utils/hub.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { dispatchCallback } from './core.js';
1313

1414
/**
1515
* @typedef {Object} PretrainedOptions Options for loading a pretrained model.
16-
* @property {function} [progress_callback=null] If specified, this function will be called during model construction, to provide the user with progress updates.
16+
* @property {import('./core.js').ProgressCallback} [progress_callback=null] If specified, this function will be called during model construction, to provide the user with progress updates.
1717
* @property {import('../configs.js').PretrainedConfig} [config=null] Configuration for the model to use instead of an automatically loaded configuration. Configuration can be automatically loaded when:
1818
* - The model is a model provided by the library (loaded with the *model id* string of a pretrained model).
1919
* - The model is loaded by supplying a local directory as `pretrained_model_name_or_path` and a configuration JSON file named *config.json* is found in the directory.
@@ -504,6 +504,7 @@ export async function getModelFile(path_or_repo_id, filename, fatal = true, opti
504504
file: filename
505505
})
506506

507+
/** @type {import('./core.js').ProgressInfo} */
507508
const progressInfo = {
508509
status: 'progress',
509510
name: path_or_repo_id,

0 commit comments

Comments
 (0)