Commit Graph

51 Commits

Author SHA1 Message Date
Joshua Lochner 0bf6e6712f [version] Update to 2.12.1 2023-12-18 23:25:00 +02:00
Joshua Lochner 1427125dc3
Update jinja dependency (#459)
* Make `@huggingface/jinja` a dependency

* Update package-lock.json

* Update JSDoc
2023-12-18 23:22:24 +02:00
Joshua Lochner 81aab022ff [version] Update to 2.12.0 2023-12-18 17:04:41 +02:00
Joshua Lochner d4f7cd5024
Add support for chat templates (#408)
* Add basic support for chat templates

* Cleanup

* JSDoc improvements

* Support conversion of user-defined functions

* Cleanup

* Fix function creation

* Add unit tests for templates

* Cleanup

* Improve JSDoc

* Add missing return types

* Add chat templates docs to table of contents

* Add support for logical negation

* Fix nested logical negation

* Add unit tests for logical operators

* Add loop variables

* Add support for `RuntimeValue` built-in functions

* Add unit tests for string instance methods

* Fix conversion of normal function to `FunctionValue`

* Update object method unit tests

* Save chat template to tokenizer_config.json during conversion

* Fix `raise_exception` error

* Add `!=` operator for booleans

* Remember to increment loop index

* Cleanup for loop evaluator

* Use `is` helper function

* Add support for text nodes

i.e., non Jinja statements/expressions

* Add auto-generated templating tests

* Update unit tests

* Remove unused function

* Add default chat templates

* Use repo with up-to-date tokenizer config

* Temporarily disable zephyr test

* Delete templates.test.js

* Move Jinja functionality to `@huggingface/jinja`

* Fix template cache type

* Update chat template unit tests

* Update `@huggingface/jinja` version

* Fix default llama2 system prompt usage

* Add unit test for llama2 w/o chat template set

* Update jinja version

* Update jinja version

* Add unit test for user-defined chat templates

Example from https://discuss.huggingface.co/t/issue-with-llama-2-chat-template-and-out-of-date-documentation/61645/3

* Add `AddedToken` for improved tokenization

* Add example usage for chat templates

* Add 'first' Metaspace pretokenizer prepend scheme

* Formatting

* Update wav2vec2 converter special tokens whitespace split

* Fix Metaspace pretokenizer split criteria

* Update inputs of `PreTokenizerSequence`

* Improve Metaspace pretokenizer

* Update llama tokenizer tests

* Improve handling of legacy llama tokenizer

* Re-enable SPM tests

* Add static tokenizer test cases

* Add llama2 static tests

* Allow user to override legacy tokenizer behaviour in `.from_pretrained`

* Add legacy tokenizer unit tests

* Bump jinja version to 0.1.0
2023-12-18 17:00:50 +02:00
Joshua Lochner 6129e45b2b [version] Update to 2.11.0 2023-12-13 15:19:12 +02:00
Joshua Lochner cb8a5961df [version] Update to 2.10.1 2023-12-06 18:48:41 +02:00
Joshua Lochner 57487744e7 [version] Update to 2.10.0 2023-12-05 15:34:53 +02:00
Joshua Lochner 768a2e26d7 [version] Update to 2.9.0 2023-11-21 14:51:11 +02:00
Joshua Lochner 6fc268cb23
Update sharp dependency version (#400) 2023-11-18 12:58:21 +02:00
Joshua Lochner c98073042f [version] Update to 2.8.0 2023-11-09 18:00:58 +02:00
Kit PANG e457c4b5d0
Upgrade typescript dependency version (#368)
Fix typegen incorrectly outputs const for non-readonly fields
2023-10-24 19:52:24 +02:00
Joshua Lochner d0915294ae [version] Update to 2.7.0 2023-10-23 16:39:27 +02:00
Joshua Lochner 63b4369ccc
Update example app dependencies (#347)
* Update dependency versions

* Update dev dependency versions
2023-10-22 10:26:00 +02:00
Joshua Lochner 5b31129218 [version] Update to 2.6.2 2023-09-27 15:15:09 +02:00
Joshua Lochner b3a2a5b00f [version] Update to 2.6.1 2023-09-18 14:56:06 +02:00
Joshua Lochner ad7e8758bc [version] Update to 2.6.0 2023-09-08 15:41:59 +02:00
Joshua Lochner 0c2dcc7498 [version] Update to 2.5.4 2023-08-28 20:07:06 +02:00
Joshua Lochner 7076c8e401 [version] Update to 2.5.3 2023-08-22 23:31:00 +02:00
Joshua Lochner 254e99ef9a [version] Update to 2.5.2 2023-08-14 22:55:54 +02:00
Joshua Lochner b420a8841e [version] Update to 2.5.1 2023-08-09 22:25:53 +02:00
Joshua Lochner 9aa1a29dac [version] Update to 2.5.0 2023-08-01 14:24:56 +02:00
Joshua Lochner 27920d8483 [version] Update to 2.4.4 2023-07-28 13:28:37 +02:00
Joshua Lochner da67f41434 [version] Update to 2.4.3 2023-07-27 06:06:42 +02:00
Joshua Lochner f181e135d4 [version] Update to 2.4.2 2023-07-22 05:08:12 +02:00
Joshua Lochner 4e947aa657 [version] Update to 2.4.1 2023-07-11 02:12:28 +02:00
Joshua Lochner 86de50d0f2
Whisper word-level timestamps (#184)
* Support outputting attentions in generate function

* Add unit tests for concatenating tensors

* Implement `cat` for `dim>0`

* Add `cat` unit tests for > 2 tensors

* Allow for negative indexing + bounds checking

* Add test case for `cat` with negative indexing

* Clean up `safeIndex` helper function

* Allow indexing error message to include dimension

* Reuse `safeIndex` helper function for `normalize_`

* Optimize `cat` indexing

* Implement `stack` tensor operation

+ add unit tests

* Add TODOs

* Implement `mean` tensor operation

* Implement `std_mean` tensor ops

* Fix order of `std_mean` returns

* Implement median filter

* Implement dynamic time warping

* Implement `neg` tensor op

* Throw error if audio sent to processor is not a `Float32Array`

* Add `round` helper function

* [WIP] Implement basic version of word-level-timestamps

Known issues:
- timestamps not correct for index > 0
- punctuation not same as python version

* Fix typo

* Fix timestamps

* Round to 2 decimals

* Fix punctuation

* Fix typing

* Remove debug statements

* Cleanup code

* Cleanup

* Remove debug statements

* Update JSDoc for extract token timestamps function

* Add return type for `std_mean` tensor function

* Improve typing of private whisper tokenizer functions

* Indicate method is private

* Allow whisper feature extractor to be called with Float64Array input

* Fix typo

* Throw error if `cross_attentions` are not present in model output when extracting token timestamps

* Throw error during generate function

* Allow whisper models to be exported with `output_attentions=True`

* Add alignment heads to generation config

* Remove print statement

* Update versions

* Override protobufjs version

* Update package-lock.json

* Require onnx==1.13.1 for conversion

Will update once onnxruntime-web supports onnx IR version 9

* Add unit test for word-level timestamps

* Extract add attentions function out of `generate`

* Fix `findLongestCommonSequence` return types

* Downgrade back to onnxruntime 1.14.0

1.15.1 is a little to unstable right now.

* Cleanup

- use `.map`
- rename variables

* Update comments

* Add examples for how to transcribe w/ word-level timestamps

* Add example for transcribing/translating audio longer than 30 seconds

* Make example more compact
2023-07-09 23:21:43 +02:00
Joshua Lochner 1563b434bc [version] Update to 2.3.1 2023-07-01 04:15:13 +02:00
Joshua Lochner 8d6622ef9b [version] Update to 2.3.0 2023-06-22 15:36:02 +02:00
Joshua Lochner d90f58110a
Add whisper unit tests (#155)
* Only run encoder with required inputs

* Add basic whisper unit tests

* Add newline after heading for docs

* Add unit test for transcribing english with timestamps

* Add multilingual test case
2023-06-21 23:58:16 +02:00
Joshua Lochner 035f69f79a [version] Update to 2.2.0 2023-06-09 15:18:29 +02:00
Joshua Lochner e5e460bd3b [version] Update to 2.1.1 2023-06-02 02:11:24 +02:00
Joshua Lochner 34b0e8b88f [version] Update to v2.1.0 2023-06-01 14:42:27 +02:00
Joshua Lochner 8b89766034 Update package-lock.json 2023-05-29 12:51:15 +02:00
Joshua Lochner ac23bc5e12 Freeze onnxruntime dependencies (#124)
Their latest version has a few issues, particularly with webgpu, and also uses .wasm files which are incompatible with their previous versions.

So, while those issues are sorted out, it's best to freeze their packages to the latest stable version.
2023-05-29 12:41:52 +02:00
Joshua Lochner 56e0c06580 Update package-lock.json 2023-05-16 19:00:28 +02:00
Joshua Lochner 06db0fe7fd Update package-lock.json 2023-05-02 18:27:22 +02:00
Joshua Lochner 1206827a3b Update dev dependency versions 2023-04-25 01:39:28 +02:00
Joshua Lochner 9bfd126c84 Update package-lock.json 2023-04-17 15:33:53 +02:00
Joshua Lochner 87e121c76e Use `sharp.js` instead of `node-canvas` for resizing images with node.js (Fixes #85)
node-canvas has problems with installation, and doesn't support bilinear/bicubic interpolation.

sharp.js is also much faster: https://github.com/ivanoff/images-manipulation-performance
2023-04-15 22:30:49 +02:00
Joshua Lochner c4c0df5696 Replace `Jimp` with `canvas` for loading images
For the following reasons:
1. Size - Jimp is a large package, making it less suitable for use in the browser. Most of the functions aren't even used by this library.
2. Speed - According to https://github.com/ivanoff/images-manipulation-performance, `node-canvas` is around 9.3x faster than Jimp.
3. `Image` class - Their `Image` class did not support easily converting between colour formats (RGB vs. RGBA vs L), which is needed for mask images (for example).

The main downside is that when resizing, the interpolation method isn't able to be specified (e.g., CLIP using bicubic). We aim to fix this in the future.
2023-04-11 02:09:43 +02:00
Joshua Lochner 328443b573 Update package-lock.json 2023-04-02 21:28:13 +03:00
chelouche9 79c4049795 make ts as dev dep 2023-04-02 21:27:25 +03:00
kungfooman 925f80c983 changes for type-checking and some JSDoc comments 2023-04-02 21:27:25 +03:00
Joshua Lochner 6d1bbc3a14 Add `onnxruntime-node` as an optional dependency 2023-03-22 02:08:24 +02:00
DavidGOrtega 48293d3917 Smart execution providers 2023-03-20 19:28:44 +01:00
Joshua Lochner 5f9edeb948 [Version] Update to v1.2.4 2023-03-15 19:57:04 +02:00
dependabot[bot] 5ac62c76b2
Bump webpack from 5.75.0 to 5.76.0
Bumps [webpack](https://github.com/webpack/webpack) from 5.75.0 to 5.76.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](https://github.com/webpack/webpack/compare/v5.75.0...v5.76.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-03-15 17:46:27 +00:00
Joshua Lochner 2ce528bfcb Update package-lock.json 2023-03-14 14:58:17 +02:00
Joshua Lochner e1c9c345f6 Replace `canvas` with `jimp` for image manipulation 2023-03-12 03:21:22 +02:00
Joshua Lochner 3e6f540ba2 Update package-lock.json 2023-03-11 19:19:14 +02:00