178 Commits

Author SHA1 Message Date
Nico Martin 4e1b4b653f [v4] Restructure repo to use pnpm workspaces (#1504)
* switched to pnpm workspaces

* updated github actions

* added comments

* Update tensor.js

* Formatting

* Update tsconfig.json

* Update tsconfig.json

* fixed circular reference error in pipelines/zero-shot-audio-classification.js

* Post-tsconfig updates

* Move transformers.js docs to package folder

* Move additional tests

* JSDoc update

* Version bumps

* Update incorrect test

* Update test_modeling_musicgen.js

* Update test_modeling_musicgen.js

* Update test_modeling_musicgen.js

* fixed broken symlink

* fixes after review

* Remove old conversion scripts

Users should use onnxruntime-genai or optimum directly

* Update .prettierrc

* Formatting

* Update readme/docs

* Move build scripts to parent folder

* Remove unused tests

* Remove old compare function

* Fix JSDoc

* Update generate.js

* Update inline descriptions

* Bump versions

* Update node imports

* Add module header to FileCache.js

* JSDoc updates

* Update tensor.js

* Move prettier config to package.json key

* Update FileCache.js

* Remove unused import

* Remove non-existent file include

* Prefer non-default exports

* Update doc module exports

* Update docs generation script

* merged tsconfigs and added contributing.md

* Update path_to_docs

* Formatting

* Formatting

* Formatting

* Update prettier usage

* Remove <code> tags from headers

* Swap docs-preview and docs-build commands

* ONNXRUNTIME_NODE_INSTALL=skip for doc-builder

* Update buildAll.mjs

* Update index

---------

Co-authored-by: Joshua Lochner <26504141+xenova@users.noreply.github.com>
2026-01-28 22:34:29 -05:00
Nico Martin 760cc66585 [v4] Switch build system to esbuild (#1466)
* added esuild

* fixed stream and stream/promises import

* changes after review

* Delete webpack.config.js

* Bump esbuild version

---------

Co-authored-by: Joshua Lochner <26504141+xenova@users.noreply.github.com>
2025-12-23 10:38:13 -05:00
Joshua Lochner c6b7edfdac Upgrade to new WebGPU EP
* ONNX Runtime improvements (experimental native webgpu; fix iOS) (#1231)

* customize the wasm paths

* update implementation

* allow using 'webgpu' in nodejs binding

* update version of onnxruntime-node

* Upgrade onnxruntime-web to same version as onnxruntime-node

* Update list of supported devices

---------

Co-authored-by: Joshua Lochner <26504141+xenova@users.noreply.github.com>

* customize the wasm paths (#1250)

* customize the wasm paths

* update implementation

* [internal] Add is_decoder option to session retrieval for preferred output location

* Update tests

* Formatting

* Bump ort versions

* Bump onnxruntime-node version

* Bump versions

* Bump ORT versions

* Bump versions

* Only check webgpu fp16 for non-node environments

* Fix

* Assume node supports webgpu

* Update ORT node support comment

* Relax test strictness

* Update conversion script versions

* Downgrade onnxslim

* cleanup

* Update package-lock.json

* Update onnxruntime versions

* Update post-build script

* Use built-in session release function

* Call garbage collection after each tokenizer test

* Do not double-throw error

* Fix race-condition in build process with file removal

* Update versions

* Bump jinja version

* [version] Update to 3.6.3

* Bump jinja version to support new features

* [version] Update to 3.6.3

* Add support for LFM2 models (#1367)

* Use prefix in lfm2 output location (#1369)

* Update package-lock.json

* Run `npm audit fix`

* Add special tokens in text-generation pipeline if tokenizer requires (#1370)

* Add special tokens in text-generation pipeline if tokenizer requires

* Fix logits processors tests

* Update bundles.test.js

* Update comment

* Formatting

* Add support for ModernBERT Decoder (#1371)

* Use from/to buffer instead of string

Actually fixes https://github.com/huggingface/transformers.js/issues/1343

* Add support for Voxtral (#1373)

* Support longform voxtral processing (#1375)

* [version] Update to 3.7.0

* Add support for Arcee (#1377)

* Optimize tensor.slice() (#1381)

* Optimize tensor.slice()

The performance of executing `tensor.slice()` is super poor, especially for
the 'logits' tensor with large dimensions.

```
const logits = outputs.logits.slice(null, -1, null);`
```

This is because currently implementation of the `slice` method manually iterates
through each element and calculate indices which is a big time consuming if
the tensor shape is large.

For cases like `slice(null, -1, null)`, where the slicing operation is
contiguous along certain dimensions, which can be optimized by bulk copy
by using `TypeArray.subarray()` and `TypeArray.set()`.

* nit

* Add a few more tensor slice unit tests

---------

Co-authored-by: Joshua Lochner <26504141+xenova@users.noreply.github.com>

---------

Co-authored-by: Yulong Wang <7679871+fs-eire@users.noreply.github.com>
Co-authored-by: Wanming Lin <wanming.lin@intel.com>
2025-07-30 17:57:03 -04:00
fidoriel b1a8389285 Pin numpy version for quantization scripts (#1351)
* Pin numpy version for scripts

* Pin to `numpy==2.2.6`

---------

Co-authored-by: Joshua Lochner <admin@xenova.com>
2025-07-01 23:41:19 -04:00
Joshua Lochner c1e0ed351a Optimize encoder-decoder exports (including Whisper) (#1218)
* Use non-buggy onnx-graphsurgeon via onnxslim for toposort

* fp16 conversion improvements

* Formatting

* Remove unnecessary lines
2025-03-05 17:47:48 +02:00
Joshua Lochner 8bef102856 Update conversion script versions (#1204)
* Update conversion script versions

* Use custom float16 converter script

* Add MIT license header

* Use relative import

* Fix transformers to stable 4.48.x branch

* Add strictness check when saving model

* Create new output nodes after casts

* Use onnxslim after fp16 conversion

* Prevent in-place modification while iterating (infinite loops)

* Finalize fp16 quantization script

* Only warn if alignment heads can't be found
2025-02-26 14:05:03 +02:00
Joshua Lochner 11db949c5d Add support for idefics3 (SmolVLM) (#1059)
* [WIP] Add support for idefics3 (SmolVLM)

* Cleanup

* Update `DataTypeMap` with 4-bit data types

* Format the model inputs before logging to console

* Use QUInt8 when quantizing models produced by onnxruntime-genai

* `auto` dtype selection

* Export `load_image` helper function

* Add listed support for Idefics3

* Add support for batched 2d images in idefics3 processor

* Update unit tests

* Add another unit test to ensure correctness of pixel attention mask placement

* Move image tokens out of call function

* Formatting

* Improve auto selection logic

* Return correct pixel_attention_mask

* Update pixel_attention_mask unit test

* Formatting

* Add idefics3 unit tests

* Increase idefics processor unit test timeout
2024-12-03 00:05:23 +02:00
Joshua Lochner e848907e54 Add new models (Janus, Qwen2-VL, JinaCLIP, LLaVA-OneVision, ViTPose, MGP-STR) & refactor processors. (#1001)
* Extract processor classes into separate folders

* Fix typo

* Define which classes use `processor_config.json`

* [WIP] Add support for `deepseek-ai/Janus-1.3B`

* Fix unit tests

* Remove redundant `extends` JSDoc

* Fix JSDoc

* Update Janus JSDoc

* Improve `VLChatProcessor` processor types

* Expose ImageFeatureExtractor as copy of ImageProcessor

* Add support for `LLaVA-OneVision`

* Add support for ViTPose

* Add ViTPose to README

* Bump dependencies

* Add support for `MGP-STR` models

* Documentation fixes

* Add support for `Qwen2VLImageProcessor`

* Format tests folder

* Use `AutoImageProcessor` for image processors

* Add support for `Qwen2VLProcessor`

* Fix `image_grid_thw` dtype

* Fix bigint product

* [WIP] Support for qwen2vl models

* Add support for JinaCLIP models

* Add listed support for Janus

* Fix qwen2vl processor unit test

* Update dependency versions

* Export logits processors

* Expose batch_decode for processor

* Qwen2VL - Implement `get_rope_index`

* Add `Qwen2VLForConditionalGeneration` unit tests

* Update dependencies

* Update `onnxslim==0.1.42`

* `tokenizer.default_chat_template` has been removed

* Add listed support for Qwen2-VL

* Fix `.from_pretrained` function type
2024-11-26 18:06:33 +02:00
Paul Dufour 5272b124ad Add support for --op_block_list in quantization script (#1036)
* Add support for op_block_list

* Remove arg

* Set default to none

* Minor code suggestions

* whoops - actually apply suggestions

---------

Co-authored-by: Joshua Lochner <admin@xenova.com>
2024-11-25 23:48:55 +02:00
Joshua Lochner ed94f6bd1a Add support for OLMo models (#1011)
* Add support for OLMo models

* Update conversion script versions

* Bump jest version

* Fix granite unit test
2024-11-04 09:22:43 +02:00
bekzod 6bd45ac66a Remove duplicate gemma value from NO_PER_CHANNEL_REDUCE_RANGE_MODELS set (#1005)
Co-authored-by: Joshua Lochner <admin@xenova.com>
2024-11-01 11:09:15 +02:00
Joshua Lochner bf1412ee7c Add support for MobileLLM (#1003) 2024-11-01 11:07:35 +02:00
Joshua Lochner 8b0d330a70 Remove in-library list of supported models 2024-10-09 13:26:45 +00:00
Joshua Lochner a32efa3d07 Add whisper turbo alignment heads 2024-10-09 11:55:05 +00:00
Joshua Lochner 4f17e954b3 Merge branch 'main' into v3 2024-09-09 16:57:23 +00:00
Joshua Lochner ba58ea2423 Bump onnxruntime==1.19.2 in scripts/requirements.txt 2024-09-09 16:35:38 +00:00
Joshua Lochner ba5d7252ff Wrap onnxslim with try block 2024-09-02 12:23:42 +00:00
Joshua Lochner 844099df2c Add library_name option to convert.py 2024-09-02 10:29:36 +00:00
Joshua Lochner bf093aec74 Fix scripts/requirements.txt 2024-08-28 10:58:05 +00:00
Joshua Lochner 1b7f9789af Topologically sort fp16 nodes 2024-08-27 18:18:45 +02:00
Joshua Lochner 83f57181ec Downgrade onnxconverter-common 2024-08-09 00:46:45 +00:00
Joshua Lochner 12569b8fb7 Consolidate conversion and quantization script 2024-08-09 00:02:28 +00:00
Joshua Lochner 974f086222 Separate IO and Quantization args 2024-07-12 09:10:15 +00:00
Joshua Lochner 9787b75aa1 Update converstion script requirements 2024-07-12 08:48:57 +00:00
Joshua Lochner 9ef3a6d01a Reload model for each quantization mode 2024-07-12 08:46:31 +00:00
Joshua Lochner cd1ea697c7 correct attribute 2024-07-04 11:59:46 +00:00
Joshua Lochner 04a334a5cc Fix q8 quantization for models > 2GB 2024-07-04 11:51:56 +00:00
Joshua Lochner b411e9fd8c Remove debug log 2024-07-04 11:14:38 +00:00
Joshua Lochner 23440f0078 formatting 2024-07-04 11:13:59 +00:00
Joshua Lochner 88f3e4419c Reorder functions 2024-07-04 11:11:41 +00:00
Joshua Lochner 45cd8d4d84 Use check_and_save_model for saving fp16 model 2024-07-04 11:07:55 +00:00
Joshua Lochner c835b54399 fp16 disable_shape_infer if model is too large 2024-07-04 10:56:44 +00:00
Joshua Lochner 83cbb218d5 save q4 quantization 2024-07-04 00:39:57 +00:00
Joshua Lochner 912865177e Fix q4 quantization 2024-07-03 22:22:13 +00:00
Joshua Lochner 04af3d578a update deps 2024-07-03 22:22:01 +00:00
Joshua Lochner dd6af93f68 Move quantization logic to quantize.py 2024-07-03 17:47:31 +00:00
Joshua Lochner 14a2990a88 Improve custom whisper ONNX config 2024-07-02 10:03:11 +02:00
Joshua Lochner 0b5469b10d Fix custom whisper configs 2024-07-02 03:09:50 +02:00
Joshua Lochner fc34517091 Add support for decision transformer (#795)
* Add support for decision transformer (Closes #794)

* Comment out supported decision transformer models

Models are in the `onnx-community` org on HF
2024-07-01 10:27:37 +02:00
Joshua Lochner af37e87718 Update onnxslim version 2024-06-22 17:53:22 +02:00
inisis e8cfaf6444 add onnxslim intergration (#811)
* add onnxslim intergration

* fix onnxslim version
2024-06-22 17:48:34 +02:00
Joshua Lochner 4d92c7f12e Minor conversion script improvements 2024-06-22 17:44:43 +02:00
Joshua Lochner 9a326eb2a7 Merge branch 'main' into v3 2024-05-30 13:30:19 +02:00
Joshua Lochner e50f5686a2 Add support for FastViT (#749)
* Add support for FastViT

* Comment out list of timm models
2024-05-23 01:47:16 +02:00
Joshua Lochner 5bae02d0a5 Add support for gemma models 2024-05-17 23:18:21 +02:00
Joshua Lochner 3260640b19 Add support for moondream1 models 2024-05-13 04:32:01 +02:00
Joshua Lochner da2ef152d0 Remove legacy flag for exports 2024-05-04 15:24:53 +02:00
Joshua Lochner f7fb8a80be Set use_past_in_inputs if exporting custom text-generation model 2024-05-04 14:49:30 +02:00
Joshua Lochner 374806bc79 Add support for OpenELM models 2024-05-03 11:35:42 +02:00
Joshua Lochner 7122a0a5a1 Add mobilevitv2 (#721)
* Add support for MobileViTV2

* Update supported_models.py

* Add support for `do_flip_channel_order`

* Add unit test for `do_flip_channel_order=true`
2024-05-02 11:42:44 +02:00