Skip to content

Commit

Permalink
Update view.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed Feb 8, 2025
1 parent 4f35233 commit b4feb4a
Show file tree
Hide file tree
Showing 65 changed files with 69 additions and 67 deletions.
2 changes: 1 addition & 1 deletion source/acuity.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion source/armnn.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
2 changes: 1 addition & 1 deletion source/barracuda.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion source/bigdl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion source/caffe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
2 changes: 1 addition & 1 deletion source/caffe2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion source/catboost.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion source/circle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion source/cntk.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion source/coreml.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion source/darknet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down
2 changes: 1 addition & 1 deletion source/dl4j.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion source/dlc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion source/dnn.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion source/dot.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const dot = {};

dot.ModelFactory = class {

match(context) {
async match(context) {
const reader = context.read('text', 0x10000);
if (reader) {
try {
Expand Down
2 changes: 1 addition & 1 deletion source/espresso.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
6 changes: 4 additions & 2 deletions source/executorch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion source/flax.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion source/flux.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion source/gguf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion source/hailo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion source/hickle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion source/imgdnn.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])) {
Expand Down
2 changes: 1 addition & 1 deletion source/kann.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion source/keras.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion source/kmodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion source/lasagne.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion source/lightgbm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])) {
Expand Down
2 changes: 1 addition & 1 deletion source/mediapipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion source/megengine.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion source/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion source/mlir.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion source/mlnet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down
2 changes: 1 addition & 1 deletion source/mnn.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion source/modular.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion source/mslite.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion source/mxnet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
2 changes: 1 addition & 1 deletion source/ncnn.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion source/nnabla.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion source/nnc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion source/nnef.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion source/numpy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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])) {
Expand Down
2 changes: 1 addition & 1 deletion source/om.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Loading

0 comments on commit b4feb4a

Please sign in to comment.