diff --git a/source/acuity.js b/source/acuity.js index 9a5440fe2e..c5ed0d8fb7 100644 --- a/source/acuity.js +++ b/source/acuity.js @@ -3,7 +3,7 @@ const acuity = {}; acuity.ModelFactory = class { - match(context) { + async match(context) { const obj = context.peek('json'); if (obj && obj.MetaData && obj.Layers) { context.type = 'acuity'; diff --git a/source/armnn.js b/source/armnn.js index 7a093af237..f0f2a63ea9 100644 --- a/source/armnn.js +++ b/source/armnn.js @@ -3,7 +3,7 @@ const armnn = {}; armnn.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier; const extension = identifier.split('.').pop().toLowerCase(); if (extension === 'armnn') { diff --git a/source/barracuda.js b/source/barracuda.js index 4955676b2d..e46d7a9686 100755 --- a/source/barracuda.js +++ b/source/barracuda.js @@ -5,7 +5,7 @@ const barracuda = {}; barracuda.ModelFactory = class { - match(context) { + async match(context) { const stream = context.stream; if (stream && stream.length > 12) { const buffer = stream.peek(12); diff --git a/source/bigdl.js b/source/bigdl.js index 1ab4eb845e..80f87deee3 100644 --- a/source/bigdl.js +++ b/source/bigdl.js @@ -5,7 +5,7 @@ const bigdl = {}; bigdl.ModelFactory = class { - match(context) { + async match(context) { const tags = context.tags('pb'); if (tags.has(2) && tags.has(7) && tags.has(8) && tags.has(9) && tags.has(10) && tags.has(11) && tags.has(12)) { diff --git a/source/caffe.js b/source/caffe.js index b105a08fcc..ab5619bd54 100644 --- a/source/caffe.js +++ b/source/caffe.js @@ -3,7 +3,7 @@ const caffe = {}; caffe.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier; const extension = identifier.split('.').pop().toLowerCase(); if (extension === 'caffemodel') { diff --git a/source/caffe2.js b/source/caffe2.js index bec0957520..86869d08a5 100644 --- a/source/caffe2.js +++ b/source/caffe2.js @@ -3,7 +3,7 @@ const caffe2 = {}; caffe2.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier.toLowerCase(); const extension = identifier.split('.').pop().toLowerCase(); switch (extension) { diff --git a/source/catboost.js b/source/catboost.js index 3bfbc81fc3..1e8844d588 100644 --- a/source/catboost.js +++ b/source/catboost.js @@ -5,7 +5,7 @@ const catboost = {}; catboost.ModelFactory = class { - match(context) { + async match(context) { const stream = context.stream; if (stream && stream.length > 4) { const buffer = stream.peek(4); diff --git a/source/circle.js b/source/circle.js index 2f501a302f..0cc69b1ebd 100644 --- a/source/circle.js +++ b/source/circle.js @@ -7,7 +7,7 @@ const circle = {}; circle.ModelFactory = class { - match(context) { + async match(context) { const reader = context.peek('flatbuffers.binary'); if (reader && reader.identifier === 'CIR0') { context.type = 'circle.flatbuffers'; diff --git a/source/cntk.js b/source/cntk.js index 2553c42a55..0dc7e34894 100644 --- a/source/cntk.js +++ b/source/cntk.js @@ -3,7 +3,7 @@ const cntk = {}; cntk.ModelFactory = class { - match(context) { + async match(context) { const stream = context.stream; // CNTK v1 const signature = [0x42, 0x00, 0x43, 0x00, 0x4e, 0x00, 0x00, 0x00]; diff --git a/source/coreml.js b/source/coreml.js index 8e91646e89..015102aaca 100644 --- a/source/coreml.js +++ b/source/coreml.js @@ -5,7 +5,7 @@ const coreml = {}; coreml.ModelFactory = class { - match(context) { + async match(context) { const stream = context.stream; const identifier = context.identifier.toLowerCase(); const extension = identifier.split('.').pop().toLowerCase(); diff --git a/source/darknet.js b/source/darknet.js index 1b97e6c3be..eea7ded70e 100644 --- a/source/darknet.js +++ b/source/darknet.js @@ -3,7 +3,7 @@ const darknet = {}; darknet.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier; const extension = identifier.split('.').pop().toLowerCase(); if (extension === 'weights' && !identifier.toLowerCase().endsWith('.espresso.weights')) { diff --git a/source/dl4j.js b/source/dl4j.js index 26f432b1a4..1b60a2ca55 100644 --- a/source/dl4j.js +++ b/source/dl4j.js @@ -5,7 +5,7 @@ const dl4j = {}; dl4j.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier; if (identifier === 'configuration.json') { const obj = context.peek('json'); diff --git a/source/dlc.js b/source/dlc.js index c8567c3e05..6e906a2038 100644 --- a/source/dlc.js +++ b/source/dlc.js @@ -6,7 +6,7 @@ const dlc = {}; dlc.ModelFactory = class { - match(context) { + async match(context) { const container = dlc.Container.open(context); if (container) { context.type = 'dlc'; diff --git a/source/dnn.js b/source/dnn.js index d36d435800..4fbb114024 100644 --- a/source/dnn.js +++ b/source/dnn.js @@ -5,7 +5,7 @@ const dnn = {}; dnn.ModelFactory = class { - match(context) { + async match(context) { const tags = context.tags('pb'); if (tags.get(4) === 0 && tags.get(10) === 2) { context.type = 'dnn'; diff --git a/source/dot.js b/source/dot.js index f71099bbb4..be9356bca7 100644 --- a/source/dot.js +++ b/source/dot.js @@ -3,7 +3,7 @@ const dot = {}; dot.ModelFactory = class { - match(context) { + async match(context) { const reader = context.read('text', 0x10000); if (reader) { try { diff --git a/source/espresso.js b/source/espresso.js index a7e672707d..741339b41b 100644 --- a/source/espresso.js +++ b/source/espresso.js @@ -3,7 +3,7 @@ const espresso = {}; espresso.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier.toLowerCase(); if (identifier.endsWith('.espresso.net')) { const obj = context.peek('json'); diff --git a/source/executorch.js b/source/executorch.js index a74f7aa260..cd73e09634 100644 --- a/source/executorch.js +++ b/source/executorch.js @@ -12,7 +12,7 @@ import * as pytorch from './pytorch.js'; executorch.ModelFactory = class { - match(context) { + async match(context) { const reader = executorch.Reader.open(context); if (reader) { context.type = 'executorch'; @@ -860,7 +860,9 @@ coreml.Reader = class { const folder = path.length === 0 ? '' : `${path.join('/')}/`; const locals = new Map(Array.from(entries).filter(([key]) => key.startsWith(folder)).map(([key, value]) => [key.substring(folder.length), value])); const context = new coreml.Context(this, identifier, value, locals, protobuf); - factory.match(context); + /* eslint-disable no-await-in-loop */ + await factory.match(context); + /* eslint-enable no-await-in-loop */ if (context.type === 'coreml.manifest') { /* eslint-disable no-await-in-loop */ const model = await factory.open(context); diff --git a/source/flax.js b/source/flax.js index 873a5e9835..bd1cdf96ba 100644 --- a/source/flax.js +++ b/source/flax.js @@ -7,7 +7,7 @@ const flax = {}; flax.ModelFactory = class { - match(context) { + async match(context) { const stream = context.stream; if (stream.length > 4) { const buffer = stream.peek(1); diff --git a/source/flux.js b/source/flux.js index 077a9a3220..96f1e8b647 100644 --- a/source/flux.js +++ b/source/flux.js @@ -5,7 +5,7 @@ const flux = {}; flux.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier; const extension = identifier.split('.').pop().toLowerCase(); const stream = context.stream; diff --git a/source/gguf.js b/source/gguf.js index 9901d4527c..1c2227382d 100644 --- a/source/gguf.js +++ b/source/gguf.js @@ -3,7 +3,7 @@ const gguf = {}; gguf.ModelFactory = class { - match(context) { + async match(context) { const reader = gguf.Reader.open(context); if (reader) { context.type = 'gguf'; diff --git a/source/hailo.js b/source/hailo.js index 5d3abc29f4..436de8fe58 100644 --- a/source/hailo.js +++ b/source/hailo.js @@ -4,7 +4,7 @@ const hailo = {}; hailo.ModelFactory = class { - match(context) { + async match(context) { const container = hailo.Container.open(context); if (container) { context.type = container.type; diff --git a/source/hickle.js b/source/hickle.js index ed2d910819..2b22420a20 100644 --- a/source/hickle.js +++ b/source/hickle.js @@ -3,7 +3,7 @@ const hickle = {}; hickle.ModelFactory = class { - match(context) { + async match(context) { const group = context.peek('hdf5'); if (group && group.attributes && group.attributes.get('CLASS') === 'hickle') { context.type = 'hickle'; diff --git a/source/imgdnn.js b/source/imgdnn.js index 4fe7257b94..0565b73e8c 100644 --- a/source/imgdnn.js +++ b/source/imgdnn.js @@ -3,7 +3,7 @@ const imgdnn = {}; imgdnn.ModelFactory = class { - match(context) { + async match(context) { const stream = context.stream; const signature = [0x49, 0x4d, 0x47, 0x44, 0x4e, 0x4e]; // IMGDNN if (stream && stream.length >= signature.length && stream.peek(6).every((value, index) => value === signature[index])) { diff --git a/source/kann.js b/source/kann.js index 66dcae7eb0..58ff325f17 100644 --- a/source/kann.js +++ b/source/kann.js @@ -3,7 +3,7 @@ const kann = {}; kann.ModelFactory = class { - match(context) { + async match(context) { const reader = context.peek('flatbuffers.binary'); if (reader && reader.identifier === 'KaNN') { context.type = 'kann.flatbuffers'; diff --git a/source/keras.js b/source/keras.js index a3c848599d..0162d4973b 100644 --- a/source/keras.js +++ b/source/keras.js @@ -7,7 +7,7 @@ const tfjs = {}; keras.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier; const extension = identifier.split('.').pop().toLowerCase(); const group = context.peek('hdf5'); diff --git a/source/kmodel.js b/source/kmodel.js index ae41577bbb..1e7c9b2190 100644 --- a/source/kmodel.js +++ b/source/kmodel.js @@ -5,7 +5,7 @@ const kmodel = {}; kmodel.ModelFactory = class { - match(context) { + async match(context) { const reader = kmodel.Reader.open(context.stream); if (reader) { context.type = 'kmodel'; diff --git a/source/lasagne.js b/source/lasagne.js index 4fc9f21ba6..c3600cc5d5 100644 --- a/source/lasagne.js +++ b/source/lasagne.js @@ -5,7 +5,7 @@ const lasagne = {}; lasagne.ModelFactory = class { - match(context) { + async match(context) { const obj = context.peek('pkl'); if (obj && obj.__class__ && obj.__class__.__module__ === 'nolearn.lasagne.base' && obj.__class__.__name__ === 'NeuralNet') { context.type = 'lasagne'; diff --git a/source/lightgbm.js b/source/lightgbm.js index 50a977bdc9..8091ce4d73 100644 --- a/source/lightgbm.js +++ b/source/lightgbm.js @@ -5,7 +5,7 @@ const lightgbm = {}; lightgbm.ModelFactory = class { - match(context) { + async match(context) { const stream = context.stream; const signature = [0x74, 0x72, 0x65, 0x65, 0x0A]; if (stream && stream.length >= signature.length && stream.peek(signature.length).every((value, index) => value === signature[index])) { diff --git a/source/mediapipe.js b/source/mediapipe.js index bae3468d47..15e724c746 100644 --- a/source/mediapipe.js +++ b/source/mediapipe.js @@ -5,7 +5,7 @@ const mediapipe = {}; mediapipe.ModelFactory = class { - match(context) { + async match(context) { const tags = context.tags('pbtxt'); if (tags.has('node') && ['input_stream', 'output_stream', 'input_side_packet', 'output_side_packet'].some((key) => tags.has(key) || tags.has(`node.${key}`))) { context.type = 'mediapipe.pbtxt'; diff --git a/source/megengine.js b/source/megengine.js index e50b946669..b7ffaa6bf5 100644 --- a/source/megengine.js +++ b/source/megengine.js @@ -7,7 +7,7 @@ const megengine = {}; megengine.ModelFactory = class { - match(context) { + async match(context) { const stream = context.stream; if (stream && stream.length >= 12) { let buffer = stream.peek(12); diff --git a/source/message.js b/source/message.js index 510b4e0b62..29eb5c00fe 100644 --- a/source/message.js +++ b/source/message.js @@ -5,7 +5,7 @@ const message = {}; message.ModelFactory = class { - match(context) { + async match(context) { const stream = context.stream; if (stream) { const buffer = stream.peek(Math.min(64, stream.length)); diff --git a/source/mlir.js b/source/mlir.js index 06fbea28ff..2305ef0cf2 100644 --- a/source/mlir.js +++ b/source/mlir.js @@ -6,7 +6,7 @@ const mlir = {}; mlir.ModelFactory = class { - match(context) { + async match(context) { const stream = context.stream; if (stream && stream.length > 4) { const buffer = stream.peek(4); diff --git a/source/mlnet.js b/source/mlnet.js index 8e1912985e..7444e1140c 100644 --- a/source/mlnet.js +++ b/source/mlnet.js @@ -7,7 +7,7 @@ const mlnet = {}; mlnet.ModelFactory = class { - match(context) { + async match(context) { const entries = context.peek('zip'); if (entries instanceof Map && entries.size > 0) { const root = new Set(['TransformerChain', 'Predictor']); diff --git a/source/mnn.js b/source/mnn.js index b1b8586de0..da5fcc794f 100644 --- a/source/mnn.js +++ b/source/mnn.js @@ -3,7 +3,7 @@ const mnn = {}; mnn.ModelFactory = class { - match(context) { + async match(context) { const reader = context.peek('flatbuffers.binary'); if (reader) { context.type = 'mnn.flatbuffers'; diff --git a/source/modular.js b/source/modular.js index 3b384243c0..4da6ab21f4 100644 --- a/source/modular.js +++ b/source/modular.js @@ -3,7 +3,7 @@ const modular = {}; modular.ModelFactory = class { - match(context) { + async match(context) { const obj = context.peek('json'); if (obj && obj.signature === "netron:modular") { context.type = 'modular'; diff --git a/source/mslite.js b/source/mslite.js index 63ec0d674b..ddde278bd0 100644 --- a/source/mslite.js +++ b/source/mslite.js @@ -3,7 +3,7 @@ const mslite = {}; mslite.ModelFactory = class { - match(context) { + async match(context) { const extension = context.identifier.split('.').pop().toLowerCase(); const reader = context.peek('flatbuffers.binary'); if (reader) { diff --git a/source/mxnet.js b/source/mxnet.js index 42364af15d..f0ad835581 100644 --- a/source/mxnet.js +++ b/source/mxnet.js @@ -5,7 +5,7 @@ const mxnet = {}; mxnet.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier; const extension = identifier.split('.').pop().toLowerCase(); if (extension === 'json') { diff --git a/source/ncnn.js b/source/ncnn.js index 1d03006bd0..c0716aac7b 100644 --- a/source/ncnn.js +++ b/source/ncnn.js @@ -10,7 +10,7 @@ const pnnx = {}; ncnn.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier.toLowerCase(); if (identifier.endsWith('.param.bin') || identifier.endsWith('.ncnnmodel')) { const stream = context.stream; diff --git a/source/nnabla.js b/source/nnabla.js index 0ddb97d2cc..17c415a1d7 100644 --- a/source/nnabla.js +++ b/source/nnabla.js @@ -3,7 +3,7 @@ const nnabla = {}; nnabla.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier; if (identifier.endsWith('.nntxt')) { const tags = context.tags('pbtxt'); diff --git a/source/nnc.js b/source/nnc.js index 585d418686..ffae2bb26f 100644 --- a/source/nnc.js +++ b/source/nnc.js @@ -3,7 +3,7 @@ const nnc = {}; nnc.ModelFactory = class { - match(context) { + async match(context) { const stream = context.stream; const signatures = [ [0xC0, 0x0F, 0x00, 0x00, 0x45, 0x4E, 0x4E, 0x43], diff --git a/source/nnef.js b/source/nnef.js index 071eafdd10..0843572d95 100644 --- a/source/nnef.js +++ b/source/nnef.js @@ -3,7 +3,7 @@ const nnef = {}; nnef.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier; const extension = identifier.split('.').pop().toLowerCase(); switch (extension) { diff --git a/source/numpy.js b/source/numpy.js index 4753de0584..4527964cb3 100644 --- a/source/numpy.js +++ b/source/numpy.js @@ -7,7 +7,7 @@ const numpy = {}; numpy.ModelFactory = class { - match(context) { + async match(context) { const stream = context.stream; const signature = [0x93, 0x4E, 0x55, 0x4D, 0x50, 0x59]; if (stream && signature.length <= stream.length && stream.peek(signature.length).every((value, index) => value === signature[index])) { diff --git a/source/om.js b/source/om.js index 31c7d813c0..9f0a371c0f 100644 --- a/source/om.js +++ b/source/om.js @@ -9,7 +9,7 @@ const svp = {}; om.ModelFactory = class { - match(context) { + async match(context) { const container = om.Container.open(context); if (container) { context.type = 'om'; diff --git a/source/onednn.js b/source/onednn.js index 85f3e4af50..a12a004cae 100644 --- a/source/onednn.js +++ b/source/onednn.js @@ -3,7 +3,7 @@ const onednn = {}; onednn.ModelFactory = class { - match(context) { + async match(context) { const obj = context.peek('json'); if (obj && obj.version && obj.engine_kind && obj.fpmath_mode && obj.graph) { context.type = 'onednn'; diff --git a/source/onnx.js b/source/onnx.js index e0bff8b606..a974225e6b 100644 --- a/source/onnx.js +++ b/source/onnx.js @@ -5,7 +5,7 @@ const onnx = {}; onnx.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier; const extensions = [ 'saved_model.pb', 'predict_net.pb', 'init_net.pb', diff --git a/source/openvino.js b/source/openvino.js index 8185d269ff..39497de0b2 100644 --- a/source/openvino.js +++ b/source/openvino.js @@ -3,7 +3,7 @@ const openvino = {}; openvino.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier.toLowerCase(); const extension = identifier.split('.').pop(); if (/^.*\.ncnn\.bin$/.test(identifier) || diff --git a/source/paddle.js b/source/paddle.js index b349c8d9bb..87071f69c4 100644 --- a/source/paddle.js +++ b/source/paddle.js @@ -8,7 +8,7 @@ const paddle = {}; paddle.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier; const extension = identifier.split('.').pop().toLowerCase(); if (identifier === '__model__' || extension === '__model__' || extension === 'paddle' || extension === 'pdmodel') { diff --git a/source/pickle.js b/source/pickle.js index 21ab7bc432..fbbb33d20a 100644 --- a/source/pickle.js +++ b/source/pickle.js @@ -5,7 +5,7 @@ const pickle = {}; pickle.ModelFactory = class { - match(context) { + async match(context) { const stream = context.stream; const signature = [0x80, undefined, 0x8a, 0x0a, 0x6c, 0xfc, 0x9c, 0x46, 0xf9, 0x20, 0x6a, 0xa8, 0x50, 0x19]; if (stream && signature.length <= stream.length && stream.peek(signature.length).every((value, index) => signature[index] === undefined || signature[index] === value)) { diff --git a/source/pytorch.js b/source/pytorch.js index 4d5d1c6ba3..8fb86c3ce1 100644 --- a/source/pytorch.js +++ b/source/pytorch.js @@ -10,7 +10,7 @@ const numpy = {}; pytorch.ModelFactory = class { - match(context) { + async match(context) { const container = pytorch.Container.open(context); if (container) { context.type = container.type; diff --git a/source/qnn.js b/source/qnn.js index 5896dcb636..968cea3dbc 100644 --- a/source/qnn.js +++ b/source/qnn.js @@ -5,7 +5,7 @@ const qnn = {}; qnn.ModelFactory = class { - match(context) { + async match(context) { const obj = context.peek('json'); if (obj && obj['model.cpp'] && obj.graph) { context.type = 'qnn.json'; diff --git a/source/rknn.js b/source/rknn.js index 995c1bd458..53714e860a 100644 --- a/source/rknn.js +++ b/source/rknn.js @@ -8,7 +8,7 @@ const openvx = {}; rknn.ModelFactory = class { - match(context) { + async match(context) { const container = rknn.Container.open(context); if (container) { context.type = 'rknn'; diff --git a/source/safetensors.js b/source/safetensors.js index fd75403071..ac9af92dfd 100644 --- a/source/safetensors.js +++ b/source/safetensors.js @@ -5,7 +5,7 @@ const safetensors = {}; safetensors.ModelFactory = class { - match(context) { + async match(context) { const container = safetensors.Container.open(context); if (container) { context.type = 'safetensors'; diff --git a/source/sentencepiece.js b/source/sentencepiece.js index ea34a099c5..fdb52e4e26 100644 --- a/source/sentencepiece.js +++ b/source/sentencepiece.js @@ -3,7 +3,7 @@ const sentencepiece = {}; sentencepiece.ModelFactory = class { - match(context) { + async match(context) { const tags = context.tags('pb'); if ((tags.size >= 3 && tags.size <= 5 && tags.get(1) === 2 && tags.get(2) === 2 && tags.get(3) === 2) && diff --git a/source/sklearn.js b/source/sklearn.js index f60844322a..2440a46f11 100644 --- a/source/sklearn.js +++ b/source/sklearn.js @@ -5,7 +5,7 @@ const sklearn = {}; sklearn.ModelFactory = class { - match(context) { + async match(context) { const obj = context.peek('pkl'); const validate = (obj, name) => { if (obj && obj.__class__ && obj.__class__.__module__ && obj.__class__.__name__) { diff --git a/source/tengine.js b/source/tengine.js index de38a3e3b8..d794297a22 100755 --- a/source/tengine.js +++ b/source/tengine.js @@ -5,7 +5,7 @@ const tengine = {}; tengine.ModelFactory = class { - match(context) { + async match(context) { const reader = tengine.Reader.open(context); if (reader) { context.type = 'tengine'; diff --git a/source/tensorrt.js b/source/tensorrt.js index 8cb2a0f72a..55e5a06a3a 100644 --- a/source/tensorrt.js +++ b/source/tensorrt.js @@ -5,7 +5,7 @@ const tensorrt = {}; tensorrt.ModelFactory = class { - match(context) { + async match(context) { const entries = [ tensorrt.Engine, tensorrt.Container diff --git a/source/tf.js b/source/tf.js index d32d34e11a..e47dea119d 100644 --- a/source/tf.js +++ b/source/tf.js @@ -9,7 +9,7 @@ const tf = {}; tf.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier; const extension = identifier.split('.').pop().toLowerCase(); if (extension === 'pbtxt' || extension === 'prototxt' || extension === 'pt' || extension === 'txt') { diff --git a/source/tflite.js b/source/tflite.js index be7d2a5313..c181e24d57 100644 --- a/source/tflite.js +++ b/source/tflite.js @@ -7,7 +7,7 @@ const tflite = {}; tflite.ModelFactory = class { - match(context) { + async match(context) { const reader = context.peek('flatbuffers.binary'); if (reader && reader.identifier === 'TFL3') { context.type = 'tflite.flatbuffers'; diff --git a/source/tnn.js b/source/tnn.js index 803eb99c81..62ca8ac78f 100644 --- a/source/tnn.js +++ b/source/tnn.js @@ -3,7 +3,7 @@ const tnn = {}; tnn.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier.toLowerCase(); const stream = context.stream; if (stream && identifier.endsWith('.tnnproto')) { diff --git a/source/torch.js b/source/torch.js index 24ecac2082..199302e592 100644 --- a/source/torch.js +++ b/source/torch.js @@ -5,7 +5,7 @@ const torch = {}; torch.ModelFactory = class { - match(context) { + async match(context) { const reader = torch.T7Reader.open(context); if (reader) { context.type = 'torch'; diff --git a/source/tvm.js b/source/tvm.js index f95fb27c24..9c8e9ce85b 100644 --- a/source/tvm.js +++ b/source/tvm.js @@ -3,7 +3,7 @@ const tvm = {}; tvm.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier; const extension = identifier.split('.').pop().toLowerCase(); if (extension === 'json') { diff --git a/source/uff.js b/source/uff.js index 29ce07cb87..7bf6b1f209 100644 --- a/source/uff.js +++ b/source/uff.js @@ -3,7 +3,7 @@ const uff = {}; uff.ModelFactory = class { - match(context) { + async match(context) { const identifier = context.identifier; const extension = identifier.split('.').pop().toLowerCase(); if (extension === 'uff' || extension === 'pb') { diff --git a/source/view.js b/source/view.js index 8577b572fa..0e4b11f5d2 100644 --- a/source/view.js +++ b/source/view.js @@ -6184,8 +6184,8 @@ view.ModelFactoryService = class { for (const module of modules) { /* eslint-disable no-await-in-loop */ const factory = await this._require(module); + await factory.match(context); /* eslint-enable no-await-in-loop */ - factory.match(context); if (context.stream && context.stream.position !== 0) { throw new view.Error('Invalid stream position.'); } @@ -6245,8 +6245,8 @@ view.ModelFactoryService = class { for (const module of modules) { /* eslint-disable no-await-in-loop */ const factory = await this._require(module); + await factory.match(context); /* eslint-enable no-await-in-loop */ - factory.match(context); if (context.stream && context.stream.position !== 0) { throw new view.Error('Invalid stream position.'); } diff --git a/source/weka.js b/source/weka.js index 88d0fb0055..9cb06d139a 100644 --- a/source/weka.js +++ b/source/weka.js @@ -6,7 +6,7 @@ const java = {}; weka.ModelFactory = class { - match(context) { + async match(context) { try { const stream = context.stream; if (stream.length >= 5) { diff --git a/source/xmodel.js b/source/xmodel.js index 1210174a8a..2b50803759 100644 --- a/source/xmodel.js +++ b/source/xmodel.js @@ -3,7 +3,7 @@ const xmodel = {}; xmodel.ModelFactory = class { - match(context) { + async match(context) { const tags = context.tags('pb'); if (tags.get(5) === 2) { context.type = 'xmodel.pb';